1111use OWC \Zaaksysteem \Resolvers \ContainerResolver ;
1212use OWC \Zaaksysteem \Traits \CheckURL ;
1313use OWC \Zaaksysteem \Traits \InformationObject ;
14+ use OWC \Zaaksysteem \Traits \MergeTags ;
1415
1516abstract class AbstractCreateUploadedDocumentsAction
1617{
1718 use CheckURL;
1819 use InformationObject;
20+ use MergeTags;
1921
2022 public const CLIENT_NAME = '' ;
2123
@@ -77,7 +79,7 @@ protected function mapInformationObjectArg(array $args, GF_Field $field, $fieldV
7779
7880 if (is_string ($ fieldValue )) {
7981 $ fieldValue = [
80- ['type ' => $ field ->linkedFieldValueDocumentType , 'url ' => $ fieldValue ],
82+ ['type ' => $ field ->linkedFieldValueDocumentType , 'url ' => $ fieldValue, ' description ' => $ field -> linkedUploadFieldDescriptionValueZGW ?? '' ],
8183 ];
8284 }
8385
@@ -107,7 +109,7 @@ protected function convertInformationObjectFieldJSON(string $fieldValue, $field)
107109 }
108110
109111 return array_map (function ($ fieldValue ) use ($ field ) {
110- return ['type ' => $ field ->linkedFieldValueDocumentType , 'url ' => $ fieldValue ];
112+ return ['type ' => $ field ->linkedFieldValueDocumentType , 'url ' => $ fieldValue, ' description ' => $ field -> linkedUploadFieldDescriptionValueZGW ?? '' ];
111113 }, $ fieldValues );
112114 }
113115
@@ -132,7 +134,7 @@ protected function connectZaakToInformationObject(?Enkelvoudiginformatieobject $
132134 return $ this ->client ->zaakinformatieobjecten ()->create (new Zaakinformatieobject ($ object ->toArray (), $ this ->client ->getClientName (), $ this ->client ->getClientNamePretty ())); // What to do when this one fails?
133135 }
134136
135- protected function prepareInformationObjectArgs (string $ objectURL , string $ informationObjectType ): array
137+ protected function prepareInformationObjectArgs (string $ objectURL , string $ informationObjectType, string $ objectDescription ): array
136138 {
137139 if (empty ($ informationObjectType )) {
138140 return [];
@@ -147,6 +149,7 @@ protected function prepareInformationObjectArgs(string $objectURL, string $infor
147149 $ args ['formaat ' ] = $ this ->getContentType ($ objectURL );
148150 $ args ['bestandsnaam ' ] = sprintf ('%s.%s ' , \sanitize_title ($ fileName ), $ this ->getExtension ($ objectURL ));
149151 $ args ['bestandsomvang ' ] = $ bestandsomvang ? (int ) $ bestandsomvang : strlen ($ inhoud );
152+ $ args ['beschrijving ' ] = 0 < strlen ($ objectDescription ) ? $ this ->handleMergeTags ($ this ->entry , $ objectDescription ) : $ fileName ;
150153 $ args ['inhoud ' ] = $ inhoud ;
151154 $ args ['vertrouwelijkheidaanduiding ' ] = 'vertrouwelijk ' ;
152155 $ args ['auteur ' ] = 'OWC ' ;
@@ -156,6 +159,8 @@ protected function prepareInformationObjectArgs(string $objectURL, string $infor
156159 $ args ['creatiedatum ' ] = date ('Y-m-d ' );
157160 $ args ['informatieobjecttype ' ] = $ informationObjectType ;
158161
162+ dd ($ args );
163+
159164 return $ args ;
160165 }
161166
0 commit comments