Commit 92e0afde authored by Florian Azizian's avatar Florian Azizian

Merge branch 'develop' into 'master'

Develop

See merge request maarch/MaarchCourrier!171
parents 4e2bd141 882caf60
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<adminmail>support@maarch.fr</adminmail> <adminmail>support@maarch.fr</adminmail>
<adminname>maarch</adminname> <adminname>maarch</adminname>
<debug>false</debug> <debug>false</debug>
<applicationname>MAARCH COURRIER 19.04</applicationname> <applicationname>MAARCH COURRIER 19.12</applicationname>
<defaultPage>welcome</defaultPage> <defaultPage>welcome</defaultPage>
<CookieTime>20</CookieTime> <!-- minutes --> <CookieTime>20</CookieTime> <!-- minutes -->
<timezone>Europe/Paris</timezone> <timezone>Europe/Paris</timezone>
......
...@@ -159,19 +159,29 @@ WITH (OIDS=FALSE); ...@@ -159,19 +159,29 @@ WITH (OIDS=FALSE);
/* REFACTORING DATA */ /* REFACTORING DATA */
DELETE FROM usergroup_content WHERE group_id in (SELECT group_id FROM usergroups WHERE enabled = 'N'); DO $$ BEGIN
DELETE FROM usergroups_reports WHERE group_id in (SELECT group_id FROM usergroups WHERE enabled = 'N'); IF (SELECT count(attname) FROM pg_attribute WHERE attrelid = (SELECT oid FROM pg_class WHERE relname = 'usergroups') AND attname = 'enabled') THEN
DELETE FROM usergroups_services WHERE group_id in (SELECT group_id FROM usergroups WHERE enabled = 'N'); DELETE FROM usergroup_content WHERE group_id in (SELECT group_id FROM usergroups WHERE enabled = 'N');
DELETE FROM security WHERE group_id in (SELECT group_id FROM usergroups WHERE enabled = 'N'); DELETE FROM usergroups_reports WHERE group_id in (SELECT group_id FROM usergroups WHERE enabled = 'N');
DELETE FROM groupbasket WHERE group_id in (SELECT group_id FROM usergroups WHERE enabled = 'N'); DELETE FROM usergroups_services WHERE group_id in (SELECT group_id FROM usergroups WHERE enabled = 'N');
DELETE FROM groupbasket_redirect WHERE group_id in (SELECT group_id FROM usergroups WHERE enabled = 'N'); DELETE FROM security WHERE group_id in (SELECT group_id FROM usergroups WHERE enabled = 'N');
DELETE FROM groupbasket_status WHERE group_id in (SELECT group_id FROM usergroups WHERE enabled = 'N'); DELETE FROM groupbasket WHERE group_id in (SELECT group_id FROM usergroups WHERE enabled = 'N');
DELETE FROM users_baskets_preferences WHERE group_serial_id in (SELECT id FROM usergroups WHERE enabled = 'N'); DELETE FROM groupbasket_redirect WHERE group_id in (SELECT group_id FROM usergroups WHERE enabled = 'N');
DELETE FROM usergroups WHERE enabled = 'N'; DELETE FROM groupbasket_status WHERE group_id in (SELECT group_id FROM usergroups WHERE enabled = 'N');
DELETE FROM actions_categories WHERE action_id in (SELECT id FROM actions WHERE enabled = 'N'); DELETE FROM users_baskets_preferences WHERE group_serial_id in (SELECT id FROM usergroups WHERE enabled = 'N');
DELETE FROM actions_groupbaskets WHERE id_action in (SELECT id FROM actions WHERE enabled = 'N'); DELETE FROM usergroups WHERE enabled = 'N';
DELETE FROM groupbasket_redirect WHERE action_id in (SELECT id FROM actions WHERE enabled = 'N'); END IF;
DELETE FROM actions WHERE enabled = 'N'; END$$;
DO $$ BEGIN
IF (SELECT count(attname) FROM pg_attribute WHERE attrelid = (SELECT oid FROM pg_class WHERE relname = 'actions') AND attname = 'enabled') THEN
DELETE FROM actions_categories WHERE action_id in (SELECT id FROM actions WHERE enabled = 'N');
DELETE FROM actions_groupbaskets WHERE id_action in (SELECT id FROM actions WHERE enabled = 'N');
DELETE FROM groupbasket_redirect WHERE action_id in (SELECT id FROM actions WHERE enabled = 'N');
DELETE FROM actions WHERE enabled = 'N';
END IF;
END$$;
DELETE FROM usergroups_services WHERE service_id = 'admin_fileplan'; DELETE FROM usergroups_services WHERE service_id = 'admin_fileplan';
DELETE FROM usergroups_services WHERE service_id = 'put_doc_in_fileplan'; DELETE FROM usergroups_services WHERE service_id = 'put_doc_in_fileplan';
DELETE FROM usergroups_services WHERE service_id = 'fileplan'; DELETE FROM usergroups_services WHERE service_id = 'fileplan';
...@@ -184,7 +194,6 @@ DELETE FROM usergroups_services WHERE service_id = 'add_cases'; ...@@ -184,7 +194,6 @@ DELETE FROM usergroups_services WHERE service_id = 'add_cases';
/* OLD FOLDERS */ /* OLD FOLDERS */
DROP VIEW IF EXISTS view_folders; DROP VIEW IF EXISTS view_folders;
DELETE FROM usergroups_services WHERE service_id IN ('folder_search', 'view_folder_tree', 'select_folder', 'show_history_folder', 'modify_folder', 'associate_folder', 'delete_folder', 'admin_foldertypes', 'create_folder', 'folder_freeze', 'close_folder'); DELETE FROM usergroups_services WHERE service_id IN ('folder_search', 'view_folder_tree', 'select_folder', 'show_history_folder', 'modify_folder', 'associate_folder', 'delete_folder', 'admin_foldertypes', 'create_folder', 'folder_freeze', 'close_folder');
DELETE FROM notes WHERE origin = 'folder';
DROP TABLE IF EXISTS foldertypes; DROP TABLE IF EXISTS foldertypes;
DROP TABLE IF EXISTS foldertypes_doctypes; DROP TABLE IF EXISTS foldertypes_doctypes;
DROP TABLE IF EXISTS foldertypes_doctypes_level1; DROP TABLE IF EXISTS foldertypes_doctypes_level1;
......
...@@ -18,7 +18,8 @@ foreach ($customs as $custom) { ...@@ -18,7 +18,8 @@ foreach ($customs as $custom) {
$folders = \SrcCore\models\DatabaseModel::select([ $folders = \SrcCore\models\DatabaseModel::select([
'select' => ['f.folders_system_id', 'f.folder_name', 'f.status', 'r.res_id', 'mlb.alt_identifier', 'r.subject'], 'select' => ['f.folders_system_id', 'f.folder_name', 'f.status', 'r.res_id', 'mlb.alt_identifier', 'r.subject'],
'table' => ['folder_tmp f, res_letterbox r, mlb_coll_ext mlb'], 'table' => ['folder_tmp f, res_letterbox r, mlb_coll_ext mlb'],
'where' => ['f.folders_system_id = r.folders_system_id', 'r.res_id = mlb.res_id', 'f.destination is null', 'f.status <> \'DEL\'', 'r.status <> \'DEL\''] 'where' => ['f.folders_system_id = r.folders_system_id', 'r.res_id = mlb.res_id', '(f.destination is null or f.destination = \'\')', 'f.status <> \'DEL\'', 'r.status <> \'DEL\''],
'order_by' => ['f.folder_name']
]); ]);
if (!empty($folders)) { if (!empty($folders)) {
......
...@@ -952,7 +952,7 @@ INSERT INTO parameters (id, param_value_string, param_value_int, param_value_dat ...@@ -952,7 +952,7 @@ INSERT INTO parameters (id, param_value_string, param_value_int, param_value_dat
INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('folder_id_increment', '', 200, NULL); INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('folder_id_increment', '', 200, NULL);
INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('work_batch_autoimport_id', NULL, 1, NULL); INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('work_batch_autoimport_id', NULL, 1, NULL);
INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('postindexing_workbatch', NULL, 1, NULL); INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('postindexing_workbatch', NULL, 1, NULL);
INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('database_version', '19.10.1', NULL, NULL); INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('database_version', '19.12.1', NULL, NULL);
INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('user_quota', '', 0, NULL); INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('user_quota', '', 0, NULL);
INSERT INTO parameters (id, description, param_value_string, param_value_int, param_value_date) VALUES ('defaultDepartment', 'Département par défaut sélectionné dans le formulaire des adresses', NULL, 75, NULL); INSERT INTO parameters (id, description, param_value_string, param_value_int, param_value_date) VALUES ('defaultDepartment', 'Département par défaut sélectionné dans le formulaire des adresses', NULL, 75, NULL);
INSERT INTO parameters (id, description, param_value_string) VALUES ('homepage_message', 'Texte apparaissant dans la bannière sur la page d''accueil, mettre un espace pour supprimer la bannière.', 'Bienvenue dans votre <b>G</b>estion <b>E</b>lectronique du <b>C</b>ourrier.'); INSERT INTO parameters (id, description, param_value_string) VALUES ('homepage_message', 'Texte apparaissant dans la bannière sur la page d''accueil, mettre un espace pour supprimer la bannière.', 'Bienvenue dans votre <b>G</b>estion <b>E</b>lectronique du <b>C</b>ourrier.');
......
...@@ -1123,10 +1123,10 @@ INSERT INTO parameters (id, param_value_string, param_value_int, param_value_dat ...@@ -1123,10 +1123,10 @@ INSERT INTO parameters (id, param_value_string, param_value_int, param_value_dat
INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('folder_id_increment', '', 200, NULL); INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('folder_id_increment', '', 200, NULL);
INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('work_batch_autoimport_id', NULL, 1, NULL); INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('work_batch_autoimport_id', NULL, 1, NULL);
INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('postindexing_workbatch', NULL, 1, NULL); INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('postindexing_workbatch', NULL, 1, NULL);
INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('database_version', '19.10.1', NULL, NULL); INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('database_version', '19.12.1', NULL, NULL);
INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('user_quota', '', 0, NULL); INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('user_quota', '', 0, NULL);
INSERT INTO parameters (id, description, param_value_string, param_value_int, param_value_date) VALUES ('defaultDepartment', 'Département par défaut sélectionné dans le formulaire des adresses', NULL, 75, NULL); INSERT INTO parameters (id, description, param_value_string, param_value_int, param_value_date) VALUES ('defaultDepartment', 'Département par défaut sélectionné dans le formulaire des adresses', NULL, 75, NULL);
INSERT INTO parameters (id, description, param_value_string) VALUES ('homepage_message', 'Texte apparaissant dans la bannière sur la page d''accueil, mettre un espace pour supprimer la bannière.', '<p>D&eacute;couvrez <strong>Maarch Courrier 19.10</strong> avec <a title="notre guide de visite" href="https://docs.maarch.org/gitbook/html/MaarchCourrier/19.04/guu/home.html" target="_blank"><span style="color:#f99830;"><strong>notre guide de visite en ligne</strong></span></a>.</p>'); INSERT INTO parameters (id, description, param_value_string) VALUES ('homepage_message', 'Texte apparaissant dans la bannière sur la page d''accueil, mettre un espace pour supprimer la bannière.', '<p>D&eacute;couvrez <strong>Maarch Courrier 19.12</strong> avec <a title="notre guide de visite" href="https://docs.maarch.org/gitbook/html/MaarchCourrier/19.04/guu/home.html" target="_blank"><span style="color:#f99830;"><strong>notre guide de visite en ligne</strong></span></a>.</p>');
INSERT INTO parameters (id, description, param_value_string) VALUES ('loginpage_message', 'Texte apparaissant sur la page de login.', '<h3><span style="color:#24b0ed"><strong>Découvrez votre application via</strong></span> <a title="le guide de visite" href="https://docs.maarch.org/gitbook/html/MaarchCourrier/19.04/guu/home.html" target="_blank"><span style="color:#f99830;"><strong>le guide de visite en ligne</strong></span></a></h3>'); INSERT INTO parameters (id, description, param_value_string) VALUES ('loginpage_message', 'Texte apparaissant sur la page de login.', '<h3><span style="color:#24b0ed"><strong>Découvrez votre application via</strong></span> <a title="le guide de visite" href="https://docs.maarch.org/gitbook/html/MaarchCourrier/19.04/guu/home.html" target="_blank"><span style="color:#f99830;"><strong>le guide de visite en ligne</strong></span></a></h3>');
INSERT INTO parameters (id, description, param_value_string) VALUES ('thumbnailsSize', 'Résolution des imagettes', '750x900'); INSERT INTO parameters (id, description, param_value_string) VALUES ('thumbnailsSize', 'Résolution des imagettes', '750x900');
INSERT INTO parameters (id, description, param_value_int) VALUES ('keepDestForRedirection', 'Si activé (1), met le destinataire en copie de la liste de diffusion lors d''une action de redirection', 0); INSERT INTO parameters (id, description, param_value_int) VALUES ('keepDestForRedirection', 'Si activé (1), met le destinataire en copie de la liste de diffusion lors d''une action de redirection', 0);
......
...@@ -422,14 +422,14 @@ abstract class BasketModelAbstract ...@@ -422,14 +422,14 @@ abstract class BasketModelAbstract
{ {
ValidatorModel::arrayType($args, ['select', 'where', 'data']); ValidatorModel::arrayType($args, ['select', 'where', 'data']);
$where = ['baskets.basket_id = users_baskets_preferences.basket_id']; $where = ['(baskets.basket_id = users_baskets_preferences.basket_id AND users_baskets_preferences.group_serial_id = usergroups.id)'];
if (!empty($args['where'])) { if (!empty($args['where'])) {
$where = array_merge($where, $args['where']); $where = array_merge($where, $args['where']);
} }
$baskets = DatabaseModel::select([ $baskets = DatabaseModel::select([
'select' => empty($args['select']) ? ['*'] : $args['select'], 'select' => empty($args['select']) ? ['*'] : $args['select'],
'table' => ['baskets, users_baskets_preferences'], 'table' => ['baskets, users_baskets_preferences, usergroups'],
'where' => $where, 'where' => $where,
'data' => empty($args['data']) ? [] : $args['data'] 'data' => empty($args['data']) ? [] : $args['data']
]); ]);
......
...@@ -424,7 +424,11 @@ class ListTemplateController ...@@ -424,7 +424,11 @@ class ListTemplateController
ValidatorModel::notEmpty($aArgs, ['items']); ValidatorModel::notEmpty($aArgs, ['items']);
ValidatorModel::arrayType($aArgs, ['items']); ValidatorModel::arrayType($aArgs, ['items']);
$destFound = false;
foreach ($aArgs['items'] as $item) { foreach ($aArgs['items'] as $item) {
if ($destFound && $item['item_mode'] == 'dest') {
return ['errors' => 'More than one dest not allowed'];
}
if (empty($item['item_id'])) { if (empty($item['item_id'])) {
return ['errors' => 'Item_id is empty']; return ['errors' => 'Item_id is empty'];
} }
...@@ -434,6 +438,9 @@ class ListTemplateController ...@@ -434,6 +438,9 @@ class ListTemplateController
if (empty($item['item_mode'])) { if (empty($item['item_mode'])) {
return ['errors' => 'Item_mode is empty']; return ['errors' => 'Item_mode is empty'];
} }
if ($item['item_mode'] == 'dest') {
$destFound = true;
}
} }
return ['success' => 'success']; return ['success' => 'success'];
......
...@@ -107,12 +107,14 @@ class FolderController ...@@ -107,12 +107,14 @@ class FolderController
} }
$folder = $folder[0]; $folder = $folder[0];
$ownerInfo = UserModel::getById(['select' => ['firstname', 'lastname'], 'id' => $folder['user_id']]);
$folder['ownerDisplayName'] = $ownerInfo['firstname'] . ' ' . $ownerInfo['lastname'];
$folder['sharing']['entities'] = []; $folder['sharing']['entities'] = [];
if ($folder['public']) { if ($folder['public']) {
$entitiesFolder = EntityFolderModel::getByFolderId(['folder_id' => $args['id']]); $entitiesFolder = EntityFolderModel::getByFolderId(['folder_id' => $args['id'], 'select' => ['entities_folders.entity_id', 'entities_folders.edition', 'entities.entity_label']]);
foreach ($entitiesFolder as $value) { foreach ($entitiesFolder as $value) {
$folder['sharing']['entities'][] = ['entity_id' => $value['entity_id'], 'edition' => $value['edition']]; $folder['sharing']['entities'][] = ['entity_id' => $value['entity_id'], 'edition' => $value['edition'], 'label' => $value['entity_label']];
} }
} }
...@@ -192,8 +194,8 @@ class FolderController ...@@ -192,8 +194,8 @@ class FolderController
if ($data['parent_id'] == $aArgs['id']) { if ($data['parent_id'] == $aArgs['id']) {
return $response->withStatus(400)->withJson(['errors' => 'Parent_id and id can not be the same']); return $response->withStatus(400)->withJson(['errors' => 'Parent_id and id can not be the same']);
} }
if (FolderController::isParentFolder(['parent_id' => $data['parent_id'], 'id' => $aArgs['id']])) { if (!empty($data['parent_id']) && FolderController::isParentFolder(['parent_id' => $data['parent_id'], 'id' => $aArgs['id']])) {
return $response->withStatus(400)->withJson(['errors' => 'Id is a parent of parent_id']); return $response->withStatus(400)->withJson(['errors' => 'parent_id does not exist or Id is a parent of parent_id']);
} }
$folder = FolderController::getScopeFolders(['login' => $GLOBALS['userId'], 'folderId' => $aArgs['id'], 'edition' => true]); $folder = FolderController::getScopeFolders(['login' => $GLOBALS['userId'], 'folderId' => $aArgs['id'], 'edition' => true]);
...@@ -534,7 +536,7 @@ class FolderController ...@@ -534,7 +536,7 @@ class FolderController
} }
$baskets = BasketModel::getWithPreferences([ $baskets = BasketModel::getWithPreferences([
'select' => ['baskets.id', 'baskets.basket_id', 'baskets.basket_clause', 'users_baskets_preferences.group_serial_id'], 'select' => ['baskets.id', 'baskets.basket_id', 'baskets.basket_name', 'baskets.basket_clause', 'users_baskets_preferences.group_serial_id', 'usergroups.group_desc'],
'where' => ['users_baskets_preferences.user_serial_id = ?'], 'where' => ['users_baskets_preferences.user_serial_id = ?'],
'data' => [$GLOBALS['id']] 'data' => [$GLOBALS['id']]
]); ]);
...@@ -561,7 +563,7 @@ class FolderController ...@@ -561,7 +563,7 @@ class FolderController
'data' => [$group['group_id'], $basket['basket_id']] 'data' => [$group['group_id'], $basket['basket_id']]
]); ]);
if (!empty($groupBasket[0]['list_event'])) { if (!empty($groupBasket[0]['list_event'])) {
$events[] = ['groupId' => $basket['group_serial_id'], 'basketId' => $basket['id'], 'event' => $groupBasket[0]['list_event']]; $events[] = ['groupId' => $basket['group_serial_id'], 'groupName' => $basket['group_desc'], 'basketId' => $basket['id'], 'basketName' => $basket['basket_name'], 'event' => $groupBasket[0]['list_event']];
} }
} }
} }
...@@ -628,7 +630,7 @@ class FolderController ...@@ -628,7 +630,7 @@ class FolderController
'select' => ['distinct (folders.id)', 'folders.*'], 'select' => ['distinct (folders.id)', 'folders.*'],
'where' => $where, 'where' => $where,
'data' => $data, 'data' => $data,
'orderBy' => ['level'] 'orderBy' => ['level', 'label']
]); ]);
return $folders; return $folders;
......
...@@ -23,7 +23,8 @@ class EntityFolderModelAbstract ...@@ -23,7 +23,8 @@ class EntityFolderModelAbstract
$entitiesFolder = DatabaseModel::select([ $entitiesFolder = DatabaseModel::select([
'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'], 'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
'table' => ['entities_folders'], 'table' => ['entities_folders', 'entities'],
'left_join' => ['entities_folders.entity_id = entities.id'],
'where' => ['folder_id = ?'], 'where' => ['folder_id = ?'],
'data' => [$aArgs['folder_id']] 'data' => [$aArgs['folder_id']]
]); ]);
......
...@@ -71,15 +71,28 @@ abstract class NotificationScheduleModelAbstract ...@@ -71,15 +71,28 @@ abstract class NotificationScheduleModelAbstract
$corePath = str_replace('custom/'.$customId.'/src/app/notification/models', '', __DIR__); $corePath = str_replace('custom/'.$customId.'/src/app/notification/models', '', __DIR__);
$corePath = str_replace('src/app/notification/models', '', $corePath); $corePath = str_replace('src/app/notification/models', '', $corePath);
$emptyLine = [
'm' => 1,
'h' => 1,
'dom' => 1,
'mon' => 1,
'dow' => 1,
'cmd' => 'empty',
'description' => 'empty',
'state' => 'hidden',
];
foreach ($lines as $cronLine) { foreach ($lines as $cronLine) {
$cronLine = trim($cronLine); $cronLine = preg_replace('![ \t]+!', ' ', trim($cronLine));
if (strpos($cronLine, '#') !== false) { if ($aArgs['setHiddenValue'] && (strpos($cronLine, '#') !== false || strpos($cronLine, 'MAILTO=') !== false)) {
$cronLine = substr($cronLine, 0, strpos($cronLine, '#')); $data[] = $emptyLine;
continue;
} elseif (!$aArgs['setHiddenValue'] && (strpos($cronLine, '#') === 0 || strpos($cronLine, 'MAILTO=') === 0)) {
$data[] = [ 'm' => $cronLine];
continue;
} }
if (empty($cronLine)) { if (empty($cronLine)) {
continue; continue;
} }
$cronLine = preg_replace('![ \t]+!', ' ', $cronLine);
if ($cronLine[0] == '@') { if ($cronLine[0] == '@') {
$explodeCronLine = explode(' ', $cronLine, 2); $explodeCronLine = explode(' ', $cronLine, 2);
$cmd = $explodeCronLine[1]; $cmd = $explodeCronLine[1];
......
...@@ -197,9 +197,15 @@ class ResourceListController ...@@ -197,9 +197,15 @@ class ResourceListController
$where[] = 'process_limit_date < CURRENT_TIMESTAMP'; $where[] = 'process_limit_date < CURRENT_TIMESTAMP';
} }
if (!empty($args['data']['search']) && mb_strlen($args['data']['search']) >= 2) { if (!empty($args['data']['search']) && mb_strlen($args['data']['search']) >= 2) {
$where[] = '(alt_identifier ilike ? OR translate(subject, \'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ\', \'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyrr\') ilike translate(?, \'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ\', \'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyrr\'))'; if (preg_match('/^"([^"]+)"$/', $args['data']['search'], $cleanSearch)) {
$queryData[] = "%{$args['data']['search']}%"; $where[] = '(alt_identifier like ? OR subject like ?)';
$queryData[] = "%{$args['data']['search']}%"; $queryData[] = "{$cleanSearch[1]}";
$queryData[] = "{$cleanSearch[1]}";
} else {
$where[] = '(alt_identifier ilike ? OR translate(subject, \'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ\', \'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyrr\') ilike translate(?, \'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ\', \'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyrr\'))';
$queryData[] = "%{$args['data']['search']}%";
$queryData[] = "%{$args['data']['search']}%";
}
} }
if (isset($args['data']['priorities'])) { if (isset($args['data']['priorities'])) {
if (empty($args['data']['priorities'])) { if (empty($args['data']['priorities'])) {
......
...@@ -687,11 +687,7 @@ class AutoCompleteController ...@@ -687,11 +687,7 @@ class AutoCompleteController
$scopedFolders = FolderController::getScopeFolders(['login' => $GLOBALS['userId']]); $scopedFolders = FolderController::getScopeFolders(['login' => $GLOBALS['userId']]);
$getScopedFoldersIds = function ($value) { $arrScopedFoldersIds = array_column($scopedFolders, 'id');
return $value['id'];
};
$arrScopedFoldersIds = array_map($getScopedFoldersIds, $scopedFolders);
$selectedFolders = FolderModel::get([ $selectedFolders = FolderModel::get([
'where' => ['label ilike ? AND id IN(?)'], 'where' => ['label ilike ? AND id IN(?)'],
......
...@@ -14,5 +14,5 @@ ...@@ -14,5 +14,5 @@
<span>{{action.label_action}}</span> <span>{{action.label_action}}</span>
</button> </button>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<folder-menu [resIds]="selectedRes" (refreshList)="refreshList()" (refreshFolders)="refreshFolders()"></folder-menu> <folder-menu [resIds]="selectedRes" [currentFolders]="folderList" (refreshList)="refreshList()" (refreshFolders)="refreshFolders()"></folder-menu>
</mat-menu> </mat-menu>
\ No newline at end of file
...@@ -45,6 +45,7 @@ export class ActionsListComponent implements OnInit { ...@@ -45,6 +45,7 @@ export class ActionsListComponent implements OnInit {
contextResId = 0; contextResId = 0;
currentLock: any = null; currentLock: any = null;
arrRes: any[] = []; arrRes: any[] = [];
folderList: any [] = [];
actionsList: any[] = []; actionsList: any[] = [];
...@@ -72,6 +73,8 @@ export class ActionsListComponent implements OnInit { ...@@ -72,6 +73,8 @@ export class ActionsListComponent implements OnInit {
this.contextMenuTitle = row.alt_identifier; this.contextMenuTitle = row.alt_identifier;
this.contextResId = row.res_id; this.contextResId = row.res_id;
this.folderList = row.folders !== undefined ? row.folders : [];
// Opens the menu // Opens the menu
this.contextMenu.openMenu(); this.contextMenu.openMenu();
......
<mat-divider *ngIf="homeData.regroupedBaskets.length > 0 || homeData.assignedBaskets.length > 0"> <mat-divider *ngIf="homeData.regroupedBaskets.length > 0 || homeData.assignedBaskets.length > 0">
</mat-divider> </mat-divider>
<mat-expansion-panel class="basketList" expanded *ngIf="homeData.regroupedBaskets.length > 0 || homeData.assignedBaskets.length > 0"> <mat-expansion-panel class="basketList" [expanded]="appService.getStateBasketMenu()" *ngIf="homeData.regroupedBaskets.length > 0 || homeData.assignedBaskets.length > 0">
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title> <mat-panel-title>
<i class="fa fa-inbox"></i>&nbsp;{{lang.myBaskets}} <i class="fa fa-inbox panelIconMenu"></i>&nbsp;{{lang.myBaskets}}
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<mat-form-field floatLabel="never" appearance="outline" class="basketsFilter" style="padding-left:20px;padding-right:20px;font-size: 11px;"> <mat-form-field floatLabel="never" appearance="outline" class="basketsFilter" style="padding-left:20px;padding-right:20px;font-size: 11px;">
......
...@@ -56,4 +56,8 @@ ...@@ -56,4 +56,8 @@
padding : 0px; padding : 0px;
padding-bottom: 5px; padding-bottom: 5px;
} }
}
.panelIconMenu {
font-size: 22px;
} }
\ No newline at end of file
...@@ -22,6 +22,7 @@ export class BasketHomeComponent implements OnInit { ...@@ -22,6 +22,7 @@ export class BasketHomeComponent implements OnInit {
basketId: '' basketId: ''
}; };
@Input() snavL: MatSidenav; @Input() snavL: MatSidenav;
@Input('opened') opened: boolean;
@Output('refreshEvent') refreshEvent = new EventEmitter<string>(); @Output('refreshEvent') refreshEvent = new EventEmitter<string>();
constructor( constructor(
......
...@@ -11,8 +11,9 @@ ...@@ -11,8 +11,9 @@
[selectedId]="folderInfo.id"></panel-folder> [selectedId]="folderInfo.id"></panel-folder>
</mat-sidenav> </mat-sidenav>
<mat-sidenav-content> <mat-sidenav-content>
<mat-card id="viewThumbnail" style="display:none;position: fixed;z-index: 2;margin-left: 1px;"><img <mat-card id="viewThumbnail" style="display:none;position: fixed;z-index: 2;margin-left: 1px;">
style="max-height: 100vh;" src="{{thumbnailUrl}}" /></mat-card> <img style="max-height: 100vh;" src="{{thumbnailUrl}}" />
</mat-card>
<div class="bg-head"> <div class="bg-head">
<div class="bg-head-title" [class.customContainerRight]="appService.getViewMode()"> <div class="bg-head-title" [class.customContainerRight]="appService.getViewMode()">
<div class="bg-head-title-label"> <div class="bg-head-title-label">
...@@ -22,13 +23,38 @@ ...@@ -22,13 +23,38 @@
<header-right></header-right> <header-right></header-right>
</div> </div>
</div> </div>
<div class="bg-head-content" [class.fullContainer]="appService.getViewMode()"> <div class="bg-head-content" [class.fullContainer]="appService.getViewMode()" style="padding-bottom: 20px;">
<app-filters-tool style="flex:1;overflow-x: auto;overflow-y: hidden;" #filtersTool <app-filters-tool style="flex:1;overflow-x: auto;overflow-y: hidden;" #filtersTool
[listProperties]="this.listProperties" [snavR]="snav2" [totalRes]="allResInBasket.length" [listProperties]="this.listProperties" [snavR]="snav2" [totalRes]="allResInBasket.length"
[selectedRes]="selectedRes" [routeDatas]="'/rest/folders/' + folderInfo.id + '/filters'" (toggleAllRes)="toggleAllRes($event)" [selectedRes]="selectedRes" [routeDatas]="'/rest/folders/' + folderInfo.id + '/filters'"
(refreshEventAfterAction)="refreshDaoAfterAction()" (refreshEvent)="refreshDao()" [title]="lang.searchMailInFolder"> (toggleAllRes)="toggleAllRes($event)" (refreshEventAfterAction)="refreshDaoAfterAction()"
(refreshEvent)="refreshDao()" [title]="lang.searchMailInFolder">
</app-filters-tool> </app-filters-tool>
</div> </div>
<div class="bg-head-content" [class.fullContainer]="appService.getViewMode()">
<div class="banner">
<div class="banner-title">
{{lang.informations}} du dossier
<div class="banner-title-divider"></div>
</div>
<div class="banner-content">
<div class="banner-content-item">
Propriétaire :<br /><b>{{folderInfo.ownerDisplayName}}</b>
</div>
<div *ngIf="folderInfo.entitiesSharing.length === 0" class="banner-content-item private">
Dossier privé
</div>
<div *ngIf="folderInfo.entitiesSharing.length > 0" class="banner-content-item">
Visible par :<br />
<div style="max-height: 100px;overflow: auto;">
<div *ngFor="let entity of folderInfo.entitiesSharing | sortBy">
<b color="secondary">{{entity}}</b>
</div>
</div>
</div>
</div>
</div>
</div>
</div> </div>
<div class="container" [class.fullContainer]="appService.getViewMode()"> <div class="container" [class.fullContainer]="appService.getViewMode()">
<div class="container-content"> <div class="container-content">
...@@ -48,7 +74,8 @@ ...@@ -48,7 +74,8 @@
<div class="table-head-tool"> <div class="table-head-tool">
<span> <span>
<app-folder-action-list #actionsList [contextMode]="false" [currentFolderInfo]="folderInfo" <app-folder-action-list #actionsList [contextMode]="false" [currentFolderInfo]="folderInfo"
[totalRes]="allResInBasket.length" [selectedRes]="selectedRes" (refreshEvent)="refreshDaoAfterAction()" [totalRes]="allResInBasket.length" [selectedRes]="selectedRes"
(refreshEvent)="refreshDaoAfterAction()"
(refreshPanelFolders)="panelFolder.refreshFoldersTree()"> (refreshPanelFolders)="panelFolder.refreshFoldersTree()">
</app-folder-action-list> </app-folder-action-list>
</span> </span>
...@@ -61,8 +88,8 @@ ...@@ -61,8 +88,8 @@
<div style="height:90%;overflow:auto;position:absolute;width:100%;"> <div style="height:90%;overflow:auto;position:absolute;width:100%;">
<table #tableBasketListSort="matSort" cdkDropList id="folder-list" <table #tableBasketListSort="matSort" cdkDropList id="folder-list"
[cdkDropListConnectedTo]="listTodrag()" [cdkDropListData]="data" [cdkDropListConnectedTo]="listTodrag()" [cdkDropListData]="data"
[cdkDropListDisabled]="dragInit || appService.getViewMode()" mat-table [dataSource]="data" matSort matSortActive="res_id" [cdkDropListDisabled]="dragInit || appService.getViewMode()" mat-table [dataSource]="data"
matSortDisableClear matSortDirection="asc" style="width:100%;"> matSort matSortActive="res_id" matSortDisableClear matSortDirection="asc" style="width:100%;">
<ng-container matColumnDef="res_id"> <ng-container matColumnDef="res_id">
<td mat-cell *matCellDef="let row" <td mat-cell *matCellDef="let row"
...@@ -78,11 +105,7 @@ ...@@ -78,11 +105,7 @@
class="main-info-status"> class="main-info-status">
<mat-icon *ngIf="row.isLocked !== true" title="{{row.statusLabel}}" <mat-icon *ngIf="row.isLocked !== true" title="{{row.statusLabel}}"
[ngStyle]="{'color': row.priorityColor}" color="primary" [ngStyle]="{'color': row.priorityColor}" color="primary"
class="{{row.statusImage.charAt(0)}}{{row.statusImage.charAt(1)}} {{row.statusImage}} {{row.statusImage.charAt(0)}}{{row.statusImage.charAt(1)}}-2x statusIcon"> class="{{row.statusImage.charAt(0)}}{{row.statusImage.charAt(1)}} {{row.statusImage}} {{row.statusImage.charAt(0)}}{{row.statusImage.charAt(1)}}-2x">
</mat-icon>
<mat-icon *ngIf="row.isLocked !== true" title="{{row.statusLabel}}"
[ngStyle]="{'color': row.priorityColor}" color="primary"
class="fa fa-folder-open fa-2x">
</mat-icon> </mat-icon>
<span *ngIf="row.confidentiality === 'Y'" <span *ngIf="row.confidentiality === 'Y'"
class="watermark">{{lang.confidential}}</span> class="watermark">{{lang.confidential}}</span>
...@@ -95,8 +118,8 @@ ...@@ -95,8 +118,8 @@
style="width:200px;text-align:center;cursor:pointer;"> style="width:200px;text-align:center;cursor:pointer;">
<ng-container <ng-container
*ngIf="row.alt_identifier == lang.undefined && row.barcode != lang.undefined"> *ngIf="row.alt_identifier == lang.undefined && row.barcode != lang.undefined">
<span style="color: rgba(0,0,0,0.4);font-size: 90%;"><i <span style="color: rgba(0,0,0,0.4);font-size: 90%;">
title="{{lang.barcode}}" class="fas fa-barcode"></i> <i title="{{lang.barcode}}" class="fas fa-barcode"></i>
{{row.barcode}}</span> {{row.barcode}}</span>
</ng-container> </ng-container>
<ng-container *ngIf="row.barcode == lang.undefined"> <ng-container *ngIf="row.barcode == lang.undefined">
...@@ -104,7 +127,8 @@ ...@@ -104,7 +127,8 @@
</ng-container> </ng-container>
</span> </span>
<span class="main-info-data" style="font-weight:bold;flex:1;cursor:pointer;" <span class="main-info-data" style="font-weight:bold;flex:1;cursor:pointer;"
[class.undefined]="row.subject == lang.undefined" title="{{row.subject}}">{{row.subject | shorten: 150: '...'}}</span> [class.undefined]="row.subject == lang.undefined"
title="{{row.subject}}">{{row.subject | shorten: 150: '...'}}</span>
<span class="main-info-action"> <span class="main-info-action">
<button mat-icon-button title="{{lang.notes}}" <button mat-icon-button title="{{lang.notes}}"
(click)="$event.stopPropagation();togglePanel('note',row)" (click)="$event.stopPropagation();togglePanel('note',row)"
...@@ -138,12 +162,15 @@ ...@@ -138,12 +162,15 @@
</td> </td>
</ng-container> </ng-container>
<tr mat-row *matRowDef="let row; columns: displayedColumnsBasket;" <tr mat-row *matRowDef="let row; columns: displayedColumnsBasket;"
(contextmenu)="open($event,row);" (click)="open($event,row);" class="rowData" style="cursor: pointer;" [class.locked]="row.isLocked == true" (contextmenu)="open($event,row);" (click)="open($event,row);" class="rowData"
cdkDrag (cdkDragStarted)="selectSpecificRes(row);" [cdkDragData]="row"> style="cursor: pointer;" [class.locked]="row.isLocked == true" cdkDrag
(cdkDragStarted)="selectSpecificRes(row);" [cdkDragData]="row">
<div class="example-custom-placeholder" *cdkDragPlaceholder></div> <div class="example-custom-placeholder" *cdkDragPlaceholder></div>
<div class="dragPreview" *cdkDragPreview><i <div class="dragPreview" *cdkDragPreview><i class="fas fa-envelope-open-text fa-2x"></i>
class="fas fa-envelope-open-text fa-2x"></i><br />{{lang.classifyInFolder}} : <br />
<b>{{row.alt_identifier}}</b></div> {{lang.classifyInFolder}} :
<b>{{row.alt_identifier}}</b>
</div>
</tr> </tr>
</table> </table>
</div> </div>
...@@ -168,6 +195,7 @@ ...@@ -168,6 +195,7 @@
<mat-divider></mat-divider> <mat-divider></mat-divider>
</mat-sidenav> </mat-sidenav>
</mat-sidenav-container> </mat-sidenav-container>
<app-folder-action-list #actionsListContext [contextMode]="true" [currentFolderInfo]="folderInfo" [totalRes]="allResInBasket.length" <app-folder-action-list #actionsListContext [contextMode]="true" [currentFolderInfo]="folderInfo"
[selectedRes]="selectedRes" (refreshEvent)="refreshDaoAfterAction()" (refreshPanelFolders)="panelFolder.refreshFoldersTree()"> [totalRes]="allResInBasket.length" [selectedRes]="selectedRes" (refreshEvent)="refreshDaoAfterAction()"
(refreshPanelFolders)="panelFolder.refreshFoldersTree()">
</app-folder-action-list> </app-folder-action-list>
\ No newline at end of file
...@@ -9,12 +9,58 @@ ...@@ -9,12 +9,58 @@
color: $primary; color: $primary;
} }
.statusIcon { .banner {
font-size: 10px; display: flex;
position: absolute; flex-direction: column;
right: 0px; margin: 10px;
background: white; border-radius: 20px;