diff --git a/src/app/resource/controllers/SummarySheetController.php b/src/app/resource/controllers/SummarySheetController.php index 0b9b074148a90522c8462a129ba298fdeeb33cbe..a03f91719f5dea61aacd6d1a38cab2456575d7f3 100644 --- a/src/app/resource/controllers/SummarySheetController.php +++ b/src/app/resource/controllers/SummarySheetController.php @@ -16,6 +16,7 @@ namespace Resource\controllers; use Basket\models\BasketModel; use Contact\models\ContactModel; +use Endroid\QrCode\QrCode; use Entity\models\EntityModel; use Entity\models\ListInstanceModel; use Note\models\NoteEntityModel; @@ -36,11 +37,6 @@ use SrcCore\models\ValidatorModel; use Status\models\StatusModel; use User\models\UserModel; -use Endroid\QrCode\ErrorCorrectionLevel; -use Endroid\QrCode\LabelAlignment; -use Endroid\QrCode\QrCode; -use Endroid\QrCode\Response\QrCodeResponse; - class SummarySheetController { public function createList(Request $request, Response $response, array $aArgs) @@ -60,6 +56,7 @@ class SummarySheetController return $response->withStatus(403)->withJson(['errors' => 'Resources is not set or empty']); } + $bodyData['resources'] = array_slice($bodyData['resources'], 0, 500); $basket = BasketModel::getById(['id' => $aArgs['basketId'], 'select' => ['basket_clause', 'basket_res_order', 'basket_name']]); $user = UserModel::getById(['id' => $aArgs['userId'], 'select' => ['user_id']]); @@ -157,8 +154,6 @@ class SummarySheetController } } - // End of data - foreach ($resources as $resource) { SummarySheetController::createSummarySheet($pdf, ['resource' => $resource, 'units' => $units, 'login' => $GLOBALS['userId'], 'data' => $data]); } @@ -175,8 +170,8 @@ class SummarySheetController private static function createSummarySheet(Fpdi $pdf, array $args) { - ValidatorModel::notEmpty($args, ['resource', 'login', 'data']); - ValidatorModel::arrayType($args, ['resource', 'units']); + ValidatorModel::notEmpty($args, ['resource', 'login']); + ValidatorModel::arrayType($args, ['resource', 'units', 'data']); ValidatorModel::stringType($args, ['login']); $resource = $args['resource']; @@ -386,7 +381,7 @@ class SummarySheetController $copies = []; $destination = ''; $found = false; - foreach ($args['data']['listInstances'] as $key => $listInstance) { + foreach ($args['data']['listInstances'] as $listKey => $listInstance) { if ($found && $listInstance['res_id'] != $resource['res_id']) { break; } elseif ($listInstance['res_id'] == $resource['res_id']) { @@ -405,7 +400,7 @@ class SummarySheetController } else { $copies[] = $item; } - unset($args['data']['listInstances'][$key]); + unset($args['data']['listInstances'][$listKey]); $found = true; } } @@ -439,7 +434,7 @@ class SummarySheetController } elseif ($unit['unit'] == 'visaWorkflow') { $users = []; $found = false; - foreach ($args['data']['listInstancesVisa'] as $key => $listInstance) { + foreach ($args['data']['listInstancesVisa'] as $listKey => $listInstance) { if ($found && $listInstance['res_id'] != $resource['res_id']) { break; } elseif ($listInstance['res_id'] == $resource['res_id']) { @@ -448,7 +443,7 @@ class SummarySheetController 'mode' => $listInstance['requested_signature'] ? 'Signataire' : 'Viseur', 'date' => TextFormatModel::formatDate($listInstance['process_date']), ]; - unset($args['data']['listInstancesVisa'][$key]); + unset($args['data']['listInstancesVisa'][$listKey]); $found = true; } } @@ -473,7 +468,7 @@ class SummarySheetController } elseif ($unit['unit'] == 'opinionWorkflow') { $users = []; $found = false; - foreach ($args['data']['listInstancesOpinion'] as $key => $listInstance) { + foreach ($args['data']['listInstancesOpinion'] as $listKey => $listInstance) { if ($found && $listInstance['res_id'] != $resource['res_id']) { break; } elseif ($listInstance['res_id'] == $resource['res_id']) { @@ -481,7 +476,7 @@ class SummarySheetController 'user' => UserModel::getLabelledUserById(['login' => $listInstance['item_id']]), 'date' => TextFormatModel::formatDate($listInstance['process_date']), ]; - unset($args['data']['listInstancesOpinion'][$key]); + unset($args['data']['listInstancesOpinion'][$listKey]); $found = true; } } @@ -506,7 +501,7 @@ class SummarySheetController } elseif ($unit['unit'] == 'notes') { $notes = []; $found = false; - foreach ($args['data']['notes'] as $key => $rawNote) { + foreach ($args['data']['notes'] as $noteKey => $rawNote) { if ($found && $rawNote['identifier'] != $resource['res_id']) { break; } elseif ($rawNote['identifier'] == $resource['res_id']) { @@ -533,7 +528,7 @@ class SummarySheetController 'note' => $rawNote['note_text'] ]; } - unset($args['data']['notes'][$key]); + unset($args['data']['notes'][$noteKey]); $found = true; } } diff --git a/src/frontend/app/list/summarySheet/summary-sheet.component.html b/src/frontend/app/list/summarySheet/summary-sheet.component.html index 2ef4f21a5f37584bcd3f35529270f54d797b8906..4fbdc5d00ac33e464247d479d7a4ae62706f3e6f 100644 --- a/src/frontend/app/list/summarySheet/summary-sheet.component.html +++ b/src/frontend/app/list/summarySheet/summary-sheet.component.html @@ -62,4 +62,7 @@ <button mat-mini-fab color="primary" (click)="addCustomUnit()" style="position: absolute;right: 30px;" title="{{lang.addCustomUnit}}"> <mat-icon fontSet="fas" fontIcon="fa-plus" style="height: auto;"></mat-icon> </button> -</div> \ No newline at end of file +</div> +<div *ngIf="data.selectedRes.length > 10" mat-dialog-actions class="actions"> + <span style="color: #d24747; font-style: italic">{{lang.firstSummarySheetsGenerated}}</span> +</div> diff --git a/src/frontend/lang/lang-en.ts b/src/frontend/lang/lang-en.ts index 404763af0fa3dc72cc184feb698d85c939801173..23652629ac86d4be46c7b1abd0488e3cd0d7f2d2 100755 --- a/src/frontend/lang/lang-en.ts +++ b/src/frontend/lang/lang-en.ts @@ -838,5 +838,6 @@ export const LANG_EN = { "contacts" : "Contact(s)", "userIsNotDeletable" : "You do not have <b>full access rights</b> to diffusion list or mails for the user ", "userIsDeletableBy" : "Only a user with the <b>totality of access rights</b> can delete or suspend this user.", - "mailEntitiesList" : "List of entities attached to mails" + "mailEntitiesList" : "List of entities attached to mails", + "firstSummarySheetsGenerated" : "Only first 500 summary sheets will be generated." }; diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts index 5bbeb38f3a8aed08508f9f2315f536a590238e12..672dde2ef1a6e532eb7ae2981de5cb728eba3bc4 100755 --- a/src/frontend/lang/lang-fr.ts +++ b/src/frontend/lang/lang-fr.ts @@ -864,5 +864,6 @@ export const LANG_FR = { "contacts" : "Contact(s)", "userIsNotDeletable" : "Vous n'avez pas la totalité des <b>droits d'accès</b> sur les listes de diffusion ou les courriers de l'utilisateur ", "userIsDeletableBy" : "Seul un utilisateur ayant la <b>totalité des droits d'accès</b> pourra supprimer ou suspendre cet utilisateur.", - "mailEntitiesList" : "Liste des entités rattachées aux courriers" + "mailEntitiesList" : "Liste des entités rattachées aux courriers", + "firstSummarySheetsGenerated" : "Seules les 500 premières fiches de liaison seront générés." }; diff --git a/src/frontend/lang/lang-nl.ts b/src/frontend/lang/lang-nl.ts index 58b044854eec8d647e7a6f4b48313e6a73e9fdd7..e3c8ae74bc6244379b31803f17f48031fe491fea 100755 --- a/src/frontend/lang/lang-nl.ts +++ b/src/frontend/lang/lang-nl.ts @@ -867,5 +867,6 @@ export const LANG_NL = { "contacts" : "Contact(s)", //_TO_TRANSLATE "userIsNotDeletable" : "You do not have <b>full access rights</b> to diffusion list or mails for the user ", //_TO_TRANSLATE "userIsDeletableBy" : "Only a user with the <b>totality of access rights</b> can delete or suspend this user.", //_TO_TRANSLATE - "mailEntitiesList" : "List of entities attached to mails" //_TO_TRANSLATE + "mailEntitiesList" : "List of entities attached to mails", //_TO_TRANSLATE + "firstSummarySheetsGenerated" : "Only first 500 summary sheets will be generated."//_TO_TRANSLATE };