diff --git a/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php b/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php index 945e527072bb8190e2838d56348e143bde62e529..5575943ae7aa9c6476fac899857b0cc2270d5afc 100755 --- a/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php +++ b/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php @@ -202,8 +202,7 @@ function manage_form($arr_id, $history, $id_action, $label_action, $status, $col foreach ($arr_id as $res_id) { $result .= $res_id.'#'; - \Attachment\controllers\AttachmentController::generateAttachForMailing(['resIdMaster' => $res_id, 'userId' => $_SESSION['user']['UserId']]); - + if (!empty($config)) { if ($config['id'] == 'ixbus') { include_once 'modules/visa/class/IxbusController.php'; diff --git a/modules/attachments/attachments_content.php b/modules/attachments/attachments_content.php index bae3a48094952ca03d392b91f874f00f88424e65..ceb838e560d8f7ce21cb2fe56fd4a2b78fd5feb5 100755 --- a/modules/attachments/attachments_content.php +++ b/modules/attachments/attachments_content.php @@ -380,8 +380,6 @@ if (isset($_POST['add']) && $_POST['add']) { 'chronoAttachment' => $chronoPubli, ]; - $filePathOnTmp = \Template\controllers\TemplateController::mergeDatasource($params); - $fileInfos = [ 'tmpDir' => $_SESSION['config']['tmppath'], 'size' => $_SESSION['upfile'][$numAttach]['size'], @@ -1086,8 +1084,6 @@ if (isset($_POST['add']) && $_POST['add']) { 'chronoAttachment' => $chronoPubli, ]; - $filePathOnTmp = \Template\controllers\TemplateController::mergeDatasource($params); - $fileInfos = [ 'tmpDir' => $_SESSION['config']['tmppath'], 'size' => filesize($filePathOnTmp), diff --git a/modules/visa/class/class_modules_tools_Abstract.php b/modules/visa/class/class_modules_tools_Abstract.php index a090da200a277165a9c9bc818e563f36b2ed9371..2a909f4c0cc93ca380cbad22d82a1c5975157c8b 100755 --- a/modules/visa/class/class_modules_tools_Abstract.php +++ b/modules/visa/class/class_modules_tools_Abstract.php @@ -333,12 +333,6 @@ abstract class visa_Abstract extends Database // If there is only one step in the visa workflow, we set status to ESIG if ($resListDiffVisa->requested_signature) { $mailStatus = 'ESIG'; - if ($inDetails == false) { - \Attachment\controllers\AttachmentController::generateAttachForMailing([ - 'resIdMaster' => $res_id, - 'userId' => $_SESSION['user']['UserId'] - ]); - } } else { $mailStatus = 'EVIS'; } diff --git a/rest/index.php b/rest/index.php index cc47e919d568af255193124d1c54a416a6d295d2..940d7a243c4bf74b79090d388ee92bd222391230 100755 --- a/rest/index.php +++ b/rest/index.php @@ -79,7 +79,7 @@ $app->put('/attachments/{id}/inSendAttachment', \Attachment\controllers\Attachme $app->get('/attachments/{id}/maarchParapheurWorkflow', \ExternalSignatoryBook\controllers\MaarchParapheurController::class . ':getWorkflow'); $app->put('/attachments/{id}/inSignatureBook', \Attachment\controllers\AttachmentController::class . ':setInSignatureBook'); $app->put('/attachments/{id}/unsign', \SignatureBook\controllers\SignatureBookController::class . ':unsignAttachment'); -$app->post('/attachments/{id}/mailing', \Attachment\controllers\AttachmentController::class . ':generateMailingById'); +$app->post('/attachments/{id}/mailing', \Attachment\controllers\AttachmentController::class . ':getMailingById'); $app->get('/attachmentsTypes', \Attachment\controllers\AttachmentController::class . ':getAttachmentsTypes'); //AutoComplete diff --git a/src/app/action/controllers/ActionMethodController.php b/src/app/action/controllers/ActionMethodController.php index eefbff04186dfd6cc508b91be8cd35ebf1750103..fc046a5f6e6e2b6bf6d52f0e46efc274ced139e2 100644 --- a/src/app/action/controllers/ActionMethodController.php +++ b/src/app/action/controllers/ActionMethodController.php @@ -16,6 +16,7 @@ use AcknowledgementReceipt\models\AcknowledgementReceiptModel; use Action\models\ActionModel; use Action\models\BasketPersistenceModel; use Action\models\ResMarkAsReadModel; +use Attachment\controllers\AttachmentController; use Attachment\models\AttachmentModel; use Entity\controllers\ListInstanceController; use Entity\models\EntityModel; @@ -310,11 +311,21 @@ class ActionMethodController ValidatorModel::notEmpty($args, ['resId']); ValidatorModel::intVal($args, ['resId']); - $circuit = ListInstanceModel::get(['select' => [1], 'where' => ['res_id = ?', 'difflist_type = ?', 'process_date is null'], 'data' => [$args['resId'], 'VISA_CIRCUIT']]); + $circuit = ListInstanceModel::get([ + 'select' => ['requested_signature'], + 'where' => ['res_id = ?', 'difflist_type = ?', 'process_date is null'], + 'data' => [$args['resId'], 'VISA_CIRCUIT'], + 'orderBy' => ['listinstance_id'], + 'limit' => 1 + ]); if (empty($circuit)) { return ['errors' => ['No available circuit']]; } + $resource = ResModel::getById(['select' => ['integrations'], 'resId' => $args['resId']]); + $integrations = json_decode($resource['integrations'], true); + $resourceIn = !empty($integrations['inSignatureBook']); + $signableAttachmentsTypes = []; $attachmentsTypes = AttachmentModel::getAttachmentsTypesByXML(); foreach ($attachmentsTypes as $key => $type) { @@ -323,21 +334,26 @@ class ActionMethodController } } - $resource = ResModel::getById(['select' => ['integrations'], 'resId' => $args['resId']]); - $integrations = json_decode($resource['integrations'], true); - if (!empty($integrations['inSignatureBook'])) { - return true; - } - $attachments = AttachmentModel::get([ - 'select' => [1], + 'select' => ['res_id', 'status'], 'where' => ['res_id_master = ?', 'attachment_type in (?)', 'in_signature_book = ?', 'status not in (?)'], 'data' => [$args['resId'], $signableAttachmentsTypes, true, ['OBS', 'DEL', 'FRZ']] ]); - if (empty($attachments)) { + if (empty($attachments) && !$resourceIn) { return ['errors' => ['No available attachments']]; } + if ($circuit[0]['requested_signature'] == true) { + foreach ($attachments as $attachment) { + if ($attachment['status'] == 'SEND_MASS') { + $generated = AttachmentController::generateMailing(['id' => $attachment['res_id'], 'userId' => $GLOBALS['id']]); + if (!empty($generated['errors'])) { + return ['errors' => $generated['errors']]; + } + } + } + } + return true; } @@ -353,7 +369,6 @@ class ActionMethodController 'orderBy' => ['listinstance_id'], 'limit' => 1 ]); - if (empty($listInstance[0])) { return ['errors' => ['No available circuit']]; } @@ -366,6 +381,28 @@ class ActionMethodController 'data' => [$listInstance[0]['listinstance_id']] ]); + $circuit = ListInstanceModel::get([ + 'select' => ['requested_signature'], + 'where' => ['res_id = ?', 'difflist_type = ?', 'process_date is null'], + 'data' => [$args['resId'], 'VISA_CIRCUIT'], + 'orderBy' => ['listinstance_id'], + 'limit' => 1 + ]); + + if ($circuit[0]['requested_signature'] == true) { + $attachments = AttachmentModel::get([ + 'select' => ['res_id'], + 'where' => ['res_id_master = ?', 'in_signature_book = ?', 'status = ?'], + 'data' => [$args['resId'], true, 'SEND_MASS'] + ]); + foreach ($attachments as $attachment) { + $generated = AttachmentController::generateMailing(['id' => $attachment['res_id'], 'userId' => $GLOBALS['id']]); + if (!empty($generated['errors'])) { + return ['errors' => $generated['errors']]; + } + } + } + return true; } diff --git a/src/app/attachment/controllers/AttachmentController.php b/src/app/attachment/controllers/AttachmentController.php index a06e3901608af8219bb588a3b6a20c6b949eb30d..eebf19384ea22776c5d7e566aa95f0a41be5e68d 100755 --- a/src/app/attachment/controllers/AttachmentController.php +++ b/src/app/attachment/controllers/AttachmentController.php @@ -621,102 +621,14 @@ class AttachmentController return ['encodedDocument' => $encodedDocument, 'fileName' => $fileName]; } - public static function generateAttachForMailing(array $aArgs) - { - $attachments = AttachmentModel::get([ - 'select' => ['*'], - 'where' => ['res_id_master = ?', 'status = ?', 'in_signature_book = ?'], - 'data' => [$aArgs['resIdMaster'], 'SEND_MASS', true] - ]); - - $contactsForMailing = DatabaseModel::select([ - 'select' => ['*'], - 'table' => ['contacts_res'], - 'where' => ['res_id = ?', 'address_id <> 0'], - 'data' => [$aArgs['resIdMaster']] - ]); - - if (!empty($attachments[0])) { - foreach ($attachments as $attachment) { - $docserver = DocserverModel::getCurrentDocserver(['typeId' => 'DOC', 'collId' => 'letterbox_coll', 'select' => ['path_template']]); - $pathToAttachmentToCopy = $docserver['path_template'] . str_replace('#', '/', $attachment['path']) . $attachment['filename']; - - foreach ($contactsForMailing as $keyContact => $contactForMailing) { - $chronoPubli = $attachment['identifier'].'-'.($keyContact+1); - - $params = [ - 'userId' => $aArgs['userId'], - 'res_id' => $aArgs['resIdMaster'], - 'coll_id' => 'letterbox_coll', - 'res_view' => 'res_attachments', - 'res_table' => 'res_attachments', - 'res_contact_id' => $contactForMailing['contact_id'], - 'res_address_id' => $contactForMailing['address_id'], - 'pathToAttachment' => $pathToAttachmentToCopy, - 'chronoAttachment' => $chronoPubli, - ]; - - $filePathOnTmp = TemplateController::mergeDatasource($params); - - $allDatas = [ - "encodedFile" => base64_encode(file_get_contents($filePathOnTmp)), - "format" => $attachment['format'], - 'resIdMaster' => $aArgs['resIdMaster'], - 'type' => $attachment['attachment_type'], - 'chrono' => $chronoPubli, - 'title' => $attachment['title'], - 'inSignatureBook' => true, - ]; - - StoreController::storeAttachment($allDatas); - } - - AttachmentModel::update([ - 'set' => [ - 'status' => 'DEL', - ], - 'where' => ['res_id = ?'], - 'data' => [$attachment['res_id']] - ]); - } - } - - return ['success' => 'success']; - } - - public static function isMailingAttach(array $aArgs) - { - $user = UserModel::getByLogin(['login' => $aArgs['login'], 'select' => ['id']]); - - if (!Validator::intVal()->validate($aArgs['resIdMaster']) || !ResController::hasRightByResId(['resId' => [$aArgs['resIdMaster']], 'userId' => $user['id']])) { - return ['errors' => 'Document out of perimeter']; - } - - $attachments = AttachmentModel::get([ - 'select' => ['res_id'], - 'where' => ['res_id_master = ?', 'status = ?'], - 'data' => [$aArgs['resIdMaster'],'SEND_MASS'] - ]); - - $return['nbAttach'] = count($attachments); - - if ($return['nbAttach'] == 0) { - return false; - } - - $return['nbContacts'] = ResModel::getNbContactsByResId(["resId" => $aArgs['resIdMaster']]); - - return $return; - } - - public static function generateMailingById(Request $request, Response $response, array $args) + public function getMailingById(Request $request, Response $response, array $args) { if (!Validator::intVal()->validate($args['id'])) { return $response->withStatus(400)->withJson(['errors' => 'Route id is not an integer']); } $attachment = AttachmentModel::getById([ - 'select' => ['status', 'res_id_master', 'title', 'identifier', 'docserver_id', 'path', 'filename', 'format', 'attachment_type'], + 'select' => ['status', 'res_id_master'], 'id' => $args['id'] ]); if (empty($attachment)) { @@ -727,22 +639,43 @@ class AttachmentController return $response->withStatus(403)->withJson(['errors' => 'Attachment is not candidate to mailing']); } + $generated = AttachmentController::generateMailing(['id' => $args['id'], 'userId' => $GLOBALS['id']]); + if (!empty($generated['errors'])) { + return $response->withStatus(400)->withJson(['errors' => $generated['errors']]); + } + + return $response->withStatus(204); + } + + public static function generateMailing(array $args) + { + ValidatorModel::notEmpty($args, ['id', 'userId']); + ValidatorModel::intVal($args, ['id', 'userId']); + + $attachment = AttachmentModel::getById([ + 'select' => ['res_id_master', 'title', 'identifier', 'docserver_id', 'path', 'filename', 'format', 'attachment_type'], + 'id' => $args['id'] + ]); + + $resource = ResModel::getById(['resId' => $attachment['res_id_master'], 'select' => ['category_id']]); + + $mode = $resource['category_id'] == 'incoming' ? 'sender' : 'recipient'; $recipients = ResourceContactModel::get([ 'select' => ['item_id'], 'where' => ['res_id = ?', 'type = ?', 'mode = ?'], - 'data' => [$attachment['res_id_master'], 'contact', 'sender'] + 'data' => [$attachment['res_id_master'], 'contact', $mode] ]); if (empty($recipients)) { - return $response->withStatus(400)->withJson(['errors' => 'No contacts available']); + return ['errors' => 'No contacts available']; } $docserver = DocserverModel::getByDocserverId(['docserverId' => $attachment['docserver_id'], 'select' => ['path_template']]); if (empty($docserver['path_template']) || !is_dir($docserver['path_template'])) { - return $response->withStatus(400)->withJson(['errors' => 'Docserver does not exist']); + return ['errors' => 'Docserver does not exist']; } $pathToAttachment = $docserver['path_template'] . str_replace('#', DIRECTORY_SEPARATOR, $attachment['path']) . $attachment['filename']; if (!is_file($pathToAttachment)) { - return $response->withStatus(400)->withJson(['errors' => 'Attachment not found on docserver']); + return ['errors' => 'Attachment not found on docserver']; } foreach ($recipients as $key => $recipient) { @@ -750,7 +683,7 @@ class AttachmentController $mergedDocument = MergeController::mergeDocument([ 'path' => $pathToAttachment, - 'data' => ['userId' => $GLOBALS['id'], 'recipientId' => $recipient['item_id'], 'recipientType' => 'contact'] + 'data' => ['userId' => $args['userId'], 'recipientId' => $recipient['item_id'], 'recipientType' => 'contact'] ]); $data = [ @@ -761,10 +694,14 @@ class AttachmentController 'chrono' => $chrono, 'type' => $attachment['attachment_type'], 'recipientId' => $recipient['item_id'], - 'recipientType' => 'contact' + 'recipientType' => 'contact', + 'inSignatureBook' => true ]; - StoreController::storeAttachment($data); + $isStored = StoreController::storeAttachment($data); + if (!empty($isStored['errors'])) { + return ['errors' => $isStored['errors']]; + } } AttachmentModel::update([ @@ -775,7 +712,7 @@ class AttachmentController 'data' => [$args['id']] ]); - return $response->withStatus(204); + return true; } private static function controlAttachment(array $args) diff --git a/src/app/contentManagement/controllers/MergeController.php b/src/app/contentManagement/controllers/MergeController.php index 751e106501e7965dec29e24309e7f8a82f8fad09..2edfe4da752747a66d515c900110863a8597ec20 100644 --- a/src/app/contentManagement/controllers/MergeController.php +++ b/src/app/contentManagement/controllers/MergeController.php @@ -72,7 +72,7 @@ class MergeController if (!empty($dataToBeMerge[$contact]['postal_address'])) { $dataToBeMerge[$contact]['postal_address'] = nl2br($dataToBeMerge[$contact]['postal_address']); $dataToBeMerge[$contact]['postal_address'] = str_replace('<br />', '</w:t><w:br/><w:t>', $dataToBeMerge[$contact]['postal_address']); - $dataToBeMerge[$contact]['postal_address'] = str_replace(array("\n\r", "\r\n", "\r", "\n"), "", $dataToBeMerge[$contact]['postal_address']); + $dataToBeMerge[$contact]['postal_address'] = str_replace(["\n\r", "\r\n", "\r", "\n"], "", $dataToBeMerge[$contact]['postal_address']); } } $tbs->LoadTemplate($args['path'], OPENTBS_ALREADY_UTF8); @@ -318,6 +318,7 @@ class MergeController $dataToBeMerge['destination'] = empty($destination) ? [] : $destination; $dataToBeMerge['parentDestination'] = empty($parentDestination) ? [] : $parentDestination; $dataToBeMerge['attachment'] = $attachment; + $dataToBeMerge['sender'] = $sender; $dataToBeMerge['recipient'] = $recipient; $dataToBeMerge['user'] = $currentUser; $dataToBeMerge['userPrimaryEntity'] = $currentUserPrimaryEntity; @@ -327,9 +328,8 @@ class MergeController $dataToBeMerge['contact'] = []; $dataToBeMerge['notes'] = $mergedNote; $dataToBeMerge['datetime'] = $datetime; - if (!empty($args['inMailing'])) { + if (empty($args['inMailing'])) { $dataToBeMerge['attachmentRecipient'] = $attachmentRecipient; - $dataToBeMerge['sender'] = $sender; } return $dataToBeMerge; diff --git a/src/app/resource/controllers/StoreController.php b/src/app/resource/controllers/StoreController.php index d8aa8e6c04f37e57a7946f94819d2b8e7ff14bb8..b52c2b77c9986c80716fce85bfb64bbc5138de70 100755 --- a/src/app/resource/controllers/StoreController.php +++ b/src/app/resource/controllers/StoreController.php @@ -172,11 +172,10 @@ class StoreController $externalId = json_encode($args['externalId']); } - $integrations = ['inSignatureBook' => false, 'inShipping' => false, 'inMailing' => false]; + $integrations = ['inSignatureBook' => false, 'inShipping' => false]; if (!empty($args['integrations'])) { $integrations['inSignatureBook'] = !empty($args['integrations']['inSignatureBook']); $integrations['inShipping'] = !empty($args['integrations']['inShipping']); - $integrations['inMailing'] = !empty($args['integrations']['inMailing']); } if (!empty($args['customFields'])) { diff --git a/src/app/resource/models/ResModelAbstract.php b/src/app/resource/models/ResModelAbstract.php index ac4815726c398abd7a0ce50c18e87d9f850cd674..2cca2aa38208d4a87a828419be124994e5374d36 100755 --- a/src/app/resource/models/ResModelAbstract.php +++ b/src/app/resource/models/ResModelAbstract.php @@ -152,26 +152,6 @@ abstract class ResModelAbstract return $resources; } - public static function getDocsByClause(array $aArgs = []) - { - ValidatorModel::notEmpty($aArgs, ['clause']); - - if (!empty($aArgs['table'])) { - $table = $aArgs['table']; - } else { - $table = 'res_view_letterbox'; - } - - $aReturn = DatabaseModel::select([ - 'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'], - 'table' => [$table], - 'where' => [$aArgs['clause']], - 'order_by' => ['res_id'] - ]); - - return $aReturn; - } - public static function getByAltIdentifier(array $args) { ValidatorModel::notEmpty($args, ['altIdentifier']); @@ -228,18 +208,4 @@ abstract class ResModelAbstract return ''; } - - public static function getNbContactsByResId(array $aArgs) - { - ValidatorModel::notEmpty($aArgs, ['resId']); - ValidatorModel::intVal($aArgs, ['resId']); - - $aResources = DatabaseModel::select([ - 'select' => ['count(1) as nb_contacts'], - 'table' => ['contacts_res'], - 'where' => ['res_id = ?', 'mode = ?'], - 'data' => [$aArgs['resId'], 'multi'] - ]); - return $aResources[0]['nb_contacts']; - } } diff --git a/src/app/template/controllers/TemplateController.php b/src/app/template/controllers/TemplateController.php index 687f7c51918c7f3b1cbc1b7a9dda3f0c5a5ee9f9..af979e4544a888474ede9a99f969bbdc8e3a55c7 100755 --- a/src/app/template/controllers/TemplateController.php +++ b/src/app/template/controllers/TemplateController.php @@ -526,94 +526,4 @@ class TemplateController return $check; } - - public static function mergeDatasource(array $aArgs) - { - include_once 'apps/maarch_entreprise/tools/tbs/tbs_class_php5.php'; - include_once 'apps/maarch_entreprise/tools/tbs/tbs_plugin_opentbs.php'; - - $pathToTemplate = $aArgs['pathToAttachment']; - $pathToTemplateInfo = pathinfo($pathToTemplate); - $datasources = TemplateController::getDatas(["id" => 'letterbox_attachment', 'resId' => $aArgs['res_id'], 'contactId' => (int)$aArgs['res_contact_id'], 'addressId' => (int)$aArgs['res_address_id'], 'chronoAttachment' => $aArgs['chronoAttachment']]); - - if (in_array($pathToTemplateInfo['extension'], ['odt', 'ods', 'odp', 'xlsx', 'pptx', 'docx', 'odf'])) { - $fileNameOnTmp = 'tmp_file_' . $aArgs['userId'] . '_' . rand() . '.' . $pathToTemplateInfo['extension']; - $tmpPath = CoreConfigModel::getTmpPath(); - $myFile = $tmpPath . $fileNameOnTmp; - - // Merge with TBS - $TBS = new \clsTinyButStrong; - $TBS->NoErr = true; - - //LOAD PLUGIN FOR ODT/DOCX DOCUMENT - $TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN); - $TBS->LoadTemplate($pathToTemplate, OPENTBS_ALREADY_UTF8); - - - foreach ($datasources as $name => $datasource) { - if (!is_array($datasource)) { - $TBS->MergeField($name, $datasource); - } else { - $TBS->MergeBlock($name, 'array', $datasource); - } - } - - if ($pathToTemplateInfo['extension'] == 'odt') { - $TBS->LoadTemplate('#styles.xml'); - } elseif ($pathToTemplateInfo['extension'] == 'docx') { - // TODO : TEST AFTER REFACTORING of getDatas function - // foreach (['recipient', 'sender', 'attachmentRecipient'] as $contact) { - // if (!empty($dataToBeMerge[$contact]['postal_address'])) { - // $dataToBeMerge[$contact]['postal_address'] = nl2br($dataToBeMerge[$contact]['postal_address']); - // $dataToBeMerge[$contact]['postal_address'] = str_replace('<br />', '</w:t><w:br/><w:t>', $dataToBeMerge[$contact]['postal_address']); - // $dataToBeMerge[$contact]['postal_address'] = str_replace(array("\n\r", "\r\n", "\r", "\n"), "", $dataToBeMerge[$contact]['postal_address']); - // } - // } - $TBS->LoadTemplate('#word/header1.xml'); - } - foreach ($datasources as $name => $datasource) { - if (!is_array($datasource)) { - $TBS->MergeField($name, $datasource); - } else { - $TBS->MergeBlock($name, 'array', $datasource); - } - } - - if ($pathToTemplateInfo['extension'] == 'docx') { - $TBS->LoadTemplate('#word/footer1.xml'); - foreach ($datasources as $name => $datasource) { - if (!is_array($datasource)) { - $TBS->MergeField($name, $datasource); - } else { - $TBS->MergeBlock($name, 'array', $datasource); - } - } - } - - $TBS->Show(OPENTBS_FILE, $myFile); - } else { - $myFile = $pathToTemplate; - } - - return $myFile; - } - - private static function getDatas(array $aArgs) - { - ValidatorModel::notEmpty($aArgs, ['id']); - - $res_id = $aArgs['resId']; - $datasources['datetime'][0]['date'] = date('d-m-Y'); - $datasources['datetime'][0]['time'] = date('H:i:s.u'); - $datasources['datetime'][0]['timestamp'] = time(); - - $datasourceScript = TemplateModel::getDatasourceById(["id" => $aArgs['id']]); - $res_contact_id = $aArgs['contactId']; - $res_address_id = $aArgs['addressId']; - $chronoAttachment = $aArgs['chronoAttachment']; - - include $datasourceScript['script']; - - return $datasources; - } } diff --git a/src/core/models/ValidatorModel.php b/src/core/models/ValidatorModel.php index a6f51085c2e101f4c8419212b3b238e343ae2539..57c16ffbb30042674acbcab276a4be90c864b5e2 100755 --- a/src/core/models/ValidatorModel.php +++ b/src/core/models/ValidatorModel.php @@ -18,13 +18,13 @@ use Respect\Validation\Validator; class ValidatorModel { - public static function notEmpty(array $aArgs, $aKeys) + public static function notEmpty(array $args, $keys) { - if (!Validator::arrayType()->notEmpty()->validate($aArgs)) { + if (!Validator::arrayType()->notEmpty()->validate($args)) { throw new \Exception('First argument must be a non empty array'); } - foreach ($aKeys as $key) { - if (!Validator::notEmpty()->validate($aArgs[$key])) { + foreach ($keys as $key) { + if (!Validator::notEmpty()->validate($args[$key])) { throw new \Exception("Argument {$key} is empty"); } } diff --git a/src/frontend/app/attachments/attachments-page/attachment-page.component.ts b/src/frontend/app/attachments/attachments-page/attachment-page.component.ts index 6dfcccc811b6aa1fd57902ba4465469302cb0582..8a0414e5720bfdaecad0e47115db1d093878ed7b 100644 --- a/src/frontend/app/attachments/attachments-page/attachment-page.component.ts +++ b/src/frontend/app/attachments/attachments-page/attachment-page.component.ts @@ -51,8 +51,8 @@ export class AttachmentPageComponent implements OnInit { public appService: AppService, private notify: NotificationService, private sortPipe: SortPipe, - private headerService: HeaderService, - private privilegeService: PrivilegeService) { + public headerService: HeaderService, + public privilegeService: PrivilegeService) { } ngOnInit(): void { diff --git a/src/frontend/app/sendedResource/sended-resource-page/sended-resource-page.component.html b/src/frontend/app/sendedResource/sended-resource-page/sended-resource-page.component.html index b671078921624dca44ae31f7cf3a454da90781a0..7a290ebf52969430e8ea26e5eb2ca1bdf6edb4a2 100644 --- a/src/frontend/app/sendedResource/sended-resource-page/sended-resource-page.component.html +++ b/src/frontend/app/sendedResource/sended-resource-page/sended-resource-page.component.html @@ -73,5 +73,5 @@ }"></editor> </mat-dialog-content> <div mat-dialog-actions class="actions"> - <button mat-raised-button color="primary" (click)="onSubmit()">{{lang.validate}}</button> -</div> \ No newline at end of file +<!-- <button mat-raised-button color="primary" (click)="onSubmit()">{{lang.validate}}</button>--> +</div> diff --git a/src/frontend/app/viewer/document-viewer.component.ts b/src/frontend/app/viewer/document-viewer.component.ts index 6cea2aa02300c20bd3b53c9343d86bd979aa1022..97412415ab53b5d2fe18f8f9564e2fdcd83f5a0f 100644 --- a/src/frontend/app/viewer/document-viewer.component.ts +++ b/src/frontend/app/viewer/document-viewer.component.ts @@ -105,7 +105,7 @@ export class DocumentViewerComponent implements OnInit { constructor( public http: HttpClient, private notify: NotificationService, - private headerService: HeaderService, + public headerService: HeaderService, public appService: AppService, private dialog: MatDialog, private sortPipe: SortPipe,