diff --git a/sql/delete_all_ressources.sql b/sql/delete_all_ressources.sql index 6e2208f87875e23862aa4409d428da5b19e3eac5..40ebb80266b372d5ccde00eee699921f44240932 100755 --- a/sql/delete_all_ressources.sql +++ b/sql/delete_all_ressources.sql @@ -34,7 +34,6 @@ ALTER SEQUENCE adr_attachments_id_seq restart WITH 1; TRUNCATE TABLE res_mark_as_read; -TRUNCATE TABLE saved_queries; TRUNCATE TABLE lc_stack; TRUNCATE TABLE tags; diff --git a/sql/index_creation.sql b/sql/index_creation.sql index 811aac8d27cb39a29a79da324f78dd7248d4572a..a5c225286f33a4f317c0160427c56701a2ddb417 100755 --- a/sql/index_creation.sql +++ b/sql/index_creation.sql @@ -72,9 +72,6 @@ CREATE INDEX user_id_idx ON history (user_id); CREATE INDEX identifier_idx ON notes (identifier); CREATE INDEX notes_user_id_idx ON notes (user_id); --- saved_queries -CREATE INDEX user_id_queries_idx ON saved_queries (user_id); - -- users CREATE INDEX lastname_users_idx ON users (lastname); diff --git a/src/app/resource/controllers/ResourceListController.php b/src/app/resource/controllers/ResourceListController.php index 5c471ae72d3ce6f5b10e651353d2045dcfe00517..0397b00ae4f07a254e2ea1d0dd0cae5ef07568ea 100644 --- a/src/app/resource/controllers/ResourceListController.php +++ b/src/app/resource/controllers/ResourceListController.php @@ -859,12 +859,12 @@ class ResourceListController $formattedResources = []; - $resources = $args['resources']; + $resources = $args['resources']; $attachments = $args['attachments']; - $customFields = CustomFieldModel::get(['select' => ['id', 'type', 'label']]); + $customFields = CustomFieldModel::get(['select' => ['id', 'type', 'label']]); $customFieldsLabels = array_column($customFields, 'label', 'id'); - $customFields = array_column($customFields, 'type', 'id'); + $customFields = array_column($customFields, 'type', 'id'); foreach ($resources as $key => $resource) { $formattedResources[$key]['resId'] = $resource['res_id']; diff --git a/src/app/search/controllers/SearchController.php b/src/app/search/controllers/SearchController.php index d9ed81116f93921b2120bdc360fef3282395a319..0f6319263b6c597fe7e732d1f52ba84aa599e064 100644 --- a/src/app/search/controllers/SearchController.php +++ b/src/app/search/controllers/SearchController.php @@ -27,6 +27,7 @@ use Entity\models\EntityModel; use Entity\models\ListInstanceModel; use Folder\models\FolderModel; use Folder\models\ResourceFolderModel; +use Note\models\NoteEntityModel; use Note\models\NoteModel; use Priority\models\PriorityModel; use RegisteredMail\models\RegisteredMailModel; @@ -40,6 +41,9 @@ use Slim\Http\Request; use Slim\Http\Response; use SrcCore\controllers\AutoCompleteController; use SrcCore\controllers\PreparedClauseController; +use SrcCore\models\CoreConfigModel; +use SrcCore\models\DatabaseModel; +use SrcCore\models\DatabasePDO; use SrcCore\models\TextFormatModel; use SrcCore\models\ValidatorModel; use Status\models\StatusModel; @@ -108,24 +112,29 @@ class SearchController $searchData = $searchClause['searchData']; $matchingFullTextResources = $searchClause['matchingResources']; - $nonSearchableStatuses = StatusModel::get(['select' => ['id'], 'where' => ['can_be_searched = ?'], 'data' => ['N']]); + $nonSearchableStatuses = StatusModel::get(['select' => ['id'], 'where' => ['can_be_searched = ?'], 'data' => ['Y']]); if (!empty($nonSearchableStatuses)) { $nonSearchableStatuses = array_column($nonSearchableStatuses, 'id'); - $searchWhere[] = 'status not in (?)'; - $searchData[] = $nonSearchableStatuses; + $searchWhere[] = 'status in (?)'; + $searchData[] = $nonSearchableStatuses; } - $resourcesBeforeFilters = ResModel::getOnView([ - 'select' => ['res_id'], - 'where' => $searchWhere, - 'data' => $searchData - ]); - $resourcesBeforeFilters = array_column($resourcesBeforeFilters, 'res_id'); + $db = new DatabasePDO(); + $db->beginTransaction(); + $query = "DROP TABLE IF EXISTS search_tmp_".$GLOBALS['id'].";"; + $db->query($query); + $query = "CREATE TEMPORARY TABLE search_tmp_".$GLOBALS['id']." (res_id bigint, priority character varying(16), type_id bigint, destination character varying(50), status character varying(10), category_id character varying(32)) ON COMMIT DROP;"; + $db->query($query); + + $resourcesBeforeFilters = "SELECT res_id, priority, type_id, destination, status, category_id FROM res_view_letterbox WHERE " . implode(' AND ', $searchWhere); + $query = "INSERT INTO search_tmp_".$GLOBALS['id']." (res_id, priority, type_id, destination, status, category_id)" . $resourcesBeforeFilters; + $db->query($query, $searchData); $filters = []; if (empty($queryParams['filters'])) { - $filters = SearchController::getFilters(['body' => $body, 'resources' => $resourcesBeforeFilters]); + $filters = SearchController::getFilters(['body' => $body]); } + $db->commitTransaction(); $searchClause = SearchController::getFiltersClause(['body' => $body, 'searchWhere' => $searchWhere, 'searchData' => $searchData]); if (empty($searchClause)) { @@ -474,7 +483,7 @@ class SearchController } if (Validator::date()->notEmpty()->validate($body['creationDate']['values']['end'])) { $args['searchWhere'][] = 'creation_date <= ?'; - $args['searchData'][] = SearchController::getEndDayDate(['date' => $body['creationDate']['values']['end']]); + $args['searchData'][] = TextFormatModel::getEndDayDate(['date' => $body['creationDate']['values']['end']]); } } if (!empty($body['documentDate']) && !empty($body['documentDate']['values']) && is_array($body['documentDate']['values'])) { @@ -484,7 +493,7 @@ class SearchController } if (Validator::date()->notEmpty()->validate($body['documentDate']['values']['end'])) { $args['searchWhere'][] = 'doc_date <= ?'; - $args['searchData'][] = SearchController::getEndDayDate(['date' => $body['documentDate']['values']['end']]); + $args['searchData'][] = TextFormatModel::getEndDayDate(['date' => $body['documentDate']['values']['end']]); } } if (!empty($body['arrivalDate']) && !empty($body['arrivalDate']['values']) && is_array($body['arrivalDate']['values'])) { @@ -494,7 +503,7 @@ class SearchController } if (Validator::date()->notEmpty()->validate($body['arrivalDate']['values']['end'])) { $args['searchWhere'][] = 'admission_date <= ?'; - $args['searchData'][] = SearchController::getEndDayDate(['date' => $body['arrivalDate']['values']['end']]); + $args['searchData'][] = TextFormatModel::getEndDayDate(['date' => $body['arrivalDate']['values']['end']]); } } if (!empty($body['departureDate']) && !empty($body['departureDate']['values']) && is_array($body['departureDate']['values'])) { @@ -504,7 +513,7 @@ class SearchController } if (Validator::date()->notEmpty()->validate($body['departureDate']['values']['end'])) { $args['searchWhere'][] = 'departure_date <= ?'; - $args['searchData'][] = SearchController::getEndDayDate(['date' => $body['departureDate']['values']['end']]); + $args['searchData'][] = TextFormatModel::getEndDayDate(['date' => $body['departureDate']['values']['end']]); } } if (!empty($body['processLimitDate']) && !empty($body['processLimitDate']['values']) && is_array($body['processLimitDate']['values'])) { @@ -514,7 +523,7 @@ class SearchController } if (Validator::date()->notEmpty()->validate($body['processLimitDate']['values']['end'])) { $args['searchWhere'][] = 'process_limit_date <= ?'; - $args['searchData'][] = SearchController::getEndDayDate(['date' => $body['processLimitDate']['values']['end']]); + $args['searchData'][] = TextFormatModel::getEndDayDate(['date' => $body['processLimitDate']['values']['end']]); } } if (!empty($body['closingDate']) && !empty($body['closingDate']['values']) && is_array($body['closingDate']['values'])) { @@ -524,7 +533,7 @@ class SearchController } if (Validator::date()->notEmpty()->validate($body['closingDate']['values']['end'])) { $args['searchWhere'][] = 'closing_date <= ?'; - $args['searchData'][] = SearchController::getEndDayDate(['date' => $body['closingDate']['values']['end']]); + $args['searchData'][] = TextFormatModel::getEndDayDate(['date' => $body['closingDate']['values']['end']]); } } if (!empty($body['senders']) && !empty($body['senders']['values']) && is_array($body['senders']['values']) && is_array($body['senders']['values'][0])) { @@ -686,28 +695,56 @@ class SearchController } } if (!empty($body['notes']) && !empty($body['notes']['values']) && is_string($body['notes']['values'])) { - $notesMatch = NoteModel::get(['select' => ['identifier'], 'where' => ['note_text ilike ?'], 'data' => ["%{$body['notes']['values']}%"]]); - if (empty($notesMatch)) { + $allNotes = NoteModel::get([ + 'select' => ['identifier', 'id'], + 'where' => ['note_text ilike ?'], + 'data' => ["%{$body['notes']['values']}%"] + ]); + if (empty($allNotes)) { return null; } + $rawUserEntities = EntityModel::getByUserId(['userId' => $GLOBALS['id'], 'select' => ['entity_id']]); + $userEntities = array_column($rawUserEntities, 'entity_id'); + + $notesMatch = []; + foreach ($allNotes as $note) { + if ($note['user_id'] == $GLOBALS['id']) { + $notesMatch[] = $note['identifier']; + continue; + } + + $noteEntities = NoteEntityModel::getWithEntityInfo(['select' => ['item_id', 'short_label'], 'where' => ['note_id = ?'], 'data' => [$note['id']]]); + if (!empty($noteEntities)) { + foreach ($noteEntities as $noteEntity) { + $note['entities_restriction'][] = ['short_label' => $noteEntity['short_label'], 'item_id' => [$noteEntity['item_id']]]; + + if (in_array($noteEntity['item_id'], $userEntities)) { + $notesMatch[] = $note['identifier']; + continue 2; + } + } + } else { + $notesMatch[] = $note['identifier']; + } + } + $args['searchWhere'][] = 'res_id in (?)'; - $notesMatch = array_column($notesMatch, 'identifier'); - $args['searchData'][] = $notesMatch; + $args['searchData'][] = $notesMatch; } if (!empty($body['attachment_type']) && !empty($body['attachment_type']['values']) && is_array($body['attachment_type']['values'])) { $args['searchWhere'][] = 'res_id in (select DISTINCT res_id_master from res_attachments where attachment_type in (?) and status in (\'TRA\', \'A_TRA\'))'; - $args['searchData'][] = $body['attachment_type']['values']; + $args['searchData'][] = $body['attachment_type']['values']; } if (!empty($body['attachment_creationDate']) && !empty($body['attachment_creationDate']['values']) && is_array($body['attachment_creationDate']['values'])) { if (Validator::date()->notEmpty()->validate($body['attachment_creationDate']['values']['start'])) { $args['searchWhere'][] = 'res_id in (select DISTINCT res_id_master from res_attachments where creation_date >= ? and status in (\'TRA\', \'A_TRA\'))'; - $args['searchData'][] = $body['attachment_creationDate']['values']['start']; + $args['searchData'][] = $body['attachment_creationDate']['values']['start']; } if (Validator::date()->notEmpty()->validate($body['attachment_creationDate']['values']['end'])) { $args['searchWhere'][] = 'res_id in (select DISTINCT res_id_master from res_attachments where creation_date <= ? and status in (\'TRA\', \'A_TRA\'))'; - $args['searchData'][] = SearchController::getEndDayDate(['date' => $body['attachment_creationDate']['values']['end']]); + $args['searchData'][] = TextFormatModel::getEndDayDate(['date' => $body['attachment_creationDate']['values']['end']]); } } if (!empty($body['groupSign']) && !empty($body['groupSign']['values']) && is_array($body['groupSign']['values'])) { @@ -915,7 +952,7 @@ class SearchController } if (Validator::date()->notEmpty()->validate($value['values']['end'])) { $args['searchWhere'][] = "(custom_fields->>'{$customFieldId}')::timestamp <= ?"; - $args['searchData'][] = SearchController::getEndDayDate(['date' => $value['values']['end']]); + $args['searchData'][] = TextFormatModel::getEndDayDate(['date' => $value['values']['end']]); } } elseif ($customField['type'] == 'banAutocomplete') { if (!empty($value) && !empty($value['values']) && is_array($value['values'])) { @@ -1012,7 +1049,7 @@ class SearchController } if (Validator::date()->notEmpty()->validate($body['registeredMail_receivedDate']['values']['end'])) { $where[] = 'received_date <= ?'; - $data[] = SearchController::getEndDayDate(['date' => $body['registeredMail_receivedDate']['values']['end']]); + $data[] = TextFormatModel::getEndDayDate(['date' => $body['registeredMail_receivedDate']['values']['end']]); } $registeredMailsMatch = RegisteredMailModel::get([ @@ -1259,14 +1296,10 @@ class SearchController { ValidatorModel::arrayType($args, ['body', 'resources']); - if (empty($args['resources'])) { - return ['entities' => [], 'priorities' => [], 'categories' => [], 'statuses' => [], 'doctypes' => [], 'folders' => []]; - } - $body = $args['body']; - $where = ['res_id in (?)']; - $queryData = [$args['resources']]; + $where = []; + $queryData = []; $wherePriorities = $where; $whereCategories = $where; @@ -1434,14 +1467,15 @@ class SearchController } $priorities = []; - $rawPriorities = ResModel::get([ - 'select' => ['count(res_id)', 'priority'], + $rawPriorities = DatabaseModel::select([ + 'select' => ['count(1)', 'priority'], + 'table' => ['search_tmp_' . $GLOBALS['id']], 'where' => $wherePriorities, 'data' => $dataPriorities, 'groupBy' => ['priority'] ]); if (!empty($body['filters']['priorities']) && is_array($body['filters']['priorities'])) { - foreach ($body['filters']['priorities'] as $key => $filter) { + foreach ($body['filters']['priorities'] as $filter) { $count = 0; foreach ($rawPriorities as $value) { if ($filter['id'] === $value['priority']) { @@ -1455,12 +1489,14 @@ class SearchController 'selected' => $filter['selected'] ]; } - } else { + } elseif (!empty($rawPriorities)) { + $resourcesPriorities = array_column($rawPriorities, 'priority'); + $prioritiesData = PriorityModel::get(['select' => ['label', 'id'], 'where' => ['id in (?)'], 'data' => [$resourcesPriorities]]); + $prioritiesData = array_column($prioritiesData, 'label', 'id'); foreach ($rawPriorities as $value) { $label = null; if (!empty($value['priority'])) { - $priority = PriorityModel::getById(['select' => ['label'], 'id' => $value['priority']]); - $label = $priority['label']; + $label = $prioritiesData[$value['priority']]; } $priorities[] = [ @@ -1473,8 +1509,9 @@ class SearchController } $categories = []; - $rawCategories = ResModel::get([ - 'select' => ['count(res_id)', 'category_id'], + $rawCategories = DatabaseModel::select([ + 'select' => ['count(1)', 'category_id'], + 'table' => ['search_tmp_' . $GLOBALS['id']], 'where' => $whereCategories, 'data' => $dataCategories, 'groupBy' => ['category_id'] @@ -1507,8 +1544,9 @@ class SearchController } $statuses = []; - $rawStatuses = ResModel::get([ - 'select' => ['count(res_id)', 'status'], + $rawStatuses = DatabaseModel::select([ + 'select' => ['count(1)', 'status'], + 'table' => ['search_tmp_' . $GLOBALS['id']], 'where' => $whereStatuses, 'data' => $dataStatuses, 'groupBy' => ['status'] @@ -1528,12 +1566,14 @@ class SearchController 'selected' => $filter['selected'] ]; } - } else { + } elseif (!empty($rawStatuses)) { + $resourcesStatuses = array_column($rawStatuses, 'status'); + $statusesData = StatusModel::get(['select' => ['label_status', 'id'], 'where' => ['id in (?)'], 'data' => [$resourcesStatuses]]); + $statusesData = array_column($statusesData, 'label_status', 'id'); foreach ($rawStatuses as $value) { $label = null; if (!empty($value['status'])) { - $status = StatusModel::getById(['select' => ['label_status'], 'id' => $value['status']]); - $label = $status['label_status']; + $label = $statusesData[$value['status']]; } $statuses[] = [ @@ -1546,8 +1586,9 @@ class SearchController } $docTypes = []; - $rawDocTypes = ResModel::get([ - 'select' => ['count(res_id)', 'type_id'], + $rawDocTypes = DatabaseModel::select([ + 'select' => ['count(1)', 'type_id'], + 'table' => ['search_tmp_' . $GLOBALS['id']], 'where' => $whereDocTypes, 'data' => $dataDocTypes, 'groupBy' => ['type_id'] @@ -1567,10 +1608,12 @@ class SearchController 'selected' => $filter['selected'] ]; } - } else { + } elseif (!empty($rawDocTypes)) { + $resourcesDoctypes = array_column($rawDocTypes, 'type_id'); + $doctypesData = DoctypeModel::get(['select' => ['description', 'type_id'], 'where' => ['type_id in (?)'], 'data' => [$resourcesDoctypes]]); + $doctypesData = array_column($doctypesData, 'description', 'type_id'); foreach ($rawDocTypes as $value) { - $doctype = DoctypeModel::getById(['select' => ['description'], 'id' => $value['type_id']]); - $label = $doctype['description']; + $label = $doctypesData[$value['type_id']]; $docTypes[] = [ 'id' => $value['type_id'], @@ -1582,8 +1625,9 @@ class SearchController } $entities = []; - $rawEntities = ResModel::get([ - 'select' => ['count(res_id)', 'destination'], + $rawEntities = DatabaseModel::select([ + 'select' => ['count(1)', 'destination'], + 'table' => ['search_tmp_' . $GLOBALS['id']], 'where' => $whereEntities, 'data' => $dataEntities, 'groupBy' => ['destination'] @@ -1603,12 +1647,14 @@ class SearchController 'selected' => $filter['selected'] ]; } - } else { + } elseif (!empty($rawEntities)) { + $resourcesEntities = array_column($rawEntities, 'destination'); + $entitiesData = EntityModel::get(['select' => ['entity_label', 'entity_id'], 'where' => ['entity_id in (?)'], 'data' => [$resourcesEntities]]); + $entitiesData = array_column($entitiesData, 'entity_label', 'entity_id'); foreach ($rawEntities as $value) { $label = null; if (!empty($value['destination'])) { - $entity = EntityModel::getByEntityId(['select' => ['entity_label'], 'entityId' => $value['destination']]); - $label = $entity['entity_label']; + $label = $entitiesData[$value['destination']]; } $entities[] = [ @@ -1620,11 +1666,11 @@ class SearchController } } - $folders = []; - $resources = ResModel::get([ + $resources = DatabaseModel::select([ 'select' => ['res_id'], - 'where' => $whereFolders, - 'data' => $dataFolders + 'table' => ['search_tmp_' . $GLOBALS['id']], + 'where' => $whereFolders, + 'data' => $dataFolders ]); $resources = !empty($resources) ? array_column($resources, 'res_id') : [0]; @@ -1635,12 +1681,25 @@ class SearchController ]); $userEntities = !empty($userEntities) ? array_column($userEntities, 'id') : [0]; - $rawFolders = FolderModel::getWithEntitiesAndResources([ - 'select' => ['folders.id', 'folders.label', 'count(DISTINCT resources_folders.res_id) as count'], - 'where' => ['resources_folders.res_id in (?)', '(folders.user_id = ? OR entities_folders.entity_id in (?) or keyword = ?)'], - 'data' => [$resources, $GLOBALS['id'], $userEntities, 'ALL_ENTITIES'], - 'groupBy' => ['folders.id', 'folders.label'] - ]); + $chunkedResources = array_chunk($resources, 30000); + $rawFolders = []; + foreach ($chunkedResources as $resources) { + $tmpRawFolders = FolderModel::getWithEntitiesAndResources([ + 'select' => ['folders.id', 'folders.label', 'count(DISTINCT resources_folders.res_id) as count'], + 'where' => ['resources_folders.res_id in (?)', '(folders.user_id = ? OR entities_folders.entity_id in (?) or keyword = ?)'], + 'data' => [$resources, $GLOBALS['id'], $userEntities, 'ALL_ENTITIES'], + 'groupBy' => ['folders.id', 'folders.label'] + ]); + foreach ($tmpRawFolders as $folders) { + $rawFolders[$folders['id']] = [ + 'id' => $folders['id'], + 'label' => $folders['label'], + 'count' => $folders['count'] + $rawFolders[$folders['id']]['count'] + ]; + } + } + + $folders = []; if (!empty($body['filters']['folders']) && is_array($body['filters']['folders'])) { foreach ($body['filters']['folders'] as $key => $filter) { $count = 0; @@ -1674,7 +1733,6 @@ class SearchController usort($entities, ['Resource\controllers\ResourceListController', 'compareSortOnLabel']); usort($folders, ['Resource\controllers\ResourceListController', 'compareSortOnLabel']); - return ['priorities' => $priorities, 'categories' => $categories, 'statuses' => $statuses, 'doctypes' => $docTypes, 'entities' => $entities, 'folders' => $folders]; } @@ -1692,12 +1750,12 @@ class SearchController if (!empty($body['subject']) && !empty($body['subject']['values']) && is_string($body['subject']['values'])) { if ($body['subject']['values'][0] == '"' && $body['subject']['values'][strlen($body['subject']['values']) - 1] == '"') { $wherePlus = 'res_id in (select res_id_master from res_attachments where title = ? and status in (\'TRA\', \'A_TRA\'))'; - $subject = trim($body['subject']['values'], '"'); - $data[] = $subject; + $subject = trim($body['subject']['values'], '"'); + $data[] = $subject; } else { $attachmentField = AutoCompleteController::getUnsensitiveFieldsForRequest(['fields' => ['title']]); $wherePlus = "res_id in (select res_id_master from res_attachments where {$attachmentField} and status in ('TRA', 'A_TRA'))"; - $data[] = "%{$body['subject']['values']}%"; + $data[] = "%{$body['subject']['values']}%"; } } if (!empty($body['chrono']) && !empty($body['chrono']['values']) && is_string($body['chrono']['values'])) { @@ -1751,15 +1809,4 @@ class SearchController return $matchingResources; } - - private static function getEndDayDate(array $args) - { - ValidatorModel::notEmpty($args, ['date']); - ValidatorModel::stringType($args, ['date']); - - $date = new \DateTime($args['date']); - $date->setTime(23, 59, 59); - - return $date->format('d-m-Y H:i:s'); - } } diff --git a/src/core/controllers/AuthenticationController.php b/src/core/controllers/AuthenticationController.php index 3bdea6d7a909ba694c6ae882d12c198dd1a548ab..397c807dce2446f12dcbe2bf49203bcabbfcdbc7 100755 --- a/src/core/controllers/AuthenticationController.php +++ b/src/core/controllers/AuthenticationController.php @@ -237,7 +237,7 @@ class AuthenticationController if ($loggingMethod['id'] == 'standard') { $login = strtolower($body['login']); if (!AuthenticationController::isUserAuthorized(['login' => $login])) { - return $response->withStatus(403)->withJson(['errors' => 'Authentication unauthorized']); + return $response->withStatus(403)->withJson(['errors' => 'Authentication Failed']); } $authenticated = AuthenticationController::standardConnection(['login' => $login, 'password' => $body['password']]); if (!empty($authenticated['date'])) { @@ -248,7 +248,7 @@ class AuthenticationController } elseif ($loggingMethod['id'] == 'ldap') { $login = strtolower($body['login']); if (!AuthenticationController::isUserAuthorized(['login' => $login])) { - return $response->withStatus(403)->withJson(['errors' => 'Authentication unauthorized']); + return $response->withStatus(403)->withJson(['errors' => 'Authentication Failed']); } $authenticated = AuthenticationController::ldapConnection(['login' => $login, 'password' => $body['password']]); if (!empty($authenticated['errors'])) { @@ -261,7 +261,7 @@ class AuthenticationController } $login = strtolower($authenticated['login']); if (!AuthenticationController::isUserAuthorized(['login' => $login])) { - return $response->withStatus(403)->withJson(['errors' => 'Authentication unauthorized']); + return $response->withStatus(403)->withJson(['errors' => 'Authentication Failed']); } } else { return $response->withStatus(403)->withJson(['errors' => 'Logging method unauthorized']); diff --git a/src/core/models/TextFormatModel.php b/src/core/models/TextFormatModel.php index 51ffa9fd498abd7e69d9fea77e249ea26fae421f..656beaa38900697eb07125a64bd510a78af0914a 100755 --- a/src/core/models/TextFormatModel.php +++ b/src/core/models/TextFormatModel.php @@ -46,6 +46,17 @@ class TextFormatModel return $date->format('d-m-Y H:i'); } + public static function getEndDayDate(array $args) + { + ValidatorModel::notEmpty($args, ['date']); + ValidatorModel::stringType($args, ['date']); + + $date = new \DateTime($args['date']); + $date->setTime(23, 59, 59); + + return $date->format('d-m-Y H:i:s'); + } + public static function removeAccent(array $aArgs) { ValidatorModel::notEmpty($aArgs, ['string']); diff --git a/src/frontend/app/administration/priority/priorities-administration.component.ts b/src/frontend/app/administration/priority/priorities-administration.component.ts index c8a42a7c5b8bdfa4c907d61a5b6ea48433703670..a2bfae6891bb0429d1bdaea6f8dbd0017af07e90 100755 --- a/src/frontend/app/administration/priority/priorities-administration.component.ts +++ b/src/frontend/app/administration/priority/priorities-administration.component.ts @@ -42,7 +42,7 @@ export class PrioritiesAdministrationComponent implements OnInit { ) { } ngOnInit(): void { - this.headerService.setHeader(this.translate.instant('lang.administration') + ' ' + this.translate.instant('lang.prioritiesAlt')); + this.headerService.setHeader(this.translate.instant('lang.administration') + ' ' + this.translate.instant('lang.priorities')); this.headerService.injectInSideBarLeft(this.adminMenuTemplate, this.viewContainerRef, 'adminMenu'); diff --git a/src/frontend/app/login/login.component.ts b/src/frontend/app/login/login.component.ts index 9b83f524f8acd6b28ee9ad01fa0f5e6bdee9c60d..a7ad6517989980fc2b4cc6a80f21578e3044f5d8 100644 --- a/src/frontend/app/login/login.component.ts +++ b/src/frontend/app/login/login.component.ts @@ -92,8 +92,6 @@ export class LoginComponent implements OnInit { this.loading = false; if (err.error.errors === 'Authentication Failed') { this.notify.error(this.translate.instant('lang.wrongLoginPassword')); - } else if (err.error.errors === 'Account Suspended') { - this.notify.error(this.translate.instant('lang.accountSuspended')); } else if (err.error.errors === 'Account Locked') { this.notify.error(this.translate.instant('lang.accountLocked') + ' ' + this.timeLimit.transform(err.error.date)); } else { diff --git a/src/frontend/app/search/filter-tool/filter-tool.component.ts b/src/frontend/app/search/filter-tool/filter-tool.component.ts index 0f3f02dc4f88b242458705c39f5664856b6d902f..79dcee559f1a6dd505c75b7f483f9539f82deb6a 100644 --- a/src/frontend/app/search/filter-tool/filter-tool.component.ts +++ b/src/frontend/app/search/filter-tool/filter-tool.component.ts @@ -27,7 +27,6 @@ export class FilterToolComponent implements OnInit { ngOnInit(): void { } setfilters(filters: any) { - console.log(filters); this.filters = filters; } diff --git a/src/frontend/app/search/result-list/search-result-list.component.html b/src/frontend/app/search/result-list/search-result-list.component.html index cb9bda9aecda03e63f3de8dfe96950261d298d1f..f88ee6f75a5eb5899f246e5417c5be67527808bd 100644 --- a/src/frontend/app/search/result-list/search-result-list.component.html +++ b/src/frontend/app/search/result-list/search-result-list.component.html @@ -75,8 +75,8 @@ <div class="table-head"> <div class="table-head-result"> <mat-checkbox *ngIf="!singleSelection" color="primary" - [checked]="selectedRes.length == allResInBasket.length && selectedRes.length > 0" - [indeterminate]="selectedRes.length > 0 && selectedRes.length < allResInBasket.length" + [checked]="selectedRes.length == resultsLength && selectedRes.length > 0" + [indeterminate]="selectedRes.length > 0 && selectedRes.length < resultsLength" style="margin: 10px;padding-right: 10px;" title="{{'lang.selectAllResInBasket' | translate}}" (change)="toggleAllRes($event)"> </mat-checkbox> {{resultsLength}} @@ -86,7 +86,7 @@ </div> <div class="table-head-tool"> <span style="position: relative;"> - <mat-paginator #paginatorResultList [length]="resultsLength" [pageSizeOptions]="[10, 25, 50, 100, 150]" + <mat-paginator #paginatorResultList [length]="paginatorLength" [pageSizeOptions]="[10, 25, 50, 100, 150]" class="paginatorResultList"></mat-paginator> <div *ngIf="paginatorResultList.getNumberOfPages() > 0" [matMenuTriggerFor]="page" class="pageList"></div> <mat-menu #page="matMenu"> @@ -99,7 +99,7 @@ </span> <span *ngIf="actionMode"> <app-followed-action-list #actionsList [contextMode]="false" [currentFolderInfo]="folderInfo" - [totalRes]="allResInBasket.length" [selectedRes]="selectedRes" + [totalRes]="resultsLength" [selectedRes]="selectedRes" (refreshEvent)="refreshDaoAfterAction()"> </app-followed-action-list> </span> @@ -274,6 +274,6 @@ <mat-divider></mat-divider> </ng-template> <app-followed-action-list #actionsListContext *ngIf="actionMode" [contextMode]="true" [currentFolderInfo]="folderInfo" - [totalRes]="allResInBasket.length" [selectedRes]="selectedRes" (refreshEvent)="refreshDaoAfterAction()" + [totalRes]="resultsLength" [selectedRes]="selectedRes" (refreshEvent)="refreshDaoAfterAction()" (refreshPanelFolders)="foldersService.getFolders()"> </app-followed-action-list> \ No newline at end of file diff --git a/src/frontend/app/search/result-list/search-result-list.component.ts b/src/frontend/app/search/result-list/search-result-list.component.ts index 4654afbc3d1dea4170297439600a0aaa66f8cc0d..8fe349473d05d4e28b7025d425f5002b1a7fb713 100644 --- a/src/frontend/app/search/result-list/search-result-list.component.ts +++ b/src/frontend/app/search/result-list/search-result-list.component.ts @@ -134,6 +134,7 @@ export class SearchResultListComponent implements OnInit, OnDestroy { @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator; @ViewChild('tableBasketListSort', { static: true }) sort: MatSort; @ViewChild('basketHome', { static: true }) basketHome: BasketHomeComponent; + paginatorLength: any; constructor( private _activatedRoute: ActivatedRoute, @@ -300,6 +301,7 @@ export class SearchResultListComponent implements OnInit, OnDestroy { this.dataFilters = data.filters; this.criteriaSearchService.updateListsPropertiesFilters(data.filters); this.resultsLength = data.count; + this.paginatorLength = data.count > 10000 ? 10000 : data.count; this.allResInBasket = data.allResources; return data.resources; }), @@ -308,6 +310,7 @@ export class SearchResultListComponent implements OnInit, OnDestroy { this.selectedRes = []; this.data = []; this.resultsLength = 0; + this.paginatorLength = 0; this.dataFilters = {}; this.allResInBasket = []; this.isLoadingResults = false; diff --git a/src/frontend/service/privileges.service.ts b/src/frontend/service/privileges.service.ts index 9d487739c26434b2ae628cf88eca242903c52172..80d6612ae36ccd1213a24cfeedbe816f065866e8 100755 --- a/src/frontend/service/privileges.service.ts +++ b/src/frontend/service/privileges.service.ts @@ -137,8 +137,8 @@ export class PrivilegeService { }, { 'id': 'admin_priorities', - 'label': 'lang.prioritiesAlt', - 'comment': 'lang.prioritiesAlt', + 'label': 'lang.priorities', + 'comment': 'lang.priorities', 'route': '/administration/priorities', 'unit': 'production', 'style': 'fa fa-clock', diff --git a/src/lang/lang-en.json b/src/lang/lang-en.json index b39c1d81c66761a74fd50f06c27870a1f9ade3c2..09231c7f40d36c375e5331db710d60b0e847a1cc 100644 --- a/src/lang/lang-en.json +++ b/src/lang/lang-en.json @@ -1221,7 +1221,6 @@ "printSeparatorInfo": "You can print <b>entity</b> or <b>generic</b> separators to use with <b>maarchCapture</b> to record scanned mails in correct entity.", "printedFolder": "Printed folder", "priorities": "Priorities", - "prioritiesAlt": "Priorities", "prioritiesHelpDesc": "Drag and drop priorities to change the order", "prioritiesOrder": "Manage priorities order", "priority": "Priority", @@ -1676,7 +1675,7 @@ "yes": "Yes", "zipcode": "Zip code", "forgotPassword": "Forgot password", - "wrongLoginPassword": "Wrong user name or wrong password", + "wrongLoginPassword": "Wrong login or wrong password<br>(or user is not allowed to log in)", "sessionExpired": "Session expired", "accountSuspended": "Your user account has been suspended", "accountLocked": "Too many connections attemps. Retry in", diff --git a/src/lang/lang-fr.json b/src/lang/lang-fr.json index f6a461ca4d7cebd4692273a5740473a5f82a4763..edea8ef73bc086ad9c0f60939deb6b9de8a13ac9 100644 --- a/src/lang/lang-fr.json +++ b/src/lang/lang-fr.json @@ -1224,8 +1224,7 @@ "printSeparators": "Impression des séparateurs", "printSeparatorInfo": "Vous pourrez imprimer les séparateurs <b>par service</b> ou <b>générique</b> afin de pouvoir les utiliser dans <b>maarchCapture</b> pour verser les courriers numérisés dans les services adéquates.", "printedFolder": "Dossier d'impression", - "priorities": "Priorité(s)", - "prioritiesAlt": "Priorités", + "priorities": "Priorités", "prioritiesHelpDesc": "Glisser-déposer les priorités pour modifier l'ordre", "prioritiesOrder": "Gérer l'ordre des priorités", "priority": "Priorité", @@ -1681,7 +1680,7 @@ "yes": "Oui", "zipcode": "Code postal", "forgotPassword": "Mot de passe oublié", - "wrongLoginPassword": "Mauvais nom d'utilisateur ou mauvais mot de passe", + "wrongLoginPassword": "L'identifiant ou le mot de passe est incorrect<br>(ou l'utilisateur n'a pas le droit de se connecter)", "sessionExpired": "Votre session a expirée", "accountSuspended": "Votre compte utilisateur a été suspendu", "accountLocked": "Nombre de tentatives de connexion dépassée. Réessayez dans", diff --git a/src/lang/lang-nl.json b/src/lang/lang-nl.json index f614f5ea8208c03076f792a22b30db5bb9503099..cb3897cf761628e63b452f72656d8599f8bbd35e 100644 --- a/src/lang/lang-nl.json +++ b/src/lang/lang-nl.json @@ -521,8 +521,7 @@ "previous": "Vorige", "primary": "Primair", "primaryEntity": "Primaire eenheid", - "priorities": "Prioriteit(en)", - "prioritiesAlt": "Prioriteiten", + "priorities": "Prioriteiten", "prioritiesHelpDesc": "De prioriteiten slepen-neerzetten om de volgorde te wijzigen", "prioritiesOrder": "De volgorde van de prioriteiten beheren", "priority": "Prioriteit", @@ -1652,7 +1651,7 @@ "reconcileMsg2": "If an <b>outgoing mail</b> is selected, only the <b>last mail</b> will be converted into signed version. The others will be <b>removed</b> !__TO_TRANSLATE", "selectMailToReconcile": "Please, select a mail to reconcile__TO_TRANSLATE", "forgotPassword": "Forgot password__TO_TRANSLATE", - "wrongLoginPassword": "Wrong user name or wrong password__TO_TRANSLATE", + "wrongLoginPassword": "Wrong login or wrong password<br>(or user is not allowed to log in)__TO_TRANSLATE", "sessionExpired": "Session expired__TO_TRANSLATE", "accountSuspended": "Your user account has been suspended__TO_TRANSLATE", "accountLocked": "Too many connections attemps. Retry in__TO_TRANSLATE",