From 067c61787ca8dedc4f09887e439538a2f9f5b5e7 Mon Sep 17 00:00:00 2001 From: lvessiller <lvessiller@open-dsi.fr> Date: Thu, 25 Feb 2021 12:28:46 +0100 Subject: [PATCH] FIX show Pastell config in demat BP --- appinfo/info.xml | 2 +- appinfo/routes.php | 3 +-- lib/Controller/PageController.php | 37 ++++++++++++++++++------------ lib/Settings/AdminSettings.php | 6 ++--- templates/content/archive_list.php | 4 ++-- templates/content/index.php | 13 ++++++----- templates/content/user_list.php | 4 +++- templates/navigation/index.php | 4 ++++ 8 files changed, 43 insertions(+), 30 deletions(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index 0dcc73a..95a6b7f 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -5,7 +5,7 @@ <name>Bulletins</name> <summary>Dématérialisation des bulletins de paie</summary> <description><![CDATA[Dématérialisation des bulletins de paie]]></description> - <version>3.0.0</version> + <version>3.0.1</version> <licence>agpl</licence> <author mail="support@open-dsi.fr" >Open-DSI</author> <namespace>Dematpayslip</namespace> diff --git a/appinfo/routes.php b/appinfo/routes.php index 0786509..d3c10f9 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -21,7 +21,6 @@ return [ ['name' => 'page#archive_action', 'url' => '/archive_action', 'verb' => 'POST'], ['name' => 'page#archive_csv', 'url' => '/archive_csv', 'verb' => 'GET'], //['name' => 'page#user_list', 'url' => '/user_list', 'verb' => ['GET', 'POST']], - ['name' => 'page#user_list', 'url' => '/user_list', 'verb' => 'GET'], - ['name' => 'page#user_list', 'url' => '/user_list', 'verb' => 'POST'], + ['name' => 'page#user_list', 'url' => '/user_list', 'verbs' => 'GET'], ] ]; diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index fb9e766..7d8e9c5 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -429,11 +429,12 @@ class PageController extends Controller { */ private function _assignParamsDemat() { return array( - 'canCancelProcess' => $this->_canCancelProcess, - 'msgList' => $this->_msgList, - 'processArr' => $this->_process->jsonSerialize(), - 'userArr' => array('id' => $this->userId), - 'pastellAppExists' => $this->_pastellAppExists, + 'dematpayslipConfigList' => $this->_dematpayslipConfigList, + 'pastellAppExists' => $this->_pastellAppExists, + 'canCancelProcess' => $this->_canCancelProcess, + 'msgList' => $this->_msgList, + 'processArr' => $this->_process->jsonSerialize(), + 'userArr' => array('id' => $this->userId), ); } @@ -444,9 +445,11 @@ class PageController extends Controller { */ private function _assignAgentList() { return array( - 'dematpayslipUserList' => $this->_dematpayslipUserMapper->findAll(), - 'exportDirUserPath' => $this->_exportDirUserPath, - 'msgList' => $this->_msgList, + 'dematpayslipConfigList' => $this->_dematpayslipConfigList, + 'pastellAppExists' => $this->_pastellAppExists, + 'dematpayslipUserList' => $this->_dematpayslipUserMapper->findAll(), + 'exportDirUserPath' => $this->_exportDirUserPath, + 'msgList' => $this->_msgList, ); } @@ -522,10 +525,12 @@ class PageController extends Controller { } return array( + 'dematpayslipConfigList' => $this->_dematpayslipConfigList, + 'pastellAppExists' => $this->_pastellAppExists, 'dematpayslipArchiveList' => $dematpayslipArchiveList, 'exportDirUserPath' => $this->_exportDirUserPath, 'msgList' => $this->_msgList, - 'paramList' => $paramList + 'paramList' => $paramList, ); } @@ -537,6 +542,8 @@ class PageController extends Controller { */ private function _assignUserList($searchList) { return array( + 'dematpayslipConfigList' => $this->_dematpayslipConfigList, + 'pastellAppExists' => $this->_pastellAppExists, 'msgList' => $this->_msgList, 'searchList' => $searchList, 'userList' => $this->_userList, @@ -1012,12 +1019,12 @@ class PageController extends Controller { $this->_msgList['error'][] = $this->l->t('Veuillez vérifier la configuration de cette application.'); } - $pastellUse = $this->config->getAppValue($this->appName, 'pastell_use', ''); - if (!empty($pastellUse)) { + $this->_dematpayslipConfigList['pastell_use'] = $this->config->getAppValue($this->appName, 'pastell_use', ''); + if (!empty($this->_dematpayslipConfigList['pastell_use'])) { // check Pastell API config - $pastellConfigFlow1Id = $this->config->getAppValue($this->appName, 'pastell_config_f1_id', ''); - $pastellConfigFlow2Id = $this->config->getAppValue($this->appName, 'pastell_config_f2_id', ''); - if (!($pastellConfigFlow1Id > 0) || !($pastellConfigFlow2Id > 0)) { + $this->_dematpayslipConfigList['pastell_config_f1_id'] = $this->config->getAppValue($this->appName, 'pastell_config_f1_id', ''); + $this->_dematpayslipConfigList['pastell_config_f2_id'] = $this->config->getAppValue($this->appName, 'pastell_config_f2_id', ''); + if (!($this->_dematpayslipConfigList['pastell_config_f1_id'] > 0) || !($this->_dematpayslipConfigList['pastell_config_f2_id'] > 0)) { $this->_msgList['error'][] = $this->l->t('Veuillez vérifier la configuration de cette application.'); } } @@ -2446,7 +2453,7 @@ class PageController extends Controller { public function userList() { // verifier l'utilisateur if ($this->userId === $this->_dematpayslipConfigList['user_id']) { - $userEmail = filter_input(INPUT_POST, 'user_search_email', FILTER_SANITIZE_EMAIL); + $userEmail = filter_input(INPUT_GET, 'user_search_email', FILTER_SANITIZE_EMAIL); $searchList = array( 'user_search_email' => $userEmail ); diff --git a/lib/Settings/AdminSettings.php b/lib/Settings/AdminSettings.php index 2447317..5fa4e45 100644 --- a/lib/Settings/AdminSettings.php +++ b/lib/Settings/AdminSettings.php @@ -84,11 +84,11 @@ class AdminSettings implements ISettings { $this->_pastellConfigFlowMapper = null; $this->_pastellConfigFlowList = array(); if ($this->_pastellAppExists === true) { - $pastellUse = intval($this->_dematpayslipConfigList['pastell_use']); - if ($pastellUse === 1) { + //$pastellUse = intval($this->_dematpayslipConfigList['pastell_use']); + //if ($pastellUse === 1) { $this->_pastellConfigFlowMapper = new PastellConfigFlowMapper(\OC::$server->getDatabaseConnection()); $this->_pastellConfigFlowList = $this->_pastellConfigFlowMapper->findAll(); - } + //} } return array( diff --git a/templates/content/archive_list.php b/templates/content/archive_list.php index 2d6ed08..3d4b8c2 100644 --- a/templates/content/archive_list.php +++ b/templates/content/archive_list.php @@ -1,12 +1,12 @@ <?php + $urlGenerator = OC::$server->getURLGenerator(); + // assigned $dematpayslipArchiveList = (isset($_['dematpayslipArchiveList']) ? $_['dematpayslipArchiveList'] : array()); $exportDirUserPath = (isset($_['exportDirUserPath']) ? $_['exportDirUserPath'] : ''); $msgList = (isset($_['msgList']) ? $_['msgList'] : array()); $paramList = (isset($_['paramList']) ? $_['paramList'] : array()); - $urlGenerator = OC::$server->getURLGenerator(); - // alert messages $htmlAlert = ''; if (!empty($msgList)) { diff --git a/templates/content/index.php b/templates/content/index.php index 8fa8922..77c9dce 100644 --- a/templates/content/index.php +++ b/templates/content/index.php @@ -2,11 +2,12 @@ $urlGenerator = OC::$server->getURLGenerator(); // assigned - $canCancelProcess = (isset($_['canCancelProcess']) ? $_['canCancelProcess'] : false); - $msgList = (isset($_['msgList']) ? $_['msgList'] : array()); - $processArr = (isset($_['processArr']) ? $_['processArr'] : array()); - $userArr = (isset($_['userArr']) ? $_['userArr'] : array()); - $pastellAppExists = (isset($_['pastellAppExists']) ? $_['pastellAppExists'] : false); + $canCancelProcess = (isset($_['canCancelProcess']) ? $_['canCancelProcess'] : false); + $msgList = (isset($_['msgList']) ? $_['msgList'] : array()); + $processArr = (isset($_['processArr']) ? $_['processArr'] : array()); + $userArr = (isset($_['userArr']) ? $_['userArr'] : array()); + $dematpayslipConfigList = (isset($_['dematpayslipConfigList']) ? $_['dematpayslipConfigList'] : array()); + $pastellAppExists = (isset($_['pastellAppExists']) ? $_['pastellAppExists'] : false); // alert messages $htmlAlert = ''; @@ -105,7 +106,7 @@ <form action="<?php print $urlGenerator->linkToRoute('dematpayslip.page.indexation', array('retry' => $retry)); ?>" id="dematpayslips_indexation_form" name="dematpayslips_indexation_form" method="POST" role="form"> <input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']); ?>"> <div> - <?php if ($pastellAppExists == true) { ?> + <?php if ($pastellAppExists == true && $dematpayslipConfigList['pastell_use'] == 1) { ?> <input type="checkbox" id="payslip_launch_indexation" name="payslip_launch_indexation" value="1" checked="checked" /> <label for="payslip_launch_indexation"><?php p($l->t('Envoi en dématérialisation')); ?></label> <input type="checkbox" id="payslip_launch_archive" name="payslip_launch_archive" value="1" checked="checked" /> <label for="payslip_launch_archive"><?php p($l->t('Archivage')); ?></label> <?php } else { ?> diff --git a/templates/content/user_list.php b/templates/content/user_list.php index ac53b0b..87119e1 100644 --- a/templates/content/user_list.php +++ b/templates/content/user_list.php @@ -1,4 +1,6 @@ <?php + $urlGenerator = OC::$server->getURLGenerator(); + // assigned $msgList = (isset($_['msgList']) ? $_['msgList'] : array()); $searchList = (isset($_['searchList']) ? $_['searchList'] : array()); @@ -46,7 +48,7 @@ <h2><?php p($l->t('Liste des utilisateurs')); ?></h2> <div id="dematpayslip_alert"><?php print $htmlAlert; ?></div> - <form action="<?php echo \OC\URLGenerator::linkToRoute('dematpayslip.page.user_list'); ?>" name="user_search_form" enctype="multipart/form-data" method="POST" role="form"> + <form action="<?php echo $urlGenerator->linkToRoute('dematpayslip.page.user_list'); ?>" name="user_search_form" method="GET" role="form"> <fieldset> <legend class="dematpayslip_legend"><?php p($l->t('Rechercher un utilisateur')); ?></legend> <input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']); ?>"> diff --git a/templates/navigation/index.php b/templates/navigation/index.php index afbe2c8..0215fa5 100644 --- a/templates/navigation/index.php +++ b/templates/navigation/index.php @@ -1,9 +1,12 @@ <?php $urlGenerator = OC::$server->getURLGenerator(); + + $pastellAppExists = (isset($_['pastellAppExists']) ? $_['pastellAppExists'] : false); ?> <ul> <li><a href="<?php echo $urlGenerator->linkToRoute('dematpayslip.page.index'); ?>">Dématérialisation</a></li> <li><a href="<?php echo $urlGenerator->linkToRoute('dematpayslip.page.agent_list'); ?>">Liste des agents</a></li> + <?php if ($pastellAppExists == true) { ?> <li><a href="<?php echo $urlGenerator->linkToRoute('dematpayslip.page.archive_list'); ?>">Liste des bulletins</a></li> <li> <ul> @@ -12,4 +15,5 @@ <li><a href="<?php echo $urlGenerator->linkToRoute('dematpayslip.page.archive_list', ['step_status' => \OCA\Dematpayslip\Db\DematpayslipArchive::STEP_STATUS_ARCHIVED]); ?>">Archivés</a></li> </ul> </li> + <?php } ?> </ul> -- GitLab