@@ -206,7 +206,7 @@ private function archiveToCitizen(string $submissionId, array $handlerConfigurat
206206 $ parentCaseCount = count ($ caseInfo );
207207
208208 if (0 === $ parentCaseCount ) {
209- $ parentCaseId = $ this ->createCitizenCase ($ cprElementValue , $ cprNameElementValue );
209+ $ parentCaseId = $ this ->createCitizenCase ($ cprElementValue , $ cprNameElementValue, $ submission -> getWebform ()-> id () );
210210 }
211211 elseif (1 < $ parentCaseCount ) {
212212 $ message = sprintf ('Too many (%d) parent cases. ' , $ parentCaseCount );
@@ -248,7 +248,7 @@ private function archiveToCitizen(string $submissionId, array $handlerConfigurat
248248 $ subCaseCount = count ($ subCases ['CasesInfo ' ]);
249249
250250 if (0 === $ subCaseCount ) {
251- $ subCaseId = $ this ->createSubCase ($ parentCaseId , $ subcaseName );
251+ $ subCaseId = $ this ->createSubCase ($ parentCaseId , $ subcaseName, $ submission -> getWebform ()-> id () );
252252 }
253253 elseif (1 === $ subCaseCount ) {
254254 $ subCaseId = $ subCases ['CasesInfo ' ][0 ]['CaseID ' ];
@@ -269,7 +269,7 @@ private function archiveToCitizen(string $submissionId, array $handlerConfigurat
269269 /**
270270 * Creates citizen parent case in GetOrganized.
271271 */
272- private function createCitizenCase (string $ cprElementValue , string $ cprNameElementValue ): string {
272+ private function createCitizenCase (string $ cprElementValue , string $ cprNameElementValue, string $ webformId ): string {
273273
274274 $ metadataArray = [
275275 'ows_Title ' => $ cprElementValue . ' - ' . $ cprNameElementValue ,
@@ -290,7 +290,7 @@ private function createCitizenCase(string $cprElementValue, string $cprNameEleme
290290 // {"CaseID":"BOR-2022-000046","CaseRelativeUrl":"\/cases\/BOR12\/BOR-2022-000046",...}.
291291 $ caseId = $ response ['CaseID ' ];
292292
293- $ msg = sprintf ('Created GetOrganized case %s ' , $ caseId );
293+ $ msg = sprintf ('Created GetOrganized case %s. Webform id %s. ' , $ caseId, $ webformId );
294294 $ this ->auditLogger ->info ('GetOrganized ' , $ msg );
295295
296296 return $ caseId ;
@@ -299,7 +299,7 @@ private function createCitizenCase(string $cprElementValue, string $cprNameEleme
299299 /**
300300 * Creates citizen subcase in GetOrganized.
301301 */
302- private function createSubCase (string $ caseId , string $ caseName ): string {
302+ private function createSubCase (string $ caseId , string $ caseName, string $ webformId ): string {
303303 $ metadataArray = [
304304 'ows_Title ' => $ caseName ,
305305 'ows_CCMParentCase ' => $ caseId ,
@@ -315,7 +315,7 @@ private function createSubCase(string $caseId, string $caseName): string {
315315 // {"CaseID":"BOR-2022-000046-001","CaseRelativeUrl":"\/cases\/BOR12\/BOR-2022-000046",...}.
316316 $ caseId = $ response ['CaseID ' ];
317317
318- $ msg = sprintf ('Created GetOrganized case %s ' , $ caseId );
318+ $ msg = sprintf ('Created GetOrganized case %s. Webform id %s. ' , $ caseId, $ webformId );
319319 $ this ->auditLogger ->info ('GetOrganized ' , $ msg );
320320
321321 return $ caseId ;
@@ -347,7 +347,7 @@ private function uploadDocumentToCase(string $caseId, string $webformAttachmentE
347347
348348 $ getOrganizedFilename = $ this ->sanitizeFilename ($ getOrganizedFilename );
349349
350- $ parentDocumentId = $ this ->archiveDocumentToGetOrganizedCase ($ caseId , $ getOrganizedFilename , $ fileContent );
350+ $ parentDocumentId = $ this ->archiveDocumentToGetOrganizedCase ($ caseId , $ getOrganizedFilename , $ fileContent, $ submission -> getWebform ()-> id () );
351351
352352 $ documentIdsForFinalizing [] = $ parentDocumentId ;
353353
@@ -368,7 +368,7 @@ private function uploadDocumentToCase(string $caseId, string $webformAttachmentE
368368
369369 $ fileContent = file_get_contents ($ file ->getFileUri ());
370370
371- $ childDocumentId = $ this ->archiveDocumentToGetOrganizedCase ($ caseId , $ getOrganizedFilename , $ fileContent );
371+ $ childDocumentId = $ this ->archiveDocumentToGetOrganizedCase ($ caseId , $ getOrganizedFilename , $ fileContent, $ submission -> getWebform ()-> id () );
372372
373373 $ childDocumentIds [] = $ childDocumentId ;
374374 }
@@ -378,15 +378,15 @@ private function uploadDocumentToCase(string $caseId, string $webformAttachmentE
378378 if (!empty ($ childDocumentIds )) {
379379 $ this ->documentService ->RelateDocuments ($ parentDocumentId , $ childDocumentIds , 1 );
380380
381- $ msg = sprintf ('Added relation between document %s and documents %s ' , $ parentDocumentId , implode (', ' , $ childDocumentIds ));
381+ $ msg = sprintf ('Added relation between document %s and documents %s. Webform id %s. ' , $ parentDocumentId , implode (', ' , $ childDocumentIds), $ submission -> getWebform ()-> id ( ));
382382 $ this ->auditLogger ->info ('GetOrganized ' , $ msg );
383383 }
384384 }
385385
386386 if ($ shouldBeFinalized ) {
387387 $ this ->documentService ->FinalizeMultiple ($ documentIdsForFinalizing );
388388
389- $ msg = sprintf ('Finalized documents %s ' , implode (', ' , $ documentIdsForFinalizing ));
389+ $ msg = sprintf ('Finalized documents %s. Webform id %s. ' , implode (', ' , $ documentIdsForFinalizing), $ submission -> getWebform ()-> id ( ));
390390 $ this ->auditLogger ->info ('GetOrganized ' , $ msg );
391391 }
392392 }
@@ -410,7 +410,7 @@ private function getAvailableElementsByType(string $type, array $elements): arra
410410 /**
411411 * Archives file content to GetOrganized case.
412412 */
413- private function archiveDocumentToGetOrganizedCase (string $ caseId , string $ getOrganizedFileName , string $ fileContent ): int {
413+ private function archiveDocumentToGetOrganizedCase (string $ caseId , string $ getOrganizedFileName , string $ fileContent, string $ webformId ): int {
414414 $ tempFile = tempnam ('/tmp ' , $ caseId . '- ' . uniqid ());
415415
416416 try {
@@ -428,7 +428,7 @@ private function archiveDocumentToGetOrganizedCase(string $caseId, string $getOr
428428 unlink ($ tempFile );
429429 }
430430
431- $ msg = sprintf ('Archived document %s to GetOrganized case %s ' , $ getOrganizedFileName , $ caseId );
431+ $ msg = sprintf ('Archived document %s to GetOrganized case %s. Webform id %s. ' , $ getOrganizedFileName , $ caseId, $ webformId );
432432 $ this ->auditLogger ->info ('GetOrganized ' , $ msg );
433433
434434 return (int ) $ documentId ;
0 commit comments