-
-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20238 from colemanw/civiCaseSave
APIv4 - CiviCase API: Fix openening a case with current user as creator
- Loading branch information
Showing
12 changed files
with
130 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"CaseType": [ | ||
{ | ||
"name": "test_case_type", | ||
"title": "Test Case Type", | ||
"definition": { | ||
"activityTypes": [ | ||
{ | ||
"name": "Open Case", | ||
"max_instances": "1" | ||
}, | ||
{ | ||
"name": "Follow up" | ||
} | ||
], | ||
"activitySets": [ | ||
{ | ||
"name": "standard_timeline", | ||
"label": "Standard Timeline", | ||
"timeline": 1, | ||
"activityTypes": [ | ||
{ | ||
"name": "Open Case", | ||
"status": "Completed" | ||
}, | ||
{ | ||
"name": "Follow up", | ||
"reference_activity": "Open Case", | ||
"reference_offset": "3", | ||
"reference_select": "newest" | ||
} | ||
] | ||
} | ||
], | ||
"timelineActivityTypes": [ | ||
{ | ||
"name": "Open Case", | ||
"status": "Completed" | ||
}, | ||
{ | ||
"name": "Follow up", | ||
"reference_activity": "Open Case", | ||
"reference_offset": "3", | ||
"reference_select": "newest" | ||
} | ||
], | ||
"caseRoles": [ | ||
{ | ||
"name": "Parent of", | ||
"creator": "1", | ||
"manager": "1" | ||
} | ||
] | ||
}, | ||
"@ref": "test_case_type_1" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
/* | ||
+--------------------------------------------------------------------+ | ||
| Copyright CiviCRM LLC. All rights reserved. | | ||
| | | ||
| This work is published under the GNU AGPLv3 license with some | | ||
| permitted exceptions and without any warranty. For full license | | ||
| and copyright information, see https://civicrm.org/licensing | | ||
+--------------------------------------------------------------------+ | ||
*/ | ||
|
||
/** | ||
* | ||
* @package CRM | ||
* @copyright CiviCRM LLC https://civicrm.org/licensing | ||
*/ | ||
|
||
|
||
namespace api\v4\Entity; | ||
|
||
use Civi\Api4\CiviCase; | ||
use api\v4\UnitTestCase; | ||
|
||
/** | ||
* @group headless | ||
*/ | ||
class CaseTest extends UnitTestCase { | ||
|
||
public function setUp() { | ||
parent::setUp(); | ||
\CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase'); | ||
$this->loadDataSet('CaseType'); | ||
} | ||
|
||
public function testCreateUsingLoggedInUser() { | ||
$this->createLoggedInUser(); | ||
|
||
$contactID = $this->createEntity(['type' => 'Individual'])['id']; | ||
|
||
$result = CiviCase::create(FALSE) | ||
->addValue('case_type_id', $this->getReference('test_case_type_1')['id']) | ||
->addValue('creator_id', 'user_contact_id') | ||
->addValue('status_id', 1) | ||
->addValue('contact_id', $contactID) | ||
->execute() | ||
->first(); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters