Skip to content

Commit

Permalink
Merge pull request #18 from itk-dev/feature/DW-271-create-case-and-su…
Browse files Browse the repository at this point in the history
…b-case

DW-271: Added methods for creating parent and sub case
  • Loading branch information
jekuaitk authored Sep 15, 2022
2 parents 6e950bc + 08ba434 commit 258f852
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 4 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"require": {
"php": "^7.4 || ^8.0",
"ext-json": "*",
"symfony/http-client": "^5.4 || ^6.0"
"symfony/http-client": "^5.4 || ^6.0",
"ext-dom": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.7",
Expand Down
55 changes: 53 additions & 2 deletions src/Service/Cases.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ public function FindCases(array $query)
}

/**
* Example query:.
* Finds cases by properties.
*
* Example query:
* $query = [
* 'FieldProperties' => [
* [
Expand All @@ -63,7 +64,7 @@ public function FindCases(array $query)
* ],
* ],
* 'CaseTypePrefixes' => ['GEO'],
* ]
* ];
*/
public function FindByCaseProperties(array $query): array
{
Expand Down Expand Up @@ -96,4 +97,54 @@ public function getByCaseId(string $caseId, string $caseTypePrefix = null): ?arr

return $cases['CasesInfo'][0] ?? null;
}

/**
* Creates case.
*
* Example data:
* $data = [
* 'CaseTypePrefix' => 'BOR',
* 'MetadataXml' =>
* "<z:row xmlns:z=\"#RowsetSchema\"
* ows_Title=\"0123456789 - Test borger\"
* ows_CCMContactData=\"Test borger;#;#0123456789;#;#\"
* ows_CCMContactData_CPR=\"0123456789\"
* ows_CaseStatus=\"Åben\"
* />",
* 'ReturnWhenCaseFullyCreated' => true,
* ];
*/
public function CreateCase(array $data): ?array
{
return $this->getData(
'POST',
$this->getApiBasePath(),
['json' => $data],
);
}

/**
* Creates SubCase.
*
* Example data:
* $data = [
* 'CaseTypePrefix' => 'BOR',
* 'MetadataXml' =>
* "<z:row xmlns:z=\"#RowsetSchema\"
* ows_Title=\"Undersag - test\"
* ows_CCMParentCase=\"BOR-2022-000038\"
* ows_ContentTypeId=\"0x0100512AABDB08FA4fadB4A10948B5A56C7C01\"
* ows_CCMContactData_CPR=\"0123456789\"
* ows_CaseStatus=\"Åben\"/>",
* 'ReturnWhenCaseFullyCreated' => true,
* ];
*/
public function CreateSubCase(array $data): ?array
{
return $this->getData(
'POST',
$this->getApiBasePath(),
['json' => $data],
);
}
}
2 changes: 1 addition & 1 deletion src/Service/Documents.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public function AddToCaseSOAP(string $filePath, string $caseId, string $fileName
</soap12:Body>
</soap12:Envelope>
XML
);
);

$sxe->registerXPathNamespace('soap12', 'http://www.w3.org/2003/05/soap-envelope');
$sxe->registerXPathNamespace('netcompany', 'http://netcompany.com/ncsolutions/ccm/webservices');
Expand Down

0 comments on commit 258f852

Please sign in to comment.