From ce0f974f72ed93d5336e408176e551894c249e05 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Wed, 23 Aug 2023 08:49:38 +0200 Subject: [PATCH 001/293] Add saturne --- class/actions_digiriskdolibarr.class.php | 47 ++ class/dashboarddigiriskstats.class.php | 2 +- .../groupmentdocument.class.php | 95 --- .../listingrisksaction.class.php | 95 --- .../listingrisksphoto.class.php | 95 --- .../projectdocument.class.php | 97 --- .../ticketdocument.class.php | 96 --- .../workunitdocument.class.php | 96 --- .../firepermitdocument.class.php | 101 +-- .../groupmentdocument.class.php | 51 ++ .../index.php | 0 .../informationssharing.class.php | 0 .../legaldisplay.class.php | 0 .../listingrisksaction.class.php | 51 ++ .../listingrisksphoto.class.php | 51 ++ .../preventionplandocument.class.php | 0 .../projectdocument.class.php | 51 ++ .../riskassessmentdocument.class.php | 0 .../ticketdocument.class.php | 51 ++ .../workunitdocument.class.php | 51 ++ class/digiriskelement.class.php | 454 ++++---------- class/evaluator.class.php | 227 ++----- class/firepermit.class.php | 547 ++++------------- core/modules/modDigiriskDolibarr.class.php | 2 +- css/digiriskdolibarr.css.php | 82 --- css/scss/element/_dashboard-box.scss | 46 -- css/scss/element/_element.scss | 3 - css/scss/element/_patchnote.scss | 41 -- css/scss/element/_picto-digirisk.scss | 5 - css/scss/module/_module.scss | 11 - css/scss/module/button/_button-add.scss | 21 - css/scss/module/button/_button.scss | 204 ------- css/scss/module/button/_colors.scss | 138 ----- css/scss/module/button/index.php | 2 - css/scss/module/dropdown/_dropdown.scss | 134 ---- css/scss/module/dropdown/_grid.scss | 11 - css/scss/module/dropdown/_list.scss | 30 - css/scss/module/dropdown/index.php | 2 - css/scss/module/form/_checkbox.scss | 52 -- css/scss/module/form/_form.scss | 155 ----- css/scss/module/form/_input.scss | 78 --- css/scss/module/form/_radio.scss | 53 -- css/scss/module/gridlayout/_gridlayout.scss | 120 ---- css/scss/module/gridlayout/index.php | 2 - css/scss/module/index.php | 2 - css/scss/module/loader/_loader.scss | 35 -- css/scss/module/loader/index.php | 2 - css/scss/module/modal/_modal.scss | 133 ---- css/scss/module/modal/index.php | 2 - css/scss/module/notice/_notice.scss | 56 -- css/scss/module/notice/_status.scss | 55 -- css/scss/module/notice/index.php | 2 - css/scss/module/slider/_slider.scss | 82 --- css/scss/module/slider/index.php | 2 - css/scss/module/table/_flex.scss | 98 --- css/scss/module/table/_table.scss | 8 - css/scss/module/table/index.php | 2 - css/scss/module/tooltip/_tooltip.scss | 107 ---- css/scss/module/tooltip/index.php | 2 - digiriskdolibarr.main.inc.php | 12 +- documents/temp/index.php | 2 - lib/digiriskdolibarr_firepermit.lib.php | 58 +- lib/digiriskdolibarr_preventionplan.lib.php | 58 +- public/signature/add_signature.php | 278 --------- public/signature/index.php | 2 - public/signature/signature_success.php | 77 --- sql/data.sql | 5 + ...l => llx_c_firepermit_attendants_role.sql} | 13 +- .../llx_digiriskdolibarr_object_signature.sql | 41 -- sql/update.sql | 21 +- view/firepermit/firepermit_agenda.php | 187 ------ view/firepermit/firepermit_attendants.php | 574 ------------------ view/firepermit/firepermit_card.php | 24 +- view/firepermit/firepermit_schedule.php | 25 +- 74 files changed, 779 insertions(+), 4636 deletions(-) delete mode 100644 class/digiriskdocuments/groupmentdocument.class.php delete mode 100644 class/digiriskdocuments/listingrisksaction.class.php delete mode 100644 class/digiriskdocuments/listingrisksphoto.class.php delete mode 100644 class/digiriskdocuments/projectdocument.class.php delete mode 100644 class/digiriskdocuments/ticketdocument.class.php delete mode 100644 class/digiriskdocuments/workunitdocument.class.php rename class/{digiriskdocuments => digiriskdolibarrdocuments}/firepermitdocument.class.php (84%) create mode 100644 class/digiriskdolibarrdocuments/groupmentdocument.class.php rename class/{digiriskdocuments => digiriskdolibarrdocuments}/index.php (100%) rename class/{digiriskdocuments => digiriskdolibarrdocuments}/informationssharing.class.php (100%) rename class/{digiriskdocuments => digiriskdolibarrdocuments}/legaldisplay.class.php (100%) create mode 100644 class/digiriskdolibarrdocuments/listingrisksaction.class.php create mode 100644 class/digiriskdolibarrdocuments/listingrisksphoto.class.php rename class/{digiriskdocuments => digiriskdolibarrdocuments}/preventionplandocument.class.php (100%) create mode 100644 class/digiriskdolibarrdocuments/projectdocument.class.php rename class/{digiriskdocuments => digiriskdolibarrdocuments}/riskassessmentdocument.class.php (100%) create mode 100644 class/digiriskdolibarrdocuments/ticketdocument.class.php create mode 100644 class/digiriskdolibarrdocuments/workunitdocument.class.php delete mode 100644 css/digiriskdolibarr.css.php delete mode 100644 css/scss/element/_dashboard-box.scss delete mode 100644 css/scss/element/_patchnote.scss delete mode 100644 css/scss/element/_picto-digirisk.scss delete mode 100644 css/scss/module/_module.scss delete mode 100644 css/scss/module/button/_button-add.scss delete mode 100644 css/scss/module/button/_button.scss delete mode 100644 css/scss/module/button/_colors.scss delete mode 100644 css/scss/module/button/index.php delete mode 100644 css/scss/module/dropdown/_dropdown.scss delete mode 100644 css/scss/module/dropdown/_grid.scss delete mode 100644 css/scss/module/dropdown/_list.scss delete mode 100644 css/scss/module/dropdown/index.php delete mode 100644 css/scss/module/form/_checkbox.scss delete mode 100644 css/scss/module/form/_form.scss delete mode 100644 css/scss/module/form/_input.scss delete mode 100644 css/scss/module/form/_radio.scss delete mode 100644 css/scss/module/gridlayout/_gridlayout.scss delete mode 100644 css/scss/module/gridlayout/index.php delete mode 100644 css/scss/module/index.php delete mode 100644 css/scss/module/loader/_loader.scss delete mode 100644 css/scss/module/loader/index.php delete mode 100644 css/scss/module/modal/_modal.scss delete mode 100644 css/scss/module/modal/index.php delete mode 100644 css/scss/module/notice/_notice.scss delete mode 100644 css/scss/module/notice/_status.scss delete mode 100644 css/scss/module/notice/index.php delete mode 100644 css/scss/module/slider/_slider.scss delete mode 100644 css/scss/module/slider/index.php delete mode 100644 css/scss/module/table/_flex.scss delete mode 100644 css/scss/module/table/_table.scss delete mode 100644 css/scss/module/table/index.php delete mode 100644 css/scss/module/tooltip/_tooltip.scss delete mode 100644 css/scss/module/tooltip/index.php delete mode 100644 documents/temp/index.php delete mode 100644 public/signature/add_signature.php delete mode 100644 public/signature/index.php delete mode 100644 public/signature/signature_success.php rename sql/{signature/llx_digiriskdolibarr_object_signature.key.sql => llx_c_firepermit_attendants_role.sql} (63%) delete mode 100644 sql/signature/llx_digiriskdolibarr_object_signature.sql delete mode 100644 view/firepermit/firepermit_agenda.php delete mode 100644 view/firepermit/firepermit_attendants.php diff --git a/class/actions_digiriskdolibarr.class.php b/class/actions_digiriskdolibarr.class.php index f710948fd..a25d33e6a 100644 --- a/class/actions_digiriskdolibarr.class.php +++ b/class/actions_digiriskdolibarr.class.php @@ -782,4 +782,51 @@ public function commonGenerateDocument($parameters, $object, $action) { } return $preventrecursivecall; // return 0 or return 1 to replace standard code } + + /** + * Overloading the saturneAttendantsRole function : replacing the parent's function with the one below. + * + * @param array $parameters Hook metadatas (context, etc...). + * @return int 0 < on error, 0 on success, 1 to replace standard code. + */ + public function saturneBannerTab(array $parameters, $object) + { + global $langs; + + // Do something only for the current context. + if ($parameters['currentcontext'] == 'firepermitsignature') { + require_once __DIR__ . '/../class/digiriskresources.class.php'; + + $digiriskresources = new DigiriskResources($this->db); + + $extSociety = $digiriskresources->fetchResourcesFromObject('FP_EXT_SOCIETY', $object); + $moreHtmlRef = $langs->trans('ExtSociety') . ' : ' . $extSociety->getNomUrl(1); + + $this->resprints = $moreHtmlRef; + } + + return 0; // or return 1 to replace standard code. + } + + /** + * Overloading the saturneAttendantsRole function : replacing the parent's function with the one below. + * + * @param array $parameters Hook metadatas (context, etc...). + * @return int 0 < on error, 0 on success, 1 to replace standard code. + */ + public function saturneAttendantsRole(array $parameters, $object) + { + // Do something only for the current context. + if ($parameters['currentcontext'] == 'firepermitsignature') { +// $signatory->fetchSignatory('FP_MAITRE_OEUVRE', $id, 'firepermit'); +// $signatory->fetchSignatory('FP_EXT_SOCIETY_RESPONSIBLE', $id, 'firepermit'); +// $signatory->fetchSignatory('FP_EXT_SOCIETY_INTERVENANTS', $id, 'firepermit'); + $signatoriesByRole['InternalResponsible'] = $parameters['signatory']->fetchSignatory('InternalResponsible', $object->id, $object->element); + $signatoriesByRole['ExternalResponsible'] = $parameters['signatory']->fetchSignatory('ExternalResponsible', $object->id, $object->element); + $signatoriesByRole['Attendant'] = $parameters['signatory']->fetchSignatory('Attendant', $object->id, $object->element); + $this->results = $signatoriesByRole; + } + + return 1; // or return 1 to replace standard code. + } } diff --git a/class/dashboarddigiriskstats.class.php b/class/dashboarddigiriskstats.class.php index b1a7d5bc1..5e211d7b8 100644 --- a/class/dashboarddigiriskstats.class.php +++ b/class/dashboarddigiriskstats.class.php @@ -27,7 +27,7 @@ require_once __DIR__ . '/digiriskstats.php'; require_once __DIR__ . '/riskanalysis/risk.class.php'; require_once __DIR__ . '/digirisktask.class.php'; -require_once __DIR__ . '/digiriskdocuments/riskassessmentdocument.class.php'; +require_once __DIR__ . '/digiriskdolibarrdocuments/riskassessmentdocument.class.php'; require_once __DIR__ . '/accident.class.php'; require_once __DIR__ . '/evaluator.class.php'; require_once __DIR__ . '/digiriskresources.class.php'; diff --git a/class/digiriskdocuments/groupmentdocument.class.php b/class/digiriskdocuments/groupmentdocument.class.php deleted file mode 100644 index fed477227..000000000 --- a/class/digiriskdocuments/groupmentdocument.class.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file class/digiriskdocuments/groupmentdocument.class.php - * \ingroup digiriskdolibarr - * \brief This file is a class file for GroupmentDocument - */ - -require_once __DIR__ . '/../digiriskdocuments.class.php'; - -/** - * Class for GroupmentDocument - */ -class GroupmentDocument extends DigiriskDocuments -{ - /** - * @var DoliDB Database handler. - */ - public $db; - - /** - * @var string ID to identify managed object. - */ - public $element = 'groupmentdocument'; - - /** - * @var int Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - - /** - * @var string String with name of icon for groupmentdocument. Must be the part after the 'object_' into object_groupmentdocument.png - */ - public $picto = 'groupmentdocument@digiriskdolibarr'; - - /** - * Constructor - * - * @param DoliDb $db Database handler - */ - public function __construct(DoliDB $db) - { - global $conf, $langs; - - $this->db = $db; - - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; - if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; - - // Unset fields that are disabled - foreach ($this->fields as $key => $val) - { - if (isset($val['enabled']) && empty($val['enabled'])) - { - unset($this->fields[$key]); - } - } - - // Translate some data of arrayofkeyval - if (is_object($langs)) - { - foreach ($this->fields as $key => $val) - { - if (is_array($val['arrayofkeyval'])) - { - foreach ($val['arrayofkeyval'] as $key2 => $val2) - { - $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2); - } - } - } - } - } -} diff --git a/class/digiriskdocuments/listingrisksaction.class.php b/class/digiriskdocuments/listingrisksaction.class.php deleted file mode 100644 index e9e3e2837..000000000 --- a/class/digiriskdocuments/listingrisksaction.class.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file class/digiriskdocuments/listingrisksaction.class.php - * \ingroup digiriskdolibarr - * \brief This file is a class file for ListingRisksAction - */ - -require_once __DIR__ . '/../digiriskdocuments.class.php'; - -/** - * Class for ListingRisksAction - */ -class ListingRisksAction extends DigiriskDocuments -{ - /** - * @var DoliDB Database handler. - */ - public $db; - - /** - * @var string ID to identify managed object. - */ - public $element = 'listingrisksaction'; - - /** - * @var int Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - - /** - * @var string String with name of icon for listingrisksaction. Must be the part after the 'object_' into object_listingrisksaction.png - */ - public $picto = 'listingrisksaction@digiriskdolibarr'; - - /** - * Constructor - * - * @param DoliDb $db Database handler - */ - public function __construct(DoliDB $db) - { - global $conf, $langs; - - $this->db = $db; - - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; - if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; - - // Unset fields that are disabled - foreach ($this->fields as $key => $val) - { - if (isset($val['enabled']) && empty($val['enabled'])) - { - unset($this->fields[$key]); - } - } - - // Translate some data of arrayofkeyval - if (is_object($langs)) - { - foreach ($this->fields as $key => $val) - { - if (is_array($val['arrayofkeyval'])) - { - foreach ($val['arrayofkeyval'] as $key2 => $val2) - { - $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2); - } - } - } - } - } -} diff --git a/class/digiriskdocuments/listingrisksphoto.class.php b/class/digiriskdocuments/listingrisksphoto.class.php deleted file mode 100644 index c684149db..000000000 --- a/class/digiriskdocuments/listingrisksphoto.class.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file class/digiriskdocuments/listingrisksphoto.class.php - * \ingroup digiriskdolibarr - * \brief This file is a class file for ListingRisksPhoto - */ - -require_once __DIR__ . '/../digiriskdocuments.class.php'; - -/** - * Class for ListingRisksPhoto - */ -class ListingRisksPhoto extends DigiriskDocuments -{ - /** - * @var DoliDB Database handler. - */ - public $db; - - /** - * @var string ID to identify managed object. - */ - public $element = 'listingrisksphoto'; - - /** - * @var int Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - - /** - * @var string String with name of icon for listingrisksphoto. Must be the part after the 'object_' into object_listingrisksphoto.png - */ - public $picto = 'listingrisksphoto@digiriskdolibarr'; - - /** - * Constructor - * - * @param DoliDb $db Database handler - */ - public function __construct(DoliDB $db) - { - global $conf, $langs; - - $this->db = $db; - - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; - if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; - - // Unset fields that are disabled - foreach ($this->fields as $key => $val) - { - if (isset($val['enabled']) && empty($val['enabled'])) - { - unset($this->fields[$key]); - } - } - - // Translate some data of arrayofkeyval - if (is_object($langs)) - { - foreach ($this->fields as $key => $val) - { - if (is_array($val['arrayofkeyval'])) - { - foreach ($val['arrayofkeyval'] as $key2 => $val2) - { - $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2); - } - } - } - } - } -} diff --git a/class/digiriskdocuments/projectdocument.class.php b/class/digiriskdocuments/projectdocument.class.php deleted file mode 100644 index 1a894dae7..000000000 --- a/class/digiriskdocuments/projectdocument.class.php +++ /dev/null @@ -1,97 +0,0 @@ - - * Copyright (C) 2022-2023 EVARISK - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file class/digiriskdocuments/projectdocument.class.php - * \ingroup digiriskdolibarr - * \brief This file is a class file for ProjectDocument - */ - -require_once __DIR__ . '/../digiriskdocuments.class.php'; - -/** - * Class for ProjectDocument - */ -class ProjectDocument extends DigiriskDocuments -{ - /** - * @var DoliDB Database handler. - */ - public $db; - - /** - * @var int Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table - */ - public $element = 'projectdocument'; - - /** - * @var int Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - - /** - * @var string String with name of icon for projectdocument. Must be the part after the 'object_' into object_projectdocument.png - */ - public $picto = 'projectdocument@digiriskdolibarr'; - - /** - * Constructor - * - * @param DoliDb $db Database handler - */ - public function __construct(DoliDB $db) - { - global $conf, $langs; - - $this->db = $db; - - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; - if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; - - // Unset fields that are disabled - foreach ($this->fields as $key => $val) - { - if (isset($val['enabled']) && empty($val['enabled'])) - { - unset($this->fields[$key]); - } - } - - // Translate some data of arrayofkeyval - if (is_object($langs)) - { - foreach ($this->fields as $key => $val) - { - if (is_array($val['arrayofkeyval'])) - { - foreach ($val['arrayofkeyval'] as $key2 => $val2) - { - $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2); - } - } - } - } - } -} diff --git a/class/digiriskdocuments/ticketdocument.class.php b/class/digiriskdocuments/ticketdocument.class.php deleted file mode 100644 index 6f4e237ff..000000000 --- a/class/digiriskdocuments/ticketdocument.class.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file class/digiriskdocuments/ticketdocument.class.php - * \ingroup digiriskdolibarr - * \brief This file is a class file for TicketDocument - */ - -require_once __DIR__ . '/../digiriskdocuments.class.php'; - -/** - * Class for TicketDocument - */ -class TicketDocument extends DigiriskDocuments -{ - /** - * @var DoliDB Database handler. - */ - public $db; - - /** - * @var int Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table - */ - public $element = 'ticketdocument'; - - /** - * @var int Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - - /** - * @var string String with name of icon for ticketdocument. Must be the part after the 'object_' into object_ticketdocument.png - */ - public $picto = 'ticketdocument@digiriskdolibarr'; - - /** - * Constructor - * - * @param DoliDb $db Database handler - */ - public function __construct(DoliDB $db) - { - global $conf, $langs; - - $this->db = $db; - - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; - if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; - - // Unset fields that are disabled - foreach ($this->fields as $key => $val) - { - if (isset($val['enabled']) && empty($val['enabled'])) - { - unset($this->fields[$key]); - } - } - - // Translate some data of arrayofkeyval - if (is_object($langs)) - { - foreach ($this->fields as $key => $val) - { - if (is_array($val['arrayofkeyval'])) - { - foreach ($val['arrayofkeyval'] as $key2 => $val2) - { - $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2); - } - } - } - } - } -} diff --git a/class/digiriskdocuments/workunitdocument.class.php b/class/digiriskdocuments/workunitdocument.class.php deleted file mode 100644 index cb9f4a5a5..000000000 --- a/class/digiriskdocuments/workunitdocument.class.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file class/digiriskdocuments/workunitdocument.class.php - * \ingroup digiriskdolibarr - * \brief This file is a class file for WorkUnitDocument - */ - -require_once __DIR__ . '/../digiriskdocuments.class.php'; - -/** - * Class for WorkUnitDocument - */ -class WorkUnitDocument extends DigiriskDocuments -{ - /** - * @var DoliDB Database handler. - */ - public $db; - - /** - * @var int Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table - */ - public $element = 'workunitdocument'; - - /** - * @var int Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - - /** - * @var string String with name of icon for workunitdocument. Must be the part after the 'object_' into object_workunitdocument.png - */ - public $picto = 'workunitdocument@digiriskdolibarr'; - - /** - * Constructor - * - * @param DoliDb $db Database handler - */ - public function __construct(DoliDB $db) - { - global $conf, $langs; - - $this->db = $db; - - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; - if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; - - // Unset fields that are disabled - foreach ($this->fields as $key => $val) - { - if (isset($val['enabled']) && empty($val['enabled'])) - { - unset($this->fields[$key]); - } - } - - // Translate some data of arrayofkeyval - if (is_object($langs)) - { - foreach ($this->fields as $key => $val) - { - if (is_array($val['arrayofkeyval'])) - { - foreach ($val['arrayofkeyval'] as $key2 => $val2) - { - $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2); - } - } - } - } - } -} diff --git a/class/digiriskdocuments/firepermitdocument.class.php b/class/digiriskdolibarrdocuments/firepermitdocument.class.php similarity index 84% rename from class/digiriskdocuments/firepermitdocument.class.php rename to class/digiriskdolibarrdocuments/firepermitdocument.class.php index 4dcf6382c..78da2b53a 100644 --- a/class/digiriskdocuments/firepermitdocument.class.php +++ b/class/digiriskdolibarrdocuments/firepermitdocument.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2022-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,80 +16,38 @@ */ /** - * \file class/digiriskdocuments/firepermitdocument.class.php - * \ingroup digiriskdolibarr - * \brief This file is a class file for FirePermitDocument + * \file class/digiriskdolibarrdocuments/firepermitdocument.class.php + * \ingroup digiriskdolibarr + * \brief This file is a class file for FirePermitDocument. */ -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; - -require_once __DIR__ . '/../digiriskdocuments.class.php'; -require_once __DIR__ . '/../digiriskresources.class.php'; -require_once __DIR__ . '/../openinghours.class.php'; +// Load Saturne libraries. +require_once __DIR__ . '/../../../saturne/class/saturnedocuments.class.php'; /** - * Class for FirePermitDocument + * Class for FirePermitDocument. */ -class FirePermitDocument extends DigiriskDocuments +class FirePermitDocument extends SaturneDocuments { - /** - * @var DoliDB Database handler. - */ - public $db; - - /** - * @var string ID to identify managed object. - */ - public $element = 'firepermitdocument'; - - /** - * @var int Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - - /** - * @var string String with name of icon for firepermitdocument. Must be the part after the 'object_' into object_firepermitdocument.png - */ - public $picto = 'firepermitdocument@digiriskdolibarr'; - - /** - * Constructor - * - * @param DoliDb $db Database handler - */ - public function __construct(DoliDB $db) - { - global $conf, $langs; - - $this->db = $db; - - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; - if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; - - // Unset fields that are disabled - foreach ($this->fields as $key => $val) { - if (isset($val['enabled']) && empty($val['enabled'])) { - unset($this->fields[$key]); - } - } - - // Translate some data of arrayofkeyval - if (is_object($langs)) { - foreach ($this->fields as $key => $val) { - if (is_array($val['arrayofkeyval'])) { - foreach ($val['arrayofkeyval'] as $key2 => $val2) { - $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2); - } - } - } - } - } + /** + * @var string Module name. + */ + public string $module = 'digiriskdolibarr'; + + /** + * @var string Element type of object. + */ + public $element = 'firepermitdocument'; + + /** + * Constructor. + * + * @param DoliDb $db Database handler. + */ + public function __construct(DoliDB $db) + { + parent::__construct($db, $this->module, $this->element); + } /** * Function for JSON filling before saving in database @@ -101,6 +59,11 @@ public function FirePermitDocumentFillJSON() { global $conf; + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; + + require_once __DIR__ . '/../digiriskresources.class.php'; + require_once __DIR__ . '/../openinghours.class.php'; + $digiriskelement = new DigiriskElement($this->db); $resources = new DigiriskResources($this->db); $firepermit = new FirePermit($this->db); diff --git a/class/digiriskdolibarrdocuments/groupmentdocument.class.php b/class/digiriskdolibarrdocuments/groupmentdocument.class.php new file mode 100644 index 000000000..1303d877b --- /dev/null +++ b/class/digiriskdolibarrdocuments/groupmentdocument.class.php @@ -0,0 +1,51 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file class/digiriskdolibarrdocuments/groupmentdocument.class.php + * \ingroup digiriskdolibarr + * \brief This file is a class file for GroupmentDocument. + */ + +// Load Saturne libraries. +require_once __DIR__ . '/../../../saturne/class/saturnedocuments.class.php'; + +/** + * Class for GroupmentDocument. + */ +class GroupmentDocument extends SaturneDocuments +{ + /** + * @var string Module name. + */ + public string $module = 'digiriskdolibarr'; + + /** + * @var string Element type of object. + */ + public $element = 'groupmentdocument'; + + /** + * Constructor. + * + * @param DoliDb $db Database handler. + */ + public function __construct(DoliDB $db) + { + parent::__construct($db, $this->module, $this->element); + } +} diff --git a/class/digiriskdocuments/index.php b/class/digiriskdolibarrdocuments/index.php similarity index 100% rename from class/digiriskdocuments/index.php rename to class/digiriskdolibarrdocuments/index.php diff --git a/class/digiriskdocuments/informationssharing.class.php b/class/digiriskdolibarrdocuments/informationssharing.class.php similarity index 100% rename from class/digiriskdocuments/informationssharing.class.php rename to class/digiriskdolibarrdocuments/informationssharing.class.php diff --git a/class/digiriskdocuments/legaldisplay.class.php b/class/digiriskdolibarrdocuments/legaldisplay.class.php similarity index 100% rename from class/digiriskdocuments/legaldisplay.class.php rename to class/digiriskdolibarrdocuments/legaldisplay.class.php diff --git a/class/digiriskdolibarrdocuments/listingrisksaction.class.php b/class/digiriskdolibarrdocuments/listingrisksaction.class.php new file mode 100644 index 000000000..58e86fcc6 --- /dev/null +++ b/class/digiriskdolibarrdocuments/listingrisksaction.class.php @@ -0,0 +1,51 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file class/digiriskdolibarrdocuments/listingrisksaction.class.php + * \ingroup digiriskdolibarr + * \brief This file is a class file for ListingRisksAction. + */ + +// Load Saturne libraries. +require_once __DIR__ . '/../../../saturne/class/saturnedocuments.class.php'; + +/** + * Class for ListingRisksAction. + */ +class ListingRisksAction extends SaturneDocuments +{ + /** + * @var string Module name. + */ + public string $module = 'digiriskdolibarr'; + + /** + * @var string Element type of object. + */ + public $element = 'listingrisksaction'; + + /** + * Constructor. + * + * @param DoliDb $db Database handler. + */ + public function __construct(DoliDB $db) + { + parent::__construct($db, $this->module, $this->element); + } +} diff --git a/class/digiriskdolibarrdocuments/listingrisksphoto.class.php b/class/digiriskdolibarrdocuments/listingrisksphoto.class.php new file mode 100644 index 000000000..be06a003e --- /dev/null +++ b/class/digiriskdolibarrdocuments/listingrisksphoto.class.php @@ -0,0 +1,51 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file class/digiriskdolibarrdocuments/listingrisksphoto.class.php + * \ingroup digiriskdolibarr + * \brief This file is a class file for ListingRisksPhoto. + */ + +// Load Saturne libraries. +require_once __DIR__ . '/../../../saturne/class/saturnedocuments.class.php'; + +/** + * Class for ListingRisksPhoto. + */ +class ListingRisksPhoto extends SaturneDocuments +{ + /** + * @var string Module name. + */ + public string $module = 'digiriskdolibarr'; + + /** + * @var string Element type of object. + */ + public $element = 'listingrisksphoto'; + + /** + * Constructor. + * + * @param DoliDb $db Database handler. + */ + public function __construct(DoliDB $db) + { + parent::__construct($db, $this->module, $this->element); + } +} diff --git a/class/digiriskdocuments/preventionplandocument.class.php b/class/digiriskdolibarrdocuments/preventionplandocument.class.php similarity index 100% rename from class/digiriskdocuments/preventionplandocument.class.php rename to class/digiriskdolibarrdocuments/preventionplandocument.class.php diff --git a/class/digiriskdolibarrdocuments/projectdocument.class.php b/class/digiriskdolibarrdocuments/projectdocument.class.php new file mode 100644 index 000000000..5f46f3041 --- /dev/null +++ b/class/digiriskdolibarrdocuments/projectdocument.class.php @@ -0,0 +1,51 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file class/digiriskdolibarrdocuments/projectdocument.class.php + * \ingroup digiriskdolibarr + * \brief This file is a class file for ProjectDocument. + */ + +// Load Saturne libraries. +require_once __DIR__ . '/../../../saturne/class/saturnedocuments.class.php'; + +/** + * Class for ProjectDocument. + */ +class ProjectDocument extends SaturneDocuments +{ + /** + * @var string Module name. + */ + public string $module = 'digiriskdolibarr'; + + /** + * @var string Element type of object. + */ + public $element = 'projectdocument'; + + /** + * Constructor. + * + * @param DoliDb $db Database handler. + */ + public function __construct(DoliDB $db) + { + parent::__construct($db, $this->module, $this->element); + } +} diff --git a/class/digiriskdocuments/riskassessmentdocument.class.php b/class/digiriskdolibarrdocuments/riskassessmentdocument.class.php similarity index 100% rename from class/digiriskdocuments/riskassessmentdocument.class.php rename to class/digiriskdolibarrdocuments/riskassessmentdocument.class.php diff --git a/class/digiriskdolibarrdocuments/ticketdocument.class.php b/class/digiriskdolibarrdocuments/ticketdocument.class.php new file mode 100644 index 000000000..0d84f660d --- /dev/null +++ b/class/digiriskdolibarrdocuments/ticketdocument.class.php @@ -0,0 +1,51 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file class/digiriskdolibarrdocuments/ticketdocument.class.php + * \ingroup digiriskdolibarr + * \brief This file is a class file for TicketDocument. + */ + +// Load Saturne libraries. +require_once __DIR__ . '/../../../saturne/class/saturnedocuments.class.php'; + +/** + * Class for TicketDocument. + */ +class TicketDocument extends SaturneDocuments +{ + /** + * @var string Module name. + */ + public string $module = 'digiriskdolibarr'; + + /** + * @var string Element type of object. + */ + public $element = 'ticketdocument'; + + /** + * Constructor. + * + * @param DoliDb $db Database handler. + */ + public function __construct(DoliDB $db) + { + parent::__construct($db, $this->module, $this->element); + } +} diff --git a/class/digiriskdolibarrdocuments/workunitdocument.class.php b/class/digiriskdolibarrdocuments/workunitdocument.class.php new file mode 100644 index 000000000..2d2eb7bbf --- /dev/null +++ b/class/digiriskdolibarrdocuments/workunitdocument.class.php @@ -0,0 +1,51 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file class/digiriskdolibarrdocuments/workunitdocument.class.php + * \ingroup digiriskdolibarr + * \brief This file is a class file for WorkUnitDocument. + */ + +// Load Saturne libraries. +require_once __DIR__ . '/../../../saturne/class/saturnedocuments.class.php'; + +/** + * Class for WorkUnitDocument. + */ +class WorkUnitDocument extends SaturneDocuments +{ + /** + * @var string Module name. + */ + public string $module = 'digiriskdolibarr'; + + /** + * @var string Element type of object. + */ + public $element = 'workunitdocument'; + + /** + * Constructor. + * + * @param DoliDb $db Database handler. + */ + public function __construct(DoliDB $db) + { + parent::__construct($db, $this->module, $this->element); + } +} diff --git a/class/digiriskelement.class.php b/class/digiriskelement.class.php index cd3e8bc39..d7bad47f6 100644 --- a/class/digiriskelement.class.php +++ b/class/digiriskelement.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,91 +16,116 @@ */ /** - * \file class/digiriskelement.class.php - * \ingroup digiriskdolibarr - * \brief This file is a CRUD class file for DigiriskElement (Create/Read/Update/Delete) + * \file class/digiriskelement.class.php + * \ingroup digiriskdolibarr + * \brief This file is a CRUD class file for DigiriskElement (Create/Read/Update/Delete). */ // Put here all includes required by your class file -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; +// Load Saturne libraries. +require_once __DIR__ . '/../../saturne/class/saturneobject.class.php'; + require_once __DIR__ . '/../lib/digiriskdolibarr_function.lib.php'; /** - * Class for DigiriskElement + * Class for DigiriskElement. */ -class DigiriskElement extends CommonObject +class DigiriskElement extends SaturneObject { - /** - * @var DoliDB Database handler. - */ - public $db; - - /** - * @var string[] Array of error strings - */ - public $errors = array(); - - /** - * @var array Result array. - */ - public $result = array(); - - /** - * @var int The object identifier - */ - public $id; - - /** - * @var string ID to identify managed object. - */ - public $element = 'digiriskelement'; - - /** - * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management. - */ - public $table_element = 'digiriskdolibarr_digiriskelement'; - - /** - * @var int Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - - /** - * @var string String with name of icon for digiriskelement. Must be the part after the 'object_' into object_digiriskelement.png - */ - public $picto = 'digiriskelement@digiriskdolibarr'; - - /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. - */ - public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'comment' => "Id"), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 1, 'noteditable' => '1', 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'comment' => "Reference of object"), - 'ref_ext' => array('type' => 'varchar(128)', 'label' => 'RefExt', 'enabled' => '1', 'position' => 20, 'notnull' => 0, 'visible' => 0,), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => -1,), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 50, 'notnull' => 0, 'visible' => -2,), - 'import_key' => array('type' => 'integer', 'label' => 'ImportId', 'enabled' => '1', 'position' => 60, 'notnull' => 1, 'visible' => -2,), - 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 70, 'notnull' => 1, 'default' => 1, 'visible' => 1, 'index' => 1,), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 80, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth400', 'help' => "Help text", 'showoncombobox' => '1',), - 'description' => array('type' => 'textarea', 'label' => 'Description', 'enabled' => '1', 'position' => 90, 'notnull' => 0, 'visible' => 3,), - 'element_type' => array('type' => 'varchar(50)', 'label' => 'ElementType', 'enabled' => '1', 'position' => 100, 'notnull' => -1, 'visible' => 1,), - 'photo' => array('type' => 'varchar(255)', 'label' => 'Photo', 'enabled' => '1', 'position' => 105, 'notnull' => -1, 'visible' => -2,), - 'show_in_selector' => array('type' => 'boolean', 'label' => 'ShowInSelectOnPublicTicketInterface', 'enabled' => '1', 'position' => 106, 'notnull' => 1, 'visible' => 1, 'default' => 1,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 110, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 120, 'notnull' => -1, 'visible' => -2,), - 'fk_parent' => array('type' => 'integer', 'label' => 'ParentElement', 'enabled' => '1', 'position' => 130, 'notnull' => 1, 'visible' => 1, 'default' => 0,), - 'fk_standard' => array('type' => 'integer', 'label' => 'Standard', 'enabled' => '1', 'position' => 140, 'notnull' => 1, 'visible' => 0, 'default' => 1,), - 'ranks' => array('type' => 'integer', 'label' => 'Order', 'enabled' => '1', 'position' => 150, 'notnull' => 1, 'visible' => 0), - ); + /** + * @var string Module name. + */ + public $module = 'digiriskdolibarr'; + + /** + * @var string Element type of object. + */ + public $element = 'digiriskelement'; + + /** + * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management. + */ + public $table_element = 'digiriskdolibarr_digiriskelement'; + + /** + * @var int Does this object support multicompany module ? + * 0 = No test on entity, 1 = Test with field entity, 'field@table' = Test with link by field@table. + */ + public int $ismultientitymanaged = 1; + + /** + * @var int Does object support extrafields ? 0 = No, 1 = Yes. + */ + public int $isextrafieldmanaged = 1; + + /** + * @var string Name of icon for firepermit. Must be a 'fa-xxx' fontawesome code (or 'fa-xxx_fa_color_size') or 'firepermit@digiriskdolibarr' if picto is file 'img/object_firepermit.png'. + */ + public string $picto = 'digiriskelement@digiriskdolibarr'; + + /** + * 'type' field format: + * 'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', + * 'select' (list of values are in 'options'), + * 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]', + * 'chkbxlst:...', + * 'varchar(x)', + * 'text', 'text:none', 'html', + * 'double(24,8)', 'real', 'price', + * 'date', 'datetime', 'timestamp', 'duration', + * 'boolean', 'checkbox', 'radio', 'array', + * 'mail', 'phone', 'url', 'password', 'ip' + * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" + * 'label' the translation key. + * 'picto' is code of a picto to show before value in forms + * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or '!empty($conf->multicurrency->enabled)' ...) + * 'position' is the sort order of field. + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty '' or 0. + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) + * 'default' is a default value for creation (can still be overwroted by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 or 2 if field can be used for measure. Field type must be summable like integer or double(24,8). Use 1 in most cases, or 2 if you don't want to see the column total into list (for example for percentage) + * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200' + * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. + * 'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar' + * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * 'validate' is 1 if you need to validate with $this->validateField() + * 'copytoclipboard' is 1 or 2 to allow to add a picto to copy value into clipboard (1=picto after label, 2=picto after value) + * + * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. + */ + + /** + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ + public array $fields = [ + 'rowid' => ['type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'comment' => "Id"], + 'ref' => ['type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 1, 'noteditable' => '1', 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'comment' => "Reference of object"], + 'ref_ext' => ['type' => 'varchar(128)', 'label' => 'RefExt', 'enabled' => '1', 'position' => 20, 'notnull' => 0, 'visible' => 0,], + 'entity' => ['type' => 'integer', 'label' => 'Entity', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => -1,], + 'date_creation' => ['type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => -2,], + 'tms' => ['type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 50, 'notnull' => 0, 'visible' => -2,], + 'import_key' => ['type' => 'integer', 'label' => 'ImportId', 'enabled' => '1', 'position' => 60, 'notnull' => 1, 'visible' => -2,], + 'status' => ['type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 70, 'notnull' => 1, 'default' => 1, 'visible' => 1, 'index' => 1,], + 'label' => ['type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 80, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth400', 'help' => "Help text", 'showoncombobox' => '1',], + 'description' => ['type' => 'textarea', 'label' => 'Description', 'enabled' => '1', 'position' => 90, 'notnull' => 0, 'visible' => 3,], + 'element_type' => ['type' => 'varchar(50)', 'label' => 'ElementType', 'enabled' => '1', 'position' => 100, 'notnull' => -1, 'visible' => 1,], + 'photo' => ['type' => 'varchar(255)', 'label' => 'Photo', 'enabled' => '1', 'position' => 105, 'notnull' => -1, 'visible' => -2,], + 'show_in_selector' => ['type' => 'boolean', 'label' => 'ShowInSelectOnPublicTicketInterface', 'enabled' => '1', 'position' => 106, 'notnull' => 1, 'visible' => 1, 'default' => 1,], + 'fk_user_creat' => ['type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 110, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',], + 'fk_user_modif' => ['type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 120, 'notnull' => -1, 'visible' => -2,], + 'fk_parent' => ['type' => 'integer', 'label' => 'ParentElement', 'enabled' => '1', 'position' => 130, 'notnull' => 1, 'visible' => 1, 'default' => 0,], + 'fk_standard' => ['type' => 'integer', 'label' => 'Standard', 'enabled' => '1', 'position' => 140, 'notnull' => 1, 'visible' => 0, 'default' => 1,], + 'ranks' => ['type' => 'integer', 'label' => 'Order', 'enabled' => '1', 'position' => 150, 'notnull' => 1, 'visible' => 0], + ]; public $rowid; public $ref; @@ -121,47 +146,24 @@ class DigiriskElement extends CommonObject public $fk_standard; public $ranks; - /** - * Constructor - * - * @param DoliDb $db Database handler - */ - public function __construct(DoliDB $db) - { - global $conf, $langs; - - $this->db = $db; - - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; - if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; - - // Unset fields that are disabled - foreach ($this->fields as $key => $val) { - if (isset($val['enabled']) && empty($val['enabled'])) { - unset($this->fields[$key]); - } - } - - // Translate some data of arrayofkeyval - if (is_object($langs)) { - foreach ($this->fields as $key => $val) { - if (is_array($val['arrayofkeyval'])) { - foreach ($val['arrayofkeyval'] as $key2 => $val2) { - $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2); - } - } - } - } - } - - /** - * Create object into database - * - * @param User $user User that creates - * @param bool $notrigger false=launch triggers after, true=disable triggers - * @return int <0 if KO, Id of created object if OK - */ - public function create(User $user, $notrigger = false) + /** + * Constructor. + * + * @param DoliDb $db Database handler. + */ + public function __construct(DoliDB $db) + { + parent::__construct($db, $this->module, $this->element); + } + + /** + * Create object into database. + * + * @param User $user User that creates. + * @param bool $notrigger false = launch triggers after, true = disable triggers. + * @return int 0 < if KO, ID of created object if OK. + */ + public function create(User $user, bool $notrigger = false): int { global $conf; if (empty($this->ref)) { @@ -177,91 +179,6 @@ public function create(User $user, $notrigger = false) return $this->createCommon($user, $notrigger || !$conf->global->DIGIRISKDOLIBARR_MAIN_AGENDA_ACTIONAUTO_DIGIRISKELEMENT_CREATE); } - /** - * Load object in memory from the database - * - * @param int $id Id object - * @param string $ref Ref - * @return int <0 if KO, 0 if not found, >0 if OK - */ - public function fetch($id, $ref = null) - { - return $this->fetchCommon($id, $ref); - } - - /** - * Load list of objects in memory from the database. - * - * @param string $sortorder Sort Order - * @param string $sortfield Sort field - * @param int $limit limit - * @param int $offset Offset - * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...) - * @param string $filtermode Filter mode (AND or OR) - * @return array|int int <0 if KO, array of pages if OK - * @throws Exception - */ - public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') - { - dol_syslog(__METHOD__, LOG_DEBUG); - - $records = array(); - - $sql = 'SELECT '; - $sql .= $this->getFieldList(); - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; - if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN (' . getEntity($this->table_element) . ')'; - else $sql .= ' WHERE 1 = 1'; - // Manage filter - $sqlwhere = array(); - if (count($filter) > 0) { - foreach ($filter as $key => $value) { - if ($key == 't.rowid') { - $sqlwhere[] = $key . '=' . $value; - } elseif (strpos($key, 'date') !== false) { - $sqlwhere[] = $key . ' = \'' . $this->db->idate($value) . '\''; - } elseif ($key == 'customsql') { - $sqlwhere[] = $value; - } else { - $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; - } - } - } - if (count($sqlwhere) > 0) { - $sql .= ' AND (' . implode(' ' . $filtermode . ' ', $sqlwhere) . ')'; - } - - if ( ! empty($sortfield)) { - $sql .= $this->db->order($sortfield, $sortorder); - } - if ( ! empty($limit)) { - $sql .= ' ' . $this->db->plimit($limit, $offset); - } - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < ($limit ? min($limit, $num) : $num)) { - $obj = $this->db->fetch_object($resql); - - $record = new self($this->db); - $record->setVarsFromFetchObj($obj); - - $records[$record->id] = $record; - - $i++; - } - $this->db->free($resql); - - return $records; - } else { - $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); - - return -1; - } - } - /** * Load ordered flat list of DigiriskElement in memory from the database * @@ -301,28 +218,15 @@ public function fetchDigiriskElementFlat($parent_id) } } - /** - * Update object into database - * - * @param User $user User that modifies - * @param bool $notrigger false=launch triggers after, true=disable triggers - * @return int <0 if KO, >0 if OK - */ - public function update(User $user, $notrigger = false) - { - global $conf; - - return $this->updateCommon($user, $notrigger || !$conf->global->DIGIRISKDOLIBARR_MAIN_AGENDA_ACTIONAUTO_DIGIRISKELEMENT_MODIFY); - } - - /** - * Delete object in database - * - * @param User $user User that deletes - * @param bool $notrigger false=launch triggers after, true=disable triggers - * @return int <0 if KO, >0 if OK - */ - public function delete(User $user, $notrigger = false) + /** + * Delete object in database. + * + * @param User $user User that deletes. + * @param bool $notrigger false = launch triggers after, true = disable triggers. + * @param bool $softDelete Don't delete object. + * @return int 0 < if KO, > 0 if OK. + */ + public function delete(User $user, bool $notrigger = false, bool $softDelete = true): int { global $conf; @@ -336,32 +240,6 @@ public function delete(User $user, $notrigger = false) return $result; } - /** - * Load the info information in the object - * - * @param int $id Id of object - * @return void - */ - public function info($id) - { - $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; - $sql .= ' fk_user_creat, fk_user_modif'; - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; - $sql .= ' WHERE t.rowid = ' . $id; - $result = $this->db->query($sql); - if ($result) { - if ($this->db->num_rows($result)) { - $obj = $this->db->fetch_object($result); - $this->id = $obj->rowid; - $this->date_creation = $this->db->jdate($obj->date_creation); - } - - $this->db->free($result); - } else { - dol_print_error($this->db); - } - } - /** * Output html form to select a digirisk element. * @@ -537,78 +415,6 @@ public function fetch_id_from_wp_digi_id($wp_digi_id) } } - /** - * Return clickable name (with picto eventually) - * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param string $option Variant where the link point to ('', 'nolink') - * @param int $addlabel 0=Default, 1=Add label into string, >1=Add first chars into string - * @param string $moreinpopup Text to add into popup - * @param string $sep Separator between ref and label if option addlabel is set - * @param int $notooltip 1=Disable tooltip - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking - * @param string $morecss More css on a link - * @return string String with URL - */ - public function getNomUrl($withpicto = 0, $option = '', $addlabel = 0, $moreinpopup = '', $sep = ' - ', $notooltip = 0, $save_lastsearch_value = -1, $morecss = '') - { - global $conf, $langs, $user, $hookmanager; - - if ( ! empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips - - $result = ''; - - $label = ''; - if ($option != 'nolink') $label = ' ' . $langs->trans(ucwords($this->element_type, 'k')) . ''; - $label .= ($label ? '
' : '') . '' . $langs->trans('Ref') . ': ' . $this->ref; // The space must be after the : to not being explode when showing the title in img_picto - $label .= ($label ? '
' : '') . '' . $langs->trans('Label') . ': ' . $this->label; // The space must be after the : to not being explode when showing the title in img_picto - if ($moreinpopup) $label .= '
' . $moreinpopup; - - $url = dol_buildpath('/digiriskdolibarr/view/digiriskelement/digiriskelement_card.php', 1) . '?id=' . $this->id; - - if ($option != 'nolink') { - // Add param to save lastsearch_values or not - $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; - if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; - } - - $linkclose = ''; - if ($option == 'blank') { - $linkclose .= ' target=_blank'; - } - - if (empty($notooltip) && $user->rights->digiriskdolibarr->digiriskelement->read) { - if ( ! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label = $langs->trans("ShowDigiriskElement"); - $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"'; - } - $linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"'; - $linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"'; - } else $linkclose = ($morecss ? ' class="' . $morecss . '"' : ''); - - if ($option != 'nolink') { - $linkstart = ''; - $linkend = ''; - } - - $result .= $linkstart; - if ($withpicto) $result .= '' . ' '; - if ($withpicto != 2) $result .= $this->ref; - if ($withpicto != 2) $result .= (($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); - $result .= $linkend; - - global $action; - $hookmanager->initHooks(array('digiriskelementtdao')); - $parameters = array('id' => $this->id, 'getnomurl' => $result); - $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $this may have been modified by some hooks - if ($reshook > 0) $result = $hookmanager->resPrint; - else $result .= $hookmanager->resPrint; - - return $result; - } - /** * Return list of deleted elements * @@ -644,8 +450,8 @@ public function getTrashList() public function getMultiEntityTrashList() { $this->ismultientitymanaged = 0; - $objects = $this->fetchAll('', 'ranks', '','',array('customsql' => ' status > 0')); - $digiriskelement_trashes = $this->fetchAll('', 'ranks', '','',array('customsql' => ' status = 0')); + $objects = $this->fetchAll('', 'ranks', 0,0, array('customsql' => ' status > 0')); + $digiriskelement_trashes = $this->fetchAll('', 'ranks', 0,0, array('customsql' => ' status = 0')); $this->ismultientitymanaged = 1; if (is_array($digiriskelement_trashes) && !empty($digiriskelement_trashes)) { $ids = []; diff --git a/class/evaluator.class.php b/class/evaluator.class.php index 86e2f46f5..6e5b6bf78 100644 --- a/class/evaluator.class.php +++ b/class/evaluator.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,60 +16,51 @@ */ /** - * \file class/evaluator.class.php - * \ingroup digiriskdolibarr - * \brief This file is a CRUD class file for Evaluator (Create/Read/Update/Delete) + * \file class/evaluator.class.php + * \ingroup digiriskdolibarr + * \brief This file is a CRUD class file for Evaluator (Create/Read/Update/Delete). */ -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; +// Load Saturne libraries. +require_once __DIR__ . '/../../saturne/class/saturneobject.class.php'; require_once __DIR__ . '/dashboarddigiriskstats.class.php'; /** - * Class for Evaluator + * Class for Evaluator. */ -class Evaluator extends CommonObject +class Evaluator extends SaturneObject { - /** - * @var DoliDB Database handler. - */ - public $db; - - /** - * @var string[] Array of error strings - */ - public $errors = array(); - - /** - * @var int The object identifier - */ - public $id; - - /** - * @var string ID to identify managed object. - */ - public $element = 'evaluator'; - - /** - * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management. - */ - public $table_element = 'digiriskdolibarr_evaluator'; - - /** - * @var int Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - - /** - * @var string String with name of icon for evaluator. Must be the part after the 'object_' into object_evaluator.png - */ - public $picto = 'evaluator@digiriskdolibarr'; + /** + * @var string Module name. + */ + public $module = 'digiriskdolibarr'; + + /** + * @var string Element type of object. + */ + public $element = 'evaluator'; + + /** + * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management. + */ + public $table_element = 'digiriskdolibarr_evaluator'; + + /** + * @var int Does this object support multicompany module ? + * 0 = No test on entity, 1 = Test with field entity, 'field@table' = Test with link by field@table. + */ + public int $ismultientitymanaged = 1; + + /** + * @var int Does object support extrafields ? 0 = No, 1 = Yes. + */ + public int $isextrafieldmanaged = 1; + + /** + * @var string Name of icon for evaluator. Must be a 'fa-xxx' fontawesome code (or 'fa-xxx_fa_color_size') or 'evaluator@digiriskdolibarr' if picto is file 'img/object_evaluator.png'. + */ + public string $picto = 'fontawesome_fa-user-check_fas_#d35968'; /** * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. @@ -108,65 +99,15 @@ class Evaluator extends CommonObject public $fk_user; public $fk_parent; - /** - * Constructor - * - * @param DoliDb $db Database handler - */ - public function __construct(DoliDB $db) - { - global $conf, $langs; - - $this->db = $db; - - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; - if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; - - // Unset fields that are disabled - foreach ($this->fields as $key => $val) { - if (isset($val['enabled']) && empty($val['enabled'])) { - unset($this->fields[$key]); - } - } - - // Translate some data of arrayofkeyval - if (is_object($langs)) { - foreach ($this->fields as $key => $val) { - if (is_array($val['arrayofkeyval'])) { - foreach ($val['arrayofkeyval'] as $key2 => $val2) { - $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2); - } - } - } - } - } - - /** - * Create object into database - * - * @param User $user User that creates - * @param bool $notrigger false=launch triggers after, true=disable triggers - * @return int <0 if KO, Id of created object if OK - */ - public function create(User $user, $notrigger = false) - { - global $conf; - - $this->element = $this->element . '@digiriskdolibarr'; - return $this->createCommon($user, $notrigger || !$conf->global->DIGIRISKDOLIBARR_MAIN_AGENDA_ACTIONAUTO_EVALUATOR_CREATE); - } - - /** - * Load object in memory from the database - * - * @param int $id Id object - * @param string $ref Ref - * @return int <0 if KO, 0 if not found, >0 if OK - */ - public function fetch($id, $ref = null) - { - return $this->fetchCommon($id, $ref); - } + /** + * Constructor. + * + * @param DoliDb $db Database handler. + */ + public function __construct(DoliDB $db) + { + parent::__construct($db, $this->module, $this->element); + } /** * Load object in memory from the database @@ -260,80 +201,6 @@ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = } } - /** - * Update object into database - * - * @param User $user User that modifies - * @param bool $notrigger false=launch triggers after, true=disable triggers - * @return int <0 if KO, >0 if OK - */ - public function update(User $user, $notrigger = false) - { - global $conf; - - return $this->updateCommon($user, $notrigger || !$conf->global->DIGIRISKDOLIBARR_MAIN_AGENDA_ACTIONAUTO_EVALUATOR_MODIFY); - } - - /** - * Delete object in database - * - * @param User $user User that deletes - * @param bool $notrigger false=launch triggers after, true=disable triggers - * @return int <0 if KO, >0 if OK - */ - public function delete(User $user, $notrigger = false) - { - global $conf; - - return $this->deleteCommon($user, $notrigger || !$conf->global->DIGIRISKDOLIBARR_MAIN_AGENDA_ACTIONAUTO_EVALUATOR_DELETE); - } - - /** - * Load the info information in the object - * - * @param int $id Id of object - * @return void - */ - public function info($id) - { - $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; - $sql .= ' fk_user_creat, fk_user_modif'; - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; - $sql .= ' WHERE t.rowid = ' . $id; - $result = $this->db->query($sql); - if ($result) { - if ($this->db->num_rows($result)) { - $obj = $this->db->fetch_object($result); - $this->id = $obj->rowid; -// if ($obj->fk_user_author) { -// $cuser = new User($this->db); -// $cuser->fetch($obj->fk_user_author); -// $this->user_creation = $cuser; -// } -// -// if ($obj->fk_user_valid) { -// $vuser = new User($this->db); -// $vuser->fetch($obj->fk_user_valid); -// $this->user_validation = $vuser; -// } -// -// if ($obj->fk_user_cloture) { -// $cluser = new User($this->db); -// $cluser->fetch($obj->fk_user_cloture); -// $this->user_cloture = $cluser; -// } - - $this->date_creation = $this->db->jdate($obj->date_creation); -// $this->date_modification = $this->db->jdate($obj->datem); -// $this->date_validation = $this->db->jdate($obj->datev); - } - - $this->db->free($result); - } else { - dol_print_error($this->db); - } - } - /** * Load dashboard info evaluator. * - get number employees involved diff --git a/class/firepermit.class.php b/class/firepermit.class.php index 4fcd5dbf8..3f8bd6ad4 100644 --- a/class/firepermit.class.php +++ b/class/firepermit.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,124 +16,128 @@ */ /** - * \file class/firepermit.class.php - * \ingroup digiriskdolibarr - * \brief This file is a class file for FirePermit + * \file class/firepermit.class.php + * \ingroup digiriskdolibarr + * \brief This file is a CRUD class file for Firepermit (Create/Read/Update/Delete). */ require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; +// Load Saturne libraries. +require_once __DIR__ . '/../../saturne/class/saturneobject.class.php'; + require_once __DIR__ . '/digiriskdocuments.class.php'; require_once __DIR__ . '/digirisksignature.class.php'; require_once __DIR__ . '/openinghours.class.php'; - /** - * Class for FirePermit + * Class for FirePermit. */ -class FirePermit extends CommonObject +class FirePermit extends SaturneObject { - /** - * @var DoliDB Database handler. - */ - public $db; - - /** - * @var string Error string - * @see $errors - */ - public $error; - - /** - * @var string[] Array of error strings - */ - public $errors = array(); - - /** - * @var int The object identifier - */ - public $id; - - /** - * @var string ID to identify managed object. - */ - public $element = 'firepermit'; - - /** - * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management. - */ - public $table_element = 'digiriskdolibarr_firepermit'; - - /** - * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management. - */ - public $table_element_line = 'digiriskdolibarr_firepermitdet'; - - - /** - * @var int Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - - /** - * @var string String with name of icon for digiriskelement. Must be the part after the 'object_' into object_digiriskelement.png - */ - public $picto = 'firepermitdocument@digiriskdolibarr'; - - /** - * @var string Label status of const. - */ - public $labelStatus; - - /** - * @var string Label status short of const. - */ - public $labelStatusShort; - - /** - * @var array Context element object - */ - public $context = array(); - - /** - * @var FirePermitLine[] Array of subtable lines - */ - public $lines = array(); - - const STATUS_DELETE = 0; - const STATUS_IN_PROGRESS = 1; - const STATUS_PENDING_SIGNATURE = 2; - const STATUS_LOCKED = 3; - const STATUS_ARCHIVED = 4; - - /** + /** + * @var string Module name. + */ + public $module = 'digiriskdolibarr'; + + /** + * @var string Element type of object. + */ + public $element = 'firepermit'; + + /** + * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management. + */ + public $table_element = 'digiriskdolibarr_firepermit'; + + /** + * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management. + */ + public $table_element_line = 'digiriskdolibarr_firepermitdet'; + + /** + * @var int Does this object support multicompany module ? + * 0 = No test on entity, 1 = Test with field entity, 'field@table' = Test with link by field@table. + */ + public int $ismultientitymanaged = 1; + + /** + * @var int Does object support extrafields ? 0 = No, 1 = Yes. + */ + public int $isextrafieldmanaged = 1; + + /** + * @var string Name of icon for firepermit. Must be a 'fa-xxx' fontawesome code (or 'fa-xxx_fa_color_size') or 'firepermit@digiriskdolibarr' if picto is file 'img/object_firepermit.png'. + */ + public string $picto = 'fontawesome_fa-fire-alt_fas_#d35968'; + + public const STATUS_DRAFT = 1; + public const STATUS_IN_PROGRESS = 1; + public const STATUS_VALIDATED = 2; + public const STATUS_PENDING_SIGNATURE = 2; + public const STATUS_LOCKED = 3; + public const STATUS_ARCHIVED = 4; + + /** + * 'type' field format: + * 'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', + * 'select' (list of values are in 'options'), + * 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]', + * 'chkbxlst:...', + * 'varchar(x)', + * 'text', 'text:none', 'html', + * 'double(24,8)', 'real', 'price', + * 'date', 'datetime', 'timestamp', 'duration', + * 'boolean', 'checkbox', 'radio', 'array', + * 'mail', 'phone', 'url', 'password', 'ip' + * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" + * 'label' the translation key. + * 'picto' is code of a picto to show before value in forms + * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or '!empty($conf->multicurrency->enabled)' ...) + * 'position' is the sort order of field. + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty '' or 0. + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) + * 'default' is a default value for creation (can still be overwroted by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 or 2 if field can be used for measure. Field type must be summable like integer or double(24,8). Use 1 in most cases, or 2 if you don't want to see the column total into list (for example for percentage) + * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200' + * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. + * 'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar' + * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * 'validate' is 1 if you need to validate with $this->validateField() + * 'copytoclipboard' is 1 or 2 to allow to add a picto to copy value into clipboard (1=picto after label, 2=picto after value) + * + * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. + */ + + /** * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ - public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'comment' => "Id"), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 1, 'noteditable' => '1', 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'comment' => "Reference of object"), - 'ref_ext' => array('type' => 'varchar(128)', 'label' => 'RefExt', 'enabled' => '1', 'position' => 20, 'notnull' => 0, 'visible' => 0,), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 0,), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => 0,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 50, 'notnull' => 0, 'visible' => 0,), - 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 70, 'notnull' => 0, 'visible' => 1, 'index' => 0,), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 80, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth200', 'help' => "Help text", 'showoncombobox' => '1',), - 'date_start' => array('type' => 'datetime', 'label' => 'StartDate', 'enabled' => '1', 'position' => 90, 'notnull' => -1, 'visible' => 1,), - 'date_end' => array('type' => 'datetime', 'label' => 'EndDate', 'enabled' => '1', 'position' => 100, 'notnull' => -1, 'visible' => 1,), - 'last_email_sent_date' => array('type' => 'datetime', 'label' => 'LastEmailSentDate', 'enabled' => '1', 'position' => 110, 'notnull' => -1, 'visible' => -2,), - 'fk_project' => array('type' => 'integer:Project:projet/class/project.class.php', 'label' => 'Project', 'enabled' => '1', 'position' => 115, 'notnull' => 1, 'visible' => 1,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 120, 'notnull' => 1, 'visible' => 0, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 130, 'notnull' => -1, 'visible' => 0,), - 'fk_preventionplan' => array('type' => 'integer', 'label' => 'PreventionPlan', 'enabled' => '1', 'position' => 140, 'notnull' => -1, 'visible' => -2,), - ); + public array $fields = [ + 'rowid' => ['type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'comment' => "Id"], + 'ref' => ['type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 1, 'noteditable' => '1', 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'comment' => "Reference of object"], + 'ref_ext' => ['type' => 'varchar(128)', 'label' => 'RefExt', 'enabled' => '1', 'position' => 20, 'notnull' => 0, 'visible' => 0,], + 'entity' => ['type' => 'integer', 'label' => 'Entity', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 0,], + 'date_creation' => ['type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => 0,], + 'tms' => ['type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 50, 'notnull' => 0, 'visible' => 0,], + 'status' => ['type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 70, 'notnull' => 0, 'visible' => 1, 'index' => 0,], + 'label' => ['type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 80, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth200', 'help' => "Help text", 'showoncombobox' => '1',], + 'date_start' => ['type' => 'datetime', 'label' => 'StartDate', 'enabled' => '1', 'position' => 90, 'notnull' => -1, 'visible' => 1,], + 'date_end' => ['type' => 'datetime', 'label' => 'EndDate', 'enabled' => '1', 'position' => 100, 'notnull' => -1, 'visible' => 1,], + 'last_email_sent_date' => ['type' => 'datetime', 'label' => 'LastEmailSentDate', 'enabled' => '1', 'position' => 110, 'notnull' => -1, 'visible' => -2,], + 'fk_project' => ['type' => 'integer:Project:projet/class/project.class.php', 'label' => 'Project', 'enabled' => '1', 'position' => 115, 'notnull' => 1, 'visible' => 1,], + 'fk_user_creat' => ['type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 120, 'notnull' => 1, 'visible' => 0, 'foreignkey' => 'user.rowid',], + 'fk_user_modif' => ['type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 130, 'notnull' => -1, 'visible' => 0,], + 'fk_preventionplan' => ['type' => 'integer', 'label' => 'PreventionPlan', 'enabled' => '1', 'position' => 140, 'notnull' => -1, 'visible' => -2,], + ]; public $rowid; public $ref; @@ -151,55 +155,15 @@ class FirePermit extends CommonObject public $fk_user_modif; public $fk_preventionplan; - /** - * Constructor - * - * @param DoliDb $db Database handler - */ - public function __construct(DoliDB $db) - { - global $conf, $langs; - - $this->db = $db; - - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; - if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; - - // Unset fields that are disabled - foreach ($this->fields as $key => $val) { - if (isset($val['enabled']) && empty($val['enabled'])) { - unset($this->fields[$key]); - } - } - - // Translate some data of arrayofkeyval - if (is_object($langs)) { - foreach ($this->fields as $key => $val) { - if (is_array($val['arrayofkeyval'])) { - foreach ($val['arrayofkeyval'] as $key2 => $val2) { - $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2); - } - } - } - } - } - - - /** - * Create object into database - * - * @param User $user User that creates - * @param bool $notrigger false=launch triggers after, true=disable triggers - * @return int <0 if KO, Id of created object if OK - */ - public function create(User $user, $notrigger = false) - { - global $conf; - - $this->element = $this->element . '@digiriskdolibarr'; - - return $this->createCommon($user, $notrigger || !$conf->global->DIGIRISKDOLIBARR_MAIN_AGENDA_ACTIONAUTO_FIREPERMIT_CREATE); - } + /** + * Constructor. + * + * @param DoliDb $db Database handler. + */ + public function __construct(DoliDB $db) + { + parent::__construct($db, $this->module, $this->element); + } /** * Clone an object into another one @@ -342,182 +306,6 @@ public function createFromClone(User $user, $fromid, $options) } } - /** - * Load object in memory from the database - * - * @param int $id Id object - * @param string $ref Ref - * @return int <0 if KO, 0 if not found, >0 if OK - */ - public function fetch($id, $ref = null) - { - return $this->fetchCommon($id, $ref); - } - - /** - * Load object lines in memory from the database - * - * @return int <0 if KO, 0 if not found, >0 if OK - */ - public function fetchLines() - { - $this->lines = array(); - - return $this->fetchLinesCommon(); - } - - /** - * Load list of objects in memory from the database. - * - * @param string $sortorder Sort Order - * @param string $sortfield Sort field - * @param int $limit limit - * @param int $offset Offset - * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...) - * @param string $filtermode Filter mode (AND or OR) - * @return array|int int <0 if KO, array of pages if OK - * @throws Exception - */ - public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') - { - dol_syslog(__METHOD__, LOG_DEBUG); - - $records = array(); - - $sql = 'SELECT '; - $sql .= $this->getFieldList(); - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; - if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN (' . getEntity($this->table_element) . ')'; - else $sql .= ' WHERE 1 = 1'; - // Manage filter - $sqlwhere = array(); - if (count($filter) > 0) { - foreach ($filter as $key => $value) { - if ($key == 't.rowid') { - $sqlwhere[] = $key . '=' . $value; - } elseif (strpos($key, 'date') !== false) { - $sqlwhere[] = $key . ' = \'' . $this->db->idate($value) . '\''; - } elseif ($key == 'customsql') { - $sqlwhere[] = $value; - } else { - $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; - } - } - } - if (count($sqlwhere) > 0) { - $sql .= ' AND (' . implode(' ' . $filtermode . ' ', $sqlwhere) . ')'; - } - - if ( ! empty($sortfield)) { - $sql .= $this->db->order($sortfield, $sortorder); - } - if ( ! empty($limit)) { - $sql .= ' ' . $this->db->plimit($limit, $offset); - } - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < ($limit ? min($limit, $num) : $num)) { - $obj = $this->db->fetch_object($resql); - - $record = new self($this->db); - $record->setVarsFromFetchObj($obj); - - $records[$record->id] = $record; - - $i++; - } - $this->db->free($resql); - - return $records; - } else { - $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); - - return -1; - } - } - - - /** - * Update object into database - * - * @param User $user User that modifies - * @param bool $notrigger false=launch triggers after, true=disable triggers - * @return int <0 if KO, >0 if OK - */ - public function update(User $user, $notrigger = false) - { - global $conf; - - return $this->updateCommon($user, $notrigger || !$conf->global->DIGIRISKDOLIBARR_MAIN_AGENDA_ACTIONAUTO_FIREPERMIT_MODIFY); - } - - /** - * Delete object in database - * - * @param User $user User that deletes - * @param bool $notrigger false=launch triggers after, true=disable triggers - * @return int <0 if KO, >0 if OK - */ - public function delete(User $user, $notrigger = false) - { - global $conf; - - $result = $this->update($user, true); - if ($result > 0 && !empty($conf->global->DIGIRISKDOLIBARR_MAIN_AGENDA_ACTIONAUTO_FIREPERMIT_DELETE)) { - $this->call_trigger('FIREPERMIT_DELETE', $user); - } - - return $result; - } - - /** - * Load the info information in the object - * - * @param int $id Id of object - * @return void - */ - public function info($id) - { - $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; - $sql .= ' fk_user_creat, fk_user_modif'; - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; - $sql .= ' WHERE t.rowid = ' . $id; - $result = $this->db->query($sql); - if ($result) { - if ($this->db->num_rows($result)) { - $obj = $this->db->fetch_object($result); - $this->id = $obj->rowid; -// if ($obj->fk_user_author) { -// $cuser = new User($this->db); -// $cuser->fetch($obj->fk_user_author); -// $this->user_creation = $cuser; -// } -// -// if ($obj->fk_user_valid) { -// $vuser = new User($this->db); -// $vuser->fetch($obj->fk_user_valid); -// $this->user_validation = $vuser; -// } -// -// if ($obj->fk_user_cloture) { -// $cluser = new User($this->db); -// $cluser->fetch($obj->fk_user_cloture); -// $this->user_cloture = $cluser; -// } - - $this->date_creation = $this->db->jdate($obj->date_creation); -// $this->date_modification = $this->db->jdate($obj->datem); -// $this->date_validation = $this->db->jdate($obj->datev); - } - - $this->db->free($result); - } else { - dol_print_error($this->db); - } - } /** * Set in progress status @@ -549,45 +337,6 @@ public function setPendingSignature($user, $notrigger = 0) return $this->setStatusCommon($user, self::STATUS_PENDING_SIGNATURE, $notrigger || !$conf->global->DIGIRISKDOLIBARR_MAIN_AGENDA_ACTIONAUTO_FIREPERMIT_PENDINGSIGNATURE, 'FIREPERMIT_PENDINGSIGNATURE'); } - /** - * Set lock status - * - * @param User $user Object user that modify - * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers - * @return int <0 if KO, >0 if OK - */ - public function setLocked($user, $notrigger = 0) - { - global $conf; - - return $this->setStatusCommon($user, self::STATUS_LOCKED, $notrigger || !$conf->global->DIGIRISKDOLIBARR_MAIN_AGENDA_ACTIONAUTO_FIREPERMIT_LOCKED, 'FIREPERMIT_LOCKED'); - } - - /** - * Set close status - * - * @param User $user Object user that modify - * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers - * @return int <0 if KO, >0 if OK - */ - public function setArchived($user, $notrigger = 0) - { - global $conf; - - return $this->setStatusCommon($user, self::STATUS_ARCHIVED, $notrigger || !$conf->global->DIGIRISKDOLIBARR_MAIN_AGENDA_ACTIONAUTO_FIREPERMIT_ARCHIVED, 'FIREPERMIT_ARCHIVED'); - } - - /** - * Return the label of the status - * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto - * @return string Label of status - */ - public function getLibStatut($mode = 0) - { - return $this->LibStatut($this->status, $mode); - } - /** * Return the status * @@ -617,68 +366,8 @@ public function LibStatut($status, $mode = 0) return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } - - /** - * Return a link on thirdparty (with picto) - * - * @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only) - * @param int $maxlen Max length of name - * @param int $notooltip 1=Disable tooltip - * @return string String with URL - */ - public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0) - { - global $conf, $langs, $hookmanager; - - if ( ! empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips - - $name = $this->ref; - - $result = ''; $label = ''; - - if ( ! empty($this->logo) && class_exists('Form')) { - $label .= '
'; - $label .= Form::showphoto('societe', $this, 0, 40, 0, '', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. - $label .= '
'; - } - - $label .= '
'; - - - // By default - $label .= '' . $langs->trans("FirePermit") . ''; - $linkstart = 'global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label = $langs->trans("ShowCompany"); - $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"'; - } - $linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"'; - $linkclose .= ' class="classfortooltip refurl"'; - } - $linkstart .= $linkclose . '>'; - $linkend = ''; - - $result .= $linkstart; - if ($withpicto) $result .= '' . ' '; - if ($withpicto != 2) $result .= ($maxlen ? dol_trunc($name, $maxlen) : $name); - $result .= $linkend; - - $result .= $hookmanager->resPrint; - - return $result; - } } + /** * Class to manage invoice lines. * Saved into database table llx_firepermitdet diff --git a/core/modules/modDigiriskDolibarr.class.php b/core/modules/modDigiriskDolibarr.class.php index 1957179c6..922fdd096 100644 --- a/core/modules/modDigiriskDolibarr.class.php +++ b/core/modules/modDigiriskDolibarr.class.php @@ -402,7 +402,7 @@ public function __construct($db) // Set this to 1 if module has its own theme directory (theme) 'theme' => 0, // Set this to relative path of css file if module has its own css file - 'css' => ["/digiriskdolibarr/css/digiriskdolibarr.css.php"], + 'css' => [], // Set this to relative path of js file if module must load a js on all pages 'js' => [], // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context to 'all' diff --git a/css/digiriskdolibarr.css.php b/css/digiriskdolibarr.css.php deleted file mode 100644 index fd74e22d8..000000000 --- a/css/digiriskdolibarr.css.php +++ /dev/null @@ -1,82 +0,0 @@ -. - */ - -/** - * \file css/digiriskdolibarr.css.php - * \ingroup digiriskdolibarr - * \brief CSS file for module DigiriskDolibarr. - */ - -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled. Language code is found on url. -if ( ! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations -if ( ! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); -if ( ! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); -if ( ! defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content -if ( ! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); -if ( ! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); - -session_cache_limiter('public'); -// false or '' = keep cache instruction added by server -// 'public' = remove cache instruction added by server -// and if no cache-control added later, a default cache delay (10800) will be added by PHP. - -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/../main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/../main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); - -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; - -// Load user to have $user->conf loaded (not done by default here because of NOLOGIN constant defined) and load permission if we need to use them in CSS -/*if (empty($user->id) && ! empty($_SESSION['dol_login'])) -{ - $user->fetch('',$_SESSION['dol_login']); - $user->getrights(); -}*/ - - -// Define css type -top_httphead('text/css'); -//// Important: Following code is to cache this file to avoid page request by browser at each Dolibarr page access. -//// You can use CTRL+F5 to refresh your browser cache. -if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate'); -else header('Cache-Control: no-cache'); - -require DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php'; -if (defined('THEME_ONLY_CONSTANT')) return; - -?> - -.pictoDigirisk { - vertical-align: middle; - width: 24px; - margin-right: 2px; -} - diff --git a/css/scss/element/_dashboard-box.scss b/css/scss/element/_dashboard-box.scss deleted file mode 100644 index f54a4d6dc..000000000 --- a/css/scss/element/_dashboard-box.scss +++ /dev/null @@ -1,46 +0,0 @@ -.box-flex-item { - - .info-box { - display: flex; - flex-wrap: nowrap; - - .info-box-icon { - height: auto !important; - border-radius: 0 0 0 15px; - } - .info-box-content { - margin-left: 0 !important; - } - } - - .info-box-icon { - display: flex; - - img, i { - margin: auto; - } - } - .close-dashboard-info, .close-dashboard-widget { - width: 20px; - height: 20px; - line-height: 20px; - text-align: center; - border-radius: 50%; - background: #e3e3e3; - transition: all 0.2s ease-out; - position: absolute; - top: -5px; - right: -5px; - - &:hover { - cursor: pointer; - background: $color__red; - color: #fff; - transform: scale(1.2); - } - > [class*="fa"] { - display: inline-block; - line-height: 20px; - } - } -} diff --git a/css/scss/element/_element.scss b/css/scss/element/_element.scss index 10f0ee3a5..22b7e979a 100644 --- a/css/scss/element/_element.scss +++ b/css/scss/element/_element.scss @@ -1,6 +1,3 @@ @import "cotation"; @import "form"; @import "page-container"; -@import "picto-digirisk"; -@import "dashboard-box"; -@import "patchnote"; diff --git a/css/scss/element/_patchnote.scss b/css/scss/element/_patchnote.scss deleted file mode 100644 index 231f6a335..000000000 --- a/css/scss/element/_patchnote.scss +++ /dev/null @@ -1,41 +0,0 @@ -div.wpeo-modal-patchnote{ - .modal-header{ - background-color: white; - border-bottom: solid #cccccc 1px; - } - .modal-container { - background-color: #e9eaed; - border-radius: 25px; - li{ - list-style-type: circle; - margin-left: 55px; - } - ul{ - line-height: 30px; - } - code{ - padding: 3px 5px; - border-radius: 6px; - background-color:#fafafa ; - } - } - .modal-content { - img{ - width: 100%; - box-shadow:5px 5px 18px rgba(0,0,0,0.2) ; - margin-bottom: 28px; - } - h3{ - margin-left: 30px; - color: #666666; - font-size: 17px; - } - } - .modal-title { - color: #0a1464; - font-size: 24px!important; - } - .wpeo-button{ - background-color: #cccccc; - } -} diff --git a/css/scss/element/_picto-digirisk.scss b/css/scss/element/_picto-digirisk.scss deleted file mode 100644 index 3fd22edfe..000000000 --- a/css/scss/element/_picto-digirisk.scss +++ /dev/null @@ -1,5 +0,0 @@ -.pictoDigirisk { - vertical-align: middle; - width: 24px; - margin-right: 2px; -} diff --git a/css/scss/module/_module.scss b/css/scss/module/_module.scss deleted file mode 100644 index 92b3913ba..000000000 --- a/css/scss/module/_module.scss +++ /dev/null @@ -1,11 +0,0 @@ -@import "dropdown/dropdown"; -@import "button/button"; -@import "modal/modal"; -@import "loader/loader"; -@import "gridlayout/gridlayout"; -@import "table/table"; -@import "tooltip/tooltip"; -@import "notice/notice"; -@import "slider/slider"; -@import "form/form"; -@import "card/card"; diff --git a/css/scss/module/button/_button-add.scss b/css/scss/module/button/_button-add.scss deleted file mode 100644 index 94ed12c40..000000000 --- a/css/scss/module/button/_button-add.scss +++ /dev/null @@ -1,21 +0,0 @@ -.wpeo-button { - .button-add { - position: absolute; - top: 0.4em; - right: 0.2em; - opacity: 0.6; - font-size: 14px; - transition: all 0.2s ease-out; - } - - &:hover { - .button-add { - opacity: 0.8; - } - } -} - -.wpeo-button.button-square-40 .button-add { - top: 0.1em; - right: 0; -} diff --git a/css/scss/module/button/_button.scss b/css/scss/module/button/_button.scss deleted file mode 100644 index 425afdeda..000000000 --- a/css/scss/module/button/_button.scss +++ /dev/null @@ -1,204 +0,0 @@ -/*-------------------------------------------------------------- - Module : Button - Version : 1.2.0 - - * Les boutons se forment grâce à leurs classes CSS - * .button -> classe de base pour un bouton - * .primary - * .light - * .dark - * .red - * .yellow - * .blue - * .green - * .transparent - * .bordered -> Change l'affichage du bouton. Fonctionne avec les même couleurs - * .strong -> texte en gras - * .uppercase -> texte en majuscule - * .float-right -> float right - * .float-left -> float left - * .square-30 -> bouton carré 30px - * .square-40 -> bouton carré 40px - * .square-50 -> bouton carré 50px - * .square-60 -> bouton carré 60px - * .margin -> margin haut et bas sur le bouton - * .radius-1 -> Arrondis les bords - * .radius-3 -> Arrondis les bords - * .radius-3 -> Arrondis les bords - * .rounded -> bouton en forme de rond - * .disable -> désactive les actions sur le bouton - * .size-small -> petite taille - * .size-large -> grande taille ---------------------------------------------------------------*/ - -.wpeo-button { - display: inline-block; - border: 0; - box-shadow: none; - background: none; - text-decoration: none; - padding: 6px 14px; - line-height: 1.4; - vertical-align: middle; - height: auto; - border-radius: 0; - transition: all 0.2s ease-out; - position: relative; - border-width: 3px; - border-style: solid; - font-size: 16px; - box-sizing: border-box; - - background: $color__primary; - border-color: $color__primary; - color: #fff; - - &:focus, &:visited { - color: #fff; - } - &:hover { - color: #fff; - box-shadow: inset 0 -2.6em rgba(255,255,255,0.25); - cursor: pointer; - text-decoration: none; - } - &:focus, &:active { - outline: none; - } -} - -/** Colors */ -@import "colors"; -@import "button-add"; - -// Icon -.wpeo-button { - .button-icon, span { - position: relative; - } - .button-icon ~ span { - margin-left: 10px; - } - span ~ .button-icon { - margin-left: 10px; - } -} - -// Strong -.wpeo-button.button-strong { - span { - font-weight: 800; - } -} - -// Uppercase -.wpeo-button.button-uppercase { - span { - text-transform: uppercase; - font-size: 14px; - } -} - -// Squared -.wpeo-button[class*="button-square-"] { - text-align: center; - overflow: hidden; - padding: 0; -} -.wpeo-button.button-square-30 { - width: 30px; - height: 30px; - line-height: 24px; // ne pas oublier les bordures : 6px - - .button-icon { - font-size: 12px; - line-height: 24px; - } -} -.wpeo-button.button-square-40 { - width: 40px; - height: 40px; - line-height: 34px; // ne pas oublier les bordures : 6px - - .button-icon { - line-height: 34px; - } -} -.wpeo-button.button-square-50 { - width: 50px; - height: 50px; - line-height: 44px; // ne pas oublier les bordures : 6px - - .button-icon { - line-height: 44px; - } -} -.wpeo-button.button-square-60 { - width: 60px; - height: 60px; - line-height: 54px; // ne pas oublier les bordures : 6px - - .button-icon { - line-height: 54px; - } -} - -// Floats -.wpeo-button { - &.button-float-left { - float: left; - } - &.button-float-right { - float: right; - } -} - -// margin -.wpeo-button.button-margin { - margin: 1em 0; -} - -// radius -.wpeo-button { - &.button-radius-1 { - border-radius: 2px; - } - &.button-radius-2 { - border-radius: 4px; - } - &.button-radius-3 { - border-radius: 6px; - } - &.button-rounded { - border-radius: 50%; - } -} - -// disable -.wpeo-button.button-disable { - background: $color__grey !important; - border-color: $color__grey !important; - color: rgba(0,0,0,0.4) !important; - pointer-events: none; - - &:hover { - box-shadow: none !important; - } - &.button-event { - pointer-events: all; - } -} - -// Taille -.wpeo-button.button-size-small { - font-size: 14px; - &.button-uppercase span { - font-size: 12px; - } -} -.wpeo-button.button-size-large { - font-size: 18px; - &.button-uppercase span { - font-size: 16px; - } -} diff --git a/css/scss/module/button/_colors.scss b/css/scss/module/button/_colors.scss deleted file mode 100644 index 7c0e446e7..000000000 --- a/css/scss/module/button/_colors.scss +++ /dev/null @@ -1,138 +0,0 @@ -// Bouton plein -.wpeo-button { - /* par défaut */ - background: $color__primary; - border-color: $color__primary; - color: $color__primary-text; - - &.button-main { - background: $color__primary; - border-color: $color__primary; - color: $color__primary-text; - } - &.button-secondary { - background: $color__secondary; - border-color: $color__secondary; - color: $color__secondary-text; - } - &.button-light { - background: #fff; - border-color: #fff; - color: $color__text-main; - &:hover { - box-shadow: inset 0 -2.6em rgba(0,0,0,0.1); - color: $color__text-main; - } - } - &.button-dark { - background: $color__dark; - border-color: $color__dark; - } - &.button-grey { - background: $color__grey; - border-color: $color__grey; - color: $color__text-main; - &:hover { - box-shadow: inset 0 -2.6em rgba(0,0,0,0.1); - color: $color__text-main; - } - } - &.button-red { - background: $color__red; - border-color: $color__red; - } - &.button-yellow { - background: $color__yellow; - border-color: $color__yellow; - } - &.button-blue { - background: $color__blue; - border-color: $color__blue; - } - &.button-green { - background: $color__green; - border-color: $color__green; - } - &.button-transparent { - background: transparent; - border-color: transparent; - color: rgba($color__text-main, 0.4); - &:hover { - color: $color__text-main; - box-shadow: inset 0 -2.6em rgba(255,255,255,0); - } - } -} - -// Bordered -.wpeo-button.button-bordered { - background: none; - /* Par defaut */ - border-color: $color__primary; - color: $color__primary; - - &.button-main { - border-color: $color__primary; - color: $color__primary; - &:hover { - box-shadow: inset 0 -2.6em $color__primary; - color: $color__primary-text; - } - } - &.button-light { - border-color: #fff; - color: #fff; - &:hover { - box-shadow: inset 0 -2.6em #fff; - color: $color__text-main; - } - } - &.button-dark { - border-color: $color__dark; - color: $color__dark; - &:hover { - box-shadow: inset 0 -2.6em $color__dark; - } - } - &.button-grey { - border-color: $color__grey; - color: darken($color__grey, 30%); - &:hover { - box-shadow: inset 0 -2.6em $color__grey; - color: $color__text-main; - } - } - &.button-red { - border-color: $color__red; - color: $color__red; - &:hover { - box-shadow: inset 0 -2.6em $color__red; - } - } - &.button-yellow { - border-color: $color__yellow; - color: $color__yellow; - &:hover { - box-shadow: inset 0 -2.6em $color__yellow; - } - } - &.button-blue { - border-color: $color__blue; - color: $color__blue; - &:hover { - box-shadow: inset 0 -2.6em $color__blue; - } - } - &.button-green { - border-color: $color__green; - color: $color__green; - &:hover { - box-shadow: inset 0 -2.6em $color__green; - } - } - - &:hover { - box-shadow: inset 0 -2.6em $color__primary; - color: #fff; - } -} diff --git a/css/scss/module/button/index.php b/css/scss/module/button/index.php deleted file mode 100644 index cd6990e24..000000000 --- a/css/scss/module/button/index.php +++ /dev/null @@ -1,2 +0,0 @@ - classe de base du mobule - .grid -> Affichage en grille - .list -> Affichage en liste ---------------------------------------------------------------*/ - -.wpeo-dropdown { - position: relative; - display: inline-block; - - .dropdown-toggle { - display: inline-block; - - span ~ *[class*="icon"]{ - margin-left: 10px; - } - } - .dropdown-content { - opacity: 0; - pointer-events: none; - transform: translateY(-10px); - transition: all 0.2s ease-out; - position: absolute; - background: #fff; - z-index: 99; - border: 1px solid rgba(0,0,0,0.1); - box-shadow: 0 0 10px 0px rgba(0,0,0,0.3); - width: 220px; - padding: 0.6em; - } - &.dropdown-active .dropdown-content { - opacity: 1; - pointer-events: auto; - transform: translateY(0); - } - ul, li { - margin: 0; - list-style-type: none; - padding: 0; - } - .dropdown-item { - display: block; - color: rgba(0,0,0,0.7); - text-decoration: none; - - &::before { - display: none; - content: ''; - } - - .dropdown-result-title, .dropdown-result-subtitle { - display: block; - } - .dropdown-result-title { - font-size: 14px; - } - .dropdown-result-subtitle { - font-size: 12px; - color: rgba(0,0,0,0.5); - } - } -} - -/** Taille */ -.wpeo-dropdown { - &.dropdown-small .dropdown-content { - width: 60px; - } - &.dropdown-medium .dropdown-content { - width: 220px; - } - &.dropdown-large .dropdown-content { - width: 360px; - } -} - -/** Padding */ -.wpeo-dropdown { - &.dropdown-padding-0 .dropdown-content { - padding: 0; - } - &.dropdown-padding-1 .dropdown-content { - padding: 0.6em; - } - &.dropdown-padding-2 .dropdown-content { - padding: 1.2em; - } -} - -/** Alignement */ -.wpeo-dropdown { - &.dropdown-left .dropdown-content { - left: 0; - } - &.dropdown-right .dropdown-content { - right: 0; - } - - &.dropdown-horizontal.dropdown-left .dropdown-content { - left: 100%; - } - &.dropdown-horizontal.dropdown-right .dropdown-content { - right: 100%; - } -} - -/** Sens */ -.wpeo-dropdown { - &.dropdown-horizontal .dropdown-content { - top: 0; - width: auto !important; - display: flex; - flex-wrap: nowrap; - flex-direction: row; - } -} - -/** Disable */ -.wpeo-dropdown .dropdown-item { - &.dropdown-item-disable { - opacity: 0.6; - cursor: default !important; - pointer-events: none; - // Pointer events: none; seulement sur les enfants pour permettre l'utilisation d'une tooltip ou autre module. - > * { - } - } -} - -@import "list"; -@import "grid"; diff --git a/css/scss/module/dropdown/_grid.scss b/css/scss/module/dropdown/_grid.scss deleted file mode 100644 index b601371a7..000000000 --- a/css/scss/module/dropdown/_grid.scss +++ /dev/null @@ -1,11 +0,0 @@ -.wpeo-dropdown.dropdown-grid { - .dropdown-item { - - img { - width: 100%; - height: auto; - display: block; - margin: 0; - } - } -} diff --git a/css/scss/module/dropdown/_list.scss b/css/scss/module/dropdown/_list.scss deleted file mode 100644 index a2ca76a33..000000000 --- a/css/scss/module/dropdown/_list.scss +++ /dev/null @@ -1,30 +0,0 @@ -.wpeo-dropdown { - .dropdown-content { - .dropdown-item { - padding: 0.6em; - background: #fff; - transition: all 0.2s ease-out; - &:hover { - cursor: pointer; - background: rgba(0,0,0,0.1); - } - } - } -} - -.wpeo-dropdown.dropdown-list { - .dropdown-content { - text-align: left; - } - .dropdown-item { - &::after { - display: block; - content: ''; - clear: both; - } - img { - float: left; - margin-right: 0.4em; - } - } -} diff --git a/css/scss/module/dropdown/index.php b/css/scss/module/dropdown/index.php deleted file mode 100644 index cd6990e24..000000000 --- a/css/scss/module/dropdown/index.php +++ /dev/null @@ -1,2 +0,0 @@ - .svg-inline--fa { - position: absolute; - right: 1em; - top: 50%; - transform: translateY(-50%); - } -} -.wpeo-form .form-element.disable { - .dropdown-toggle > .svg-inline--fa { - display: none; - } -} - -/* Compatibility Autocomplete */ -.wpeo-form .wpeo-autocomplete { - display: block; - width: 100%; - .autocomplete-label { - box-shadow: none; - padding: 0.74em 1em; - } -} -.wpeo-form.form-light { - .wpeo-autocomplete .autocomplete-label { - background: #fff; - &:hover { - background: $color__grey; - } - } -} diff --git a/css/scss/module/form/_radio.scss b/css/scss/module/form/_radio.scss deleted file mode 100644 index 78491106e..000000000 --- a/css/scss/module/form/_radio.scss +++ /dev/null @@ -1,53 +0,0 @@ -/** Général */ -.wpeo-form .form-element { - input[type="radio"].form-field { - display: inline-block; - width: auto; - } -} - -/** Design */ -.wpeo-form .form-element { - input[type="radio"].form-field { - appearance: none; - border-radius: 50%; - width: 16px; - height: 16px; - padding: 0; - border: 0; - background: transparent !important; - border: 1px solid rgba(0,0,0,0.4); - transition: 0.2s all linear; - outline: none; - position: relative; - top: 2px; - - &::before { - display: none !important; - content: '' !important; - } - &:hover { - cursor: pointer; - border: 1px solid $color__primary; - box-shadow: 0 0 0 1px $color__primary inset; - background: transparent !important; - } - &:checked { - border: 1px solid $color__primary; - box-shadow: 0 0 0 4px $color__primary inset; - } - & + label { - text-transform: none; - font-weight: 400; - font-size: 14px; - display: inline-block; - margin-right: 1em; - &:hover { - cursor: pointer; - } - &:active { - outline: none; - } - } - } -} diff --git a/css/scss/module/gridlayout/_gridlayout.scss b/css/scss/module/gridlayout/_gridlayout.scss deleted file mode 100644 index e73cb7cd2..000000000 --- a/css/scss/module/gridlayout/_gridlayout.scss +++ /dev/null @@ -1,120 +0,0 @@ -/*-------------------------------------------------------------- - Module : Gridlayout - Version : 1.5.0 - - * Classes pour l'élément parent - .wpeo-gridlayout -> classe de base du mobule - .grid-X -> Définit le nombre de colonnes - .grid-margin-X -> Ajoute des marges au dessus et en dessous du parent - .grid-gap-X -> Définit les gouttières des colonnes - - * Classes pour les enfants direct - .gridw-X -> Change la largeur du bloc enfant (gridw-2 = 2 fois la taille initiale) - .gridh-X -> Change la hauteur du bloc enfant (gridh-2 = 2 fois la taille initiale) ---------------------------------------------------------------*/ - -.wpeo-gridlayout { - display: grid; - grid-gap: 1em 1em; - grid-template-columns: repeat( 4, 1fr ); -} - -/** Définition des tailles */ -.wpeo-gridlayout { - /** Du parent */ - @for $i from 1 through 6 { - &.grid-#{$i} { - grid-template-columns: repeat( $i, 1fr ); - } - - /** Chaque enfant peut modifier sa propre taille */ - @for $y from 1 through 6 { - @if ( $y <= $i ) { - &.grid-#{$i} > .gridw-#{$y} { - grid-column: auto / span $y; - - @if ( $y > 1 ) { - @media ( max-width: $media__medium ) { - grid-column: auto / span 2; - } - } - } - } - } - } -} - -/** Définition des hauteur des enfants */ -.wpeo-gridlayout { - @for $i from 1 through 6 { - > .gridh-#{$i} { - grid-row: auto / span $i; - - @media ( max-width: $media__medium ) { - grid-row: auto / span 1 !important; - } - } - } -} - -/** Marges */ -.wpeo-gridlayout { - @for $i from 0 through 6 { - &.grid-margin-#{$i} { - margin: #{$i}em 0; - } - } -} - -/** Gouttières */ -.wpeo-gridlayout { - @for $i from 0 through 6 { - &.grid-gap-#{$i} { - grid-gap: #{$i}em #{$i}em; - } - } -} - -/** Alignements */ -.wpeo-gridlayout { - .grid-align-center { - margin-left: auto; - margin-right: auto; - } - .grid-align-right { - margin-left: auto; - } - .grid-align-middle { - margin-top: auto; - margin-bottom: auto; - } - .grid-align-bottom { - margin-top: auto; - } -} - -/** Media queries */ -.wpeo-gridlayout:not(.dropdown-content) { - @for $i from 1 through 6 { - @if ( $i > 2 ) { - @media ( max-width: $media__medium ) { - &.grid-#{$i} { - grid-template-columns: repeat( 2, 1fr ) !important; - } - } - } - @if ( $i > 1 ) { - @media ( max-width: $media__small ) { - &.grid-#{$i} { - grid-template-columns: repeat( 1, 1fr ) !important; - } - } - } - - } - > * { - @media ( max-width: $media__small ) { - grid-column: auto / span 1 !important; - } - } -} diff --git a/css/scss/module/gridlayout/index.php b/css/scss/module/gridlayout/index.php deleted file mode 100644 index cd6990e24..000000000 --- a/css/scss/module/gridlayout/index.php +++ /dev/null @@ -1,2 +0,0 @@ - classe de base pour le module - .loader-spin => icone de chargement ---------------------------------------------------------------*/ - -.wpeo-loader { - transition: all 0.2s ease-out; - pointer-events: none; - opacity: 0.5; - position: relative; - - .loader-spin { - position: absolute; - border: 3px solid #a7a7a7; - border-top: 3px solid darken($color__primary, 40%); - border-radius: 50%; - width: 20px; - height: 20px; - z-index: 99; - left: 50%; - top: 50%; - margin: 0 !important; - padding: 0 !important; - animation: loader-spin 1s ease-out infinite; - } -} - - - @keyframes loader-spin { - 0% { transform: translate(-50%, -50%) rotate(0deg); } - 100% { transform: translate(-50%, -50%) rotate(360deg); } - } diff --git a/css/scss/module/loader/index.php b/css/scss/module/loader/index.php deleted file mode 100644 index cd6990e24..000000000 --- a/css/scss/module/loader/index.php +++ /dev/null @@ -1,2 +0,0 @@ - classe de base du mobule - .modalactive -> lance l'apparition de la modal - .no-modal-close -> désactive l'icone fermeture ---------------------------------------------------------------*/ - -.wpeo-modal { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 1000; - background: rgba(39,42,53,.9); - opacity: 0; - pointer-events: none; - transition: all 0.2s ease-out; - - // Fix pointer event on textarea field. - textarea { - resize: none; - } - - &.modal-active { - opacity: 1; - pointer-events: auto; - z-index: 1002; - - .modal-container { - transform: translate(-50%, -50%); - } - textarea { - resize: both; - } - } - - // Fix 2eme niveau modal. - &.modal-active .modal-active { - z-index: 1003; - } - // Fix 3eme niveau modal. - &.modal-active .modal-active .modal-active { - z-index: 1004; - } - - &.modal-force-display { - .modal-close { - display: none; - } - } -} - -.wpeo-modal { - .modal-container { - position: absolute; - transition: all 0.2s ease-out; - width: 100%; - max-width: 860px; - height: 100%; - max-height: 560px; - background: #fff; - padding: 1em 0; - margin: auto; - top: 50%; - left: 50%; - transform: translate(-50%, -60%); - @media ( max-width: $media__small ) { - padding: 1em; - } - } - - .modal-container { - .modal-header { - height: 10%; - display: flex; - padding: 0 2em; - } - .modal-content { - height: 78%; - padding: 0 2em; - } - .modal-footer { - height: 12%; - padding: 0 2em; - } - } - .modal-container .modal-header { - .modal-title, .modal-close { - margin: auto 0; - } - .modal-title { - text-transform: uppercase; - font-size: 18px; - white-space: normal; - @media ( max-width: $media__medium ) { - font-size: 16px; - } - @media ( max-width: $media__small ) { - font-size: 14px; - } - } - .modal-close { - margin-left: auto; - color: rgba(0,0,0,0.3); - padding: 4px; - transition: all 0.2s ease-out; - &:hover { - cursor: pointer; - color: $color__primary; - } - } - } - .modal-container .modal-content { - overflow-y: auto; - font-size: 14px; - @media ( max-width: $media__small ) { - font-size: 12px; - } - } - .modal-container .modal-footer { - text-align: right; - padding-top: 1em; - &.left { - text-align: left; - } - &.center { - text-align: center; - } - } -} diff --git a/css/scss/module/modal/index.php b/css/scss/module/modal/index.php deleted file mode 100644 index cd6990e24..000000000 --- a/css/scss/module/modal/index.php +++ /dev/null @@ -1,2 +0,0 @@ - classe de base du mobule ---------------------------------------------------------------*/ - -/* General */ -.wpeo-notice { - position: relative; - font-size: 1em; - padding: 1em; - overflow: hidden; - border-radius: 3px; - border: solid #eee 1px; - margin: 1em 0; - display: flex; - transition: all 0.2s ease-out; - align-items: center; - - &::before { - display: block; - font-family: 'Font Awesome 5 Free'; - font-weight: 900; - font-size: 24px; - } - .notice-content { - width: 100%; - padding: 0 1em; - color: rgba(0,0,0,0.6); - } - .notice-title { - font-size: 20px; - font-weight: 600; - color: rgba(0,0,0,0.9); - } - .notice-subtitle { - font-size: 14px; - } - .notice-close { - color: rgba(0,0,0,0.3); - transition: all 0.2s ease-out; - - &:hover { - color: $color__primary; - cursor: pointer; - } - } - ul { - padding: 0 0 0 1.4em; - margin: 0.4em 0; - } -} - -/** Status */ -@import "status"; diff --git a/css/scss/module/notice/_status.scss b/css/scss/module/notice/_status.scss deleted file mode 100644 index ba3f02e6e..000000000 --- a/css/scss/module/notice/_status.scss +++ /dev/null @@ -1,55 +0,0 @@ -/** Info */ -.wpeo-notice.notice-info { - border-left: solid $color__blue 6px; - color: $color__blue; - background: rgba( $color__blue, 0.05 ); - - &::before { - content: '\f05a'; - } - .notice-title, .notice-subtitle, a { - color: $color__blue; - } -} - -/** Error */ -.wpeo-notice.notice-error { - border-left: solid $color__red 6px; - color: $color__red; - background: rgba( $color__red, 0.05 ); - - &::before { - content: '\f057'; - } - .notice-title, .notice-subtitle, a { - color: $color__red; - } -} - -/** Warning */ -.wpeo-notice.notice-warning { - border-left: solid $color__yellow 6px; - color: $color__yellow; - background: rgba( $color__yellow, 0.05 ); - - &::before { - content: '\f071'; - } - .notice-title, .notice-subtitle, a { - color: $color__yellow; - } -} - -/** Success */ -.wpeo-notice.notice-success { - border-left: solid $color__green 6px; - color: $color__green; - background: rgba( $color__green, 0.05 ); - - &::before { - content: '\f058'; - } - .notice-title, .notice-subtitle, a { - color: $color__green; - } -} diff --git a/css/scss/module/notice/index.php b/css/scss/module/notice/index.php deleted file mode 100644 index cd6990e24..000000000 --- a/css/scss/module/notice/index.php +++ /dev/null @@ -1,2 +0,0 @@ - classe de base du mobule ---------------------------------------------------------------*/ - - -@import "flex"; diff --git a/css/scss/module/table/index.php b/css/scss/module/table/index.php deleted file mode 100644 index cd6990e24..000000000 --- a/css/scss/module/table/index.php +++ /dev/null @@ -1,2 +0,0 @@ - classe de base du mobule - .tooltip-primary -> tooltip sur fond rouge - .tooltip-light -> tooltip sur fond rouge - .tooltip-red -> tooltip sur fond rouge ---------------------------------------------------------------*/ - -.wpeo-tooltip { - display: block; - position: absolute; - bottom: 0; - left: 0; - opacity: 0; - pointer-events: none; - z-index: 99999; - white-space: nowrap; - background: $color__dark; - color: #fff; - border-radius: 6px; - font-size: 0.8rem; - padding: 0 1em; - height: 2.2em; - line-height: 2.2em; - - &::before { - display: block; - content: ''; - width: 0; - height: 0; - border-style: solid; - position: absolute; - } - &:focus { - outline: none; - } -} - -/* Couleurs */ -@mixin set-arrow-color($color) { - &.tooltip-top::before { - border-color: $color transparent transparent transparent; - } - &.tooltip-right::before { - border-color: transparent $color transparent transparent; - } - &.tooltip-bottom::before { - border-color: transparent transparent $color transparent; - } - &.tooltip-left::before { - border-color: transparent transparent transparent $color; - } -} - -.wpeo-tooltip { - &.tooltip-dark { - background: $color__dark; - @include set-arrow-color($color__dark); - } - &.tooltip-primary { - background: $color__primary; - @include set-arrow-color($color__primary); - } - &.tooltip-light { - background: $color__grey; - color: rgba(0,0,0,0.6); - @include set-arrow-color($color__grey); - } - &.tooltip-red { - background: $color__red; - @include set-arrow-color($color__red); - } -} - -/* Position de la fleche */ -.wpeo-tooltip { - &.tooltip-top::before { - border-width: 6px 6px 0 6px; - border-color: $color__dark transparent transparent transparent; - bottom: -6px; - left: 50%; - transform: translateX(-50%); - } - &.tooltip-right::before { - border-width: 6px 6px 6px 0; - border-color: transparent $color__dark transparent transparent; - top: 50%; - transform: translateY(-50%); - left: -6px; - } - &.tooltip-bottom::before { - border-width: 0 6px 6px 6px; - border-color: transparent transparent $color__dark transparent; - top: -6px; - left: 50%; - transform: translateX(-50%); - } - &.tooltip-left::before { - border-width: 6px 0 6px 6px; - border-color: transparent transparent transparent $color__dark; - top: 50%; - transform: translateY(-50%); - right: -6px; - } -} diff --git a/css/scss/module/tooltip/index.php b/css/scss/module/tooltip/index.php deleted file mode 100644 index cd6990e24..000000000 --- a/css/scss/module/tooltip/index.php +++ /dev/null @@ -1,2 +0,0 @@ - +/* Copyright (C) 2021-2023 EVARISK * - * This program is free software: you can redistribute it and/or modify + * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -12,53 +12,37 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ /** * \file lib/digiriskdolibarr_firepermit.lib.php * \ingroup digiriskdolibarr - * \brief Library files with common functions for DigiriskElement + * \brief Library files with common functions for Firepermit. */ +// Load Saturne libraries. +require_once __DIR__ . '/../../saturne/lib/object.lib.php'; + /** - * Prepare array of tabs for DigiriskElement + * Prepare array of tabs for firepermit. * - * @param DigiriskElement $object DigiriskElement - * @return array Array of tabs + * @param FirePermit $object Firepermit object. + * @return array Array of tabs. + * @throws Exception */ -function firepermitPrepareHead($object) +function firepermit_prepare_head(FirePermit $object): array { - global $langs, $conf, $user; - - $langs->load("digiriskdolibarr@digiriskdolibarr"); - - $h = 0; - $head = array(); - - if ($user->rights->digiriskdolibarr->firepermit->read) { - $head[$h][0] = dol_buildpath("/digiriskdolibarr/view/firepermit/firepermit_card.php", 1) . '?id=' . $object->id; - $head[$h][1] = ' ' . $langs->trans("Card"); - $head[$h][2] = 'firepermitCard'; - $h++; - - $head[$h][0] = dol_buildpath("/digiriskdolibarr/view/firepermit/firepermit_agenda.php", 1) . '?id=' . $object->id; - $head[$h][1] = ' ' . $langs->trans("Events"); - $head[$h][2] = 'firepermitAgenda'; - $h++; + // Global variables definitions. + global $langs; - $head[$h][0] = dol_buildpath("/digiriskdolibarr/view/firepermit/firepermit_schedule.php", 1) . '?id=' . $object->id; - $head[$h][1] = ' ' . $langs->trans("Schedule"); - $head[$h][2] = 'firepermitSchedule'; - $h++; + $head = []; - $head[$h][0] = dol_buildpath("/digiriskdolibarr/view/firepermit/firepermit_attendants.php", 1) . '?id=' . $object->id; - $head[$h][1] = ' ' . $langs->trans("Attendants"); - $head[$h][2] = 'firepermitAttendants'; - $h++; - } + $head[1][0] = dol_buildpath("/digiriskdolibarr/view/firepermit/firepermit_schedule.php", 1) . '?id=' . $object->id; + $head[1][1] = ' ' . $langs->trans("Schedule"); + $head[1][2] = 'firepermitSchedule'; - complete_head_from_modules($conf, $langs, $object, $head, $h, 'firepermitdocument@digiriskdolibarr'); + $moreParams['documentType'] = 'FirePermitDocument'; - return $head; + return saturne_object_prepare_head($object, $head, $moreParams, true); } diff --git a/lib/digiriskdolibarr_preventionplan.lib.php b/lib/digiriskdolibarr_preventionplan.lib.php index d5f4b4e0c..8473fc697 100644 --- a/lib/digiriskdolibarr_preventionplan.lib.php +++ b/lib/digiriskdolibarr_preventionplan.lib.php @@ -1,9 +1,9 @@ +/* Copyright (C) 2021-2023 EVARISK * - * This program is free software: you can redistribute it and/or modify + * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -12,53 +12,37 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ /** * \file lib/digiriskdolibarr_preventionplan.lib.php * \ingroup digiriskdolibarr - * \brief Library files with common functions for DigiriskElement + * \brief Library files with common functions for Preventionplan. */ +// Load Saturne libraries. +require_once __DIR__ . '/../../saturne/lib/object.lib.php'; + /** - * Prepare array of tabs for DigiriskElement + * Prepare array of tabs for preventionplan. * - * @param PreventionPlan $object PreventionPlan - * @return array Array of tabs + * @param PreventionPlan $object Preventionplan object. + * @return array Array of tabs. + * @throws Exception */ -function preventionplanPrepareHead($object) +function preventionplan_prepare_head(PreventionPlan $object): array { - global $langs, $conf, $user; - - $langs->load("digiriskdolibarr@digiriskdolibarr"); - - $h = 0; - $head = array(); - - if ($user->rights->digiriskdolibarr->preventionplan->read) { - $head[$h][0] = dol_buildpath("/digiriskdolibarr/view/preventionplan/preventionplan_card.php", 1) . '?id=' . $object->id; - $head[$h][1] = ' ' . $langs->trans("Card"); - $head[$h][2] = 'preventionplanCard'; - $h++; - - $head[$h][0] = dol_buildpath("/digiriskdolibarr/view/preventionplan/preventionplan_agenda.php", 1) . '?id=' . $object->id; - $head[$h][1] = ' ' . $langs->trans("Events"); - $head[$h][2] = 'preventionplanAgenda'; - $h++; + // Global variables definitions. + global $langs; - $head[$h][0] = dol_buildpath("/digiriskdolibarr/view/preventionplan/preventionplan_schedule.php", 1) . '?id=' . $object->id; - $head[$h][1] = ' ' . $langs->trans("Schedule"); - $head[$h][2] = 'preventionplanSchedule'; - $h++; + $head = []; - $head[$h][0] = dol_buildpath("/digiriskdolibarr/view/preventionplan/preventionplan_attendants.php", 1) . '?id=' . $object->id; - $head[$h][1] = ' ' . $langs->trans("Attendants"); - $head[$h][2] = 'preventionplanAttendants'; - $h++; - } + $head[1][0] = dol_buildpath("/digiriskdolibarr/view/preventionplan/preventionplan_schedule.php", 1) . '?id=' . $object->id; + $head[1][1] = ' ' . $langs->trans("Schedule"); + $head[1][2] = 'preventionplanSchedule'; - complete_head_from_modules($conf, $langs, $object, $head, $h, 'preventionplandocument@digiriskdolibarr'); + $moreParams['documentType'] = 'PreventionPlanDocument'; - return $head; + return saturne_object_prepare_head($object, $head, $moreParams, true); } diff --git a/public/signature/add_signature.php b/public/signature/add_signature.php deleted file mode 100644 index bc87b5521..000000000 --- a/public/signature/add_signature.php +++ /dev/null @@ -1,278 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file public/signature/add_signature.php - * \ingroup digiriskdolibarr - * \brief Public page to add signature - */ - -if ( ! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); -if ( ! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); -if ( ! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); -if ( ! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); -if ( ! defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged. -if ( ! defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. -if ( ! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -if ( ! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); - -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); - -require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; -require_once '../../class/preventionplan.class.php'; -require_once '../../class/digiriskdocuments/preventionplandocument.class.php'; -require_once '../../class/firepermit.class.php'; -require_once '../../class/digiriskdocuments/firepermitdocument.class.php'; -require_once '../../class/accident.class.php'; -//require_once '../../class/digiriskdocuments/accidentdocument.class.php'; -require_once '../../lib/digiriskdolibarr_function.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array("digiriskdolibarr@digiriskdolibarr", "other", "errors")); - -// Get parameters -$track_id = GETPOST('track_id', 'alpha'); -$action = GETPOST('action', 'aZ09'); -$source = GETPOST('source', 'aZ09'); -$type = GETPOST('type', 'aZ09'); -$url = dirname($_SERVER['PHP_SELF']) . '/signature_success.php'; - -// Initialize technical objects -$user = new User($db); - -switch ($type) { - case 'preventionplan': - $object = new PreventionPlan($db); - $signatory = new PreventionPlanSignature($db); - $objectdocument = new PreventionPlanDocument($db); - break; - case 'firepermit': - $object = new FirePermit($db); - $signatory = new FirePermitSignature($db); - $objectdocument = new FirePermitDocument($db); - break; - case 'accident': - $object = new Accident($db); - $signatory = new SaturneSignature($db, $object->module, $object->element); - break; -} - -$signatory->fetch('', '', " AND signature_url =" . "'" . $track_id . "'"); -if (dol_strlen($signatory->signature)) { - $urltoredirect = dirname($_SERVER['PHP_SELF']) . '/signature_success.php'; - header('Location: ' . $urltoredirect); -} -$object->fetch($signatory->fk_object); - -$upload_dir = $conf->digiriskdolibarr->multidir_output[isset($object->entity) ? $object->entity : 1]; - -/* - * Actions - */ - -$parameters = array(); -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - -// Action to add record -if ($action == 'addSignature') { - $signatoryID = GETPOST('signatoryID'); - $data = json_decode(file_get_contents('php://input'), true); - - $signatory->fetch($signatoryID); - $signatory->signature = $data['signature']; - $signatory->signature_date = dol_now('tzuser'); - - // Check Captcha code if is enabled - if ( ! empty($conf->global->DIGIRISKDOLIBARR_USE_CAPTCHA)) { - $sessionkey = 'dol_antispam_value'; - $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) === strtolower($data['code']))); - - if ( ! $ok) { - $error++; - setEventMessage($langs->trans('ErrorBadValueForCode'), 'errors'); - $action = ''; - } - } - - if ( ! $error) { - $result = $signatory->update($user, false); - if ($result > 0) { - $signatory->setSigned($user, false); - // Creation signature OK - exit; - } else { - // Creation signature KO - if ( ! empty($signatory->errors)) setEventMessages(null, $signatory->errors, 'errors'); - else setEventMessages($signatory->error, null, 'errors'); - } - } else { - exit; - } -} - -if ($action == 'builddoc') { - $outputlangs = $langs; - $newlang = ''; - - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); - if ( ! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - - // To be sure vars is defined - if (empty($hidedetails)) $hidedetails = 0; - if (empty($hidedesc)) $hidedesc = 0; - if (empty($hideref)) $hideref = 0; - if (empty($moreparams)) $moreparams = null; - - $constforval = "DIGIRISKDOLIBARR_".strtoupper($type.'document')."_SPECIMEN_ADDON_ODT_PATH"; - $template = preg_replace('/DOL_DOCUMENT_ROOT/', DOL_DOCUMENT_ROOT, $conf->global->$constforval); - $model = $type.'document_specimen_odt:'.$template.'template_'.$type.'document_specimen.odt'; - - $moreparams['object'] = $object; - $moreparams['user'] = $user; - - $result = $objectdocument->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); - if ($result <= 0) { - setEventMessages($object->error, $object->errors, 'errors'); - - $action = ''; - } elseif (empty($donotredirect)) { - $document_name = $objectdocument->last_main_doc; - - copy($conf->digiriskdolibarr->multidir_output[isset($object->entity) ? $object->entity : 1] . '/' . $type.'document' . '/' . $object->ref . '/specimen/' . $document_name, DOL_DOCUMENT_ROOT . '/custom/digiriskdolibarr/documents/temp/' . $type . '_specimen_' . $track_id . '.odt'); - - setEventMessages($langs->trans("FileGenerated") . ' - ' . $document_name, null); - - $urltoredirect = $_SERVER['REQUEST_URI']; - $urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect); - $urltoredirect = preg_replace('/action=builddoc&?/', '', $urltoredirect); // To avoid infinite loop - - header('Location: ' . $urltoredirect . '#builddoc'); - exit; - } -} - -if ($action == 'remove_file') { - $files = dol_dir_list(DOL_DOCUMENT_ROOT . '/custom/digiriskdolibarr/documents/temp/'); // get all file names - - foreach ($files as $file) { - if (is_file($file['fullname'])) { - dol_delete_file($file['fullname']); - } - } -} -/* - * View - */ - -$form = new Form($db); - -if (empty($conf->global->DIGIRISKDOLIBARR_SIGNATURE_ENABLE_PUBLIC_INTERFACE)) { - print $langs->trans('SignaturePublicInterfaceForbidden'); - exit; -} - -$morejs = array("/digiriskdolibarr/js/signature-pad.min.js", "/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); - -llxHeaderSignature($langs->trans("Signature"), "", 0, 0, $morejs, $morecss); - -if ( $signatory->role == 'PP_EXT_SOCIETY_INTERVENANTS') { - $element = $signatory; -} else { - $element = $signatory->fetchSignatory($signatory->role, $signatory->fk_object, $type); - $element = array_shift($element); -} - -?> -
- -
-
- -
- trans("ThisIsInformationOnDocumentToSign"); ?> - - - - - - trans('ShowDocument'); ?> - -
-
-
-
-
trans("Name"); ?>
-
firstname . ' ' . $signatory->lastname; ?>
-
-
-
trans("DocumentName"); ?>
-
ref . ' ' . $object->label; ?>
-
-
-
-
-
- trans("Signature"); ?> - -
-
-
- -
-
-
- global->DIGIRISKDOLIBARR_USE_CAPTCHA)) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '' . img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"') . ''; - print ''; - print '
'; - }?> -
-close(); - diff --git a/public/signature/index.php b/public/signature/index.php deleted file mode 100644 index cd6990e24..000000000 --- a/public/signature/index.php +++ /dev/null @@ -1,2 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file public/signature/signature_success.php - * \ingroup digiriskdolibarr - * \brief Public page to view success on signature - */ - -if ( ! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); -if ( ! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); -if ( ! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); -if ( ! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); -if ( ! defined('NOLOGIN')) define("NOLOGIN", 1); // This means this output page does not require to be logged. -if ( ! defined('NOCSRFCHECK')) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. -if ( ! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -if ( ! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); - -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); - -require_once '../../lib/digiriskdolibarr_function.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array("digiriskdolibarr@digiriskdolibarr", "other", "errors")); - -/* - * View - */ - -if (empty($conf->global->DIGIRISKDOLIBARR_SIGNATURE_ENABLE_PUBLIC_INTERFACE)) { - print $langs->trans('SignaturePublicInterfaceForbidden'); - exit; -} - -$morejs = array("/digiriskdolibarr/js/signature-pad.min.js", "/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); - -llxHeaderSignature($langs->trans("Signature"), "", 0, 0, $morejs, $morecss); - -?> -
-

trans("SignatureSuccess"); ?>

-
-close(); - diff --git a/sql/data.sql b/sql/data.sql index fcc09576f..ec8cea0e6 100644 --- a/sql/data.sql +++ b/sql/data.sql @@ -107,6 +107,11 @@ INSERT INTO `llx_c_lesion_nature` (`rowid`, `entity`, `ref`, `label`, `descripti INSERT INTO `llx_c_lesion_nature` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(11, 0, 'Other', 'Other', '', 1); INSERT INTO `llx_c_lesion_nature` (`rowid`, `entity`, `ref`, `label`, `description`, `active`) VALUES(12, 0, 'CutOff', 'CutOff', '', 1); +-- 9.11.0 +INSERT INTO `llx_c_firepermit_attendants_role` (`rowid`, `entity`, `ref`, `label`, `description`, `active`, `position`) VALUES(1, 0, 'InternalResponsible', 'InternalResponsible', '', 1, 1); +INSERT INTO `llx_c_firepermit_attendants_role` (`rowid`, `entity`, `ref`, `label`, `description`, `active`, `position`) VALUES(1, 0, 'ExternalResponsible', 'ExternalResponsible', '', 1, 10); +INSERT INTO `llx_c_firepermit_attendants_role` (`rowid`, `entity`, `ref`, `label`, `description`, `active`, `position`) VALUES(2, 0, 'Attendant', 'Attendant', '', 1, 20); + INSERT INTO `llx_c_conventions_collectives` (`rowid`, `entity`, `tms`, `code`, `libelle`, `description`, `tracking`, `active`, `module`) VALUES(1, 0, '2021-01-22 09:27:09', '0003', 'Convention collective nationale des ouvriers de la navigation intérieure de marchandises', 'Convention collective nationale des ouvriers de la navigation intérieure de marchandises', '1', 1, NULL); INSERT INTO `llx_c_conventions_collectives` (`rowid`, `entity`, `tms`, `code`, `libelle`, `description`, `tracking`, `active`, `module`) VALUES(2, 0, '2021-01-22 09:27:09', '0016', 'Convention collective nationale des transports routiers et activités auxiliaires du transport ', 'Convention collective nationale des transports routiers et activités auxiliaires du transport ', '1', 1, NULL); INSERT INTO `llx_c_conventions_collectives` (`rowid`, `entity`, `tms`, `code`, `libelle`, `description`, `tracking`, `active`, `module`) VALUES(3, 0, '2021-01-22 09:27:09', '0018', 'Convention collective nationale des industries textiles ', 'Convention collective nationale des industries textiles ', '1', 1, NULL); diff --git a/sql/signature/llx_digiriskdolibarr_object_signature.key.sql b/sql/llx_c_firepermit_attendants_role.sql similarity index 63% rename from sql/signature/llx_digiriskdolibarr_object_signature.key.sql rename to sql/llx_c_firepermit_attendants_role.sql index b1bed5eb7..5255fd606 100644 --- a/sql/signature/llx_digiriskdolibarr_object_signature.key.sql +++ b/sql/llx_c_firepermit_attendants_role.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -13,5 +13,12 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see https://www.gnu.org/licenses/. -ALTER TABLE llx_digiriskdolibarr_object_signature ADD INDEX idx_digiriskdolibarr_object_signature_rowid (rowid); -ALTER TABLE llx_digiriskdolibarr_object_signature ADD CONSTRAINT llx_digiriskdolibarr_object_signature_fk_object FOREIGN KEY (fk_object) REFERENCES llx_digiriskdolibarr_object(rowid); +CREATE TABLE llx_c_firepermit_attendants_role( + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + entity integer default 1, + ref varchar(128), + label varchar(255), + description text, + active tinyint(4) DEFAULT 1, + position integer DEFAULT 0 +) ENGINE=innodb; diff --git a/sql/signature/llx_digiriskdolibarr_object_signature.sql b/sql/signature/llx_digiriskdolibarr_object_signature.sql deleted file mode 100644 index bd8617eb3..000000000 --- a/sql/signature/llx_digiriskdolibarr_object_signature.sql +++ /dev/null @@ -1,41 +0,0 @@ --- Copyright (C) 2021 EOXIA --- --- This program is free software: you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation, either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see https://www.gnu.org/licenses/. - -CREATE TABLE llx_digiriskdolibarr_object_signature( - rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - entity integer DEFAULT 1 NOT NULL, - date_creation datetime NOT NULL, - tms timestamp, - import_key integer DEFAULT NULL, - status smallint, - role varchar(255), - firstname varchar(255), - lastname varchar(255), - email varchar(255), - phone varchar(255), - society_name varchar(255), - signature_date datetime DEFAULT NULL, - signature_location varchar(255), - signature_comment text DEFAULT NULL, - element_id integer NOT NULL, - element_type varchar(255), - signature longtext, - stamp text, - last_email_sent_date datetime DEFAULT NULL, - signature_url varchar(255), - transaction_url varchar(255), - object_type varchar(255), - fk_object integer NOT NULL -) ENGINE=innodb; diff --git a/sql/update.sql b/sql/update.sql index 926d876e2..967d2a915 100644 --- a/sql/update.sql +++ b/sql/update.sql @@ -86,21 +86,32 @@ UPDATE llx_digiriskdolibarr_risk SET category = 21 WHERE category = 19; -- 9.11.1 ALTER TABLE llx_digiriskdolibarr_firepermitdet CHANGE `use_equipment` `used_equipment` text; DELETE FROM llx_c_action_trigger WHERE elementtype = 'informationssharing@digiriskdolibarr'; -DELETE FROM llx_c_action_trigger WHERE elementtype = 'legaldisplay@digiriskdolibarr'; DELETE FROM llx_c_action_trigger WHERE elementtype = 'preventionplandocument@digiriskdolibarr'; -DELETE FROM llx_c_action_trigger WHERE elementtype = 'firepermitdocument@digiriskdolibarr'; +DELETE FROM llx_c_action_trigger WHERE elementtype = 'legaldisplay@digiriskdolibarr'; DELETE FROM llx_c_action_trigger WHERE elementtype = 'groupmentdocument@digiriskdolibarr'; DELETE FROM llx_c_action_trigger WHERE elementtype = 'workunitdocument@digiriskdolibarr'; +DELETE FROM llx_c_action_trigger WHERE elementtype = 'firepermitdocument@digiriskdolibarr'; DELETE FROM llx_c_action_trigger WHERE elementtype = 'listingrisksphoto@digiriskdolibarr'; -DELETE FROM llx_c_action_trigger WHERE elementtype = 'listingrisksaction@digiriskdolibarr'; DELETE FROM llx_c_action_trigger WHERE elementtype = 'riskassessmentdocument@digiriskdolibarr'; +DELETE FROM llx_c_action_trigger WHERE elementtype = 'listingrisksaction@digiriskdolibarr'; DELETE FROM llx_c_action_trigger WHERE elementtype = 'digiriskelement@digiriskdolibarr'; DELETE FROM llx_c_action_trigger WHERE elementtype = 'digirisksignature@digiriskdolibarr'; DELETE FROM llx_c_action_trigger WHERE elementtype = 'preventionplan@digiriskdolibarr'; - -- 9.12.0 ALTER TABLE llx_c_digiriskdolibarr_action_trigger DROP COLUMN `rang`; ALTER TABLE llx_c_digiriskdolibarr_action_trigger ADD entity integer DEFAULT 1 AFTER rowid; -ALTER TABLE llx_c_digiriskdolibarr_action_trigger ADD position integer DEFAULT 0 AFTER description; ALTER TABLE llx_c_digiriskdolibarr_action_trigger ADD active tinyint(4) DEFAULT 1 AFTER description; +ALTER TABLE llx_c_digiriskdolibarr_action_trigger ADD position integer DEFAULT 0 AFTER description; ALTER TABLE llx_c_digiriskdolibarr_action_trigger CHANGE `code` `ref` varchar(64) NOT NULL; +UPDATE llx_digiriskdolibarr_object_signature SET role = 'InternalResponsible' WHERE role = 'PP_MAITRE_OEUVRE'; +UPDATE llx_digiriskdolibarr_object_signature SET role = 'ExternalResponsible' WHERE role = 'PP_EXT_SOCIETY_RESPONSIBLE'; +UPDATE llx_digiriskdolibarr_object_signature SET role = 'Attendant' WHERE role = 'PP_EXT_SOCIETY_INTERVENANTS'; +UPDATE llx_digiriskdolibarr_object_signature SET role = 'InternalResponsible' WHERE role = 'FP_MAITRE_OEUVRE'; +UPDATE llx_digiriskdolibarr_object_signature SET role = 'ExternalResponsible' WHERE role = 'FP_EXT_SOCIETY_RESPONSIBLE'; +UPDATE llx_digiriskdolibarr_object_signature SET role = 'Attendant' WHERE role = 'FP_EXT_SOCIETY_INTERVENANTS'; +UPDATE llx_digiriskdolibarr_object_signature SET role = 'Responsible' WHERE role = 'ACC_USER_EMPLOYER'; +ALTER TABLE `llx_digiriskdolibarr_object_signature` ADD module_name VARCHAR(128) NULL AFTER element_type; +UPDATE `llx_digiriskdolibarr_object_signature` SET module_name = 'digiriskdolibarr'; +INSERT INTO `llx_saturne_object_signature` (entity, date_creation, tms, import_key, status, role, firstname, lastname, email, phone, society_name, signature_date, signature_location, signature_comment, element_id, element_type, module_name, signature, stamp, last_email_sent_date, signature_url, transaction_url, object_type, fk_object) +SELECT entity, date_creation, tms, import_key, status, role, firstname, lastname, email, phone, society_name, signature_date, signature_location, signature_comment, element_id, element_type, module_name, signature, stamp, last_email_sent_date, signature_url, transaction_url, object_type, fk_object FROM `llx_digiriskdolibarr_object_signature`; +DROP TABLE `llx_digiriskdolibarr_object_signature`; \ No newline at end of file diff --git a/view/firepermit/firepermit_agenda.php b/view/firepermit/firepermit_agenda.php deleted file mode 100644 index 27d932c1e..000000000 --- a/view/firepermit/firepermit_agenda.php +++ /dev/null @@ -1,187 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file view/firepermit/firepermit_agenda.php - * \ingroup digiriskdolibarr - * \brief Page of FirePermit events - */ - -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); - -require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; - -require_once __DIR__ . '/../../class/firepermit.class.php'; -require_once __DIR__ . '/../../class/digiriskresources.class.php'; -require_once __DIR__ . '/../../lib/digiriskdolibarr_firepermit.lib.php'; -require_once __DIR__ . '/../../lib/digiriskdolibarr_function.lib.php'; - -global $conf, $db, $langs, $hookmanager, $user; - -// Load translation files required by the page -$langs->loadLangs(array("digiriskdolibarr@digiriskdolibarr", "other")); - -// Get parameters -$id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'alpha'); -$cancel = GETPOST('cancel', 'aZ09'); -$backtopage = GETPOST('backtopage', 'alpha'); - -if (GETPOST('actioncode', 'array')) { - $actioncode = GETPOST('actioncode', 'array', 3); - if ( ! count($actioncode)) $actioncode = '0'; -} else { - $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); -} -$search_agenda_label = GETPOST('search_agenda_label'); - -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; -$sortfield = GETPOST("sortfield", 'alpha'); -$sortorder = GETPOST("sortorder", 'alpha'); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 -$offset = $limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; -if ( ! $sortfield) $sortfield = 'a.datep,a.id'; -if ( ! $sortorder) $sortorder = 'DESC,DESC'; - -// Initialize technical objects -$object = new FirePermit($db); -$extrafields = new ExtraFields($db); -$digiriskresources = new DigiriskResources($db); -$project = new Project($db); -$hookmanager->initHooks(array('firepermitagenda', 'globalcard')); // Note that conf->hooks_modules contains array -// Fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label($object->table_element); - -// Load object -include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -if ($id > 0 || ! empty($ref)) $upload_dir = $conf->digiriskdolibarr->multidir_output[$object->entity] . "/" . $object->id; - -// Security check - Protection if external user -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; - -$permissiontoread = $user->rights->digiriskdolibarr->firepermit->read; - -if ( ! $permissiontoread) accessforbidden(); - -/* - * Actions - */ - -$parameters = array('id' => $id); -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - -if (empty($reshook)) { - // Cancel - if (GETPOST('cancel', 'alpha') && ! empty($backtopage)) { - header("Location: " . $backtopage); - exit; - } - - // Purge search criteria - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers - $actioncode = ''; - $search_agenda_label = ''; - } -} - -/* - * View - */ - -if ($object->id > 0) { - $title = $langs->trans("FirePermit") . ' - ' . $langs->trans("Agenda"); - $help_url = 'FR:Module_Digirisk#DigiRisk_-_Permis_de_feu'; - $morejs = array("/digiriskdolibarr/js/digiriskdolibarr.js"); - $morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); - - llxHeader('', $title, $help_url, '', '', '', $morejs, $morecss); - - $head = firepermitPrepareHead($object); - - print dol_get_fiche_head($head, 'firepermitAgenda', $title, -1, "digiriskdolibarr@digiriskdolibarr"); - - // Object card - // ------------------------------------------------------------ - dol_strlen($object->label) ? $morehtmlref = '' . ' - ' . $object->label . '' : ''; - $morehtmlref .= '
'; - // External Society -- Société extérieure - $ext_society = $digiriskresources->fetchResourcesFromObject('FP_EXT_SOCIETY', $object); - $morehtmlref .= $langs->trans('ExtSociety') . ' : ' . $ext_society->getNomUrl(1); - // Project - $project->fetch($object->fk_project); - $morehtmlref .= '
' . $langs->trans('Project') . ' : ' . getNomUrlProject($project, 1, 'blank', 1); - $morehtmlref .= '
'; - - $linkback = '' . $langs->trans("BackToList") . ''; - - digirisk_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $object->getLibStatut(5)); - - print '
'; - - $object->info($object->id); - dol_print_object_info($object, 1); - - print '
'; - - print dol_get_fiche_end(); - - // Actions buttons - $out = '&origin=' . $object->element . '@digiriskdolibarr' . '&originid=' . $object->id . '&backtopage='. $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&percentage=-1'; - - if ( ! empty($conf->agenda->enabled)) { - $linktocreatetimeBtnStatus = ! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create); - $morehtmlcenter = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT . '/comm/action/card.php?action=create' . $out, '', $linktocreatetimeBtnStatus); - } - - if ( ! empty($conf->agenda->enabled) && ( ! empty($user->rights->agenda->myactions->read) || ! empty($user->rights->agenda->allactions->read))) { - $param = '&id=' . $object->id; - if ( ! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage=' . urlencode($contextpage); - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit=' . urlencode($limit); - - print_barre_liste($langs->trans("ActionsOnFirePermit"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlcenter, '', 0, 1, 1); - - // List of all actions - $filters = array(); - show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, 'digiriskdolibarr'); - print '
'; - } -} - -// End of page -llxFooter(); -$db->close(); diff --git a/view/firepermit/firepermit_attendants.php b/view/firepermit/firepermit_attendants.php deleted file mode 100644 index 50ea91f24..000000000 --- a/view/firepermit/firepermit_attendants.php +++ /dev/null @@ -1,574 +0,0 @@ - - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file view/firepermit/firepermit_attendants.php - * \ingroup digiriskdolibarr - * \brief Page to add/edit/view firepermit_signature - */ - -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); - -require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; - -require_once __DIR__ . '/../../class/digiriskresources.class.php'; -require_once __DIR__ . '/../../class/firepermit.class.php'; -require_once __DIR__ . '/../../lib/digiriskdolibarr_firepermit.lib.php'; -require_once __DIR__ . '/../../lib/digiriskdolibarr_function.lib.php'; - -global $db, $langs; - -// Load translation files required by the page -$langs->loadLangs(array("digiriskdolibarr@digiriskdolibarr", "other")); - -// Get parameters -$id = GETPOST('id', 'int'); -$action = GETPOST('action', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'firepermitsignature'; // To manage different context of search -$backtopage = GETPOST('backtopage', 'alpha'); - -// Initialize technical objects -$object = new FirePermit($db); -$signatory = new FirePermitSignature($db); -$digiriskresources = new DigiriskResources($db); -$usertmp = new User($db); -$contact = new Contact($db); -$form = new Form($db); -$project = new Project($db); - -$object->fetch($id); - -$hookmanager->initHooks(array('firepermitsignature', 'globalcard')); // Note that conf->hooks_modules contains array - -//Security check -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; - -$permissiontoread = $user->rights->digiriskdolibarr->firepermit->read; -$permissiontoadd = $user->rights->digiriskdolibarr->firepermit->write; -$permissiontodelete = $user->rights->digiriskdolibarr->firepermit->delete; - -if ( ! $permissiontoread) accessforbidden(); - -/* -/* - * Actions - */ - -$parameters = array(); -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - -if (empty($backtopage) || ($cancel && empty($id))) { - if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { - $backtopage = dol_buildpath('/digiriskdolibarr/view/firepermit/firepermit_attendants.php', 1) . '?id=' . ($object->id > 0 ? $object->id : '__ID__'); - } -} - -// Action to add record -if ($action == 'addAttendant') { - $object->fetch($id); - $extintervenant_ids = GETPOST('ext_intervenants'); - - if (empty($extintervenant_ids) || $extintervenant_ids < 1) { - setEventMessages($langs->trans('ErrorNoAttendantSelected', $langs->transnoentitiesnoconv('ExtIntervenant')), null, 'errors'); - } - - if ( ! $error) { - $result = $signatory->setSignatory($object->id, 'firepermit', 'socpeople', $extintervenant_ids, 'FP_EXT_SOCIETY_INTERVENANTS', 1); - if ($result > 0) { - foreach ($extintervenant_ids as $extintervenant_id) { - $contact->fetch($extintervenant_id); - setEventMessages($langs->trans('AddAttendantMessage') . ' ' . $contact->firstname . ' ' . $contact->lastname, array()); - } - // Creation attendant OK - $urltogo = str_replace('__ID__', $result, $backtopage); - $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $id, $urltogo); // New method to autoselect project after a New on another form object creation - header("Location: " . $urltogo); - exit; - } else { - // Creation attendant KO - if ( ! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); - else setEventMessages($object->error, null, 'errors'); - } - } -} - -// Action to add record -if ($action == 'addSignature') { - $signatoryID = GETPOST('signatoryID'); - $data = json_decode(file_get_contents('php://input'), true); - - $signatory->fetch($signatoryID); - $signatory->signature = $data['signature']; - if (!empty($signatory->signature)) { - $signatory->signature_date = dol_now('tzuser'); - } else { - $signatory->signature_date = ''; - } - - if ( ! $error) { - $result = $signatory->update($user); - - if ($result > 0) { - // Creation signature OK - if (!empty($signatory->signature)) { - $signatory->setSigned($user); - } else { - $signatory->setRegistered($user); - } - $urltogo = str_replace('__ID__', $result, $backtopage); - $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $id, $urltogo); // New method to autoselect project after a New on another form object creation - header("Location: " . $urltogo); - exit; - } else { - // Creation signature KO - if ( ! empty($signatory->errors)) setEventMessages(null, $signatory->errors, 'errors'); - else setEventMessages($signatory->error, null, 'errors'); - } - } -} - -// Action to set status STATUS_ABSENT -if ($action == 'setAbsent') { - $signatoryID = GETPOST('signatoryID'); - - $signatory->fetch($signatoryID); - - if ( ! $error) { - $result = $signatory->setAbsent($user, 0); - if ($result > 0) { - // set absent OK - setEventMessages($langs->trans('Attendant') . ' ' . $signatory->firstname . ' ' . $signatory->lastname . ' ' . $langs->trans('SetAbsentAttendant'), array()); - $urltogo = str_replace('__ID__', $result, $backtopage); - $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $id, $urltogo); // New method to autoselect project after a New on another form object creation - header("Location: " . $urltogo); - exit; - } else { - // set absent KO - if ( ! empty($signatory->errors)) setEventMessages(null, $signatory->errors, 'errors'); - else setEventMessages($signatory->error, null, 'errors'); - } - } -} - -// Action to send Email -if ($action == 'send') { - $signatoryID = GETPOST('signatoryID'); - $signatory->fetch($signatoryID); - - if (!dol_strlen($signatory->email)) { - if ($signatory->element_type == 'user') { - $usertmp = $user; - $usertmp->fetch($signatory->element_id); - if (dol_strlen($usertmp->email)) { - $signatory->email = $usertmp->email; - $signatory->update($user, true); - } - } else if ($signatory->element_type == 'socpeople') { - $contact->fetch($signatory->element_id); - if (dol_strlen($contact->email)) { - $signatory->email = $contact->email; - $signatory->update($user, true); - } - } - } - - if (!dol_strlen($signatory->email)) { - setEventMessages($langs->trans('Attendant') . ' ' . $signatory->firstname . ' ' . $signatory->lastname . ' ' . $langs->trans('HasNoEmail'), null, 'errors'); - $urltogo = str_replace('__ID__', $result, $backtopage); - $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $id, $urltogo); // New method to autoselect project after a New on another form object creation - header("Location: " . $urltogo); - exit; - } - - if ( ! $error) { - $langs->load('mails'); - $sendto = $signatory->email; - - if (dol_strlen($sendto) && ( ! empty($conf->global->MAIN_MAIL_EMAIL_FROM))) { - require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; - - $from = $conf->global->MAIN_MAIL_EMAIL_FROM; - $url = dol_buildpath('/custom/digiriskdolibarr/public/signature/add_signature.php?track_id=' . $signatory->signature_url . '&type=' . $object->element, 3); - - $message = $langs->trans('SignatureEmailMessage') . ' ' . $url; - $subject = $langs->trans('SignatureEmailSubject') . ' ' . $object->ref; - - // Create form object - // Send mail (substitutionarray must be done just before this) - $mailfile = new CMailFile($subject, $sendto, $from, $message, array(), array(), array(), "", "", 0, -1, '', '', '', '', 'mail'); - - if ($mailfile->error) { - setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - } else { - if ( ! empty($conf->global->MAIN_MAIL_SMTPS_ID)) { - $result = $mailfile->sendfile(); - if ($result) { - $signatory->last_email_sent_date = dol_now('tzuser'); - $signatory->update($user, true); - $signatory->setPending($user, false); - setEventMessages($langs->trans('SendEmailAt') . ' ' . $signatory->email, array()); - // This avoid sending mail twice if going out and then back to page - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); - exit; - } else { - $langs->load("other"); - $mesg = '
'; - if ($mailfile->error) { - $mesg .= $langs->transnoentities('ErrorFailedToSendMail', dol_escape_htmltag($from), dol_escape_htmltag($sendto)); - $mesg .= '
' . $mailfile->error; - } else { - $mesg .= $langs->transnoentities('ErrorFailedToSendMail', dol_escape_htmltag($from), dol_escape_htmltag($sendto)); - } - $mesg .= '
'; - setEventMessages($mesg, null, 'warnings'); - } - } else { - setEventMessages($langs->trans('ErrorSetupEmail') . '
' . $langs->trans('GoToEmailSetup') . ' '. $langs->trans('PathToEmailSetup') .'', '', 'errors'); - } - } - } else { - $langs->load("errors"); - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("MailTo")), null, 'warnings'); - dol_syslog('Try to send email with no recipient defined', LOG_WARNING); - } - } else { - // Mail sent KO - if ( ! empty($signatory->errors)) setEventMessages(null, $signatory->errors, 'errors'); - else setEventMessages($signatory->error, null, 'errors'); - } -} - -// Action to delete attendant -if ($action == 'deleteAttendant') { - $signatoryToDeleteID = GETPOST('signatoryID'); - $signatory->fetch($signatoryToDeleteID); - - if ( ! $error) { - $result = $signatory->setDeleted($user, 0); - if ($result > 0) { - setEventMessages($langs->trans('DeleteAttendantMessage') . ' ' . $signatory->firstname . ' ' . $signatory->lastname, array()); - // Deletion attendant OK - $urltogo = str_replace('__ID__', $result, $backtopage); - $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $id, $urltogo); // New method to autoselect project after a New on another form object creation - header("Location: " . $urltogo); - exit; - } else { - // Deletion attendant KO - if ( ! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); - else setEventMessages($object->error, null, 'errors'); - } - } else { - $action = ''; - } -} - -/* - * View - */ - -$title = $langs->trans("FirePermitAttendants"); -$help_url = 'FR:Module_Digirisk#DigiRisk_-_Permis_de_feu'; -$morejs = array("/digiriskdolibarr/js/signature-pad.min.js", "/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); - -llxHeader('', $title, $help_url, '', '', '', $morejs, $morecss); - -if ( ! empty($object->id)) $res = $object->fetch_optionals(); - -// Object card -// ------------------------------------------------------------ - -$head = firepermitPrepareHead($object); -print dol_get_fiche_head($head, 'firepermitAttendants', $langs->trans("FirePermit"), -1, "digiriskdolibarr@digiriskdolibarr"); - -dol_strlen($object->label) ? $morehtmlref = '' . ' - ' . $object->label . '' : ''; -$morehtmlref .= '
'; -// External Society -- Société extérieure -$ext_society = $digiriskresources->fetchResourcesFromObject('FP_EXT_SOCIETY', $object); -$morehtmlref .= $langs->trans('ExtSociety') . ' : ' . $ext_society->getNomUrl(1); -// Project -$project->fetch($object->fk_project); -$morehtmlref .= '
' . $langs->trans('Project') . ' : ' . getNomUrlProject($project, 1, 'blank', 1); -$morehtmlref .= '
'; - -$linkback = '' . $langs->trans("BackToList") . ''; - -digirisk_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $object->getLibStatut(5)); - -print dol_get_fiche_end(); ?> - -status == 1 ) : ?> -
-
-
trans('DisclaimerSignatureTitle') ?>
-
trans("FirePermitMustBeValidatedToSign") ?>
-
- trans("GoToValidateFirePermit") ?>; -
- - -status == $object::STATUS_PENDING_SIGNATURE && $signatory->checkSignatoriesSignatures($object->id, 'firepermit')) { - print '' . $langs->trans("GoToLockFirePermit") . ''; -} - -// Part to show record -if ((empty($action) || ($action != 'create' && $action != 'edit'))) { - $url = $_SERVER['REQUEST_URI']; - $zone = "private"; - - //Master builder -- Maitre Oeuvre - $element = $signatory->fetchSignatory('FP_MAITRE_OEUVRE', $id, 'firepermit'); - if (is_array($element)) { - $element = array_shift($element); - $usertmp->fetch($element->element_id); - } - - print load_fiche_titre($langs->trans("SignatureMaitreOeuvre"), '', ''); - - print '
'; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - - print ''; - print ''; - print ''; - print '
' . $langs->trans("Name") . '' . $langs->trans("Role") . '' . $langs->trans("SignatureLink") . '' . $langs->trans("SendMailDate") . '' . $langs->trans("SignatureDate") . '' . $langs->trans("Status") . '' . $langs->trans("ActionsSignature") . '' . $langs->trans("Signature") . '
'; - print $usertmp->getNomUrl(1); - print ''; - print $langs->trans("MaitreOeuvre"); - print ''; - if ($object->status == 2) { - $signatureUrl = dol_buildpath('/custom/digiriskdolibarr/public/signature/add_signature.php?track_id=' . $element->signature_url . '&type=' . $object->element, 3); - print ''; - } else { - print '-'; - } - print ''; - print dol_print_date($element->last_email_sent_date, 'dayhour'); - print ''; - print dol_print_date($element->signature_date, 'dayhour'); - print ''; - print $element->getLibStatut(5); - print ''; - if ($object->status == 2 && $permissiontoadd) { - require __DIR__ . "/../../core/tpl/signature/digiriskdolibarr_signature_action_view.tpl.php"; - } - print ''; - if ($element->signature != $langs->transnoentities("FileGenerated") && $permissiontoadd) { - require __DIR__ . "/../../core/tpl/signature/digiriskdolibarr_signature_view.tpl.php"; - } - print '
'; - print '
'; - - //External Society Responsible -- Responsable Société extérieure - $element = $signatory->fetchSignatory('FP_EXT_SOCIETY_RESPONSIBLE', $id, 'firepermit'); - if (is_array($element)) { - $element = array_shift($element); - $contact->fetch($element->element_id); - } - - print load_fiche_titre($langs->trans("SignatureResponsibleExtSociety"), '', ''); - - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; - print '
' . $langs->trans("Name") . '' . $langs->trans("Role") . '' . $langs->trans("SignatureLink") . '' . $langs->trans("SendMailDate") . '' . $langs->trans("SignatureDate") . '' . $langs->trans("Status") . '' . $langs->trans("ActionsSignature") . '' . $langs->trans("Signature") . '
'; - print $contact->getNomUrl(1); - print ''; - print $langs->trans("ExtSocietyResponsible"); - print ''; - if ($object->status == 2) { - $signatureUrl = dol_buildpath('/custom/digiriskdolibarr/public/signature/add_signature.php?track_id=' . $element->signature_url . '&type=' . $object->element, 3); - print ''; - } else { - print '-'; - } - print ''; - print dol_print_date($element->last_email_sent_date, 'dayhour'); - print ''; - print dol_print_date($element->signature_date, 'dayhour'); - print ''; - print $element->getLibStatut(5); - print ''; - if ($object->status == 2 && $permissiontoadd) { - require __DIR__ . "/../../core/tpl/signature/digiriskdolibarr_signature_action_view.tpl.php"; - } - print ''; - if ($element->signature != $langs->transnoentities("FileGenerated") && $permissiontoadd) { - require __DIR__ . "/../../core/tpl/signature/digiriskdolibarr_signature_view.tpl.php"; - } - print '
'; - print '
'; - - //External Society Interventants -- Intervenants Société extérieure - $ext_society_intervenants = $signatory->fetchSignatory('FP_EXT_SOCIETY_INTERVENANTS', $id, 'firepermit'); - - print load_fiche_titre($langs->trans("SignatureIntervenants"), $newcardbutton, ''); - - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $already_selected_intervenants[$contact->id] = $contact->id; - $j = 1; - if (is_array($ext_society_intervenants) && ! empty($ext_society_intervenants) && $ext_society_intervenants > 0) { - foreach ($ext_society_intervenants as $element) { - $contact->fetch($element->element_id); - print ''; - print ''; - print ''; - print ''; - $already_selected_intervenants[$element->element_id] = $element->element_id; - $j++; - } - } else { - print ''; - } - - if ($object->status == 1 && $permissiontoadd) { - print ''; - print ''; - print ''; - print ''; - print ''; - - if ($backtopageforcancel) print ''; - - //Intervenants extérieurs - $ext_society = $digiriskresources->fetchResourcesFromObject('FP_EXT_SOCIETY', $object); - if ($ext_society < 1) { - $ext_society = new StdClass(); - } - print ''; - print ''; - print ''; - print ''; - print '
' . $langs->trans("Name") . '' . $langs->trans("Role") . '' . $langs->trans("SignatureLink") . '' . $langs->trans("SendMailDate") . '' . $langs->trans("SignatureDate") . '' . $langs->trans("Status") . '' . $langs->trans("ActionsSignature") . '' . $langs->trans("Signature") . '
'; - print $contact->getNomUrl(1); - print ''; - print $langs->trans("ExtSocietyIntervenant") . ' ' . $j; - print ''; - if ($object->status == 2) { - $signatureUrl = dol_buildpath('/custom/digiriskdolibarr/public/signature/add_signature.php?track_id=' . $element->signature_url . '&type=' . $object->element, 3); - print ''; - } else { - print '-'; - } - - print ''; - print dol_print_date($element->last_email_sent_date, 'dayhour'); - print ''; - print dol_print_date($element->signature_date, 'dayhour'); - print ''; - print $element->getLibStatut(5); - print ''; - if ($object->status < 3 && $permissiontoadd) { - require __DIR__ . "/../../core/tpl/signature/digiriskdolibarr_signature_action_view.tpl.php"; - } - print ''; - if ($element->signature != $langs->transnoentities("FileGenerated") && $permissiontoadd) { - require __DIR__ . "/../../core/tpl/signature/digiriskdolibarr_signature_view.tpl.php"; - } - print '
'; - print $langs->trans('NoAttendants'); - print '
'; - print digirisk_selectcontacts($ext_society->id, GETPOST('ext_intervenants'), 'ext_intervenants[]', 0, '', '', 0, 'width200', false, 1, 0, array(), 'multiple', 'ext_intervenants', false, 0, $already_selected_intervenants); - print ''; - print '' . $langs->trans("ExtSocietyIntervenants") . ''; - print '-'; - print ''; - print '-'; - print ''; - print '-'; - print ''; - print '-'; - print ''; - print ''; - print ''; - print '-'; - print '
' . "\n"; - print ''; - print '
'; - } -} - -// End of page -llxFooter(); -$db->close(); diff --git a/view/firepermit/firepermit_card.php b/view/firepermit/firepermit_card.php index 3aa8debca..33625a7c2 100644 --- a/view/firepermit/firepermit_card.php +++ b/view/firepermit/firepermit_card.php @@ -21,20 +21,14 @@ * \brief Page to create/edit/view firepermit */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment. +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT .'/core/class/html.formprojet.class.php'; @@ -997,7 +991,7 @@ // ------------------------------------------------------------ $res = $object->fetch_optionals(); - $head = firepermitPrepareHead($object); + $head = firepermit_prepare_head($object); print dol_get_fiche_head($head, 'firepermitCard', $title, -1, "digiriskdolibarr@digiriskdolibarr"); dol_strlen($object->label) ? $morehtmlref = '' . ' - ' . $object->label . '' : ''; diff --git a/view/firepermit/firepermit_schedule.php b/view/firepermit/firepermit_schedule.php index 7712cef1c..001566822 100644 --- a/view/firepermit/firepermit_schedule.php +++ b/view/firepermit/firepermit_schedule.php @@ -21,21 +21,14 @@ * \brief Page to create/edit/view Fire Permit Schedule */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); - +// Load DigiriskDolibarr environment. +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once __DIR__ . '/../../class/firepermit.class.php'; @@ -124,7 +117,7 @@ // Object card // ------------------------------------------------------------ -$head = firepermitPrepareHead($firepermit); +$head = firepermit_prepare_head($firepermit); print dol_get_fiche_head($head, 'firepermitSchedule', $langs->trans("FirePermit"), -1, "digiriskdolibarr@digiriskdolibarr"); dol_strlen($firepermit->label) ? $morehtmlref = '' . ' - ' . $firepermit->label . '' : ''; From 145057c17099070aab33e24cd03b6a4889eba5fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20David?= Date: Mon, 28 Aug 2023 12:10:27 +0200 Subject: [PATCH 002/293] #3217 [Admin] fix: saturne integration in admin files --- admin/config/about.php | 86 -------- admin/config/accident.php | 112 +++++----- admin/config/digiriskdocuments.php | 116 +++++------ admin/config/digiriskelement.php | 56 +++-- admin/config/digirisksignature.php | 138 ------------ admin/config/firepermit.php | 91 ++++---- admin/config/preventionplan.php | 102 +++++---- admin/config/riskassessmentdocument.php | 126 +++++------ admin/securityconf.php | 197 +++++++++--------- admin/setup.php | 160 +++++++------- admin/socialconf.php | 69 +++--- admin/ticket/ticket.php | 126 +++++------ class/accident.class.php | 2 +- class/actions_digiriskdolibarr.class.php | 2 +- class/api_digiriskdolibarr.class.php | 2 +- class/dashboarddigiriskstats.class.php | 2 +- class/digiriskdocuments.class.php | 2 +- .../informationssharing.class.php | 2 +- .../legaldisplay.class.php | 2 +- .../preventionplandocument.class.php | 2 +- .../riskassessmentdocument.class.php | 2 +- class/digiriskelement.class.php | 2 +- class/digiriskelement/groupment.class.php | 2 +- class/digiriskelement/workunit.class.php | 2 +- class/digiriskresources.class.php | 2 +- class/digirisksignature.class.php | 2 +- class/digiriskstandard.class.php | 2 +- class/digiriskstats.php | 2 +- class/digirisktask.class.php | 2 +- class/evaluator.class.php | 2 +- class/openinghours.class.php | 2 +- class/preventionplan.class.php | 2 +- class/riskanalysis/risk.class.php | 2 +- class/riskanalysis/riskassessment.class.php | 2 +- class/riskanalysis/risksign.class.php | 2 +- class/ticketdigiriskstats.class.php | 2 +- core/ajax/contacts.php | 2 +- .../modules_digiriskelementdocument.php | 2 +- ..._firepermitdocument_custom_odt.modules.php | 2 +- .../doc_firepermitdocument_odt.modules.php | 2 +- .../mod_firepermitdocument_standard.php | 2 +- .../modules_firepermitdocument.php | 2 +- ...c_groupmentdocument_custom_odt.modules.php | 2 +- .../doc_groupmentdocument_odt.modules.php | 2 +- .../mod_groupmentdocument_standard.php | 2 +- .../modules_groupmentdocument.php | 2 +- ...informationssharing_custom_odt.modules.php | 2 +- .../doc_informationssharing_odt.modules.php | 2 +- .../mod_informationssharing_standard.php | 2 +- .../modules_informationssharing.php | 2 +- .../doc_legaldisplay_custom_odt.modules.php | 2 +- .../doc_legaldisplay_odt.modules.php | 2 +- .../mod_legaldisplay_standard.php | 2 +- .../legaldisplay/modules_legaldisplay.php | 2 +- ..._listingrisksaction_custom_odt.modules.php | 2 +- .../doc_listingrisksaction_odt.modules.php | 2 +- .../mod_listingrisksaction_standard.php | 2 +- .../modules_listingrisksaction.php | 2 +- ...c_listingrisksphoto_custom_odt.modules.php | 2 +- .../doc_listingrisksphoto_odt.modules.php | 2 +- .../mod_listingrisksphoto_standard.php | 2 +- .../modules_listingrisksphoto.php | 2 +- .../modules_digiriskdocuments.php | 2 +- ...ventionplandocument_custom_odt.modules.php | 2 +- ...doc_preventionplandocument_odt.modules.php | 2 +- ...ntionplandocument_specimen_odt.modules.php | 2 +- .../mod_preventionplandocument_standard.php | 2 +- .../modules_preventionplandocument.php | 2 +- .../mod_projectdocument_standard.php | 2 +- ...kassessmentdocument_custom_odt.modules.php | 2 +- ...doc_riskassessmentdocument_odt.modules.php | 2 +- .../mod_riskassessmentdocument_standard.php | 2 +- .../modules_riskassessmentdocument.php | 2 +- .../doc_ticketdocument_custom_odt.modules.php | 2 +- .../doc_ticketdocument_odt.modules.php | 2 +- .../mod_ticketdocument_standard.php | 2 +- .../ticketdocument/modules_ticketdocument.php | 2 +- ...oc_workunitdocument_custom_odt.modules.php | 2 +- .../doc_workunitdocument_odt.modules.php | 2 +- .../mod_workunitdocument_standard.php | 2 +- .../modules_workunitdocument.php | 2 +- .../accident/mod_accident_standard.php | 2 +- .../mod_accident_lesion_standard.php | 2 +- .../mod_accident_workstop_standard.php | 2 +- .../evaluator/mod_evaluator_standard.php | 2 +- .../firepermit/mod_firepermit_standard.php | 2 +- .../mod_firepermitdet_standard.php | 2 +- .../groupment/mod_groupment_standard.php | 2 +- .../modules_digiriskelement.php | 2 +- .../mod_preventionplan_standard.php | 2 +- .../mod_preventionplandet_standard.php | 2 +- .../workunit/mod_workunit_standard.php | 2 +- .../riskanalysis/modules_riskanalysis.php | 2 +- .../riskanalysis/risk/mod_risk_standard.php | 2 +- .../mod_riskassessment_standard.php | 2 +- .../risksign/mod_risksign_standard.php | 2 +- core/modules/modDigiriskDolibarr.class.php | 126 ++++------- .../functions_digiriskdolibarr.lib.php | 2 +- ...arr_informationssharingfields_view.tpl.php | 2 +- ...skdolibarr_legaldisplayfields_view.tpl.php | 2 +- ...digiriskdolibarr_openinghours_view.tpl.php | 2 +- ...iskdolibarr_projectcreation_action.tpl.php | 2 +- .../digiriskdolibarr_photo_view.tpl.php | 2 +- ...olibarr_DigiriskdolibarrTriggers.class.php | 2 +- digiriskdolibarrindex.php | 2 +- js/digiriskdolibarr.js | 8 +- langs/en_US/digiriskdolibarr.lang | 2 +- langs/fr_FR/digiriskdolibarr.lang | 2 +- lib/digiriskdolibarr.lib.php | 19 +- lib/digiriskdolibarr_accident.lib.php | 2 +- lib/digiriskdolibarr_digiriskelement.lib.php | 2 +- lib/digiriskdolibarr_digiriskstandard.lib.php | 2 +- lib/digiriskdolibarr_function.lib.php | 2 +- lib/digiriskdolibarr_ticket.lib.php | 2 +- package.json | 2 +- public/ticket/create_ticket.php | 2 +- public/ticket/ticket_success.php | 2 +- sql/accident/llx_c_lesion_localization.sql | 2 +- sql/accident/llx_c_lesion_nature.sql | 2 +- sql/accident/llx_c_relative_location.sql | 2 +- .../llx_digiriskdolibarr_accident.key.sql | 2 +- .../llx_digiriskdolibarr_accident.sql | 2 +- ...iriskdolibarr_accident_extrafields.key.sql | 2 +- ..._digiriskdolibarr_accident_extrafields.sql | 2 +- ...x_digiriskdolibarr_accident_lesion.key.sql | 2 +- .../llx_digiriskdolibarr_accident_lesion.sql | 2 +- ...digiriskdolibarr_accident_workstop.key.sql | 2 +- ...llx_digiriskdolibarr_accident_workstop.sql | 2 +- ...barr_accident_workstop_extrafields.key.sql | 2 +- ...dolibarr_accident_workstop_extrafields.sql | 2 +- ..._digiriskdolibarr_accidentmetadata.key.sql | 2 +- .../llx_digiriskdolibarr_accidentmetadata.sql | 2 +- ...digiriskdolibarr_digiriskdocuments.key.sql | 2 +- ...llx_digiriskdolibarr_digiriskdocuments.sql | 2 +- ...barr_digiriskdocuments_extrafields.key.sql | 2 +- ...dolibarr_digiriskdocuments_extrafields.sql | 2 +- ...x_digiriskdolibarr_digiriskelement.key.sql | 2 +- .../llx_digiriskdolibarr_digiriskelement.sql | 2 +- ...libarr_digiriskelement_extrafields.key.sql | 2 +- ...skdolibarr_digiriskelement_extrafields.sql | 2 +- .../llx_digiriskdolibarr_firepermit.key.sql | 2 +- .../llx_digiriskdolibarr_firepermit.sql | 2 +- ...iskdolibarr_firepermit_extrafields.key.sql | 2 +- ...igiriskdolibarr_firepermit_extrafields.sql | 2 +- ...llx_digiriskdolibarr_firepermitdet.key.sql | 2 +- .../llx_digiriskdolibarr_firepermitdet.sql | 2 +- ...dolibarr_firepermitdet_extrafields.key.sql | 2 +- ...riskdolibarr_firepermitdet_extrafields.sql | 2 +- sql/llx_c_conventions_collectives.sql | 2 +- sql/llx_categorie_ticket.key.sql | 2 +- sql/llx_categorie_ticket.sql | 2 +- ...digiriskdolibarr_digiriskresources.key.sql | 2 +- ...llx_digiriskdolibarr_digiriskresources.sql | 2 +- ..._digiriskdolibarr_digiriskstandard.key.sql | 2 +- sql/llx_digiriskdolibarr_digiriskstandard.sql | 2 +- ...ibarr_digiriskstandard_extrafields.key.sql | 2 +- ...kdolibarr_digiriskstandard_extrafields.sql | 2 +- sql/llx_digiriskdolibarr_evaluator.key.sql | 2 +- sql/llx_digiriskdolibarr_evaluator.sql | 2 +- ...riskdolibarr_evaluator_extrafields.key.sql | 2 +- ...digiriskdolibarr_evaluator_extrafields.sql | 2 +- sql/llx_element_openinghours.sql | 2 +- ...lx_digiriskdolibarr_preventionplan.key.sql | 2 +- .../llx_digiriskdolibarr_preventionplan.sql | 2 +- ...olibarr_preventionplan_extrafields.key.sql | 2 +- ...iskdolibarr_preventionplan_extrafields.sql | 2 +- ...digiriskdolibarr_preventionplandet.key.sql | 2 +- ...llx_digiriskdolibarr_preventionplandet.sql | 2 +- ...barr_preventionplandet_extrafields.key.sql | 2 +- ...dolibarr_preventionplandet_extrafields.sql | 2 +- .../llx_digiriskdolibarr_risk.key.sql | 2 +- .../llx_digiriskdolibarr_risk.sql | 2 +- ..._digiriskdolibarr_risk_extrafields.key.sql | 2 +- .../llx_digiriskdolibarr_risk_extrafields.sql | 2 +- ...lx_digiriskdolibarr_riskassessment.key.sql | 2 +- .../llx_digiriskdolibarr_riskassessment.sql | 2 +- ...olibarr_riskassessment_extrafields.key.sql | 2 +- ...iskdolibarr_riskassessment_extrafields.sql | 2 +- .../llx_digiriskdolibarr_risksign.key.sql | 2 +- .../llx_digiriskdolibarr_risksign.sql | 2 +- ...iriskdolibarr_risksign_extrafields.key.sql | 2 +- ..._digiriskdolibarr_risksign_extrafields.sql | 2 +- test/phpunit/AccidentUnitTest.php | 2 +- test/phpunit/AllTests.php | 2 +- test/phpunit/DigiriskDocumentsUnitTest.php | 2 +- test/phpunit/DigiriskElementUnitTest.php | 2 +- test/phpunit/DigiriskResourcesUnitTest.php | 2 +- test/phpunit/DigiriskSignatureUnitTest.php | 2 +- test/phpunit/DigiriskStandardUnitTest.php | 2 +- test/phpunit/EvaluatorUnitTest.php | 2 +- test/phpunit/FirePermitUnitTest.php | 2 +- test/phpunit/OpeninghoursUnitTest.php | 2 +- test/phpunit/PreventionPlanUnitTest.php | 2 +- .../riskanalysis/RiskAssessmentUnitTest.php | 2 +- .../phpunit/riskanalysis/RiskSignUnitTest.php | 2 +- test/phpunit/riskanalysis/RiskUnitTest.php | 2 +- view/accident/accident_card.php | 2 +- view/accident/accident_list.php | 3 +- view/accident/accident_metadata.php | 3 +- view/accident/accident_metadata_lesion.php | 3 +- .../digiriskelement_agenda.php | 3 +- view/digiriskelement/digiriskelement_card.php | 3 +- .../digiriskelement_evaluator.php | 3 +- .../digiriskelement_listingrisksaction.php | 3 +- .../digiriskelement_listingrisksphoto.php | 3 +- .../digiriskelement_organization.php | 3 +- .../digiriskelement_register.php | 3 +- view/digiriskelement/digiriskelement_risk.php | 3 +- .../digiriskelement_risksign.php | 3 +- view/digiriskelement/risk_list.php | 3 +- .../digiriskstandard_agenda.php | 3 +- .../digiriskstandard_card.php | 3 +- .../digiriskstandard_informationssharing.php | 3 +- .../digiriskstandard_legaldisplay.php | 3 +- ...igiriskstandard_riskassessmentdocument.php | 3 +- view/digirisktools.php | 2 +- view/digiriskusers.php | 2 +- view/firepermit/firepermit_card.php | 3 +- view/firepermit/firepermit_list.php | 3 +- view/firepermit/firepermit_schedule.php | 3 +- view/openinghours_card.php | 2 +- view/preventionplan/preventionplan_agenda.php | 3 +- .../preventionplan_attendants.php | 3 +- view/preventionplan/preventionplan_card.php | 3 +- view/preventionplan/preventionplan_list.php | 3 +- .../preventionplan_schedule.php | 3 +- view/ticket/dashboard_ticket.php | 1 - view/ticket/ticketstats.php | 3 +- view/ticket/ticketstatscsv.php | 3 +- 229 files changed, 797 insertions(+), 1190 deletions(-) delete mode 100644 admin/config/about.php delete mode 100644 admin/config/digirisksignature.php diff --git a/admin/config/about.php b/admin/config/about.php deleted file mode 100644 index 773e9b00b..000000000 --- a/admin/config/about.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file admin/config/about.php - * \ingroup digiriskdolibarr - * \brief About page of module Digiriskdolibarr. - */ - -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); - -global $langs, $user, $db; - -// Libraries -require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/includes/parsedown/Parsedown.php'; - -require_once '../../lib/digiriskdolibarr.lib.php'; -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; - -// Translations -$langs->loadLangs(array("errors", "admin", "digiriskdolibarr@digiriskdolibarr")); - -// Access control -if ( ! $user->admin) accessforbidden(); - -// Parameters -$backtopage = GETPOST('backtopage', 'alpha'); - -/* - * View - */ - -$page_name = "DigiriskdolibarrAbout"; -$help_url = 'FR:Module_Digirisk#Informations'; - -$morejs = array("/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); - -llxHeader('', $langs->trans($page_name), $help_url, '', '', '', $morejs, $morecss); - -// Subheader -$linkback = '' . $langs->trans("BackToModuleList") . ''; - -print load_fiche_titre($langs->trans($page_name), $linkback, 'digiriskdolibarr32px@digiriskdolibarr'); - -// Configuration header -$head = digiriskdolibarrAdminPrepareHead(); -print dol_get_fiche_head($head, 'about', '', 0, 'digiriskdolibarr@digiriskdolibarr'); - -$contents = file_get_contents(DOL_DOCUMENT_ROOT . '/custom/digiriskdolibarr/README.md'); -$Parsedown = new Parsedown(); -echo $Parsedown->text($contents); - -// Page end -print dol_get_fiche_end(); -llxFooter(); -$db->close(); diff --git a/admin/config/accident.php b/admin/config/accident.php index de8df40b9..200ec7266 100644 --- a/admin/config/accident.php +++ b/admin/config/accident.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,20 +21,14 @@ * \brief Digiriskdolibarr accident page. */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} global $conf, $db, $langs, $user; @@ -42,14 +36,10 @@ require_once DOL_DOCUMENT_ROOT . "/core/class/html.formprojet.class.php"; require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; -require_once '../../lib/digiriskdolibarr.lib.php'; -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; +require_once __DIR__ . '/../../lib/digiriskdolibarr.lib.php'; // Translations -$langs->loadLangs(array("admin", "digiriskdolibarr@digiriskdolibarr")); - -// Access control -if ( ! $user->admin) accessforbidden(); +saturne_load_langs(["admin"]); // Parameters $action = GETPOST('action', 'alpha'); @@ -62,6 +52,10 @@ // Initialize technical objects $usertmp = new User($db); +// Security check - Protection if external user +$permissiontoread = $user->rights->digiriskdolibarr->adminpage->read; +saturne_check_access($permissiontoread); + /* * Actions */ @@ -79,15 +73,17 @@ } if ($action == 'updateMask') { - $maskconstaccident = GETPOST('maskconstaccident', 'alpha'); - $maskaccident = GETPOST('maskaccident', 'alpha'); + $accidentMaskConst = GETPOST('maskconstaccident', 'alpha'); + $accidentMask = GETPOST('maskaccident', 'alpha'); - if ($maskconstaccident) $res = dolibarr_set_const($db, $maskconstaccident, $maskaccident, 'chaine', 0, '', $conf->entity); + if ($accidentMaskConst) { + $res = dolibarr_set_const($db, $accidentMaskConst, $accidentMask, 'chaine', 0, '', $conf->entity); + } if ( ! $res > 0) $error++; if ( ! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + setEventMessages($langs->trans("SetupSaved"), null); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } @@ -112,52 +108,27 @@ * View */ -if ( ! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } +if (isModEnabled('project')) { + $formproject = new FormProjets($db); +} + $form = new Form($db); -$help_url = 'FR:Module_Digirisk'; +$helpUrl = 'FR:Module_Digirisk'; $title = $langs->trans("Accident"); -$morejs = array("/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); - -llxHeader('', $title, $help_url, '', '', '', $morejs, $morecss); +saturne_header(0,'', $title, $helpUrl); // Subheader -$linkback = '' . $langs->trans("BackToModuleList") . ''; - +$linkback = '' . $langs->trans("BackToModuleList") . ''; print load_fiche_titre($title, $linkback, 'digiriskdolibarr32px@digiriskdolibarr'); // Configuration header -$head = digiriskdolibarrAdminPrepareHead(); +$head = digiriskdolibarr_admin_prepare_head(); print dol_get_fiche_head($head, 'accident', '', -1, "digiriskdolibarr@digiriskdolibarr"); print load_fiche_titre(' ' . $langs->trans("AccidentManagement"), '', ''); print '
'; -print load_fiche_titre($langs->trans("LinkedProject"), '', ''); - -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - -// Project -if ( ! empty($conf->projet->enabled)) { - $langs->load("projects"); - print ''; -} - -print '
' . $langs->trans("Name") . '' . $langs->trans("SelectProject") . '' . $langs->trans("Action") . '
'; - $numprojet = $formproject->select_projects(0, $conf->global->DIGIRISKDOLIBARR_ACCIDENT_PROJECT, 'ACCProject', 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 'maxwidth500'); - print ' '; - print ''; - print '
'; -print '
'; /* * Numbering module @@ -423,6 +394,31 @@ print ''; +// Project +if (isModEnabled('project')) { + print load_fiche_titre($langs->trans("LinkedProject"), '', ''); + + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + $langs->load("projects"); + print ''; + + print '
' . $langs->trans("Name") . '' . $langs->trans("SelectProject") . '' . $langs->trans("Action") . '
'; + $formproject->select_projects(0, $conf->global->DIGIRISKDOLIBARR_ACCIDENT_PROJECT, 'ACCProject', 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 'maxwidth500'); + print ' '; + print ''; + print '
'; + print '
'; +} + // Page end print dol_get_fiche_end(); llxFooter(); diff --git a/admin/config/digiriskdocuments.php b/admin/config/digiriskdocuments.php index 67de4e521..68053ef91 100644 --- a/admin/config/digiriskdocuments.php +++ b/admin/config/digiriskdocuments.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,20 +21,14 @@ * \brief Digiriskdolibarr digiriskdocuments page. */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER['CONTEXT_DOCUMENT_ROOT'])) $res = @include $_SERVER['CONTEXT_DOCUMENT_ROOT']. '/main.inc.php'; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)). '/main.inc.php')) $res = @include substr($tmp, 0, ($i + 1)). '/main.inc.php'; -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))). '/main.inc.php')) $res = @include dirname(substr($tmp, 0, ($i + 1))). '/main.inc.php'; -// Try main.inc.php using relative path -if (!$res && file_exists('../../main.inc.php')) $res = @include '../../main.inc.php'; -if (!$res && file_exists('../../../main.inc.php')) $res = @include '../../../main.inc.php'; -if (!$res && file_exists('../../../../main.inc.php')) $res = @include '../../../../main.inc.php'; -if (!$res) die('Include of main fails'); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} global $conf, $db, $langs, $user; @@ -42,14 +36,11 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; -require_once '../../lib/digiriskdolibarr.lib.php'; -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; +require_once __DIR__ . '/../../lib/digiriskdolibarr.lib.php'; // Translations -$langs->loadLangs(array('admin', 'digiriskdolibarr@digiriskdolibarr')); +saturne_load_langs(["admin"]); -// Access control -if (!$user->admin) accessforbidden(); // Parameters $action = GETPOST('action', 'alpha'); @@ -58,36 +49,39 @@ $type = GETPOST('type', 'alpha'); $const = GETPOST('const', 'alpha'); $label = GETPOST('label', 'alpha'); -$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php +$modulepart = GETPOST('modulepart', 'aZ09'); + +// Security check - Protection if external user +$permissiontoread = $user->rights->digiriskdolibarr->adminpage->read; +saturne_check_access($permissiontoread); /* * Actions */ if ($action == 'deletefile' && $modulepart == 'ecm' && !empty($user->admin)) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $keyforuploaddir = GETPOST('keyforuploaddir', 'aZ09'); - - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim(getDolGlobalString($keyforuploaddir)))); - foreach ($listofdir as $key => $tmpdir) { - $tmpdir = preg_replace('/DOL_DATA_ROOT\/*/', '', $tmpdir); // Clean string if we found a hardcoded DOL_DATA_ROOT - if (!$tmpdir) { - unset($listofdir[$key]); + $keyForUploadDir = GETPOST('keyforuploaddir', 'aZ09'); + + $listOfDir = explode(',', preg_replace('/[\r\n]+/', ',', trim(getDolGlobalString($keyForUploadDir)))); + foreach ($listOfDir as $key => $tmpDir) { + $tmpDir = preg_replace('/DOL_DATA_ROOT\/*/', '', $tmpDir); // Clean string if we found a hardcoded DOL_DATA_ROOT + if (!$tmpDir) { + unset($listOfDir[$key]); continue; } - $tmpdir = DOL_DATA_ROOT.'/'.$tmpdir; // Complete with DOL_DATA_ROOT. Only files into DOL_DATA_ROOT can be reach/set - if (!is_dir($tmpdir)) { - if (empty($nomessageinsetmoduleoptions)) { - setEventMessages($langs->trans('ErrorDirNotFound', $tmpdir), null, 'warnings'); + $tmpDir = DOL_DATA_ROOT . '/' . $tmpDir; // Complete with DOL_DATA_ROOT. Only files into DOL_DATA_ROOT can be reach/set + if (!is_dir($tmpDir)) { + if (empty($noMessageInSetModuleOptions)) { + setEventMessages($langs->trans('ErrorDirNotFound', $tmpDir), null, 'warnings'); } } else { - $upload_dir = $tmpdir; - break; // So we take the first directory found into setup $conf->global->$keyforuploaddir + $upload_dir = $tmpDir; + break; // So we take the first directory found into setup $conf->global->$keyForUploadDir } } - $filetodelete = $tmpdir.'/'.GETPOST('file'); - $result = dol_delete_file($filetodelete); + $fileToDelete = $tmpDir.'/'.GETPOST('file'); + $result = dol_delete_file($fileToDelete); if ($result > 0) { setEventMessages($langs->trans('FileWasRemoved', GETPOST('file')), null, 'mesgs'); header('Location: ' . $_SERVER['PHP_SELF']); @@ -105,7 +99,7 @@ if ($type == 'projectdocument') { $type = 'project'; } else { - $constforval = 'DIGIRISKDOLIBARR_' .strtoupper($type). '_DEFAULT_MODEL'; + $constforval = 'DIGIRISKDOLIBARR_' . strtoupper($type) . '_DEFAULT_MODEL'; if ($value == dolibarr_get_const($db, $constforval)) { dolibarr_del_const($db, $constforval); } @@ -117,13 +111,12 @@ // Set default model if ($action == 'setdoc') { if ($type != 'projectdocument') { - $constforval = 'DIGIRISKDOLIBARR_' .strtoupper($type). '_DEFAULT_MODEL'; + $constforval = 'DIGIRISKDOLIBARR_' . strtoupper($type) . '_DEFAULT_MODEL'; dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity); } else { dolibarr_set_const($db, 'PROJECT_ADDON_PDF', $value, 'chaine', 0, '', $conf->entity); } - // On active le modele $ret = delDocumentModel($value, $type); if ($ret > 0) { $ret = addDocumentModel($value, $type, $label, $const); @@ -134,24 +127,23 @@ } if ($action == 'setModuleOptions') { - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $keyforuploaddir = GETPOST('keyforuploaddir', 'aZ09'); - - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim(getDolGlobalString($keyforuploaddir)))); - foreach ($listofdir as $key => $tmpdir) { - $tmpdir = preg_replace('/DOL_DATA_ROOT\/*/', '', $tmpdir); // Clean string if we found a hardcoded DOL_DATA_ROOT - if (!$tmpdir) { - unset($listofdir[$key]); + $keyForUploadDir = GETPOST('keyforuploaddir', 'aZ09'); + + $listOfDir = explode(',', preg_replace('/[\r\n]+/', ',', trim(getDolGlobalString($keyForUploadDir)))); + foreach ($listOfDir as $key => $tmpDir) { + $tmpDir = preg_replace('/DOL_DATA_ROOT\/*/', '', $tmpDir); // Clean string if we found a hardcoded DOL_DATA_ROOT + if (!$tmpDir) { + unset($listOfDir[$key]); continue; } - $tmpdir = DOL_DATA_ROOT.'/'.$tmpdir; // Complete with DOL_DATA_ROOT. Only files into DOL_DATA_ROOT can be reach/set - if (!is_dir($tmpdir)) { - if (empty($nomessageinsetmoduleoptions)) { - setEventMessages($langs->trans('ErrorDirNotFound', $tmpdir), null, 'warnings'); + $tmpDir = DOL_DATA_ROOT.'/'.$tmpDir; // Complete with DOL_DATA_ROOT. Only files into DOL_DATA_ROOT can be reach/set + if (!is_dir($tmpDir)) { + if (empty($noMessageInSetModuleOptions)) { + setEventMessages($langs->trans('ErrorDirNotFound', $tmpDir), null, 'warnings'); } } else { - $upload_dir = $tmpdir; - break; // So we take the first directory found into setup $conf->global->$keyforuploaddir + $upload_dir = $tmpDir; + break; // So we take the first directory found into setup $conf->global->$keyForUploadDir } } @@ -186,8 +178,8 @@ if (!empty($upload_dirold) && !empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { $result = dol_add_file_process($upload_dirold, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs, $object); - } elseif (!empty($tmpdir)) { - $result = dol_add_file_process($tmpdir, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '' ); + } elseif (!empty($tmpDir)) { + $result = dol_add_file_process($tmpDir, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '' ); } } } @@ -197,13 +189,10 @@ * View */ -$help_url = 'FR:Module_Digirisk#L.27onglet_Document_Unique'; +$helpUrl = 'FR:Module_Digirisk#L.27onglet_Document_Unique'; $title = $langs->trans('YourDocuments'); -$morejs = array('/digiriskdolibarr/js/digiriskdolibarr.js'); -$morecss = array('/digiriskdolibarr/css/digiriskdolibarr.css'); - -llxHeader('', $title, $help_url, '', '', '', $morejs, $morecss); +saturne_header(0,'', $title, $helpUrl); $types = array( 'LegalDisplay' => 'legaldisplay', @@ -243,7 +232,7 @@ print load_fiche_titre($title, $selectorAnchor, 'digiriskdolibarr32px@digiriskdolibarr'); // Configuration header -$head = digiriskdolibarrAdminPrepareHead(); +$head = digiriskdolibarr_admin_prepare_head(); print dol_get_fiche_head($head, 'digiriskdocuments', '', -1, 'digiriskdolibarr@digiriskdolibarr'); print load_fiche_titre($langs->trans("DigiriskDocumentsData"), '', ''); @@ -543,9 +532,6 @@ print ''; print ''; } - - print '
'; - } // Page end print dol_get_fiche_end(); diff --git a/admin/config/digiriskelement.php b/admin/config/digiriskelement.php index 844c1f7af..a9bce6e16 100644 --- a/admin/config/digiriskelement.php +++ b/admin/config/digiriskelement.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,38 +21,36 @@ * \brief Digiriskdolibarr digiriskelement page. */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} global $langs, $user, $db; // Libraries require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; -require_once '../../lib/digiriskdolibarr.lib.php'; -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; +require_once __DIR__ . '/../../lib/digiriskdolibarr.lib.php'; // Translations -$langs->loadLangs(array("admin", "digiriskdolibarr@digiriskdolibarr")); - -// Access control -if ( ! $user->admin) accessforbidden(); +saturne_load_langs(["admin"]); // Parameters $backtopage = GETPOST('backtopage', 'alpha'); +// Security check - Protection if external user +$permissiontoread = $user->rights->digiriskdolibarr->adminpage->read; +saturne_check_access($permissiontoread); + +/* + * Actions + */ + if (GETPOST('action') == 'setmod') { if (GETPOST('type') == 'groupment') { dolibarr_set_const($db, "DIGIRISKDOLIBARR_GROUPMENT_ADDON", GETPOST('value'), 'chaine', 0, '', $conf->entity); @@ -69,21 +67,18 @@ * View */ -$help_url = 'FR:Module_Digirisk#L.27onglet_.C3.89l.C3.A9ment_DigiRisk'; +$helpUrl = 'FR:Module_Digirisk#L.27onglet_.C3.89l.C3.A9ment_DigiRisk'; $title = $langs->trans("Organization"); -$morejs = array("/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); - -llxHeader('', $title, $help_url, '', '', '', $morejs, $morecss); +saturne_header(0,'', $title, $helpUrl); // Subheader -$linkback = '' . $langs->trans("BackToModuleList") . ''; +$linkback = '' . $langs->trans("BackToModuleList") . ''; print load_fiche_titre($title, $linkback, 'digiriskdolibarr32px@digiriskdolibarr'); // Configuration header -$head = digiriskdolibarrAdminPrepareHead(); +$head = digiriskdolibarr_admin_prepare_head(); print dol_get_fiche_head($head, 'digiriskelement', '', -1, "digiriskdolibarr@digiriskdolibarr"); $types = array( @@ -186,13 +181,11 @@ closedir($handle); } } - print ''; - print '
'; } /* - * Deleted Elements + * Deleted elements */ print load_fiche_titre(' ' . $langs->trans('DeletedElements'), '', ''); @@ -219,7 +212,6 @@ print ''; print ''; -// Page end // Page end print dol_get_fiche_end(); diff --git a/admin/config/digirisksignature.php b/admin/config/digirisksignature.php deleted file mode 100644 index 94fd25f35..000000000 --- a/admin/config/digirisksignature.php +++ /dev/null @@ -1,138 +0,0 @@ - - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ - -/** - * \file admin/config/digirisksignature.php - * \ingroup digiriskdolibarr - * \brief Page to public interface of module DigiriskDolibarr for signature - */ - -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); - -global $langs, $user; - -// Libraries -require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; - -require_once '../../lib/digiriskdolibarr.lib.php'; -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; - -// Translations -$langs->loadLangs(array("admin", "digiriskdolibarr@digiriskdolibarr")); - -// Access control -if ( ! $user->admin) accessforbidden(); - -// Parameters -$action = GETPOST('action', 'alpha'); -$backtopage = GETPOST('backtopage', 'alpha'); -$value = GETPOST('value', 'alpha'); - -/* - * Actions - */ - -if ($action == 'setPublicInterface') { - if (GETPOST('value')) dolibarr_set_const($db, 'DIGIRISKDOLIBARR_SIGNATURE_ENABLE_PUBLIC_INTERFACE', 1, 'integer', 0, '', $conf->entity); - else dolibarr_set_const($db, 'DIGIRISKDOLIBARR_SIGNATURE_ENABLE_PUBLIC_INTERFACE', 0, 'integer', 0, '', $conf->entity); -} - -/* - * View - */ - -$form = new Form($db); - -$help_url = 'FR:Module_Digirisk'; -$title = $langs->trans("DigiriskSignature"); - -$morejs = array("/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); - -llxHeader('', $title, $help_url, '', '', '', $morejs, $morecss); - -// Subheader -$linkback = '' . $langs->trans("BackToModuleList") . ''; - -print load_fiche_titre($title, $linkback, 'digiriskdolibarr32px@digiriskdolibarr'); - -// Configuration header -$head = digiriskdolibarrAdminPrepareHead(); -print dol_get_fiche_head($head, 'digirisksignature', '', -1, "digiriskdolibarr@digiriskdolibarr"); - -print load_fiche_titre(' ' . $langs->trans('SignatureManagement'), '', ''); -print '
'; - -print load_fiche_titre($langs->trans("SignaturePublicInterface"), '', ''); - -$enabledisablehtml = $langs->trans("SignatureActivatePublicInterface") . ' '; -if (empty($conf->global->DIGIRISKDOLIBARR_SIGNATURE_ENABLE_PUBLIC_INTERFACE)) { - // Button off, click to enable - $enabledisablehtml .= ''; - $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); - $enabledisablehtml .= ''; -} else { - // Button on, click to disable - $enabledisablehtml .= ''; - $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on'); - $enabledisablehtml .= ''; -} -print $enabledisablehtml; -print ''; - -print '

'; - -if ( ! empty($conf->global->DIGIRISKDOLIBARR_SIGNATURE_ENABLE_PUBLIC_INTERFACE)) { - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - // Show logo for company - print ''; - print ''; - print ''; - print ''; - - print '
' . $langs->trans("Parameters") . '' . $langs->trans("Status") . '' . $langs->trans("ShortInfo") . '
' . $langs->trans("SignatureShowCompanyLogo") . ''; - print ajax_constantonoff('DIGIRISKDOLIBARR_SIGNATURE_SHOW_COMPANY_LOGO'); - print ''; - print $form->textwithpicto('', $langs->trans("SignatureShowCompanyLogoHelp"), 1, 'help'); - print '
'; - print '
'; -} - -// End of page -print dol_get_fiche_end(); -llxFooter(); -$db->close(); diff --git a/admin/config/firepermit.php b/admin/config/firepermit.php index 111573156..9370df74b 100644 --- a/admin/config/firepermit.php +++ b/admin/config/firepermit.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,20 +21,14 @@ * \brief Digiriskdolibarr firepermit page. */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} global $conf, $db, $langs, $user; @@ -42,14 +36,10 @@ require_once DOL_DOCUMENT_ROOT . "/core/class/html.formprojet.class.php"; require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; -require_once '../../lib/digiriskdolibarr.lib.php'; -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; +require_once __DIR__ . '/../../lib/digiriskdolibarr.lib.php'; // Translations -$langs->loadLangs(array("admin", "digiriskdolibarr@digiriskdolibarr")); - -// Access control -if ( ! $user->admin) accessforbidden(); +saturne_load_langs(["admin"]); // Parameters $action = GETPOST('action', 'alpha'); @@ -62,6 +52,10 @@ // Initialize technical objects $usertmp = new User($db); +// Security check - Protection if external user +$permissiontoread = $user->rights->digiriskdolibarr->adminpage->read; +saturne_check_access($permissiontoread); + /* * Actions */ @@ -72,22 +66,22 @@ dolibarr_set_const($db, "DIGIRISKDOLIBARR_FIREPERMIT_PROJECT", $FPRProject[0], 'integer', 0, '', $conf->entity); - if ($action != 'updateedit' && ! $error) { + if ($action != 'updateedit' && !$error) { header("Location: " . $_SERVER["PHP_SELF"]); exit; } } if ($action == 'updateMask') { - $maskconstfirepermit = GETPOST('maskconstfirepermit', 'alpha'); - $maskfirepermit = GETPOST('maskfirepermit', 'alpha'); + $firePermitMaskConst = GETPOST('maskconstfirepermit', 'alpha'); + $firePermitMask = GETPOST('maskfirepermit', 'alpha'); - if ($maskconstfirepermit) $res = dolibarr_set_const($db, $maskconstfirepermit, $maskfirepermit, 'chaine', 0, '', $conf->entity); + if ($firePermitMaskConst) $res = dolibarr_set_const($db, $firePermitMaskConst, $firePermitMask, 'chaine', 0, '', $conf->entity); if ( ! $res > 0) $error++; if ( ! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + setEventMessages($langs->trans("SetupSaved"), null); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } @@ -117,53 +111,52 @@ * View */ -if ( ! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } +if (isModEnabled('project')) { + $formproject = new FormProjets($db); +} $form = new Form($db); -$help_url = 'FR:Module_Digirisk'; +$helpUrl = 'FR:Module_Digirisk'; $title = $langs->trans("FirePermit"); -$morejs = array("/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); - -llxHeader('', $title, $help_url, '', '', '', $morejs, $morecss); +saturne_header(0,'', $title, $helpUrl); // Subheader -$linkback = '' . $langs->trans("BackToModuleList") . ''; +$linkback = '' . $langs->trans("BackToModuleList") . ''; print load_fiche_titre($title, $linkback, 'digiriskdolibarr32px@digiriskdolibarr'); // Configuration header -$head = digiriskdolibarrAdminPrepareHead(); +$head = digiriskdolibarr_admin_prepare_head(); print dol_get_fiche_head($head, 'firepermit', '', -1, "digiriskdolibarr@digiriskdolibarr"); print load_fiche_titre(' ' . $langs->trans("FirePermitManagement"), '', ''); print '
'; print load_fiche_titre($langs->trans("LinkedProject"), '', ''); -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - // Project -if ( ! empty($conf->projet->enabled)) { +if (isModEnabled('project')) { + print ''; + print ''; + print ''; + print '
' . $langs->trans("Name") . '' . $langs->trans("SelectProject") . '' . $langs->trans("Action") . '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + $langs->load("projects"); print ''; -} -print '
' . $langs->trans("Name") . '' . $langs->trans("SelectProject") . '' . $langs->trans("Action") . '
'; - $numprojet = $formproject->select_projects(0, $conf->global->DIGIRISKDOLIBARR_FIREPERMIT_PROJECT, 'FPRProject', 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 'maxwidth500'); + $formproject->select_projects(0, $conf->global->DIGIRISKDOLIBARR_FIREPERMIT_PROJECT, 'FPRProject', 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 'maxwidth500'); print ' '; print ''; print '
'; -print '
'; + print ''; + print ''; +} /* * Numbering module diff --git a/admin/config/preventionplan.php b/admin/config/preventionplan.php index 3df34f0d4..9ab741fda 100644 --- a/admin/config/preventionplan.php +++ b/admin/config/preventionplan.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,20 +21,14 @@ * \brief Digiriskdolibarr preventionplan page. */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} global $conf, $db, $langs, $user; @@ -42,14 +36,11 @@ require_once DOL_DOCUMENT_ROOT . "/core/class/html.formprojet.class.php"; require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; -require_once '../../lib/digiriskdolibarr.lib.php'; -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; +require_once __DIR__ . '/../../lib/digiriskdolibarr.lib.php'; // Translations -$langs->loadLangs(array("admin", "digiriskdolibarr@digiriskdolibarr")); +saturne_load_langs(["admin"]); -// Access control -if ( ! $user->admin) accessforbidden(); // Parameters $action = GETPOST('action', 'alpha'); @@ -62,6 +53,10 @@ // Initialize technical objects $usertmp = new User($db); +// Security check - Protection if external user +$permissiontoread = $user->rights->digiriskdolibarr->adminpage->read; +saturne_check_access($permissiontoread); + /* * Actions */ @@ -79,36 +74,36 @@ } if ($action == 'updateMask') { - $maskconstpreventionplan = GETPOST('maskconstpreventionplan', 'alpha'); - $maskpreventionplan = GETPOST('maskpreventionplan', 'alpha'); + $preventionPlanMaskConst = GETPOST('maskconstpreventionplan', 'alpha'); + $preventionPlanMask = GETPOST('maskpreventionplan', 'alpha'); - if ($maskconstpreventionplan) $res = dolibarr_set_const($db, $maskconstpreventionplan, $maskpreventionplan, 'chaine', 0, '', $conf->entity); + if ($preventionPlanMaskConst) $res = dolibarr_set_const($db, $preventionPlanMaskConst, $preventionPlanMask, 'chaine', 0, '', $conf->entity); if ( ! $res > 0) $error++; if ( ! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + setEventMessages($langs->trans("SetupSaved"), null); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } if ($action == 'setmod') { - $constforval = 'DIGIRISKDOLIBARR_' . strtoupper($type) . "_ADDON"; - dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity); + $constForVal = 'DIGIRISKDOLIBARR_' . strtoupper($type) . "_ADDON"; + dolibarr_set_const($db, $constForVal, $value, 'chaine', 0, '', $conf->entity); } if ($action == 'setmodPreventionPlanDet') { - $constforval = 'DIGIRISKDOLIBARR_' . strtoupper('preventionplandet') . "_ADDON"; - dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity); + $constForVal = 'DIGIRISKDOLIBARR_' . strtoupper('preventionplandet') . "_ADDON"; + dolibarr_set_const($db, $constForVal, $value, 'chaine', 0, '', $conf->entity); } if ($action == 'setMaitreOeuvre') { - $maitre_oeuvre_id = GETPOST('maitre_oeuvre'); + $masterWorkerId = GETPOST('maitre_oeuvre'); if ( ! $error) { - $constforval = 'DIGIRISKDOLIBARR_' . strtoupper($type) . "_MAITRE_OEUVRE"; - dolibarr_set_const($db, $constforval, $maitre_oeuvre_id, 'integer', 0, '', $conf->entity); + $constForVal = 'DIGIRISKDOLIBARR_' . strtoupper($type) . "_MAITRE_OEUVRE"; + dolibarr_set_const($db, $constForVal, $masterWorkerId, 'integer', 0, '', $conf->entity); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } } @@ -117,52 +112,51 @@ * View */ -if ( ! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } +if (isModEnabled('project')) { + $formproject = new FormProjets($db); +} $form = new Form($db); -$help_url = 'FR:Module_Digirisk'; +$helpUrl = 'FR:Module_Digirisk'; $title = $langs->trans("PreventionPlan"); -$morejs = array("/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); - -llxHeader('', $title, $help_url, '', '', '', $morejs, $morecss); +saturne_header(0,'', $title, $helpUrl); // Subheader -$linkback = '' . $langs->trans("BackToModuleList") . ''; +$linkback = '' . $langs->trans("BackToModuleList") . ''; print load_fiche_titre($title, $linkback, 'digiriskdolibarr32px@digiriskdolibarr'); // Configuration header -$head = digiriskdolibarrAdminPrepareHead(); +$head = digiriskdolibarr_admin_prepare_head(); print dol_get_fiche_head($head, 'preventionplan', '', -1, "digiriskdolibarr@digiriskdolibarr"); print load_fiche_titre(' ' . $langs->trans("PreventionPlanManagement"), '', ''); print '
'; print load_fiche_titre($langs->trans("LinkedProject"), '', ''); -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - // Project -if ( ! empty($conf->projet->enabled)) { +if (isModEnabled('project')) { + print ''; + print ''; + print ''; + print '
' . $langs->trans("Name") . '' . $langs->trans("SelectProject") . '' . $langs->trans("Action") . '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + $langs->load("projects"); print ''; -} -print '
' . $langs->trans("Name") . '' . $langs->trans("SelectProject") . '' . $langs->trans("Action") . '
'; - $numprojet = $formproject->select_projects(0, $conf->global->DIGIRISKDOLIBARR_PREVENTIONPLAN_PROJECT, 'PPRProject', 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 'maxwidth500'); + $formproject->select_projects(0, $conf->global->DIGIRISKDOLIBARR_PREVENTIONPLAN_PROJECT, 'PPRProject', 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 'maxwidth500'); print ' '; print ''; print '
'; -print '
'; + print ''; + print ''; +} /* * Numbering module Prevention Plan diff --git a/admin/config/riskassessmentdocument.php b/admin/config/riskassessmentdocument.php index 53e2abc99..a6d2cb143 100644 --- a/admin/config/riskassessmentdocument.php +++ b/admin/config/riskassessmentdocument.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,20 +21,14 @@ * \brief Digiriskdolibarr riskassessmentdocument page. */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} global $conf, $db, $langs, $user; @@ -45,8 +39,7 @@ require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php'; -require_once '../../lib/digiriskdolibarr.lib.php'; -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; +require_once __DIR__ . '/../../lib/digiriskdolibarr.lib.php'; $action = GETPOST('action', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); @@ -56,33 +49,34 @@ $task = new Task($db); // Translations -$langs->loadLangs(array("admin", "digiriskdolibarr@digiriskdolibarr")); - -// Access control -if ( ! $user->admin) accessforbidden(); +saturne_load_langs(["admin"]); // Parameters $action = GETPOST('action', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); +// Security check - Protection if external user +$permissiontoread = $user->rights->digiriskdolibarr->adminpage->read; +saturne_check_access($permissiontoread); + /* * Actions */ if (($action == 'update' && ! GETPOST("cancel", 'alpha')) || ($action == 'updateedit')) { - $DUProject = GETPOST('DUProject', 'none'); - $DUProject = preg_split('/_/', $DUProject); - $EvaluatorDuration = GETPOST('EvaluatorDuration', 'alpha'); - $TaskTimeSpentDuration = GETPOST('TaskTimeSpentDuration', 'alpha'); + $DUProject = GETPOST('DUProject', 'none'); + $DUProject = preg_split('/_/', $DUProject); + $evaluatorDuration = GETPOST('EvaluatorDuration', 'alpha'); + $taskTimeSpentDuration = GETPOST('TaskTimeSpentDuration', 'alpha'); dolibarr_set_const($db, "DIGIRISKDOLIBARR_DU_PROJECT", $DUProject[0], 'integer', 0, '', $conf->entity); - if (!empty($EvaluatorDuration) || $EvaluatorDuration === '0') { - dolibarr_set_const($db, "DIGIRISKDOLIBARR_EVALUATOR_DURATION", $EvaluatorDuration, 'integer', 0, '', $conf->entity); + if (!empty($evaluatorDuration) || $evaluatorDuration === '0') { + dolibarr_set_const($db, "DIGIRISKDOLIBARR_EVALUATOR_DURATION", $evaluatorDuration, 'integer', 0, '', $conf->entity); } - if (!empty($TaskTimeSpentDuration) || $TaskTimeSpentDuration === '0') { - dolibarr_set_const($db, "DIGIRISKDOLIBARR_TASK_TIMESPENT_DURATION", $TaskTimeSpentDuration, 'integer', 0, '', $conf->entity); + if (!empty($taskTimeSpentDuration) || $taskTimeSpentDuration === '0') { + dolibarr_set_const($db, "DIGIRISKDOLIBARR_TASK_TIMESPENT_DURATION", $taskTimeSpentDuration, 'integer', 0, '', $conf->entity); } if (!empty(GETPOST('project_contact_type'))) { @@ -104,36 +98,28 @@ * View */ -if ( ! empty($conf->projet->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } -$formcompany = new FormCompany($db); - -$help_url = 'FR:Module_Digirisk#L.27onglet_Analyse_des_risques'; +$helpUrl = 'FR:Module_Digirisk#L.27onglet_Analyse_des_risques'; $title = $langs->trans("RiskAssessmentDocument"); -$morejs = array("/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); - -llxHeader('', $title, $help_url, '', '', '', $morejs, $morecss); +saturne_header(0,'', $title, $helpUrl); // Subheader -$linkback = '' . $langs->trans("BackToModuleList") . ''; - +$linkback = '' . $langs->trans("BackToModuleList") . ''; print load_fiche_titre($title, $linkback, 'digiriskdolibarr32px@digiriskdolibarr'); // Configuration header -$head = digiriskdolibarrAdminPrepareHead(); +$head = digiriskdolibarr_admin_prepare_head(); print dol_get_fiche_head($head, 'riskassessmentdocument', '', -1, "digiriskdolibarr@digiriskdolibarr"); -// RISKS - +// Risks print load_fiche_titre(' ' . $langs->trans('RiskConfig'), '', ''); print '
'; - print load_fiche_titre($langs->trans("DigiriskRiskNumberingModule"), '', ''); print ''; @@ -316,7 +302,7 @@ print ''; print ''; -$result = !empty($conf->mc->entities['risk']) ? strpos($conf->mc->entities['risk'], $conf->entity) : 0; +$areRisksShared = !empty($conf->mc->entities['risk']) ? strpos($conf->mc->entities['risk'], $conf->entity) : 0; print ''; print ''; print '
'; print $langs->trans('ShowSharedRisks'); @@ -325,7 +311,7 @@ print ''; -if ($conf->multicompany->enabled && !empty($conf->mc->sharings['risk']) && $result > 0) { +if (isModEnabled('multicompany') && !empty($conf->mc->sharings['risk']) && $areRisksShared > 0) { print ajax_constantonoff('DIGIRISKDOLIBARR_SHOW_SHARED_RISKS'); } else { print $langs->trans('DisabledSharedElement'); @@ -334,10 +320,8 @@ print '
'; -print '
'; - -// Risk Assessment +// Risk Assessments print load_fiche_titre(' ' . $langs->trans('RiskAssessmentConfig'), '', ''); print '
'; @@ -481,25 +465,23 @@ print ''; // Tasks - -print '
'; print load_fiche_titre(' ' . $langs->trans("TaskConfig"), '', ''); print '
'; print load_fiche_titre($langs->trans("TasksManagement"), '', ''); -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - // Project -if ( ! empty($conf->projet->enabled)) { +if (isModEnabled('project')) { + print ''; + print ''; + print ''; + print '
' . $langs->trans("Name") . '' . $langs->trans("SelectProject") . '' . $langs->trans("Action") . '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + $langs->load("projects"); print ''; -} -print '
' . $langs->trans("Name") . '' . $langs->trans("SelectProject") . '' . $langs->trans("Action") . '
'; $formproject->select_projects(0, $conf->global->DIGIRISKDOLIBARR_DU_PROJECT, 'DUProject', 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 'maxwidth500'); @@ -516,10 +498,10 @@ $formcompany->selectTypeContact($task, $conf->global->DIGIRISKDOLIBARR_DEFAULT_TASK_CONTACT_TYPE, 'task_contact_type', 'internal', 'position', 0, 'minwidth500'); print ''; print '
'; -print '
'; + print ''; + print ''; +} print load_fiche_titre($langs->trans("DigiriskTaskData"), '', ''); @@ -585,7 +567,6 @@ print ''; print ''; - print ''; print $langs->trans('ShowAllTasks'); print ""; @@ -597,9 +578,8 @@ print ''; print ''; print ''; -print '
'; -print '
'; +print ''; print ''; print ''; print ''; @@ -618,14 +598,11 @@ print '
'; print '
'; -print '
'; // Evaluators - print load_fiche_titre(' ' . $langs->trans("EvaluatorConfig"), '', ''); print '
'; - print load_fiche_titre($langs->trans("DigiriskEvaluatorNumberingModule"), '', ''); print ''; @@ -713,7 +690,7 @@ print load_fiche_titre($langs->trans("DigiriskEvaluatorData"), '', ''); -print ''; +print ''; print ''; print ''; print '
'; @@ -732,9 +709,8 @@ print '
'; print ''; -print '
'; -// Risk sign +// Risk signs print load_fiche_titre(' ' . $langs->trans("RiskSignConfig"), '', ''); print '
'; @@ -842,7 +818,7 @@ print ''; print ''; -$result = !empty($conf->mc->entities['risksign']) ? strpos($conf->mc->entities['risksign'], $conf->entity) : 0; +$areRiskSignsShared = !empty($conf->mc->entities['risksign']) ? strpos($conf->mc->entities['risksign'], $conf->entity) : 0; print ''; print $langs->trans('ShowSharedRiskSigns'); @@ -851,7 +827,7 @@ print ''; print ''; -if ($conf->multicompany->enabled && !empty($conf->mc->sharings['risksign']) && $result > 0) { +if (isModEnabled('multicompany') && !empty($conf->mc->sharings['risksign']) && $areRiskSignsShared > 0) { print ajax_constantonoff('DIGIRISKDOLIBARR_SHOW_SHARED_RISKSIGNS'); } else { print $langs->trans('DisabledSharedElement'); diff --git a/admin/securityconf.php b/admin/securityconf.php index 16b15c24e..e611134f5 100644 --- a/admin/securityconf.php +++ b/admin/securityconf.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,20 +21,14 @@ * \brief Digiriskdolibarr setup page for security data configuration. */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} global $conf, $db, $langs, $user, $hookmanager; @@ -49,14 +43,11 @@ require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; -require_once '../class/digiriskresources.class.php'; +require_once __DIR__ . '/../class/digiriskresources.class.php'; require_once __DIR__ . '/../core/tpl/digirisk_security_checks.php'; // Translations -$langs->loadLangs(array('admin', 'companies', "digiriskdolibarr@digiriskdolibarr")); - -// Access control -if ( ! $user->admin) accessforbidden(); +saturne_load_langs(["admin", "companies"]); // Parameters $action = GETPOST('action', 'aZ09'); @@ -72,6 +63,10 @@ $hookmanager->initHooks(array('admincompany', 'globaladmin')); +// Security check - Protection if external user +$permissiontoread = $user->rights->digiriskdolibarr->adminpage->read; +saturne_check_access($permissiontoread); + /* * Actions */ @@ -81,33 +76,33 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (($action == 'update' && ! GETPOST("cancel", 'alpha')) || ($action == 'updateedit')) { - $labourdoctor_id[0] = GETPOST('labourdoctor_socid', 'int') > 0 ? GETPOST('labourdoctor_socid', 'int') : 0 ; - $labourinspector_id[0] = GETPOST('labourinspector_socid', 'int') > 0 ? GETPOST('labourinspector_socid', 'int') : 0; - - $labourdoctor_socpeopleassigned = ! empty(GETPOST('labourdoctor_contactid', 'array')) ? GETPOST('labourdoctor_contactid', 'array') : (GETPOST('labourdoctor_contactid', 'int') > 0 ? array(GETPOST('labourdoctor_contactid', 'int')) : array()); - $labourinspector_socpeopleassigned = ! empty(GETPOST('labourinspector_contactid', 'array')) ? GETPOST('labourinspector_contactid', 'array') : (GETPOST('labourinspector_contactid', 'int') > 0 ? array(GETPOST('labourinspector_contactid', 'int')) : array()); - - $resources->digirisk_dolibarr_set_resources($db, $user->id, 'LabourDoctorSociety', 'societe', $labourdoctor_id, $conf->entity); - $resources->digirisk_dolibarr_set_resources($db, $user->id, 'LabourInspectorSociety', 'societe', $labourinspector_id, $conf->entity); - - $resources->digirisk_dolibarr_set_resources($db, $user->id, 'LabourDoctorContact', 'socpeople', $labourdoctor_socpeopleassigned, $conf->entity); - $resources->digirisk_dolibarr_set_resources($db, $user->id, 'LabourInspectorContact', 'socpeople', $labourinspector_socpeopleassigned, $conf->entity); - - $samu_id[0] = GETPOST('samu_socid', 'int') ? GETPOST('samu_socid', 'int') : $allLinks['SAMU']->id[0]; - $pompiers_id[0] = GETPOST('pompiers_socid', 'int') ? GETPOST('pompiers_socid', 'int') : $allLinks['Pompiers']->id[0]; - $police_id[0] = GETPOST('police_socid', 'int') ? GETPOST('police_socid', 'int') : $allLinks['Police']->id[0] ; - $touteurgence_id[0] = GETPOST('touteurgence_socid', 'int') ? GETPOST('touteurgence_socid', 'int') : $allLinks['AllEmergencies']->id[0]; - $defenseur_id[0] = GETPOST('defenseur_socid', 'int') ? GETPOST('defenseur_socid', 'int') : $allLinks['RightsDefender']->id[0] ; - $antipoison_id[0] = GETPOST('antipoison_socid', 'int') ? GETPOST('antipoison_socid', 'int') : $allLinks['PoisonControlCenter']->id[0]; - $responsible_id[0] = GETPOST('responsible_socid', 'int') ? GETPOST('responsible_socid', 'int') : $allLinks['Responsible']->id[0]; - - $resources->digirisk_dolibarr_set_resources($db, $user->id, 'SAMU', 'societe', $samu_id, $conf->entity); - $resources->digirisk_dolibarr_set_resources($db, $user->id, 'Pompiers', 'societe', $pompiers_id, $conf->entity); - $resources->digirisk_dolibarr_set_resources($db, $user->id, 'Police', 'societe', $police_id, $conf->entity); - $resources->digirisk_dolibarr_set_resources($db, $user->id, 'AllEmergencies', 'societe', $touteurgence_id, $conf->entity); - $resources->digirisk_dolibarr_set_resources($db, $user->id, 'RightsDefender', 'societe', $defenseur_id, $conf->entity); - $resources->digirisk_dolibarr_set_resources($db, $user->id, 'PoisonControlCenter', 'societe', $antipoison_id, $conf->entity); - $resources->digirisk_dolibarr_set_resources($db, $user->id, 'Responsible', 'societe', $responsible_id, $conf->entity); + $labourDoctorId[0] = GETPOST('labourdoctor_socid', 'int') > 0 ? GETPOST('labourdoctor_socid', 'int') : 0 ; + $labourInspectorId[0] = GETPOST('labourinspector_socid', 'int') > 0 ? GETPOST('labourinspector_socid', 'int') : 0; + + $labourDoctorSocpeopleAssigned = ! empty(GETPOST('labourdoctor_contactid', 'array')) ? GETPOST('labourdoctor_contactid', 'array') : (GETPOST('labourdoctor_contactid', 'int') > 0 ? array(GETPOST('labourdoctor_contactid', 'int')) : array()); + $labourInspectorSocpeopleAssigned = ! empty(GETPOST('labourinspector_contactid', 'array')) ? GETPOST('labourinspector_contactid', 'array') : (GETPOST('labourinspector_contactid', 'int') > 0 ? array(GETPOST('labourinspector_contactid', 'int')) : array()); + + $resources->digirisk_dolibarr_set_resources($db, $user->id, 'LabourDoctorSociety', 'societe', $labourDoctorId, $conf->entity); + $resources->digirisk_dolibarr_set_resources($db, $user->id, 'LabourInspectorSociety', 'societe', $labourInspectorId, $conf->entity); + + $resources->digirisk_dolibarr_set_resources($db, $user->id, 'LabourDoctorContact', 'socpeople', $labourDoctorSocpeopleAssigned, $conf->entity); + $resources->digirisk_dolibarr_set_resources($db, $user->id, 'LabourInspectorContact', 'socpeople', $labourInspectorSocpeopleAssigned, $conf->entity); + + $samuId[0] = GETPOST('samu_socid', 'int') ? GETPOST('samu_socid', 'int') : $allLinks['SAMU']->id[0]; + $pompiersId[0] = GETPOST('pompiers_socid', 'int') ? GETPOST('pompiers_socid', 'int') : $allLinks['Pompiers']->id[0]; + $policeId[0] = GETPOST('police_socid', 'int') ? GETPOST('police_socid', 'int') : $allLinks['Police']->id[0] ; + $touteUrgenceId[0] = GETPOST('touteurgence_socid', 'int') ? GETPOST('touteurgence_socid', 'int') : $allLinks['AllEmergencies']->id[0]; + $defenseurId[0] = GETPOST('defenseur_socid', 'int') ? GETPOST('defenseur_socid', 'int') : $allLinks['RightsDefender']->id[0] ; + $antipoisonId[0] = GETPOST('antipoison_socid', 'int') ? GETPOST('antipoison_socid', 'int') : $allLinks['PoisonControlCenter']->id[0]; + $responsibleId[0] = GETPOST('responsible_socid', 'int') ? GETPOST('responsible_socid', 'int') : $allLinks['Responsible']->id[0]; + + $resources->digirisk_dolibarr_set_resources($db, $user->id, 'SAMU', 'societe', $samuId, $conf->entity); + $resources->digirisk_dolibarr_set_resources($db, $user->id, 'Pompiers', 'societe', $pompiersId, $conf->entity); + $resources->digirisk_dolibarr_set_resources($db, $user->id, 'Police', 'societe', $policeId, $conf->entity); + $resources->digirisk_dolibarr_set_resources($db, $user->id, 'AllEmergencies', 'societe', $touteUrgenceId, $conf->entity); + $resources->digirisk_dolibarr_set_resources($db, $user->id, 'RightsDefender', 'societe', $defenseurId, $conf->entity); + $resources->digirisk_dolibarr_set_resources($db, $user->id, 'PoisonControlCenter', 'societe', $antipoisonId, $conf->entity); + $resources->digirisk_dolibarr_set_resources($db, $user->id, 'Responsible', 'societe', $responsibleId, $conf->entity); dolibarr_set_const($db, "DIGIRISKDOLIBARR_LOCATION_OF_DETAILED_INSTRUCTION", GETPOST("emplacementCD", 'none'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "DIGIRISKDOLIBARR_SOCIETY_DESCRIPTION", GETPOST("description", 'none'), 'chaine', 0, '', $conf->entity); @@ -130,11 +125,10 @@ $form = new Form($db); -$help_url = 'FR:Module_Digirisk#L.27onglet_S.C3.A9curit.C3.A9'; +$helpUrl = 'FR:Module_Digirisk#L.27onglet_S.C3.A9curit.C3.A9'; $title = $langs->trans("CompanyFoundation") . ' - ' . $langs->trans("Security"); -$morejs = array("/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); +saturne_header(0,'', $title, $helpUrl); $counter = 0; @@ -156,8 +150,6 @@ } -llxHeader('', $title, $help_url, '', '', '', $morejs, $morecss); - print load_fiche_titre($title, '', 'title_setup'); $head = company_admin_prepare_head(); @@ -179,7 +171,7 @@ '; -if ($conf->societe->enabled) { +if (isModEnabled('societe')) { /* *** Labour Doctor -- Médecin du travail *** */ @@ -187,16 +179,16 @@ print '' . $langs->trans("LabourDoctor") . '' . "\n"; print '' . $langs->trans("ActionOnCompany") . ''; - $labour_doctor_society = $allLinks['LabourDoctorSociety']; + $labourdDoctorSociety = $allLinks['LabourDoctorSociety']; // * Third party concerned - Tiers concerné * - if ($labour_doctor_society->ref == 'LabourDoctorSociety') { + if ($labourdDoctorSociety->ref == 'LabourDoctorSociety') { $events = array(); $events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1', 1), 'htmlname' => 'labourdoctor_contactid', 'params' => array('add-customer-contact' => 'disabled')); - $societe->fetch($labour_doctor_society->id[0]); + $societe->fetch($labourdDoctorSociety->id[0]); - print $form->select_company($labour_doctor_society->id[0], 'labourdoctor_socid', '', 'SelectThirdParty', 1, 0, $events, 0, 'minwidth300'); + print $form->select_company($labourdDoctorSociety->id[0], 'labourdoctor_socid', '', 'SelectThirdParty', 1, 0, $events, 0, 'minwidth300'); } else { $events = array(); $events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1', 1), 'htmlname' => 'labourdoctor_contactid', 'params' => array('add-customer-contact' => 'disabled')); @@ -212,18 +204,17 @@ print ''; // * Related contacts - Contacts associés * - print '' . $langs->trans("ActionOnContact") . ''; - $labour_doctor_contact = $allLinks['LabourDoctorContact']; - $labourdoctorpreselectedids = $labour_doctor_contact->id; + $labourdDoctorContact = $allLinks['LabourDoctorContact']; + $labourDoctorPreselectedIds = $labourdDoctorContact->id; - if ($labour_doctor_contact->id) { - print $form->selectcontacts(empty($labour_doctor_society->id[0]) ? -1 : $labour_doctor_society->id[0], $labour_doctor_contact->id, 'labourdoctor_contactid[]', 0, '', '', 0, 'quatrevingtpercent', false, 0, array(), false, 'multiple', 'labourdoctor_contactid'); + if ($labourdDoctorContact->id) { + print $form->selectcontacts(empty($labourdDoctorSociety->id[0]) ? -1 : $labourdDoctorSociety->id[0], $labourdDoctorContact->id, 'labourdoctor_contactid[]', 0, '', '', 0, 'quatrevingtpercent', false, 0, array(), false, 'multiple', 'labourdoctor_contactid'); } else { - $labourdoctorpreselectedids = GETPOST('labourdoctor_contactid', 'array'); - if (GETPOST('labourdoctor_contactid', 'array')) $labourdoctorpreselectedids[GETPOST('labourdoctor_contactid', 'array')] = GETPOST('labourdoctor_contactid', 'array'); - print $form->selectcontacts(empty(GETPOST('labourdoctor_socid', 'int')) ? -1 : GETPOST('labourdoctor_socid', 'int'), $labourdoctorpreselectedids, 'labourdoctor_contactid[]', 0, '', '', 0, 'quatrevingtpercent', false, 0, array(), false, 'multiple', 'labourdoctor_contactid'); + $labourDoctorPreselectedIds = GETPOST('labourdoctor_contactid', 'array'); + if (GETPOST('labourdoctor_contactid', 'array')) $labourDoctorPreselectedIds[GETPOST('labourdoctor_contactid', 'array')] = GETPOST('labourdoctor_contactid', 'array'); + print $form->selectcontacts(empty(GETPOST('labourdoctor_socid', 'int')) ? -1 : GETPOST('labourdoctor_socid', 'int'), $labourDoctorPreselectedIds, 'labourdoctor_contactid[]', 0, '', '', 0, 'quatrevingtpercent', false, 0, array(), false, 'multiple', 'labourdoctor_contactid'); } print ''; @@ -234,16 +225,16 @@ print '' . $langs->trans("LabourInspector") . '' . "\n"; print '' . $langs->trans("ActionOnCompany") . ''; - $labour_inspector_societe = $allLinks['LabourInspectorSociety']; + $labourdInspectorSociete = $allLinks['LabourInspectorSociety']; // * Third party concerned - Tiers concerné * - if ($labour_inspector_societe->ref == 'LabourInspectorSociety') { + if ($labourdInspectorSociete->ref == 'LabourInspectorSociety') { $events = array(); $events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1', 1), 'htmlname' => 'labourinspector_contactid', 'params' => array('add-customer-contact' => 'disabled')); - $societe->fetch($labour_inspector_societe->id[0]); + $societe->fetch($labourdInspectorSociete->id[0]); - print $form->select_company($labour_inspector_societe->id[0], 'labourinspector_socid', '', 0, 1, 0, $events, 0, 'minwidth300'); + print $form->select_company($labourdInspectorSociete->id[0], 'labourinspector_socid', '', 0, 1, 0, $events, 0, 'minwidth300'); } else { $events = array(); $events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1', 1), 'htmlname' => 'labourinspector_contactid', 'params' => array('add-customer-contact' => 'disabled')); @@ -261,15 +252,15 @@ print '' . $langs->trans("ActionOnContact") . ''; - $labour_inspector_contact = $allLinks['LabourInspectorContact']; - $preselectedids = $labour_inspector_contact->id; + $labourInspectorContacts = $allLinks['LabourInspectorContact']; + $labourInspectorPreselectedIds = $labourInspectorContacts->id; - if ($labour_inspector_contact->id) { - print $form->selectcontacts(empty($labour_inspector_societe->id[0]) ? -1 : $labour_inspector_societe->id[0], $labour_inspector_contact->id, 'labourinspector_contactid[]', 0, '', '', 0, 'quatrevingtpercent', false, 0, array(), false, 'multiple', 'labourinspector_contactid'); + if ($labourInspectorContacts->id) { + print $form->selectcontacts(empty($labourdInspectorSociete->id[0]) ? -1 : $labourdInspectorSociete->id[0], $labourInspectorContacts->id, 'labourinspector_contactid[]', 0, '', '', 0, 'quatrevingtpercent', false, 0, array(), false, 'multiple', 'labourinspector_contactid'); } else { - $preselectedids = GETPOST('labourinspector_contactid', 'array'); - if (GETPOST('labourinspector_contactid', 'array')) $preselectedids[GETPOST('labourinspector_contactid', 'array')] = GETPOST('labourinspector_contactid', 'array'); - print $form->selectcontacts(empty(GETPOST('labourinspector_socid', 'int')) ? -1 : GETPOST('labourinspector_socid', 'int'), $preselectedids, 'labourinspector_contactid[]', 0, '', '', 0, 'quatrevingtpercent', false, 0, array(), false, 'multiple', 'labourinspector_contactid'); + $labourInspectorPreselectedIds = GETPOST('labourinspector_contactid', 'array'); + if (GETPOST('labourinspector_contactid', 'array')) $labourInspectorPreselectedIds[GETPOST('labourinspector_contactid', 'array')] = GETPOST('labourinspector_contactid', 'array'); + print $form->selectcontacts(empty(GETPOST('labourinspector_socid', 'int')) ? -1 : GETPOST('labourinspector_socid', 'int'), $labourInspectorPreselectedIds, 'labourinspector_contactid[]', 0, '', '', 0, 'quatrevingtpercent', false, 0, array(), false, 'multiple', 'labourinspector_contactid'); } print ''; @@ -280,14 +271,14 @@ print '' . $langs->trans("SAMU") . '' . "\n"; print '' . $langs->trans("ActionOnCompany") . ''; - $samu_resources = $allLinks['SAMU']; + $samuResources = $allLinks['SAMU']; // * Third party concerned - Tiers concerné * - if ($samu_resources->ref == 'SAMU') { - $societe->fetch($samu_resources->id[0]); + if ($samuResources->ref == 'SAMU') { + $societe->fetch($samuResources->id[0]); - print $form->select_company($samu_resources->id[0], 'samu_socid', '', 'SelectThirdParty', 1, 0, 0, 0, 'minwidth300'); + print $form->select_company($samuResources->id[0], 'samu_socid', '', 'SelectThirdParty', 1, 0, 0, 0, 'minwidth300'); } else { //For external user force the company to user company if ( ! empty($user->socid)) { @@ -306,13 +297,13 @@ print '' . $langs->trans("FireBrigade") . '' . "\n"; print '' . $langs->trans("ActionOnCompany") . ''; - $pompiers_resources = $allLinks['Pompiers']; + $pompiersResources = $allLinks['Pompiers']; // * Third party concerned - Tiers concerné * - if ($pompiers_resources->ref == 'Pompiers') { - $societe->fetch($pompiers_resources->id[0]); - print $form->select_company($pompiers_resources->id[0], 'pompiers_socid', '', 'SelectThirdParty', 1, 0, 0, 0, 'minwidth300'); + if ($pompiersResources->ref == 'Pompiers') { + $societe->fetch($pompiersResources->id[0]); + print $form->select_company($pompiersResources->id[0], 'pompiers_socid', '', 'SelectThirdParty', 1, 0, 0, 0, 'minwidth300'); } else { //For external user force the company to user company if ( ! empty($user->socid)) { @@ -331,13 +322,13 @@ print '' . $langs->trans("Police") . '' . "\n"; print '' . $langs->trans("ActionOnCompany") . ''; - $police_resources = $allLinks['Police']; + $policeResources = $allLinks['Police']; // * Third party concerned - Tiers concerné * - if ($police_resources->ref == 'Police') { - $societe->fetch($police_resources->id[0]); - print $form->select_company($police_resources->id[0], 'police_socid', '', 'SelectThirdParty', 1, 0, 0, 0, 'minwidth300'); + if ($policeResources->ref == 'Police') { + $societe->fetch($policeResources->id[0]); + print $form->select_company($policeResources->id[0], 'police_socid', '', 'SelectThirdParty', 1, 0, 0, 0, 'minwidth300'); } else { //For external user force the company to user company if ( ! empty($user->socid)) { @@ -356,13 +347,13 @@ print '' . $langs->trans("AllEmergencies") . '' . "\n"; print '' . $langs->trans("ActionOnCompany") . ''; - $touteurgence_resources = $allLinks['AllEmergencies']; + $touteUrgenceResources = $allLinks['AllEmergencies']; // * Third party concerned - Tiers concerné * - if ($touteurgence_resources->ref == 'AllEmergencies') { - $societe->fetch($touteurgence_resources->id[0]); - print $form->select_company($touteurgence_resources->id[0], 'touteurgence_socid', '', 'SelectThirdParty', 1, 0, 0, 0, 'minwidth300'); + if ($touteUrgenceResources->ref == 'AllEmergencies') { + $societe->fetch($touteUrgenceResources->id[0]); + print $form->select_company($touteUrgenceResources->id[0], 'touteurgence_socid', '', 'SelectThirdParty', 1, 0, 0, 0, 'minwidth300'); } else { //For external user force the company to user company if ( ! empty($user->socid)) { @@ -381,13 +372,13 @@ print '' . $langs->trans("RightsDefender") . '' . "\n"; print '' . $langs->trans("ActionOnCompany") . ''; - $defenseur_resources = $allLinks['RightsDefender']; + $defenseurResources = $allLinks['RightsDefender']; // * Third party concerned - Tiers concerné * - if ($defenseur_resources->ref == 'RightsDefender') { - $societe->fetch($defenseur_resources->id[0]); - print $form->select_company($defenseur_resources->id[0], 'defenseur_socid', '', 'SelectThirdParty', 1, 0, 0, 0, 'minwidth300'); + if ($defenseurResources->ref == 'RightsDefender') { + $societe->fetch($defenseurResources->id[0]); + print $form->select_company($defenseurResources->id[0], 'defenseur_socid', '', 'SelectThirdParty', 1, 0, 0, 0, 'minwidth300'); } else { //For external user force the company to user company if ( ! empty($user->socid)) { @@ -406,13 +397,13 @@ print '' . $langs->trans("PoisonControlCenter") . '' . "\n"; print '' . $langs->trans("ActionOnCompany") . ''; - $poison_control_center_resources = $allLinks['PoisonControlCenter']; + $poisonControlCenterResources = $allLinks['PoisonControlCenter']; // * Third party concerned - Tiers concerné * - if ($poison_control_center_resources->ref == 'PoisonControlCenter') { - $societe->fetch($poison_control_center_resources->id[0]); - print $form->select_company($poison_control_center_resources->id[0], 'antipoison_socid', '', 'SelectThirdParty', 1, 0, 0, 0, 'minwidth300'); + if ($poisonControlCenterResources->ref == 'PoisonControlCenter') { + $societe->fetch($poisonControlCenterResources->id[0]); + print $form->select_company($poisonControlCenterResources->id[0], 'antipoison_socid', '', 'SelectThirdParty', 1, 0, 0, 0, 'minwidth300'); } else { //For external user force the company to user company if ( ! empty($user->socid)) { @@ -433,12 +424,12 @@ // * Responsible to notify - Responsable à prévenir * -$responsible_resources = $allLinks['Responsible']; +$responsibleResources = $allLinks['Responsible']; // * Third party concerned - Tiers concerné * -if ($responsible_resources->ref == 'Responsible' && $responsible_resources->id[0] > 0) { - $usertmp->fetch($responsible_resources->id[0]); +if ($responsibleResources->ref == 'Responsible' && $responsibleResources->id[0] > 0) { + $usertmp->fetch($responsibleResources->id[0]); $userlist = $form->select_dolusers(GETPOST('responsible_socid'), '', 0, null, 0, '', '', 0, 0, 0, 'AND u.statut = 1', 0, '', 'minwidth300', 0, 1); print ''; diff --git a/admin/setup.php b/admin/setup.php index 33e1dca6a..be3149c9a 100644 --- a/admin/setup.php +++ b/admin/setup.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,53 +21,42 @@ * \brief Digiriskdolibarr setup page. */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} global $conf, $db, $langs, $user; -$projectRefClass = $conf->global->PROJECT_ADDON; - // Libraries require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php"; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/modules/project/' . $projectRefClass . '.php'; -require_once '../lib/digiriskdolibarr.lib.php'; +require_once __DIR__ . '/../lib/digiriskdolibarr.lib.php'; require_once __DIR__ . '/../core/tpl/digirisk_security_checks.php'; // Translations -$langs->loadLangs(array("admin", "digiriskdolibarr@digiriskdolibarr")); +saturne_load_langs(["admin"]); // Initialize technical objects $project = new Project($db); $third_party = new Societe($db); -$projectRef = new $projectRefClass(); +$form = new Form($db); // Parameters $action = GETPOST('action', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $value = GETPOST('value', 'alpha'); -// Access control -if ( ! $user->admin) accessforbidden(); - -// Parameters -$backtopage = GETPOST('backtopage', 'alpha'); +// Security check - Protection if external user +$permissiontoread = $user->rights->digiriskdolibarr->adminpage->read; +saturne_check_access($permissiontoread); /* * Actions @@ -76,27 +65,38 @@ require_once '../core/tpl/digiriskdolibarr_projectcreation_action.tpl.php'; if ($action == 'setredirectafterconnection') { - $constforval = 'DIGIRISKDOLIBARR_REDIRECT_AFTER_CONNECTION'; - dolibarr_set_const($db, $constforval, $value, 'integer', 0, '', $conf->entity); + $constForVal = 'DIGIRISKDOLIBARR_REDIRECT_AFTER_CONNECTION'; + dolibarr_set_const($db, $constForVal, $value, 'integer', 0, '', $conf->entity); } -if ($action == 'setMediaDimension') { - $MediaMaxWidthMedium = GETPOST('MediaMaxWidthMedium', 'alpha'); - $MediaMaxHeightMedium = GETPOST('MediaMaxHeightMedium', 'alpha'); - $MediaMaxWidthLarge = GETPOST('MediaMaxWidthLarge', 'alpha'); - $MediaMaxHeightLarge = GETPOST('MediaMaxHeightLarge', 'alpha'); - - if (!empty($MediaMaxWidthMedium) || $MediaMaxWidthMedium === '0') { - dolibarr_set_const($db, "DIGIRISKDOLIBARR_MEDIA_MAX_WIDTH_MEDIUM", $MediaMaxWidthMedium, 'integer', 0, '', $conf->entity); - } - if (!empty($MediaMaxHeightMedium) || $MediaMaxHeightMedium === '0') { - dolibarr_set_const($db, "DIGIRISKDOLIBARR_MEDIA_MAX_HEIGHT_MEDIUM", $MediaMaxHeightMedium, 'integer', 0, '', $conf->entity); - } - if (!empty($MediaMaxWidthLarge) || $MediaMaxWidthLarge === '0') { - dolibarr_set_const($db, "DIGIRISKDOLIBARR_MEDIA_MAX_WIDTH_LARGE", $MediaMaxWidthLarge, 'integer', 0, '', $conf->entity); +if ($action == 'setMediaInfos') { + $error = 0; + $mediasMax['DIGIRISKDOLIBARR_MEDIA_MAX_WIDTH_MINI'] = GETPOST('MediaMaxWidthMini', 'alpha'); + $mediasMax['DIGIRISKDOLIBARR_MEDIA_MAX_HEIGHT_MINI'] = GETPOST('MediaMaxHeightMini', 'alpha'); + $mediasMax['DIGIRISKDOLIBARR_MEDIA_MAX_WIDTH_SMALL'] = GETPOST('MediaMaxWidthSmall', 'alpha'); + $mediasMax['DIGIRISKDOLIBARR_MEDIA_MAX_HEIGHT_SMALL'] = GETPOST('MediaMaxHeightSmall', 'alpha'); + $mediasMax['DIGIRISKDOLIBARR_MEDIA_MAX_WIDTH_MEDIUM'] = GETPOST('MediaMaxWidthMedium', 'alpha'); + $mediasMax['DIGIRISKDOLIBARR_MEDIA_MAX_HEIGHT_MEDIUM'] = GETPOST('MediaMaxHeightMedium', 'alpha'); + $mediasMax['DIGIRISKDOLIBARR_MEDIA_MAX_WIDTH_LARGE'] = GETPOST('MediaMaxWidthLarge', 'alpha'); + $mediasMax['DIGIRISKDOLIBARR_MEDIA_MAX_HEIGHT_LARGE'] = GETPOST('MediaMaxHeightLarge', 'alpha'); + $mediasMax['DIGIRISKDOLIBARR_DISPLAY_NUMBER_MEDIA_GALLERY'] = GETPOST('DisplayNumberMediaGallery', 'alpha'); + + foreach($mediasMax as $constName => $valueMax) { + if (empty($valueMax)) { + setEventMessages('MediaDimensionEmptyError', [], 'errors'); + $error++; + break; + } else if ($valueMax < 0) { + setEventMessages('MediaDimensionNegativeError', [], 'errors'); + $error++; + break; + } else { + dolibarr_set_const($db, $constName, $valueMax, 'integer', 0, '', $conf->entity); + } } - if (!empty($MediaMaxHeightLarge) || $MediaMaxHeightLarge === '0') { - dolibarr_set_const($db, "DIGIRISKDOLIBARR_MEDIA_MAX_HEIGHT_LARGE", $MediaMaxHeightLarge, 'integer', 0, '', $conf->entity); + + if (empty($error)) { + setEventMessages('MediaDimensionSetWithSuccess', []); } } @@ -104,21 +104,18 @@ * View */ -$page_name = "DigiriskdolibarrSetup"; -$help_url = 'FR:Module_Digirisk#Configuration'; - -$morejs = array("/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); +$title = $langs->trans("DigiriskdolibarrSetup"); +$helpUrl = 'FR:Module_Digirisk#Configuration'; -llxHeader('', $langs->trans($page_name), $help_url, '', '', '', $morejs, $morecss); +saturne_header(0,'', $title, $helpUrl); // Subheader -$linkback = '' . $langs->trans("BackToModuleList") . ''; +$linkback = '' . $langs->trans("BackToModuleList") . ''; -print load_fiche_titre($langs->trans($page_name), $linkback, 'digiriskdolibarr32px@digiriskdolibarr'); +print load_fiche_titre($langs->trans($title), $linkback, 'digiriskdolibarr32px@digiriskdolibarr'); // Configuration header -$head = digiriskdolibarrAdminPrepareHead(); +$head = digiriskdolibarr_admin_prepare_head(); print dol_get_fiche_head($head, 'settings', '', -1, "digiriskdolibarr@digiriskdolibarr"); print '

' . ' ' . $langs->trans("AgendaModuleRequired") . '
'; @@ -198,42 +195,63 @@ print load_fiche_titre($langs->trans("MediaData"), '', ''); -print '
'; +print ''; print ''; -print ''; +print ''; print ''; print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; print ''; -print ''; + +print ''; +print ''; +print ''; print ''; print '
' . $langs->trans("Name") . '' . $langs->trans("Description") . '' . $langs->trans("Value") . '' . $langs->trans("Action") . '' . $langs->trans('Name') . '' . $langs->trans('Description') . '' . $langs->trans('Value') . '
' . $langs->trans("MediaMaxWidthMediumDescription") . '
' . $langs->trans('MediaMaxWidthMiniDescription') . '
' . $langs->trans('MediaMaxHeightMiniDescription') . '
' . $langs->trans('MediaMaxWidthSmallDescription') . '
' . $langs->trans('MediaMaxHeightSmallDescription') . '
' . $langs->trans('MediaMaxWidthMediumDescription') . ''; print '
' . $langs->trans("MediaMaxHeightMediumDescription") . '
' . $langs->trans('MediaMaxHeightMediumDescription') . ''; print '
' . $langs->trans("MediaMaxWidthLargeDescription") . '
' . $langs->trans('MediaMaxWidthLargeDescription') . ''; print '
' . $langs->trans("MediaMaxHeightLargeDescription") . '
' . $langs->trans('MediaMaxHeightLargeDescription') . ''; +print '
' . $langs->trans('DisplayNumberMediaGalleryDescription') . '
'; +print $form->buttonsSaveCancel('Save', ''); print '
'; // Page end diff --git a/admin/socialconf.php b/admin/socialconf.php index 580f345ed..9278bee59 100644 --- a/admin/socialconf.php +++ b/admin/socialconf.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,20 +21,14 @@ * \brief Digiriskdolibarr setup page for social data configuration. */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} global $conf, $db, $langs, $user, $hookmanager; @@ -47,14 +41,11 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; -require_once '../class/digiriskresources.class.php'; +require_once __DIR__ . '/../class/digiriskresources.class.php'; require_once __DIR__ . '/../core/tpl/digirisk_security_checks.php'; // Translations -$langs->loadLangs(array('admin', 'companies', "digiriskdolibarr@digiriskdolibarr")); - -// Access control -if ( ! $user->admin) accessforbidden(); +saturne_load_langs(["admin", "companies"]); // Parameters $action = GETPOST('action', 'aZ09'); @@ -67,9 +58,9 @@ $hookmanager->initHooks(array('admincompany', 'globaladmin')); -$electionDateCSE = dol_mktime(0, 0, 0, GETPOST('date_debutmonth', 'int'), GETPOST('date_debutday', 'int'), GETPOST('date_debutyear', 'int')); -$electionDateDP = dol_mktime(0, 0, 0, GETPOST('date_finmonth', 'int'), GETPOST('date_finday', 'int'), GETPOST('date_finyear', 'int')); -$date = dol_mktime(0, 0, 0, GETPOST('datemonth', 'int'), GETPOST('dateday', 'int'), GETPOST('dateyear', 'int')); +// Security check - Protection if external user +$permissiontoread = $user->rights->digiriskdolibarr->adminpage->read; +saturne_check_access($permissiontoread); /* * Actions @@ -105,11 +96,11 @@ $resources->digirisk_dolibarr_set_resources($db, $user->id, 'TitularsDP', 'societe', $TitularsDP, $conf->entity); $resources->digirisk_dolibarr_set_resources($db, $user->id, 'AlternatesDP', 'societe', $AlternatesDP, $conf->entity); - $HarassmentOfficer = GETPOST('HarassmentOfficer', 'int'); - $HarassmentOfficerCSE = GETPOST('HarassmentOfficerCSE', 'int'); + $harassmentOfficer = GETPOST('HarassmentOfficer', 'int'); + $harassmentOfficerCSE = GETPOST('HarassmentOfficerCSE', 'int'); - $resources->digirisk_dolibarr_set_resources($db, $user->id, 'HarassmentOfficer', 'user', array($HarassmentOfficer), $conf->entity); - $resources->digirisk_dolibarr_set_resources($db, $user->id, 'HarassmentOfficerCSE', 'user', array($HarassmentOfficerCSE), $conf->entity); + $resources->digirisk_dolibarr_set_resources($db, $user->id, 'HarassmentOfficer', 'user', array($harassmentOfficer), $conf->entity); + $resources->digirisk_dolibarr_set_resources($db, $user->id, 'HarassmentOfficerCSE', 'user', array($harassmentOfficerCSE), $conf->entity); if ($action != 'updateedit' && ! $error) { header("Location: " . $_SERVER["PHP_SELF"]); @@ -217,11 +208,11 @@ */ print '' . $langs->trans("HarassmentOfficer") . '' . $langs->trans("") . '' . "\n"; -$HarassmentOfficer = $allLinks['HarassmentOfficer']; +$harassmentOfficer = $allLinks['HarassmentOfficer']; print ''; print '' . $langs->trans("ActionOnUser") . ''; print ''; -print $form->select_dolusers($HarassmentOfficer->id, 'HarassmentOfficer', 1, null, 0, '', '', $conf->entity, 0, 0, 'AND u.statut = 1', 0, '', 'minwidth300'); +print $form->select_dolusers($harassmentOfficer->id, 'HarassmentOfficer', 1, null, 0, '', '', $conf->entity, 0, 0, 'AND u.statut = 1', 0, '', 'minwidth300'); if ( ! GETPOSTISSET('backtopage')) print ' '; print ''; @@ -230,11 +221,11 @@ */ print '' . $langs->trans("HarassmentOfficerCSE") . '' . $langs->trans("") . '' . "\n"; -$HarassmentOfficerCSE = $allLinks['HarassmentOfficerCSE']; +$harassmentOfficerCSE = $allLinks['HarassmentOfficerCSE']; print ''; print '' . $langs->trans("ActionOnUser") . ''; print ''; -print $form->select_dolusers($HarassmentOfficerCSE->id, 'HarassmentOfficerCSE', 1, null, 0, '', '', $conf->entity, 0, 0, 'AND u.statut = 1', 0, '', 'minwidth300'); +print $form->select_dolusers($harassmentOfficerCSE->id, 'HarassmentOfficerCSE', 1, null, 0, '', '', $conf->entity, 0, 0, 'AND u.statut = 1', 0, '', 'minwidth300'); if ( ! GETPOSTISSET('backtopage')) print ' '; print ''; @@ -253,14 +244,14 @@ // * ESC Titulars - Titulaires CSE * $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', $conf->entity, 0, 0, 'AND u.statut = 1', 0, '', '', 0, 1); -$titulars_cse = $allLinks['TitularsCSE']; +$titularsCse = $allLinks['TitularsCSE']; print ''; print '' . $form->editfieldkey('Titulars', 'TitularsCSE_id', '', $object, 0) . ''; print ''; -print $form->multiselectarray('TitularsCSE', $userlist, $titulars_cse->id, null, null, null, null, "300"); +print $form->multiselectarray('TitularsCSE', $userlist, $titularsCse->id, null, null, null, null, "300"); if ( ! GETPOSTISSET('backtopage')) print ' '; @@ -269,13 +260,13 @@ // * ESC Alternates - Suppléants CSE * $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', $conf->entity, 0, 0, 'AND u.statut = 1', 0, '', '', 0, 1); -$alternates_cse = $allLinks['AlternatesCSE']; +$alternatesCse = $allLinks['AlternatesCSE']; print ''; print '' . $form->editfieldkey('Alternates', 'AlternatesCSE_id', '', $object, 0) . ''; print ''; -print $form->multiselectarray('AlternatesCSE', $userlist, $alternates_cse->id, null, null, null, null, "300"); +print $form->multiselectarray('AlternatesCSE', $userlist, $alternatesCse->id, null, null, null, null, "300"); if ( ! GETPOSTISSET('backtopage')) print ' '; @@ -294,13 +285,13 @@ // * Staff Representatives Titulars - Titulaires Délégués du Personnel * $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', $conf->entity, 0, 0, 'AND u.statut = 1', 0, '', '', 0, 1); -$titulars_dp = $allLinks['TitularsDP']; +$titularsDp = $allLinks['TitularsDP']; print ''; print '' . $form->editfieldkey('Titulars', 'TitularsDP_id', '', $object, 0) . ''; print ''; -print $form->multiselectarray('TitularsDP', $userlist, $titulars_dp->id, null, null, null, null, "300"); +print $form->multiselectarray('TitularsDP', $userlist, $titularsDp->id, null, null, null, null, "300"); if ( ! GETPOSTISSET('backtopage')) print ' '; @@ -309,13 +300,13 @@ // * Staff Representatives Suppléants - Suppléants Délégués du Personnel * $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', $conf->entity, 0, 0, 'AND u.statut = 1', 0, '', '', 0, 1); -$alternates_dp = $allLinks['AlternatesDP']; +$alternatesDp = $allLinks['AlternatesDP']; print ''; print '' . $form->editfieldkey('Alternates', 'AlternatesDP', '', $object, 0) . ''; print ''; -print $form->multiselectarray('AlternatesDP', $userlist, $alternates_dp->id, null, null, null, null, "300"); +print $form->multiselectarray('AlternatesDP', $userlist, $alternatesDp->id, null, null, null, null, "300"); if ( ! GETPOSTISSET('backtopage')) print ' '; diff --git a/admin/ticket/ticket.php b/admin/ticket/ticket.php index f2dd1fb15..4b2170223 100644 --- a/admin/ticket/ticket.php +++ b/admin/ticket/ticket.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,20 +21,14 @@ * \brief Page to public interface of module DigiriskDolibarr for ticket */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} global $conf, $db, $langs, $user; @@ -49,26 +43,26 @@ require_once DOL_DOCUMENT_ROOT . "/core/class/html.formprojet.class.php"; require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; -require_once '../../lib/digiriskdolibarr.lib.php'; -require_once '../../lib/digiriskdolibarr_ticket.lib.php'; -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; +require_once __DIR__ . '/../../lib/digiriskdolibarr.lib.php'; +require_once __DIR__ . '/../../lib/digiriskdolibarr_ticket.lib.php'; // Translations -$langs->loadLangs(array("admin", "digiriskdolibarr@digiriskdolibarr")); +saturne_load_langs(["admin"]); // Initialize technical objects $extra_fields = new ExtraFields($db); $category = new Categorie($db); $ticket = new Ticket($db); -// Access control -if ( ! $user->admin) accessforbidden(); - // Parameters $action = GETPOST('action', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $value = GETPOST('value', 'alpha'); +// Security check - Protection if external user +$permissiontoread = $user->rights->digiriskdolibarr->adminpage->read; +saturne_check_access($permissiontoread); + /* * Actions */ @@ -92,13 +86,6 @@ setEventMessages($langs->transnoentities('TicketPublicInterfaceEnabled'), array()); } -if ($action == 'setMultiEntitySelector') { - if (GETPOST('value')) dolibarr_set_const($db, 'DIGIRISKDOLIBARR_SHOW_MULTI_ENTITY_SELECTOR_ON_TICKET_PUBLIC_INTERFACE', 1, 'integer', 0, '', 0); - else dolibarr_set_const($db, 'DIGIRISKDOLIBARR_SHOW_MULTI_ENTITY_SELECTOR_ON_TICKET_PUBLIC_INTERFACE', 0, 'integer', 0, '', 0); -// setEventMessages($langs->transnoentities('TicketPublicInterfaceEnabled'), array()); -} - - if ($action == 'setEmails') { dolibarr_set_const($db, 'DIGIRISKDOLIBARR_TICKET_SUBMITTED_SEND_MAIL_TO', GETPOST('emails'), 'integer', 0, '', $conf->entity); setEventMessages($langs->transnoentities('EmailsToNotifySet'), array()); @@ -118,10 +105,11 @@ } dolibarr_set_const($db, 'DIGIRISKDOLIBARR_TICKET_EXTRAFIELDS', 1, 'integer', 0, '', 0); } -$upload_dir = $conf->categorie->multidir_output[$conf->entity?:1]; -global $maxwidthmini, $maxheightmini, $maxwidthsmall, $maxheightsmall; if ($action == 'generateCategories') { + global $maxwidthmini, $maxheightmini, $maxwidthsmall, $maxheightsmall; + + $upload_dir = $conf->categorie->multidir_output[$conf->entity?:1]; $result = createTicketCategory($langs->transnoentities('Register'), '', '', 1, 'ticket'); dolibarr_set_const($db, 'DIGIRISKDOLIBARR_TICKET_MAIN_CATEGORY', $result, 'integer', 0, '', $conf->entity); @@ -233,15 +221,16 @@ * View */ -if ( ! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } +if (isModEnabled('project')) { + $formproject = new FormProjets($db); +} $form = new Form($db); $formother = new FormOther($db); -$help_url = 'FR:Module_Digirisk'; +$helpUrl = 'FR:Module_Digirisk'; $title = $langs->transnoentities("Ticket"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); -llxHeader('', $title, $help_url, '', '', '', '', $morecss); +saturne_header(0,'', $title, $helpUrl); // Subheader $linkback = '' . $langs->transnoentities("BackToModuleList") . ''; @@ -249,7 +238,7 @@ print load_fiche_titre($title, $linkback, 'digiriskdolibarr32px@digiriskdolibarr'); // Configuration header -$head = digiriskdolibarrAdminPrepareHead(); +$head = digiriskdolibarr_admin_prepare_head(); print dol_get_fiche_head($head, 'ticket', '', -1, "digiriskdolibarr@digiriskdolibarr"); print load_fiche_titre(' ' . $langs->transnoentities("TicketManagement"), '', ''); @@ -258,7 +247,7 @@ print '' . $langs->transnoentities("DigiriskTicketPublicAccess") . ' : ' . dol_buildpath('/custom/digiriskdolibarr/public/ticket/create_ticket.php?entity=' . $conf->entity, 2) . ''; -if ($conf->multicompany->enabled) { +if (isModEnabled('multicompany')) { print load_fiche_titre($langs->transnoentities("MultiEntityPublicInterface"), '', ''); print '' . $langs->transnoentities("DigiriskTicketPublicAccess") . ' : ' . dol_buildpath('/custom/digiriskdolibarr/public/ticket/create_ticket.php', 2) . ''; @@ -266,23 +255,23 @@ print dol_get_fiche_end(); -$enabledisablehtml = $langs->transnoentities("TicketActivatePublicInterface") . ' '; +$enableDisableHtml = $langs->transnoentities("TicketActivatePublicInterface") . ' '; if (empty($conf->global->DIGIRISKDOLIBARR_TICKET_ENABLE_PUBLIC_INTERFACE)) { // Button off, click to enable - $enabledisablehtml .= ''; - $enabledisablehtml .= img_picto($langs->transnoentities("Disabled"), 'switch_off'); + $enableDisableHtml .= ''; + $enableDisableHtml .= img_picto($langs->transnoentities("Disabled"), 'switch_off'); } else { // Button on, click to disable - $enabledisablehtml .= ''; - $enabledisablehtml .= img_picto($langs->transnoentities("Activated"), 'switch_on'); + $enableDisableHtml .= ''; + $enableDisableHtml .= img_picto($langs->transnoentities("Activated"), 'switch_on'); } -$enabledisablehtml .= ''; -print $enabledisablehtml; +$enableDisableHtml .= ''; +print $enableDisableHtml; print ''; print '

'; -if ( ! empty($conf->global->DIGIRISKDOLIBARR_TICKET_ENABLE_PUBLIC_INTERFACE)) { +if ($conf->global->DIGIRISKDOLIBARR_TICKET_ENABLE_PUBLIC_INTERFACE == 1) { print '
'; print ''; print ''; @@ -318,19 +307,11 @@ print ''; print ''; - if ($conf->multicompany->enabled) { + if (isModEnabled('multicompany')) { //Page de sélection de l'entité print ''; print ''; print ''; } - //Envoi d'emails automatiques + //Envoi d'emails automatique print ''; print '
' . $langs->transnoentities("ShowSelectorOnTicketPublicInterface") . ''; - if (empty($conf->global->DIGIRISKDOLIBARR_SHOW_MULTI_ENTITY_SELECTOR_ON_TICKET_PUBLIC_INTERFACE)) { - // Button off, click to enable - print ''; - print img_picto($langs->transnoentities("Disabled"), 'switch_off'); - } else { - // Button on, click to disable - print ''; - print img_picto($langs->transnoentities("Activated"), 'switch_on'); - } + print ajax_constantonoff('DIGIRISKDOLIBARR_SHOW_MULTI_ENTITY_SELECTOR_ON_TICKET_PUBLIC_INTERFACE'); print ''; print ''; @@ -342,7 +323,7 @@ print '
' . $langs->transnoentities("SendEmailOnTicketSubmit") . ''; print ajax_constantonoff('DIGIRISKDOLIBARR_SEND_EMAIL_ON_TICKET_SUBMIT'); @@ -532,29 +513,29 @@ print ''; // Project - print load_fiche_titre($langs->transnoentities("LinkedProject"), '', ''); + if (isModEnabled('project')) { + print load_fiche_titre($langs->transnoentities("LinkedProject"), '', ''); - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print '
' . $langs->transnoentities("Name") . '' . $langs->transnoentities("SelectProject") . '' . $langs->transnoentities("Action") . '
'; + print ''; + print ''; + print ''; + print ''; + print ''; - if ( ! empty($conf->projet->enabled)) { $langs->load("projects"); print ''; - } - print '
' . $langs->transnoentities("Name") . '' . $langs->transnoentities("SelectProject") . '' . $langs->transnoentities("Action") . '
'; $numprojet = $formproject->select_projects(0, $conf->global->DIGIRISKDOLIBARR_TICKET_PROJECT, 'TSProject', 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 'maxwidth500'); print ' '; print ''; print '
'; - print '
'; + print '
'; + print ''; + } print load_fiche_titre($langs->transnoentities("TicketCategories"), '', '', 0, 'TicketCategories'); @@ -630,7 +611,6 @@ print ''; //Set child category label - print '
'; print ''; print ''; @@ -717,7 +697,7 @@ print '' . $langs->transnoentities("GenerateQRCode") . ''; - $targetPath = $qrCodePath; + $targetPath = $qrCodePath; $urlToEncode = DOL_MAIN_URL_ROOT . '/custom/digiriskdolibarr/public/ticket/create_ticket.php?entity=' . $conf->entity; print ''; @@ -742,7 +722,7 @@ print ''; print '
'; - if ($conf->multicompany->enabled) { + if (isModEnabled('multicompany')) { // Multi Entity QR Code generation print load_fiche_titre($langs->transnoentities("MultiCompanyQRCodeGeneration"), '', ''); diff --git a/class/accident.class.php b/class/accident.class.php index eac0c8e73..0f5585de7 100644 --- a/class/accident.class.php +++ b/class/accident.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/actions_digiriskdolibarr.class.php b/class/actions_digiriskdolibarr.class.php index a25d33e6a..bce6ff659 100644 --- a/class/actions_digiriskdolibarr.class.php +++ b/class/actions_digiriskdolibarr.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/api_digiriskdolibarr.class.php b/class/api_digiriskdolibarr.class.php index 9d84ad6ec..71aa056a2 100644 --- a/class/api_digiriskdolibarr.class.php +++ b/class/api_digiriskdolibarr.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/dashboarddigiriskstats.class.php b/class/dashboarddigiriskstats.class.php index 5e211d7b8..4f351ffa2 100644 --- a/class/dashboarddigiriskstats.class.php +++ b/class/dashboarddigiriskstats.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2022 EOXIA * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/digiriskdocuments.class.php b/class/digiriskdocuments.class.php index 9387b7b20..2ccd361c9 100644 --- a/class/digiriskdocuments.class.php +++ b/class/digiriskdocuments.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/digiriskdolibarrdocuments/informationssharing.class.php b/class/digiriskdolibarrdocuments/informationssharing.class.php index c2f152f17..1e0b14dc0 100644 --- a/class/digiriskdolibarrdocuments/informationssharing.class.php +++ b/class/digiriskdolibarrdocuments/informationssharing.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/digiriskdolibarrdocuments/legaldisplay.class.php b/class/digiriskdolibarrdocuments/legaldisplay.class.php index 677e22d9a..0a63818bc 100644 --- a/class/digiriskdolibarrdocuments/legaldisplay.class.php +++ b/class/digiriskdolibarrdocuments/legaldisplay.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/digiriskdolibarrdocuments/preventionplandocument.class.php b/class/digiriskdolibarrdocuments/preventionplandocument.class.php index 0311a1aea..a118f4eab 100644 --- a/class/digiriskdolibarrdocuments/preventionplandocument.class.php +++ b/class/digiriskdolibarrdocuments/preventionplandocument.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/digiriskdolibarrdocuments/riskassessmentdocument.class.php b/class/digiriskdolibarrdocuments/riskassessmentdocument.class.php index 17b778104..084babdf5 100644 --- a/class/digiriskdolibarrdocuments/riskassessmentdocument.class.php +++ b/class/digiriskdolibarrdocuments/riskassessmentdocument.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/digiriskelement.class.php b/class/digiriskelement.class.php index d7bad47f6..5e6adcc26 100644 --- a/class/digiriskelement.class.php +++ b/class/digiriskelement.class.php @@ -53,7 +53,7 @@ class DigiriskElement extends SaturneObject * @var int Does this object support multicompany module ? * 0 = No test on entity, 1 = Test with field entity, 'field@table' = Test with link by field@table. */ - public int $ismultientitymanaged = 1; + public $ismultientitymanaged = 1; /** * @var int Does object support extrafields ? 0 = No, 1 = Yes. diff --git a/class/digiriskelement/groupment.class.php b/class/digiriskelement/groupment.class.php index 8a387e37c..765324445 100644 --- a/class/digiriskelement/groupment.class.php +++ b/class/digiriskelement/groupment.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/digiriskelement/workunit.class.php b/class/digiriskelement/workunit.class.php index 69ff13884..22bb5e007 100644 --- a/class/digiriskelement/workunit.class.php +++ b/class/digiriskelement/workunit.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/digiriskresources.class.php b/class/digiriskresources.class.php index 5f009fa5b..9476252c9 100644 --- a/class/digiriskresources.class.php +++ b/class/digiriskresources.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/digirisksignature.class.php b/class/digirisksignature.class.php index 6b669d743..2af49d0ab 100644 --- a/class/digirisksignature.class.php +++ b/class/digirisksignature.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/digiriskstandard.class.php b/class/digiriskstandard.class.php index 05fcdd239..9202baf7e 100644 --- a/class/digiriskstandard.class.php +++ b/class/digiriskstandard.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/digiriskstats.php b/class/digiriskstats.php index 3a7e8b855..ef6492d30 100644 --- a/class/digiriskstats.php +++ b/class/digiriskstats.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2022 EOXIA * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/digirisktask.class.php b/class/digirisktask.class.php index 746a0c38f..b8f51c5bc 100644 --- a/class/digirisktask.class.php +++ b/class/digirisktask.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2022 EOXIA * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/evaluator.class.php b/class/evaluator.class.php index 6e5b6bf78..778025d83 100644 --- a/class/evaluator.class.php +++ b/class/evaluator.class.php @@ -50,7 +50,7 @@ class Evaluator extends SaturneObject * @var int Does this object support multicompany module ? * 0 = No test on entity, 1 = Test with field entity, 'field@table' = Test with link by field@table. */ - public int $ismultientitymanaged = 1; + public $ismultientitymanaged = 1; /** * @var int Does object support extrafields ? 0 = No, 1 = Yes. diff --git a/class/openinghours.class.php b/class/openinghours.class.php index 93728832e..af21d933d 100644 --- a/class/openinghours.class.php +++ b/class/openinghours.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/preventionplan.class.php b/class/preventionplan.class.php index 845c04c30..02d66aaaf 100644 --- a/class/preventionplan.class.php +++ b/class/preventionplan.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/riskanalysis/risk.class.php b/class/riskanalysis/risk.class.php index 32f3f6214..8a3d694f9 100644 --- a/class/riskanalysis/risk.class.php +++ b/class/riskanalysis/risk.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/riskanalysis/riskassessment.class.php b/class/riskanalysis/riskassessment.class.php index 1b81492fc..f796eee04 100644 --- a/class/riskanalysis/riskassessment.class.php +++ b/class/riskanalysis/riskassessment.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/riskanalysis/risksign.class.php b/class/riskanalysis/risksign.class.php index e88e39162..e7dac29e6 100644 --- a/class/riskanalysis/risksign.class.php +++ b/class/riskanalysis/risksign.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/class/ticketdigiriskstats.class.php b/class/ticketdigiriskstats.class.php index 73ca65cff..987516c3e 100644 --- a/class/ticketdigiriskstats.class.php +++ b/class/ticketdigiriskstats.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2022 EOXIA * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/ajax/contacts.php b/core/ajax/contacts.php index b4c648b49..68c8831e7 100644 --- a/core/ajax/contacts.php +++ b/core/ajax/contacts.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/digiriskelementdocument/modules_digiriskelementdocument.php b/core/modules/digiriskdolibarr/digiriskdocuments/digiriskelementdocument/modules_digiriskelementdocument.php index 4ac7de4bd..f511aa446 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/digiriskelementdocument/modules_digiriskelementdocument.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/digiriskelementdocument/modules_digiriskelementdocument.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/doc_firepermitdocument_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/doc_firepermitdocument_custom_odt.modules.php index b7f4d2cfb..c23760bf7 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/doc_firepermitdocument_custom_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/doc_firepermitdocument_custom_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/doc_firepermitdocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/doc_firepermitdocument_odt.modules.php index 13bd24a62..cca64fb82 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/doc_firepermitdocument_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/doc_firepermitdocument_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/mod_firepermitdocument_standard.php b/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/mod_firepermitdocument_standard.php index d93952166..802474925 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/mod_firepermitdocument_standard.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/mod_firepermitdocument_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/modules_firepermitdocument.php b/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/modules_firepermitdocument.php index a37f6dbed..18fa0836a 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/modules_firepermitdocument.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/modules_firepermitdocument.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/doc_groupmentdocument_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/doc_groupmentdocument_custom_odt.modules.php index 63f4ed8d3..d6b641285 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/doc_groupmentdocument_custom_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/doc_groupmentdocument_custom_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/doc_groupmentdocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/doc_groupmentdocument_odt.modules.php index 635b2b4d5..26ce37acc 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/doc_groupmentdocument_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/doc_groupmentdocument_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/mod_groupmentdocument_standard.php b/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/mod_groupmentdocument_standard.php index d3603dab1..f60f74d5c 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/mod_groupmentdocument_standard.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/mod_groupmentdocument_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/modules_groupmentdocument.php b/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/modules_groupmentdocument.php index fa7f2c463..db1977bee 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/modules_groupmentdocument.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/modules_groupmentdocument.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/doc_informationssharing_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/doc_informationssharing_custom_odt.modules.php index 472ce8b31..2753098c0 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/doc_informationssharing_custom_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/doc_informationssharing_custom_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/doc_informationssharing_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/doc_informationssharing_odt.modules.php index bacc3fc6d..b479e6cff 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/doc_informationssharing_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/doc_informationssharing_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/mod_informationssharing_standard.php b/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/mod_informationssharing_standard.php index e68f915c2..84f7c7119 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/mod_informationssharing_standard.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/mod_informationssharing_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/modules_informationssharing.php b/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/modules_informationssharing.php index 983643d88..c0ef1f4be 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/modules_informationssharing.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/modules_informationssharing.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/doc_legaldisplay_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/doc_legaldisplay_custom_odt.modules.php index 082757c7f..9bae5207f 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/doc_legaldisplay_custom_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/doc_legaldisplay_custom_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/doc_legaldisplay_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/doc_legaldisplay_odt.modules.php index 1611f47c9..31778b830 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/doc_legaldisplay_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/doc_legaldisplay_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/mod_legaldisplay_standard.php b/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/mod_legaldisplay_standard.php index 5ca521ad5..a9c578023 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/mod_legaldisplay_standard.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/mod_legaldisplay_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/modules_legaldisplay.php b/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/modules_legaldisplay.php index 46fff7e39..3efd30e1a 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/modules_legaldisplay.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/modules_legaldisplay.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/doc_listingrisksaction_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/doc_listingrisksaction_custom_odt.modules.php index 5cff7dcc5..fc9db9ca2 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/doc_listingrisksaction_custom_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/doc_listingrisksaction_custom_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/doc_listingrisksaction_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/doc_listingrisksaction_odt.modules.php index 372dab726..22307c03a 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/doc_listingrisksaction_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/doc_listingrisksaction_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/mod_listingrisksaction_standard.php b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/mod_listingrisksaction_standard.php index db843b84c..ea5a76376 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/mod_listingrisksaction_standard.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/mod_listingrisksaction_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/modules_listingrisksaction.php b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/modules_listingrisksaction.php index afa4262a9..fb350104f 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/modules_listingrisksaction.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/modules_listingrisksaction.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/doc_listingrisksphoto_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/doc_listingrisksphoto_custom_odt.modules.php index 6f60c7c83..aaf041eab 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/doc_listingrisksphoto_custom_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/doc_listingrisksphoto_custom_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/doc_listingrisksphoto_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/doc_listingrisksphoto_odt.modules.php index 3cf8cd774..88c9035b8 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/doc_listingrisksphoto_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/doc_listingrisksphoto_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/mod_listingrisksphoto_standard.php b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/mod_listingrisksphoto_standard.php index 97a0fafff..5723d34ca 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/mod_listingrisksphoto_standard.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/mod_listingrisksphoto_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/modules_listingrisksphoto.php b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/modules_listingrisksphoto.php index 2414de9c2..a3871947c 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/modules_listingrisksphoto.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/modules_listingrisksphoto.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/modules_digiriskdocuments.php b/core/modules/digiriskdolibarr/digiriskdocuments/modules_digiriskdocuments.php index 4572b3f78..f65c9a060 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/modules_digiriskdocuments.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/modules_digiriskdocuments.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_custom_odt.modules.php index 1c183310c..4460fc2b7 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_custom_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_custom_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_odt.modules.php index 5664d0733..5281f693e 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_specimen_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_specimen_odt.modules.php index c953acda9..11770605f 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_specimen_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_specimen_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/mod_preventionplandocument_standard.php b/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/mod_preventionplandocument_standard.php index e694c474a..5e9527c96 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/mod_preventionplandocument_standard.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/mod_preventionplandocument_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/modules_preventionplandocument.php b/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/modules_preventionplandocument.php index c2660dbb0..93e817e09 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/modules_preventionplandocument.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/modules_preventionplandocument.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/projectdocument/mod_projectdocument_standard.php b/core/modules/digiriskdolibarr/digiriskdocuments/projectdocument/mod_projectdocument_standard.php index 17ee3d09d..67410f940 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/projectdocument/mod_projectdocument_standard.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/projectdocument/mod_projectdocument_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021 EOXIA * Copyright (C) 2022-2023 EVARISK * * This program is free software; you can redistribute it and/or modify diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/doc_riskassessmentdocument_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/doc_riskassessmentdocument_custom_odt.modules.php index df06091a5..f28bf395e 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/doc_riskassessmentdocument_custom_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/doc_riskassessmentdocument_custom_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/doc_riskassessmentdocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/doc_riskassessmentdocument_odt.modules.php index 712e4ccdc..98f6e2e03 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/doc_riskassessmentdocument_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/doc_riskassessmentdocument_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/mod_riskassessmentdocument_standard.php b/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/mod_riskassessmentdocument_standard.php index 714462ae7..55a3e95f6 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/mod_riskassessmentdocument_standard.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/mod_riskassessmentdocument_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/modules_riskassessmentdocument.php b/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/modules_riskassessmentdocument.php index e7a1bb866..f3f11035b 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/modules_riskassessmentdocument.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/modules_riskassessmentdocument.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/doc_ticketdocument_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/doc_ticketdocument_custom_odt.modules.php index 3e2731320..28d5651a8 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/doc_ticketdocument_custom_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/doc_ticketdocument_custom_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/doc_ticketdocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/doc_ticketdocument_odt.modules.php index cccc13a74..0a160fb87 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/doc_ticketdocument_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/doc_ticketdocument_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/mod_ticketdocument_standard.php b/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/mod_ticketdocument_standard.php index 42bf9fa32..6a0607701 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/mod_ticketdocument_standard.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/mod_ticketdocument_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/modules_ticketdocument.php b/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/modules_ticketdocument.php index 8f86960ac..a1b839c37 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/modules_ticketdocument.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/modules_ticketdocument.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/doc_workunitdocument_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/doc_workunitdocument_custom_odt.modules.php index ac6f67e5b..560683f60 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/doc_workunitdocument_custom_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/doc_workunitdocument_custom_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/doc_workunitdocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/doc_workunitdocument_odt.modules.php index 07c037f7b..aeca83400 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/doc_workunitdocument_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/doc_workunitdocument_odt.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/mod_workunitdocument_standard.php b/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/mod_workunitdocument_standard.php index a36b969ea..be6fa9957 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/mod_workunitdocument_standard.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/mod_workunitdocument_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/modules_workunitdocument.php b/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/modules_workunitdocument.php index 36c4ece66..dae1e643e 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/modules_workunitdocument.php +++ b/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/modules_workunitdocument.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskelement/accident/mod_accident_standard.php b/core/modules/digiriskdolibarr/digiriskelement/accident/mod_accident_standard.php index 66f9e4363..b4757b952 100644 --- a/core/modules/digiriskdolibarr/digiriskelement/accident/mod_accident_standard.php +++ b/core/modules/digiriskdolibarr/digiriskelement/accident/mod_accident_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskelement/accident_lesion/mod_accident_lesion_standard.php b/core/modules/digiriskdolibarr/digiriskelement/accident_lesion/mod_accident_lesion_standard.php index 8e1219703..c8a8c1e36 100644 --- a/core/modules/digiriskdolibarr/digiriskelement/accident_lesion/mod_accident_lesion_standard.php +++ b/core/modules/digiriskdolibarr/digiriskelement/accident_lesion/mod_accident_lesion_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskelement/accident_workstop/mod_accident_workstop_standard.php b/core/modules/digiriskdolibarr/digiriskelement/accident_workstop/mod_accident_workstop_standard.php index 6effbc6f5..12f7267ac 100644 --- a/core/modules/digiriskdolibarr/digiriskelement/accident_workstop/mod_accident_workstop_standard.php +++ b/core/modules/digiriskdolibarr/digiriskelement/accident_workstop/mod_accident_workstop_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskelement/evaluator/mod_evaluator_standard.php b/core/modules/digiriskdolibarr/digiriskelement/evaluator/mod_evaluator_standard.php index abaaf657b..5f38dcb31 100644 --- a/core/modules/digiriskdolibarr/digiriskelement/evaluator/mod_evaluator_standard.php +++ b/core/modules/digiriskdolibarr/digiriskelement/evaluator/mod_evaluator_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskelement/firepermit/mod_firepermit_standard.php b/core/modules/digiriskdolibarr/digiriskelement/firepermit/mod_firepermit_standard.php index 4cba68667..b3122d3b5 100644 --- a/core/modules/digiriskdolibarr/digiriskelement/firepermit/mod_firepermit_standard.php +++ b/core/modules/digiriskdolibarr/digiriskelement/firepermit/mod_firepermit_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskelement/firepermitdet/mod_firepermitdet_standard.php b/core/modules/digiriskdolibarr/digiriskelement/firepermitdet/mod_firepermitdet_standard.php index 2d997e12f..bcb9018cb 100644 --- a/core/modules/digiriskdolibarr/digiriskelement/firepermitdet/mod_firepermitdet_standard.php +++ b/core/modules/digiriskdolibarr/digiriskelement/firepermitdet/mod_firepermitdet_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskelement/groupment/mod_groupment_standard.php b/core/modules/digiriskdolibarr/digiriskelement/groupment/mod_groupment_standard.php index 879ab7c1d..c0bd1bf3e 100644 --- a/core/modules/digiriskdolibarr/digiriskelement/groupment/mod_groupment_standard.php +++ b/core/modules/digiriskdolibarr/digiriskelement/groupment/mod_groupment_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskelement/modules_digiriskelement.php b/core/modules/digiriskdolibarr/digiriskelement/modules_digiriskelement.php index 1cd23f582..fce819b7c 100644 --- a/core/modules/digiriskdolibarr/digiriskelement/modules_digiriskelement.php +++ b/core/modules/digiriskdolibarr/digiriskelement/modules_digiriskelement.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskelement/preventionplan/mod_preventionplan_standard.php b/core/modules/digiriskdolibarr/digiriskelement/preventionplan/mod_preventionplan_standard.php index b164d2c32..cc2670901 100644 --- a/core/modules/digiriskdolibarr/digiriskelement/preventionplan/mod_preventionplan_standard.php +++ b/core/modules/digiriskdolibarr/digiriskelement/preventionplan/mod_preventionplan_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskelement/preventionplandet/mod_preventionplandet_standard.php b/core/modules/digiriskdolibarr/digiriskelement/preventionplandet/mod_preventionplandet_standard.php index d0ef95040..d32e5a92d 100644 --- a/core/modules/digiriskdolibarr/digiriskelement/preventionplandet/mod_preventionplandet_standard.php +++ b/core/modules/digiriskdolibarr/digiriskelement/preventionplandet/mod_preventionplandet_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/digiriskelement/workunit/mod_workunit_standard.php b/core/modules/digiriskdolibarr/digiriskelement/workunit/mod_workunit_standard.php index 43bdf3f2a..6f807eca6 100644 --- a/core/modules/digiriskdolibarr/digiriskelement/workunit/mod_workunit_standard.php +++ b/core/modules/digiriskdolibarr/digiriskelement/workunit/mod_workunit_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/riskanalysis/modules_riskanalysis.php b/core/modules/digiriskdolibarr/riskanalysis/modules_riskanalysis.php index 38bfa59f8..5f817e595 100644 --- a/core/modules/digiriskdolibarr/riskanalysis/modules_riskanalysis.php +++ b/core/modules/digiriskdolibarr/riskanalysis/modules_riskanalysis.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/riskanalysis/risk/mod_risk_standard.php b/core/modules/digiriskdolibarr/riskanalysis/risk/mod_risk_standard.php index c14f5f0c1..725482655 100644 --- a/core/modules/digiriskdolibarr/riskanalysis/risk/mod_risk_standard.php +++ b/core/modules/digiriskdolibarr/riskanalysis/risk/mod_risk_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/riskanalysis/riskassessment/mod_riskassessment_standard.php b/core/modules/digiriskdolibarr/riskanalysis/riskassessment/mod_riskassessment_standard.php index 27bc655ab..00edb23dd 100644 --- a/core/modules/digiriskdolibarr/riskanalysis/riskassessment/mod_riskassessment_standard.php +++ b/core/modules/digiriskdolibarr/riskanalysis/riskassessment/mod_riskassessment_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/digiriskdolibarr/riskanalysis/risksign/mod_risksign_standard.php b/core/modules/digiriskdolibarr/riskanalysis/risksign/mod_risksign_standard.php index 54d18485b..366d4c819 100644 --- a/core/modules/digiriskdolibarr/riskanalysis/risksign/mod_risksign_standard.php +++ b/core/modules/digiriskdolibarr/riskanalysis/risksign/mod_risksign_standard.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/modules/modDigiriskDolibarr.class.php b/core/modules/modDigiriskDolibarr.class.php index 922fdd096..87661ba4e 100644 --- a/core/modules/modDigiriskDolibarr.class.php +++ b/core/modules/modDigiriskDolibarr.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2018-2019 Nicolas ZABOURI * Copyright (C) 2019-2020 Frédéric France - * Copyright (C) 2019-2020 Eoxia + * Copyright (C) 2019-2020 Eoxia * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1234,7 +1234,7 @@ public function __construct($db) 'leftmenu' => '', 'url' => '/digiriskdolibarr/digiriskdolibarrindex.php', 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position' => 48520 + $r, + 'position' => 100 + $r, 'enabled' => '$conf->digiriskdolibarr->enabled', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. 'perms' => '$user->rights->digiriskdolibarr->lire', // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules 'target' => '', @@ -1252,7 +1252,7 @@ public function __construct($db) 'leftmenu' => '', 'url' => '/digiriskdolibarr/digiriskdolibarrindex.php', 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position' => 48520 + $r, + 'position' => 100 + $r, 'enabled' => '$conf->digiriskdolibarr->enabled', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. 'perms' => '$user->rights->digiriskdolibarr->lire', // Use 'perms'=>'$user->rights->digiriskdolibarr->digiriskconst->read' if you want your menu with a permission rules 'target' => '', @@ -1268,7 +1268,7 @@ public function __construct($db) 'leftmenu' => 'digiriskstandard', 'url' => '/digiriskdolibarr/view/digiriskstandard/digiriskstandard_card.php?id=' . $conf->global->DIGIRISKDOLIBARR_ACTIVE_STANDARD, 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position' => 48520 + $r, + 'position' => 100 + $r, 'enabled' => '$conf->digiriskdolibarr->enabled', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'perms' => '$user->rights->digiriskdolibarr->riskassessmentdocument->read', // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules 'target' => '', @@ -1284,7 +1284,7 @@ public function __construct($db) 'leftmenu' => 'digirisklistingrisk', 'url' => '/digiriskdolibarr/view/digiriskelement/risk_list.php', 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position' => 48520 + $r, + 'position' => 100 + $r, 'enabled' => '$conf->digiriskdolibarr->enabled', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'perms' => '$user->rights->digiriskdolibarr->risk->read', // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules 'target' => '', @@ -1300,7 +1300,7 @@ public function __construct($db) 'leftmenu' => 'digiriskpreventionplan', 'url' => '/digiriskdolibarr/view/preventionplan/preventionplan_list.php', 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position' => 48520 + $r, + 'position' => 100 + $r, 'enabled' => '$conf->digiriskdolibarr->enabled', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'perms' => '$user->rights->digiriskdolibarr->preventionplan->read', // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules 'target' => '', @@ -1316,7 +1316,7 @@ public function __construct($db) 'leftmenu' => 'digiriskfirepermit', 'url' => '/digiriskdolibarr/view/firepermit/firepermit_list.php', 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position' => 48520 + $r, + 'position' => 100 + $r, 'enabled' => '$conf->digiriskdolibarr->enabled', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'perms' => '$user->rights->digiriskdolibarr->firepermit->read', // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules 'target' => '', @@ -1332,14 +1332,29 @@ public function __construct($db) 'leftmenu' => 'digiriskaccident', 'url' => '/digiriskdolibarr/view/accident/accident_list.php', 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position' => 48520 + $r, + 'position' => 100 + $r, 'enabled' => '$conf->digiriskdolibarr->enabled', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'perms' => '$user->rights->digiriskdolibarr->accident->read', // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules 'target' => '', 'user' => 0, // 0=Menu for internal users, 1=external users, 2=both ]; - $this->menu[$r++] = [ + $this->menu[$r++] = array( + 'fk_menu' => 'fk_mainmenu=digiriskdolibarr,fk_leftmenu=digiriskaccident', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type' => 'left', // This is a Left menu entry + 'titre' => '' . $langs->transnoentities('AccidentInvestigation'), + 'mainmenu' => 'digiriskdolibarr', + 'leftmenu' => 'digiriskaccidentinvestigation', + 'url' => '/digiriskdolibarr/view/accident_investigation/accident_investigation_list.php', + 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 100 + $r, + 'enabled' => '$conf->digiriskdolibarr->enabled && $conf->saturne->enabled', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms' => '$user->rights->digiriskdolibarr->lire && $user->rights->digiriskdolibarr->accident_investigation->read', // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules + 'target' => '', + 'user' => 0, // 0=Menu for internal users, 1=external users, 2=both + ); + + $this->menu[$r++] = array( 'fk_menu' => 'fk_mainmenu=digiriskdolibarr', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type' => 'left', // This is a Left menu entry 'titre' => $langs->trans('Users'), @@ -1348,7 +1363,7 @@ public function __construct($db) 'leftmenu' => 'digiriskusers', 'url' => '/digiriskdolibarr/view/digiriskusers.php', 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position' => 48520 + $r, + 'position' => 100 + $r, 'enabled' => '$conf->digiriskdolibarr->enabled', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'perms' => '$user->rights->digiriskdolibarr->adminpage->read', // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules 'target' => '', @@ -1364,7 +1379,7 @@ public function __construct($db) 'leftmenu' => 'digiriskactionplan', 'url' => '/projet/tasks.php?id=' . $conf->global->DIGIRISKDOLIBARR_DU_PROJECT, 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position' => 48520 + $r, + 'position' => 100 + $r, 'enabled' => '$conf->digiriskdolibarr->enabled', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'perms' => '$user->rights->digiriskdolibarr->digiriskelement->read', // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules 'target' => '_blank', @@ -1380,7 +1395,7 @@ public function __construct($db) 'leftmenu' => 'digirisktools', 'url' => '/digiriskdolibarr/view/digirisktools.php', 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position' => 48520 + $r, + 'position' => 100 + $r, 'enabled' => '$conf->digiriskdolibarr->enabled', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'perms' => '$user->rights->digiriskdolibarr->adminpage->read', // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules 'target' => '', @@ -1396,45 +1411,13 @@ public function __construct($db) 'leftmenu' => 'digiriskorganization', 'url' => '/digiriskdolibarr/view/digiriskelement/digiriskelement_organization.php', 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position' => 48520 + $r, + 'position' => 100 + $r, 'enabled' => '$conf->digiriskdolibarr->enabled', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'perms' => '$user->rights->digiriskdolibarr->digiriskelement->read', // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules 'target' => '', 'user' => 0, // 0=Menu for internal users, 1=external users, 2=both ]; - $this->menu[$r++] = [ - 'fk_menu' => 'fk_mainmenu=digiriskdolibarr', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type' => 'left', // This is a Left menu entry - 'titre' => $langs->trans('DigiriskConfig'), - 'prefix' => '', - 'mainmenu' => 'digiriskdolibarr', - 'leftmenu' => 'digiriskconfig', - 'url' => '/digiriskdolibarr/admin/setup.php', - 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position' => 48520 + $r, - 'enabled' => '$conf->digiriskdolibarr->enabled', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms' => '$user->rights->digiriskdolibarr->adminpage->read', // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules - 'target' => '', - 'user' => 0, // 0=Menu for internal users, 1=external users, 2=both - ]; - - $this->menu[$r++] = [ - 'fk_menu' => 'fk_mainmenu=digiriskdolibarr', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type' => 'left', // This is a Left menu entry - 'titre' => $langs->transnoentities('DigiriskConfigSociety'), - 'prefix' => '', - 'mainmenu' => 'digiriskdolibarr', - 'leftmenu' => 'digirisksocietyconfig', - 'url' => '/admin/company.php', - 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position' => 48520 + $r, - 'enabled' => '$conf->digiriskdolibarr->enabled && $user->admin', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms' => '$user->admin', // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules - 'target' => '', - 'user' => 0, // 0=Menu for internal users, 1=external users, 2=both - ]; - $this->menu[$r++] = [ 'fk_menu' => 'fk_mainmenu=digiriskdolibarr', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type' => 'left', // This is a Left menu entry @@ -1444,7 +1427,7 @@ public function __construct($db) 'leftmenu' => '', 'url' => '/custom/digiriskdolibarr/public/ticket/create_ticket.php' . ((!$conf->multicompany->enabled) ? '?entity=' . $conf->entity : ''), 'langs' => '', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position' => 48520 + $r, + 'position' => 100 + $r, 'enabled' => '$conf->digiriskdolibarr->enabled && $conf->global->DIGIRISKDOLIBARR_TICKET_ENABLE_PUBLIC_INTERFACE', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'perms' => 1, // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules 'target' => '', @@ -1454,20 +1437,20 @@ public function __construct($db) $this->menu[$r++] = [ 'fk_menu' => 'fk_mainmenu=digiriskdolibarr', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type' => 'left', // This is a Left menu entry - 'titre' => $langs->transnoentities('MinimizeMenu'), - 'prefix' => '', + 'titre' => $langs->transnoentities('DigiriskConfigSociety'), + 'prefix' => '', 'mainmenu' => 'digiriskdolibarr', - 'leftmenu' => '', - 'url' => '', - 'langs' => '', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position' => 48520 + $r, - 'enabled' => '$conf->digiriskdolibarr->enabled', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms' => 1, // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules + 'leftmenu' => 'digirisksocietyconfig', + 'url' => '/admin/company.php', + 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position' => 100 + $r, + 'enabled' => '$conf->digiriskdolibarr->enabled && $user->admin', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms' => '$user->admin', // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules 'target' => '', 'user' => 0, // 0=Menu for internal users, 1=external users, 2=both ]; - $this->menu[$r++] = [ + $this->menu[$r++] = array( 'fk_menu' => 'fk_mainmenu=ticket', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type' => 'left', // This is a Left menu entry 'titre' => $langs->transnoentities('DashBoard'), @@ -1476,44 +1459,13 @@ public function __construct($db) 'leftmenu' => 'ticketstats', 'url' => '/digiriskdolibarr/view/ticket/ticketstats.php', 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position' => 48520 + $r, + 'position' => 100 + $r, 'enabled' => '$conf->digiriskdolibarr->enabled && $conf->ticket->enabled', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'perms' => '$user->rights->ticket->read && $user->rights->digiriskdolibarr->lire', // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules 'target' => '', 'user' => 0, // 0=Menu for internal users, 1=external users, 2=both ]; - $this->menu[$r++] = [ - 'fk_menu' => 'fk_mainmenu=digiriskdolibarr,fk_leftmenu=digiriskaccident', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type' => 'left', // This is a Left menu entry - 'titre' => '' . $langs->transnoentities('AccidentInvestigation'), - 'mainmenu' => 'digiriskdolibarr', - 'leftmenu' => 'digiriskaccidentinvestigation', - 'url' => '/digiriskdolibarr/view/accident_investigation/accident_investigation_list.php', - 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position' => 48520 + $r, - 'enabled' => '$conf->digiriskdolibarr->enabled && $conf->saturne->enabled', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms' => '$user->rights->digiriskdolibarr->lire && $user->rights->digiriskdolibarr->accident_investigation->read', // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules - 'target' => '', - 'user' => 0, // 0=Menu for internal users, 1=external users, 2=both - ]; - -// $this->menu[$r++] = array( -// 'fk_menu' => 'fk_mainmenu=ticket', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode -// 'type' => 'left', // This is a Left menu entry -// 'titre' => $langs->transnoentities('DashBoard'), -// 'prefix' => $pictoDigirisk, -// 'mainmenu' => 'ticket', -// 'leftmenu' => 'dashboardticket', -// 'url' => '/digiriskdolibarr/view/ticket/dashboard_ticket.php', -// 'langs' => 'digiriskdolibarr@digiriskdolibarr', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. -// 'position' => 48520 + $r, -// 'enabled' => '$conf->digiriskdolibarr->enabled && $conf->ticket->enabled', // Define condition to show or hide menu entry. Use '$conf->digiriskdolibarr->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. -// 'perms' => '$user->rights->ticket->read && $user->rights->digiriskdolibarr->lire', // Use 'perms'=>'$user->rights->digiriskdolibarr->level1->level2' if you want your menu with a permission rules -// 'target' => '', -// 'user' => 0, // 0=Menu for internal users, 1=external users, 2=both -// ); - // Exports profiles provided by this module $r = 1; diff --git a/core/substitutions/functions_digiriskdolibarr.lib.php b/core/substitutions/functions_digiriskdolibarr.lib.php index a860118bf..e27c149ff 100644 --- a/core/substitutions/functions_digiriskdolibarr.lib.php +++ b/core/substitutions/functions_digiriskdolibarr.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/tpl/digiriskdocuments/digiriskdolibarr_informationssharingfields_view.tpl.php b/core/tpl/digiriskdocuments/digiriskdolibarr_informationssharingfields_view.tpl.php index 2c359bd8c..ba216226e 100644 --- a/core/tpl/digiriskdocuments/digiriskdolibarr_informationssharingfields_view.tpl.php +++ b/core/tpl/digiriskdocuments/digiriskdolibarr_informationssharingfields_view.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/tpl/digiriskdocuments/digiriskdolibarr_legaldisplayfields_view.tpl.php b/core/tpl/digiriskdocuments/digiriskdolibarr_legaldisplayfields_view.tpl.php index 35b101d38..2f17ed739 100644 --- a/core/tpl/digiriskdocuments/digiriskdolibarr_legaldisplayfields_view.tpl.php +++ b/core/tpl/digiriskdocuments/digiriskdolibarr_legaldisplayfields_view.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/tpl/digiriskdolibarr_openinghours_view.tpl.php b/core/tpl/digiriskdolibarr_openinghours_view.tpl.php index 347377c95..feeaa0413 100644 --- a/core/tpl/digiriskdolibarr_openinghours_view.tpl.php +++ b/core/tpl/digiriskdolibarr_openinghours_view.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/tpl/digiriskdolibarr_projectcreation_action.tpl.php b/core/tpl/digiriskdolibarr_projectcreation_action.tpl.php index 3cb60c5ee..9172a8080 100644 --- a/core/tpl/digiriskdolibarr_projectcreation_action.tpl.php +++ b/core/tpl/digiriskdolibarr_projectcreation_action.tpl.php @@ -1,6 +1,6 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/tpl/medias/digiriskdolibarr_photo_view.tpl.php b/core/tpl/medias/digiriskdolibarr_photo_view.tpl.php index b44f93392..9660af842 100644 --- a/core/tpl/medias/digiriskdolibarr_photo_view.tpl.php +++ b/core/tpl/medias/digiriskdolibarr_photo_view.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/core/triggers/interface_99_modDigiriskdolibarr_DigiriskdolibarrTriggers.class.php b/core/triggers/interface_99_modDigiriskdolibarr_DigiriskdolibarrTriggers.class.php index 147c1b621..e902bfd08 100644 --- a/core/triggers/interface_99_modDigiriskdolibarr_DigiriskdolibarrTriggers.class.php +++ b/core/triggers/interface_99_modDigiriskdolibarr_DigiriskdolibarrTriggers.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/digiriskdolibarrindex.php b/digiriskdolibarrindex.php index f20920da0..e9cecb857 100644 --- a/digiriskdolibarrindex.php +++ b/digiriskdolibarrindex.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/js/digiriskdolibarr.js b/js/digiriskdolibarr.js index b7b322024..069f87dbf 100644 --- a/js/digiriskdolibarr.js +++ b/js/digiriskdolibarr.js @@ -28,8 +28,8 @@ /** * @namespace EO_Framework_Init * - * @author Eoxia - * @copyright 2015-2021 Eoxia + * @author Eoxia + * @copyright 2015-2021-2023 EVARISK */ if ( ! window.eoxiaJS ) { @@ -699,7 +699,7 @@ window.eoxiaJS.dropdown.toggleAngleClass = function( button ) { /** * @namespace EO_Framework_Tooltip * - * @author Eoxia + * @author Eoxia * @copyright 2015-2018 Eoxia */ @@ -825,7 +825,7 @@ if ( ! window.eoxiaJS.tooltip ) { /** * @namespace EO_Framework_Loader * - * @author Eoxia + * @author Eoxia * @copyright 2015-2018 Eoxia */ diff --git a/langs/en_US/digiriskdolibarr.lang b/langs/en_US/digiriskdolibarr.lang index 61e52f130..1a8187a6b 100644 --- a/langs/en_US/digiriskdolibarr.lang +++ b/langs/en_US/digiriskdolibarr.lang @@ -1,4 +1,4 @@ -# Copyright (C) 2021 EOXIA +# Copyright (C) 2021-2023 EVARISK # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/langs/fr_FR/digiriskdolibarr.lang b/langs/fr_FR/digiriskdolibarr.lang index d55975f75..0f747b5f5 100644 --- a/langs/fr_FR/digiriskdolibarr.lang +++ b/langs/fr_FR/digiriskdolibarr.lang @@ -1,4 +1,4 @@ -# Copyright (C) 2021 EOXIA +# Copyright (C) 2021-2023 EVARISK # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/lib/digiriskdolibarr.lib.php b/lib/digiriskdolibarr.lib.php index b10b77e85..ec9d1fa0e 100644 --- a/lib/digiriskdolibarr.lib.php +++ b/lib/digiriskdolibarr.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ * * @return array */ -function digiriskdolibarrAdminPrepareHead() +function digiriskdolibarr_admin_prepare_head() { global $langs, $conf; @@ -70,26 +70,17 @@ function digiriskdolibarrAdminPrepareHead() $head[$h][2] = 'digiriskdocuments'; $h++; - $head[$h][0] = dol_buildpath("/digiriskdolibarr/admin/config/digirisksignature.php", 1); - $head[$h][1] = ' ' . $langs->trans("DigiriskSignature"); - $head[$h][2] = 'digirisksignature'; - $h++; - - $head[$h][0] = dol_buildpath("/digiriskdolibarr/admin/config/event.php", 1); - $head[$h][1] = ' ' . $langs->trans("Events"); - $head[$h][2] = 'event'; - $h++; - $head[$h][0] = dol_buildpath("/digiriskdolibarr/admin/setup.php", 1); $head[$h][1] = ' ' . $langs->trans("Settings"); $head[$h][2] = 'settings'; $h++; - $head[$h][0] = dol_buildpath("/digiriskdolibarr/admin/config/about.php", 1); - $head[$h][1] = ' ' . $langs->trans("About"); + $head[$h][0] = dol_buildpath('/saturne/admin/about.php?module_name=DigiriskDolibarr', 1); + $head[$h][1] = '' . $langs->trans('About'); $head[$h][2] = 'about'; $h++; + complete_head_from_modules($conf, $langs, null, $head, $h, 'digiriskdolibarr'); return $head; diff --git a/lib/digiriskdolibarr_accident.lib.php b/lib/digiriskdolibarr_accident.lib.php index 4ec138a80..07131d72e 100644 --- a/lib/digiriskdolibarr_accident.lib.php +++ b/lib/digiriskdolibarr_accident.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/lib/digiriskdolibarr_digiriskelement.lib.php b/lib/digiriskdolibarr_digiriskelement.lib.php index 3cde74bf5..2ee038a46 100644 --- a/lib/digiriskdolibarr_digiriskelement.lib.php +++ b/lib/digiriskdolibarr_digiriskelement.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/lib/digiriskdolibarr_digiriskstandard.lib.php b/lib/digiriskdolibarr_digiriskstandard.lib.php index a434e9aa5..fc23e1528 100644 --- a/lib/digiriskdolibarr_digiriskstandard.lib.php +++ b/lib/digiriskdolibarr_digiriskstandard.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/lib/digiriskdolibarr_function.lib.php b/lib/digiriskdolibarr_function.lib.php index 74ab49447..75b60f167 100644 --- a/lib/digiriskdolibarr_function.lib.php +++ b/lib/digiriskdolibarr_function.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/lib/digiriskdolibarr_ticket.lib.php b/lib/digiriskdolibarr_ticket.lib.php index d19808929..85ec0ae0d 100644 --- a/lib/digiriskdolibarr_ticket.lib.php +++ b/lib/digiriskdolibarr_ticket.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/package.json b/package.json index 610bf67c2..bbf74d8ed 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "contributors": [ { "name": "Eoxia", - "email": "dev@eoxia.com" + "email": "technique@evarisk.com" } ], "license": "GPLv3", diff --git a/public/ticket/create_ticket.php b/public/ticket/create_ticket.php index 882227cd8..59bd93c22 100644 --- a/public/ticket/create_ticket.php +++ b/public/ticket/create_ticket.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/public/ticket/ticket_success.php b/public/ticket/ticket_success.php index 9c37220a3..c840060c8 100644 --- a/public/ticket/ticket_success.php +++ b/public/ticket/ticket_success.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/sql/accident/llx_c_lesion_localization.sql b/sql/accident/llx_c_lesion_localization.sql index 53ddb4d41..78b004f17 100644 --- a/sql/accident/llx_c_lesion_localization.sql +++ b/sql/accident/llx_c_lesion_localization.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/accident/llx_c_lesion_nature.sql b/sql/accident/llx_c_lesion_nature.sql index 3347cd805..d9bb6c525 100644 --- a/sql/accident/llx_c_lesion_nature.sql +++ b/sql/accident/llx_c_lesion_nature.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/accident/llx_c_relative_location.sql b/sql/accident/llx_c_relative_location.sql index e8164e1ee..12547463c 100644 --- a/sql/accident/llx_c_relative_location.sql +++ b/sql/accident/llx_c_relative_location.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/accident/llx_digiriskdolibarr_accident.key.sql b/sql/accident/llx_digiriskdolibarr_accident.key.sql index b6f8e5123..86fda7115 100644 --- a/sql/accident/llx_digiriskdolibarr_accident.key.sql +++ b/sql/accident/llx_digiriskdolibarr_accident.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/accident/llx_digiriskdolibarr_accident.sql b/sql/accident/llx_digiriskdolibarr_accident.sql index 9412a989f..5ba6fd2e7 100644 --- a/sql/accident/llx_digiriskdolibarr_accident.sql +++ b/sql/accident/llx_digiriskdolibarr_accident.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/accident/llx_digiriskdolibarr_accident_extrafields.key.sql b/sql/accident/llx_digiriskdolibarr_accident_extrafields.key.sql index 8fb72f8f1..7bddc2dc9 100644 --- a/sql/accident/llx_digiriskdolibarr_accident_extrafields.key.sql +++ b/sql/accident/llx_digiriskdolibarr_accident_extrafields.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/accident/llx_digiriskdolibarr_accident_extrafields.sql b/sql/accident/llx_digiriskdolibarr_accident_extrafields.sql index ae4d54e43..bcf262c2e 100644 --- a/sql/accident/llx_digiriskdolibarr_accident_extrafields.sql +++ b/sql/accident/llx_digiriskdolibarr_accident_extrafields.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/accident/llx_digiriskdolibarr_accident_lesion.key.sql b/sql/accident/llx_digiriskdolibarr_accident_lesion.key.sql index 194f1040c..4ec0d540a 100644 --- a/sql/accident/llx_digiriskdolibarr_accident_lesion.key.sql +++ b/sql/accident/llx_digiriskdolibarr_accident_lesion.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/accident/llx_digiriskdolibarr_accident_lesion.sql b/sql/accident/llx_digiriskdolibarr_accident_lesion.sql index 7c237537a..4251a1fbd 100644 --- a/sql/accident/llx_digiriskdolibarr_accident_lesion.sql +++ b/sql/accident/llx_digiriskdolibarr_accident_lesion.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/accident/llx_digiriskdolibarr_accident_workstop.key.sql b/sql/accident/llx_digiriskdolibarr_accident_workstop.key.sql index 47687b927..437333c71 100644 --- a/sql/accident/llx_digiriskdolibarr_accident_workstop.key.sql +++ b/sql/accident/llx_digiriskdolibarr_accident_workstop.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/accident/llx_digiriskdolibarr_accident_workstop.sql b/sql/accident/llx_digiriskdolibarr_accident_workstop.sql index 8961cc308..a4b140594 100644 --- a/sql/accident/llx_digiriskdolibarr_accident_workstop.sql +++ b/sql/accident/llx_digiriskdolibarr_accident_workstop.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/accident/llx_digiriskdolibarr_accident_workstop_extrafields.key.sql b/sql/accident/llx_digiriskdolibarr_accident_workstop_extrafields.key.sql index 2367b8d03..3f080e6a5 100644 --- a/sql/accident/llx_digiriskdolibarr_accident_workstop_extrafields.key.sql +++ b/sql/accident/llx_digiriskdolibarr_accident_workstop_extrafields.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/accident/llx_digiriskdolibarr_accident_workstop_extrafields.sql b/sql/accident/llx_digiriskdolibarr_accident_workstop_extrafields.sql index c6a39b994..9b33feffd 100644 --- a/sql/accident/llx_digiriskdolibarr_accident_workstop_extrafields.sql +++ b/sql/accident/llx_digiriskdolibarr_accident_workstop_extrafields.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/accident/llx_digiriskdolibarr_accidentmetadata.key.sql b/sql/accident/llx_digiriskdolibarr_accidentmetadata.key.sql index 99d682b15..b5ba50e11 100644 --- a/sql/accident/llx_digiriskdolibarr_accidentmetadata.key.sql +++ b/sql/accident/llx_digiriskdolibarr_accidentmetadata.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/accident/llx_digiriskdolibarr_accidentmetadata.sql b/sql/accident/llx_digiriskdolibarr_accidentmetadata.sql index bb64eb41d..517382d53 100644 --- a/sql/accident/llx_digiriskdolibarr_accidentmetadata.sql +++ b/sql/accident/llx_digiriskdolibarr_accidentmetadata.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments.key.sql b/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments.key.sql index 27324fa9e..594d2a657 100644 --- a/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments.key.sql +++ b/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments.sql b/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments.sql index 8dff965c8..93eb9b879 100644 --- a/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments.sql +++ b/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments_extrafields.key.sql b/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments_extrafields.key.sql index e9e5dd662..95a86019b 100644 --- a/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments_extrafields.key.sql +++ b/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments_extrafields.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments_extrafields.sql b/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments_extrafields.sql index 35d5f3ee7..6f0b4a51d 100644 --- a/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments_extrafields.sql +++ b/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments_extrafields.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/digiriskelement/llx_digiriskdolibarr_digiriskelement.key.sql b/sql/digiriskelement/llx_digiriskdolibarr_digiriskelement.key.sql index 0b9646e2d..3c8c21830 100644 --- a/sql/digiriskelement/llx_digiriskdolibarr_digiriskelement.key.sql +++ b/sql/digiriskelement/llx_digiriskdolibarr_digiriskelement.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/digiriskelement/llx_digiriskdolibarr_digiriskelement.sql b/sql/digiriskelement/llx_digiriskdolibarr_digiriskelement.sql index 284cc1167..3368c2771 100644 --- a/sql/digiriskelement/llx_digiriskdolibarr_digiriskelement.sql +++ b/sql/digiriskelement/llx_digiriskdolibarr_digiriskelement.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/digiriskelement/llx_digiriskdolibarr_digiriskelement_extrafields.key.sql b/sql/digiriskelement/llx_digiriskdolibarr_digiriskelement_extrafields.key.sql index 873954958..4e9c08e9b 100644 --- a/sql/digiriskelement/llx_digiriskdolibarr_digiriskelement_extrafields.key.sql +++ b/sql/digiriskelement/llx_digiriskdolibarr_digiriskelement_extrafields.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/digiriskelement/llx_digiriskdolibarr_digiriskelement_extrafields.sql b/sql/digiriskelement/llx_digiriskdolibarr_digiriskelement_extrafields.sql index 35743a61c..fc940245c 100644 --- a/sql/digiriskelement/llx_digiriskdolibarr_digiriskelement_extrafields.sql +++ b/sql/digiriskelement/llx_digiriskdolibarr_digiriskelement_extrafields.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/firepermit/llx_digiriskdolibarr_firepermit.key.sql b/sql/firepermit/llx_digiriskdolibarr_firepermit.key.sql index 7c10b9039..fe1c85584 100644 --- a/sql/firepermit/llx_digiriskdolibarr_firepermit.key.sql +++ b/sql/firepermit/llx_digiriskdolibarr_firepermit.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/firepermit/llx_digiriskdolibarr_firepermit.sql b/sql/firepermit/llx_digiriskdolibarr_firepermit.sql index 26097cf90..af624f697 100644 --- a/sql/firepermit/llx_digiriskdolibarr_firepermit.sql +++ b/sql/firepermit/llx_digiriskdolibarr_firepermit.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/firepermit/llx_digiriskdolibarr_firepermit_extrafields.key.sql b/sql/firepermit/llx_digiriskdolibarr_firepermit_extrafields.key.sql index 2a08dfd84..ec8d670b3 100644 --- a/sql/firepermit/llx_digiriskdolibarr_firepermit_extrafields.key.sql +++ b/sql/firepermit/llx_digiriskdolibarr_firepermit_extrafields.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/firepermit/llx_digiriskdolibarr_firepermit_extrafields.sql b/sql/firepermit/llx_digiriskdolibarr_firepermit_extrafields.sql index a3dd6709e..707d12d4d 100644 --- a/sql/firepermit/llx_digiriskdolibarr_firepermit_extrafields.sql +++ b/sql/firepermit/llx_digiriskdolibarr_firepermit_extrafields.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/firepermit/llx_digiriskdolibarr_firepermitdet.key.sql b/sql/firepermit/llx_digiriskdolibarr_firepermitdet.key.sql index 3aed0aed7..1f77ce2be 100644 --- a/sql/firepermit/llx_digiriskdolibarr_firepermitdet.key.sql +++ b/sql/firepermit/llx_digiriskdolibarr_firepermitdet.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/firepermit/llx_digiriskdolibarr_firepermitdet.sql b/sql/firepermit/llx_digiriskdolibarr_firepermitdet.sql index 363f543d4..55e76e7f5 100644 --- a/sql/firepermit/llx_digiriskdolibarr_firepermitdet.sql +++ b/sql/firepermit/llx_digiriskdolibarr_firepermitdet.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/firepermit/llx_digiriskdolibarr_firepermitdet_extrafields.key.sql b/sql/firepermit/llx_digiriskdolibarr_firepermitdet_extrafields.key.sql index a33cee494..b8822460c 100644 --- a/sql/firepermit/llx_digiriskdolibarr_firepermitdet_extrafields.key.sql +++ b/sql/firepermit/llx_digiriskdolibarr_firepermitdet_extrafields.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/firepermit/llx_digiriskdolibarr_firepermitdet_extrafields.sql b/sql/firepermit/llx_digiriskdolibarr_firepermitdet_extrafields.sql index 4d903a446..5386a066b 100644 --- a/sql/firepermit/llx_digiriskdolibarr_firepermitdet_extrafields.sql +++ b/sql/firepermit/llx_digiriskdolibarr_firepermitdet_extrafields.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/llx_c_conventions_collectives.sql b/sql/llx_c_conventions_collectives.sql index fd7f64303..748e1e431 100644 --- a/sql/llx_c_conventions_collectives.sql +++ b/sql/llx_c_conventions_collectives.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/llx_categorie_ticket.key.sql b/sql/llx_categorie_ticket.key.sql index 012b9a9ea..e3c7593fa 100644 --- a/sql/llx_categorie_ticket.key.sql +++ b/sql/llx_categorie_ticket.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/llx_categorie_ticket.sql b/sql/llx_categorie_ticket.sql index 16ab92522..379a22ecb 100644 --- a/sql/llx_categorie_ticket.sql +++ b/sql/llx_categorie_ticket.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/llx_digiriskdolibarr_digiriskresources.key.sql b/sql/llx_digiriskdolibarr_digiriskresources.key.sql index 645d2c885..76d13c33b 100644 --- a/sql/llx_digiriskdolibarr_digiriskresources.key.sql +++ b/sql/llx_digiriskdolibarr_digiriskresources.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/llx_digiriskdolibarr_digiriskresources.sql b/sql/llx_digiriskdolibarr_digiriskresources.sql index 017203ec8..3b47b6c19 100644 --- a/sql/llx_digiriskdolibarr_digiriskresources.sql +++ b/sql/llx_digiriskdolibarr_digiriskresources.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/llx_digiriskdolibarr_digiriskstandard.key.sql b/sql/llx_digiriskdolibarr_digiriskstandard.key.sql index 13ce66bdf..df36fa928 100644 --- a/sql/llx_digiriskdolibarr_digiriskstandard.key.sql +++ b/sql/llx_digiriskdolibarr_digiriskstandard.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/llx_digiriskdolibarr_digiriskstandard.sql b/sql/llx_digiriskdolibarr_digiriskstandard.sql index 9a760d4c7..c2c93c14d 100644 --- a/sql/llx_digiriskdolibarr_digiriskstandard.sql +++ b/sql/llx_digiriskdolibarr_digiriskstandard.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/llx_digiriskdolibarr_digiriskstandard_extrafields.key.sql b/sql/llx_digiriskdolibarr_digiriskstandard_extrafields.key.sql index af76bf032..eb6d5e908 100644 --- a/sql/llx_digiriskdolibarr_digiriskstandard_extrafields.key.sql +++ b/sql/llx_digiriskdolibarr_digiriskstandard_extrafields.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/llx_digiriskdolibarr_digiriskstandard_extrafields.sql b/sql/llx_digiriskdolibarr_digiriskstandard_extrafields.sql index b65ddf4e5..15f1f27cc 100644 --- a/sql/llx_digiriskdolibarr_digiriskstandard_extrafields.sql +++ b/sql/llx_digiriskdolibarr_digiriskstandard_extrafields.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/llx_digiriskdolibarr_evaluator.key.sql b/sql/llx_digiriskdolibarr_evaluator.key.sql index 25328c943..605b1c2af 100644 --- a/sql/llx_digiriskdolibarr_evaluator.key.sql +++ b/sql/llx_digiriskdolibarr_evaluator.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/llx_digiriskdolibarr_evaluator.sql b/sql/llx_digiriskdolibarr_evaluator.sql index 452f6c4c3..aedec2b01 100644 --- a/sql/llx_digiriskdolibarr_evaluator.sql +++ b/sql/llx_digiriskdolibarr_evaluator.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/llx_digiriskdolibarr_evaluator_extrafields.key.sql b/sql/llx_digiriskdolibarr_evaluator_extrafields.key.sql index 88f9f5b2f..96df5ca5a 100644 --- a/sql/llx_digiriskdolibarr_evaluator_extrafields.key.sql +++ b/sql/llx_digiriskdolibarr_evaluator_extrafields.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/llx_digiriskdolibarr_evaluator_extrafields.sql b/sql/llx_digiriskdolibarr_evaluator_extrafields.sql index fa4f47e37..553fc02dc 100644 --- a/sql/llx_digiriskdolibarr_evaluator_extrafields.sql +++ b/sql/llx_digiriskdolibarr_evaluator_extrafields.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/llx_element_openinghours.sql b/sql/llx_element_openinghours.sql index b8d03d917..6fa7d5e27 100644 --- a/sql/llx_element_openinghours.sql +++ b/sql/llx_element_openinghours.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/preventionplan/llx_digiriskdolibarr_preventionplan.key.sql b/sql/preventionplan/llx_digiriskdolibarr_preventionplan.key.sql index abfbbf9bd..9f838535e 100644 --- a/sql/preventionplan/llx_digiriskdolibarr_preventionplan.key.sql +++ b/sql/preventionplan/llx_digiriskdolibarr_preventionplan.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/preventionplan/llx_digiriskdolibarr_preventionplan.sql b/sql/preventionplan/llx_digiriskdolibarr_preventionplan.sql index 584d44883..737b3c9a1 100644 --- a/sql/preventionplan/llx_digiriskdolibarr_preventionplan.sql +++ b/sql/preventionplan/llx_digiriskdolibarr_preventionplan.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/preventionplan/llx_digiriskdolibarr_preventionplan_extrafields.key.sql b/sql/preventionplan/llx_digiriskdolibarr_preventionplan_extrafields.key.sql index 18993c80a..bb63fb88d 100644 --- a/sql/preventionplan/llx_digiriskdolibarr_preventionplan_extrafields.key.sql +++ b/sql/preventionplan/llx_digiriskdolibarr_preventionplan_extrafields.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/preventionplan/llx_digiriskdolibarr_preventionplan_extrafields.sql b/sql/preventionplan/llx_digiriskdolibarr_preventionplan_extrafields.sql index e75ab4256..6c0be6df2 100644 --- a/sql/preventionplan/llx_digiriskdolibarr_preventionplan_extrafields.sql +++ b/sql/preventionplan/llx_digiriskdolibarr_preventionplan_extrafields.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/preventionplan/llx_digiriskdolibarr_preventionplandet.key.sql b/sql/preventionplan/llx_digiriskdolibarr_preventionplandet.key.sql index 064d7bba0..9a0be9ff4 100644 --- a/sql/preventionplan/llx_digiriskdolibarr_preventionplandet.key.sql +++ b/sql/preventionplan/llx_digiriskdolibarr_preventionplandet.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/preventionplan/llx_digiriskdolibarr_preventionplandet.sql b/sql/preventionplan/llx_digiriskdolibarr_preventionplandet.sql index a25cd423a..2b0fa0e9e 100644 --- a/sql/preventionplan/llx_digiriskdolibarr_preventionplandet.sql +++ b/sql/preventionplan/llx_digiriskdolibarr_preventionplandet.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/preventionplan/llx_digiriskdolibarr_preventionplandet_extrafields.key.sql b/sql/preventionplan/llx_digiriskdolibarr_preventionplandet_extrafields.key.sql index 856554b32..38f3403ce 100644 --- a/sql/preventionplan/llx_digiriskdolibarr_preventionplandet_extrafields.key.sql +++ b/sql/preventionplan/llx_digiriskdolibarr_preventionplandet_extrafields.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/preventionplan/llx_digiriskdolibarr_preventionplandet_extrafields.sql b/sql/preventionplan/llx_digiriskdolibarr_preventionplandet_extrafields.sql index 8bb9147ec..9c8018870 100644 --- a/sql/preventionplan/llx_digiriskdolibarr_preventionplandet_extrafields.sql +++ b/sql/preventionplan/llx_digiriskdolibarr_preventionplandet_extrafields.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/riskanalysis/llx_digiriskdolibarr_risk.key.sql b/sql/riskanalysis/llx_digiriskdolibarr_risk.key.sql index 5cf10c8d5..d7f3e9d8f 100644 --- a/sql/riskanalysis/llx_digiriskdolibarr_risk.key.sql +++ b/sql/riskanalysis/llx_digiriskdolibarr_risk.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/riskanalysis/llx_digiriskdolibarr_risk.sql b/sql/riskanalysis/llx_digiriskdolibarr_risk.sql index a683e22eb..bcbb91c6b 100644 --- a/sql/riskanalysis/llx_digiriskdolibarr_risk.sql +++ b/sql/riskanalysis/llx_digiriskdolibarr_risk.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/riskanalysis/llx_digiriskdolibarr_risk_extrafields.key.sql b/sql/riskanalysis/llx_digiriskdolibarr_risk_extrafields.key.sql index b20ad7510..29fd09d20 100644 --- a/sql/riskanalysis/llx_digiriskdolibarr_risk_extrafields.key.sql +++ b/sql/riskanalysis/llx_digiriskdolibarr_risk_extrafields.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/riskanalysis/llx_digiriskdolibarr_risk_extrafields.sql b/sql/riskanalysis/llx_digiriskdolibarr_risk_extrafields.sql index ad0bd4931..c174fa70f 100644 --- a/sql/riskanalysis/llx_digiriskdolibarr_risk_extrafields.sql +++ b/sql/riskanalysis/llx_digiriskdolibarr_risk_extrafields.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/riskanalysis/llx_digiriskdolibarr_riskassessment.key.sql b/sql/riskanalysis/llx_digiriskdolibarr_riskassessment.key.sql index 2477c3787..10581c3d0 100644 --- a/sql/riskanalysis/llx_digiriskdolibarr_riskassessment.key.sql +++ b/sql/riskanalysis/llx_digiriskdolibarr_riskassessment.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/riskanalysis/llx_digiriskdolibarr_riskassessment.sql b/sql/riskanalysis/llx_digiriskdolibarr_riskassessment.sql index 2ea9aea48..0b3edb1c1 100644 --- a/sql/riskanalysis/llx_digiriskdolibarr_riskassessment.sql +++ b/sql/riskanalysis/llx_digiriskdolibarr_riskassessment.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/riskanalysis/llx_digiriskdolibarr_riskassessment_extrafields.key.sql b/sql/riskanalysis/llx_digiriskdolibarr_riskassessment_extrafields.key.sql index 14c8168c4..e4b0d2ca4 100644 --- a/sql/riskanalysis/llx_digiriskdolibarr_riskassessment_extrafields.key.sql +++ b/sql/riskanalysis/llx_digiriskdolibarr_riskassessment_extrafields.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/riskanalysis/llx_digiriskdolibarr_riskassessment_extrafields.sql b/sql/riskanalysis/llx_digiriskdolibarr_riskassessment_extrafields.sql index d3c8f0402..d80ecd53d 100644 --- a/sql/riskanalysis/llx_digiriskdolibarr_riskassessment_extrafields.sql +++ b/sql/riskanalysis/llx_digiriskdolibarr_riskassessment_extrafields.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/riskanalysis/llx_digiriskdolibarr_risksign.key.sql b/sql/riskanalysis/llx_digiriskdolibarr_risksign.key.sql index a3918e0a3..8ef108f7d 100644 --- a/sql/riskanalysis/llx_digiriskdolibarr_risksign.key.sql +++ b/sql/riskanalysis/llx_digiriskdolibarr_risksign.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/riskanalysis/llx_digiriskdolibarr_risksign.sql b/sql/riskanalysis/llx_digiriskdolibarr_risksign.sql index a38d37848..110e4ed71 100644 --- a/sql/riskanalysis/llx_digiriskdolibarr_risksign.sql +++ b/sql/riskanalysis/llx_digiriskdolibarr_risksign.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/riskanalysis/llx_digiriskdolibarr_risksign_extrafields.key.sql b/sql/riskanalysis/llx_digiriskdolibarr_risksign_extrafields.key.sql index 0164a18bc..8334ac0dc 100644 --- a/sql/riskanalysis/llx_digiriskdolibarr_risksign_extrafields.key.sql +++ b/sql/riskanalysis/llx_digiriskdolibarr_risksign_extrafields.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/sql/riskanalysis/llx_digiriskdolibarr_risksign_extrafields.sql b/sql/riskanalysis/llx_digiriskdolibarr_risksign_extrafields.sql index ea8c0e4b2..f3bc3fc8c 100644 --- a/sql/riskanalysis/llx_digiriskdolibarr_risksign_extrafields.sql +++ b/sql/riskanalysis/llx_digiriskdolibarr_risksign_extrafields.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2021 EOXIA +-- Copyright (C) 2021-2023 EVARISK -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/test/phpunit/AccidentUnitTest.php b/test/phpunit/AccidentUnitTest.php index 1c0225f9e..af26d0ff0 100644 --- a/test/phpunit/AccidentUnitTest.php +++ b/test/phpunit/AccidentUnitTest.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index 856492387..4cf230d52 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/test/phpunit/DigiriskDocumentsUnitTest.php b/test/phpunit/DigiriskDocumentsUnitTest.php index 7a312e173..8ea3a097f 100644 --- a/test/phpunit/DigiriskDocumentsUnitTest.php +++ b/test/phpunit/DigiriskDocumentsUnitTest.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/test/phpunit/DigiriskElementUnitTest.php b/test/phpunit/DigiriskElementUnitTest.php index 6d5692d60..6269572cc 100644 --- a/test/phpunit/DigiriskElementUnitTest.php +++ b/test/phpunit/DigiriskElementUnitTest.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/test/phpunit/DigiriskResourcesUnitTest.php b/test/phpunit/DigiriskResourcesUnitTest.php index 6e0992ed4..d221188d8 100644 --- a/test/phpunit/DigiriskResourcesUnitTest.php +++ b/test/phpunit/DigiriskResourcesUnitTest.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/test/phpunit/DigiriskSignatureUnitTest.php b/test/phpunit/DigiriskSignatureUnitTest.php index dffd53d7e..8d2bba37d 100644 --- a/test/phpunit/DigiriskSignatureUnitTest.php +++ b/test/phpunit/DigiriskSignatureUnitTest.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/test/phpunit/DigiriskStandardUnitTest.php b/test/phpunit/DigiriskStandardUnitTest.php index 46a587e00..1fc745cfb 100644 --- a/test/phpunit/DigiriskStandardUnitTest.php +++ b/test/phpunit/DigiriskStandardUnitTest.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/test/phpunit/EvaluatorUnitTest.php b/test/phpunit/EvaluatorUnitTest.php index 2d963be0d..00f21624e 100644 --- a/test/phpunit/EvaluatorUnitTest.php +++ b/test/phpunit/EvaluatorUnitTest.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/test/phpunit/FirePermitUnitTest.php b/test/phpunit/FirePermitUnitTest.php index 0b7bcc14d..5e00a0d34 100644 --- a/test/phpunit/FirePermitUnitTest.php +++ b/test/phpunit/FirePermitUnitTest.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/test/phpunit/OpeninghoursUnitTest.php b/test/phpunit/OpeninghoursUnitTest.php index 7b7315f71..ebf915723 100644 --- a/test/phpunit/OpeninghoursUnitTest.php +++ b/test/phpunit/OpeninghoursUnitTest.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/test/phpunit/PreventionPlanUnitTest.php b/test/phpunit/PreventionPlanUnitTest.php index d8602df23..6f146ad62 100644 --- a/test/phpunit/PreventionPlanUnitTest.php +++ b/test/phpunit/PreventionPlanUnitTest.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/test/phpunit/riskanalysis/RiskAssessmentUnitTest.php b/test/phpunit/riskanalysis/RiskAssessmentUnitTest.php index cd8b86b7e..5ec1772c4 100644 --- a/test/phpunit/riskanalysis/RiskAssessmentUnitTest.php +++ b/test/phpunit/riskanalysis/RiskAssessmentUnitTest.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/test/phpunit/riskanalysis/RiskSignUnitTest.php b/test/phpunit/riskanalysis/RiskSignUnitTest.php index f854309f0..4a6754310 100644 --- a/test/phpunit/riskanalysis/RiskSignUnitTest.php +++ b/test/phpunit/riskanalysis/RiskSignUnitTest.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/test/phpunit/riskanalysis/RiskUnitTest.php b/test/phpunit/riskanalysis/RiskUnitTest.php index f8c129d9a..9f465415b 100644 --- a/test/phpunit/riskanalysis/RiskUnitTest.php +++ b/test/phpunit/riskanalysis/RiskUnitTest.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/view/accident/accident_card.php b/view/accident/accident_card.php index 5ac399848..3fa0c95f7 100644 --- a/view/accident/accident_card.php +++ b/view/accident/accident_card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/view/accident/accident_list.php b/view/accident/accident_list.php index 23a89ac1a..b83957a69 100644 --- a/view/accident/accident_list.php +++ b/view/accident/accident_list.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,7 +46,6 @@ require_once __DIR__ . '/../../class/digiriskresources.class.php'; require_once __DIR__ . '/../../lib/digiriskdolibarr_function.lib.php'; require_once __DIR__ . '/../../lib/digiriskdolibarr_digiriskelement.lib.php'; -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; global $conf, $db, $hookmanager, $langs, $user; diff --git a/view/accident/accident_metadata.php b/view/accident/accident_metadata.php index 692264747..ff232cb95 100644 --- a/view/accident/accident_metadata.php +++ b/view/accident/accident_metadata.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -67,7 +67,6 @@ $hookmanager->initHooks(array('accidentmetadata', 'globalcard')); // Note that conf->hooks_modules contains array // Security check -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->accident->read; $permissiontoadd = $user->rights->digiriskdolibarr->accident->write; diff --git a/view/accident/accident_metadata_lesion.php b/view/accident/accident_metadata_lesion.php index bcc642136..6cff13247 100644 --- a/view/accident/accident_metadata_lesion.php +++ b/view/accident/accident_metadata_lesion.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,7 +64,6 @@ $hookmanager->initHooks(array('accidentmetadatalesion', 'globalcard')); // Note that conf->hooks_modules contains array // Security check -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->accident->read; $permissiontoadd = $user->rights->digiriskdolibarr->accident->write; diff --git a/view/digiriskelement/digiriskelement_agenda.php b/view/digiriskelement/digiriskelement_agenda.php index 022259afc..aaf1ee964 100644 --- a/view/digiriskelement/digiriskelement_agenda.php +++ b/view/digiriskelement/digiriskelement_agenda.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -92,7 +92,6 @@ if ($id > 0 || ! empty($ref)) $upload_dir = $conf->digiriskdolibarr->multidir_output[$object->entity] . "/" . $object->id; //Security check -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->digiriskelement->read; $permissiontoadd = $user->rights->digiriskdolibarr->digiriskelement->write; diff --git a/view/digiriskelement/digiriskelement_card.php b/view/digiriskelement/digiriskelement_card.php index b0e046113..dcfa95a8b 100644 --- a/view/digiriskelement/digiriskelement_card.php +++ b/view/digiriskelement/digiriskelement_card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -93,7 +93,6 @@ $upload_dir = $conf->digiriskdolibarr->multidir_output[isset($object->entity) ? $object->entity : 1]; //Security check -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->digiriskelement->read; $permissiontoadd = $user->rights->digiriskdolibarr->digiriskelement->write; diff --git a/view/digiriskelement/digiriskelement_evaluator.php b/view/digiriskelement/digiriskelement_evaluator.php index f3d562e00..227286c74 100644 --- a/view/digiriskelement/digiriskelement_evaluator.php +++ b/view/digiriskelement/digiriskelement_evaluator.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -133,7 +133,6 @@ } //Permission for digiriskelement_evaluator -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->evaluator->read; $permissiontoadd = $user->rights->digiriskdolibarr->evaluator->write; diff --git a/view/digiriskelement/digiriskelement_listingrisksaction.php b/view/digiriskelement/digiriskelement_listingrisksaction.php index 4ffd4a217..71056a61a 100644 --- a/view/digiriskelement/digiriskelement_listingrisksaction.php +++ b/view/digiriskelement/digiriskelement_listingrisksaction.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -74,7 +74,6 @@ $upload_dir = $conf->digiriskdolibarr->multidir_output[isset($conf->entity) ? $conf->entity : 1]; // Security check -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->listingrisksaction->read; $permissiontoadd = $user->rights->digiriskdolibarr->listingrisksaction->write; diff --git a/view/digiriskelement/digiriskelement_listingrisksphoto.php b/view/digiriskelement/digiriskelement_listingrisksphoto.php index 8f1d88029..831e87097 100644 --- a/view/digiriskelement/digiriskelement_listingrisksphoto.php +++ b/view/digiriskelement/digiriskelement_listingrisksphoto.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -74,7 +74,6 @@ $upload_dir = $conf->digiriskdolibarr->multidir_output[isset($conf->entity) ? $conf->entity : 1]; // Security check -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->listingrisksphoto->read; $permissiontoadd = $user->rights->digiriskdolibarr->listingrisksphoto->write; diff --git a/view/digiriskelement/digiriskelement_organization.php b/view/digiriskelement/digiriskelement_organization.php index 5dcf604ff..cf6604cb4 100644 --- a/view/digiriskelement/digiriskelement_organization.php +++ b/view/digiriskelement/digiriskelement_organization.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,7 +41,6 @@ require_once __DIR__ . '/../../class/digiriskelement.class.php'; require_once __DIR__ . '/../../lib/digiriskdolibarr_function.lib.php'; -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; global $conf, $db, $hookmanager, $langs, $user; diff --git a/view/digiriskelement/digiriskelement_register.php b/view/digiriskelement/digiriskelement_register.php index 72d47051e..9dd7cbd9b 100644 --- a/view/digiriskelement/digiriskelement_register.php +++ b/view/digiriskelement/digiriskelement_register.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,7 +72,6 @@ if ($id > 0 || ! empty($ref)) $upload_dir = $conf->digiriskdolibarr->multidir_output[$object->entity] . "/" . $object->id; //Security check -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->digiriskelement->read; $permissiontoadd = $user->rights->digiriskdolibarr->digiriskelement->write; diff --git a/view/digiriskelement/digiriskelement_risk.php b/view/digiriskelement/digiriskelement_risk.php index 710c281fc..4bfbce369 100644 --- a/view/digiriskelement/digiriskelement_risk.php +++ b/view/digiriskelement/digiriskelement_risk.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -153,7 +153,6 @@ include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. //Permission for digiriskelement_risk -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->risk->read; $permissiontoadd = $user->rights->digiriskdolibarr->risk->write; diff --git a/view/digiriskelement/digiriskelement_risksign.php b/view/digiriskelement/digiriskelement_risksign.php index 901dc90e5..9439137b6 100644 --- a/view/digiriskelement/digiriskelement_risksign.php +++ b/view/digiriskelement/digiriskelement_risksign.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -124,7 +124,6 @@ include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. //Permission for digiriskelement_risksign -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->risksign->read; $permissiontoadd = $user->rights->digiriskdolibarr->risksign->write; diff --git a/view/digiriskelement/risk_list.php b/view/digiriskelement/risk_list.php index 0c9380b13..d0f11711f 100644 --- a/view/digiriskelement/risk_list.php +++ b/view/digiriskelement/risk_list.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,7 +59,6 @@ require_once './../../core/modules/digiriskdolibarr/riskanalysis/riskassessment/mod_riskassessment_standard.php'; require_once './../../lib/digiriskdolibarr_digiriskstandard.lib.php'; require_once './../../lib/digiriskdolibarr_function.lib.php'; -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permtoupload = $user->rights->ecm->upload; diff --git a/view/digiriskstandard/digiriskstandard_agenda.php b/view/digiriskstandard/digiriskstandard_agenda.php index 242e13b93..ea7aa7f22 100644 --- a/view/digiriskstandard/digiriskstandard_agenda.php +++ b/view/digiriskstandard/digiriskstandard_agenda.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -94,7 +94,6 @@ if ($id > 0 || ! empty($ref)) $upload_dir = $conf->digiriskdolibarr->multidir_output[$object->entity] . "/" . $object->id; //Security check -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->digiriskelement->read; $permissiontoadd = $user->rights->digiriskdolibarr->digiriskelement->write; diff --git a/view/digiriskstandard/digiriskstandard_card.php b/view/digiriskstandard/digiriskstandard_card.php index 5c04430fe..ed282bafb 100644 --- a/view/digiriskstandard/digiriskstandard_card.php +++ b/view/digiriskstandard/digiriskstandard_card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -61,7 +61,6 @@ $object->fetch($conf->global->DIGIRISKDOLIBARR_ACTIVE_STANDARD); // Security check -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->riskassessmentdocument->read; diff --git a/view/digiriskstandard/digiriskstandard_informationssharing.php b/view/digiriskstandard/digiriskstandard_informationssharing.php index d1ec433cb..ba48026d0 100644 --- a/view/digiriskstandard/digiriskstandard_informationssharing.php +++ b/view/digiriskstandard/digiriskstandard_informationssharing.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -67,7 +67,6 @@ $upload_dir = $conf->digiriskdolibarr->multidir_output[isset($conf->entity) ? $conf->entity : 1]; //Security check -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->informationssharing->read; $permissiontoadd = $user->rights->digiriskdolibarr->informationssharing->write; diff --git a/view/digiriskstandard/digiriskstandard_legaldisplay.php b/view/digiriskstandard/digiriskstandard_legaldisplay.php index fdb992f9f..136774b34 100644 --- a/view/digiriskstandard/digiriskstandard_legaldisplay.php +++ b/view/digiriskstandard/digiriskstandard_legaldisplay.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -67,7 +67,6 @@ $upload_dir = $conf->digiriskdolibarr->multidir_output[isset($conf->entity) ? $conf->entity : 1]; //Security check -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->legaldisplay->read; $permissiontoadd = $user->rights->digiriskdolibarr->legaldisplay->write; diff --git a/view/digiriskstandard/digiriskstandard_riskassessmentdocument.php b/view/digiriskstandard/digiriskstandard_riskassessmentdocument.php index cb6035687..7a8595fd2 100644 --- a/view/digiriskstandard/digiriskstandard_riskassessmentdocument.php +++ b/view/digiriskstandard/digiriskstandard_riskassessmentdocument.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -80,7 +80,6 @@ $upload_dir = $conf->digiriskdolibarr->multidir_output[isset($conf->entity) ? $conf->entity : 1]; //Security check -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->riskassessmentdocument->read; $permissiontoadd = $user->rights->digiriskdolibarr->riskassessmentdocument->write; diff --git a/view/digirisktools.php b/view/digirisktools.php index 78ee61f9a..99b861936 100644 --- a/view/digirisktools.php +++ b/view/digirisktools.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/view/digiriskusers.php b/view/digiriskusers.php index d54b7c168..b22fe59c9 100644 --- a/view/digiriskusers.php +++ b/view/digiriskusers.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/view/firepermit/firepermit_card.php b/view/firepermit/firepermit_card.php index 33625a7c2..9f74f1e87 100644 --- a/view/firepermit/firepermit_card.php +++ b/view/firepermit/firepermit_card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -91,7 +91,6 @@ $upload_dir = $conf->digiriskdolibarr->multidir_output[isset($object->entity) ? $object->entity : 1]; // Security check -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->firepermit->read; $permissiontoadd = $user->rights->digiriskdolibarr->firepermit->write; diff --git a/view/firepermit/firepermit_list.php b/view/firepermit/firepermit_list.php index 8a11016f9..d17ad2d65 100644 --- a/view/firepermit/firepermit_list.php +++ b/view/firepermit/firepermit_list.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,7 +46,6 @@ require_once __DIR__ . '/../../class/firepermit.class.php'; require_once __DIR__ . '/../../class/preventionplan.class.php'; require_once __DIR__ . '/../../class/digiriskresources.class.php'; -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; global $conf, $db; diff --git a/view/firepermit/firepermit_schedule.php b/view/firepermit/firepermit_schedule.php index 001566822..31423ce72 100644 --- a/view/firepermit/firepermit_schedule.php +++ b/view/firepermit/firepermit_schedule.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -67,7 +67,6 @@ $object->fetch(0, '', $morewhere); // Security check -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->firepermit->read; $permissiontoadd = $user->rights->digiriskdolibarr->firepermit->write; diff --git a/view/openinghours_card.php b/view/openinghours_card.php index 4674dbc35..7c4b4db75 100644 --- a/view/openinghours_card.php +++ b/view/openinghours_card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/view/preventionplan/preventionplan_agenda.php b/view/preventionplan/preventionplan_agenda.php index 6b2682f5f..9f003021b 100644 --- a/view/preventionplan/preventionplan_agenda.php +++ b/view/preventionplan/preventionplan_agenda.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -92,7 +92,6 @@ if ($id > 0 || ! empty($ref)) $upload_dir = $conf->digiriskdolibarr->multidir_output[$object->entity] . "/" . $object->id; // Security check - Protection if external user -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->preventionplan->read; diff --git a/view/preventionplan/preventionplan_attendants.php b/view/preventionplan/preventionplan_attendants.php index 494e422e0..f87f0fe6f 100644 --- a/view/preventionplan/preventionplan_attendants.php +++ b/view/preventionplan/preventionplan_attendants.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -69,7 +69,6 @@ $hookmanager->initHooks(array('preventionplansignature', 'globalcard')); // Note that conf->hooks_modules contains array //Security check -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->preventionplan->read; $permissiontoadd = $user->rights->digiriskdolibarr->preventionplan->write; diff --git a/view/preventionplan/preventionplan_card.php b/view/preventionplan/preventionplan_card.php index c00e81667..88f672815 100644 --- a/view/preventionplan/preventionplan_card.php +++ b/view/preventionplan/preventionplan_card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -100,7 +100,6 @@ $upload_dir = $conf->digiriskdolibarr->multidir_output[isset($object->entity) ? $object->entity : 1]; // Security check -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->preventionplan->read; $permissiontoadd = $user->rights->digiriskdolibarr->preventionplan->write; diff --git a/view/preventionplan/preventionplan_list.php b/view/preventionplan/preventionplan_list.php index 46461cd12..9b05a2491 100644 --- a/view/preventionplan/preventionplan_list.php +++ b/view/preventionplan/preventionplan_list.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,7 +42,6 @@ require_once __DIR__ . '/../../class/preventionplan.class.php'; require_once __DIR__ . '/../../class/digiriskresources.class.php'; -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; // Load translation files required by the page $langs->loadLangs(array('projects', 'companies', 'commercial')); diff --git a/view/preventionplan/preventionplan_schedule.php b/view/preventionplan/preventionplan_schedule.php index a9944d059..8f0c4610b 100644 --- a/view/preventionplan/preventionplan_schedule.php +++ b/view/preventionplan/preventionplan_schedule.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 EVARISK * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,7 +75,6 @@ $object->fetch(0, '', $morewhere); // Security check - Protection if external user -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $permissiontoread = $user->rights->digiriskdolibarr->preventionplan->read; $permissiontoadd = $user->rights->digiriskdolibarr->preventionplan->write; diff --git a/view/ticket/dashboard_ticket.php b/view/ticket/dashboard_ticket.php index a76269306..0ab31ae8e 100644 --- a/view/ticket/dashboard_ticket.php +++ b/view/ticket/dashboard_ticket.php @@ -41,7 +41,6 @@ require_once './../../lib/digiriskdolibarr_function.lib.php'; require_once __DIR__ . '/../../class/digiriskelement.class.php'; -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; global $conf, $db, $langs, $user; diff --git a/view/ticket/ticketstats.php b/view/ticket/ticketstats.php index 9fd916205..106fdd8c3 100644 --- a/view/ticket/ticketstats.php +++ b/view/ticket/ticketstats.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2022 EOXIA * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,7 +49,6 @@ require_once __DIR__ . '/../../lib/digiriskdolibarr_ticket.lib.php'; require_once __DIR__ . '/../../class/ticketdigiriskstats.class.php'; require_once __DIR__ . '/../../class/digiriskelement.class.php'; -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; $WIDTH = DolGraph::getDefaultGraphSizeForStats('width'); $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height'); diff --git a/view/ticket/ticketstatscsv.php b/view/ticket/ticketstatscsv.php index 6becd8feb..d972fd308 100644 --- a/view/ticket/ticketstatscsv.php +++ b/view/ticket/ticketstatscsv.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2022 EOXIA * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,7 +44,6 @@ require_once __DIR__ . '/../../lib/digiriskdolibarr_ticket.lib.php'; require_once __DIR__ . '/../../class/ticketdigiriskstats.class.php'; -require_once __DIR__ . '/../../core/tpl/digirisk_security_checks.php'; // Load translation files required by the page $langs->loadLangs(array('other')); From fe2e03e6bbfffae995a1e4a96325a596006ed648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20David?= Date: Mon, 28 Aug 2023 14:07:43 +0200 Subject: [PATCH 003/293] #3217 [JS] fix: js saturne integration --- gulpfile.js | 27 +- js/digiriskdolibarr.js | 84 ++-- js/digiriskdolibarr.min.js | 1 + js/modules/accident.js | 141 +++++++ js/modules/button.js | 45 +++ js/modules/dashboard.js | 95 +++++ js/modules/digiriskelement.js | 76 ++++ js/modules/document.js | 62 +++ js/modules/evaluationMethod.js | 72 ++++ js/modules/evaluator.js | 145 +++++++ js/modules/form.js | 88 +++++ js/modules/navigation.js | 235 ++++++++++++ js/modules/preventionPlan.js | 58 +++ js/modules/risk.js | 372 ++++++++++++++++++ js/modules/riskAssessment.js | 406 ++++++++++++++++++++ js/modules/riskSign.js | 240 ++++++++++++ js/modules/task.js | 657 ++++++++++++++++++++++++++++++++ js/modules/ticket.js | 272 +++++++++++++ js/modules/user.js | 77 ++++ public/ticket/create_ticket.php | 2 +- 20 files changed, 3089 insertions(+), 66 deletions(-) create mode 100644 js/digiriskdolibarr.min.js create mode 100644 js/modules/accident.js create mode 100644 js/modules/button.js create mode 100644 js/modules/dashboard.js create mode 100644 js/modules/digiriskelement.js create mode 100644 js/modules/document.js create mode 100644 js/modules/evaluationMethod.js create mode 100644 js/modules/evaluator.js create mode 100644 js/modules/form.js create mode 100644 js/modules/navigation.js create mode 100644 js/modules/preventionPlan.js create mode 100644 js/modules/risk.js create mode 100644 js/modules/riskAssessment.js create mode 100644 js/modules/riskSign.js create mode 100644 js/modules/task.js create mode 100644 js/modules/ticket.js create mode 100644 js/modules/user.js diff --git a/gulpfile.js b/gulpfile.js index e2bd6e54c..78c730af9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,34 +1,33 @@ 'use strict'; var gulp = require('gulp'); -var watch = require('gulp-watch'); -var concat = require('gulp-concat'); var sass = require('gulp-sass')(require('sass')); var rename = require('gulp-rename'); var uglify = require('gulp-uglify'); -var autoprefixer = require('gulp-autoprefixer'); +var concat = require('gulp-concat'); var paths = { scss_core : [ 'css/scss/**/*.scss', 'css/' ], + js_backend: [ 'js/digiriskdolibarr.js', 'js/modules/*.js' ] }; /** Core */ -gulp.task( 'scss_core', function () { - return gulp.src(paths.scss_core[0]) - .pipe(sass({ 'outputStyle': 'expanded' }).on('error', sass.logError)) - .pipe( autoprefixer({ - browsers: ['last 2 versions'], - cascade: false - }) ) - .pipe(rename('./digiriskdolibarr.css')) - .pipe(gulp.dest(paths.scss_core[1])) +gulp.task( 'scss_core', function() { + return gulp.src( paths.scss_core[0] ) .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError)) .pipe(rename('./digiriskdolibarr.min.css')) - .pipe(gulp.dest(paths.scss_core[1])); + .pipe(gulp.dest( paths.scss_core[1])); }); +gulp.task('js_backend', function () { + return gulp.src(paths.js_backend) + .pipe(concat('digiriskdolibarr.min.js')) + .pipe(uglify()) + .pipe(gulp.dest('./js/')) // It will create folder client.min.js +}); /** Watch */ -gulp.task( 'default', function () { +gulp.task('default', function() { gulp.watch(paths.scss_core[0], gulp.series('scss_core')); + gulp.watch(paths.js_backend[1], gulp.series('js_backend')); }); diff --git a/js/digiriskdolibarr.js b/js/digiriskdolibarr.js index 069f87dbf..b57475d16 100644 --- a/js/digiriskdolibarr.js +++ b/js/digiriskdolibarr.js @@ -1,46 +1,28 @@ -/* Copyright (C) 2022 EVARISK - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * Library javascript to enable Browser notifications - */ +/* Javascript library of module DigiriskDolibarr */ /** - * \file js/digiriskdolibarr.js - * \ingroup digiriskdolibarr - * \brief JavaScript file for module DigiriskDolibarr. + * @namespace DigiriskDolibarr_Framework_Init + * + * @author Evarisk + * @copyright 2015-2023 Evarisk */ - -/* Javascript library of module DigiriskDolibarr */ - 'use strict'; /** * @namespace EO_Framework_Init * - * @author Eoxia - * @copyright 2015-2021-2023 EVARISK + * @author Evarisk + * @copyright 2015-2021 Evarisk */ -if ( ! window.eoxiaJS ) { +if ( ! window.digiriskdolibarr ) { /** - * [eoxiaJS description] + * [digiriskdolibarr description] * * @memberof EO_Framework_Init * * @type {Object} */ - window.eoxiaJS = {}; + window.digiriskdolibarr = {}; /** * [scriptsLoaded description] @@ -49,10 +31,10 @@ if ( ! window.eoxiaJS ) { * * @type {Boolean} */ - window.eoxiaJS.scriptsLoaded = false; + window.digiriskdolibarr.scriptsLoaded = false; } -if ( ! window.eoxiaJS.scriptsLoaded ) { +if ( ! window.digiriskdolibarr.scriptsLoaded ) { /** * [description] * @@ -60,8 +42,8 @@ if ( ! window.eoxiaJS.scriptsLoaded ) { * * @returns {void} [description] */ - window.eoxiaJS.init = function() { - window.eoxiaJS.load_list_script(); + window.digiriskdolibarr.init = function() { + window.digiriskdolibarr.load_list_script(); }; /** @@ -71,25 +53,25 @@ if ( ! window.eoxiaJS.scriptsLoaded ) { * * @returns {void} [description] */ - window.eoxiaJS.load_list_script = function() { - if ( ! window.eoxiaJS.scriptsLoaded) { + window.digiriskdolibarr.load_list_script = function() { + if ( ! window.digiriskdolibarr.scriptsLoaded) { var key = undefined, slug = undefined; - for ( key in window.eoxiaJS ) { + for ( key in window.digiriskdolibarr ) { - if ( window.eoxiaJS[key].init ) { - window.eoxiaJS[key].init(); + if ( window.digiriskdolibarr[key].init ) { + window.digiriskdolibarr[key].init(); } - for ( slug in window.eoxiaJS[key] ) { + for ( slug in window.digiriskdolibarr[key] ) { - if ( window.eoxiaJS[key] && window.eoxiaJS[key][slug] && window.eoxiaJS[key][slug].init ) { - window.eoxiaJS[key][slug].init(); + if ( window.digiriskdolibarr[key] && window.digiriskdolibarr[key][slug] && window.digiriskdolibarr[key][slug].init ) { + window.digiriskdolibarr[key][slug].init(); } } } - window.eoxiaJS.scriptsLoaded = true; + window.digiriskdolibarr.scriptsLoaded = true; } }; @@ -100,24 +82,24 @@ if ( ! window.eoxiaJS.scriptsLoaded ) { * * @returns {void} [description] */ - window.eoxiaJS.refresh = function() { + window.digiriskdolibarr.refresh = function() { var key = undefined; var slug = undefined; - for ( key in window.eoxiaJS ) { - if ( window.eoxiaJS[key].refresh ) { - window.eoxiaJS[key].refresh(); + for ( key in window.digiriskdolibarr ) { + if ( window.digiriskdolibarr[key].refresh ) { + window.digiriskdolibarr[key].refresh(); } - for ( slug in window.eoxiaJS[key] ) { + for ( slug in window.digiriskdolibarr[key] ) { - if ( window.eoxiaJS[key] && window.eoxiaJS[key][slug] && window.eoxiaJS[key][slug].refresh ) { - window.eoxiaJS[key][slug].refresh(); + if ( window.digiriskdolibarr[key] && window.digiriskdolibarr[key][slug] && window.digiriskdolibarr[key][slug].refresh ) { + window.digiriskdolibarr[key][slug].refresh(); } } } }; - $( document ).ready( window.eoxiaJS.init ); + $( document ).ready( window.digiriskdolibarr.init ); } /** @@ -699,7 +681,7 @@ window.eoxiaJS.dropdown.toggleAngleClass = function( button ) { /** * @namespace EO_Framework_Tooltip * - * @author Eoxia + * @author Eoxia * @copyright 2015-2018 Eoxia */ @@ -825,7 +807,7 @@ if ( ! window.eoxiaJS.tooltip ) { /** * @namespace EO_Framework_Loader * - * @author Eoxia + * @author Eoxia * @copyright 2015-2018 Eoxia */ diff --git a/js/digiriskdolibarr.min.js b/js/digiriskdolibarr.min.js new file mode 100644 index 000000000..1c8d0bf12 --- /dev/null +++ b/js/digiriskdolibarr.min.js @@ -0,0 +1 @@ +"use strict";window.digiriskdolibarr||(window.digiriskdolibarr={},window.digiriskdolibarr.scriptsLoaded=!1),window.digiriskdolibarr.scriptsLoaded||(window.digiriskdolibarr.init=function(){window.digiriskdolibarr.load_list_script()},window.digiriskdolibarr.load_list_script=function(){if(!window.digiriskdolibarr.scriptsLoaded){var i=void 0,e=void 0;for(i in window.digiriskdolibarr)for(e in window.digiriskdolibarr[i].init&&window.digiriskdolibarr[i].init(),window.digiriskdolibarr[i])window.digiriskdolibarr[i]&&window.digiriskdolibarr[i][e]&&window.digiriskdolibarr[i][e].init&&window.digiriskdolibarr[i][e].init();window.digiriskdolibarr.scriptsLoaded=!0}},window.digiriskdolibarr.refresh=function(){var i=void 0,e=void 0;for(i in window.digiriskdolibarr)for(e in window.digiriskdolibarr[i].refresh&&window.digiriskdolibarr[i].refresh(),window.digiriskdolibarr[i])window.digiriskdolibarr[i]&&window.digiriskdolibarr[i][e]&&window.digiriskdolibarr[i][e].refresh&&window.digiriskdolibarr[i][e].refresh()},$(document).ready(window.digiriskdolibarr.init)),window.digiriskdolibarr.accident={},window.digiriskdolibarr.accident.init=function(){window.digiriskdolibarr.accident.event()},window.digiriskdolibarr.accident.event=function(){$(document).on("submit",".sendfile",window.digiriskdolibarr.accident.tmpStockFile),$(document).on("click",".linked-file-delete-workstop",window.digiriskdolibarr.accident.removeFile),$(document).on("change","#external_accident",window.digiriskdolibarr.accident.showExternalAccidentLocation)},window.digiriskdolibarr.accident.tmpStockFile=function(e,i=""){var s=$("#sendfile").prop("files"),t=new FormData;for(let i=0;ii.json()).then(i=>{i=i[0].option.matrix[e];t.find(".risk-evaluation-calculated-cotation").find(".risk-evaluation-cotation").attr("data-scale",window.digiriskdolibarr.evaluation.getDynamicScale(i)),t.find(".risk-evaluation-calculated-cotation").find(".risk-evaluation-cotation span").text(i),t.find(".risk-evaluation-content").find(".risk-evaluation-seuil").val(i),window.digiriskdolibarr.risk.haveDataInInput(t)})}},window.digiriskdolibarr.evaluator={},window.digiriskdolibarr.evaluator.init=function(){window.digiriskdolibarr.evaluator.event()},window.digiriskdolibarr.evaluator.event=function(){$(document).on("click",".evaluator-create",window.digiriskdolibarr.evaluator.createEvaluator),$(document).on("change","#fk_user_employer",window.digiriskdolibarr.evaluator.selectUser)},window.digiriskdolibarr.evaluator.selectUser=function(i){var e=window.saturne.toolbox.getToken(),s=$(this).closest(".modal-container"),t=s.find("#fk_user_employer").val();window.saturne.loader.display(s.find('input[name="evaluatorJob"]')),$.ajax({url:document.URL+"&action=getEvaluatorJob&token="+e,type:"POST",processData:!1,data:JSON.stringify({userID:t}),contentType:!1,success:function(i){s.find('input[name="evaluatorJob"]').val($(i).find('input[name="evaluatorJob"]').val()),s.find('input[name="evaluatorJob"]').removeClass("wpeo-loader")},error:function(i){}}),window.digiriskdolibarr.evaluator.haveDataInInput(s)},window.digiriskdolibarr.evaluator.haveDataInInput=function(i){i=i.parent().parent();i.hasClass("evaluator-add-modal")&&(0 div:nth-child(1)").text();$.ajax({url:document.URL+"&action=saveRisk&token="+e,type:"POST",processData:!1,data:JSON.stringify({riskID:t,category:s,comment:r,newParent:o}),contentType:!1,success:function(i){$(".wpeo-loader").removeClass("wpeo-loader");var e=$(".messageSuccessRiskEdit"),s=(o==a||n?($(".modal-active").removeClass("modal-active"),$(".risk-description-"+t).html($(i).find(".risk-description-"+t)),$(".risk-row-content-"+t).find(".risk-category .cell-risk").html($(i).find(".risk-row-content-"+t).find(".risk-category .cell-risk").children()),$(".risk-row-content-"+t).find(".risk-category").fadeOut(800),$(".risk-row-content-"+t).find(".risk-category").fadeIn(800),$(".risk-row-content-"+t).find(".risk-description-"+t).fadeOut(800),$(".risk-row-content-"+t).find(".risk-description-"+t).fadeIn(800)):$(".risk-row-content-"+t).fadeOut(800,function(){$(".fichecenter .opacitymedium.colorblack.paddingleft").html($(i).find("#searchFormListRisks .opacitymedium.colorblack.paddingleft"))}),""),s=(s=(s+=e.find(".valueForEditRisk1").val())+d)+e.find(".valueForEditRisk2").val();e.find("a").attr("href","#risk_row_"+t),e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")},error:function(i){var e=$(".messageErrorRiskEdit"),s="",s=(s=(s+=e.find(".valueForEditRisk1").val())+d)+e.find(".valueForEditRisk2").val();e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")}})},window.digiriskdolibarr.risk.unlinkSharedRisk=function(i){var e=window.saturne.toolbox.getToken();let s=$(this).attr("value"),t=(window.saturne.loader.display($(this)),$(".risk_row_"+s).find(".risk-container > div:nth-child(1)").text());var a=document.URL.split(/#/);$.ajax({url:a[0]+"&action=unlinkSharedRisk&token="+e,type:"POST",processData:!1,data:JSON.stringify({riskID:s}),contentType:!1,success:function(i){$(".confirmquestions").html($(i).find(".confirmquestions").children()),$(".fichecenter.sharedrisklist .opacitymedium.colorblack.paddingleft").html($(i).find("#searchFormSharedListRisks .opacitymedium.colorblack.paddingleft"));var i=$(".messageSuccessRiskUnlinkShared"),e=($("#risk_row_"+s).fadeOut(800),""),e=(e=(e+=i.find(".valueForUnlinkSharedRisk1").val())+t)+i.find(".valueForUnlinkSharedRisk2").val();i.find(".notice-subtitle .text").text(e),i.removeClass("hidden")},error:function(i){var e=$(".messageErrorRiskUnlinkShared"),s="",s=(s=(s+=e.find(".valueForUnlinkSharedRisk1").val())+t)+e.find(".valueForUnlinkSharedRisk2").val();e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")}})},window.digiriskdolibarr.risk.sharedRiskBoxLoader=function(i){"Oui"==$(this).text()&&window.saturne.loader.display($("#searchFormSharedListRisks"))},window.digiriskdolibarr.evaluation={},window.digiriskdolibarr.evaluation.init=function(){window.digiriskdolibarr.evaluation.event()},window.digiriskdolibarr.evaluation.event=function(){$(document).on("click",".select-evaluation-method",window.digiriskdolibarr.evaluation.selectEvaluationMethod),$(document).on("click",".cotation-container .risk-evaluation-cotation.cotation",window.digiriskdolibarr.evaluation.selectSeuil),$(document).on("click",".risk-evaluation-create",window.digiriskdolibarr.evaluation.createEvaluation),$(document).on("click",".risk-evaluation-save",window.digiriskdolibarr.evaluation.saveEvaluation),$(document).on("click",".risk-evaluation-delete",window.digiriskdolibarr.evaluation.deleteEvaluation)},window.digiriskdolibarr.evaluation.selectEvaluationMethod=function(i){var e=$(this).closest(".modal-container");0"+e.split(/\(/)[0]+"("+(+s-1)+")"),s-1<1&&$(".fichecenter.risklist").html($(i).find("#searchFormListRisks")),t.removeClass("wpeo-loader"),""),e=(e=(e+=r.find(".valueForDeleteEvaluation1").val())+n)+r.find(".valueForDeleteEvaluation2").val();r.find(".notice-subtitle .text").text(e),r.removeClass("hidden")},error:function(i){var e="",e=(e=(e+=o.find(".valueForDeleteEvaluation1").val())+n)+o.find(".valueForDeleteEvaluation2").val();o.find(".notice-subtitle .text").text(e),o.removeClass("hidden")}})}},window.digiriskdolibarr.evaluation.saveEvaluation=function(i){var e=window.saturne.toolbox.getToken();let s=$(this).closest(".risk-evaluation-edit-modal"),t=s.attr("value");var a=s.find(".risk-evaluation-comment textarea").val();let n=$(this).closest(".risk-row").find(".risk-evaluations-list-content").attr("value"),r=$(".risk-evaluation-ref-"+t).attr("value"),o=$(".risk-evaluation-list-modal-"+n),d=$("#risk_evaluation_list"+n).hasClass("modal-active");var a=window.digiriskdolibarr.risk.sanitizeBeforeRequest(a),l=s.find(".risk-evaluation-method").val(),c=s.find(".risk-evaluation-seuil").val(),k=s.find("#RiskAssessmentDateEdit"+t).val(),u=s.find(".risk-evaluation-photo .filename").val();let m=[];Object.values($(".table-cell.active.cell-"+t)).forEach(function(i){-1<$(i).data("seuil")&&(m[$(i).data("type")]=$(i).data("seuil"))}),window.saturne.loader.display($(this)),$.ajax({url:document.URL+"&action=saveEvaluation&token="+e,type:"POST",processData:!1,data:JSON.stringify({cotation:c,comment:a,method:l,photo:u,date:k,evaluationID:t,criteres:{gravite:m.gravite||0,occurrence:m.occurrence||0,protection:m.protection||0,formation:m.formation||0,exposition:m.exposition||0}}),contentType:!1,success:function(i){$("#risk_evaluation_edit"+t).removeClass("modal-active"),0<$(i).find(".risk-evaluation-container.risk-evaluation-container-"+t+":not(.last-risk-assessment)").length?((d?($(".risk-evaluation-ref-"+t+":not(.last-risk-assessment)").fadeOut(800),$(".risk-evaluation-ref-"+t+":not(.last-risk-assessment)")):($(".risk-evaluation-container-"+t+":not(.last-risk-assessment)").fadeOut(800),$(".risk-evaluation-container-"+t+":not(.last-risk-assessment)"))).fadeIn(800),o.find(".risk-evaluation-ref-"+t).replaceWith($(i).find(".risk-evaluation-ref-"+t)),$(".risk-evaluation-container.risk-evaluation-container-"+t+":not(.last-risk-assessment)").replaceWith($(i).find(".risk-evaluation-container.risk-evaluation-container-"+t+":not(.last-risk-assessment)")),$("#risk_evaluation_add"+n).html($(i).find("#risk_evaluation_add"+n).children())):($(".div-table-responsive").html($(i).find(".div-table-responsive").children()),(d?($(".risk-evaluation-ref-"+t+":not(.last-risk-assessment)").fadeOut(800),$(".risk-evaluation-ref-"+t+":not(.last-risk-assessment)")):($(".risk-evaluation-container-"+t+":not(.last-risk-assessment)").fadeOut(800),$(".risk-evaluation-container-"+t+":not(.last-risk-assessment)"))).fadeIn(800)),$(".wpeo-loader").removeClass("wpeo-loader");var i=$(".messageSuccessEvaluationEdit"),e=(s.find("#risk_evaluation_edit"+t).removeClass("modal-active"),""),e=(e=(e+=i.find(".valueForEditEvaluation1").val())+r)+i.find(".valueForEditEvaluation2").val();i.find("a").attr("href","#risk_row_"+n),i.find(".notice-subtitle .text").text(e),i.removeClass("hidden")},error:function(){var i=$(".messageErrorEvaluationEdit"),e="",e=(e=(e+=i.find(".valueForEditEvaluation1").val())+r)+i.find(".valueForEditEvaluation2").val();i.find(".notice-subtitle .text").text(e),i.removeClass("hidden")}})},window.digiriskdolibarr.risksign={},window.digiriskdolibarr.risksign.init=function(){window.digiriskdolibarr.risksign.event()},window.digiriskdolibarr.risksign.event=function(){$(document).on("click",".risksign-category-danger .item, .wpeo-table .risksign-category-danger .item",window.digiriskdolibarr.risksign.selectRiskSign),$(document).on("click",".risksign-create:not(.button-disable)",window.digiriskdolibarr.risksign.createRiskSign),$(document).on("click",".risksign-save",window.digiriskdolibarr.risksign.saveRiskSign),$(document).on("click",".risksign-unlink-shared",window.digiriskdolibarr.risksign.unlinkSharedRiskSign)},window.digiriskdolibarr.risksign.selectRiskSign=function(i){var e=$(this),e=(e.closest(".content").removeClass("active"),e.closest(".wpeo-dropdown").find(".dropdown-toggle span").hide(),e.closest(".wpeo-dropdown").find(".dropdown-toggle img").show(),e.closest(".wpeo-dropdown").find(".dropdown-toggle img").attr("src",e.find("img").attr("src")),e.closest(".wpeo-dropdown").find(".dropdown-toggle img").attr("aria-label",e.closest(".wpeo-tooltip-event").attr("aria-label")),e.closest(".fichecenter").find(".input-hidden-danger").val(e.data("id")),$(this).closest(".modal-container"));window.digiriskdolibarr.risksign.haveDataInInput(e)},window.digiriskdolibarr.risksign.haveDataInInput=function(i){i=i.parent().parent();i.hasClass("risksign-add-modal")&&0<=i.find('input[name="risksign_category_id"]').val()&&i.find(".button-disable").removeClass("button-disable")},window.digiriskdolibarr.risksign.createRiskSign=function(i){var e=window.saturne.toolbox.getToken(),s=$(this).closest(".fichecenter").find(".risksign-content"),t=s.find(".risksign-category input").val(),s=s.find(".risksign-description textarea").val();window.saturne.loader.display($(".fichecenter.risksignlist")),$.ajax({url:document.URL+"&action=add&token="+e,type:"POST",data:JSON.stringify({riskSignCategory:t,riskSignDescription:s}),processData:!1,contentType:!1,success:function(i){$(".fichecenter.risksignlist").html($(i).find("#searchFormListRiskSigns"));var e=$(".messageSuccessRiskSignCreate");$(".fichecenter.risksignlist").removeClass("wpeo-loader"),e.html($(i).find(".risksign-create-success-notice")),e.removeClass("hidden")},error:function(i){var e=$(".messageErrorRiskCreate");e.html($(i).find(".risksign-create-error-notice")),e.removeClass("hidden")}})},window.digiriskdolibarr.risksign.saveRiskSign=function(i){var e=window.saturne.toolbox.getToken(),s=$(this).attr("value");let t=$(this).closest(".risksign-container").find(".risksign-content"),a="";var n=t.find(".risksign-category input").val(),r=t.find(".risksign-description textarea").val();let o=$(".risksign_row_"+s).find(".risksign-container > div:nth-child(1)").text();window.saturne.loader.display(t),$.ajax({url:document.URL+"&action=saveRiskSign&token="+e,data:JSON.stringify({riskSignID:s,riskSignCategory:n,riskSignDescription:r}),type:"POST",processData:!1,contentType:!1,success:function(i){$(".fichecenter.risksignlist").html($(i).find("#searchFormListRiskSigns"));i=$(".messageSuccessRiskSignEdit");t.removeClass("wpeo-loader"),a=(a=(a+=i.find(".valueForEditRiskSign1").val())+o)+i.find(".valueForEditRiskSign2").val(),i.find(".notice-subtitle .text").text(a),i.removeClass("hidden")},error:function(){var i=$(".messageErrorRiskSignEdit");t.removeClass("wpeo-loader"),a=(a=(a+=i.find(".valueForEditRiskSign1").val())+o)+i.find(".valueForEditRiskSign2").val(),i.find(".notice-subtitle .text").text(a),i.removeClass("hidden")}})},window.digiriskdolibarr.risksign.unlinkSharedRiskSign=function(i){var e=window.saturne.toolbox.getToken();let s=$(this).attr("value"),t=(window.saturne.loader.display($(this)),$(".risksign_row_"+s).find(".risksign-container > div:nth-child(1)").text());var a=document.URL.split(/#/);$.ajax({url:a[0]+"&action=unlinkSharedRiskSign&token="+e,type:"POST",processData:!1,data:JSON.stringify({risksignID:s}),contentType:!1,success:function(i){$(".fichecenter.sharedrisksignlist .opacitymedium.colorblack.paddingleft").html($(i).find("#searchFormSharedListRiskSigns .opacitymedium.colorblack.paddingleft"));var i=$(".messageSuccessRiskSignUnlinkShared"),e=($("#risksign_row_"+s).fadeOut(800),""),e=(e=(e+=i.find(".valueForUnlinkSharedRiskSign1").val())+t)+i.find(".valueForUnlinkSharedRiskSign2").val();i.find(".notice-subtitle .text").text(e),i.removeClass("hidden")},error:function(i){var e=$(".messageErrorRiskSignUnlinkShared"),s="",s=(s=(s+=e.find(".valueForUnlinkSharedRiskSign1").val())+t)+e.find(".valueForUnlinkSharedRiskSign2").val();e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")}})},window.digiriskdolibarr.riskassessmenttask={},window.digiriskdolibarr.riskassessmenttask.init=function(){window.digiriskdolibarr.riskassessmenttask.event()},window.digiriskdolibarr.riskassessmenttask.event=function(){$(document).on("input",".riskassessment-task-label",window.digiriskdolibarr.riskassessmenttask.fillRiskAssessmentTaskLabel),$(document).on("click",".riskassessment-task-create",window.digiriskdolibarr.riskassessmenttask.createRiskAssessmentTask),$(document).on("click",".riskassessment-task-save",window.digiriskdolibarr.riskassessmenttask.saveRiskAssessmentTask),$(document).on("click",".riskassessment-task-delete",window.digiriskdolibarr.riskassessmenttask.deleteRiskAssessmentTask),$(document).on("click",".riskassessment-task-timespent-create",window.digiriskdolibarr.riskassessmenttask.createRiskAssessmentTaskTimeSpent),$(document).on("click",".riskassessment-task-timespent-save",window.digiriskdolibarr.riskassessmenttask.saveRiskAssessmentTaskTimeSpent),$(document).on("click",".riskassessment-task-timespent-delete",window.digiriskdolibarr.riskassessmenttask.deleteRiskAssessmentTaskTimeSpent),$(document).on("click",".riskassessment-task-progress-checkbox:not(.riskassessment-task-progress-checkbox-readonly)",window.digiriskdolibarr.riskassessmenttask.checkTaskProgress),$(document).on("change","#RiskassessmentTaskTimespentDatehour",window.digiriskdolibarr.riskassessmenttask.selectRiskassessmentTaskTimespentDateHour),$(document).on("change","#RiskassessmentTaskTimespentDatemin",window.digiriskdolibarr.riskassessmenttask.selectRiskassessmentTaskTimespentDateMin),$(document).on("keyup",".riskassessment-task-label",window.digiriskdolibarr.riskassessmenttask.checkRiskassessmentTaskLabelLength),$(document).on("click",".listingHeaderTaskTooltip",window.digiriskdolibarr.riskassessmenttask.redirectOnSharedTaskConfig)},window.digiriskdolibarr.riskassessmenttask.fillRiskAssessmentTaskLabel=function(i){var e=$(this).closest(".modal-container");window.digiriskdolibarr.riskassessmenttask.haveDataInInput(e)},window.digiriskdolibarr.riskassessmenttask.haveDataInInput=function(i){i=i.parent().parent();i.hasClass("riskassessment-task-add-modal")&&i.find('input[name="label"]').val().length&&i.find(".button-disable").removeClass("button-disable")},window.digiriskdolibarr.riskassessmenttask.createRiskAssessmentTask=function(i){var e=window.saturne.toolbox.getToken(),t=$(this).attr("value"),s=$(this).closest(".riskassessment-task-add-modal").find(".riskassessment-task-container"),a=s.find(".riskassessment-task-label").val(),a=window.digiriskdolibarr.risk.sanitizeBeforeRequest(a),n=s.find("#RiskassessmentTaskDateStart"+t).val(),r=s.find("#RiskassessmentTaskDateStart"+t+"hour").val(),o=s.find("#RiskassessmentTaskDateStart"+t+"min").val(),d=s.find("#RiskassessmentTaskDateEnd"+t).val(),l=s.find("#RiskassessmentTaskDateEnd"+t+"hour").val(),c=s.find("#RiskassessmentTaskDateEnd"+t+"min").val(),s=s.find(".riskassessment-task-budget").val();window.saturne.loader.display($(this)),window.saturne.loader.display($(".riskassessment-tasks"+t)),$.ajax({url:document.URL+"&action=addRiskAssessmentTask&token="+e,type:"POST",data:JSON.stringify({tasktitle:a,dateStart:n,hourStart:r,minStart:o,dateEnd:d,hourEnd:l,minEnd:c,budget:s,riskToAssign:t}),processData:!1,contentType:!1,success:function(i){$(".tasks-list-container-"+t).replaceWith($(i).find(".tasks-list-container-"+t));var e=$(".messageSuccessTaskCreate");$(".riskassessment-tasks"+t).fadeOut(800),$(".riskassessment-tasks"+t).fadeIn(800),e.find("a").attr("href","#risk_row_"+t),e.html($(i).find(".task-create-success-notice")),e.removeClass("hidden")},error:function(i){$(".wpeo-loader").removeClass("wpeo-loader"),window.scrollTo(0,0);var i=JSON.parse(i.responseText),e=$(".messageErrorTaskCreate"),s=($("#risk_assessment_task_add"+t).removeClass("modal-active"),""),s=(s=(s+=e.find(".valueForCreateTask1").val())+e.find(".valueForCreateTask2").val())+" : "+i.message;e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")}})},window.digiriskdolibarr.riskassessmenttask.deleteRiskAssessmentTask=function(i){var e=window.saturne.toolbox.getToken(),s=$(this).closest(".riskassessment-tasks");let t=$(this).closest(".riskassessment-tasks").attr("value"),a=$(this).attr("value");s=s.find(".labelForDelete").val();let n=$(".messageSuccessTaskDelete"),r=$(".messageErrorTaskDelete");if(1!=confirm(s))return!1;{let s=$(".riskassessment-task-container-"+a).attr("value");window.saturne.loader.display($(".riskassessment-task-container-"+a)),$.ajax({url:document.URL+"&action=deleteRiskAssessmentTask&deletedRiskAssessmentTaskId="+a+"&token="+e,type:"POST",processData:!1,contentType:!1,success:function(i){$(".riskassessment-task-container-"+a).closest(".riskassessment-task-listing-wrapper").html($(i).find(".tasks-list-container-"+t).find(".riskassessment-task-listing-wrapper")),$(".riskassessment-tasks"+t).fadeOut(800),$(".riskassessment-tasks"+t).fadeIn(800);i="",i=(i=(i+=n.find(".valueForDeleteTask1").val())+s)+n.find(".valueForDeleteTask2").val();n.find("a").attr("href","#risk_row_"+t),n.find(".notice-subtitle .text").text(i),n.removeClass("hidden")},error:function(i){$(".wpeo-loader").removeClass("wpeo-loader"),window.scrollTo(0,0);var i=JSON.parse(i.responseText),e="",e=(e=(e=(e+=r.find(".valueForDeleteTask1").val())+s)+r.find(".valueForDeleteTask2").val())+" : "+i.message;r.find(".notice-subtitle .text").text(e),r.removeClass("hidden")}})}},window.digiriskdolibarr.riskassessmenttask.saveRiskAssessmentTask=function(i){var e=window.saturne.toolbox.getToken();let s=$(this).attr("value");var t=$(this).closest(".modal-container");let a=$(this).closest(".riskassessment-tasks").attr("value"),n="";var r=t.find(".riskassessment-task-label"+s).val(),r=window.digiriskdolibarr.risk.sanitizeBeforeRequest(r);let o=$(".riskassessment-task-single-"+s+" .riskassessment-task-reference").attr("value"),d=0;t.find(".riskassessment-task-progress-checkbox"+s).is(":checked")&&(d=1);var l=t.find("#RiskassessmentTaskDateStart"+s).val(),c=t.find("#RiskassessmentTaskDateStart"+s+"hour").val(),k=t.find("#RiskassessmentTaskDateStart"+s+"min").val(),u=t.find("#RiskassessmentTaskDateEnd"+s).val(),m=t.find("#RiskassessmentTaskDateEnd"+s+"hour").val(),v=t.find("#RiskassessmentTaskDateEnd"+s+"min").val(),t=t.find(".riskassessment-task-budget"+s).val();window.saturne.loader.display($(this)),window.saturne.loader.display($(".riskassessment-task-single-"+s)),$.ajax({url:document.URL+"&action=saveRiskAssessmentTask&token="+e,data:JSON.stringify({riskAssessmentTaskID:s,tasktitle:r,dateStart:l,hourStart:c,minStart:k,dateEnd:u,hourEnd:m,minEnd:v,budget:t,taskProgress:d}),type:"POST",processData:!1,contentType:!1,success:function(i){$("#risk_assessment_task_edit"+s).removeClass("modal-active"),$(".riskassessment-task-container-"+s).replaceWith($(i).find(".riskassessment-task-container-"+s).first());i=$(".messageSuccessTaskEdit");$(".riskassessment-tasks"+a).fadeOut(800),$(".riskassessment-tasks"+a).fadeIn(800),n=(n=(n+=i.find(".valueForEditTask1").val())+o)+i.find(".valueForEditTask2").val(),$(".wpeo-loader").removeClass("wpeo-loader"),$(".loader-spin").remove(),i.find("a").attr("href","#risk_row_"+a),i.find(".notice-subtitle .text").text(n),i.removeClass("hidden")},error:function(i){$(".wpeo-loader").removeClass("wpeo-loader"),window.scrollTo(0,0);var i=JSON.parse(i.responseText),e=$(".messageErrorTaskEdit");$("#risk_assessment_task_edit"+s).removeClass("modal-active"),$(".wpeo-loader").removeClass("wpeo-loader"),n=(n=(n=(n+=e.find(".valueForEditTask1").val())+o)+e.find(".valueForEditTask2").val()+" : ")+i.message,e.find(".notice-subtitle .text").text(n),e.removeClass("hidden")}})},window.digiriskdolibarr.riskassessmenttask.createRiskAssessmentTaskTimeSpent=function(i){var e=window.saturne.toolbox.getToken();let s=$(this).attr("value");var t=$(this).closest(".riskassessment-task-edit-modal"),a=t.find(".riskassessment-task-timespent-container");let n=t.find("riskassessment-task-single").attr("value"),r="",o=t.find(".riskassessment-task-reference").attr("value"),d=$(".id-container").find(".riskassessment-total-task-timespent-"+s);var t=a.find("#RiskassessmentTaskTimespentDate"+s).val(),l=a.find("#RiskassessmentTaskTimespentDate"+s+"hour").val(),c=a.find("#RiskassessmentTaskTimespentDate"+s+"min").val(),k=a.find(".riskassessment-task-timespent-comment").val(),k=window.digiriskdolibarr.risk.sanitizeBeforeRequest(k),a=a.find(".riskassessment-task-timespent-duration").val();window.saturne.loader.display($(this)),window.saturne.loader.display($(".riskassessment-task-single-"+s)),$.ajax({url:document.URL+"&action=addRiskAssessmentTaskTimeSpent&token="+e,type:"POST",data:JSON.stringify({taskID:s,date:t,hour:l,min:c,comment:k,duration:a}),processData:!1,contentType:!1,success:function(i){var e=$(".messageSuccessTaskTimeSpentCreate"+s);$(".riskassessment-tasks"+n).fadeOut(800),$(".riskassessment-tasks"+n).fadeIn(800),r=(r=(r+=e.find(".valueForCreateTaskTimeSpent1").val())+o)+e.find(".valueForCreateTaskTimeSpent2").val(),$(".riskassessment-task-timespent-container").find(".riskassessment-task-timespent-list-"+s).html($(i).find(".riskassessment-task-timespent-container").find(".riskassessment-task-timespent-list-"+s)),$(".riskassessment-task-container-"+s).closest(".riskassessment-tasks").html($(i).find(".riskassessment-task-container-"+s).closest(".riskassessment-tasks")),$(".loader-spin").remove(),$(".wpeo-loader").removeClass("wpeo-loader"),e.find(".notice-subtitle .text").text(r),e.removeClass("hidden"),d.html($(i).find(".modal-content").find(".riskassessment-total-task-timespent-"+s).first())},error:function(i){$(this).closest(".risk-row-content-"+n).removeClass("wpeo-loader");var e=$(".messageErrorTaskTimeSpentCreate"+s);e.html($(i).find(".task-timespent-create-error-notice")),e.removeClass("hidden")},complete:function(){$("#risk_assessment_task_edit"+s+".wpeo-modal").addClass("modal-active")}})},window.digiriskdolibarr.riskassessmenttask.deleteRiskAssessmentTaskTimeSpent=function(i){var e=window.saturne.toolbox.getToken();let a=$(this).closest(".riskassessment-task-timespent-list").attr("value"),n=$(this).attr("value");var s=$(this).attr("value"),t=$(this).closest(".riskassessment-task-timespent-"+n).find(".labelForDelete").val();let r=$(".id-container").first().find(".riskassessment-total-task-timespent-"+a);if(1!=confirm(t))return!1;{let t=$(".riskassessment-task-container-"+a).attr("value");window.saturne.loader.display($(this)),$.ajax({url:document.URL+"&action=deleteRiskAssessmentTaskTimeSpent&deletedRiskAssessmentTaskTimeSpentId="+s+"&token="+e,type:"POST",processData:!1,contentType:!1,success:function(i){var e=$(".messageSuccessTaskTimeSpentDelete"+a),s=($(".riskassessment-task-timespent-"+n).fadeOut(800),""),s=(s=(s+=e.find(".valueForDeleteTaskTimeSpent1").val())+t)+e.find(".valueForDeleteTaskTimeSpent2").val();e.find(".notice-subtitle .text").text(s),e.removeClass("hidden"),r.html($(i).find(".modal-content").find(".riskassessment-total-task-timespent-"+a).first())},error:function(i){var e=$(".messageErrorTaskDeleteTimeSpent"+a),s="",s=(s=(s+=e.find(".valueForDeleteTaskTimeSpent1").val())+t)+e.find(".valueForDeleteTaskTimeSpent2").val();e.find(".notice-subtitle .text").text(s),e.removeClass("hidden")}})}},window.digiriskdolibarr.riskassessmenttask.saveRiskAssessmentTaskTimeSpent=function(i){var e=window.saturne.toolbox.getToken();let s=$(this);var t=$(this).attr("value"),a=$(this).closest(".riskassessment-task-timespent-edit-modal").find(".riskassessment-task-timespent-container");let n=a.attr("value"),r="",o=$(".riskassessment-task-container-"+n).attr("value"),d=$(".id-container").first().find(".riskassessment-total-task-timespent-"+n);var l=a.find("#RiskassessmentTaskTimespentDateEdit"+t).val(),c=a.find("#RiskassessmentTaskTimespentDateEdit"+t+"hour").val(),k=a.find("#RiskassessmentTaskTimespentDateEdit"+t+"min").val(),u=a.find(".riskassessment-task-timespent-comment").val(),u=window.digiriskdolibarr.risk.sanitizeBeforeRequest(u),a=a.find(".riskassessment-task-timespent-duration").val();window.saturne.loader.display($(this)),window.saturne.loader.display($(".riskassessment-task-single-"+n)),$.ajax({url:document.URL+"&action=saveRiskAssessmentTaskTimeSpent&token="+e,data:JSON.stringify({riskAssessmentTaskTimeSpentID:t,taskID:n,date:l,hour:c,min:k,comment:u,duration:a}),type:"POST",processData:!1,contentType:!1,success:function(i){s.closest(".modal-active").removeClass("modal-active");var e=$(".messageSuccessTaskTimeSpentEdit"+n);$(".wpeo-loader").removeClass("wpeo-loader"),r=(r=(r+=e.find(".valueForEditTaskTimeSpent1").val())+o)+e.find(".valueForEditTaskTimeSpent2").val(),d.html($(i).find(".modal-content").find(".riskassessment-total-task-timespent-"+n).first()),$(".riskassessment-task-timespent-list-"+n).html($(i).find(".riskassessment-task-timespent-list-"+n).children()),e.find(".notice-subtitle .text").text(r),e.removeClass("hidden")},error:function(i){var e=$(".messageSuccessTaskTimeSpentEdit"+n);r=(r=(r+=e.find(".valueForEditTaskTimeSpent1").val())+o)+e.find(".valueForEditTaskTimeSpent2").val(),e.find(".notice-subtitle .text").text(r),e.removeClass("hidden")}})},window.digiriskdolibarr.riskassessmenttask.checkTaskProgress=function(i){var e=window.saturne.toolbox.getToken(),s=$(this).closest(".riskassessment-task-container"),t=s.find(".riskassessment-task-single-content").attr("value");let a=$(this).closest(".riskassessment-tasks").attr("value"),n="",r=s.attr("value"),o="";s.find(".riskassessment-task-progress-checkbox"+t).hasClass("progress-checkbox-check")?(o=0,s.find(".riskassessment-task-progress-checkbox"+t).toggleClass("progress-checkbox-check").toggleClass("progress-checkbox-uncheck")):s.find(".riskassessment-task-progress-checkbox"+t).hasClass("progress-checkbox-uncheck")&&(o=1,s.find(".riskassessment-task-progress-checkbox"+t).toggleClass("progress-checkbox-uncheck").toggleClass("progress-checkbox-check")),window.saturne.loader.display($(".riskassessment-task-single-"+t));s=window.location.href.replace(/#.*/,"");$.ajax({url:s+"&action=checkTaskProgress&token="+e,data:JSON.stringify({riskAssessmentTaskID:t,taskProgress:o}),type:"POST",processData:!1,contentType:!1,success:function(i){$(".fichecenter.risklist").html($(i).find("#searchFormListRisks"));i=$(".messageSuccessTaskEdit");$(".riskassessment-tasks"+a).fadeOut(800),$(".riskassessment-tasks"+a).fadeIn(800),n=(n=(n+=i.find(".valueForEditTask1").val())+r)+i.find(".valueForEditTask2").val(),i.find(".notice-subtitle .text").text(n),i.removeClass("hidden")},error:function(i){var e=$(".messageErrorTaskEdit");n=(n=(n+=e.find(".valueForEditTask1").val())+r)+e.find(".valueForEditTask2").val(),e.find(".notice-subtitle .text").text(n),e.removeClass("hidden")}})},window.digiriskdolibarr.riskassessmenttask.selectRiskassessmentTaskTimespentDateHour=function(i){$(this).closest(".nowraponall").find(".select-riskassessmenttask-timespent-datehour").remove(),$(this).before('{$("#sendFileForm").load(document.URL+n+"ticket_id="+a+" #fileLinkedTable")})},window.digiriskdolibarr.ticket.removeFile=function(i){let e=$(this).attr("value");e=e.replace("_mini","");var s=$("#ticket_id").val(),t=window.saturne.toolbox.getQuerySeparator();fetch(document.URL+t+"action=removefile&filetodelete="+e+"&ticket_id="+s,{method:"POST"}).then(i=>{$(this).parent().parent().hide()})},window.digiriskdolibarr.ticket.addDashBoardTicketInfo=function(){var i=window.saturne.toolbox.getToken(),e=$("#select2-boxcombo-container").attr("title"),s=e.split(" : ")[0],e=e.split(" : ")[2],t=window.saturne.toolbox.getQuerySeparator();$.ajax({url:document.URL+t+"action=adddashboardinfo&token="+i,type:"POST",processData:!1,data:JSON.stringify({digiriskelementID:s,catID:e}),contentType:!1,success:function(i){window.location.reload()},error:function(){}})},window.digiriskdolibarr.ticket.closeDashBoardTicketInfo=function(){var i=window.saturne.toolbox.getToken();let e=$(this);var s=e.attr("data-digiriskelementid"),t=e.attr("data-catid"),a=window.saturne.toolbox.getQuerySeparator();$.ajax({url:document.URL+a+"action=closedashboardinfo&token="+i,type:"POST",processData:!1,data:JSON.stringify({digiriskelementID:s,catID:t}),contentType:!1,success:function(i){e.closest(".box-flex-item").fadeOut(400),$(".add-widget-box").attr("style",""),$(".add-widget-box").html($(i).find(".add-widget-box").children())},error:function(){}})},window.digiriskdolibarr.ticket.checkValidEmail=function(){0==/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(this.value)?$(this).css("border","3px solid red"):$(this).css("border","3px solid green")},window.digiriskdolibarr.ticket.checkValidPhone=function(){0==/^(?:(?:(?:\+|00)\d{2}[\s]?(?:\(0\)[\s]?)?)|0){1}[1-9]{1}([\s.-]?)(?:\d{2}\1?){3}\d{2}$/.test(this.value)?$(this).css("border","3px solid red"):$(this).css("border","3px solid green")},window.digiriskdolibarr.digiriskusers={},window.digiriskdolibarr.digiriskusers.init=function(){window.digiriskdolibarr.digiriskusers.event()},window.digiriskdolibarr.digiriskusers.event=function(){$(document).on("input",".digirisk-users #firstname",window.digiriskdolibarr.digiriskusers.fillEmail),$(document).on("input",".digirisk-users #lastname",window.digiriskdolibarr.digiriskusers.fillEmail)},window.digiriskdolibarr.digiriskusers.fillEmail=function(i){var e=$(".digirisk-users #firstname").val(),s=$(".digirisk-users #lastname").val(),t=$(".input-domain-mail").val(),e=window.digiriskdolibarr.digiriskusers.removeDiacritics(e+"."+s+"@"+t).toLowerCase();$(".digirisk-users #email").val(e)},window.digiriskdolibarr.digiriskusers.removeDiacritics=function(i){for(var e="",s=i.normalize("NFD"),t=0,a=0;t 0 ? '&subaction=' + subaction : '' + + $.ajax({ + url: document.URL + '&action=sendfile&objectlineid=' + id + '&token=' + token + subactionPost, + type: "POST", + processData: false, + contentType: false, + data: formData, + success: function ( resp ) { + $('#sendFileForm' + id).html($(resp).find('#fileLinkedTable' + id)) + }, + error: function ( ) { + } + }); +}; + +/** + * Supprime le fichier sélectionné dans digiriskdolibarr/accident/accident_ref/workstop/__REF__ (temp ou ref du workstop) + * + * @since 8.5.0 + * @version 8.5.0 + * + * @return {void} + */ + +window.digiriskdolibarr.accident.removeFile = function( event ) { + let filetodelete = $(this).attr('value'); + let subActionPost = $(this).hasClass('edit-line') ? '&subaction=editline' : '' + + filetodelete = filetodelete.replace('_mini', '') + + let objectlineid = $(this).closest('.objectline').attr('value') + let token = window.saturne.toolbox.getToken(); + + $.ajax({ + url: document.URL + '&action=removefile&filetodelete=' + filetodelete + '&objectlineid=' + objectlineid + '&token=' + token + subActionPost, + type: "POST", + processData: false, + contentType: false, + success: function ( resp ) { + $('#sendFileForm' + objectlineid).html($(resp).find('#fileLinkedTable' + objectlineid)) + }, + error: function ( ) { + } + }); +}; + +/** + * Show external Accident location. + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.accident.showExternalAccidentLocation = function() { + let fkElementField = $(this).closest('.accident-table').find('.fk_element_field') + let fkSocField = $(this).closest('.accident-table').find('.fk_soc_field') + let accidentLocationField = $(this).closest('.accident-table').find('.accident_location_field') + let externalAccident = $(this).closest('.accident-table').find('#select2-external_accident-container').attr('title') + + switch (externalAccident) { + case 'Non': + fkElementField.attr('style', '') + fkSocField.attr('style', 'display:none') + accidentLocationField.attr('style', 'display:none') + fkElementField.removeClass('hidden') + fkSocField.addClass('hidden') + accidentLocationField.addClass('hidden') + break; + case 'Oui': + fkElementField.attr('style', 'display:none') + fkSocField.attr('style', '') + accidentLocationField.attr('style', 'display:none') + fkElementField.addClass('hidden') + fkSocField.removeClass('hidden') + accidentLocationField.addClass('hidden') + break; + case 'Autre': + fkElementField.attr('style', 'display:none') + fkSocField.attr('style', 'display:none') + accidentLocationField.attr('style', '') + fkElementField.addClass('hidden') + fkSocField.addClass('hidden') + accidentLocationField.removeClass('hidden') + break; + } +}; diff --git a/js/modules/button.js b/js/modules/button.js new file mode 100644 index 000000000..0d12589ab --- /dev/null +++ b/js/modules/button.js @@ -0,0 +1,45 @@ +/** + * Initialise l'objet "button" ainsi que la méthode "init" obligatoire pour la bibliothèque DigiriskDolibarr. + * + * @since 9.8.2 + * @version 9.8.2 + */ +window.digiriskdolibarr.button = {}; + +/** + * La méthode appelée automatiquement par la bibliothèque DigiriskDolibarr. + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.button.init = function() { + window.digiriskdolibarr.button.event(); +}; + +/** + * La méthode contenant tous les événements pour les buttons. + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.button.event = function() { + $( document ).on( 'click', '.wpeo-button:submit', window.digiriskdolibarr.button.addLoader ); + $( document ).on( 'click', '.auto-download', window.digiriskdolibarr.button.addLoader ); +}; + +/** + * Add loader on button + * + * @since 9.8.2 + * @version 9.8.2 + * + * @return {void} + */ +window.digiriskdolibarr.button.addLoader = function() { + window.saturne.loader.display($(this)); + $(this).toggleClass('button-blue button-disable'); +}; diff --git a/js/modules/dashboard.js b/js/modules/dashboard.js new file mode 100644 index 000000000..9ed3ab9ad --- /dev/null +++ b/js/modules/dashboard.js @@ -0,0 +1,95 @@ +/** + * Initialise l'objet "dashboard" ainsi que la méthode "init" obligatoire pour la bibliothèque DigiriskDolibarr. + * + * @since 1.1.0 + * @version 1.1.0 + */ +window.digiriskdolibarr.dashboard = {}; + +/** + * La méthode appelée automatiquement par la bibliothèque DigiriskDolibarr. + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.dashboard.init = function() { + window.digiriskdolibarr.dashboard.event(); +}; + +/** + * La méthode contenant tous les événements pour les dashboards. + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.dashboard.event = function() { + $( document ).on( 'change', '.add-dashboard-widget', window.digiriskdolibarr.dashboard.addDashBoardInfo ); + $( document ).on( 'click', '.close-dashboard-widget', window.digiriskdolibarr.dashboard.closeDashBoardInfo ); +}; + +/** + * Add widget dashboard info + * + * @since 9.5.0 + * @version 9.5.0 + * + * @return {void} + */ +window.digiriskdolibarr.dashboard.addDashBoardInfo = function() { + var dashboardWidgetForm = document.getElementById('dashBoardForm') + var formData = new FormData(dashboardWidgetForm) + let dashboardWidgetName = formData.get('boxcombo') + let querySeparator = window.saturne.toolbox.getQuerySeparator(document.URL) + let token = window.saturne.toolbox.getToken() + + $.ajax({ + url: document.URL + querySeparator + 'action=adddashboardinfo&token=' + token, + type: "POST", + processData: false, + data: JSON.stringify({ + dashboardWidgetName: dashboardWidgetName + }), + contentType: false, + success: function ( resp ) { + window.location.reload(); + }, + error: function ( ) { + } + }); +}; + +/** + * Close widget dashboard info + * + * @since 9.5.0 + * @version 9.5.0 + * + * @return {void} + */ +window.digiriskdolibarr.dashboard.closeDashBoardInfo = function() { + let box = $(this); + let dashboardWidgetName = box.attr('data-widgetname'); + let querySeparator = window.saturne.toolbox.getQuerySeparator(document.URL) + let token = window.saturne.toolbox.getToken() + + $.ajax({ + url: document.URL + querySeparator + 'action=closedashboardinfo&token='+token, + type: "POST", + processData: false, + data: JSON.stringify({ + dashboardWidgetName: dashboardWidgetName + }), + contentType: false, + success: function ( resp ) { + box.closest('.box-flex-item').fadeOut(400) + $('.add-widget-box').attr('style', '') + $('.add-widget-box').html($(resp).find('.add-widget-box').children()) + }, + error: function ( ) { + } + }); +}; diff --git a/js/modules/digiriskelement.js b/js/modules/digiriskelement.js new file mode 100644 index 000000000..93b739170 --- /dev/null +++ b/js/modules/digiriskelement.js @@ -0,0 +1,76 @@ + +/** + * Initialise l'objet "digiriskelement" ainsi que la méthode "init" obligatoire pour la bibliothèque DigiriskDolibarr. + * + * @since 9.8.2 + * @version 9.8.2 + */ +window.digiriskdolibarr.digiriskelement = {}; + +/** + * La méthode appelée automatiquement par la bibliothèque DigiriskDolibarr. + * + * @since 9.8.2 + * @version 9.8.2 + * + * @return {void} + */ +window.digiriskdolibarr.digiriskelement.init = function() { + window.digiriskdolibarr.digiriskelement.event(); +}; + +/** + * La méthode contenant tous les événements pour le digiriskelement. + * + * @since 9.8.2 + * @version 9.8.2 + * + * @return {void} + */ +window.digiriskdolibarr.digiriskelement.event = function() { + $( document ).on( 'click', '#select_all_shared_elements_by_digiriskelement', window.digiriskdolibarr.digiriskelement.selectAllSharedElementByDigiriskElement ); + $( document ).on( 'click', '#select_all_shared_elements', window.digiriskdolibarr.digiriskelement.selectAllSharedElements ); +}; + +/** + * Action select all shared elements by digiriskelement. + * + * @since 9.2.0 + * @version 9.8.2 + * + * @return {void} + */ +window.digiriskdolibarr.digiriskelement.selectAllSharedElementByDigiriskElement = function ( event ) { + let digiriskelementid = $(this).attr('name'); + if(this.checked) { + // Iterate each checkbox + $(this).closest('.ui-widget').find('.importsharedelement-digiriskelement-' + digiriskelementid).not(':disabled').each(function() { + this.checked = true; + }); + } else { + $(this).closest('.ui-widget').find('.importsharedelement-digiriskelement-' + digiriskelementid).not(':disabled').each(function() { + this.checked = false; + }); + } +}; + +/** + * Action select all shared elements. + * + * @since 9.2.0 + * @version 9.8.2 + * + * @return {void} + */ +window.digiriskdolibarr.digiriskelement.selectAllSharedElements = function ( event ) { + if(this.checked) { + // Iterate each checkbox + $(this).closest('.ui-widget').find(':checkbox').not(':disabled').not('#select_all_shared_elements_by_digiriskelement').each(function() { + this.checked = true; + }); + } else { + $(this).closest('.ui-widget').find(':checkbox').not(':disabled').not('#select_all_shared_elements_by_digiriskelement').each(function() { + this.checked = false; + }); + } +}; diff --git a/js/modules/document.js b/js/modules/document.js new file mode 100644 index 000000000..026240253 --- /dev/null +++ b/js/modules/document.js @@ -0,0 +1,62 @@ + +/** + * Initialise l'objet "signature" ainsi que la méthode "init" obligatoire pour la bibliothèque DigiriskDolibarr. + * + * @since 1.1.0 + * @version 1.1.0 + */ +window.digiriskdolibarr.document = {}; + +/** + * Initialise le canvas document + * + * @since 8.1.2 + * @version 8.1.2 + */ +window.digiriskdolibarr.document.canvas; + +/** + * Initialise le bouton document + * + * @since 8.1.2 + * @version 8.1.2 + */ +window.digiriskdolibarr.document.buttonSignature; + +/** + * La méthode appelée automatiquement par la bibliothèque DigiriskDolibarr. + * + * @since 8.1.2 + * @version 8.1.2 + * + * @return {void} + */ +window.digiriskdolibarr.document.init = function() { + window.digiriskdolibarr.document.event(); +}; + +/** + * La méthode contenant tous les événements pour les documents. + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.document.event = function() { + $( document ).on( 'click', '#builddoc_generatebutton', window.digiriskdolibarr.document.displayLoader ); + $( document ).on( 'click', '.pdf-generation', window.digiriskdolibarr.document.displayLoader ); + $( document ).on( 'click', '.send-risk-assessment-document-by-mail', window.digiriskdolibarr.document.displayLoader ); +}; + +/** + * Display loader on generation document. + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.document.displayLoader = function( ) { + window.saturne.loader.display($(this).closest('.div-table-responsive-no-min')); +}; diff --git a/js/modules/evaluationMethod.js b/js/modules/evaluationMethod.js new file mode 100644 index 000000000..fd08835bc --- /dev/null +++ b/js/modules/evaluationMethod.js @@ -0,0 +1,72 @@ + +/** + * Initialise l'objet "evaluationMethodEvarisk" ainsi que la méthode "init" obligatoire pour la bibliothèque DigiriskDolibarr. + * + * @since 1.0.0 + * @version 1.0.0 + */ +window.digiriskdolibarr.evaluationMethodEvarisk = {}; + +/** + * La méthode appelée automatiquement par la bibliothèque DigiriskDolibarr. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.evaluationMethodEvarisk.init = function() { + window.digiriskdolibarr.evaluationMethodEvarisk.event(); +}; + +/** + * La méthode contenant tous les événements pour le evaluation. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.evaluationMethodEvarisk.event = function() { + $( document ).on( 'click', '.wpeo-table.evaluation-method .table-cell.can-select', window.digiriskdolibarr.evaluationMethodEvarisk.selectSeuil ); +}; + +/** + * Select Seuil on advanced cotation. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @param {ClickEvent} event L'état du clic. + * @return {void} + */ +window.digiriskdolibarr.evaluationMethodEvarisk.selectSeuil = function( event ) { + $( this ).closest( '.table-row' ).find( '.active' ).removeClass( 'active' ); + $( this ).addClass( 'active' ); + + var element = $( this ); + var elementParent = element.closest('.modal-container'); + var evaluationID = element.data( 'evaluation-id' ); + + let criteres = []; + Object.values(elementParent.find('.table-cell.active.cell-'+evaluationID)).forEach(function(v) { + if ($(v).data( 'seuil' ) > -1) { + criteres.push($(v).data( 'seuil' )); + } + }); + + // Rend le bouton "active" et met à jour la cotation et la scale + if (criteres.length === 5) { + let cotationBeforeAdapt = criteres[0] * criteres[1] * criteres[2] * criteres[3] * criteres[4]; + + let root = window.location.pathname.split(/view/)[0] + + fetch(root + '/js/json/default.json').then(response => response.json()).then(data => { + let cotationAfterAdapt = data[0].option.matrix[cotationBeforeAdapt]; + elementParent.find('.risk-evaluation-calculated-cotation').find('.risk-evaluation-cotation').attr('data-scale', window.digiriskdolibarr.evaluation.getDynamicScale(cotationAfterAdapt)); + elementParent.find('.risk-evaluation-calculated-cotation').find('.risk-evaluation-cotation span').text(cotationAfterAdapt); + elementParent.find('.risk-evaluation-content').find('.risk-evaluation-seuil').val(cotationAfterAdapt); + window.digiriskdolibarr.risk.haveDataInInput(elementParent); + }) + } +}; diff --git a/js/modules/evaluator.js b/js/modules/evaluator.js new file mode 100644 index 000000000..59717cd31 --- /dev/null +++ b/js/modules/evaluator.js @@ -0,0 +1,145 @@ + +/** + * Initialise l'objet "évaluateur" ainsi que la méthode "init" obligatoire pour la bibliothèque DigiriskDolibarr. + * + * @since 1.0.0 + * @version 1.0.0 + */ +window.digiriskdolibarr.evaluator = {}; + +/** + * La méthode appelée automatiquement par la bibliothèque DigiriskDolibarr. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.evaluator.init = function() { + window.digiriskdolibarr.evaluator.event(); +}; + +/** + * La méthode contenant tous les événements pour l'évaluateur. + * + * @since 1.0.0 + * @version 9.6.0 + * + * @return {void} + */ +window.digiriskdolibarr.evaluator.event = function() { + $( document ).on( 'click', '.evaluator-create', window.digiriskdolibarr.evaluator.createEvaluator ); + $( document ).on( 'change', '#fk_user_employer', window.digiriskdolibarr.evaluator.selectUser ); +}; + +/** + * Clique sur une des user de la liste. + * + * @since 1.0.0 + * @version 9.6.0 + * + * @param {ClickEvent} event L'état du clic. + * @return {void} + */ +window.digiriskdolibarr.evaluator.selectUser = function( event ) { + let token = window.saturne.toolbox.getToken() + + var elementParent = $(this).closest('.modal-container') + let userID = elementParent.find('#fk_user_employer').val() + + window.saturne.loader.display(elementParent.find('input[name="evaluatorJob"]')); + + $.ajax({ + url: document.URL + '&action=getEvaluatorJob&token='+token, + type: "POST", + processData: false, + data: JSON.stringify({ + userID: userID + }), + contentType: false, + success: function ( resp ) { + elementParent.find('input[name="evaluatorJob"]').val($(resp).find('input[name="evaluatorJob"]').val()) + elementParent.find('input[name="evaluatorJob"]').removeClass('wpeo-loader') + }, + error: function ( resp ) { + } + }); + + // Rend le bouton "active". + window.digiriskdolibarr.evaluator.haveDataInInput(elementParent); +} + +/** + * Check value on evaluatorUser. + * + * @since 9.6.0 + * @version 9.6.0 + * + * @param elementParent --- Parent element + * @return {void} + */ +window.digiriskdolibarr.evaluator.haveDataInInput = function( elementParent ) { + var element = elementParent.parent().parent(); + + if (element.hasClass('evaluator-add-modal')) { + var evaluator_user = element.find('#fk_user_employer'); + if ( evaluator_user.val() > 0 ) { + element.find('.button-disable').removeClass('button-disable'); + } else { + element.find('.evaluator-create').addClass('button-disable'); + } + } +}; + +/** + * Action create evaluator. + * + * @since 1.0.0 + * @version 9.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.evaluator.createEvaluator = function ( event ) { + let token = window.saturne.toolbox.getToken() + + let elementEvaluator = $(this).closest('.fichecenter').find('.evaluator-content'); + + var userName = $('#select2-fk_user_employer-container').attr('title') + var userID = $('#fk_user_employer').find("option:contains('"+userName+"')").attr('value') + + var date = elementEvaluator.find('#EvaluatorDate').val(); + var duration = elementEvaluator.find('.evaluator-duration .duration').val(); + var job = elementEvaluator.find('.evaluatorJob').val(); + + let elementParent = $(this).closest('.fichecenter').find('.div-table-responsive'); + + window.saturne.loader.display(elementParent); + + $.ajax({ + url: document.URL + '&action=add&token='+token, + type: "POST", + data: JSON.stringify({ + evaluatorID: userID, + date: date, + duration: duration, + job: job + }), + processData: false, + contentType: false, + success: function ( resp ) { + $('.fichecenter').html($(resp).find('#searchFormList')) + + let actionContainerSuccess = $('.messageSuccessEvaluatorCreate'); + + actionContainerSuccess.find($(resp).find('.evaluator-create-success-notice')) + actionContainerSuccess.removeClass('hidden'); + }, + error: function ( resp ) { + let actionContainerError = $('.messageErrorEvaluatorCreate'); + + actionContainerError.find($(resp).find('.evaluator-create-error-notice')) + actionContainerError.removeClass('hidden'); + } + }); + +}; diff --git a/js/modules/form.js b/js/modules/form.js new file mode 100644 index 000000000..a123fd18d --- /dev/null +++ b/js/modules/form.js @@ -0,0 +1,88 @@ + +/** + * Initialise l'objet "form" ainsi que la méthode "init" obligatoire pour la bibliothèque DigiriskDolibarr. + * + * @since 9.8.0 + * @version 9.8.0 + */ +window.digiriskdolibarr.form = {}; + +/** + * La méthode appelée automatiquement par la bibliothèque DigiriskDolibarr. + * + * @since 9.8.0 + * @version 9.8.0 + * + * @return {void} + */ +window.digiriskdolibarr.form.init = function() { + window.digiriskdolibarr.form.event(); +}; + +/** + * La méthode contenant tous les événements pour les boutons. + * + * @since 9.8.0 + * @version 9.8.0 + * + * @return {void} + */ +window.digiriskdolibarr.form.event = function() { + $( document ).on( 'submit', '#searchFormListRisks, #searchFormInheritedListRisks, #searchFormSharedListRisks', window.digiriskdolibarr.form.searchForm ); +}; + +/** + * Enlève les valeurs d'input vides d'un formulaire. + * + * @since 9.8.0 + * @version 9.8.0 + * + * @return {void} + */ +window.digiriskdolibarr.form.searchForm = function(event) { + event.preventDefault() + + let formId = $(this).closest('form').attr('id'); + + var searchFormListRisks = document.getElementById(formId); + var formData = new FormData(searchFormListRisks); + let newFormData = new FormData(); + + let dataToSend = [ + 'token', + 'formfilteraction', + 'action', + 'id', + 'sortfield', + 'sortorder', + 'page', + 'contextpage', + 'limit', + 'toselect[]', + 'massaction', + 'confirm', + 'cancel', + 'pageplusone', + 'backtopage' + ] + + for (const pair of formData.entries()) { + if (dataToSend.includes(pair[0]) || pair[0].match(/search_/)) { + newFormData.append(pair[0], pair[1]) + } + } + + window.saturne.loader.display($('#' + formId)); + + $.ajax({ + url: document.URL, + type: "POST", + data: newFormData, + processData: false, + contentType: false, + success: function (resp) { + $('.wpeo-loader').removeClass('wpeo-loader'); + $('#' + formId).replaceWith($(resp).find('#' + formId)) + }, + }); +} diff --git a/js/modules/navigation.js b/js/modules/navigation.js new file mode 100644 index 000000000..d97c89ad7 --- /dev/null +++ b/js/modules/navigation.js @@ -0,0 +1,235 @@ + +/** + * Initialise l'objet "navigation" ainsi que la méthode "init" obligatoire pour la bibliothèque DigiriskDolibarr. + * + * @since 1.0.0 + * @version 1.0.0 + */ + +window.digiriskdolibarr.navigation = {}; + +/** + * La méthode appelée automatiquement par la bibliothèque DigiriskDolibarr. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.navigation.init = function() { + window.digiriskdolibarr.navigation.event(); +}; + +/** + * La méthode contenant tous les événements pour la navigation. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.navigation.event = function() { + // Main Menu Digirisk Society + $( document ).on( 'click', '.toggle-unit', window.digiriskdolibarr.navigation.switchToggle ); + $( document ).on( 'click', '#newGroupment', window.digiriskdolibarr.navigation.switchToggle ); + $( document ).on( 'click', '#newWorkunit', window.digiriskdolibarr.navigation.switchToggle ); + $( document ).on( 'click', '.digirisk-wrap .navigation-container .toolbar div', window.digiriskdolibarr.navigation.toggleAll ); + $( document ).on( 'click', '#slider', window.digiriskdolibarr.navigation.setUnitActive ); + $( document ).on( 'click', '#newGroupment', window.digiriskdolibarr.navigation.redirect ); + $( document ).on( 'click', '#newWorkunit', window.digiriskdolibarr.navigation.redirect ); + $( document ).on( 'click', '.side-nav-responsive', window.digiriskdolibarr.navigation.toggleMobileNav ); + $( document ).on( 'click', '.save-organization', window.digiriskdolibarr.navigation.saveOrganization ); +}; + +/** + * Gestion du toggle dans la navigation. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @param {MouseEvent} event Les attributs lors du clic. + * @return {void} + */ +window.digiriskdolibarr.navigation.switchToggle = function( event ) { + event.preventDefault(); + + var MENU = localStorage.menu + if (MENU == null || MENU == '') { + MENU = new Set() + } else { + MENU = JSON.parse(MENU) + MENU = new Set(MENU) + } + + if ( $( this ).find( '.toggle-icon' ).hasClass( 'fa-chevron-down' ) ) { + + $(this).find( '.toggle-icon' ).removeClass('fa-chevron-down').addClass('fa-chevron-right'); + var idUnToggled = $(this).closest('.unit').attr('id').split('unit')[1] + $(this).closest('.unit').removeClass('toggled'); + + MENU.delete(idUnToggled) + localStorage.setItem('menu', JSON.stringify(Array.from(MENU.keys()))) + + } else if ( $( this ).find( '.toggle-icon' ).hasClass( 'fa-chevron-right' ) ){ + + $(this).find( '.toggle-icon' ).removeClass('fa-chevron-right').addClass('fa-chevron-down'); + $(this).closest('.unit').addClass('toggled'); + + var idToggled = $(this).closest('.unit').attr('id').split('unit')[1] + MENU.add(idToggled) + localStorage.setItem('menu', JSON.stringify(Array.from(MENU.keys()))) + } + +}; + +/** + * Déplies ou replies tous les éléments enfants + * + * @since 1.0.0 + * @version 1.0.0 + * + * @param {MouseEvent} event Les attributs lors du clic + * @return {void} + */ +window.digiriskdolibarr.navigation.toggleAll = function( event ) { + event.preventDefault(); + + if ( $( this ).hasClass( 'toggle-plus' ) ) { + + $( '.digirisk-wrap .navigation-container .workunit-list .unit .toggle-icon').removeClass( 'fa-chevron-right').addClass( 'fa-chevron-down' ); + $( '.digirisk-wrap .navigation-container .workunit-list .unit' ).addClass( 'toggled' ); + + // local storage add all + let MENU = [] + $( '.digirisk-wrap .navigation-container .workunit-list .unit .title' ).get().map(function (v){ + MENU.push($(v).attr('value')) + }) + localStorage.setItem('menu', JSON.stringify(Array.from(MENU.values())) ); + } + + if ( $( this ).hasClass( 'toggle-minus' ) ) { + $( '.digirisk-wrap .navigation-container .workunit-list .unit.toggled' ).removeClass( 'toggled' ); + $( '.digirisk-wrap .navigation-container .workunit-list .unit .toggle-icon').addClass( 'fa-chevron-right').removeClass( 'fa-chevron-down' ); + + // local storage delete all + let emptyMenu = new Set('0'); + localStorage.setItem('menu', JSON.stringify(Object.values(emptyMenu)) ); + } +}; + +/** + * Ajout la classe 'active' à l'élément. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @param {MouseEvent} event Les attributs lors du clic. + * @return {void} + */ +window.digiriskdolibarr.navigation.setUnitActive = function( event ) { + + $( '.digirisk-wrap .navigation-container .unit.active' ).removeClass( 'active' ); + let id = $(this).attr('value'); + + $( this ).closest( '.unit' ).addClass( 'active' ); + $( this ).closest( '.unit' ).attr( 'value', id ); + +}; + +/** + * Redirection sur l'élément courant. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @param {MouseEvent} event Les attributs lors du clic. + * @return {booleen} + */ +window.digiriskdolibarr.navigation.redirect = function( event ) { + var URLToGo = ''; + var params = new window.URLSearchParams(window.location.search); + var id = $(params.get('id')) + + //get ID from div selected in left menu + history.pushState({ path: document.URL}, '', this.href); + //change URL without refresh + if (!id) { + URLToGo = document.URL.split('?id=')[0]; + } else { + URLToGo = document.URL; + } + $( this ).closest( '.side-nav' ).find( '#id-left' ).removeClass( 'active' ); + + //empty and fill object card + $.ajax({ + url: URLToGo, + success: function( resp ) { + $('#cardContent').html($(resp).find('#cardContent')) + }, + }); + return false; +}; + +/** + * Toggle la classe "active" sur le menu des GP/UT en mobile. + * + * @since 1.1.0 + * @version 1.1.0 + */ +window.digiriskdolibarr.navigation.toggleMobileNav = function( event ) { + $( this ).closest( '.side-nav' ).find( '#id-left' ).toggleClass( 'active' ); +} + +/** + * Permet de sauvegarder l'organisation des groupements et unités de travail + * + * @since 8.2.2 + * @version 8.2.2 + */ +window.digiriskdolibarr.navigation.saveOrganization = function( event ) { + let token = window.saturne.toolbox.getToken() + + let idArray = [] + let parentArray = [] + let id = 0 + let parent_id = 0 + + //Notices + let actionContainerSuccess = $('.messageSuccessOrganizationSaved'); + let actionContainerError = $('.messageErrorOrganizationSaved'); + + $('.route').each(function() { + id = $(this).attr('id') + parent_id = $(this).parent('ul').attr('id').split(/space/)[1] + + idArray.push(id) + parentArray.push(parent_id) + }) + + window.saturne.loader.display($(this)); + + //ajouter sécurité si le nombre de gp à la fin n'est pas le même qu'en bdd alors on stop tout + + $.ajax({ + url: document.URL + '&action=saveOrganization&ids='+idArray.toString()+'&parent_ids='+parentArray+'&token='+token, + success: function() { + actionContainerSuccess.removeClass('hidden'); + + $('.wpeo-loader').addClass('button-disable') + $('.wpeo-loader').attr('style','background: #47e58e !important;border-color: #47e58e !important;') + $('.wpeo-loader').find('.fas.fa-check').attr('style', '') + $("a").attr("onclick", "").unbind("click"); + + $('.wpeo-loader').removeClass('wpeo-loader') + }, + error: function ( ) { + actionContainerError.removeClass('hidden'); + + $('.wpeo-loader').addClass('button-disable') + $('.wpeo-loader').attr('style','background: #e05353 !important;border-color: #e05353 !important;') + $('.wpeo-loader').find('.fas.fa-times').attr('style', '') + + $('.wpeo-loader').removeClass('wpeo-loader') + } + }); +} diff --git a/js/modules/preventionPlan.js b/js/modules/preventionPlan.js new file mode 100644 index 000000000..23eaf6137 --- /dev/null +++ b/js/modules/preventionPlan.js @@ -0,0 +1,58 @@ + +/** + * Initialise l'objet "preventionplan" ainsi que la méthode "init" obligatoire pour la bibliothèque DigiriskDolibarr. + * + * @since 1.1.0 + * @version 1.1.0 + */ +window.digiriskdolibarr.preventionplan = {}; + +/** + * La méthode appelée automatiquement par la bibliothèque DigiriskDolibarr. + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.preventionplan.init = function() { + window.digiriskdolibarr.preventionplan.event(); +}; + +/** + * La méthode contenant tous les événements pour les preventionplans. + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.preventionplan.event = function() { + $( document ).on( 'click', '#prior_visit_bool', window.digiriskdolibarr.preventionplan.showDateAndText ); +}; + +/** + * Show date and text for prevention plan prior visit. + * + * @since 1.0.0 + * @version 9.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.preventionplan.showDateAndText = function() { + let dateField = $(this).closest('.preventionplan-table').find('.prior_visit_date_field') + let textField = $(this).closest('.preventionplan-table').find('.prior_visit_text_field') + + if (dateField.hasClass('hidden')) { + dateField.attr('style', '') + textField.attr('style', '') + dateField.removeClass('hidden') + textField.removeClass('hidden') + } else { + dateField.attr('style', 'display:none') + textField.attr('style', 'display:none') + dateField.addClass('hidden') + textField.addClass('hidden') + } + +}; diff --git a/js/modules/risk.js b/js/modules/risk.js new file mode 100644 index 000000000..c6bdce30e --- /dev/null +++ b/js/modules/risk.js @@ -0,0 +1,372 @@ + +/** + * Initialise l'objet "risk" ainsi que la méthode "init" obligatoire pour la bibliothèque DigiriskDolibarr. + * + * @since 1.0.0 + * @version 1.0.0 + */ +window.digiriskdolibarr.risk = {}; + +/** + * La méthode appelée automatiquement par la bibliothèque DigiriskDolibarr. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.risk.init = function() { + window.digiriskdolibarr.risk.event(); +}; + +/** + * La méthode contenant tous les événements pour le risk. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.risk.event = function() { + $( document ).on( 'click', '.category-danger .item, .wpeo-table .category-danger .item', window.digiriskdolibarr.risk.selectDanger ); + $( document ).on( 'click', '.risk-create:not(.button-disable)', window.digiriskdolibarr.risk.createRisk ); + $( document ).on( 'click', '.risk-save', window.digiriskdolibarr.risk.saveRisk ); + $( document ).on( 'click', '.risk-unlink-shared', window.digiriskdolibarr.risk.unlinkSharedRisk ); + $( document ).on( 'click', 'div[aria-describedby="dialog-confirm-actionButtonImportSharedRisks"] .ui-button.ui-corner-all.ui-widget', window.digiriskdolibarr.risk.sharedRiskBoxLoader ); +}; + +/** + * Lors du clic sur un riskCategory, remplaces le contenu du toggle et met l'image du risque sélectionné. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @param {MouseEvent} event [description] + * @return {void} + */ +window.digiriskdolibarr.risk.selectDanger = function( event ) { + var element = $(this); + + element.closest('.content').removeClass('active'); + element.closest('.wpeo-dropdown').find('.dropdown-toggle span').hide(); + element.closest('.wpeo-dropdown').find('.dropdown-toggle img').show(); + element.closest('.wpeo-dropdown').find('.dropdown-toggle img').attr('src', element.find('img').attr('src')); + element.closest('.wpeo-dropdown').find('.dropdown-toggle img').attr('aria-label', element.closest('.wpeo-tooltip-event').attr('aria-label')); + element.closest('.wpeo-dropdown').find('.input-hidden-danger').val(element.data('id')); + + var riskDescriptionPrefill = element.closest('.wpeo-dropdown').find('.input-risk-description-prefill').val(); + if (riskDescriptionPrefill == 1) { + element.closest('.risk-content').find('.risk-description textarea').text(element.closest('.wpeo-tooltip-event').attr('aria-label')); + } + var elementParent = $(this).closest('.modal-container'); + + // Rend le bouton "active". + window.digiriskdolibarr.risk.haveDataInInput(elementParent); +}; + +/** + * Check value on riskCategory and riskCotation. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @param elementParent --- Parent element + * @return {void} + */ +window.digiriskdolibarr.risk.haveDataInInput = function( elementParent ) { + var element = elementParent.parent().parent(); + var cotation = element.find('.risk-evaluation-seuil'); + + if (element.hasClass('risk-add-modal')) { + var category = element.find('input[name="risk_category_id"]') + if ( category.val() >= 0 && cotation.val() >= 0 ) { + element.find('.risk-create.button-disable').removeClass('button-disable'); + } + } else if (element.hasClass('risk-evaluation-add-modal')) { + if ( cotation.val() >= 0 ) { + element.find('.risk-evaluation-create.button-disable').removeClass('button-disable'); + } + } +}; + +/** + * Sanitize request before send. + * + * @since 1.0.0 + * @version 9.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.risk.sanitizeBeforeRequest = function ( text ) { + if (typeof text == 'string') { + if (text.match(/"/)) { + return text.split(/"/).join('') + } + } + return text +} + +/** + * Action create risk. + * + * @since 1.0.0 + * @version 9.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.risk.createRisk = function ( event ) { + let token = window.saturne.toolbox.getToken() + + let elementRisk = $(this).closest('.fichecenter').find('.risk-content'); + let elementEvaluation = $(this).closest('.fichecenter').find('.risk-evaluation-container'); + let elementTask = $(this).closest('.fichecenter').find('.riskassessment-task'); + + let riskCommentText = elementRisk.find('.risk-description textarea').val() + let evaluationText = elementEvaluation.find('.risk-evaluation-comment textarea').val() + + let taskText = elementTask.find('input').val() + + riskCommentText = window.digiriskdolibarr.risk.sanitizeBeforeRequest(riskCommentText) + evaluationText = window.digiriskdolibarr.risk.sanitizeBeforeRequest(evaluationText) + taskText = window.digiriskdolibarr.risk.sanitizeBeforeRequest(taskText) + + //Risk + var category = elementRisk.find('.risk-category input').val(); + var description = riskCommentText; + + //Risk assessment + var method = elementEvaluation.find('.risk-evaluation-header .risk-evaluation-method').val(); + var cotation = elementEvaluation.find('.risk-evaluation-seuil').val(); + var photo = elementEvaluation.find('.risk-evaluation-photo-single .filename').val(); + var comment = evaluationText; + var date = elementEvaluation.find('#RiskAssessmentDate').val(); + var criteres = [] + + Object.values($('.table-cell.active.cell-0')).forEach(function(v) { + if ($(v).data( 'seuil' ) > -1) { + criteres[ $(v).data( 'type' )] = $(v).data( 'seuil' ) + } + }) + + //Task + var task = taskText; + let dateStart = elementTask.find('#RiskassessmentTaskDateStartModalRisk').val(); + let hourStart = elementTask.find('#RiskassessmentTaskDateStartModalRiskhour').val(); + let minStart = elementTask.find('#RiskassessmentTaskDateStartModalRiskmin').val(); + let dateEnd = elementTask.find('#RiskassessmentTaskDateEndModalRisk').val(); + let hourEnd = elementTask.find('#RiskassessmentTaskDateEndModalRiskhour').val(); + let minEnd = elementTask.find('#RiskassessmentTaskDateEndModalRiskmin').val(); + let budget = elementTask.find('.riskassessment-task-budget').val() + + //Loader + window.saturne.loader.display($('.fichecenter.risklist')); + + $.ajax({ + url: document.URL + '&action=add&token='+token, + type: "POST", + data: JSON.stringify({ + cotation: cotation, + comment: comment, + category: category, + description: description, + method: method, + photo: photo, + date: date, + task: task, + dateStart: dateStart, + hourStart: hourStart, + minStart: minStart, + dateEnd: dateEnd, + hourEnd: hourEnd, + minEnd: minEnd, + budget: budget, + criteres: { + gravite: criteres['gravite'] ? criteres['gravite'] : 0, + occurrence: criteres['occurrence'] ? criteres['occurrence'] : 0, + protection: criteres['protection'] ? criteres['protection'] : 0, + formation: criteres['formation'] ? criteres['formation'] : 0, + exposition: criteres['exposition'] ? criteres['exposition'] : 0 + } + }), + processData: false, + contentType: false, + success: function ( resp ) { + $('.fichecenter.risklist').html($(resp).find('#searchFormListRisks')) + + let actionContainerSuccess = $('.messageSuccessRiskCreate') + actionContainerSuccess.html($(resp).find('.risk-create-success-notice')) + actionContainerSuccess.removeClass('hidden') + $('.fichecenter.risklist').removeClass('wpeo-loader'); + }, + error: function ( resp ) { + let actionContainerError = $('.messageErrorRiskCreate'); + + actionContainerError.html($(resp).find('.risk-create-error-notice')); + actionContainerError.removeClass('hidden'); + + $('.fichecenter.risklist').removeClass('wpeo-loader'); + } + }); + +}; + +/** + * Action save risk. + * + * @since 1.0.0 + * @version 9.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.risk.saveRisk = function ( event ) { + let token = window.saturne.toolbox.getToken() + + let editedRiskId = $(this).attr('value'); + let elementRisk = $(this).closest('.risk-container').find('.risk-content'); + var params = new window.URLSearchParams(window.location.search); + var id = params.get('id') + + let moveRiskDisabled = $(this).closest('.risk-container').find('.move-risk').hasClass('move-disabled') + let riskCommentText = elementRisk.find('.risk-description textarea').val() + riskCommentText = window.digiriskdolibarr.risk.sanitizeBeforeRequest(riskCommentText) + + var category = elementRisk.find('.risk-category input').val(); + + if (riskCommentText) { + var description = riskCommentText; + } else { + var description = ''; + } + + var newParent = $(this).closest('.risk-container').find('#socid option:selected').val(); + + if (newParent == id || moveRiskDisabled) { + window.saturne.loader.display($(this).closest('.risk-row-content-' + editedRiskId).find('.risk-description-'+editedRiskId)); + window.saturne.loader.display($(this).closest('.risk-row-content-' + editedRiskId).find('.risk-category')); + } else { + window.saturne.loader.display($(this).closest('.risk-row-content-' + editedRiskId)) + } + let riskRef = $('.risk_row_'+editedRiskId).find('.risk-container > div:nth-child(1)').text(); + + + $.ajax({ + url: document.URL + '&action=saveRisk&token='+token, + type: "POST", + processData: false, + data: JSON.stringify({ + riskID: editedRiskId, + category: category, + comment: description, + newParent: newParent + }), + contentType: false, + success: function ( resp ) { + $('.wpeo-loader').removeClass('wpeo-loader'); + let actionContainerSuccess = $('.messageSuccessRiskEdit'); + if (newParent == id || moveRiskDisabled) { + $('.modal-active').removeClass('modal-active') + $('.risk-description-'+editedRiskId).html($(resp).find('.risk-description-'+editedRiskId)) + $('.risk-row-content-' + editedRiskId).find('.risk-category .cell-risk').html($(resp).find('.risk-row-content-' + editedRiskId).find('.risk-category .cell-risk').children()) + $('.risk-row-content-' + editedRiskId).find('.risk-category').fadeOut(800); + $('.risk-row-content-' + editedRiskId).find('.risk-category').fadeIn(800); + $('.risk-row-content-' + editedRiskId).find('.risk-description-'+editedRiskId).fadeOut(800); + $('.risk-row-content-' + editedRiskId).find('.risk-description-'+editedRiskId).fadeIn(800); + } else { + $('.risk-row-content-'+editedRiskId).fadeOut(800, function () { + $('.fichecenter .opacitymedium.colorblack.paddingleft').html($(resp).find('#searchFormListRisks .opacitymedium.colorblack.paddingleft')) + }); + } + + let textToShow = ''; + textToShow += actionContainerSuccess.find('.valueForEditRisk1').val() + textToShow += riskRef + textToShow += actionContainerSuccess.find('.valueForEditRisk2').val() + + actionContainerSuccess.find('a').attr('href', '#risk_row_'+editedRiskId) + actionContainerSuccess.find('.notice-subtitle .text').text(textToShow) + actionContainerSuccess.removeClass('hidden'); + }, + error: function ( resp ) { + let actionContainerError = $('.messageErrorRiskEdit'); + + let textToShow = ''; + textToShow += actionContainerError.find('.valueForEditRisk1').val() + textToShow += riskRef + textToShow += actionContainerError.find('.valueForEditRisk2').val() + + actionContainerError.find('.notice-subtitle .text').text(textToShow) + actionContainerError.removeClass('hidden'); + } + }); +}; + +/** + * Action unlink shared risk. + * + * @since 9.2.0 + * @version 9.2.0 + * + * @return {void} + */ +window.digiriskdolibarr.risk.unlinkSharedRisk = function ( event ) { + let token = window.saturne.toolbox.getToken() + + let riskId = $(this).attr('value'); + + window.saturne.loader.display($(this)); + + let riskRef = $('.risk_row_'+riskId).find('.risk-container > div:nth-child(1)').text(); + let url = document.URL.split(/#/); + + $.ajax({ + url: url[0] + '&action=unlinkSharedRisk&token='+token, + type: "POST", + processData: false, + data: JSON.stringify({ + riskID: riskId, + }), + contentType: false, + success: function ( resp ) { + //refresh shared risk list form + $('.confirmquestions').html($(resp).find('.confirmquestions').children()) + //refresh shared risk counter + $('.fichecenter.sharedrisklist .opacitymedium.colorblack.paddingleft').html($(resp).find('#searchFormSharedListRisks .opacitymedium.colorblack.paddingleft')) + let actionContainerSuccess = $('.messageSuccessRiskUnlinkShared'); + + $('#risk_row_' + riskId).fadeOut(800); + + let textToShow = ''; + textToShow += actionContainerSuccess.find('.valueForUnlinkSharedRisk1').val() + textToShow += riskRef + textToShow += actionContainerSuccess.find('.valueForUnlinkSharedRisk2').val() + + actionContainerSuccess.find('.notice-subtitle .text').text(textToShow) + actionContainerSuccess.removeClass('hidden'); + }, + error: function ( resp ) { + let actionContainerError = $('.messageErrorRiskUnlinkShared'); + + let textToShow = ''; + textToShow += actionContainerError.find('.valueForUnlinkSharedRisk1').val() + textToShow += riskRef + textToShow += actionContainerError.find('.valueForUnlinkSharedRisk2').val() + + actionContainerError.find('.notice-subtitle .text').text(textToShow) + actionContainerError.removeClass('hidden'); + } + }); +}; + +/** + * Action loader shared risk box. + * + * @since 9.2.0 + * @version 9.2.0 + * + * @return {void} + */ +window.digiriskdolibarr.risk.sharedRiskBoxLoader = function ( event ) { + if ($(this).text() == 'Oui') { + window.saturne.loader.display($('#searchFormSharedListRisks')) + } +}; diff --git a/js/modules/riskAssessment.js b/js/modules/riskAssessment.js new file mode 100644 index 000000000..528c5976a --- /dev/null +++ b/js/modules/riskAssessment.js @@ -0,0 +1,406 @@ + +/** + * Initialise l'objet "evaluation" ainsi que la méthode "init" obligatoire pour la bibliothèque DigiriskDolibarr. + * + * @since 1.0.0 + * @version 1.0.0 + */ +window.digiriskdolibarr.evaluation = {}; + +/** + * La méthode appelée automatiquement par la bibliothèque DigiriskDolibarr. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.evaluation.init = function() { + window.digiriskdolibarr.evaluation.event(); +}; + +/** + * La méthode contenant tous les événements pour le evaluation. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.evaluation.event = function() { + $( document ).on( 'click', '.select-evaluation-method', window.digiriskdolibarr.evaluation.selectEvaluationMethod); + $( document ).on( 'click', '.cotation-container .risk-evaluation-cotation.cotation', window.digiriskdolibarr.evaluation.selectSeuil ); + $( document ).on( 'click', '.risk-evaluation-create', window.digiriskdolibarr.evaluation.createEvaluation); + $( document ).on( 'click', '.risk-evaluation-save', window.digiriskdolibarr.evaluation.saveEvaluation); + $( document ).on( 'click', '.risk-evaluation-delete', window.digiriskdolibarr.evaluation.deleteEvaluation); +} + +/** + * Select Evaluation Method. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.evaluation.selectEvaluationMethod = function ( event ) { + var elementParent = $(this).closest('.modal-container'); + var multiple_method = elementParent.find('.risk-evaluation-multiple-method').val(); + + if (multiple_method > 0) { + elementParent.find('.select-evaluation-method.selected').removeClass('selected'); + + $(this).addClass('selected'); + $(this).removeClass('button-grey'); + $(this).addClass('button-blue'); + + elementParent.find('.select-evaluation-method:not(.selected)').removeClass('button-blue'); + elementParent.find('.select-evaluation-method:not(.selected)').addClass('button-grey'); + + if ($(this).hasClass('evaluation-standard')) { + elementParent.find('.cotation-advanced').attr('style', 'display:none'); + elementParent.find('.cotation-standard').attr('style', 'display:block'); + elementParent.find('.risk-evaluation-calculated-cotation').attr('style', 'display:none') + elementParent.find('.risk-evaluation-method').val('standard'); + elementParent.find(this).closest('.risk-evaluation-container').removeClass('advanced'); + elementParent.find(this).closest('.risk-evaluation-container').addClass('standard'); + } else { + elementParent.find('.cotation-standard').attr('style', 'display:none'); + elementParent.find('.cotation-advanced').attr('style', 'display:block'); + elementParent.find('.risk-evaluation-calculated-cotation').attr('style', 'display:block'); + elementParent.find('.risk-evaluation-method').val('advanced'); + elementParent.find(this).closest('.risk-evaluation-container').addClass('advanced'); + elementParent.find(this).closest('.risk-evaluation-container').removeClass('standard'); + } + } +}; + +/** + * Clique sur une des cotations simples. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @param {ClickEvent} event L'état du clic. + * @return {void} + */ +window.digiriskdolibarr.evaluation.selectSeuil = function( event ) { + var element = $(this); + var elementParent = $(this).closest('.modal-container') + var seuil = element.data( 'seuil' ); + var variableID = element.data( 'variable-id' ); + + element.closest('.cotation-container').find('.risk-evaluation-seuil').val($( this ).text()); + element.closest('.cotation-container').find('.selected-cotation').removeClass('selected-cotation') + element.addClass('selected-cotation') + + if ( variableID && seuil ) { + window.digiriskdolibarr.risk.haveDataInInput( elementParent ) + } +}; + +/** + * Get default cotation. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @param {int} risk assessment cotation value. + * @return {int} + */ +window.digiriskdolibarr.evaluation.getDynamicScale = function (cotation) { + switch (true) { + case (cotation === 0): + case (cotation < 48): + return 1; + case (cotation < 51): + return 2; + case (cotation < 79): + return 3; + case (cotation < 101): + return 4; + } +}; + +/** + * Action create evaluation. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.evaluation.createEvaluation = function ( event ) { + let token = window.saturne.toolbox.getToken() + + var riskToAssign = $(this).attr('value'); + let element = $(this).closest('.risk-evaluation-add-modal'); + let single = element.find('.risk-evaluation-container'); + + let evaluationText = single.find('.risk-evaluation-comment textarea').val() + evaluationText = window.digiriskdolibarr.risk.sanitizeBeforeRequest(evaluationText) + + var method = single.find('.risk-evaluation-method').val(); + var cotation = single.find('.risk-evaluation-seuil').val(); + var comment = evaluationText + var date = single.find('#RiskAssessmentDateCreate0').val(); + var photo = single.find('.risk-evaluation-photo-single .filename').val(); + + let criteres = []; + Object.values($('.table-cell.active.cell-0')).forEach(function(v) { + if ($(v).data( 'seuil' ) > -1) { + criteres[ $(v).data( 'type' )] = $(v).data( 'seuil' ) + } + }) + + window.saturne.loader.display($(this)); + window.saturne.loader.display($('.risk-evaluation-list-container-' + riskToAssign)); + + $.ajax({ + url: document.URL + '&action=addEvaluation&token='+token, + type: "POST", + data: JSON.stringify({ + cotation: cotation, + comment: comment, + method: method, + photo: photo, + date: date, + riskId: riskToAssign, + criteres: { + gravite: criteres['gravite'] ? criteres['gravite'] : 0, + occurrence: criteres['occurrence'] ? criteres['occurrence'] : 0, + protection: criteres['protection'] ? criteres['protection'] : 0, + formation: criteres['formation'] ? criteres['formation'] : 0, + exposition: criteres['exposition'] ? criteres['exposition'] : 0 + } + }), + processData: false, + contentType: false, + success: function( resp ) { + + if ($(resp).find('.risk-evaluation-list-container-' + riskToAssign).length > 0) { + $('.risk-evaluation-list-container-' + riskToAssign).replaceWith($(resp).find('.risk-evaluation-list-container-' + riskToAssign)) + } else { + $('.div-table-responsive').replaceWith($(resp).find('.div-table-responsive')); + } + + let actionContainerSuccess = $('.messageSuccessEvaluationCreate'); + + $('.risk-evaluation-list-container-' + riskToAssign).fadeOut(800); + $('.risk-evaluation-list-container-' + riskToAssign).fadeIn(800); + actionContainerSuccess.empty() + actionContainerSuccess.html($(resp).find('.riskassessment-create-success-notice')) + actionContainerSuccess.find('a').attr('href', '#risk_row_'+riskToAssign) + + $('.wpeo-loader').removeClass('wpeo-loader') + actionContainerSuccess.removeClass('hidden'); + }, + error: function ( resp ) { + let actionContainerError = $('.messageErrorEvaluationCreate'); + + $(this).closest('.risk-row-content-' + riskToAssign).removeClass('wpeo-loader'); + + actionContainerError.empty() + actionContainerError.html($(resp).find('.riskassessment-create-error-notice')) + + actionContainerError.removeClass('hidden'); + } + }); +}; + + +/** + * Action delete evaluation. + * + * @since 1.0.0 + * @version 9.0.0 + * + * @return {boolean} + */ +window.digiriskdolibarr.evaluation.deleteEvaluation = function ( event ) { + let token = window.saturne.toolbox.getToken() + + let element = $(this).closest('.risk-evaluation-in-modal'); + let textToShowBeforeDelete = element.find('.labelForDelete').val(); + let actionContainerSuccess = $('.messageSuccessEvaluationDelete'); + let actionContainerError = $('.messageErrorEvaluationDelete'); + let evaluationID = element.attr('value'); + + var r = confirm(textToShowBeforeDelete); + if (r == true) { + + let elementParent = $(this).closest('.risk-evaluations-list-content'); + let riskId = elementParent.attr('value'); + let evaluationRef = $('.risk-evaluation-ref-'+evaluationID).attr('value'); + + window.saturne.loader.display($('.risk-evaluation-ref-'+evaluationID)); + + $.ajax({ + url:document.URL + '&action=deleteEvaluation&deletedEvaluationId=' + evaluationID + '&token=' + token, + type: "POST", + processData: false, + contentType: false, + success: function ( resp ) { + //remove risk assessment from list in modal + $('.risk-evaluation-container-' + evaluationID).fadeOut(400) + + //refresh risk assessment list + $('.risk-evaluation-list-content-' + riskId).replaceWith($(resp).find('.risk-evaluation-list-content-' + riskId)) + + //refresh risk assessment add modal to actualize last risk assessment + $('#risk_evaluation_add' + riskId).replaceWith($(resp).find('#risk_evaluation_add' + riskId)) + + //update risk assessment counter + let evaluationCounterText = $('#risk_row_'+riskId).find('.table-cell-header-label').text() + let evaluationCounter = evaluationCounterText.split(/\(/)[1].split(/\)/)[0] + $('#risk_row_' + riskId).find('.table-cell-header-label').html('' + evaluationCounterText.split(/\(/)[0] + '(' + (+evaluationCounter - 1) + ')' + '') + + if (evaluationCounter - 1 < 1) { + $('.fichecenter.risklist').html($(resp).find('#searchFormListRisks')) + } + + elementParent.removeClass('wpeo-loader'); + + let textToShow = ''; + textToShow += actionContainerSuccess.find('.valueForDeleteEvaluation1').val() + textToShow += evaluationRef + textToShow += actionContainerSuccess.find('.valueForDeleteEvaluation2').val() + + actionContainerSuccess.find('.notice-subtitle .text').text(textToShow) + actionContainerSuccess.removeClass('hidden'); + }, + error: function ( resp ) { + + let textToShow = ''; + textToShow += actionContainerError.find('.valueForDeleteEvaluation1').val() + textToShow += evaluationRef + textToShow += actionContainerError.find('.valueForDeleteEvaluation2').val() + + actionContainerError.find('.notice-subtitle .text').text(textToShow); + actionContainerError.removeClass('hidden'); + } + }); + + } else { + return false; + } +} + +/** + * Action save evaluation. + * + * @since 1.0.0 + * @version 9.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.evaluation.saveEvaluation = function ( event ) { + let token = window.saturne.toolbox.getToken() + + let element = $(this).closest('.risk-evaluation-edit-modal'); + let evaluationID = element.attr('value'); + let evaluationText = element.find('.risk-evaluation-comment textarea').val() + + let elementParent = $(this).closest('.risk-row').find('.risk-evaluations-list-content'); + let riskId = elementParent.attr('value'); + let evaluationRef = $('.risk-evaluation-ref-'+evaluationID).attr('value'); + let listModalContainer = $('.risk-evaluation-list-modal-'+riskId) + let listModal = $('#risk_evaluation_list'+riskId) + let fromList = listModal.hasClass('modal-active'); + + evaluationText = window.digiriskdolibarr.risk.sanitizeBeforeRequest(evaluationText) + + var method = element.find('.risk-evaluation-method').val(); + var cotation = element.find('.risk-evaluation-seuil').val(); + var comment = evaluationText; + var date = element.find('#RiskAssessmentDateEdit' + evaluationID).val(); + var photo = element.find('.risk-evaluation-photo .filename').val(); + + let criteres = []; + Object.values($('.table-cell.active.cell-'+evaluationID)).forEach(function(v) { + if ($(v).data( 'seuil' ) > -1) { + criteres[ $(v).data( 'type' )] = $(v).data( 'seuil' ) + } + }) + + window.saturne.loader.display($(this)); + + $.ajax({ + url: document.URL + '&action=saveEvaluation&token='+token, + type: "POST", + processData: false, + data: JSON.stringify({ + cotation: cotation, + comment: comment, + method: method, + photo: photo, + date: date, + evaluationID: evaluationID, + criteres: { + gravite: criteres['gravite'] ? criteres['gravite'] : 0, + occurrence: criteres['occurrence'] ? criteres['occurrence'] : 0, + protection: criteres['protection'] ? criteres['protection'] : 0, + formation: criteres['formation'] ? criteres['formation'] : 0, + exposition: criteres['exposition'] ? criteres['exposition'] : 0 + } + }), + contentType: false, + success: function ( resp ) { + $('#risk_evaluation_edit'+evaluationID).removeClass('modal-active') + + if ($(resp).find('.risk-evaluation-container.risk-evaluation-container-'+evaluationID+':not(.last-risk-assessment)').length > 0) { + if (fromList) { + $('.risk-evaluation-ref-'+evaluationID+':not(.last-risk-assessment)').fadeOut(800); + $('.risk-evaluation-ref-'+evaluationID+':not(.last-risk-assessment)').fadeIn(800); + } else { + $('.risk-evaluation-container-'+evaluationID+':not(.last-risk-assessment)').fadeOut(800); + $('.risk-evaluation-container-'+evaluationID+':not(.last-risk-assessment)').fadeIn(800); + } + //refresh risk assessment single in modal list + listModalContainer.find('.risk-evaluation-ref-'+evaluationID).replaceWith($(resp).find('.risk-evaluation-ref-'+evaluationID)) + + //refresh risk assessment single in list + $('.risk-evaluation-container.risk-evaluation-container-'+evaluationID+':not(.last-risk-assessment)').replaceWith($(resp).find('.risk-evaluation-container.risk-evaluation-container-'+evaluationID+':not(.last-risk-assessment)')) + + //refresh risk assessment add modal to actualize last risk assessment + $('#risk_evaluation_add' + riskId).html($(resp).find('#risk_evaluation_add' + riskId).children()) + } else { + $('.div-table-responsive').html($(resp).find('.div-table-responsive').children()); + + if (fromList) { + $('.risk-evaluation-ref-'+evaluationID+':not(.last-risk-assessment)').fadeOut(800); + $('.risk-evaluation-ref-'+evaluationID+':not(.last-risk-assessment)').fadeIn(800); + } else { + $('.risk-evaluation-container-'+evaluationID+':not(.last-risk-assessment)').fadeOut(800); + $('.risk-evaluation-container-'+evaluationID+':not(.last-risk-assessment)').fadeIn(800); + } + } + + $('.wpeo-loader').removeClass('wpeo-loader') + let actionContainerSuccess = $('.messageSuccessEvaluationEdit'); + + element.find('#risk_evaluation_edit'+evaluationID).removeClass('modal-active'); + + let textToShow = ''; + textToShow += actionContainerSuccess.find('.valueForEditEvaluation1').val() + textToShow += evaluationRef + textToShow += actionContainerSuccess.find('.valueForEditEvaluation2').val() + actionContainerSuccess.find('a').attr('href', '#risk_row_'+riskId) + + actionContainerSuccess.find('.notice-subtitle .text').text(textToShow) + actionContainerSuccess.removeClass('hidden'); + }, + error: function ( ) { + let actionContainerError = $('.messageErrorEvaluationEdit'); + + let textToShow = ''; + textToShow += actionContainerError.find('.valueForEditEvaluation1').val() + textToShow += evaluationRef + textToShow += actionContainerError.find('.valueForEditEvaluation2').val() + + actionContainerError.find('.notice-subtitle .text').text(textToShow); + actionContainerError.removeClass('hidden'); + } + }); + +}; diff --git a/js/modules/riskSign.js b/js/modules/riskSign.js new file mode 100644 index 000000000..1a6e93f66 --- /dev/null +++ b/js/modules/riskSign.js @@ -0,0 +1,240 @@ + +/** + * Initialise l'objet "risksign" ainsi que la méthode "init" obligatoire pour la bibliothèque DigiriskDolibarr. + * + * @since 1.0.0 + * @version 1.0.0 + */ +window.digiriskdolibarr.risksign = {}; + +/** + * La méthode appelée automatiquement par la bibliothèque DigiriskDolibarr. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.risksign.init = function() { + window.digiriskdolibarr.risksign.event(); +}; + +/** + * La méthode contenant tous les événements pour le risksign. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.risksign.event = function() { + $( document ).on( 'click', '.risksign-category-danger .item, .wpeo-table .risksign-category-danger .item', window.digiriskdolibarr.risksign.selectRiskSign ); + $( document ).on( 'click', '.risksign-create:not(.button-disable)', window.digiriskdolibarr.risksign.createRiskSign ); + $( document ).on( 'click', '.risksign-save', window.digiriskdolibarr.risksign.saveRiskSign ); + $( document ).on( 'click', '.risksign-unlink-shared', window.digiriskdolibarr.risksign.unlinkSharedRiskSign ); +}; + +/** + * Lors du clic sur un riskSignCategory, remplaces le contenu du toggle et met l'image du risque sélectionné. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @param {MouseEvent} event [description] + * @return {void} + */ +window.digiriskdolibarr.risksign.selectRiskSign = function( event ) { + var element = $(this); + element.closest('.content').removeClass('active'); + element.closest('.wpeo-dropdown').find('.dropdown-toggle span').hide(); + element.closest('.wpeo-dropdown').find('.dropdown-toggle img').show(); + element.closest('.wpeo-dropdown').find('.dropdown-toggle img').attr('src', element.find('img').attr('src')); + element.closest('.wpeo-dropdown').find('.dropdown-toggle img').attr('aria-label', element.closest('.wpeo-tooltip-event').attr('aria-label')); + + element.closest('.fichecenter').find('.input-hidden-danger').val(element.data('id')); + + var elementParent = $(this).closest('.modal-container'); + + // Rend le bouton "active". + window.digiriskdolibarr.risksign.haveDataInInput(elementParent); +}; + +/** + * Check value on riskSignCategory. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @param elementParent --- Parent element + * @return {void} + */ +window.digiriskdolibarr.risksign.haveDataInInput = function( elementParent ) { + var element = elementParent.parent().parent(); + + if (element.hasClass('risksign-add-modal')) { + var risksign_category = element.find('input[name="risksign_category_id"]') + if ( risksign_category.val() >= 0 ) { + element.find('.button-disable').removeClass('button-disable'); + } + } +}; + +/** + * Action create risksign. + * + * @since 1.0.0 + * @version 9.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.risksign.createRiskSign = function ( event ) { + let token = window.saturne.toolbox.getToken() + + let elementRiskSign = $(this).closest('.fichecenter').find('.risksign-content'); + var category = elementRiskSign.find('.risksign-category input').val(); + var description = elementRiskSign.find('.risksign-description textarea').val(); + + window.saturne.loader.display($('.fichecenter.risksignlist')); + + $.ajax({ + url: document.URL + '&action=add&token='+token, + type: "POST", + data: JSON.stringify({ + riskSignCategory: category, + riskSignDescription: description + }), + processData: false, + contentType: false, + success: function ( resp ) { + $('.fichecenter.risksignlist').html($(resp).find('#searchFormListRiskSigns')) + + let actionContainerSuccess = $('.messageSuccessRiskSignCreate'); + + $('.fichecenter.risksignlist').removeClass('wpeo-loader'); + + actionContainerSuccess.html($(resp).find('.risksign-create-success-notice')) + actionContainerSuccess.removeClass('hidden'); + }, + error: function ( resp ) { + let actionContainerError = $('.messageErrorRiskCreate'); + actionContainerError.html($(resp).find('.risksign-create-error-notice')) + actionContainerError.removeClass('hidden'); + } + }); + +}; + +/** + * Action save risksign. + * + * @since 1.0.0 + * @version 9.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.risksign.saveRiskSign = function ( event ) { + let token = window.saturne.toolbox.getToken() + + let editedRiskSignId = $(this).attr('value'); + let elementRiskSign = $(this).closest('.risksign-container').find('.risksign-content'); + let textToShow = '' + + var category = elementRiskSign.find('.risksign-category input').val(); + var description = elementRiskSign.find('.risksign-description textarea').val(); + + let riskSignRef = $('.risksign_row_'+editedRiskSignId).find('.risksign-container > div:nth-child(1)').text(); + + window.saturne.loader.display(elementRiskSign); + + $.ajax({ + url: document.URL + '&action=saveRiskSign&token='+token, + data: JSON.stringify({ + riskSignID: editedRiskSignId, + riskSignCategory: category, + riskSignDescription: description + }), + type: "POST", + processData: false, + contentType: false, + success: function ( resp ) { + $('.fichecenter.risksignlist').html($(resp).find('#searchFormListRiskSigns')) + + let actionContainerSuccess = $('.messageSuccessRiskSignEdit'); + + elementRiskSign.removeClass('wpeo-loader'); + + textToShow += actionContainerSuccess.find('.valueForEditRiskSign1').val() + textToShow += riskSignRef + textToShow += actionContainerSuccess.find('.valueForEditRiskSign2').val() + + actionContainerSuccess.find('.notice-subtitle .text').text(textToShow) + actionContainerSuccess.removeClass('hidden'); + }, + error: function ( ) { + let actionContainerError = $('.messageErrorRiskSignEdit'); + elementRiskSign.removeClass('wpeo-loader'); + + textToShow += actionContainerError.find('.valueForEditRiskSign1').val() + textToShow += riskSignRef + textToShow += actionContainerError.find('.valueForEditRiskSign2').val() + + actionContainerError.find('.notice-subtitle .text').text(textToShow) + actionContainerError.removeClass('hidden'); + } + }); + +}; + +/** + * Action unlink shared risk sign. + * + * @since 9.4.0 + * @version 9.4.0 + * + * @return {void} + */ +window.digiriskdolibarr.risksign.unlinkSharedRiskSign = function ( event ) { + let token = window.saturne.toolbox.getToken() + + let risksignId = $(this).attr('value'); + + window.saturne.loader.display($(this)); + + let risksignRef = $('.risksign_row_'+risksignId).find('.risksign-container > div:nth-child(1)').text(); + let url = document.URL.split(/#/); + + $.ajax({ + url: url[0] + '&action=unlinkSharedRiskSign&token='+token, + type: "POST", + processData: false, + data: JSON.stringify({ + risksignID: risksignId, + }), + contentType: false, + success: function ( resp ) { + $('.fichecenter.sharedrisksignlist .opacitymedium.colorblack.paddingleft').html($(resp).find('#searchFormSharedListRiskSigns .opacitymedium.colorblack.paddingleft')) + let actionContainerSuccess = $('.messageSuccessRiskSignUnlinkShared'); + + $('#risksign_row_' + risksignId).fadeOut(800); + + let textToShow = ''; + textToShow += actionContainerSuccess.find('.valueForUnlinkSharedRiskSign1').val() + textToShow += risksignRef + textToShow += actionContainerSuccess.find('.valueForUnlinkSharedRiskSign2').val() + + actionContainerSuccess.find('.notice-subtitle .text').text(textToShow) + actionContainerSuccess.removeClass('hidden'); + }, + error: function ( resp ) { + let actionContainerError = $('.messageErrorRiskSignUnlinkShared'); + + let textToShow = ''; + textToShow += actionContainerError.find('.valueForUnlinkSharedRiskSign1').val() + textToShow += risksignRef + textToShow += actionContainerError.find('.valueForUnlinkSharedRiskSign2').val() + + actionContainerError.find('.notice-subtitle .text').text(textToShow) + actionContainerError.removeClass('hidden'); + } + }); +}; diff --git a/js/modules/task.js b/js/modules/task.js new file mode 100644 index 000000000..57f40b139 --- /dev/null +++ b/js/modules/task.js @@ -0,0 +1,657 @@ + +/** + * Initialise l'objet "riskassessmenttask" ainsi que la méthode "init" obligatoire pour la bibliothèque DigiriskDolibarr. + * + * @since 1.0.0 + * @version 1.0.0 + */ +window.digiriskdolibarr.riskassessmenttask = {}; + +/** + * La méthode appelée automatiquement par la bibliothèque DigiriskDolibarr. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.riskassessmenttask.init = function() { + window.digiriskdolibarr.riskassessmenttask.event(); +}; + +/** + * La méthode contenant tous les événements pour le riskassessment-task. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.riskassessmenttask.event = function() { + $( document ).on( 'input', '.riskassessment-task-label', window.digiriskdolibarr.riskassessmenttask.fillRiskAssessmentTaskLabel); + $( document ).on( 'click', '.riskassessment-task-create', window.digiriskdolibarr.riskassessmenttask.createRiskAssessmentTask); + $( document ).on( 'click', '.riskassessment-task-save', window.digiriskdolibarr.riskassessmenttask.saveRiskAssessmentTask); + $( document ).on( 'click', '.riskassessment-task-delete', window.digiriskdolibarr.riskassessmenttask.deleteRiskAssessmentTask ); + $( document ).on( 'click', '.riskassessment-task-timespent-create', window.digiriskdolibarr.riskassessmenttask.createRiskAssessmentTaskTimeSpent); + $( document ).on( 'click', '.riskassessment-task-timespent-save', window.digiriskdolibarr.riskassessmenttask.saveRiskAssessmentTaskTimeSpent); + $( document ).on( 'click', '.riskassessment-task-timespent-delete', window.digiriskdolibarr.riskassessmenttask.deleteRiskAssessmentTaskTimeSpent ); + $( document ).on( 'click', '.riskassessment-task-progress-checkbox:not(.riskassessment-task-progress-checkbox-readonly)', window.digiriskdolibarr.riskassessmenttask.checkTaskProgress ); + $( document ).on( 'change', '#RiskassessmentTaskTimespentDatehour', window.digiriskdolibarr.riskassessmenttask.selectRiskassessmentTaskTimespentDateHour ); + $( document ).on( 'change', '#RiskassessmentTaskTimespentDatemin', window.digiriskdolibarr.riskassessmenttask.selectRiskassessmentTaskTimespentDateMin ); + $( document ).on( 'keyup', '.riskassessment-task-label', window.digiriskdolibarr.riskassessmenttask.checkRiskassessmentTaskLabelLength ); + $( document ).on( 'click', '.listingHeaderTaskTooltip', window.digiriskdolibarr.riskassessmenttask.redirectOnSharedTaskConfig ); +}; + +/** + * Fill riskassessmenttask label + * + * @since 1.0.0 + * @version 1.0.0 + * + * @param {MouseEvent} event [description] + * @return {void} + */ +window.digiriskdolibarr.riskassessmenttask.fillRiskAssessmentTaskLabel = function( event ) { + var elementParent = $(this).closest('.modal-container'); + + window.digiriskdolibarr.riskassessmenttask.haveDataInInput(elementParent); +}; + +/** + * Check value on riskAssessmentTask. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @param elementParent --- Parent element + * @return {void} + */ +window.digiriskdolibarr.riskassessmenttask.haveDataInInput = function( elementParent ) { + var element = elementParent.parent().parent(); + + if (element.hasClass('riskassessment-task-add-modal')) { + var riskassessmenttasklabel = element.find('input[name="label"]').val(); + if ( riskassessmenttasklabel.length ) { + element.find('.button-disable').removeClass('button-disable'); + } + } +}; + +/** + * Action create task. + * + * @since 1.0.0 + * @version 9.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.riskassessmenttask.createRiskAssessmentTask = function ( event ) { + let token = window.saturne.toolbox.getToken() + + var riskToAssign = $(this).attr('value'); + let element = $(this).closest('.riskassessment-task-add-modal'); + let single = element.find('.riskassessment-task-container'); + + let taskText = single.find('.riskassessment-task-label').val() + taskText = window.digiriskdolibarr.risk.sanitizeBeforeRequest(taskText) + + let dateStart = single.find('#RiskassessmentTaskDateStart' + riskToAssign).val(); + let hourStart = single.find('#RiskassessmentTaskDateStart' + riskToAssign + 'hour').val(); + let minStart = single.find('#RiskassessmentTaskDateStart' + riskToAssign + 'min').val(); + let dateEnd = single.find('#RiskassessmentTaskDateEnd' + riskToAssign).val(); + let hourEnd = single.find('#RiskassessmentTaskDateEnd' + riskToAssign + 'hour').val(); + let minEnd = single.find('#RiskassessmentTaskDateEnd' + riskToAssign + 'min').val(); + let budget = single.find('.riskassessment-task-budget').val() + + window.saturne.loader.display($(this)); + window.saturne.loader.display($('.riskassessment-tasks' + riskToAssign)); + + $.ajax({ + url: document.URL + '&action=addRiskAssessmentTask&token='+token, + type: "POST", + data: JSON.stringify({ + tasktitle: taskText, + dateStart: dateStart, + hourStart: hourStart, + minStart: minStart, + dateEnd: dateEnd, + hourEnd: hourEnd, + minEnd: minEnd, + budget: budget, + riskToAssign: riskToAssign, + }), + processData: false, + contentType: false, + success: function ( resp ) { + $('.tasks-list-container-'+riskToAssign).replaceWith($(resp).find('.tasks-list-container-'+riskToAssign)) + let actionContainerSuccess = $('.messageSuccessTaskCreate'); + + $('.riskassessment-tasks' + riskToAssign).fadeOut(800); + $('.riskassessment-tasks' + riskToAssign).fadeIn(800); + + actionContainerSuccess.find('a').attr('href', '#risk_row_'+riskToAssign) + + actionContainerSuccess.html($(resp).find('.task-create-success-notice')) + actionContainerSuccess.removeClass('hidden'); + }, + error: function ( resp ) { + $('.wpeo-loader').removeClass('wpeo-loader'); + window.scrollTo(0, 0); + let response = JSON.parse(resp.responseText) + + let actionContainerError = $('.messageErrorTaskCreate'); + $('#risk_assessment_task_add'+riskToAssign).removeClass('modal-active') + + let textToShow = ''; + + textToShow += actionContainerError.find('.valueForCreateTask1').val() + textToShow += actionContainerError.find('.valueForCreateTask2').val() + textToShow += ' : ' + textToShow += response.message + + actionContainerError.find('.notice-subtitle .text').text(textToShow); + actionContainerError.removeClass('hidden'); + } + }); +}; + +/** + * Action delete riskassessmenttask. + * + * @since 1.0.0 + * @version 9.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.riskassessmenttask.deleteRiskAssessmentTask = function ( event ) { + let token = window.saturne.toolbox.getToken() + + let element = $(this).closest('.riskassessment-tasks'); + let riskId = $(this).closest('.riskassessment-tasks').attr('value'); + let deletedRiskAssessmentTaskId = $(this).attr('value'); + let textToShow = element.find('.labelForDelete').val(); + let actionContainerSuccess = $('.messageSuccessTaskDelete'); + let actionContainerError = $('.messageErrorTaskDelete'); + + var r = confirm(textToShow); + if (r == true) { + + let riskAssessmentTaskRef = $('.riskassessment-task-container-'+deletedRiskAssessmentTaskId).attr('value'); + + window.saturne.loader.display($('.riskassessment-task-container-'+deletedRiskAssessmentTaskId)); + + $.ajax({ + url: document.URL + '&action=deleteRiskAssessmentTask&deletedRiskAssessmentTaskId=' + deletedRiskAssessmentTaskId + '&token=' + token, + type: "POST", + processData: false, + contentType: false, + success: function ( resp ) { + $('.riskassessment-task-container-'+deletedRiskAssessmentTaskId).closest('.riskassessment-task-listing-wrapper').html($(resp).find('.tasks-list-container-'+riskId).find('.riskassessment-task-listing-wrapper')) + $('.riskassessment-tasks' + riskId).fadeOut(800); + $('.riskassessment-tasks' + riskId).fadeIn(800); + let textToShow = ''; + textToShow += actionContainerSuccess.find('.valueForDeleteTask1').val() + textToShow += riskAssessmentTaskRef + textToShow += actionContainerSuccess.find('.valueForDeleteTask2').val() + + actionContainerSuccess.find('a').attr('href', '#risk_row_'+riskId) + + actionContainerSuccess.find('.notice-subtitle .text').text(textToShow) + actionContainerSuccess.removeClass('hidden'); + }, + error: function ( resp ) { + $('.wpeo-loader').removeClass('wpeo-loader'); + window.scrollTo(0, 0); + let response = JSON.parse(resp.responseText) + + let textToShow = ''; + textToShow += actionContainerError.find('.valueForDeleteTask1').val() + textToShow += riskAssessmentTaskRef + textToShow += actionContainerError.find('.valueForDeleteTask2').val() + textToShow += ' : ' + textToShow += response.message + + actionContainerError.find('.notice-subtitle .text').text(textToShow); + actionContainerError.removeClass('hidden'); + } + }); + + } else { + return false; + } +}; + +/** + * Action save riskassessmenttask. + * + * @since 1.0.0 + * @version 9.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.riskassessmenttask.saveRiskAssessmentTask = function ( event ) { + let token = window.saturne.toolbox.getToken() + + let editedRiskAssessmentTaskId = $(this).attr('value'); + let elementRiskAssessmentTask = $(this).closest('.modal-container'); + let riskId = $(this).closest('.riskassessment-tasks').attr('value') + let textToShow = ''; + + let taskText = elementRiskAssessmentTask.find('.riskassessment-task-label' + editedRiskAssessmentTaskId).val() + taskText = window.digiriskdolibarr.risk.sanitizeBeforeRequest(taskText) + + let taskRef = $('.riskassessment-task-single-'+editedRiskAssessmentTaskId+' .riskassessment-task-reference').attr('value'); + + let taskProgress = 0; + if (elementRiskAssessmentTask.find('.riskassessment-task-progress-checkbox' + editedRiskAssessmentTaskId).is(':checked')) { + taskProgress = 1; + } + + let dateStart = elementRiskAssessmentTask.find('#RiskassessmentTaskDateStart' + editedRiskAssessmentTaskId).val(); + let hourStart = elementRiskAssessmentTask.find('#RiskassessmentTaskDateStart' + editedRiskAssessmentTaskId + 'hour').val(); + let minStart = elementRiskAssessmentTask.find('#RiskassessmentTaskDateStart' + editedRiskAssessmentTaskId + 'min').val(); + let dateEnd = elementRiskAssessmentTask.find('#RiskassessmentTaskDateEnd' + editedRiskAssessmentTaskId).val(); + let hourEnd = elementRiskAssessmentTask.find('#RiskassessmentTaskDateEnd' + editedRiskAssessmentTaskId + 'hour').val(); + let minEnd = elementRiskAssessmentTask.find('#RiskassessmentTaskDateEnd' + editedRiskAssessmentTaskId + 'min').val(); + let budget = elementRiskAssessmentTask.find('.riskassessment-task-budget' + editedRiskAssessmentTaskId).val() + + window.saturne.loader.display($(this)); + window.saturne.loader.display($('.riskassessment-task-single-'+ editedRiskAssessmentTaskId)); + + $.ajax({ + url: document.URL + '&action=saveRiskAssessmentTask&token='+token, + data: JSON.stringify({ + riskAssessmentTaskID: editedRiskAssessmentTaskId, + tasktitle: taskText, + dateStart: dateStart, + hourStart: hourStart, + minStart: minStart, + dateEnd: dateEnd, + hourEnd: hourEnd, + minEnd: minEnd, + budget: budget, + taskProgress: taskProgress, + }), + type: "POST", + processData: false, + contentType: false, + success: function ( resp ) { + $('#risk_assessment_task_edit'+editedRiskAssessmentTaskId).removeClass('modal-active') + $('.riskassessment-task-container-'+editedRiskAssessmentTaskId).replaceWith($(resp).find('.riskassessment-task-container-'+editedRiskAssessmentTaskId).first()) + let actionContainerSuccess = $('.messageSuccessTaskEdit'); + $('.riskassessment-tasks' + riskId).fadeOut(800); + $('.riskassessment-tasks' + riskId).fadeIn(800); + textToShow += actionContainerSuccess.find('.valueForEditTask1').val() + textToShow += taskRef + textToShow += actionContainerSuccess.find('.valueForEditTask2').val() + + $('.wpeo-loader').removeClass('wpeo-loader') + $('.loader-spin').remove() + actionContainerSuccess.find('a').attr('href', '#risk_row_'+riskId) + + actionContainerSuccess.find('.notice-subtitle .text').text(textToShow) + actionContainerSuccess.removeClass('hidden'); + }, + error: function ( resp ) { + $('.wpeo-loader').removeClass('wpeo-loader'); + window.scrollTo(0, 0); + let response = JSON.parse(resp.responseText) + + let actionContainerError = $('.messageErrorTaskEdit'); + $('#risk_assessment_task_edit'+editedRiskAssessmentTaskId).removeClass('modal-active') + $('.wpeo-loader').removeClass('wpeo-loader') + + textToShow += actionContainerError.find('.valueForEditTask1').val() + textToShow += taskRef + textToShow += actionContainerError.find('.valueForEditTask2').val() + textToShow += ' : ' + textToShow += response.message + + actionContainerError.find('.notice-subtitle .text').text(textToShow); + actionContainerError.removeClass('hidden'); + } + }); +}; + +/** + * Action create task timespent. + * + * @since 9.1.0 + * @version 9.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.riskassessmenttask.createRiskAssessmentTaskTimeSpent = function ( event ) { + let token = window.saturne.toolbox.getToken() + + let taskID = $(this).attr('value'); + let element = $(this).closest('.riskassessment-task-edit-modal'); + let single = element.find('.riskassessment-task-timespent-container'); + let riskId = element.find('riskassessment-task-single').attr('value'); + let textToShow = ''; + let taskRef = element.find('.riskassessment-task-reference').attr('value'); + let timespent = $('.id-container').find('.riskassessment-total-task-timespent-'+taskID) + + let date = single.find('#RiskassessmentTaskTimespentDate' + taskID).val(); + let hour = single.find('#RiskassessmentTaskTimespentDate' + taskID + 'hour').val(); + let min = single.find('#RiskassessmentTaskTimespentDate' + taskID + 'min').val(); + let comment = single.find('.riskassessment-task-timespent-comment').val() + comment = window.digiriskdolibarr.risk.sanitizeBeforeRequest(comment) + let duration = single.find('.riskassessment-task-timespent-duration').val() + + window.saturne.loader.display($(this)); + window.saturne.loader.display($('.riskassessment-task-single-'+ taskID)); + + $.ajax({ + url: document.URL + '&action=addRiskAssessmentTaskTimeSpent&token='+token, + type: "POST", + data: JSON.stringify({ + taskID: taskID, + date: date, + hour: hour, + min: min, + comment: comment, + duration: duration, + }), + processData: false, + contentType: false, + success: function ( resp ) { + //element.html($(resp).find(single)) + let actionContainerSuccess = $('.messageSuccessTaskTimeSpentCreate'+ taskID); + + $('.riskassessment-tasks' + riskId).fadeOut(800); + $('.riskassessment-tasks' + riskId).fadeIn(800); + + textToShow += actionContainerSuccess.find('.valueForCreateTaskTimeSpent1').val() + textToShow += taskRef + textToShow += actionContainerSuccess.find('.valueForCreateTaskTimeSpent2').val() + + $('.riskassessment-task-timespent-container').find('.riskassessment-task-timespent-list-'+taskID).html($(resp).find('.riskassessment-task-timespent-container').find('.riskassessment-task-timespent-list-'+taskID)) + $('.riskassessment-task-container-'+taskID).closest('.riskassessment-tasks').html($(resp).find('.riskassessment-task-container-'+taskID).closest('.riskassessment-tasks')) + $('.loader-spin').remove(); + $('.wpeo-loader').removeClass('wpeo-loader') + + actionContainerSuccess.find('.notice-subtitle .text').text(textToShow) + actionContainerSuccess.removeClass('hidden'); + timespent.html($(resp).find('.modal-content').find('.riskassessment-total-task-timespent-'+taskID).first()) + }, + error: function ( resp ) { + $(this).closest('.risk-row-content-' + riskId).removeClass('wpeo-loader'); + let actionContainerError = $('.messageErrorTaskTimeSpentCreate'+ taskID); + actionContainerError.html($(resp).find('.task-timespent-create-error-notice')) + actionContainerError.removeClass('hidden'); + }, + complete: function () { + $('#risk_assessment_task_edit'+taskID+'.wpeo-modal').addClass('modal-active') + } + }); +}; + +/** + * Action delete riskassessmenttasktimespent. + * + * @since 9.1.0 + * @version 9.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.riskassessmenttask.deleteRiskAssessmentTaskTimeSpent = function ( event ) { + let token = window.saturne.toolbox.getToken() + + let taskID = $(this).closest('.riskassessment-task-timespent-list').attr('value'); + let timespentID = $(this).attr('value'); + let deletedRiskAssessmentTaskTimeSpentId = $(this).attr('value'); + + let element = $(this).closest('.riskassessment-task-timespent-'+timespentID); + let textToShow = element.find('.labelForDelete').val(); + let timespent = $('.id-container').first().find('.riskassessment-total-task-timespent-'+taskID) + + var r = confirm(textToShow); + if (r == true) { + + let riskAssessmentTaskRef = $('.riskassessment-task-container-'+taskID).attr('value'); + + window.saturne.loader.display($(this)); + + $.ajax({ + url: document.URL + '&action=deleteRiskAssessmentTaskTimeSpent&deletedRiskAssessmentTaskTimeSpentId=' + deletedRiskAssessmentTaskTimeSpentId + '&token=' + token, + type: "POST", + processData: false, + contentType: false, + success: function ( resp ) { + //$('.fichecenter.risklist').html($(resp).find('#searchFormListRisks')) + let actionContainerSuccess = $('.messageSuccessTaskTimeSpentDelete'+ taskID); + $('.riskassessment-task-timespent-' + timespentID).fadeOut(800); + //$('.riskassessment-tasks' + riskId).fadeIn(800); + let textToShow = ''; + textToShow += actionContainerSuccess.find('.valueForDeleteTaskTimeSpent1').val() + textToShow += riskAssessmentTaskRef + textToShow += actionContainerSuccess.find('.valueForDeleteTaskTimeSpent2').val() + + actionContainerSuccess.find('.notice-subtitle .text').text(textToShow) + actionContainerSuccess.removeClass('hidden'); + timespent.html($(resp).find('.modal-content').find('.riskassessment-total-task-timespent-'+taskID).first()) + }, + error: function ( resp ) { + let actionContainerError = $('.messageErrorTaskDeleteTimeSpent'+ taskID); + + let textToShow = ''; + textToShow += actionContainerError.find('.valueForDeleteTaskTimeSpent1').val() + textToShow += riskAssessmentTaskRef + textToShow += actionContainerError.find('.valueForDeleteTaskTimeSpent2').val() + + actionContainerError.find('.notice-subtitle .text').text(textToShow); + actionContainerError.removeClass('hidden'); + } + }); + + } else { + return false; + } +}; + +/** + * Action save riskassessmenttasktimespent. + * + * @since 9.1.0 + * @version 9.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.riskassessmenttask.saveRiskAssessmentTaskTimeSpent = function ( event ) { + let token = window.saturne.toolbox.getToken() + + let currentElement = $(this); + let riskAssessmentTaskTimeSpentID = $(this).attr('value'); + + let element = $(this).closest('.riskassessment-task-timespent-edit-modal'); + let single = element.find('.riskassessment-task-timespent-container'); + let taskID = single.attr('value'); + let textToShow = ''; + let taskRef = $('.riskassessment-task-container-'+taskID).attr('value'); + let timespent = $('.id-container').first().find('.riskassessment-total-task-timespent-'+taskID) + let date = single.find('#RiskassessmentTaskTimespentDateEdit' + riskAssessmentTaskTimeSpentID).val(); + let hour = single.find('#RiskassessmentTaskTimespentDateEdit' + riskAssessmentTaskTimeSpentID + 'hour').val(); + let min = single.find('#RiskassessmentTaskTimespentDateEdit' + riskAssessmentTaskTimeSpentID + 'min').val(); + let comment = single.find('.riskassessment-task-timespent-comment').val() + comment = window.digiriskdolibarr.risk.sanitizeBeforeRequest(comment) + let duration = single.find('.riskassessment-task-timespent-duration').val() + + window.saturne.loader.display($(this)); + window.saturne.loader.display($('.riskassessment-task-single-'+ taskID)); + + $.ajax({ + url: document.URL + '&action=saveRiskAssessmentTaskTimeSpent&token='+token, + data: JSON.stringify({ + riskAssessmentTaskTimeSpentID: riskAssessmentTaskTimeSpentID, + taskID: taskID, + date: date, + hour: hour, + min: min, + comment: comment, + duration: duration, + }), + type: "POST", + processData: false, + contentType: false, + success: function ( resp ) { + currentElement.closest('.modal-active').removeClass('modal-active') + let actionContainerSuccess = $('.messageSuccessTaskTimeSpentEdit'+ taskID); + $('.wpeo-loader').removeClass('wpeo-loader') + + textToShow += actionContainerSuccess.find('.valueForEditTaskTimeSpent1').val() + textToShow += taskRef + textToShow += actionContainerSuccess.find('.valueForEditTaskTimeSpent2').val() + + timespent.html($(resp).find('.modal-content').find('.riskassessment-total-task-timespent-'+taskID).first()) + $('.riskassessment-task-timespent-list-'+taskID).html($(resp).find('.riskassessment-task-timespent-list-'+taskID).children()) + //actionContainerSuccess.find('a').attr('href', '#risk_row_'+riskId) + + actionContainerSuccess.find('.notice-subtitle .text').text(textToShow) + actionContainerSuccess.removeClass('hidden'); + }, + error: function ( resp ) { + let actionContainerError = $('.messageSuccessTaskTimeSpentEdit'+ taskID); + + textToShow += actionContainerError.find('.valueForEditTaskTimeSpent1').val() + textToShow += taskRef + textToShow += actionContainerError.find('.valueForEditTaskTimeSpent2').val() + + actionContainerError.find('.notice-subtitle .text').text(textToShow); + actionContainerError.removeClass('hidden'); + } + }); +}; + +/** + * Action check task progress. + * + * @since 9.1.0 + * @version 9.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.riskassessmenttask.checkTaskProgress = function ( event ) { + let token = window.saturne.toolbox.getToken() + + let elementRiskAssessmentTask = $(this).closest('.riskassessment-task-container'); + let RiskAssessmentTaskId = elementRiskAssessmentTask.find('.riskassessment-task-single-content').attr('value'); + let riskId = $(this).closest('.riskassessment-tasks').attr('value'); + let textToShow = ''; + + let taskRef = elementRiskAssessmentTask.attr('value'); + + let taskProgress = ''; + if (elementRiskAssessmentTask.find('.riskassessment-task-progress-checkbox'+RiskAssessmentTaskId).hasClass('progress-checkbox-check')) { + taskProgress = 0; + elementRiskAssessmentTask.find('.riskassessment-task-progress-checkbox'+RiskAssessmentTaskId).toggleClass('progress-checkbox-check').toggleClass('progress-checkbox-uncheck'); + } else if (elementRiskAssessmentTask.find('.riskassessment-task-progress-checkbox'+RiskAssessmentTaskId).hasClass('progress-checkbox-uncheck')) { + taskProgress = 1; + elementRiskAssessmentTask.find('.riskassessment-task-progress-checkbox'+RiskAssessmentTaskId).toggleClass('progress-checkbox-uncheck').toggleClass('progress-checkbox-check'); + } + + window.saturne.loader.display($('.riskassessment-task-single-'+ RiskAssessmentTaskId)); + + let url = window.location.href.replace(/#.*/, ""); + + $.ajax({ + url: url + '&action=checkTaskProgress&token='+token, + data: JSON.stringify({ + riskAssessmentTaskID: RiskAssessmentTaskId, + taskProgress: taskProgress, + }), + type: "POST", + processData: false, + contentType: false, + success: function ( resp ) { + $('.fichecenter.risklist').html($(resp).find('#searchFormListRisks')) + let actionContainerSuccess = $('.messageSuccessTaskEdit'); + $('.riskassessment-tasks' + riskId).fadeOut(800); + $('.riskassessment-tasks' + riskId).fadeIn(800); + textToShow += actionContainerSuccess.find('.valueForEditTask1').val() + textToShow += taskRef + textToShow += actionContainerSuccess.find('.valueForEditTask2').val() + + actionContainerSuccess.find('.notice-subtitle .text').text(textToShow) + actionContainerSuccess.removeClass('hidden'); + }, + error: function ( resp ) { + let actionContainerError = $('.messageErrorTaskEdit'); + + textToShow += actionContainerError.find('.valueForEditTask1').val() + textToShow += taskRef + textToShow += actionContainerError.find('.valueForEditTask2').val() + + actionContainerError.find('.notice-subtitle .text').text(textToShow); + actionContainerError.removeClass('hidden'); + } + }); +}; + +/** + * Select riskAssessmentTask TimeSpent date hour. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @param elementParent --- Parent element + * @return {void} + */ +window.digiriskdolibarr.riskassessmenttask.selectRiskassessmentTaskTimespentDateHour = function( event ) { + $(this).closest('.nowraponall').find('.select-riskassessmenttask-timespent-datehour').remove(); + $(this).before('') +}; + +/** + * Select riskAssessmentTask TimeSpent date min. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @param elementParent --- Parent element + * @return {void} + */ +window.digiriskdolibarr.riskassessmenttask.selectRiskassessmentTaskTimespentDateMin = function( event ) { + $(this).closest('.nowraponall').find('.select-riskassessmenttask-timespent-datemin').remove(); + $(this).before('') +}; + +/** + * Check riskassessmenttask label length + * + * @since 9.4.0 + * @version 9.4.0 + * + * @param {MouseEvent} event [description] + * @return {void} + */ +window.digiriskdolibarr.riskassessmenttask.checkRiskassessmentTaskLabelLength = function( event ) { + var labelLenght = $(this).val().length; + if (labelLenght > 255) { + let actionContainerWarning = $('.messageWarningTaskLabel'); + actionContainerWarning.removeClass('hidden'); + $('.riskassessment-task-create').removeClass('button-blue'); + $('.riskassessment-task-create').addClass('button-grey'); + $('.riskassessment-task-create').addClass('button-disable'); + } else { + let actionContainerWarning = $('.messageWarningTaskLabel'); + actionContainerWarning.addClass('hidden'); + $('.riskassessment-task-create').addClass('button-blue'); + $('.riskassessment-task-create').removeClass('button-grey'); + $('.riskassessment-task-create').removeClass('button-disable'); + } +}; + +/** + * Redirect on shared task config + * + * @since 9.8.2 + * @version 9.8.2 + * + * @param {MouseEvent} event [description] + * @return {void} + */ +window.digiriskdolibarr.riskassessmenttask.redirectOnSharedTaskConfig = function( event ) { + let url = $('.riskassessment-tasks').find('input[name="sharedTaskTooltipUrl"]').val(); + window.open(location.origin + url, '_blank'); +}; diff --git a/js/modules/ticket.js b/js/modules/ticket.js new file mode 100644 index 000000000..7fd2b40e2 --- /dev/null +++ b/js/modules/ticket.js @@ -0,0 +1,272 @@ + +/** + * Initialise l'objet "ticket" ainsi que la méthode "init" obligatoire pour la bibliothèque DigiriskDolibarr. + * + * @since 1.1.0 + * @version 1.1.0 + */ +window.digiriskdolibarr.ticket = {}; + +/** + * La méthode appelée automatiquement par la bibliothèque DigiriskDolibarr. + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.ticket.init = function() { + window.digiriskdolibarr.ticket.event(); +}; + +/** + * La méthode contenant tous les événements pour les tickets. + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.ticket.event = function() { + $( document ).on( 'click', '.ticket-parentCategory', window.digiriskdolibarr.ticket.selectParentCategory ); + $( document ).on( 'click', '.ticket-subCategory', window.digiriskdolibarr.ticket.selectSubCategory ); + $( document ).on( 'submit', '#sendFile', window.digiriskdolibarr.ticket.tmpStockFile ); + $( document ).on( 'click', '.linked-file-delete', window.digiriskdolibarr.ticket.removeFile ); + $( document ).on( 'change', '.add-dashboard-info', window.digiriskdolibarr.ticket.addDashBoardTicketInfo ); + $( document ).on( 'click', '.close-dashboard-info', window.digiriskdolibarr.ticket.closeDashBoardTicketInfo ); + $( document ).on( 'keyup', '.email', window.digiriskdolibarr.ticket.checkValidEmail ); + $( document ).on( 'keyup', '.options_digiriskdolibarr_ticket_phone', window.digiriskdolibarr.ticket.checkValidPhone ); +}; + +/** + * Mets à jour les input du formulaire + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.ticket.updateFormData = function( ) { + let parentCategoryID = window.digiriskdolibarr.ticket.getParentCategory() + let subCategoryID = window.digiriskdolibarr.ticket.getSubCategory() + + $('.ticket-parentCategory.active').removeClass('active') + $('.ticket-parentCategory'+parentCategoryID).addClass('active') + + $('.subCategories').attr('style','display:none') + $('.children'+parentCategoryID).attr('style','') + + $('.ticket-subCategory.active').removeClass('active') + $('.ticket-subCategory'+subCategoryID).addClass('active') +}; + +/** + * Clique sur une des catégories parentes de la liste. + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.ticket.selectParentCategory = function( ) { + let subCategoryInput = $('.ticketpublicarea').find("#subCategory"); + let parentCategoryInput = $('.ticketpublicarea').find("#parentCategory"); + + subCategoryInput.val(0) + parentCategoryInput.val($(this).attr('id')) + + window.digiriskdolibarr.ticket.updateFormData() +}; + +/** + * Récupère la valeur de la catégorie parente sélectionnée + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.ticket.getParentCategory = function( ) { + return $('.ticketpublicarea').find("#parentCategory").val() +}; + +/** + * Clique sur une des catégories enfants de la liste. + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.ticket.selectSubCategory = function( ) { + let subCategoryInput = $('.ticketpublicarea').find("#subCategory"); + subCategoryInput.val($(this).attr('id')) + + window.digiriskdolibarr.ticket.updateFormData() +}; + +/** + * Récupère la valeur de la catégorie enfant sélectionnée + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.ticket.getSubCategory = function( ) { + return $('.ticketpublicarea').find("#subCategory").val() +}; + +/** + * Upload automatiquement le(s) fichier(s) séelectionnés dans ecm/digiriskdolibarr/ticket/tmp/__REF__ + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.ticket.tmpStockFile = function( ) { + event.preventDefault() + + var files = $('#sendfile').prop('files'); + + const formData = new FormData(); + for (let i = 0; i < files.length; i++) { + let file = files[i] + formData.append('files[]', file) + } + var ticket_id = $('#ticket_id').val() + let querySeparator = window.saturne.toolbox.getQuerySeparator() + + window.saturne.loader.display($('.files-uploaded')); + + fetch(document.URL + querySeparator + 'action=sendfile&ticket_id='+ticket_id, { + method: 'POST', + body: formData, + }).then((resp) => { + $('#sendFileForm').load(document.URL+ querySeparator + 'ticket_id='+ticket_id + ' #fileLinkedTable') + }) +}; + +/** + * Upload automatiquement le(s) fichier(s) séelectionnés dans ecm/digiriskdolibarr/ticket/tmp/__REF__ + * + * @since 1.1.0 + * @version 1.1.0 + * + * @return {void} + */ +window.digiriskdolibarr.ticket.removeFile = function( event ) { + let filetodelete = $(this).attr('value'); + filetodelete = filetodelete.replace('_mini', '') + let ticket_id = $('#ticket_id').val() + let querySeparator = window.saturne.toolbox.getQuerySeparator() + + fetch(document.URL + querySeparator + 'action=removefile&filetodelete='+filetodelete+'&ticket_id='+ticket_id, { + method: 'POST', + }).then((resp) => { + $(this).parent().parent().hide() + }) +}; + +/** + * Add ticket dashboard info for a category by service + * + * @since 9.5.0 + * @version 9.5.0 + * + * @return {void} + */ +window.digiriskdolibarr.ticket.addDashBoardTicketInfo = function() { + let token = window.saturne.toolbox.getToken() + + let selectTitle = $('#select2-boxcombo-container').attr('title') + let digiriskelementID = selectTitle.split(' : ')[0]; + let catID = selectTitle.split(' : ')[2]; + let querySeparator = window.saturne.toolbox.getQuerySeparator() + + $.ajax({ + url: document.URL + querySeparator + 'action=adddashboardinfo&token='+token, + type: "POST", + processData: false, + data: JSON.stringify({ + digiriskelementID: digiriskelementID, + catID: catID + }), + contentType: false, + success: function ( resp ) { + window.location.reload(); + }, + error: function ( ) { + } + }); +}; + +/** + * Close ticket dashboard info for a category by service + * + * @since 9.5.0 + * @version 9.5.0 + * + * @return {void} + */ +window.digiriskdolibarr.ticket.closeDashBoardTicketInfo = function() { + let token = window.saturne.toolbox.getToken() + + let box = $(this); + let digiriskelementID = box.attr('data-digiriskelementid'); + let catID = box.attr('data-catid'); + let querySeparator = window.saturne.toolbox.getQuerySeparator() + + $.ajax({ + url: document.URL + querySeparator + 'action=closedashboardinfo&token='+token, + type: "POST", + processData: false, + data: JSON.stringify({ + digiriskelementID: digiriskelementID, + catID: catID + }), + contentType: false, + success: function ( resp ) { + box.closest('.box-flex-item').fadeOut(400) + $('.add-widget-box').attr('style', '') + $('.add-widget-box').html($(resp).find('.add-widget-box').children()) + }, + error: function ( ) { + } + }); +}; + +/** + * Check if email is valid + * + * @since 9.6.0 + * @version 9.6.0 + * + * @return {void} + */ +window.digiriskdolibarr.ticket.checkValidEmail = function() { + var reEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; + if (reEmail.test(this.value) == false) { + $(this).css("border", "3px solid red"); + } else { + $(this).css("border", "3px solid green"); + } +}; + +/** + * Check if phone is valid + * + * @since 9.8.2 + * @version 9.8.2 + * + * @return {void} + */ +window.digiriskdolibarr.ticket.checkValidPhone = function() { + var rePhone = /^(?:(?:(?:\+|00)\d{2}[\s]?(?:\(0\)[\s]?)?)|0){1}[1-9]{1}([\s.-]?)(?:\d{2}\1?){3}\d{2}$/; + if (rePhone.test(this.value) == false) { + $(this).css("border", "3px solid red"); + } else { + $(this).css("border", "3px solid green"); + } +}; diff --git a/js/modules/user.js b/js/modules/user.js new file mode 100644 index 000000000..a775c2d56 --- /dev/null +++ b/js/modules/user.js @@ -0,0 +1,77 @@ + +/** + * Initialise l'objet "digiriskusers" ainsi que la méthode "init" obligatoire pour la bibliothèque DigiriskDolibarr. + * + * @since 1.0.0 + * @version 1.0.0 + */ +window.digiriskdolibarr.digiriskusers = {}; + +/** + * La méthode appelée automatiquement par la bibliothèque DigiriskDolibarr. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.digiriskusers.init = function() { + window.digiriskdolibarr.digiriskusers.event(); +}; + +/** + * La méthode contenant tous les événements pour l'évaluateur. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @return {void} + */ +window.digiriskdolibarr.digiriskusers.event = function() { + $( document ).on( 'input', '.digirisk-users #firstname', window.digiriskdolibarr.digiriskusers.fillEmail ); + $( document ).on( 'input', '.digirisk-users #lastname', window.digiriskdolibarr.digiriskusers.fillEmail ); +}; + +/** + * Clique sur une des user de la liste. + * + * @since 1.0.0 + * @version 1.0.0 + * + * @param {ClickEvent} event L'état du clic. + * @return {void} + */ +window.digiriskdolibarr.digiriskusers.fillEmail = function( event ) { + + var firstname = $('.digirisk-users #firstname').val() + var lastname = $('.digirisk-users #lastname').val() + var domainMail = $( '.input-domain-mail' ).val(); + + var together = window.digiriskdolibarr.digiriskusers.removeDiacritics( firstname + '.' + lastname + '@' + domainMail ).toLowerCase(); + + $('.digirisk-users #email').val(together) +}; + +/** + * [description] + * + * @memberof EO_Framework_Global + * + * @param {void} input [description] + * @returns {void} [description] + */ +window.digiriskdolibarr.digiriskusers.removeDiacritics = function( input ) { + var output = ''; + var normalized = input.normalize( 'NFD' ); + var i = 0; + var j = 0; + + while ( i < input.length ) { + output += normalized[j]; + + j += ( input[i] == normalized[j] ) ? 1 : 2; + i++; + } + + return output; +}; diff --git a/public/ticket/create_ticket.php b/public/ticket/create_ticket.php index 59bd93c22..1f5383348 100644 --- a/public/ticket/create_ticket.php +++ b/public/ticket/create_ticket.php @@ -498,7 +498,7 @@
From ce836c42fe8a1fb0212eda9e8155f569df3b5e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20David?= Date: Mon, 28 Aug 2023 15:44:07 +0200 Subject: [PATCH 004/293] #3217 [DigiriskStandard] add: first saturne integration --- ...skdolibarr_legaldisplayfields_view.tpl.php | 26 ++-- lib/digiriskdolibarr_digiriskstandard.lib.php | 2 +- lib/digiriskdolibarr_function.lib.php | 5 +- .../digiriskstandard_legaldisplay.php | 136 ++++-------------- 4 files changed, 47 insertions(+), 122 deletions(-) diff --git a/core/tpl/digiriskdocuments/digiriskdolibarr_legaldisplayfields_view.tpl.php b/core/tpl/digiriskdocuments/digiriskdolibarr_legaldisplayfields_view.tpl.php index 2f17ed739..412d7f9a6 100644 --- a/core/tpl/digiriskdocuments/digiriskdolibarr_legaldisplayfields_view.tpl.php +++ b/core/tpl/digiriskdocuments/digiriskdolibarr_legaldisplayfields_view.tpl.php @@ -28,9 +28,9 @@ LegalDisplayFillJSON($legaldisplay), false, 512, JSON_UNESCAPED_UNICODE)->LegalDisplay; + $document = json_decode($document->LegalDisplayFillJSON($document), false, 512, JSON_UNESCAPED_UNICODE)->LegalDisplay; } catch (Exception $e) { - $legaldisplay->error = $e->getMessage(); + $document->error = $e->getMessage(); dol_syslog($e->getMessage(), LOG_INFO); return -1; } @@ -39,8 +39,8 @@ print ''; print ' ' . $form->textwithpicto($langs->trans("LabourDoctor"), $langs->trans('HowToSetDataLegalDisplay')) . ''; print ''; -if ($legaldisplay->occupational_health_service->id > 0) { - $contact->fetch($legaldisplay->occupational_health_service->id); +if ($document->occupational_health_service->id > 0) { + $contact->fetch($document->occupational_health_service->id); print $contact->getNomUrl(1); } print ''; @@ -49,8 +49,8 @@ print ''; print ' ' . $form->textwithpicto($langs->trans("LabourInspector"), $langs->trans('HowToSetDataLegalDisplay')) . ''; print ''; -if ($legaldisplay->detective_work->id > 0) { - $contact->fetch($legaldisplay->detective_work->id); +if ($document->detective_work->id > 0) { + $contact->fetch($document->detective_work->id); print $contact->getNomUrl(1); } print ''; @@ -59,49 +59,49 @@ print ''; print ' ' . $form->textwithpicto($langs->trans("SAMU"), $langs->trans('HowToSetDataLegalDisplay')) . ''; print ''; -print ' ' . $legaldisplay->emergency_service->samu; +print ' ' . $document->emergency_service->samu; print ''; // Pompiers print ''; print ' ' . $form->textwithpicto($langs->trans("Pompiers"), $langs->trans('HowToSetDataLegalDisplay')) . ''; print ''; -print ' ' . $legaldisplay->emergency_service->pompier; +print ' ' . $document->emergency_service->pompier; print ''; // Police print ''; print ' ' . $form->textwithpicto($langs->trans("Police"), $langs->trans('HowToSetDataLegalDisplay')) . ''; print ''; -print ' ' . $legaldisplay->emergency_service->police; +print ' ' . $document->emergency_service->police; print ''; // Urgences print ''; print ' ' . $form->textwithpicto($langs->trans("AllEmergencies"), $langs->trans('HowToSetDataLegalDisplay')) . ''; print ''; -print ' ' . $legaldisplay->emergency_service->emergency; +print ' ' . $document->emergency_service->emergency; print ''; // Défenseur du droit du travail print ''; print ' ' . $form->textwithpicto($langs->trans("RightsDefender"), $langs->trans('HowToSetDataLegalDisplay')) . ''; print ''; -print ' ' . $legaldisplay->emergency_service->right_defender; +print ' ' . $document->emergency_service->right_defender; print ''; // Centre Antipoison print ''; print ' ' . $form->textwithpicto($langs->trans("PoisonControlCenter"), $langs->trans('HowToSetDataLegalDisplay')) . ''; print ''; -print ' ' . $legaldisplay->emergency_service->poison_control_center; +print ' ' . $document->emergency_service->poison_control_center; print ''; // Responsable de prévention print ''; print ' ' . $form->textwithpicto($langs->trans("ResponsibleToNotify"), $langs->trans('HowToSetDataLegalDisplay')) . ''; print ''; -$usertmp->fetch($legaldisplay->safety_rule->id); +$usertmp->fetch($document->safety_rule->id); print $usertmp->getNomUrl(1); print ''; diff --git a/lib/digiriskdolibarr_digiriskstandard.lib.php b/lib/digiriskdolibarr_digiriskstandard.lib.php index fc23e1528..167fd72b6 100644 --- a/lib/digiriskdolibarr_digiriskstandard.lib.php +++ b/lib/digiriskdolibarr_digiriskstandard.lib.php @@ -27,7 +27,7 @@ * @param DigiriskStandard $object DigiriskStandard * @return array Array of tabs */ -function digiriskstandardPrepareHead($object) +function digiriskstandard_prepare_head($object) { global $langs, $conf, $user; diff --git a/lib/digiriskdolibarr_function.lib.php b/lib/digiriskdolibarr_function.lib.php index 75b60f167..e3b1adc50 100644 --- a/lib/digiriskdolibarr_function.lib.php +++ b/lib/digiriskdolibarr_function.lib.php @@ -543,7 +543,7 @@ function remove_index($model) * @return void *@throws Exception */ -function digiriskHeader($title = '', $help_url = '', $arrayofjs = array(), $arrayofcss = array(), $morequerystring = '', $morecssonbody = '', $replacemainareaby = '') +function digirisk_header($title = '', $helpUrl = '', $arrayofjs = [], $arrayofcss = [], $morequerystring = '', $morecssonbody = '', $replacemainareaby = '') { global $conf, $langs, $db, $user; @@ -552,6 +552,7 @@ function digiriskHeader($title = '', $help_url = '', $arrayofjs = array(), $arra require_once __DIR__ . '/../core/modules/digiriskdolibarr/digiriskelement/groupment/mod_groupment_sirius.php'; require_once __DIR__ . '/../core/modules/digiriskdolibarr/digiriskelement/workunit/mod_workunit_standard.php'; require_once __DIR__ . '/../core/modules/digiriskdolibarr/digiriskelement/workunit/mod_workunit_canopus.php'; + $mod_groupment = new $conf->global->DIGIRISKDOLIBARR_GROUPMENT_ADDON(); $mod_workunit = new $conf->global->DIGIRISKDOLIBARR_WORKUNIT_ADDON(); @@ -561,7 +562,7 @@ function digiriskHeader($title = '', $help_url = '', $arrayofjs = array(), $arra $workunit_prefix = dol_strlen($mod_workunit->prefix) > 0 ? $mod_workunit->prefix : $conf->global->DIGIRISKDOLIBARR_WORKUNIT_CANOPUS_ADDON; $workunit_prefix = preg_match('/{/',$workunit_prefix) ? preg_split('/{/', $workunit_prefix)[0] : $workunit_prefix; - llxHeader('', $title, $help_url, '', '', '', $arrayofjs, $arrayofcss, $morequerystring, $morecssonbody); + saturne_header(1, '', $title, $helpUrl, '', 0, 0, $arrayofjs, $arrayofcss, $morequerystring, $morecssonbody); //Body navigation digirisk $object = new DigiriskElement($db); diff --git a/view/digiriskstandard/digiriskstandard_legaldisplay.php b/view/digiriskstandard/digiriskstandard_legaldisplay.php index 136774b34..893839782 100644 --- a/view/digiriskstandard/digiriskstandard_legaldisplay.php +++ b/view/digiriskstandard/digiriskstandard_legaldisplay.php @@ -21,26 +21,20 @@ * \brief Page to view legaldisplay */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once __DIR__ . '/../../class/digiriskstandard.class.php'; -require_once __DIR__ . '/../../class/digiriskdocuments/legaldisplay.class.php'; +require_once __DIR__ . '/../../class/digiriskdolibarrdocuments/legaldisplay.class.php'; require_once __DIR__ . '/../../lib/digiriskdolibarr_digiriskstandard.lib.php'; require_once __DIR__ . '/../../lib/digiriskdolibarr_function.lib.php'; require_once __DIR__ . '/../../core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/modules_legaldisplay.php'; @@ -48,14 +42,14 @@ global $db, $conf, $langs, $user, $hookmanager; // Load translation files required by the page -$langs->loadLangs(array("digiriskdolibarr@digiriskdolibarr", "other")); +saturne_load_langs(['others']); // Get parameters $action = GETPOST('action', 'aZ09'); // Initialize technical objects $object = new DigiriskStandard($db); -$legaldisplay = new LegalDisplay($db); +$document = new LegalDisplay($db); $contact = new Contact($db); $usertmp = new User($db); $project = new Project($db); @@ -64,15 +58,14 @@ $object->fetch($conf->global->DIGIRISKDOLIBARR_ACTIVE_STANDARD); -$upload_dir = $conf->digiriskdolibarr->multidir_output[isset($conf->entity) ? $conf->entity : 1]; - -//Security check +$upload_dir = $conf->digiriskdolibarr->multidir_output[$conf->entity ?? 1]; +// Security check - Protection if external user $permissiontoread = $user->rights->digiriskdolibarr->legaldisplay->read; $permissiontoadd = $user->rights->digiriskdolibarr->legaldisplay->write; $permissiontodelete = $user->rights->digiriskdolibarr->legaldisplay->delete; -if ( ! $permissiontoread) accessforbidden(); +saturne_check_access($permissiontoread); /* * Actions @@ -85,75 +78,12 @@ if (empty($reshook)) { $error = 0; - // Action to build doc - if ($action == 'builddoc' && $permissiontoadd) { - $outputlangs = $langs; - $newlang = ''; - - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); - if ( ! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - - // To be sure vars is defined - if (empty($hidedetails)) $hidedetails = 0; - if (empty($hidedesc)) $hidedesc = 0; - if (empty($hideref)) $hideref = 0; - if (empty($moreparams)) $moreparams = null; - - $model = GETPOST('model', 'alpha'); - - $moreparams['object'] = ""; - $moreparams['user'] = $user; - - $result = $legaldisplay->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); - if ($result <= 0) { - setEventMessages($object->error, $object->errors, 'errors'); - $action = ''; - } else { - if (empty($donotredirect)) { - setEventMessages($langs->trans("FileGenerated") . ' - ' . $legaldisplay->last_main_doc, null); - - $urltoredirect = $_SERVER['REQUEST_URI']; - $urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect); - $urltoredirect = preg_replace('/action=builddoc&?/', '', $urltoredirect); // To avoid infinite loop - - header('Location: ' . $urltoredirect . '#builddoc'); - exit; - } - } - } + // Actions builddoc, forcebuilddoc, remove_file. + require_once __DIR__ . '/../../../saturne/core/tpl/documents/documents_action.tpl.php'; // Action to generate pdf from odt file - require_once __DIR__ . '/../../core/tpl/documents/digiriskdolibarr_manual_pdf_generation_action.tpl.php'; - -} - -// Delete file in doc form -if ($action == 'remove_file' && $permissiontodelete) { - if ( ! empty($upload_dir)) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - - $langs->load("other"); - $filetodelete = GETPOST('file', 'alpha'); - $file = $upload_dir . '/' . $filetodelete; - $ret = dol_delete_file($file, 0, 0, 0, $object); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", $filetodelete), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", $filetodelete), null, 'errors'); - - // Make a redirect to avoid to keep the remove_file into the url that create side effects - $urltoredirect = $_SERVER['REQUEST_URI']; - $urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect); - $urltoredirect = preg_replace('/action=remove_file&?/', '', $urltoredirect); - - header('Location: ' . $urltoredirect); - exit; - } else { - setEventMessages('BugFoundVarUploaddirnotDefined', null, 'errors'); - } + require_once __DIR__ . '/../../../saturne/core/tpl/documents/saturne_manual_pdf_generation_action.tpl.php'; } - /* * View */ @@ -161,19 +91,16 @@ $emptyobject = new stdClass(); $title = $langs->trans('LegalDisplay'); -$help_url = 'FR:Module_Digirisk#Soci.C3.A9t.C3.A9.2FOrganisation'; -$morejs = array("/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); +$helpUrl = 'FR:Module_Digirisk#Soci.C3.A9t.C3.A9.2FOrganisation'; -digiriskHeader($title, $help_url, $morejs, $morecss); ?> +digirisk_header($title, $helpUrl); ?>
-fetch_optionals(); -$head = digiriskstandardPrepareHead($object); -print dol_get_fiche_head($head, 'standardLegalDisplay', $title, -1, "digiriskdolibarr@digiriskdolibarr"); +saturne_get_fiche_head($object, 'standardLegalDisplay', $title); // Object card // ------------------------------------------------------------ @@ -200,20 +127,17 @@ print dol_get_fiche_end(); // Document Generation -- Génération des documents -$includedocgeneration = 1; -if ($includedocgeneration) { - $dir_files = 'legaldisplay'; - $filedir = $upload_dir . '/' . $dir_files; - $urlsource = $_SERVER["PHP_SELF"]; - $modulepart = 'digiriskdolibarr:LegalDisplay'; - - if ($permissiontoadd || $permissiontoread) { - $genallowed = 1; - } - - print digiriskshowdocuments($modulepart, $dir_files, $filedir, $urlsource, $genallowed, $permissiontodelete, $conf->global->DIGIRISKDOLIBARR_LEGALDISPLAY_DEFAULT_MODEL, 1, 0, '', $langs->trans('LegalDisplay'), '', '', $legaldisplay); +$dirFiles = 'legaldisplay'; +$filedir = $upload_dir . '/' . $dirFiles; +$urlsource = $_SERVER["PHP_SELF"]; +$modulepart = 'digiriskdolibarr:LegalDisplay'; + +if ($permissiontoadd || $permissiontoread) { + $genallowed = 1; } +print saturne_show_documents($modulepart, $dirFiles, $filedir, $urlsource, 1,1, '', 1, 0, 0, 0, 0, '', 0, '', empty($soc->default_lang) ? '' : $soc->default_lang, $object); + // End of page llxFooter(); $db->close(); From 3219ca10a1b1c205e6ef61a48b120178876fbdf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20David?= Date: Mon, 28 Aug 2023 18:12:52 +0200 Subject: [PATCH 005/293] #3217 [DigiriskStandard] fix: saturne integration --- .../groupmentdocument.class.php | 2 +- .../workunitdocument.class.php | 2 +- ...arr_informationssharingfields_view.tpl.php | 40 ++-- lib/digiriskdolibarr_function.lib.php | 171 ------------------ .../digiriskstandard_agenda.php | 81 ++++----- .../digiriskstandard_card.php | 41 ++--- .../digiriskstandard_informationssharing.php | 144 ++++----------- .../digiriskstandard_legaldisplay.php | 12 +- ...igiriskstandard_riskassessmentdocument.php | 124 +++++-------- 9 files changed, 155 insertions(+), 462 deletions(-) diff --git a/class/digiriskdolibarrdocuments/groupmentdocument.class.php b/class/digiriskdolibarrdocuments/groupmentdocument.class.php index 1303d877b..17c79b560 100644 --- a/class/digiriskdolibarrdocuments/groupmentdocument.class.php +++ b/class/digiriskdolibarrdocuments/groupmentdocument.class.php @@ -32,7 +32,7 @@ class GroupmentDocument extends SaturneDocuments /** * @var string Module name. */ - public string $module = 'digiriskdolibarr'; + public $module = 'digiriskdolibarr'; /** * @var string Element type of object. diff --git a/class/digiriskdolibarrdocuments/workunitdocument.class.php b/class/digiriskdolibarrdocuments/workunitdocument.class.php index 2d2eb7bbf..43aa61f1e 100644 --- a/class/digiriskdolibarrdocuments/workunitdocument.class.php +++ b/class/digiriskdolibarrdocuments/workunitdocument.class.php @@ -32,7 +32,7 @@ class WorkUnitDocument extends SaturneDocuments /** * @var string Module name. */ - public string $module = 'digiriskdolibarr'; + public $module = 'digiriskdolibarr'; /** * @var string Element type of object. diff --git a/core/tpl/digiriskdocuments/digiriskdolibarr_informationssharingfields_view.tpl.php b/core/tpl/digiriskdocuments/digiriskdolibarr_informationssharingfields_view.tpl.php index ba216226e..aa1395deb 100644 --- a/core/tpl/digiriskdocuments/digiriskdolibarr_informationssharingfields_view.tpl.php +++ b/core/tpl/digiriskdocuments/digiriskdolibarr_informationssharingfields_view.tpl.php @@ -28,9 +28,9 @@ InformationsSharingFillJSON($informationssharing), false, 512, JSON_UNESCAPED_UNICODE)->InformationsSharing; + $document = json_decode($document->InformationsSharingFillJSON($document), false, 512, JSON_UNESCAPED_UNICODE)->InformationsSharing; } catch (Exception $e) { - $informationssharing->error = $e->getMessage(); + $document->error = $e->getMessage(); dol_syslog($e->getMessage(), LOG_INFO); return -1; } @@ -39,10 +39,10 @@ print ''; print ' ' . $form->textwithpicto($langs->trans("LabourDoctor"), $langs->trans('HowToSetDataLegalDisplay')) . ''; print ''; -if ($informationssharing->occupational_health_service->id > 0) { - $contact->fetch($informationssharing->occupational_health_service->id); +if ($document->occupational_health_service->id > 0) { + $contact->fetch($document->occupational_health_service->id); print $contact->getNomUrl(1) . ' '; - print ' ' . $informationssharing->occupational_health_service->phone; + print ' ' . $document->occupational_health_service->phone; } print ''; @@ -50,10 +50,10 @@ print ''; print ' ' . $form->textwithpicto($langs->trans("LabourInspector"), $langs->trans('HowToSetDataLegalDisplay')) . ''; print ''; -if ($informationssharing->detective_work->id > 0) { - $contact->fetch($informationssharing->detective_work->id); +if ($document->detective_work->id > 0) { + $contact->fetch($document->detective_work->id); print $contact->getNomUrl(1) . ' '; - print ' ' . $informationssharing->detective_work->phone; + print ' ' . $document->detective_work->phone; } print ''; @@ -61,10 +61,10 @@ print ''; print ' ' . $form->textwithpicto($langs->trans("HarassmentOfficer"), $langs->trans('HowToSetDataInformationsSharing')) . ''; print ''; -if ($informationssharing->harassment_officer->id > 0) { - $user->fetch($informationssharing->harassment_officer->id); +if ($document->harassment_officer->id > 0) { + $user->fetch($document->harassment_officer->id); print $user->getNomUrl(1) . ' '; - print ' ' . $informationssharing->harassment_officer->phone; + print ' ' . $document->harassment_officer->phone; } print ''; @@ -72,10 +72,10 @@ print ''; print ' ' . $form->textwithpicto($langs->trans("HarassmentOfficerCSE"), $langs->trans('HowToSetDataInformationsSharing')) . ''; print ''; -if ($informationssharing->harassment_officer_cse->id > 0) { - $user->fetch($informationssharing->harassment_officer_cse->id); +if ($document->harassment_officer_cse->id > 0) { + $user->fetch($document->harassment_officer_cse->id); print $user->getNomUrl(1) . ' '; - print ' ' . $informationssharing->harassment_officer_cse->phone; + print ' ' . $document->harassment_officer_cse->phone; } print ''; @@ -85,21 +85,21 @@ print ''; print ' ' . $form->textwithpicto($langs->trans("ElectionDateCSE"), $langs->trans('HowToSetDataInformationsSharing')) . ''; print ''; -print ' ' . dol_print_date($informationssharing->membres_du_comite_entreprise_date, 'day'); +print ' ' . dol_print_date($document->membres_du_comite_entreprise_date, 'day'); print ''; // Titulars print ''; print ' ' . $form->textwithpicto($langs->trans("Titulars"), $langs->trans('HowToSetDataInformationsSharing')) . ''; print ''; -print $informationssharing->membres_du_comite_entreprise_titulairesFullName; +print $document->membres_du_comite_entreprise_titulairesFullName; print ''; // Alternates print ''; print ' ' . $form->textwithpicto($langs->trans("Alternates"), $langs->trans('HowToSetDataInformationsSharing')) . ''; print ''; -print $informationssharing->membres_du_comite_entreprise_suppleantsFullName; +print $document->membres_du_comite_entreprise_suppleantsFullName; print ''; // DP @@ -107,21 +107,21 @@ print ''; print ' ' . $form->textwithpicto($langs->trans("ElectionDateDP"), $langs->trans('HowToSetDataInformationsSharing')) . ''; print ''; -print ' ' . dol_print_date($informationssharing->delegues_du_personnels_date, 'day'); +print ' ' . dol_print_date($document->delegues_du_personnels_date, 'day'); print ''; //Titulars print ''; print ' ' . $form->textwithpicto($langs->trans("Titulars"), $langs->trans('HowToSetDataInformationsSharing')) . ''; print ''; -print $informationssharing->delegues_du_personnels_titulairesFullName; +print $document->delegues_du_personnels_titulairesFullName; print ''; //Alternates print ''; print ' ' . $form->textwithpicto($langs->trans("Alternates"), $langs->trans('HowToSetDataInformationsSharing')) . ''; print ''; -print $informationssharing->delegues_du_personnels_suppleantsFullName; +print $document->delegues_du_personnels_suppleantsFullName; print ''; ?> diff --git a/lib/digiriskdolibarr_function.lib.php b/lib/digiriskdolibarr_function.lib.php index e3b1adc50..f70b518b9 100644 --- a/lib/digiriskdolibarr_function.lib.php +++ b/lib/digiriskdolibarr_function.lib.php @@ -21,175 +21,6 @@ * \brief Library files with common functions for Digiriskdolibarr */ -/** - * Show photos of an object (nbmax maximum), into several columns - * - * @param string $modulepart 'product', 'ticket', ... - * @param string $sdir Directory to scan (full absolute path) - * @param string $size 0=original size, 1='small' use thumbnail if possible - * @param int $nbmax Nombre maximum de photos (0=pas de max) - * @param int $nbbyrow Number of image per line or -1 to use div. Used only if size=1. - * @param int $showfilename 1=Show filename - * @param int $showaction 1=Show icon with action links (resize, delete) - * @param int $maxHeight Max height of original image when size='small' (so we can use original even if small requested). If 0, always use 'small' thumb image. - * @param int $maxWidth Max width of original image when size='small' - * @param int $nolink Do not add a href link to view enlarged imaged into a new tab - * @param int $notitle Do not add title tag on image - * @param int $usesharelink Use the public shared link of image (if not available, the 'nophoto' image will be shown instead) - * @param string $subdir Subdirectory to scan - * @param object $object Object element - * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto - */ -function digirisk_show_photos($modulepart, $sdir, $size = '', $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0, $notitle = 0, $usesharelink = 0, $subdir = "", $object = null) -{ - global $conf, $langs; - - include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - include_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php'; - - $sortfield = 'position_name'; - $sortorder = 'desc'; - - if (is_object($object)) { - $dir = $sdir . '/' . $object->ref . '/'; - $pdir = $subdir . '/' . $object->ref . '/'; - } else { - $dir = $sdir . '/'; - $pdir = $subdir . '/'; - } - - // Defined relative dir to DOL_DATA_ROOT - if ($dir) { - $relativedir = preg_replace('/^' . preg_quote(DOL_DATA_ROOT, '/') . '/', '', $dir); - $relativedir = preg_replace('/^[\\/]/', '', $relativedir); - preg_replace('/[\\/]$/', '', $relativedir); - } - - $dirthumb = $dir . 'thumbs/'; - $pdirthumb = $pdir . 'thumbs/'; - - $return = '' . "\n"; - $nbphoto = 0; - - $filearray = dol_dir_list($dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, SORT_DESC, 1); - if (count($filearray)) { - if ($sortfield && $sortorder) { - $filearray = dol_sort_array($filearray, $sortfield, $sortorder); - } - - foreach ($filearray as $key => $val) { - $file = $val['name']; - - //if (! utf8_check($file)) $file=utf8_encode($file); // To be sure file is stored in UTF8 in memory - - //if (dol_is_file($dir.$file) && image_format_supported($file) >= 0) - if (image_format_supported($file) >= 0) { - $nbphoto++; - $photo = $file; - $viewfilename = $file; - - if ($size == 'small') { // Format vignette - // Find name of thumb file - $photo_vignette = basename(getImageFileNameForSize($dir . $file, '_small')); - - if ( ! dol_is_file($dirthumb . $photo_vignette)) $photo_vignette = ''; - - // Get filesize of original file - $imgarray = dol_getImageSize($dir . $photo); - - if ($nbbyrow > 0) { - if ($nbphoto == 1) $return .= ''; - - if ($nbphoto % $nbbyrow == 1) $return .= ''; - $return .= ''; - if (($nbphoto % $nbbyrow) == 0) $return .= ''; - } elseif ($nbbyrow < 0) $return .= ''; - } - - if (empty($size)) { // Format origine - $return .= ''; - - if ($showfilename) $return .= '
' . $viewfilename; - } - - // On continue ou on arrete de boucler ? - if ($nbmax && $nbphoto >= $nbmax) break; - } - } - - if ($size == 'small') { - if ($nbbyrow > 0) { - // Ferme tableau - while ($nbphoto % $nbbyrow) { - $return .= ''; - $nbphoto++; - } - - if ($nbphoto) $return .= '
'; - } elseif ($nbbyrow < 0) $return .= '
'; - - $return .= "\n"; - - $relativefile = preg_replace('/^\//', '', $pdir . $photo); - if (empty($nolink)) { - $urladvanced = getAdvancedPreviewUrl($modulepart, $relativefile, 0, 'entity=' . $conf->entity); - if ($urladvanced) $return .= ''; - else $return .= ''; - } - - // Show image (width height=$maxHeight) - // Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine - $alt = $langs->transnoentitiesnoconv('File') . ': ' . $relativefile; - $alt .= ' - ' . $langs->transnoentitiesnoconv('Size') . ': ' . $imgarray['width'] . 'x' . $imgarray['height']; - if ($notitle) $alt = ''; - - if ($usesharelink) { - if ($val['share']) { - if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) { - $return .= ''; - $return .= ''; - } else { - $return .= ''; - $return .= ''; - } - } else { - $return .= ''; - $return .= ''; - } - } elseif ($photo_vignette && $imgarray['height'] > $maxHeight) { - $return .= ''; - $return .= ''; - } else { - $return .= ''; - $return .= ''; - } - $return .= ''; - - if (empty($nolink)) $return .= ''; - $return .= "\n"; - if ($showfilename) $return .= '
' . $viewfilename; - if ($showaction) { - $return .= '
'; - // On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites - if ($photo_vignette && (image_format_supported($photo) > 0) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight)) { - $return .= '' . img_picto($langs->trans('GenerateThumb'), 'refresh') . '  '; - } - } - $return .= "\n"; - - if ($nbbyrow > 0) { - $return .= '
 
'; - } - } - } else { - $return .= ''; - } - if (is_object($object)) { - $object->nbphoto = $nbphoto; - } - return $return; -} - /** * Return a string to show the box with list of available documents for object. * This also set the property $this->numoffiles @@ -581,8 +412,6 @@ function digirisk_header($title = '', $helpUrl = '', $arrayofjs = [], $arrayofcs } ?> - -
diff --git a/view/digiriskstandard/digiriskstandard_agenda.php b/view/digiriskstandard/digiriskstandard_agenda.php index ea7aa7f22..f1506b149 100644 --- a/view/digiriskstandard/digiriskstandard_agenda.php +++ b/view/digiriskstandard/digiriskstandard_agenda.php @@ -21,20 +21,14 @@ * \brief Page of DigiriskStandard events */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; @@ -49,7 +43,7 @@ global $conf, $db, $langs, $user, $hookmanager; // Load translation files required by the page -$langs->loadLangs(array("digiriskdolibarr@digiriskdolibarr", "other")); +saturne_load_langs(['other']); // Get parameters $id = GETPOST('id', 'int'); @@ -70,6 +64,7 @@ $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); + if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; @@ -85,20 +80,16 @@ $object->fetch($conf->global->DIGIRISKDOLIBARR_ACTIVE_STANDARD); -$hookmanager->initHooks(array('digiriskstandardagenda', 'globalcard')); // Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('digiriskstandardagenda', 'globalcard')); + // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); -// Load object -include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -if ($id > 0 || ! empty($ref)) $upload_dir = $conf->digiriskdolibarr->multidir_output[$object->entity] . "/" . $object->id; - -//Security check - +// Security check - Protection if external user $permissiontoread = $user->rights->digiriskdolibarr->digiriskelement->read; $permissiontoadd = $user->rights->digiriskdolibarr->digiriskelement->write; -if ( ! $permissiontoread) accessforbidden(); +saturne_check_access($permissiontoread); /* * Actions @@ -127,19 +118,17 @@ */ if ($object->id > 0) { - $title = $langs->trans("Agenda"); - //if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; - $help_url = 'FR:Module_Digirisk#DigiRisk_-_Document_Unique'; - $morejs = array("/digiriskdolibarr/js/digiriskdolibarr.js"); - $morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); + $title = $langs->trans("Agenda"); + $helpUrl = 'FR:Module_Digirisk#DigiRisk_-_Document_Unique'; - digiriskHeader($title, $help_url, $morejs, $morecss); + digirisk_header($title, $helpUrl); print '
'; - if ( ! empty($conf->notification->enabled)) $langs->load("mails"); - $head = digiriskstandardPrepareHead($object); + if (isModEnabled('notification')) { + $langs->load("mails"); + } - print dol_get_fiche_head($head, 'standardAgenda', $title, -1, "digiriskdolibarr@digiriskdolibarr"); + saturne_get_fiche_head($object, 'standardAgenda', $title); // Object card // ------------------------------------------------------------ @@ -148,7 +137,7 @@ $project->fetch($conf->global->DIGIRISKDOLIBARR_DU_PROJECT); $morehtmlref .= $langs->trans('Project') . ' : ' . getNomUrlProject($project, 1, 'blank', 1); $morehtmlref .= '
'; - $morehtmlleft = '
' . digirisk_show_photos('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $emptyobject) . '
'; + $morehtmlleft = '
' . saturne_show_medias_linked('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $object, 0,0, 0) . '
'; digirisk_banner_tab($object, '', '', 0, '', '', $morehtmlref, '', '', $morehtmlleft); @@ -160,26 +149,24 @@ // Actions buttons $out = '&origin=' . $object->element . '@digiriskdolibarr' . '&originid=' . $object->id . '&backtopage='. $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&percentage=-1'; - if ( ! empty($conf->agenda->enabled)) { + if (isModEnabled('agenda')) { $linktocreatetimeBtnStatus = ! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create); $morehtmlcenter = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT . '/comm/action/card.php?action=create' . $out, '', $linktocreatetimeBtnStatus); - } - - if ( ! empty($conf->agenda->enabled) && ( ! empty($user->rights->agenda->myactions->read) || ! empty($user->rights->agenda->allactions->read))) { - $param = '&id=' . $object->id; - if ( ! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage=' . urlencode($contextpage); - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit=' . urlencode($limit); - print_barre_liste($langs->trans("ActionsOnDigiriskStandard"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlcenter, '', 0, 1, 1); + if (( ! empty($user->rights->agenda->myactions->read) || ! empty($user->rights->agenda->allactions->read))) { + $param = '&id=' . $object->id; + if ( ! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage=' . urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit=' . urlencode($limit); - // List of all actions - $filters = array(); - $filters['search_agenda_label'] = $search_agenda_label; + print_barre_liste($langs->trans("ActionsOnDigiriskStandard"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlcenter, '', 0, 1, 1); - // TODO Replace this with same code than into list.php + // List of all actions + $filters = array(); + $filters['search_agenda_label'] = $search_agenda_label; - show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, 'digiriskdolibarr'); - print '
'; + show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, 'digiriskdolibarr'); + print '
'; + } } } diff --git a/view/digiriskstandard/digiriskstandard_card.php b/view/digiriskstandard/digiriskstandard_card.php index ed282bafb..bf903e47e 100644 --- a/view/digiriskstandard/digiriskstandard_card.php +++ b/view/digiriskstandard/digiriskstandard_card.php @@ -21,20 +21,14 @@ * \brief Page to create/edit/view digiriskstandard */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; @@ -48,7 +42,7 @@ global $db, $conf, $langs, $user, $maxwidthmini, $maxheightmini, $maxwidthsmall,$maxheightsmall; // Load translation files required by the page -$langs->loadLangs(array("digiriskdolibarr@digiriskdolibarr")); +saturne_load_langs(); // Get parameters $action = GETPOST('action', 'alpha'); @@ -60,11 +54,10 @@ $object->fetch($conf->global->DIGIRISKDOLIBARR_ACTIVE_STANDARD); -// Security check - +// Security check - Protection if external user $permissiontoread = $user->rights->digiriskdolibarr->riskassessmentdocument->read; -if ( ! $permissiontoread) accessforbidden(); +saturne_check_access($permissiontoread); /* * Actions @@ -105,19 +98,15 @@ $emptyobject = new stdClass(); $title = $langs->trans("DigiriskStandardInformation"); -$help_url = 'FR:Module_Digirisk#DigiRisk_-_Document_Unique'; -$morejs = array("/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); +$helpUrl = 'FR:Module_Digirisk#DigiRisk_-_Document_Unique'; -digiriskHeader($title, $help_url, $morejs, $morecss); ?> +digirisk_header($title, $helpUrl); ?>
trans("Information"), -1, "digiriskdolibarr@digiriskdolibarr"); + saturne_get_fiche_head($object, 'standardCard', $title); // Object card // Project @@ -125,7 +114,7 @@ $project->fetch($conf->global->DIGIRISKDOLIBARR_DU_PROJECT); $morehtmlref .= $langs->trans('Project') . ' : ' . getNomUrlProject($project, 1, 'blank', 1); $morehtmlref .= '
'; - $morehtmlleft = '
' . digirisk_show_photos('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $emptyobject) . '
'; + $morehtmlleft = '
' . saturne_show_medias_linked('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $object, 0,0, 0) . '
'; digirisk_banner_tab($object, '', '', 0, '', '', $morehtmlref, '', '', $morehtmlleft); diff --git a/view/digiriskstandard/digiriskstandard_informationssharing.php b/view/digiriskstandard/digiriskstandard_informationssharing.php index ba48026d0..4a5f5c823 100644 --- a/view/digiriskstandard/digiriskstandard_informationssharing.php +++ b/view/digiriskstandard/digiriskstandard_informationssharing.php @@ -21,26 +21,20 @@ * \brief Page to view informationssharing */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once __DIR__ . '/../../class/digiriskstandard.class.php'; -require_once __DIR__ . '/../../class/digiriskdocuments/informationssharing.class.php'; +require_once __DIR__ . '/../../class/digiriskdolibarrdocuments/informationssharing.class.php'; require_once __DIR__ . '/../../lib/digiriskdolibarr_digiriskstandard.lib.php'; require_once __DIR__ . '/../../lib/digiriskdolibarr_function.lib.php'; require_once __DIR__ . '/../../core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/modules_informationssharing.php'; @@ -48,31 +42,29 @@ global $db, $conf, $langs, $hookmanager, $user; // Load translation files required by the page -$langs->loadLangs(array("digiriskdolibarr@digiriskdolibarr", "other")); +saturne_load_langs(['other']); // Get parameters $action = GETPOST('action', 'aZ09'); // Initialize technical objects -$object = new DigiriskStandard($db); -$informationssharing = new InformationsSharing($db); -$contact = new Contact($db); -$project = new Project($db); +$object = new DigiriskStandard($db); +$document = new InformationsSharing($db); +$contact = new Contact($db); +$project = new Project($db); $hookmanager->initHooks(array('digiriskelementinformationssharing', 'globalcard')); // Note that conf->hooks_modules contains array $object->fetch($conf->global->DIGIRISKDOLIBARR_ACTIVE_STANDARD); - $upload_dir = $conf->digiriskdolibarr->multidir_output[isset($conf->entity) ? $conf->entity : 1]; -//Security check - +// Security check - Protection if external user $permissiontoread = $user->rights->digiriskdolibarr->informationssharing->read; $permissiontoadd = $user->rights->digiriskdolibarr->informationssharing->write; $permissiontodelete = $user->rights->digiriskdolibarr->informationssharing->delete; -if ( ! $permissiontoread) accessforbidden(); +saturne_check_access($permissiontoread); /* * Actions @@ -85,95 +77,28 @@ if (empty($reshook)) { $error = 0; - // Action to build doc - if ($action == 'builddoc' && $permissiontoadd) { - $outputlangs = $langs; - $newlang = ''; - - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); - if ( ! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - - // To be sure vars is defined - if (empty($hidedetails)) $hidedetails = 0; - if (empty($hidedesc)) $hidedesc = 0; - if (empty($hideref)) $hideref = 0; - if (empty($moreparams)) $moreparams = null; - - $model = GETPOST('model', 'alpha'); - - $moreparams['object'] = ""; - $moreparams['user'] = $user; - - $result = $informationssharing->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); - if ($result <= 0) { - setEventMessages($object->error, $object->errors, 'errors'); - $action = ''; - } else { - if (empty($donotredirect)) { - setEventMessages($langs->trans("FileGenerated") . ' - ' . $informationssharing->last_main_doc, null); - - $urltoredirect = $_SERVER['REQUEST_URI']; - $urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect); - $urltoredirect = preg_replace('/action=builddoc&?/', '', $urltoredirect); // To avoid infinite loop - - header('Location: ' . $urltoredirect . '#builddoc'); - exit; - } - } - } + // Actions builddoc, forcebuilddoc, remove_file. + require_once __DIR__ . '/../../../saturne/core/tpl/documents/documents_action.tpl.php'; // Action to generate pdf from odt file - require_once __DIR__ . '/../../core/tpl/documents/digiriskdolibarr_manual_pdf_generation_action.tpl.php'; - -} - -// Delete file in doc form -if ($action == 'remove_file' && $permissiontodelete) { - if ( ! empty($upload_dir)) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - - $langs->load("other"); - $filetodelete = GETPOST('file', 'alpha'); - $file = $upload_dir . '/' . $filetodelete; - $ret = dol_delete_file($file, 0, 0, 0, $object); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", $filetodelete), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", $filetodelete), null, 'errors'); - - // Make a redirect to avoid to keep the remove_file into the url that create side effects - $urltoredirect = $_SERVER['REQUEST_URI']; - $urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect); - $urltoredirect = preg_replace('/action=remove_file&?/', '', $urltoredirect); - - header('Location: ' . $urltoredirect); - exit; - } else { - setEventMessages('BugFoundVarUploaddirnotDefined', null, 'errors'); - } + require_once __DIR__ . '/../../../saturne/core/tpl/documents/saturne_manual_pdf_generation_action.tpl.php'; } /* * View */ -$emptyobject = new stdClass(); - -$title = $langs->trans('InformationsSharing'); -$help_url = 'FR:Module_Digirisk#Soci.C3.A9t.C3.A9.2FOrganisation'; -$morejs = array("/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); +$title = $langs->trans('InformationsSharing'); +$helpUrl = 'FR:Module_Digirisk#Soci.C3.A9t.C3.A9.2FOrganisation'; -digiriskHeader($title, $help_url, $morejs, $morecss); ?> +digirisk_header($title, $helpUrl); ?>
fetch_optionals(); -$head = digiriskstandardPrepareHead($object); -print dol_get_fiche_head($head, 'standardInformationsSharing', $title, -1, "digiriskdolibarr@digiriskdolibarr"); +saturne_get_fiche_head($object, 'standardInformationsSharing', $title); // Object card // ------------------------------------------------------------ @@ -182,7 +107,7 @@ $project->fetch($conf->global->DIGIRISKDOLIBARR_DU_PROJECT); $morehtmlref .= $langs->trans('Project') . ' : ' . getNomUrlProject($project, 1, 'blank', 1); $morehtmlref .= '
'; -$morehtmlleft = '
' . digirisk_show_photos('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $emptyobject) . '
'; +$morehtmlleft = '
' . saturne_show_medias_linked('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $object, 0,0, 0) . '
'; digirisk_banner_tab($object, '', '', 0, '', '', $morehtmlref, '', '', $morehtmlleft); @@ -200,20 +125,17 @@ print dol_get_fiche_end(); // Document Generation -- Génération des documents -$includedocgeneration = 1; -if ($includedocgeneration) { - $dir_files = 'informationssharing'; - $filedir = $upload_dir . '/' . $dir_files; - $urlsource = $_SERVER["PHP_SELF"]; - $modulepart = 'digiriskdolibarr:InformationsSharing'; - - if ($permissiontoadd || $permissiontoread) { - $genallowed = 1; - } - - print digiriskshowdocuments($modulepart, $dir_files, $filedir, $urlsource, $genallowed, $permissiontodelete, $conf->global->DIGIRISKDOLIBARR_INFORMATIONSSHARING_DEFAULT_MODEL, 1, 0, '', $langs->trans('InformationsSharing'), '', '', $informationssharing); +$dirFiles = 'informationssharing'; +$filedir = $upload_dir . '/' . $dirFiles ; +$urlsource = $_SERVER["PHP_SELF"]; +$modulepart = 'digiriskdolibarr:InformationsSharing'; + +if ($permissiontoadd || $permissiontoread) { + $genallowed = 1; } +print saturne_show_documents($modulepart, $dirFiles, $filedir, $urlsource, 1,1, '', 1, 0, 0, 0, 0, '', 0, '', empty($soc->default_lang) ? '' : $soc->default_lang, $object); + // End of page llxFooter(); $db->close(); diff --git a/view/digiriskstandard/digiriskstandard_legaldisplay.php b/view/digiriskstandard/digiriskstandard_legaldisplay.php index 893839782..41ae21bcc 100644 --- a/view/digiriskstandard/digiriskstandard_legaldisplay.php +++ b/view/digiriskstandard/digiriskstandard_legaldisplay.php @@ -42,7 +42,7 @@ global $db, $conf, $langs, $user, $hookmanager; // Load translation files required by the page -saturne_load_langs(['others']); +saturne_load_langs(['other']); // Get parameters $action = GETPOST('action', 'aZ09'); @@ -84,14 +84,13 @@ // Action to generate pdf from odt file require_once __DIR__ . '/../../../saturne/core/tpl/documents/saturne_manual_pdf_generation_action.tpl.php'; } + /* * View */ -$emptyobject = new stdClass(); - -$title = $langs->trans('LegalDisplay'); -$helpUrl = 'FR:Module_Digirisk#Soci.C3.A9t.C3.A9.2FOrganisation'; +$title = $langs->trans('LegalDisplay'); +$helpUrl = 'FR:Module_Digirisk#Soci.C3.A9t.C3.A9.2FOrganisation'; digirisk_header($title, $helpUrl); ?> @@ -102,6 +101,7 @@ saturne_get_fiche_head($object, 'standardLegalDisplay', $title); + // Object card // ------------------------------------------------------------ // Project @@ -109,7 +109,7 @@ $project->fetch($conf->global->DIGIRISKDOLIBARR_DU_PROJECT); $morehtmlref .= $langs->trans('Project') . ' : ' . getNomUrlProject($project, 1, 'blank', 1); $morehtmlref .= '
'; -$morehtmlleft = '
' . digirisk_show_photos('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $emptyobject) . '
'; +$morehtmlleft = '
' . saturne_show_medias_linked('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $object, 0,0, 0) . '
'; digirisk_banner_tab($object, '', '', 0, '', '', $morehtmlref, '', '', $morehtmlleft); diff --git a/view/digiriskstandard/digiriskstandard_riskassessmentdocument.php b/view/digiriskstandard/digiriskstandard_riskassessmentdocument.php index 7a8595fd2..96c00356d 100644 --- a/view/digiriskstandard/digiriskstandard_riskassessmentdocument.php +++ b/view/digiriskstandard/digiriskstandard_riskassessmentdocument.php @@ -21,20 +21,15 @@ * \brief Page to view riskassessmentdocument */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); + +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; @@ -45,9 +40,9 @@ require_once __DIR__ . '/../../class/digiriskresources.class.php'; require_once __DIR__ . '/../../class/digiriskstandard.class.php'; require_once __DIR__ . '/../../class/digiriskelement.class.php'; -require_once __DIR__ . '/../../class/digiriskdocuments/groupmentdocument.class.php'; -require_once __DIR__ . '/../../class/digiriskdocuments/workunitdocument.class.php'; -require_once __DIR__ . '/../../class/digiriskdocuments/riskassessmentdocument.class.php'; +require_once __DIR__ . '/../../class/digiriskdolibarrdocuments/groupmentdocument.class.php'; +require_once __DIR__ . '/../../class/digiriskdolibarrdocuments/workunitdocument.class.php'; +require_once __DIR__ . '/../../class/digiriskdolibarrdocuments/riskassessmentdocument.class.php'; require_once __DIR__ . '/../../lib/digiriskdolibarr_digiriskstandard.lib.php'; require_once __DIR__ . '/../../lib/digiriskdolibarr_function.lib.php'; require_once __DIR__ . '/../../core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/mod_riskassessmentdocument_standard.php'; @@ -56,7 +51,7 @@ global $db, $conf, $langs, $hookmanager, $user; // Load translation files required by the page -$langs->loadLangs(array("digiriskdolibarr@digiriskdolibarr", "other")); +saturne_load_langs(['other']); // Get parameters $action = GETPOST('action', 'aZ09'); @@ -64,7 +59,7 @@ // Initialize technical objects $object = new DigiriskStandard($db); $digiriskelement = new DigiriskElement($db); -$riskassessmentdocument = new RiskAssessmentDocument($db); +$document = new RiskAssessmentDocument($db); $digiriskresources = new DigiriskResources($db); $thirdparty = new Societe($db); $contact = new Contact($db); @@ -79,14 +74,13 @@ $upload_dir = $conf->digiriskdolibarr->multidir_output[isset($conf->entity) ? $conf->entity : 1]; -//Security check - +// Security check - Protection if external user $permissiontoread = $user->rights->digiriskdolibarr->riskassessmentdocument->read; $permissiontoadd = $user->rights->digiriskdolibarr->riskassessmentdocument->write; $permissiontodelete = $user->rights->digiriskdolibarr->riskassessmentdocument->delete; $permtoupload = $user->rights->ecm->upload; -if ( ! $permissiontoread) accessforbidden(); +saturne_check_access($permissiontoread); /* * Actions @@ -185,7 +179,7 @@ $moreparams['object'] = ""; $moreparams['user'] = $user; - $result = $riskassessmentdocument->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + $result = $document->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); //Création du dossier à zipper $entity = ($conf->entity > 1) ? '/' . $conf->entity : ''; @@ -194,15 +188,15 @@ $nameSociety = str_replace(' ', '_', $conf->global->MAIN_INFO_SOCIETE_NOM); $nameSociety = preg_replace('/\./', '_', $conf->global->MAIN_INFO_SOCIETE_NOM); - $pathToZip = DOL_DATA_ROOT . $entity . '/digiriskdolibarr/riskassessmentdocument/' . $date . '_'. $riskassessmentdocument->ref . '_' . $nameSociety; + $pathToZip = DOL_DATA_ROOT . $entity . '/digiriskdolibarr/riskassessmentdocument/' . $date . '_'. $document->ref . '_' . $nameSociety; dol_mkdir($pathToZip); // Ajout du fichier au dossier à zipper - $nameFile = $date . '_' . $riskassessmentdocument->ref . '_' . $nameSociety; + $nameFile = $date . '_' . $document->ref . '_' . $nameSociety; $nameFile = str_replace(' ', '_', $nameFile); $nameFile = dol_sanitizeFileName($nameFile); - copy(DOL_DATA_ROOT . $entity . '/digiriskdolibarr/riskassessmentdocument/' . $riskassessmentdocument->last_main_doc, $pathToZip . '/' . $nameFile . '.odt'); - $pathinfo = pathinfo($riskassessmentdocument->last_main_doc); + copy(DOL_DATA_ROOT . $entity . '/digiriskdolibarr/riskassessmentdocument/' . $document->last_main_doc, $pathToZip . '/' . $nameFile . '.odt'); + $pathinfo = pathinfo($document->last_main_doc); if (file_exists(DOL_DATA_ROOT . $entity . '/digiriskdolibarr/riskassessmentdocument/' . $pathinfo['filename'] . '.pdf')) { copy(DOL_DATA_ROOT . $entity . '/digiriskdolibarr/riskassessmentdocument/' . $pathinfo['filename'] . '.pdf', $pathToZip . '/' . $nameFile . '.pdf'); } @@ -231,7 +225,7 @@ // Ajout du fichier au dossier à zipper $sourceFilePath = DOL_DATA_ROOT . $entity . '/digiriskdolibarr/' . $subFolder . '/' . $digiriskelementsingle['object']->ref . '/'; - $nameFile = $date . '_' . $riskassessmentdocument->ref . '_' . $digiriskelementsingle['object']->ref . '_' . $digiriskelementdocument->ref . '_' . $digiriskelementsingle['object']->label . '_' . $nameSociety; + $nameFile = $date . '_' . $document->ref . '_' . $digiriskelementsingle['object']->ref . '_' . $digiriskelementdocument->ref . '_' . $digiriskelementsingle['object']->label . '_' . $nameSociety; $nameFile = str_replace(' ', '_', $nameFile); $nameFile = dol_sanitizeFileName($nameFile); copy($sourceFilePath . $digiriskelementdocument->last_main_doc, $pathToZip . '/' . $nameFile . '.odt'); @@ -247,7 +241,7 @@ // Initialize archive object $zip = new ZipArchive(); - $zip->open($riskassessmentdocument->ref . '.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE); + $zip->open($document->ref . '.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE); // Create recursive directory iterator /** @var SplFileInfo[] $files */ @@ -272,7 +266,7 @@ $zip->close(); //move archive to riskassessmentdocument folder - rename(DOL_DOCUMENT_ROOT . '/custom/digiriskdolibarr/view/digiriskstandard/' . $riskassessmentdocument->ref . '.zip', $pathToZip . '.zip'); + rename(DOL_DOCUMENT_ROOT . '/custom/digiriskdolibarr/view/digiriskstandard/' . $document->ref . '.zip', $pathToZip . '.zip'); } } @@ -281,7 +275,7 @@ $action = ''; } else { if (empty($donotredirect)) { - setEventMessages($langs->trans("FileGenerated") . ' - ' . $riskassessmentdocument->last_main_doc, null); + setEventMessages($langs->trans("FileGenerated") . ' - ' . $document->last_main_doc, null); $urltoredirect = $_SERVER['REQUEST_URI']; $urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect); @@ -297,33 +291,11 @@ } } - // Action to generate pdf from odt file - require_once __DIR__ . '/../../core/tpl/documents/digiriskdolibarr_manual_pdf_generation_action.tpl.php'; - - - // Delete file in doc form - if ($action == 'remove_file' && $permissiontodelete) { - if ( ! empty($upload_dir)) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - - $langs->load("other"); - $filetodelete = GETPOST('file', 'alpha'); - $file = $upload_dir . '/' . $filetodelete; - $ret = dol_delete_file($file, 0, 0, 0, $object); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", $filetodelete), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", $filetodelete), null, 'errors'); + // Actions builddoc, forcebuilddoc, remove_file. + require_once __DIR__ . '/../../../saturne/core/tpl/documents/documents_action.tpl.php'; - // Make a redirect to avoid to keep the remove_file into the url that create side effects - $urltoredirect = $_SERVER['REQUEST_URI']; - $urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect); - $urltoredirect = preg_replace('/action=remove_file&?/', '', $urltoredirect); - - header('Location: ' . $urltoredirect); - exit; - } else { - setEventMessages('BugFoundVarUploaddirnotDefined', null, 'errors'); - } - } + // Action to generate pdf from odt file + require_once __DIR__ . '/../../../saturne/core/tpl/documents/saturne_manual_pdf_generation_action.tpl.php'; // Actions to send emails $triggersendname = 'RISKASSESSMENTDOCUMENT_SENTBYMAIL'; @@ -340,22 +312,17 @@ * View */ -$emptyobject = new stdClass(); - $title = $langs->trans('RiskAssessmentDocument'); $help_url = 'FR:Module_Digirisk#Impression_du_Document_Unique'; -$morejs = array("/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); -digiriskHeader($title, $help_url, $morejs, $morecss); ?> +digirisk_header($title, $help_url); ?>
fetch_optionals(); -$head = digiriskstandardPrepareHead($object); -print dol_get_fiche_head($head, 'standardRiskAssessmentDocument', $title, -1, "digiriskdolibarr@digiriskdolibarr"); +saturne_get_fiche_head($object, 'standardRiskAssessmentDocument', $title); // Object card // ------------------------------------------------------------ @@ -364,7 +331,7 @@ $project->fetch($conf->global->DIGIRISKDOLIBARR_DU_PROJECT); $morehtmlref .= $langs->trans('Project') . ' : ' . getNomUrlProject($project, 1, 'blank', 1); $morehtmlref .= '
'; -$morehtmlleft = '
' . digirisk_show_photos('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $emptyobject) . '
'; +$morehtmlleft = '
' . saturne_show_medias_linked('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $object, 0,0, 0) . '
'; digirisk_banner_tab($object, '', '', 0, '', '', $morehtmlref, '', '', $morehtmlleft); @@ -453,10 +420,9 @@ print dol_get_fiche_end(); // Document Generation -- Génération des documents -$includedocgeneration = 1; -if ($includedocgeneration && $action != 'edit') { - $dir_files = 'riskassessmentdocument'; - $filedir = $upload_dir . '/' . $dir_files; +if ($action != 'edit') { + $dirFiles = 'riskassessmentdocument'; + $filedir = $upload_dir . '/' . $dirFiles; $urlsource = $_SERVER["PHP_SELF"]; $modulepart = 'digiriskdolibarr:RiskAssessmentDocument'; @@ -464,7 +430,7 @@ $genallowed = 1; } - print digiriskshowdocuments($modulepart, $dir_files, $filedir, $urlsource, $genallowed, $permissiontodelete, $conf->global->DIGIRISKDOLIBARR_RISKASSESSMENTDOCUMENT_DEFAULT_MODEL, 1, 0, '', $langs->trans('RiskAssessmentDocument'), '', '', $riskassessmentdocument, 0, 'remove_file'); + print saturne_show_documents($modulepart, $dirFiles, $filedir, $urlsource, 1,1, '', 1, 0, 0, 0, 0, '', 0, '', empty($soc->default_lang) ? '' : $soc->default_lang, $object); } // Presend form @@ -473,18 +439,18 @@ $thirdparty->fetch($labour_inspector_id); $object->thirdparty = $thirdparty; -$modelmail = 'riskassessmentdocument'; -$defaulttopic = 'Information'; -$diroutput = $upload_dir . '/riskassessmentdocument'; -$filter = array('customsql' => "t.type='riskassessmentdocument'"); -$riskassessmentdocument = $riskassessmentdocument->fetchAll('desc', 't.rowid', 1, 0, $filter, 'AND'); -if ( ! empty($riskassessmentdocument) && is_array($riskassessmentdocument)) { - $riskassessmentdocument = array_shift($riskassessmentdocument); - $ref = dol_sanitizeFileName($riskassessmentdocument->ref); +$modelmail = 'riskassessmentdocument'; +$defaulttopic = 'Information'; +$diroutput = $upload_dir . '/riskassessmentdocument'; +$filter = array('customsql' => "t.type='riskassessmentdocument'"); +$document = $document->fetchAll('desc', 't.rowid', 1, 0, $filter, 'AND'); +if ( ! empty($document) && is_array($document)) { + $document = array_shift($document); + $ref = dol_sanitizeFileName($document->ref); } $trackid = 'thi' . $object->id; -if ($action == 'presend' && ! empty($riskassessmentdocument)) { +if ($action == 'presend' && ! empty($document)) { $langs->load("mails"); $titreform = 'SendMail'; From 7f37c72c4033b498d3acb8d32615c02ddca801a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20David?= Date: Tue, 29 Aug 2023 10:32:35 +0200 Subject: [PATCH 006/293] #3217 [View] add: common views saturne integration --- class/digiriskelement/groupment.class.php | 4 +- class/digiriskelement/workunit.class.php | 4 +- view/digirisktools.php | 47 ++++++++---------- view/digiriskusers.php | 46 ++++++----------- view/openinghours_card.php | 60 +++++++++-------------- 5 files changed, 63 insertions(+), 98 deletions(-) diff --git a/class/digiriskelement/groupment.class.php b/class/digiriskelement/groupment.class.php index 765324445..f7a87a74d 100644 --- a/class/digiriskelement/groupment.class.php +++ b/class/digiriskelement/groupment.class.php @@ -47,12 +47,12 @@ class Groupment extends DigiriskElement /** * @var int Does object support extrafields ? 0=No, 1=Yes */ - public $isextrafieldmanaged = 1; + public int $isextrafieldmanaged = 1; /** * @var string String with name of icon for groupment. Must be the part after the 'object_' into object_groupment.png */ - public $picto = 'groupment@digiriskdolibarr'; + public string $picto = 'groupment@digiriskdolibarr'; /** * Constructor diff --git a/class/digiriskelement/workunit.class.php b/class/digiriskelement/workunit.class.php index 22bb5e007..b312f392e 100644 --- a/class/digiriskelement/workunit.class.php +++ b/class/digiriskelement/workunit.class.php @@ -47,12 +47,12 @@ class WorkUnit extends DigiriskElement /** * @var int Does object support extrafields ? 0=No, 1=Yes */ - public $isextrafieldmanaged = 1; + public int $isextrafieldmanaged = 1; /** * @var string String with name of icon for workunit. Must be the part after the 'object_' into object_workunit.png */ - public $picto = 'workunit@digiriskdolibarr'; + public string $picto = 'workunit@digiriskdolibarr'; /** * Constructor diff --git a/view/digirisktools.php b/view/digirisktools.php index 99b861936..b223e03bc 100644 --- a/view/digirisktools.php +++ b/view/digirisktools.php @@ -21,27 +21,19 @@ * \brief Tools page of digiriskdolibarr top menu */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} global $conf, $db, $langs, $user; -$taskRefClass = $conf->global->PROJECT_TASK_ADDON; - require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/modules/project/task/' . $taskRefClass . '.php'; require_once __DIR__ . '/../class/digiriskstandard.class.php'; require_once __DIR__ . '/../class/digiriskelement.class.php'; @@ -60,7 +52,7 @@ require_once __DIR__ . '/../core/tpl/digirisk_security_checks.php'; // Load translation files required by the page -$langs->loadLangs(array("digiriskdolibarr@digiriskdolibarr")); +saturne_load_langs(); // Parameters $action = GETPOST('action', 'alpha'); @@ -84,15 +76,19 @@ $refRiskMod = new $conf->global->DIGIRISKDOLIBARR_RISK_ADDON(); $refRiskAssessmentMod = new $conf->global->DIGIRISKDOLIBARR_RISKASSESSMENT_ADDON(); $refRiskSignMod = new $conf->global->DIGIRISKDOLIBARR_RISKSIGN_ADDON(); -$refTaskMod = new $taskRefClass(); -$upload_dir = $conf->digiriskdolibarr->multidir_output[isset($conf->entity) ? $conf->entity : 1]; +$numberingModuleName = [ + 'project/task' => $conf->global->PROJECT_TASK_ADDON, +]; +list($refTaskMod) = saturne_require_objects_mod($numberingModuleName); + +$upload_dir = $conf->digiriskdolibarr->multidir_output[$conf->entity ?? 1]; -// Security check +// Security check - Protection if external user $permissiontoread = $user->rights->digiriskdolibarr->adminpage->read; $permtoupload = $user->rights->ecm->upload; -if ( ! $user->rights->digiriskdolibarr->adminpage->read) accessforbidden(); +saturne_check_access($permissiontoread); /* * Actions @@ -793,13 +789,12 @@ * View */ -$help_url = 'FR:Module_Digirisk#Import.2Fexport_de_donn.C3.A9es'; -$morejs = array("/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); +$title = $langs->trans("Tools"); +$helpUrl = 'FR:Module_Digirisk#Import.2Fexport_de_donn.C3.A9es'; -llxHeader("", $langs->trans("Tools"), $help_url, '', '', '', $morejs, $morecss); +saturne_header(0,"", $title, $helpUrl); -print load_fiche_titre($langs->trans("Tools"), '', 'wrench'); +print load_fiche_titre($title, '', 'wrench'); if ($user->rights->digiriskdolibarr->adminpage->read) { if ($conf->global->DIGIRISKDOLIBARR_TOOLS_TREE_ALREADY_IMPORTED == 1) : ?> diff --git a/view/digiriskusers.php b/view/digiriskusers.php index b22fe59c9..fdb078329 100644 --- a/view/digiriskusers.php +++ b/view/digiriskusers.php @@ -21,19 +21,14 @@ * \brief Page to view Users */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} // Libraries require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php'; @@ -48,7 +43,7 @@ global $conf, $db, $hookmanager, $langs, $user; // Load translation files required by page -$langs->loadLangs(array('users', 'companies', 'hrm')); +saturne_load_langs(['users', 'companies', 'hrm']); // Get parameters $action = GETPOST('action', 'aZ09'); @@ -81,18 +76,11 @@ $hookmanager->initHooks(array('digiriskuserlist', 'globalcard')); // Note that conf->hooks_modules contains array // Define value to know what current user can do on users -$canadduser = ( ! empty($user->admin) || $user->rights->user->user->creer); -$permissiontoadd = $user->rights->digiriskdolibarr->adminpage->read; +$permissiontoadd = ( ! empty($user->admin) || $user->rights->user->user->creer); +$permissiontoread = $user->rights->digiriskdolibarr->adminpage->read; -if ( ! $user->rights->user->user->lire && ! $user->admin) { - accessforbidden(); -} - -// Security check (for external users) -$socid = 0; -if ($user->socid > 0) { - $socid = $user->socid; -} +// Security check - Protection if external user +saturne_check_access($permissiontoadd); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -208,7 +196,7 @@ } } // Action Add user -if ($action == 'add' && $canadduser && $permissiontoadd) { +if ($action == 'add' && $permissiontoadd) { $error = 0; if ( ! $_POST["lastname"]) { @@ -313,7 +301,6 @@ $user2 = new User($db); - $sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.email, u.job, u.api_key, u.accountancy_code, u.gender, u.employee, u.photo,"; $sql .= " u.datelastlogin, u.datepreviouslogin,"; $sql .= " u.ldap_sid, u.statut, u.entity,"; @@ -575,7 +562,6 @@ print "\n"; - print ''; if ( ! empty($arrayfields['u.login']['checked'])) print_liste_field_titre("Login", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder); if ( ! empty($arrayfields['u.lastname']['checked'])) print_liste_field_titre("Lastname", $_SERVER['PHP_SELF'], "u.lastname", $param, "", "", $sortfield, $sortorder); @@ -604,8 +590,6 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; - - $i = 0; $totalarray = array(); while ($i < min($num, $limit)) { @@ -804,7 +788,7 @@ print "\n"; -if ($canadduser && (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) || $conf->entity == 1)) { +if ($permissiontoadd && (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) || $conf->entity == 1)) { print '
'; print ''; print ''; diff --git a/view/openinghours_card.php b/view/openinghours_card.php index 7c4b4db75..239a1e412 100644 --- a/view/openinghours_card.php +++ b/view/openinghours_card.php @@ -21,19 +21,14 @@ * \brief Page to view Opening Hours */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php'; @@ -41,7 +36,10 @@ require_once __DIR__ . '/../class/openinghours.class.php'; require_once __DIR__ . '/../core/tpl/digirisk_security_checks.php'; -$langs->loadLangs(array("digiriskdolibarr@digiriskdolibarr")); +global $db, $conf, $langs, $user, $hookmanager; + +// Load translation files required by the page +saturne_load_langs(); $action = (GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'); @@ -60,19 +58,9 @@ exit; } -// Get object canvas (By default, this is not defined, so standard usage of dolibarr) -$societe->getCanvas($socid); -$canvas = $societe->canvas ? $societe->canvas : GETPOST("canvas"); -$objcanvas = null; -if ( ! empty($canvas)) { - require_once DOL_DOCUMENT_ROOT . '/core/class/canvas.class.php'; - $objcanvas = new Canvas($db, $action); - $objcanvas->getCanvas('thirdparty', 'card', $canvas); -} - -// Security check +// Security check - Protection if external user $permissiontoadd = $user->rights->societe->creer; -restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas); +saturne_check_access($permissiontoadd); /* /* @@ -96,7 +84,7 @@ $object->saturday = GETPOST('saturday', 'string'); $object->sunday = GETPOST('sunday', 'string'); $object->create($user); - setEventMessages($langs->trans('ThirdPartyOpeningHoursSave'), null, 'mesgs'); + setEventMessages($langs->trans('ThirdPartyOpeningHoursSave'), null,); } @@ -119,22 +107,20 @@ $title = $langs->trans("ThirdParty"); if ( ! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $societe->name) $title = $societe->name . " - " . $langs->trans('OpeningHours'); -$help_url = 'FR:Module_Digirisk#L.27onglet_Horaire_d.27ouverture'; +$helpUrl = 'FR:Module_Digirisk#L.27onglet_Horaire_d.27ouverture'; -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); +saturne_header(0,'', $title, $helpUrl); -llxHeader('', $title, $help_url, '', '', '', array(), $morecss); - -if ( ! empty($societe->id)) $res = $societe->fetch_optionals(); +$societe->fetch_optionals(); // Object card // ------------------------------------------------------------ -$morehtmlref = '
'; -$morehtmlref .= '
'; -$head = societe_prepare_head($societe); -print dol_get_fiche_head($head, 'openinghours', $langs->trans("ThirdParty"), 0, 'company'); + +print saturne_get_fiche_head($societe, 'openinghours', $title); + $linkback = '' . $langs->trans("BackToList") . ''; -dol_banner_tab($societe, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); + +saturne_banner_tab($societe, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); print dol_get_fiche_end(); From 103b978a782b093d89e0c6610a04160823c57136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20David?= Date: Tue, 29 Aug 2023 15:04:03 +0200 Subject: [PATCH 007/293] #3217 [DigiriskElement] fix: saturne integration & documents --- class/digiriskdocuments.class.php | 275 +----------------- .../groupmentdocument.class.php | 4 +- .../riskassessmentdocument.class.php | 57 +--- .../mod_groupmentdocument_standard.php | 111 ------- .../mod_workunitdocument_standard.php | 111 ------- .../digiriskelementdocument/index.php | 0 .../modules_digiriskelementdocument.php | 5 +- ..._firepermitdocument_custom_odt.modules.php | 0 .../doc_firepermitdocument_odt.modules.php | 0 .../firepermitdocument/index.php | 0 .../mod_firepermitdocument_standard.php | 0 .../modules_firepermitdocument.php | 4 +- ...c_groupmentdocument_custom_odt.modules.php | 0 .../doc_groupmentdocument_odt.modules.php | 0 .../groupmentdocument/index.php | 0 .../mod_groupmentdocument_standard.php | 42 +++ .../modules_groupmentdocument.php | 0 .../index.php | 0 ...informationssharing_custom_odt.modules.php | 0 .../doc_informationssharing_odt.modules.php | 0 .../informationssharing/index.php | 0 .../mod_informationssharing_standard.php | 0 .../modules_informationssharing.php | 0 .../doc_legaldisplay_custom_odt.modules.php | 0 .../doc_legaldisplay_odt.modules.php | 0 .../legaldisplay/index.php | 0 .../mod_legaldisplay_standard.php | 0 .../legaldisplay/modules_legaldisplay.php | 0 ..._listingrisksaction_custom_odt.modules.php | 0 .../doc_listingrisksaction_odt.modules.php | 0 .../listingrisksaction/index.php | 0 .../mod_listingrisksaction_standard.php | 0 .../modules_listingrisksaction.php | 0 ...c_listingrisksphoto_custom_odt.modules.php | 0 .../doc_listingrisksphoto_odt.modules.php | 0 .../listingrisksphoto/index.php | 0 .../mod_listingrisksphoto_standard.php | 0 .../modules_listingrisksphoto.php | 0 .../modules_digiriskdocuments.php | 0 ...ventionplandocument_custom_odt.modules.php | 0 ...doc_preventionplandocument_odt.modules.php | 0 ...ntionplandocument_specimen_odt.modules.php | 0 .../preventionplandocument/index.php | 0 .../mod_preventionplandocument_standard.php | 0 .../modules_preventionplandocument.php | 2 +- .../projectdocument/index.php | 0 .../mod_projectdocument_standard.php | 0 .../pdf_orque_projectdocument.modules.php | 21 +- ...kassessmentdocument_custom_odt.modules.php | 0 ...doc_riskassessmentdocument_odt.modules.php | 0 .../riskassessmentdocument/index.php | 0 .../mod_riskassessmentdocument_standard.php | 0 .../modules_riskassessmentdocument.php | 0 .../doc_ticketdocument_custom_odt.modules.php | 2 +- .../doc_ticketdocument_odt.modules.php | 2 +- .../ticketdocument/index.php | 0 .../mod_ticketdocument_standard.php | 0 .../ticketdocument/modules_ticketdocument.php | 2 +- ...oc_workunitdocument_custom_odt.modules.php | 0 .../doc_workunitdocument_odt.modules.php | 0 .../workunitdocument/index.php | 0 .../mod_workunitdocument_standard.php | 42 +++ .../modules_workunitdocument.php | 0 lib/digiriskdolibarr_digiriskelement.lib.php | 4 +- lib/digiriskdolibarr_digiriskstandard.lib.php | 2 +- sql/digiriskdocuments/index.php | 2 - ...digiriskdolibarr_digiriskdocuments.key.sql | 19 -- ...llx_digiriskdolibarr_digiriskdocuments.sql | 33 --- ...barr_digiriskdocuments_extrafields.key.sql | 16 - ...dolibarr_digiriskdocuments_extrafields.sql | 22 -- view/digiriskelement/digiriskelement_card.php | 207 +++++-------- .../digiriskstandard_agenda.php | 2 +- .../digiriskstandard_card.php | 2 +- .../digiriskstandard_informationssharing.php | 2 +- .../digiriskstandard_legaldisplay.php | 3 +- ...igiriskstandard_riskassessmentdocument.php | 2 +- 76 files changed, 196 insertions(+), 800 deletions(-) delete mode 100644 core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/mod_groupmentdocument_standard.php delete mode 100644 core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/mod_workunitdocument_standard.php rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/digiriskelementdocument/index.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/digiriskelementdocument/modules_digiriskelementdocument.php (99%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/firepermitdocument/doc_firepermitdocument_custom_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/firepermitdocument/doc_firepermitdocument_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/firepermitdocument/index.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/firepermitdocument/mod_firepermitdocument_standard.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/firepermitdocument/modules_firepermitdocument.php (99%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/groupmentdocument/doc_groupmentdocument_custom_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/groupmentdocument/doc_groupmentdocument_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/groupmentdocument/index.php (100%) create mode 100644 core/modules/digiriskdolibarr/digiriskdolibarrdocuments/groupmentdocument/mod_groupmentdocument_standard.php rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/groupmentdocument/modules_groupmentdocument.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/index.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/informationssharing/doc_informationssharing_custom_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/informationssharing/doc_informationssharing_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/informationssharing/index.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/informationssharing/mod_informationssharing_standard.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/informationssharing/modules_informationssharing.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/legaldisplay/doc_legaldisplay_custom_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/legaldisplay/doc_legaldisplay_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/legaldisplay/index.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/legaldisplay/mod_legaldisplay_standard.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/legaldisplay/modules_legaldisplay.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/listingrisksaction/doc_listingrisksaction_custom_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/listingrisksaction/doc_listingrisksaction_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/listingrisksaction/index.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/listingrisksaction/mod_listingrisksaction_standard.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/listingrisksaction/modules_listingrisksaction.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/listingrisksphoto/doc_listingrisksphoto_custom_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/listingrisksphoto/doc_listingrisksphoto_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/listingrisksphoto/index.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/listingrisksphoto/mod_listingrisksphoto_standard.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/listingrisksphoto/modules_listingrisksphoto.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/modules_digiriskdocuments.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/preventionplandocument/doc_preventionplandocument_custom_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/preventionplandocument/doc_preventionplandocument_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/preventionplandocument/doc_preventionplandocument_specimen_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/preventionplandocument/index.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/preventionplandocument/mod_preventionplandocument_standard.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/preventionplandocument/modules_preventionplandocument.php (99%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/projectdocument/index.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/projectdocument/mod_projectdocument_standard.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/projectdocument/pdf_orque_projectdocument.modules.php (97%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/riskassessmentdocument/doc_riskassessmentdocument_custom_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/riskassessmentdocument/doc_riskassessmentdocument_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/riskassessmentdocument/index.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/riskassessmentdocument/mod_riskassessmentdocument_standard.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/riskassessmentdocument/modules_riskassessmentdocument.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/ticketdocument/doc_ticketdocument_custom_odt.modules.php (99%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/ticketdocument/doc_ticketdocument_odt.modules.php (98%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/ticketdocument/index.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/ticketdocument/mod_ticketdocument_standard.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/ticketdocument/modules_ticketdocument.php (99%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/workunitdocument/doc_workunitdocument_custom_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/workunitdocument/doc_workunitdocument_odt.modules.php (100%) rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/workunitdocument/index.php (100%) create mode 100644 core/modules/digiriskdolibarr/digiriskdolibarrdocuments/workunitdocument/mod_workunitdocument_standard.php rename core/modules/digiriskdolibarr/{digiriskdocuments => digiriskdolibarrdocuments}/workunitdocument/modules_workunitdocument.php (100%) delete mode 100644 sql/digiriskdocuments/index.php delete mode 100644 sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments.key.sql delete mode 100644 sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments.sql delete mode 100644 sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments_extrafields.key.sql delete mode 100644 sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments_extrafields.sql diff --git a/class/digiriskdocuments.class.php b/class/digiriskdocuments.class.php index 2ccd361c9..3a486efc3 100644 --- a/class/digiriskdocuments.class.php +++ b/class/digiriskdocuments.class.php @@ -23,90 +23,23 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; +// Load Saturne libraries. +require_once __DIR__ . '/../../saturne/class/saturnedocuments.class.php'; + /** * Class for DigiriskDocuments */ -class DigiriskDocuments extends CommonObject +class DigiriskDocuments extends SaturneDocuments { /** - * @var DoliDB Database handler. - */ - public $db; - - /** - * @var string[] Array of error strings - */ - public $errors = array(); - - /** - * @var int The object identifier + * @var string Module name. */ - public $id; - - /** - * @var string ID to identify managed object. - */ - public $element = 'digiriskdocuments'; + public $module = 'digiriskdolibarr'; /** * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management. */ - public $table_element = 'digiriskdolibarr_digiriskdocuments'; - - /** - * @var int Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - - /** - * @var string String with name of icon for digiriskdocuments. Must be the part after the 'object_' into object_digiriskdocuments.png - */ - public $picto = 'digiriskdocuments@digiriskdolibarr'; - - /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. - */ - public $fields=array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'comment'=>"Id"), - 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), - 'ref_ext' => array('type'=>'varchar(128)', 'label'=>'RefExt', 'enabled'=>'1', 'position'=>20, 'notnull'=>0, 'visible'=>0,), - 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>0,), - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>40, 'notnull'=>1, 'visible'=>0,), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>0,), - 'import_key' => array('type'=>'integer', 'label'=>'ImportKey', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>0,), - 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>0,), - 'type' => array('type'=>'varchar(128)', 'label'=>'Type', 'enabled'=>'1', 'position'=>80, 'notnull'=>0, 'visible'=>0,), - 'json' => array('type'=>'text', 'label'=>'JSON', 'enabled'=>'1', 'position'=>90, 'notnull'=>0, 'visible'=>0,), - 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>100, 'notnull'=>-1, 'visible'=>0,), - 'model_odt' => array('type'=>'varchar(255)', 'label'=>'Model ODT', 'enabled'=>'1', 'position'=>110, 'notnull'=>0, 'visible'=>0,), - 'last_main_doc' => array('type'=>'varchar(128)', 'label'=>'LastMainDoc', 'enabled'=>'1', 'position'=>120, 'notnull'=>0, 'visible'=>0,), - 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>130, 'notnull'=>1, 'visible'=>0, 'foreignkey'=>'user.rowid',), - 'parent_type' => array('type'=>'varchar(255)', 'label'=>'Parent_type', 'enabled'=>'1', 'position'=>140, 'notnull'=>1, 'visible'=>0, 'default'=>1,), - 'parent_id' => array('type'=>'integer', 'label'=>'Parent_id', 'enabled'=>'1', 'position'=>150, 'notnull'=>1, 'visible'=>0, 'default'=>1,), - ); - - public $rowid; - public $ref; - public $ref_ext; - public $entity; - public $date_creation; - public $tms; - public $import_key; - public $status; - public $type; - public $json; - public $model_pdf; - public $model_odt; - public $last_main_doc; - public $fk_user_creat; - public $parent_type; - public $parent_id; + public $table_element = 'saturne_object_documents'; /** * Constructor @@ -115,36 +48,7 @@ class DigiriskDocuments extends CommonObject */ public function __construct(DoliDB $db) { - global $conf, $langs; - - $this->db = $db; - - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; - if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; - - // Unset fields that are disabled - foreach ($this->fields as $key => $val) - { - if (isset($val['enabled']) && empty($val['enabled'])) - { - unset($this->fields[$key]); - } - } - - // Translate some data of arrayofkeyval - if (is_object($langs)) - { - foreach ($this->fields as $key => $val) - { - if (is_array($val['arrayofkeyval'])) - { - foreach ($val['arrayofkeyval'] as $key2 => $val2) - { - $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2); - } - } - } - } + parent::__construct($db, $this->module, $this->element); } /** @@ -154,7 +58,7 @@ public function __construct(DoliDB $db) * @param bool $notrigger false=launch triggers after, true=disable triggers * @return int 0 < if KO, ID of created object if OK */ - public function create(User $user, $notrigger = false, $parentObject = 0) + public function create(User $user, bool $notrigger = false, object $parentObject = null): int { global $conf; @@ -166,7 +70,7 @@ public function create(User $user, $notrigger = false, $parentObject = 0) $this->import_key = ""; $this->status = 1; $this->type = $this->element; - + $this->module_name = $this->module; $this->fk_user_creat = $user->id ?: 1; if ($parentObject->id > 0) { @@ -206,120 +110,6 @@ public function DigiriskFillJSON($object) { } } - /** - * Load object in memory from the database - * - * @param int $id Id object - * @param string $ref Ref - * @return int 0 < if KO, 0 if not found, >0 if OK - */ - public function fetch($id, $ref = null) - { - return $this->fetchCommon($id, $ref); - } - - /** - * Load list of objects in memory from the database. - * - * @param string $sortorder Sort Order - * @param string $sortfield Sort field - * @param int $limit limit - * @param int $offset Offset - * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...) - * @param string $filtermode Filter mode (AND/OR) - * @return array|int int <0 if KO, array of pages if OK - * @throws Exception - */ - public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') - { - dol_syslog(__METHOD__, LOG_DEBUG); - - $records = array(); - - $sql = 'SELECT '; - $sql .= $this->getFieldList(); - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; - if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')'; - else $sql .= ' WHERE 1 = 1'; - // Manage filter - $sqlwhere = array(); - if (count($filter) > 0) { - foreach ($filter as $key => $value) { - if ($key == 't.rowid') { - $sqlwhere[] = $key.'='.$value; - } - elseif (strpos($key, 'date') !== false) { - $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; - } - elseif ($key == 'customsql') { - $sqlwhere[] = $value; - } - else { - $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; - } - } - } - if (count($sqlwhere) > 0) { - $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; - } - - if (!empty($sortfield)) { - $sql .= $this->db->order($sortfield, $sortorder); - } - if (!empty($limit)) { - $sql .= ' '.$this->db->plimit($limit, $offset); - } - - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < ($limit ? min($limit, $num) : $num)) - { - $obj = $this->db->fetch_object($resql); - - $record = new self($this->db); - $record->setVarsFromFetchObj($obj); - - $records[$record->id] = $record; - - $i++; - } - $this->db->free($resql); - - return $records; - } else { - $this->errors[] = 'Error '.$this->db->lasterror(); - dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); - - return -1; - } - } - - /** - * Update object into database - * - * @param User $user User that modifies - * @param bool $notrigger false=launch triggers after, true=disable triggers - * @return int 0 < if KO, >0 if OK - */ - public function update(User $user, $notrigger = false) - { - return $this->updateCommon($user, $notrigger); - } - - /** - * Delete object in database - * - * @param User $user User that deletes - * @param bool $notrigger false=launch triggers after, true=disable triggers - * @return int 0 < if KO, >0 if OK - */ - public function delete(User $user, $notrigger = false) - { - return $this->deleteCommon($user, $notrigger); - } - /** * Load the info information of the object * @@ -376,51 +166,6 @@ public function info($id) } } - /** - * Initialise object with example values - * ID must be 0 if object instance is a specimen - * - * @return void - */ - public function initAsSpecimen() - { - $this->initAsSpecimenCommon(); - } - - /** - * Create a document onto disk according to template module. - * - * @param string $modele Force template to use ('' to not force) - * @param Translate $outputlangs Objet langs use for translation - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information - * @param bool $preventrecursivecall Prevent recursive on commonGenerateDocument hook - * @return int 0 if KO, 1 if OK - */ - public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null, $preventrecursivecall = false) - { - global $langs, $conf; - $langs->load("digiriskdolibarr@digiriskdolibarr"); - - $modelpath = "custom/digiriskdolibarr/core/modules/digiriskdolibarr/digiriskdocuments/".$this->element."/"; - - if ($preventrecursivecall) { - $moreparams['preventrecursivecall'] = true; - } - - $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, ($preventrecursivecall ? $moreparams : $moreparams['object'])); - - $confName = 'DIGIRISKDOLIBARR_MAIN_AGENDA_ACTIONAUTO_' . strtoupper($this->type).'_GENERATE'; - - if (!empty($conf->global->$confName)) { - $this->call_trigger(strtoupper($this->type) . '_GENERATE', $moreparams['user']); - } - - return $result; - } - /** * Fill risk data for ODT. * diff --git a/class/digiriskdolibarrdocuments/groupmentdocument.class.php b/class/digiriskdolibarrdocuments/groupmentdocument.class.php index 17c79b560..51f4bd066 100644 --- a/class/digiriskdolibarrdocuments/groupmentdocument.class.php +++ b/class/digiriskdolibarrdocuments/groupmentdocument.class.php @@ -21,13 +21,11 @@ * \brief This file is a class file for GroupmentDocument. */ -// Load Saturne libraries. -require_once __DIR__ . '/../../../saturne/class/saturnedocuments.class.php'; /** * Class for GroupmentDocument. */ -class GroupmentDocument extends SaturneDocuments +class GroupmentDocument extends DigiriskDocuments { /** * @var string Module name. diff --git a/class/digiriskdolibarrdocuments/riskassessmentdocument.class.php b/class/digiriskdolibarrdocuments/riskassessmentdocument.class.php index 084babdf5..6214ef403 100644 --- a/class/digiriskdolibarrdocuments/riskassessmentdocument.class.php +++ b/class/digiriskdolibarrdocuments/riskassessmentdocument.class.php @@ -32,68 +32,23 @@ class RiskAssessmentDocument extends DigiriskDocuments { /** - * @var DoliDB Database handler. + * @var string Module name. */ - public $db; + public $module = 'digiriskdolibarr'; /** - * @var string ID to identify managed object. + * @var string Element type of object. */ public $element = 'riskassessmentdocument'; /** - * @var int Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - - /** - * @var string String with name of icon for riskassessmentdocument. Must be the part after the 'object_' into object_riskassessmentdocuement.png - */ - public $picto = 'riskassessmentdocument@digiriskdolibarr'; - - /** - * Constructor + * Constructor. * - * @param DoliDb $db Database handler + * @param DoliDb $db Database handler. */ public function __construct(DoliDB $db) { - global $conf, $langs; - - $this->db = $db; - - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; - if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; - - // Unset fields that are disabled - foreach ($this->fields as $key => $val) - { - if (isset($val['enabled']) && empty($val['enabled'])) - { - unset($this->fields[$key]); - } - } - - // Translate some data of arrayofkeyval - if (is_object($langs)) - { - foreach ($this->fields as $key => $val) - { - if (is_array($val['arrayofkeyval'])) - { - foreach ($val['arrayofkeyval'] as $key2 => $val2) - { - $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2); - } - } - } - } + parent::__construct($db, $this->module, $this->element); } /** diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/mod_groupmentdocument_standard.php b/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/mod_groupmentdocument_standard.php deleted file mode 100644 index f60f74d5c..000000000 --- a/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/mod_groupmentdocument_standard.php +++ /dev/null @@ -1,111 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * or see https://www.gnu.org/ - */ - -/** - * \file core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/mod_groupmentdocument_standard.php - * \ingroup digiriskdolibarr - * \brief File containing class for groupmentdocument numbering module Standard - */ - -require_once __DIR__ . '/../modules_digiriskdocuments.php'; - -/** - * Class to manage groupmentdocument numbering rules Standard - */ -class mod_groupmentdocument_standard extends ModeleNumRefDigiriskDocuments -{ - /** - * Dolibarr version of the loaded document - * @var string - */ - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' - - /** - * @var string document prefix - */ - public $prefix = 'GPD'; - - /** - * @var string model name - */ - public $name = 'Dioné'; - - /** - * @var string Error code (or message) - */ - public $error = ''; - - /** - * Returns the description of the numbering model - * - * @return string Texte descriptif - */ - public function info() - { - global $langs; - $langs->load("digiriskdolibarr@digiriskdolibarr"); - return $langs->trans('DigiriskGroupmentDocumentStandardModel', $this->prefix); - } - - /** - * Return an example of numbering - * - * @return string Example - */ - public function getExample() - { - return $this->prefix . "1"; - } - - /** - * Return next free value - * - * @param Object $object Object we need next value for - * @return string Value if KO, <0 if KO - * @throws Exception - */ - public function getNextValue($object) - { - global $db, $conf; - - // first we get the max value - $posindice = strlen($this->prefix) + 1; - $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max"; - $sql .= " FROM " . MAIN_DB_PREFIX . "digiriskdolibarr_digiriskdocuments"; - $sql .= " WHERE ref LIKE '" . $db->escape($this->prefix) . "%'"; - if ($object->ismultientitymanaged == 1) { - $sql .= " AND entity = " . $conf->entity; - } - - $resql = $db->query($sql); - if ($resql) { - $obj = $db->fetch_object($resql); - if ($obj) $max = intval($obj->max); - else $max = 0; - } else { - dol_syslog("mod_groupmentdocument_standard::getNextValue", LOG_DEBUG); - return -1; - } - - if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is - else $num = sprintf("%s", $max + 1); - - dol_syslog("mod_groupmentdocument_standard::getNextValue return " . $this->prefix . $num); - return $this->prefix . $num; - } -} diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/mod_workunitdocument_standard.php b/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/mod_workunitdocument_standard.php deleted file mode 100644 index be6fa9957..000000000 --- a/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/mod_workunitdocument_standard.php +++ /dev/null @@ -1,111 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * or see https://www.gnu.org/ - */ - -/** - * \file core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/mod_workunitdocument_standard.php - * \ingroup digiriskdolibarr - * \brief File containing class for workunitdocument numbering module Standard - */ - -require_once __DIR__ . '/../modules_digiriskdocuments.php'; - -/** - * Class to manage workunitdocument numbering rules Standard - */ -class mod_workunitdocument_standard extends ModeleNumRefDigiriskDocuments -{ - /** - * Dolibarr version of the loaded document - * @var string - */ - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' - - /** - * @var string document prefix - */ - public $prefix = 'WUD'; - - /** - * @var string model name - */ - public $name = 'Téthys'; - - /** - * @var string Error code (or message) - */ - public $error = ''; - - /** - * Returns the description of the numbering model - * - * @return string Texte descriptif - */ - public function info() - { - global $langs; - $langs->load("digiriskdolibarr@digiriskdolibarr"); - return $langs->trans('DigiriskWorkUnitDocumentStandardModel', $this->prefix); - } - - /** - * Return an example of numbering - * - * @return string Example - */ - public function getExample() - { - return $this->prefix . "1"; - } - - /** - * Return next free value - * - * @param Object $object Object we need next value for - * @return string Value if KO, <0 if KO - * @throws Exception - */ - public function getNextValue($object) - { - global $db, $conf; - - // first we get the max value - $posindice = strlen($this->prefix) + 1; - $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max"; - $sql .= " FROM " . MAIN_DB_PREFIX . "digiriskdolibarr_digiriskdocuments"; - $sql .= " WHERE ref LIKE '" . $db->escape($this->prefix) . "%'"; - if ($object->ismultientitymanaged == 1) { - $sql .= " AND entity = " . $conf->entity; - } - - $resql = $db->query($sql); - if ($resql) { - $obj = $db->fetch_object($resql); - if ($obj) $max = intval($obj->max); - else $max = 0; - } else { - dol_syslog("mod_workunitdocument_standard::getNextValue", LOG_DEBUG); - return -1; - } - - if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is - else $num = sprintf("%s", $max + 1); - - dol_syslog("mod_workunitdocument_standard::getNextValue return " . $this->prefix . $num); - return $this->prefix . $num; - } -} diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/digiriskelementdocument/index.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/digiriskelementdocument/index.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/digiriskelementdocument/index.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/digiriskelementdocument/index.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/digiriskelementdocument/modules_digiriskelementdocument.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/digiriskelementdocument/modules_digiriskelementdocument.php similarity index 99% rename from core/modules/digiriskdolibarr/digiriskdocuments/digiriskelementdocument/modules_digiriskelementdocument.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/digiriskelementdocument/modules_digiriskelementdocument.php index f511aa446..84385762d 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/digiriskelementdocument/modules_digiriskelementdocument.php +++ b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/digiriskelementdocument/modules_digiriskelementdocument.php @@ -52,6 +52,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // phpcs:enable global $user, $langs, $conf, $hookmanager, $action, $mysoc; + $digiriskelement = $digiriskelement['object']; $type = $digiriskelement->element_type; if (empty($srctemplatepath)) { @@ -72,6 +73,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $outputlangs->loadLangs(array("main", "dict", "companies", "digiriskdolibarr@digiriskdolibarr")); $refModName = 'DIGIRISKDOLIBARR_' . strtoupper($type) . 'DOCUMENT_ADDON'; + $mod = new $conf->global->$refModName($this->db); $ref = $mod->getNextValue($object); @@ -104,7 +106,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $object->last_main_doc = $filename; - $sql = "UPDATE " . MAIN_DB_PREFIX . "digiriskdolibarr_digiriskdocuments"; + $sql = "UPDATE " . MAIN_DB_PREFIX . "saturne_object_documents"; $sql .= " SET last_main_doc =" . ( ! empty($filename) ? "'" . $this->db->escape($filename) . "'" : 'null'); $sql .= " WHERE rowid = " . $object->id; @@ -199,6 +201,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails if ( ! empty($digiriskelement) ) { //Fill risks data $risks = $risk->fetchRisksOrderedByCotation($digiriskelement->id, false, $conf->global->DIGIRISKDOLIBARR_SHOW_INHERITED_RISKS_IN_DOCUMENTS, $conf->global->DIGIRISKDOLIBARR_SHOW_SHARED_RISKS); + $object->fillRiskData($odfHandler, $object, $outputlangs, $tmparray, $file, $risks, $conf->global->DIGIRISKDOLIBARR_SHOW_SHARED_RISKS); //Fill evaluators data diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/doc_firepermitdocument_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/firepermitdocument/doc_firepermitdocument_custom_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/doc_firepermitdocument_custom_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/firepermitdocument/doc_firepermitdocument_custom_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/doc_firepermitdocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/firepermitdocument/doc_firepermitdocument_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/doc_firepermitdocument_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/firepermitdocument/doc_firepermitdocument_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/index.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/firepermitdocument/index.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/index.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/firepermitdocument/index.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/mod_firepermitdocument_standard.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/firepermitdocument/mod_firepermitdocument_standard.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/mod_firepermitdocument_standard.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/firepermitdocument/mod_firepermitdocument_standard.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/modules_firepermitdocument.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/firepermitdocument/modules_firepermitdocument.php similarity index 99% rename from core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/modules_firepermitdocument.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/firepermitdocument/modules_firepermitdocument.php index 18fa0836a..7d0ab5854 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/firepermitdocument/modules_firepermitdocument.php +++ b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/firepermitdocument/modules_firepermitdocument.php @@ -241,7 +241,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $tmparray['dimanche_aprem'] = $opening_hours_sunday[1]; if ( ! empty($preventionplanlines) && $preventionplanlines > 0 && is_array($preventionplanlines)) { - $tmparray['interventions_info'] = count($preventionplanlines) . " " . $langs->trans('PreventionPlanLine'); + $tmparray['interventions_info'] = count($preventionplanlines) . " modules_firepermitdocument.php" . $langs->trans('PreventionPlanLine'); } else { $tmparray['interventions_info'] = 0; } @@ -279,7 +279,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $tmparray['dimanche_apremF'] = $opening_hours_sunday[1]; if ( ! empty($firepermitlines) && $firepermitlines > 0 && is_array($firepermitlines)) { - $tmparray['interventions_info_FP'] = count($firepermitlines) . " " . $langs->trans('FirePermitLine'); + $tmparray['interventions_info_FP'] = count($firepermitlines) . " modules_firepermitdocument.php" . $langs->trans('FirePermitLine'); } else { $tmparray['interventions_info_FP'] = 0; } diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/doc_groupmentdocument_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/groupmentdocument/doc_groupmentdocument_custom_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/doc_groupmentdocument_custom_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/groupmentdocument/doc_groupmentdocument_custom_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/doc_groupmentdocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/groupmentdocument/doc_groupmentdocument_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/doc_groupmentdocument_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/groupmentdocument/doc_groupmentdocument_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/index.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/groupmentdocument/index.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/index.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/groupmentdocument/index.php diff --git a/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/groupmentdocument/mod_groupmentdocument_standard.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/groupmentdocument/mod_groupmentdocument_standard.php new file mode 100644 index 000000000..4618aeb77 --- /dev/null +++ b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/groupmentdocument/mod_groupmentdocument_standard.php @@ -0,0 +1,42 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see https://www.gnu.org/ + */ + +/** + * \file core/modules/digiquali/controldocument/mod_controldocument_standard.php + * \ingroup digiquali + * \brief File of class to manage controldocument numbering rules standard. + */ + +// Load Saturne libraries. +require_once __DIR__ . '/../../../../../../saturne/core/modules/saturne/modules_saturne.php'; + +/** + * Class to manage controldocument numbering rules standard. + */ +class mod_groupmentdocument_standard extends ModeleNumRefSaturne +{ + /** + * @var string Numbering module ref prefix. + */ + public string $prefix = 'GPD'; + + /** + * @var string Name. + */ + public string $name = 'Dioné'; +} diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/modules_groupmentdocument.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/groupmentdocument/modules_groupmentdocument.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/modules_groupmentdocument.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/groupmentdocument/modules_groupmentdocument.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/index.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/index.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/index.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/index.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/doc_informationssharing_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/informationssharing/doc_informationssharing_custom_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/doc_informationssharing_custom_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/informationssharing/doc_informationssharing_custom_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/doc_informationssharing_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/informationssharing/doc_informationssharing_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/doc_informationssharing_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/informationssharing/doc_informationssharing_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/index.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/informationssharing/index.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/index.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/informationssharing/index.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/mod_informationssharing_standard.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/informationssharing/mod_informationssharing_standard.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/mod_informationssharing_standard.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/informationssharing/mod_informationssharing_standard.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/modules_informationssharing.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/informationssharing/modules_informationssharing.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/informationssharing/modules_informationssharing.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/informationssharing/modules_informationssharing.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/doc_legaldisplay_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/legaldisplay/doc_legaldisplay_custom_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/doc_legaldisplay_custom_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/legaldisplay/doc_legaldisplay_custom_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/doc_legaldisplay_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/legaldisplay/doc_legaldisplay_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/doc_legaldisplay_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/legaldisplay/doc_legaldisplay_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/index.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/legaldisplay/index.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/index.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/legaldisplay/index.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/mod_legaldisplay_standard.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/legaldisplay/mod_legaldisplay_standard.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/mod_legaldisplay_standard.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/legaldisplay/mod_legaldisplay_standard.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/modules_legaldisplay.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/legaldisplay/modules_legaldisplay.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/legaldisplay/modules_legaldisplay.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/legaldisplay/modules_legaldisplay.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/doc_listingrisksaction_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/doc_listingrisksaction_custom_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/doc_listingrisksaction_custom_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/doc_listingrisksaction_custom_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/doc_listingrisksaction_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/doc_listingrisksaction_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/doc_listingrisksaction_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/doc_listingrisksaction_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/index.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/index.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/index.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/index.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/mod_listingrisksaction_standard.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/mod_listingrisksaction_standard.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/mod_listingrisksaction_standard.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/mod_listingrisksaction_standard.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/modules_listingrisksaction.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/modules_listingrisksaction.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/modules_listingrisksaction.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/modules_listingrisksaction.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/doc_listingrisksphoto_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/doc_listingrisksphoto_custom_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/doc_listingrisksphoto_custom_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/doc_listingrisksphoto_custom_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/doc_listingrisksphoto_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/doc_listingrisksphoto_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/doc_listingrisksphoto_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/doc_listingrisksphoto_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/index.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/index.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/index.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/index.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/mod_listingrisksphoto_standard.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/mod_listingrisksphoto_standard.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/mod_listingrisksphoto_standard.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/mod_listingrisksphoto_standard.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/modules_listingrisksphoto.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/modules_listingrisksphoto.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/modules_listingrisksphoto.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/modules_listingrisksphoto.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/modules_digiriskdocuments.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/modules_digiriskdocuments.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/modules_digiriskdocuments.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/modules_digiriskdocuments.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/preventionplandocument/doc_preventionplandocument_custom_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_custom_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/preventionplandocument/doc_preventionplandocument_custom_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/preventionplandocument/doc_preventionplandocument_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/preventionplandocument/doc_preventionplandocument_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_specimen_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/preventionplandocument/doc_preventionplandocument_specimen_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/doc_preventionplandocument_specimen_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/preventionplandocument/doc_preventionplandocument_specimen_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/index.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/preventionplandocument/index.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/index.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/preventionplandocument/index.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/mod_preventionplandocument_standard.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/preventionplandocument/mod_preventionplandocument_standard.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/mod_preventionplandocument_standard.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/preventionplandocument/mod_preventionplandocument_standard.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/modules_preventionplandocument.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/preventionplandocument/modules_preventionplandocument.php similarity index 99% rename from core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/modules_preventionplandocument.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/preventionplandocument/modules_preventionplandocument.php index 93e817e09..722a7879c 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/preventionplandocument/modules_preventionplandocument.php +++ b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/preventionplandocument/modules_preventionplandocument.php @@ -188,7 +188,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $tmparray['date_start_intervention_PPP'] = dol_print_date($preventionplan->date_start, 'dayhoursec'); $tmparray['date_end_intervention_PPP'] = dol_print_date($preventionplan->date_end, 'dayhoursec'); if (is_array($preventionplanlines)) { - $tmparray['interventions_info'] = count($preventionplanlines) . " " . $langs->trans('PreventionPlanLine'); + $tmparray['interventions_info'] = count($preventionplanlines) . " modules_preventionplandocument.php" . $langs->trans('PreventionPlanLine'); } else { $tmparray['interventions_info'] = 0; } diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/projectdocument/index.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/projectdocument/index.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/projectdocument/index.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/projectdocument/index.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/projectdocument/mod_projectdocument_standard.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/projectdocument/mod_projectdocument_standard.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/projectdocument/mod_projectdocument_standard.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/projectdocument/mod_projectdocument_standard.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/projectdocument/pdf_orque_projectdocument.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/projectdocument/pdf_orque_projectdocument.modules.php similarity index 97% rename from core/modules/digiriskdolibarr/digiriskdocuments/projectdocument/pdf_orque_projectdocument.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/projectdocument/pdf_orque_projectdocument.modules.php index 84b096899..264763ded 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/projectdocument/pdf_orque_projectdocument.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/projectdocument/pdf_orque_projectdocument.modules.php @@ -22,13 +22,13 @@ * \brief File of class to generate project document orque */ -require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php'; -require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/modules/project/modules_project.php'; +require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; require_once __DIR__ . '/mod_projectdocument_standard.php'; require_once __DIR__ . '/../../../../../class/riskanalysis/risk.class.php'; @@ -274,7 +274,7 @@ public function write_file(ProjectDocument $objectDocument, Translate $outputlan if (file_exists($dir)) { // Add pdfgeneration hook if (!is_object($hookmanager)) { - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('pdfgeneration')); @@ -331,7 +331,8 @@ public function write_file(ProjectDocument $objectDocument, Translate $outputlan $pdf->SetSubject($outputlangs->transnoentities('Project')); $pdf->SetCreator('Dolibarr ' .DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref). ' ' .$outputlangs->transnoentities('Project')); + $pdf->SetKeyWords( + $outputlangs->convToOutputCharset($object->ref) . ' pdf_orque_projectdocument.modules.php' .$outputlangs->transnoentities('Project')); if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { $pdf->SetCompression(false); } @@ -730,7 +731,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $pdf->SetFont('', 'B', $default_font_size + 3); $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 4, $outputlangs->transnoentities('Project'). ' ' .$outputlangs->convToOutputCharset($object->ref), '', 'R'); + $pdf->MultiCell(100, 4, $outputlangs->transnoentities('Project') . ' pdf_orque_projectdocument.modules.php' .$outputlangs->convToOutputCharset($object->ref), '', 'R'); $pdf->SetFont('', '', $default_font_size + 2); $posy += 6; diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/doc_riskassessmentdocument_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/riskassessmentdocument/doc_riskassessmentdocument_custom_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/doc_riskassessmentdocument_custom_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/riskassessmentdocument/doc_riskassessmentdocument_custom_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/doc_riskassessmentdocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/riskassessmentdocument/doc_riskassessmentdocument_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/doc_riskassessmentdocument_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/riskassessmentdocument/doc_riskassessmentdocument_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/index.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/riskassessmentdocument/index.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/index.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/riskassessmentdocument/index.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/mod_riskassessmentdocument_standard.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/riskassessmentdocument/mod_riskassessmentdocument_standard.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/mod_riskassessmentdocument_standard.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/riskassessmentdocument/mod_riskassessmentdocument_standard.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/modules_riskassessmentdocument.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/riskassessmentdocument/modules_riskassessmentdocument.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/riskassessmentdocument/modules_riskassessmentdocument.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/riskassessmentdocument/modules_riskassessmentdocument.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/doc_ticketdocument_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/ticketdocument/doc_ticketdocument_custom_odt.modules.php similarity index 99% rename from core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/doc_ticketdocument_custom_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/ticketdocument/doc_ticketdocument_custom_odt.modules.php index 28d5651a8..371724235 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/doc_ticketdocument_custom_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/ticketdocument/doc_ticketdocument_custom_odt.modules.php @@ -26,7 +26,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/doc.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; require_once __DIR__ . '/../../../../../class/digiriskelement.class.php'; require_once __DIR__ . '/mod_ticketdocument_standard.php'; diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/doc_ticketdocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/ticketdocument/doc_ticketdocument_odt.modules.php similarity index 98% rename from core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/doc_ticketdocument_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/ticketdocument/doc_ticketdocument_odt.modules.php index 0a160fb87..bdd94144e 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/doc_ticketdocument_odt.modules.php +++ b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/ticketdocument/doc_ticketdocument_odt.modules.php @@ -26,7 +26,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/doc.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; require_once __DIR__ . '/../../../../../class/digiriskelement.class.php'; require_once __DIR__ . '/mod_ticketdocument_standard.php'; diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/index.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/ticketdocument/index.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/index.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/ticketdocument/index.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/mod_ticketdocument_standard.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/ticketdocument/mod_ticketdocument_standard.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/mod_ticketdocument_standard.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/ticketdocument/mod_ticketdocument_standard.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/modules_ticketdocument.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/ticketdocument/modules_ticketdocument.php similarity index 99% rename from core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/modules_ticketdocument.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/ticketdocument/modules_ticketdocument.php index a1b839c37..70b8eac32 100644 --- a/core/modules/digiriskdolibarr/digiriskdocuments/ticketdocument/modules_ticketdocument.php +++ b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/ticketdocument/modules_ticketdocument.php @@ -253,7 +253,7 @@ function write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hide } } - require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; + require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; $actioncomm = new ActionComm($this->db); $event_list = $actioncomm->getActions('',$ticket->id,$ticket->element,''); diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/doc_workunitdocument_custom_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/workunitdocument/doc_workunitdocument_custom_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/doc_workunitdocument_custom_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/workunitdocument/doc_workunitdocument_custom_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/doc_workunitdocument_odt.modules.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/workunitdocument/doc_workunitdocument_odt.modules.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/doc_workunitdocument_odt.modules.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/workunitdocument/doc_workunitdocument_odt.modules.php diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/index.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/workunitdocument/index.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/index.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/workunitdocument/index.php diff --git a/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/workunitdocument/mod_workunitdocument_standard.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/workunitdocument/mod_workunitdocument_standard.php new file mode 100644 index 000000000..a08cb9bbe --- /dev/null +++ b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/workunitdocument/mod_workunitdocument_standard.php @@ -0,0 +1,42 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see https://www.gnu.org/ + */ + +/** + * \file core/modules/digiquali/controldocument/mod_controldocument_standard.php + * \ingroup digiquali + * \brief File of class to manage controldocument numbering rules standard. + */ + +// Load Saturne libraries. +require_once __DIR__ . '/../../../../../../saturne/core/modules/saturne/modules_saturne.php'; + +/** + * Class to manage controldocument numbering rules standard. + */ +class mod_workunitdocument_standard extends ModeleNumRefSaturne +{ + /** + * @var string Numbering module ref prefix. + */ + public string $prefix = 'GPD'; + + /** + * @var string Name. + */ + public string $name = 'Téthys'; +} diff --git a/core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/modules_workunitdocument.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/workunitdocument/modules_workunitdocument.php similarity index 100% rename from core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/modules_workunitdocument.php rename to core/modules/digiriskdolibarr/digiriskdolibarrdocuments/workunitdocument/modules_workunitdocument.php diff --git a/lib/digiriskdolibarr_digiriskelement.lib.php b/lib/digiriskdolibarr_digiriskelement.lib.php index 2ee038a46..e12e93199 100644 --- a/lib/digiriskdolibarr_digiriskelement.lib.php +++ b/lib/digiriskdolibarr_digiriskelement.lib.php @@ -27,11 +27,11 @@ * @param DigiriskElement $object DigiriskElement * @return array Array of tabs */ -function digiriskelementPrepareHead($object) +function digiriskelement_prepare_head($object) { global $langs, $conf, $user; - $langs->load("digiriskdolibarr@digiriskdolibarr"); + saturne_load_langs(); $h = 0; $head = array(); diff --git a/lib/digiriskdolibarr_digiriskstandard.lib.php b/lib/digiriskdolibarr_digiriskstandard.lib.php index 167fd72b6..d797128be 100644 --- a/lib/digiriskdolibarr_digiriskstandard.lib.php +++ b/lib/digiriskdolibarr_digiriskstandard.lib.php @@ -31,7 +31,7 @@ function digiriskstandard_prepare_head($object) { global $langs, $conf, $user; - $langs->load("digiriskdolibarr@digiriskdolibarr"); + saturne_load_langs(); $h = 0; $head = array(); diff --git a/sql/digiriskdocuments/index.php b/sql/digiriskdocuments/index.php deleted file mode 100644 index cd6990e24..000000000 --- a/sql/digiriskdocuments/index.php +++ /dev/null @@ -1,2 +0,0 @@ - --- --- This program is free software: you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation, either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see https://www.gnu.org/licenses/. - -ALTER TABLE llx_digiriskdolibarr_digiriskdocuments ADD INDEX idx_digiriskdolibarr_digiriskdocuments_rowid (rowid); -ALTER TABLE llx_digiriskdolibarr_digiriskdocuments ADD INDEX idx_digiriskdolibarr_digiriskdocuments_ref (ref); -ALTER TABLE llx_digiriskdolibarr_digiriskdocuments ADD CONSTRAINT llx_digiriskdolibarr_digiriskdocuments_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); -ALTER TABLE llx_digiriskdolibarr_digiriskdocuments ADD UNIQUE uk_digiriskdocuments_ref (ref, entity); diff --git a/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments.sql b/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments.sql deleted file mode 100644 index 93eb9b879..000000000 --- a/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments.sql +++ /dev/null @@ -1,33 +0,0 @@ --- Copyright (C) 2021-2023 EVARISK --- --- This program is free software: you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation, either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see https://www.gnu.org/licenses/. - -CREATE TABLE llx_digiriskdolibarr_digiriskdocuments( - rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - ref varchar(128) DEFAULT '(PROV)' NOT NULL, - ref_ext varchar(128), - entity integer DEFAULT 1 NOT NULL, - date_creation datetime NOT NULL, - tms timestamp, - import_key integer DEFAULT NULL, - status smallint, - type varchar(128), - json text, - model_pdf varchar(255), - model_odt varchar(255), - last_main_doc varchar(128), - fk_user_creat integer NOT NULL, - parent_type varchar(255), - parent_id integer NOT NULL -) ENGINE=innodb; diff --git a/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments_extrafields.key.sql b/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments_extrafields.key.sql deleted file mode 100644 index 95a86019b..000000000 --- a/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments_extrafields.key.sql +++ /dev/null @@ -1,16 +0,0 @@ --- Copyright (C) 2021-2023 EVARISK --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see https://www.gnu.org/licenses/. - -ALTER TABLE llx_digiriskdolibarr_digiriskdocuments_extrafields ADD INDEX idx_fk_object(fk_object); diff --git a/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments_extrafields.sql b/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments_extrafields.sql deleted file mode 100644 index 6f0b4a51d..000000000 --- a/sql/digiriskdocuments/llx_digiriskdolibarr_digiriskdocuments_extrafields.sql +++ /dev/null @@ -1,22 +0,0 @@ --- Copyright (C) 2021-2023 EVARISK --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see https://www.gnu.org/licenses/. - -create table llx_digiriskdolibarr_digiriskdocuments_extrafields( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, - import_key varchar(14), - fk_object integer NOT NULL -) ENGINE=innodb; - diff --git a/view/digiriskelement/digiriskelement_card.php b/view/digiriskelement/digiriskelement_card.php index dcfa95a8b..9b72bbd35 100644 --- a/view/digiriskelement/digiriskelement_card.php +++ b/view/digiriskelement/digiriskelement_card.php @@ -21,20 +21,14 @@ * \brief Page to create/edit/view digiriskelement */ -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if ( ! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if ( ! $res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php"; -if ( ! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php"; -// Try main.inc.php using relative path -if ( ! $res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if ( ! $res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if ( ! $res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php"; -if ( ! $res) die("Include of main fails"); +// Load DigiriskDolibarr environment +if (file_exists('../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../digiriskdolibarr.main.inc.php'; +} elseif (file_exists('../../digiriskdolibarr.main.inc.php')) { + require_once __DIR__ . '/../../digiriskdolibarr.main.inc.php'; +} else { + die('Include of digiriskdolibarr main fails'); +} require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; @@ -43,21 +37,21 @@ require_once __DIR__ . '/../../class/digiriskdocuments.class.php'; require_once __DIR__ . '/../../class/digiriskelement.class.php'; require_once __DIR__ . '/../../class/digiriskstandard.class.php'; -require_once __DIR__ . '/../../class/digiriskdocuments/groupmentdocument.class.php'; -require_once __DIR__ . '/../../class/digiriskdocuments/workunitdocument.class.php'; +require_once __DIR__ . '/../../class/digiriskdolibarrdocuments/groupmentdocument.class.php'; +require_once __DIR__ . '/../../class/digiriskdolibarrdocuments/workunitdocument.class.php'; require_once __DIR__ . '/../../lib/digiriskdolibarr_digiriskelement.lib.php'; require_once __DIR__ . '/../../lib/digiriskdolibarr_function.lib.php'; require_once __DIR__ . '/../../core/modules/digiriskdolibarr/digiriskelement/groupment/mod_groupment_standard.php'; require_once __DIR__ . '/../../core/modules/digiriskdolibarr/digiriskelement/groupment/mod_groupment_sirius.php'; require_once __DIR__ . '/../../core/modules/digiriskdolibarr/digiriskelement/workunit/mod_workunit_standard.php'; require_once __DIR__ . '/../../core/modules/digiriskdolibarr/digiriskelement/workunit/mod_workunit_canopus.php'; -require_once __DIR__ . '/../../core/modules/digiriskdolibarr/digiriskdocuments/groupmentdocument/modules_groupmentdocument.php'; -require_once __DIR__ . '/../../core/modules/digiriskdolibarr/digiriskdocuments/workunitdocument/modules_workunitdocument.php'; +require_once __DIR__ . '/../../core/modules/digiriskdolibarr/digiriskdolibarrdocuments/groupmentdocument/modules_groupmentdocument.php'; +require_once __DIR__ . '/../../core/modules/digiriskdolibarr/digiriskdolibarrdocuments/workunitdocument/modules_workunitdocument.php'; global $conf, $db, $hookmanager, $langs, $user; // Load translation files required by the page -$langs->loadLangs(array("digiriskdolibarr@digiriskdolibarr", "other")); +saturne_load_langs(['other']); // Get parameters $id = GETPOST('id', 'int'); @@ -69,7 +63,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $element_type = GETPOST('element_type', 'alpha'); -$fk_parent = GETPOST('fk_parent', 'int'); +$fkParent = GETPOST('fk_parent', 'int'); // Initialize technical objects $object = new DigiriskElement($db); @@ -80,9 +74,9 @@ $object->fetch($id); if ( $object->element_type == 'groupment') { - $digiriskelementdocument = new GroupmentDocument($db); + $document = new GroupmentDocument($db); } elseif ( $object->element_type == 'workunit' ) { - $digiriskelementdocument = new WorkUnitDocument($db); + $document = new WorkUnitDocument($db); } // Fetch optionals attributes and labels @@ -92,19 +86,18 @@ $upload_dir = $conf->digiriskdolibarr->multidir_output[isset($object->entity) ? $object->entity : 1]; -//Security check - +// Security check - Protection if external user $permissiontoread = $user->rights->digiriskdolibarr->digiriskelement->read; $permissiontoadd = $user->rights->digiriskdolibarr->digiriskelement->write; $permissiontodelete = $user->rights->digiriskdolibarr->digiriskelement->delete; -if ( ! $permissiontoread) accessforbidden(); +saturne_check_access($permissiontoread); /* * Actions */ -$parameters = array(); +$parameters = []; $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -142,69 +135,11 @@ header('Location: ' . $backtopage); } - // Action to build doc - if ($action == 'builddoc' && $permissiontoadd) { - $outputlangs = $langs; - $newlang = ''; - - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); - if ( ! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - - // To be sure vars is defined - if (empty($hidedetails)) $hidedetails = 0; - if (empty($hidedesc)) $hidedesc = 0; - if (empty($hideref)) $hideref = 0; - if (empty($moreparams)) $moreparams = null; - - $model = GETPOST('model', 'alpha'); - - $moreparams['object'] = $object; - $moreparams['user'] = $user; - - $result = $digiriskelementdocument->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); - if ($result <= 0) { - setEventMessages($object->error, $object->errors, 'errors'); - $action = ''; - } else { - if (empty($donotredirect)) { - setEventMessages($langs->trans("FileGenerated") . ' - ' . $digiriskelementdocument->last_main_doc, null); - $urltoredirect = $_SERVER['REQUEST_URI']; - $urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect); - $urltoredirect = preg_replace('/action=builddoc&?/', '', $urltoredirect); // To avoid infinite loop - header('Location: ' . $urltoredirect . '#builddoc'); - exit; - } - } - } + // Actions builddoc, forcebuilddoc, remove_file. + require_once __DIR__ . '/../../../saturne/core/tpl/documents/documents_action.tpl.php'; // Action to generate pdf from odt file require_once __DIR__ . '/../../core/tpl/documents/digiriskdolibarr_manual_pdf_generation_action.tpl.php'; - // Delete file in doc form - if ($action == 'remove_file' && $permissiontodelete) { - if ( ! empty($upload_dir)) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - - $langs->load("other"); - $filetodelete = GETPOST('file', 'alpha'); - $file = $upload_dir . '/' . $filetodelete; - $ret = dol_delete_file($file, 0, 0, 0, $object); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", $filetodelete), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", $filetodelete), null, 'errors'); - - // Make a redirect to avoid to keep the remove_file into the url that create side effects - $urltoredirect = $_SERVER['REQUEST_URI']; - $urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect); - $urltoredirect = preg_replace('/action=remove_file&?/', '', $urltoredirect); - - header('Location: ' . $urltoredirect); - exit; - } else { - setEventMessages('BugFoundVarUploaddirnotDefined', null, 'errors'); - } - } if ($action == 'confirm_delete' && GETPOST("confirm") == "yes") { $object->fetch($id); @@ -226,7 +161,6 @@ */ $form = new Form($db); -$emptyobject = new stdClass(); $formconfirm = ''; $parameters = array('formConfirm' => $formconfirm, 'object' => $object); @@ -237,35 +171,33 @@ if ( $object->element_type == 'groupment' ) { $title = $langs->trans("Groupment"); - $title_create = $langs->trans("NewGroupment"); - $title_edit = $langs->trans("ModifyGroupment"); + $titleCreate = $langs->trans("NewGroupment"); + $titleEdit = $langs->trans("ModifyGroupment"); $object->picto = 'groupment@digiriskdolibarr'; } elseif ( $object->element_type == 'workunit' ) { $title = $langs->trans("WorkUnit"); - $title_create = $langs->trans("NewWorkUnit"); - $title_edit = $langs->trans("ModifyWorkUnit"); + $titleCreate = $langs->trans("NewWorkUnit"); + $titleEdit = $langs->trans("ModifyWorkUnit"); $object->picto = 'workunit@digiriskdolibarr'; } else { $element_type = GETPOST('element_type', 'alpha'); if ( $element_type == 'groupment' ) { - $title_create = $langs->trans("NewGroupment"); + $titleCreate = $langs->trans("NewGroupment"); } else { - $title_create = $langs->trans("NewWorkUnit"); + $titleCreate = $langs->trans("NewWorkUnit"); } } $help_url = 'FR:Module_Digirisk#Cr.C3.A9ation_UT_et_GP'; -$morejs = array("/digiriskdolibarr/js/digiriskdolibarr.js"); -$morecss = array("/digiriskdolibarr/css/digiriskdolibarr.css"); -digiriskHeader($title, $help_url, $morejs, $morecss); ?> +digirisk_header($title, $help_url); ?> -
+
fetch($fk_parent); - print load_fiche_titre($title_create, '', "digiriskdolibarr32px@digiriskdolibarr"); + $object->fetch($fkParent); + print load_fiche_titre($titleCreate, '', "digiriskdolibarr32px@digiriskdolibarr"); print ''; print ''; @@ -274,7 +206,7 @@ if ($backtopageforcancel) print ''; - print dol_get_fiche_head(array(), ''); + print dol_get_fiche_head(); unset($object->fields['ref']); unset($object->fields['status']); @@ -289,7 +221,7 @@ print '' . $langs->trans("ParentElement") . ''; print ''; - if (empty($fk_parent)) { + if (empty($fkParent)) { $digiriskstandard->fetch($conf->global->DIGIRISKDOLIBARR_ACTIVE_STANDARD); print $digiriskstandard->getNomUrl(1, 'blank', 1); } else { @@ -305,7 +237,7 @@ print ''; print ''; - print ''; + print ''; print '' . $langs->trans("ShowInSelectOnPublicTicketInterface") . ''; print ''; @@ -329,7 +261,7 @@ // Part to edit record if (($id || $ref) && $action == 'edit') { - print load_fiche_titre($title_edit, '', "digiriskdolibarr32px@digiriskdolibarr"); + print load_fiche_titre($titleEdit, '', "digiriskdolibarr32px@digiriskdolibarr"); print ''; print ''; @@ -364,7 +296,7 @@ if ($id != $conf->global->DIGIRISKDOLIBARR_DIGIRISKELEMENT_TRASH) { print '' . $langs->trans("ParentElement") . ''; - print $object->select_digiriskelement_list($object->fk_parent, 'fk_parent', 'element_type="groupment" AND fk_parent != ' . $conf->global->DIGIRISKDOLIBARR_DIGIRISKELEMENT_TRASH, 0, 0, array(), 0, 0, 'minwidth100', GETPOST('id'), false); + print $object->select_digiriskelement_list($object->fk_parent, 'fk_parent', 'element_type="groupment" AND fk_parent != ' . $conf->global->DIGIRISKDOLIBARR_DIGIRISKELEMENT_TRASH, 0, 0, [], 0, 0, 'minwidth100', GETPOST('id'), false); } print ''; @@ -399,25 +331,24 @@ print $formconfirm; $res = $object->fetch_optionals(); - $head = digiriskelementPrepareHead($object); + saturne_get_fiche_head($object, 'elementCard', $title); - print dol_get_fiche_head($head, 'elementCard', $title, -1, "digiriskdolibarr@digiriskdolibarr"); + $trashList = $object->fetchDigiriskElementFlat($conf->global->DIGIRISKDOLIBARR_DIGIRISKELEMENT_TRASH); - $trash_list = $object->fetchDigiriskElementFlat($conf->global->DIGIRISKDOLIBARR_DIGIRISKELEMENT_TRASH); - - if ($trash_list < 0 || empty($trash_list)) { - $trash_list = array(); + if ($trashList < 0 || empty($trashList)) { + $trashList = []; } // Object card // ------------------------------------------------------------ $width = 80; $height = 80; $cssclass = 'photoref'; - dol_strlen($object->label) ? $morehtmlref = ' - ' . $object->label : ''; + // Project $morehtmlref = '
'; $project->fetch($conf->global->DIGIRISKDOLIBARR_DU_PROJECT); $morehtmlref .= $langs->trans('Project') . ' : ' . getNomUrlProject($project, 1, 'blank', 1); + // ParentElement $parent_element = new DigiriskElement($db); $result = $parent_element->fetch($object->fk_parent); @@ -431,9 +362,9 @@ } $morehtmlref .= '
'; if (isset($object->element_type)) { - $morehtmlleft = '
' . digirisk_show_photos('digiriskdolibarr', $conf->digiriskdolibarr->multidir_output[$conf->entity] . '/' . $object->element_type, 'small', 5, 0, 0, 0, $height, $width, 0, 0, 0, $object->element_type, $object) . '
'; + $morehtmlleft = '
' . saturne_show_medias_linked('digiriskdolibarr', $conf->digiriskdolibarr->multidir_output[$conf->entity] . '/' . $object->element_type, 'small', 5, 0, 0, 0, $height, $width, 0, 0, 0, $object->element_type, $object, 'photo', 0, 0) . '
'; } else { - $morehtmlleft = '
' . digirisk_show_photos('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 5, 0, 0, 0, $height, $width, 0, 0, 0, 'logos', $emptyobject) . '
'; + $morehtmlleft = '
' . saturne_show_medias_linked('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $object, 'photo',0, 0) . '
'; } $linkback = '' . $langs->trans("BackToList") . ''; @@ -450,9 +381,6 @@ print 'show_in_selector == 0) ? '' : ' checked=""') . '" disabled> '; print ''; - //Show common fields - // include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - // Other attributes. Fields from hook formObjectOptions and Extrafields. include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; @@ -466,7 +394,7 @@ if ($object->id > 0) { // Buttons for actions print '
' . "\n"; - $parameters = array(); + $parameters = []; $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -478,7 +406,7 @@ print '' . $langs->trans('Modify') . '' . "\n"; } - if ($permissiontodelete && ! array_key_exists($object->id, $trash_list) && $object->id != $conf->global->DIGIRISKDOLIBARR_DIGIRISKELEMENT_TRASH) { + if ($permissiontodelete && ! array_key_exists($object->id, $trashList) && $object->id != $conf->global->DIGIRISKDOLIBARR_DIGIRISKELEMENT_TRASH) { print '' . $langs->trans("Delete") . ''; } else { print '' . $langs->trans('Delete') . ''; @@ -487,32 +415,29 @@ print '
' . "\n"; // Document Generation -- Génération des documents - $includedocgeneration = 1; - if ($includedocgeneration) { - print '
'; - - $objref = dol_sanitizeFileName($object->ref); - $dir_files = $digiriskelementdocument->element . '/' . $objref; - $filedir = $upload_dir . '/' . $dir_files; - $urlsource = $_SERVER["PHP_SELF"] . '?id=' . $id; - - if ($digiriskelementdocument->element == 'groupmentdocument') { - $modulepart = 'digiriskdolibarr:GroupmentDocument'; - $defaultmodel = $conf->global->DIGIRISKDOLIBARR_GROUPMENTDOCUMENT_DEFAULT_MODEL; - $title = $langs->trans('GroupmentDocument'); - } elseif ($digiriskelementdocument->element == 'workunitdocument') { - $modulepart = 'digiriskdolibarr:WorkUnitDocument'; - $defaultmodel = $conf->global->DIGIRISKDOLIBARR_WORKUNITDOCUMENT_DEFAULT_MODEL; - $title = $langs->trans('WorkUnitDocument'); - } - - if ($permissiontoadd || $permissiontoread) { - $genallowed = 1; - } + print '
'; + + $objref = dol_sanitizeFileName($object->ref); + $dirFiles = $document->element . '/' . $objref; + $filedir = $upload_dir . '/' . $dirFiles; + $urlsource = $_SERVER["PHP_SELF"] . '?id=' . $id; + + if ($document->element == 'groupmentdocument') { + $modulepart = 'digiriskdolibarr:GroupmentDocument'; + $defaultmodel = $conf->global->DIGIRISKDOLIBARR_GROUPMENTDOCUMENT_DEFAULT_MODEL; + $title = $langs->trans('GroupmentDocument'); + } elseif ($document->element == 'workunitdocument') { + $modulepart = 'digiriskdolibarr:WorkUnitDocument'; + $defaultmodel = $conf->global->DIGIRISKDOLIBARR_WORKUNITDOCUMENT_DEFAULT_MODEL; + $title = $langs->trans('WorkUnitDocument'); + } - print digiriskshowdocuments($modulepart, $dir_files, $filedir, $urlsource, $genallowed, $permissiontodelete, $defaultmodel, 1, 0, '', $title, '', '', $digiriskelementdocument); + if ($permissiontoadd || $permissiontoread) { + $genallowed = 1; } + print saturne_show_documents($modulepart, $dirFiles, $filedir, $urlsource, 1,1, '', 1, 0, 0, 0, 0, '', 0, '', empty($soc->default_lang) ? '' : $soc->default_lang, $object); + print '
'; diff --git a/view/digiriskstandard/digiriskstandard_agenda.php b/view/digiriskstandard/digiriskstandard_agenda.php index f1506b149..dd443e83c 100644 --- a/view/digiriskstandard/digiriskstandard_agenda.php +++ b/view/digiriskstandard/digiriskstandard_agenda.php @@ -137,7 +137,7 @@ $project->fetch($conf->global->DIGIRISKDOLIBARR_DU_PROJECT); $morehtmlref .= $langs->trans('Project') . ' : ' . getNomUrlProject($project, 1, 'blank', 1); $morehtmlref .= '
'; - $morehtmlleft = '
' . saturne_show_medias_linked('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $object, 0,0, 0) . '
'; + $morehtmlleft = '
' . saturne_show_medias_linked('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $object, 'photo',0, 0) . '
'; digirisk_banner_tab($object, '', '', 0, '', '', $morehtmlref, '', '', $morehtmlleft); diff --git a/view/digiriskstandard/digiriskstandard_card.php b/view/digiriskstandard/digiriskstandard_card.php index bf903e47e..a1e118276 100644 --- a/view/digiriskstandard/digiriskstandard_card.php +++ b/view/digiriskstandard/digiriskstandard_card.php @@ -114,7 +114,7 @@ $project->fetch($conf->global->DIGIRISKDOLIBARR_DU_PROJECT); $morehtmlref .= $langs->trans('Project') . ' : ' . getNomUrlProject($project, 1, 'blank', 1); $morehtmlref .= '
'; - $morehtmlleft = '
' . saturne_show_medias_linked('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $object, 0,0, 0) . '
'; + $morehtmlleft = '
' . saturne_show_medias_linked('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $object, 'photo',0, 0) . '
'; digirisk_banner_tab($object, '', '', 0, '', '', $morehtmlref, '', '', $morehtmlleft); diff --git a/view/digiriskstandard/digiriskstandard_informationssharing.php b/view/digiriskstandard/digiriskstandard_informationssharing.php index 4a5f5c823..e42284b45 100644 --- a/view/digiriskstandard/digiriskstandard_informationssharing.php +++ b/view/digiriskstandard/digiriskstandard_informationssharing.php @@ -107,7 +107,7 @@ $project->fetch($conf->global->DIGIRISKDOLIBARR_DU_PROJECT); $morehtmlref .= $langs->trans('Project') . ' : ' . getNomUrlProject($project, 1, 'blank', 1); $morehtmlref .= '
'; -$morehtmlleft = '
' . saturne_show_medias_linked('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $object, 0,0, 0) . '
'; +$morehtmlleft = '
' . saturne_show_medias_linked('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $object, 'photo',0, 0) . '
'; digirisk_banner_tab($object, '', '', 0, '', '', $morehtmlref, '', '', $morehtmlleft); diff --git a/view/digiriskstandard/digiriskstandard_legaldisplay.php b/view/digiriskstandard/digiriskstandard_legaldisplay.php index 41ae21bcc..9352e17c8 100644 --- a/view/digiriskstandard/digiriskstandard_legaldisplay.php +++ b/view/digiriskstandard/digiriskstandard_legaldisplay.php @@ -101,7 +101,6 @@ saturne_get_fiche_head($object, 'standardLegalDisplay', $title); - // Object card // ------------------------------------------------------------ // Project @@ -109,7 +108,7 @@ $project->fetch($conf->global->DIGIRISKDOLIBARR_DU_PROJECT); $morehtmlref .= $langs->trans('Project') . ' : ' . getNomUrlProject($project, 1, 'blank', 1); $morehtmlref .= '
'; -$morehtmlleft = '
' . saturne_show_medias_linked('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $object, 0,0, 0) . '
'; +$morehtmlleft = '
' . saturne_show_medias_linked('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $object, 'photo',0, 0) . '
'; digirisk_banner_tab($object, '', '', 0, '', '', $morehtmlref, '', '', $morehtmlleft); diff --git a/view/digiriskstandard/digiriskstandard_riskassessmentdocument.php b/view/digiriskstandard/digiriskstandard_riskassessmentdocument.php index 96c00356d..c47fb4b51 100644 --- a/view/digiriskstandard/digiriskstandard_riskassessmentdocument.php +++ b/view/digiriskstandard/digiriskstandard_riskassessmentdocument.php @@ -331,7 +331,7 @@ $project->fetch($conf->global->DIGIRISKDOLIBARR_DU_PROJECT); $morehtmlref .= $langs->trans('Project') . ' : ' . getNomUrlProject($project, 1, 'blank', 1); $morehtmlref .= '
'; -$morehtmlleft = '
' . saturne_show_medias_linked('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $object, 0,0, 0) . '
'; +$morehtmlleft = '
' . saturne_show_medias_linked('mycompany', $conf->mycompany->dir_output . '/logos', 'small', 1, 0, 0, 0, 80, 80, 0, 0, 0, 'logos', $object, 'photo',0, 0) . '
'; digirisk_banner_tab($object, '', '', 0, '', '', $morehtmlref, '', '', $morehtmlleft); From 5d38e90e36afb32b15ec048aa53a7d1f619ff6aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20David?= Date: Tue, 29 Aug 2023 15:43:54 +0200 Subject: [PATCH 008/293] #3217 [CSS] fix: saturne integration --- css/digiriskdolibarr.css | 2 +- css/digiriskdolibarr.min.css | 2 +- css/scss/module/_module.scss | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 css/scss/module/_module.scss diff --git a/css/digiriskdolibarr.css b/css/digiriskdolibarr.css index 496771b55..358905769 100644 --- a/css/digiriskdolibarr.css +++ b/css/digiriskdolibarr.css @@ -3851,4 +3851,4 @@ tr.liste_titre th.liste_titre:not(.maxwidthsearch), tr.liste_titre td.liste_titr div.secondcolumn div.box { padding-left: 0px; } -} \ No newline at end of file +} diff --git a/css/digiriskdolibarr.min.css b/css/digiriskdolibarr.min.css index e8ffc9d00..bd3a13dbb 100644 --- a/css/digiriskdolibarr.min.css +++ b/css/digiriskdolibarr.min.css @@ -1 +1 @@ -.risk-evaluation-cotation{width:50px;min-width:50px;height:50px;line-height:50px;text-align:center;border-radius:6px;background:#ececec;color:rgba(0,0,0,.8);font-size:16px;font-weight:600;margin-right:.5em}.risk-evaluation-cotation[data-scale="1"]{background:#ececec}.risk-evaluation-cotation[data-scale="2"]{background:#e9ad4f;color:#fff}.risk-evaluation-cotation[data-scale="3"]{background:#e05353;color:#fff}.risk-evaluation-cotation[data-scale="4"]{background:#2b2b2b;color:#fff}.risk-evaluation-cotation.selected-cotation{-webkit-box-shadow:0 0 0 2px #0d8aff;box-shadow:0 0 0 2px #0d8aff}.can-select,.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .risk-evaluation-cotation{-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.can-select:hover,.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .risk-evaluation-cotation:hover{cursor:pointer;opacity:.8}.wpeo-modal .title{display:block;font-weight:600;font-size:13px;margin-bottom:.6em;color:rgba(0,0,0,.8)}.wpeo-modal input[type=text],.wpeo-modal input[type=email],.wpeo-modal input[type=url],.wpeo-modal input[type=password],.wpeo-modal input[type=search],.wpeo-modal input[type=number],.wpeo-modal input[type=tel],.wpeo-modal input[type=range],.wpeo-modal input[type=date],.wpeo-modal input[type=month],.wpeo-modal input[type=week],.wpeo-modal input[type=time],.wpeo-modal input[type=datetime],.wpeo-modal input[type=datetime-local],.wpeo-modal input[type=color],.wpeo-modal select,.wpeo-modal textarea{width:100%;border:1px solid rgba(0,0,0,.2);padding:1em;-webkit-box-sizing:border-box;box-sizing:border-box}.wpeo-modal input[type=text]:focus,.wpeo-modal input[type=email]:focus,.wpeo-modal input[type=url]:focus,.wpeo-modal input[type=password]:focus,.wpeo-modal input[type=search]:focus,.wpeo-modal input[type=number]:focus,.wpeo-modal input[type=tel]:focus,.wpeo-modal input[type=range]:focus,.wpeo-modal input[type=date]:focus,.wpeo-modal input[type=month]:focus,.wpeo-modal input[type=week]:focus,.wpeo-modal input[type=time]:focus,.wpeo-modal input[type=datetime]:focus,.wpeo-modal input[type=datetime-local]:focus,.wpeo-modal input[type=color]:focus,.wpeo-modal select:focus,.wpeo-modal textarea:focus{border:1px solid rgba(0,0,0,.6)}.wpeo-modal select{padding:1em 0}.form-label-required::after{display:inline-block;content:"*";color:#e05353;font-size:22px;line-height:0;position:relative;top:4px;left:4px}.digirisk-page-container{max-width:1000px;background:#fff;-webkit-box-shadow:0 0 40px 0 rgba(0,0,0,.1);box-shadow:0 0 40px 0 rgba(0,0,0,.1);margin:1.5em auto 0 auto;padding:2em;-webkit-box-sizing:border-box;box-sizing:border-box}.digirisk-page-container *{-webkit-box-sizing:border-box;box-sizing:border-box}.pictoDigirisk{vertical-align:middle;width:24px;margin-right:2px}.box-flex-item .info-box{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:nowrap;flex-wrap:nowrap}.box-flex-item .info-box .info-box-icon{height:auto !important;border-radius:0 0 0 15px}.box-flex-item .info-box .info-box-content{margin-left:0 !important}.box-flex-item .info-box-icon{display:-webkit-box;display:-ms-flexbox;display:flex}.box-flex-item .info-box-icon img,.box-flex-item .info-box-icon i{margin:auto}.box-flex-item .close-dashboard-info,.box-flex-item .close-dashboard-widget{width:20px;height:20px;line-height:20px;text-align:center;border-radius:50%;background:#e3e3e3;-webkit-transition:all .2s ease-out;transition:all .2s ease-out;position:absolute;top:-5px;right:-5px}.box-flex-item .close-dashboard-info:hover,.box-flex-item .close-dashboard-widget:hover{cursor:pointer;background:#e05353;color:#fff;-webkit-transform:scale(1.2);transform:scale(1.2)}.box-flex-item .close-dashboard-info>[class*=fa],.box-flex-item .close-dashboard-widget>[class*=fa]{display:inline-block;line-height:20px}div.wpeo-modal-patchnote .modal-header{background-color:#fff;border-bottom:solid #ccc 1px}div.wpeo-modal-patchnote .modal-container{background-color:#e9eaed;border-radius:25px}div.wpeo-modal-patchnote .modal-container li{list-style-type:circle;margin-left:55px}div.wpeo-modal-patchnote .modal-container ul{line-height:30px}div.wpeo-modal-patchnote .modal-container code{padding:3px 5px;border-radius:6px;background-color:#fafafa}div.wpeo-modal-patchnote .modal-content img{width:100%;-webkit-box-shadow:5px 5px 18px rgba(0,0,0,.2);box-shadow:5px 5px 18px rgba(0,0,0,.2);margin-bottom:28px}div.wpeo-modal-patchnote .modal-content h3{margin-left:30px;color:#666;font-size:17px}div.wpeo-modal-patchnote .modal-title{color:#0a1464;font-size:24px !important}div.wpeo-modal-patchnote .wpeo-button{background-color:#ccc}.wpeo-dropdown{position:relative;display:inline-block}.wpeo-dropdown .dropdown-toggle{display:inline-block}.wpeo-dropdown .dropdown-toggle span~*[class*=icon]{margin-left:10px}.wpeo-dropdown .dropdown-content{opacity:0;pointer-events:none;-webkit-transform:translateY(-10px);transform:translateY(-10px);-webkit-transition:all .2s ease-out;transition:all .2s ease-out;position:absolute;background:#fff;z-index:99;border:1px solid rgba(0,0,0,.1);-webkit-box-shadow:0 0 10px 0px rgba(0,0,0,.3);box-shadow:0 0 10px 0px rgba(0,0,0,.3);width:220px;padding:.6em}.wpeo-dropdown.dropdown-active .dropdown-content{opacity:1;pointer-events:auto;-webkit-transform:translateY(0);transform:translateY(0)}.wpeo-dropdown ul,.wpeo-dropdown li{margin:0;list-style-type:none;padding:0}.wpeo-dropdown .dropdown-item{display:block;color:rgba(0,0,0,.7);text-decoration:none}.wpeo-dropdown .dropdown-item::before{display:none;content:""}.wpeo-dropdown .dropdown-item .dropdown-result-title,.wpeo-dropdown .dropdown-item .dropdown-result-subtitle{display:block}.wpeo-dropdown .dropdown-item .dropdown-result-title{font-size:14px}.wpeo-dropdown .dropdown-item .dropdown-result-subtitle{font-size:12px;color:rgba(0,0,0,.5)}.wpeo-dropdown.dropdown-small .dropdown-content{width:60px}.wpeo-dropdown.dropdown-medium .dropdown-content{width:220px}.wpeo-dropdown.dropdown-large .dropdown-content{width:360px}.wpeo-dropdown.dropdown-padding-0 .dropdown-content{padding:0}.wpeo-dropdown.dropdown-padding-1 .dropdown-content{padding:.6em}.wpeo-dropdown.dropdown-padding-2 .dropdown-content{padding:1.2em}.wpeo-dropdown.dropdown-left .dropdown-content{left:0}.wpeo-dropdown.dropdown-right .dropdown-content{right:0}.wpeo-dropdown.dropdown-horizontal.dropdown-left .dropdown-content{left:100%}.wpeo-dropdown.dropdown-horizontal.dropdown-right .dropdown-content{right:100%}.wpeo-dropdown.dropdown-horizontal .dropdown-content{top:0;width:auto !important;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.wpeo-dropdown .dropdown-item.dropdown-item-disable{opacity:.6;cursor:default !important;pointer-events:none}.wpeo-dropdown .dropdown-content .dropdown-item{padding:.6em;background:#fff;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.wpeo-dropdown .dropdown-content .dropdown-item:hover{cursor:pointer;background:rgba(0,0,0,.1)}.wpeo-dropdown.dropdown-list .dropdown-content{text-align:left}.wpeo-dropdown.dropdown-list .dropdown-item::after{display:block;content:"";clear:both}.wpeo-dropdown.dropdown-list .dropdown-item img{float:left;margin-right:.4em}.wpeo-dropdown.dropdown-grid .dropdown-item img{width:100%;height:auto;display:block;margin:0}.wpeo-button{display:inline-block;border:0;-webkit-box-shadow:none;box-shadow:none;background:none;text-decoration:none;padding:6px 14px;line-height:1.4;vertical-align:middle;height:auto;border-radius:0;-webkit-transition:all .2s ease-out;transition:all .2s ease-out;position:relative;border-width:3px;border-style:solid;font-size:16px;-webkit-box-sizing:border-box;box-sizing:border-box;background:#0d8aff;border-color:#0d8aff;color:#fff}.wpeo-button:focus,.wpeo-button:visited{color:#fff}.wpeo-button:hover{color:#fff;-webkit-box-shadow:inset 0 -2.6em rgba(255,255,255,.25);box-shadow:inset 0 -2.6em rgba(255,255,255,.25);cursor:pointer;text-decoration:none}.wpeo-button:focus,.wpeo-button:active{outline:none}.wpeo-button{background:#0d8aff;border-color:#0d8aff;color:#fff}.wpeo-button.button-main{background:#0d8aff;border-color:#0d8aff;color:#fff}.wpeo-button.button-secondary{background:#263c5c;border-color:#263c5c;color:#fff}.wpeo-button.button-light{background:#fff;border-color:#fff;color:#333}.wpeo-button.button-light:hover{-webkit-box-shadow:inset 0 -2.6em rgba(0,0,0,.1);box-shadow:inset 0 -2.6em rgba(0,0,0,.1);color:#333}.wpeo-button.button-dark{background:#2b2b2b;border-color:#2b2b2b}.wpeo-button.button-grey{background:#ececec;border-color:#ececec;color:#333}.wpeo-button.button-grey:hover{-webkit-box-shadow:inset 0 -2.6em rgba(0,0,0,.1);box-shadow:inset 0 -2.6em rgba(0,0,0,.1);color:#333}.wpeo-button.button-red{background:#e05353;border-color:#e05353}.wpeo-button.button-yellow{background:#e9ad4f;border-color:#e9ad4f}.wpeo-button.button-blue{background:#0d8aff;border-color:#0d8aff}.wpeo-button.button-green{background:#47e58e;border-color:#47e58e}.wpeo-button.button-transparent{background:rgba(0,0,0,0);border-color:rgba(0,0,0,0);color:rgba(51,51,51,.4)}.wpeo-button.button-transparent:hover{color:#333;-webkit-box-shadow:inset 0 -2.6em rgba(255,255,255,0);box-shadow:inset 0 -2.6em rgba(255,255,255,0)}.wpeo-button.button-bordered{background:none;border-color:#0d8aff;color:#0d8aff}.wpeo-button.button-bordered.button-main{border-color:#0d8aff;color:#0d8aff}.wpeo-button.button-bordered.button-main:hover{-webkit-box-shadow:inset 0 -2.6em #0d8aff;box-shadow:inset 0 -2.6em #0d8aff;color:#fff}.wpeo-button.button-bordered.button-light{border-color:#fff;color:#fff}.wpeo-button.button-bordered.button-light:hover{-webkit-box-shadow:inset 0 -2.6em #fff;box-shadow:inset 0 -2.6em #fff;color:#333}.wpeo-button.button-bordered.button-dark{border-color:#2b2b2b;color:#2b2b2b}.wpeo-button.button-bordered.button-dark:hover{-webkit-box-shadow:inset 0 -2.6em #2b2b2b;box-shadow:inset 0 -2.6em #2b2b2b}.wpeo-button.button-bordered.button-grey{border-color:#ececec;color:#a0a0a0}.wpeo-button.button-bordered.button-grey:hover{-webkit-box-shadow:inset 0 -2.6em #ececec;box-shadow:inset 0 -2.6em #ececec;color:#333}.wpeo-button.button-bordered.button-red{border-color:#e05353;color:#e05353}.wpeo-button.button-bordered.button-red:hover{-webkit-box-shadow:inset 0 -2.6em #e05353;box-shadow:inset 0 -2.6em #e05353}.wpeo-button.button-bordered.button-yellow{border-color:#e9ad4f;color:#e9ad4f}.wpeo-button.button-bordered.button-yellow:hover{-webkit-box-shadow:inset 0 -2.6em #e9ad4f;box-shadow:inset 0 -2.6em #e9ad4f}.wpeo-button.button-bordered.button-blue{border-color:#0d8aff;color:#0d8aff}.wpeo-button.button-bordered.button-blue:hover{-webkit-box-shadow:inset 0 -2.6em #0d8aff;box-shadow:inset 0 -2.6em #0d8aff}.wpeo-button.button-bordered.button-green{border-color:#47e58e;color:#47e58e}.wpeo-button.button-bordered.button-green:hover{-webkit-box-shadow:inset 0 -2.6em #47e58e;box-shadow:inset 0 -2.6em #47e58e}.wpeo-button.button-bordered:hover{-webkit-box-shadow:inset 0 -2.6em #0d8aff;box-shadow:inset 0 -2.6em #0d8aff;color:#fff}.wpeo-button .button-add{position:absolute;top:.4em;right:.2em;opacity:.6;font-size:14px;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.wpeo-button:hover .button-add{opacity:.8}.wpeo-button.button-square-40 .button-add{top:.1em;right:0}.wpeo-button .button-icon,.wpeo-button span{position:relative}.wpeo-button .button-icon~span{margin-left:10px}.wpeo-button span~.button-icon{margin-left:10px}.wpeo-button.button-strong span{font-weight:800}.wpeo-button.button-uppercase span{text-transform:uppercase;font-size:14px}.wpeo-button[class*=button-square-]{text-align:center;overflow:hidden;padding:0}.wpeo-button.button-square-30{width:30px;height:30px;line-height:24px}.wpeo-button.button-square-30 .button-icon{font-size:12px;line-height:24px}.wpeo-button.button-square-40{width:40px;height:40px;line-height:34px}.wpeo-button.button-square-40 .button-icon{line-height:34px}.wpeo-button.button-square-50{width:50px;height:50px;line-height:44px}.wpeo-button.button-square-50 .button-icon{line-height:44px}.wpeo-button.button-square-60{width:60px;height:60px;line-height:54px}.wpeo-button.button-square-60 .button-icon{line-height:54px}.wpeo-button.button-float-left{float:left}.wpeo-button.button-float-right{float:right}.wpeo-button.button-margin{margin:1em 0}.wpeo-button.button-radius-1{border-radius:2px}.wpeo-button.button-radius-2{border-radius:4px}.wpeo-button.button-radius-3{border-radius:6px}.wpeo-button.button-rounded{border-radius:50%}.wpeo-button.button-disable{background:#ececec !important;border-color:#ececec !important;color:rgba(0,0,0,.4) !important;pointer-events:none}.wpeo-button.button-disable:hover{-webkit-box-shadow:none !important;box-shadow:none !important}.wpeo-button.button-disable.button-event{pointer-events:all}.wpeo-button.button-size-small{font-size:14px}.wpeo-button.button-size-small.button-uppercase span{font-size:12px}.wpeo-button.button-size-large{font-size:18px}.wpeo-button.button-size-large.button-uppercase span{font-size:16px}.wpeo-modal{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1000;background:rgba(39,42,53,.9);opacity:0;pointer-events:none;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.wpeo-modal textarea{resize:none}.wpeo-modal.modal-active{opacity:1;pointer-events:auto;z-index:1002}.wpeo-modal.modal-active .modal-container{-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%)}.wpeo-modal.modal-active textarea{resize:both}.wpeo-modal.modal-active .modal-active{z-index:1003}.wpeo-modal.modal-active .modal-active .modal-active{z-index:1004}.wpeo-modal.modal-force-display .modal-close{display:none}.wpeo-modal .modal-container{position:absolute;-webkit-transition:all .2s ease-out;transition:all .2s ease-out;width:100%;max-width:860px;height:100%;max-height:560px;background:#fff;padding:1em 0;margin:auto;top:50%;left:50%;-webkit-transform:translate(-50%, -60%);transform:translate(-50%, -60%)}@media(max-width: 480px){.wpeo-modal .modal-container{padding:1em}}.wpeo-modal .modal-container .modal-header{height:10%;display:-webkit-box;display:-ms-flexbox;display:flex;padding:0 2em}.wpeo-modal .modal-container .modal-content{height:78%;padding:0 2em}.wpeo-modal .modal-container .modal-footer{height:12%;padding:0 2em}.wpeo-modal .modal-container .modal-header .modal-title,.wpeo-modal .modal-container .modal-header .modal-close{margin:auto 0}.wpeo-modal .modal-container .modal-header .modal-title{text-transform:uppercase;font-size:18px;white-space:normal}@media(max-width: 770px){.wpeo-modal .modal-container .modal-header .modal-title{font-size:16px}}@media(max-width: 480px){.wpeo-modal .modal-container .modal-header .modal-title{font-size:14px}}.wpeo-modal .modal-container .modal-header .modal-close{margin-left:auto;color:rgba(0,0,0,.3);padding:4px;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.wpeo-modal .modal-container .modal-header .modal-close:hover{cursor:pointer;color:#0d8aff}.wpeo-modal .modal-container .modal-content{overflow-y:auto;font-size:14px}@media(max-width: 480px){.wpeo-modal .modal-container .modal-content{font-size:12px}}.wpeo-modal .modal-container .modal-footer{text-align:right;padding-top:1em}.wpeo-modal .modal-container .modal-footer.left{text-align:left}.wpeo-modal .modal-container .modal-footer.center{text-align:center}.wpeo-loader{-webkit-transition:all .2s ease-out;transition:all .2s ease-out;pointer-events:none;opacity:.5;position:relative}.wpeo-loader .loader-spin{position:absolute;border:3px solid #a7a7a7;border-top:3px solid #002140;border-radius:50%;width:20px;height:20px;z-index:99;left:50%;top:50%;margin:0 !important;padding:0 !important;-webkit-animation:loader-spin 1s ease-out infinite;animation:loader-spin 1s ease-out infinite}@-webkit-keyframes loader-spin{0%{-webkit-transform:translate(-50%, -50%) rotate(0deg);transform:translate(-50%, -50%) rotate(0deg)}100%{-webkit-transform:translate(-50%, -50%) rotate(360deg);transform:translate(-50%, -50%) rotate(360deg)}}@keyframes loader-spin{0%{-webkit-transform:translate(-50%, -50%) rotate(0deg);transform:translate(-50%, -50%) rotate(0deg)}100%{-webkit-transform:translate(-50%, -50%) rotate(360deg);transform:translate(-50%, -50%) rotate(360deg)}}.wpeo-gridlayout{display:grid;grid-gap:1em 1em;grid-template-columns:repeat(4, 1fr)}.wpeo-gridlayout.grid-1{grid-template-columns:repeat(1, 1fr)}.wpeo-gridlayout.grid-1>.gridw-1{grid-column:auto/span 1}.wpeo-gridlayout.grid-2{grid-template-columns:repeat(2, 1fr)}.wpeo-gridlayout.grid-2>.gridw-1{grid-column:auto/span 1}.wpeo-gridlayout.grid-2>.gridw-2{grid-column:auto/span 2}@media(max-width: 770px){.wpeo-gridlayout.grid-2>.gridw-2{grid-column:auto/span 2}}.wpeo-gridlayout.grid-3{grid-template-columns:repeat(3, 1fr)}.wpeo-gridlayout.grid-3>.gridw-1{grid-column:auto/span 1}.wpeo-gridlayout.grid-3>.gridw-2{grid-column:auto/span 2}@media(max-width: 770px){.wpeo-gridlayout.grid-3>.gridw-2{grid-column:auto/span 2}}.wpeo-gridlayout.grid-3>.gridw-3{grid-column:auto/span 3}@media(max-width: 770px){.wpeo-gridlayout.grid-3>.gridw-3{grid-column:auto/span 2}}.wpeo-gridlayout.grid-4{grid-template-columns:repeat(4, 1fr)}.wpeo-gridlayout.grid-4>.gridw-1{grid-column:auto/span 1}.wpeo-gridlayout.grid-4>.gridw-2{grid-column:auto/span 2}@media(max-width: 770px){.wpeo-gridlayout.grid-4>.gridw-2{grid-column:auto/span 2}}.wpeo-gridlayout.grid-4>.gridw-3{grid-column:auto/span 3}@media(max-width: 770px){.wpeo-gridlayout.grid-4>.gridw-3{grid-column:auto/span 2}}.wpeo-gridlayout.grid-4>.gridw-4{grid-column:auto/span 4}@media(max-width: 770px){.wpeo-gridlayout.grid-4>.gridw-4{grid-column:auto/span 2}}.wpeo-gridlayout.grid-5{grid-template-columns:repeat(5, 1fr)}.wpeo-gridlayout.grid-5>.gridw-1{grid-column:auto/span 1}.wpeo-gridlayout.grid-5>.gridw-2{grid-column:auto/span 2}@media(max-width: 770px){.wpeo-gridlayout.grid-5>.gridw-2{grid-column:auto/span 2}}.wpeo-gridlayout.grid-5>.gridw-3{grid-column:auto/span 3}@media(max-width: 770px){.wpeo-gridlayout.grid-5>.gridw-3{grid-column:auto/span 2}}.wpeo-gridlayout.grid-5>.gridw-4{grid-column:auto/span 4}@media(max-width: 770px){.wpeo-gridlayout.grid-5>.gridw-4{grid-column:auto/span 2}}.wpeo-gridlayout.grid-5>.gridw-5{grid-column:auto/span 5}@media(max-width: 770px){.wpeo-gridlayout.grid-5>.gridw-5{grid-column:auto/span 2}}.wpeo-gridlayout.grid-6{grid-template-columns:repeat(6, 1fr)}.wpeo-gridlayout.grid-6>.gridw-1{grid-column:auto/span 1}.wpeo-gridlayout.grid-6>.gridw-2{grid-column:auto/span 2}@media(max-width: 770px){.wpeo-gridlayout.grid-6>.gridw-2{grid-column:auto/span 2}}.wpeo-gridlayout.grid-6>.gridw-3{grid-column:auto/span 3}@media(max-width: 770px){.wpeo-gridlayout.grid-6>.gridw-3{grid-column:auto/span 2}}.wpeo-gridlayout.grid-6>.gridw-4{grid-column:auto/span 4}@media(max-width: 770px){.wpeo-gridlayout.grid-6>.gridw-4{grid-column:auto/span 2}}.wpeo-gridlayout.grid-6>.gridw-5{grid-column:auto/span 5}@media(max-width: 770px){.wpeo-gridlayout.grid-6>.gridw-5{grid-column:auto/span 2}}.wpeo-gridlayout.grid-6>.gridw-6{grid-column:auto/span 6}@media(max-width: 770px){.wpeo-gridlayout.grid-6>.gridw-6{grid-column:auto/span 2}}.wpeo-gridlayout>.gridh-1{grid-row:auto/span 1}@media(max-width: 770px){.wpeo-gridlayout>.gridh-1{grid-row:auto/span 1 !important}}.wpeo-gridlayout>.gridh-2{grid-row:auto/span 2}@media(max-width: 770px){.wpeo-gridlayout>.gridh-2{grid-row:auto/span 1 !important}}.wpeo-gridlayout>.gridh-3{grid-row:auto/span 3}@media(max-width: 770px){.wpeo-gridlayout>.gridh-3{grid-row:auto/span 1 !important}}.wpeo-gridlayout>.gridh-4{grid-row:auto/span 4}@media(max-width: 770px){.wpeo-gridlayout>.gridh-4{grid-row:auto/span 1 !important}}.wpeo-gridlayout>.gridh-5{grid-row:auto/span 5}@media(max-width: 770px){.wpeo-gridlayout>.gridh-5{grid-row:auto/span 1 !important}}.wpeo-gridlayout>.gridh-6{grid-row:auto/span 6}@media(max-width: 770px){.wpeo-gridlayout>.gridh-6{grid-row:auto/span 1 !important}}.wpeo-gridlayout.grid-margin-0{margin:0em 0}.wpeo-gridlayout.grid-margin-1{margin:1em 0}.wpeo-gridlayout.grid-margin-2{margin:2em 0}.wpeo-gridlayout.grid-margin-3{margin:3em 0}.wpeo-gridlayout.grid-margin-4{margin:4em 0}.wpeo-gridlayout.grid-margin-5{margin:5em 0}.wpeo-gridlayout.grid-margin-6{margin:6em 0}.wpeo-gridlayout.grid-gap-0{grid-gap:0em 0em}.wpeo-gridlayout.grid-gap-1{grid-gap:1em 1em}.wpeo-gridlayout.grid-gap-2{grid-gap:2em 2em}.wpeo-gridlayout.grid-gap-3{grid-gap:3em 3em}.wpeo-gridlayout.grid-gap-4{grid-gap:4em 4em}.wpeo-gridlayout.grid-gap-5{grid-gap:5em 5em}.wpeo-gridlayout.grid-gap-6{grid-gap:6em 6em}.wpeo-gridlayout .grid-align-center{margin-left:auto;margin-right:auto}.wpeo-gridlayout .grid-align-right{margin-left:auto}.wpeo-gridlayout .grid-align-middle{margin-top:auto;margin-bottom:auto}.wpeo-gridlayout .grid-align-bottom{margin-top:auto}@media(max-width: 480px){.wpeo-gridlayout:not(.dropdown-content).grid-2{grid-template-columns:repeat(1, 1fr) !important}}@media(max-width: 770px){.wpeo-gridlayout:not(.dropdown-content).grid-3{grid-template-columns:repeat(2, 1fr) !important}}@media(max-width: 480px){.wpeo-gridlayout:not(.dropdown-content).grid-3{grid-template-columns:repeat(1, 1fr) !important}}@media(max-width: 770px){.wpeo-gridlayout:not(.dropdown-content).grid-4{grid-template-columns:repeat(2, 1fr) !important}}@media(max-width: 480px){.wpeo-gridlayout:not(.dropdown-content).grid-4{grid-template-columns:repeat(1, 1fr) !important}}@media(max-width: 770px){.wpeo-gridlayout:not(.dropdown-content).grid-5{grid-template-columns:repeat(2, 1fr) !important}}@media(max-width: 480px){.wpeo-gridlayout:not(.dropdown-content).grid-5{grid-template-columns:repeat(1, 1fr) !important}}@media(max-width: 770px){.wpeo-gridlayout:not(.dropdown-content).grid-6{grid-template-columns:repeat(2, 1fr) !important}}@media(max-width: 480px){.wpeo-gridlayout:not(.dropdown-content).grid-6{grid-template-columns:repeat(1, 1fr) !important}}@media(max-width: 480px){.wpeo-gridlayout:not(.dropdown-content)>*{grid-column:auto/span 1 !important}}.wpeo-table.table-flex{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;font-size:14px}.wpeo-table.table-flex .table-row{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.wpeo-table.table-flex .table-row:not(.table-header):nth-of-type(odd){background:rgba(0,0,0,.05)}.wpeo-table.table-flex .table-row.table-header{background:#263c5c}.wpeo-table.table-flex .table-row.table-header .table-cell{font-weight:700;color:#fff}.wpeo-table.table-flex .table-cell{margin:auto 0;width:100%;padding:.8em .6em}@media(max-width: 770px){.wpeo-table.table-flex .table-cell{padding:.4em}}.wpeo-table.table-flex.table-1 .table-cell{width:100%}.wpeo-table.table-flex.table-2 .table-cell{width:50%}.wpeo-table.table-flex.table-3 .table-cell{width:33.3333333333%}.wpeo-table.table-flex.table-4 .table-cell{width:25%}.wpeo-table.table-flex.table-5 .table-cell{width:20%}.wpeo-table.table-flex.table-6 .table-cell{width:16.6666666667%}.wpeo-table.table-flex.table-7 .table-cell{width:14.2857142857%}.wpeo-table.table-flex.table-8 .table-cell{width:12.5%}.wpeo-table.table-flex.table-9 .table-cell{width:11.1111111111%}.wpeo-table.table-flex.table-10 .table-cell{width:10%}.wpeo-table.table-flex .table-cell.table-25{max-width:25px;min-width:25px}.wpeo-table.table-flex .table-cell.table-50{max-width:50px;min-width:50px}.wpeo-table.table-flex .table-cell.table-75{max-width:75px;min-width:75px}.wpeo-table.table-flex .table-cell.table-100{max-width:100px;min-width:100px}.wpeo-table.table-flex .table-cell.table-125{max-width:125px;min-width:125px}.wpeo-table.table-flex .table-cell.table-150{max-width:150px;min-width:150px}.wpeo-table.table-flex .table-cell.table-175{max-width:175px;min-width:175px}.wpeo-table.table-flex .table-cell.table-200{max-width:200px;min-width:200px}.wpeo-table.table-flex .table-cell.table-225{max-width:225px;min-width:225px}.wpeo-table.table-flex .table-cell.table-250{max-width:250px;min-width:250px}.wpeo-table.table-flex .table-cell.table-275{max-width:275px;min-width:275px}.wpeo-table.table-flex .table-cell.table-300{max-width:300px;min-width:300px}.wpeo-table.table-flex .table-cell.table-325{max-width:325px;min-width:325px}.wpeo-table.table-flex .table-cell.table-350{max-width:350px;min-width:350px}.wpeo-table.table-flex .table-cell.table-375{max-width:375px;min-width:375px}.wpeo-table.table-flex .table-cell.table-400{max-width:400px;min-width:400px}.wpeo-table.table-flex .table-cell.table-425{max-width:425px;min-width:425px}.wpeo-table.table-flex .table-cell.table-450{max-width:450px;min-width:450px}.wpeo-table.table-flex .table-cell.table-475{max-width:475px;min-width:475px}.wpeo-table.table-flex .table-cell.table-500{max-width:500px;min-width:500px}.wpeo-table.table-flex .table-cell.table-full{width:100%}.wpeo-table.table-flex .table-cell.table-end{text-align:right;margin-left:auto}.wpeo-table.table-flex .table-cell.table-padding-0{padding:0}@media(max-width: 480px){.wpeo-table.table-flex .table-row{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.wpeo-table.table-flex .table-cell{width:100%}}.wpeo-tooltip{display:block;position:absolute;bottom:0;left:0;opacity:0;pointer-events:none;z-index:99999;white-space:nowrap;background:#2b2b2b;color:#fff;border-radius:6px;font-size:.8rem;padding:0 1em;height:2.2em;line-height:2.2em}.wpeo-tooltip::before{display:block;content:"";width:0;height:0;border-style:solid;position:absolute}.wpeo-tooltip:focus{outline:none}.wpeo-tooltip.tooltip-dark{background:#2b2b2b}.wpeo-tooltip.tooltip-dark.tooltip-top::before{border-color:#2b2b2b rgba(0,0,0,0) rgba(0,0,0,0) rgba(0,0,0,0)}.wpeo-tooltip.tooltip-dark.tooltip-right::before{border-color:rgba(0,0,0,0) #2b2b2b rgba(0,0,0,0) rgba(0,0,0,0)}.wpeo-tooltip.tooltip-dark.tooltip-bottom::before{border-color:rgba(0,0,0,0) rgba(0,0,0,0) #2b2b2b rgba(0,0,0,0)}.wpeo-tooltip.tooltip-dark.tooltip-left::before{border-color:rgba(0,0,0,0) rgba(0,0,0,0) rgba(0,0,0,0) #2b2b2b}.wpeo-tooltip.tooltip-primary{background:#0d8aff}.wpeo-tooltip.tooltip-primary.tooltip-top::before{border-color:#0d8aff rgba(0,0,0,0) rgba(0,0,0,0) rgba(0,0,0,0)}.wpeo-tooltip.tooltip-primary.tooltip-right::before{border-color:rgba(0,0,0,0) #0d8aff rgba(0,0,0,0) rgba(0,0,0,0)}.wpeo-tooltip.tooltip-primary.tooltip-bottom::before{border-color:rgba(0,0,0,0) rgba(0,0,0,0) #0d8aff rgba(0,0,0,0)}.wpeo-tooltip.tooltip-primary.tooltip-left::before{border-color:rgba(0,0,0,0) rgba(0,0,0,0) rgba(0,0,0,0) #0d8aff}.wpeo-tooltip.tooltip-light{background:#ececec;color:rgba(0,0,0,.6)}.wpeo-tooltip.tooltip-light.tooltip-top::before{border-color:#ececec rgba(0,0,0,0) rgba(0,0,0,0) rgba(0,0,0,0)}.wpeo-tooltip.tooltip-light.tooltip-right::before{border-color:rgba(0,0,0,0) #ececec rgba(0,0,0,0) rgba(0,0,0,0)}.wpeo-tooltip.tooltip-light.tooltip-bottom::before{border-color:rgba(0,0,0,0) rgba(0,0,0,0) #ececec rgba(0,0,0,0)}.wpeo-tooltip.tooltip-light.tooltip-left::before{border-color:rgba(0,0,0,0) rgba(0,0,0,0) rgba(0,0,0,0) #ececec}.wpeo-tooltip.tooltip-red{background:#e05353}.wpeo-tooltip.tooltip-red.tooltip-top::before{border-color:#e05353 rgba(0,0,0,0) rgba(0,0,0,0) rgba(0,0,0,0)}.wpeo-tooltip.tooltip-red.tooltip-right::before{border-color:rgba(0,0,0,0) #e05353 rgba(0,0,0,0) rgba(0,0,0,0)}.wpeo-tooltip.tooltip-red.tooltip-bottom::before{border-color:rgba(0,0,0,0) rgba(0,0,0,0) #e05353 rgba(0,0,0,0)}.wpeo-tooltip.tooltip-red.tooltip-left::before{border-color:rgba(0,0,0,0) rgba(0,0,0,0) rgba(0,0,0,0) #e05353}.wpeo-tooltip.tooltip-top::before{border-width:6px 6px 0 6px;border-color:#2b2b2b rgba(0,0,0,0) rgba(0,0,0,0) rgba(0,0,0,0);bottom:-6px;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.wpeo-tooltip.tooltip-right::before{border-width:6px 6px 6px 0;border-color:rgba(0,0,0,0) #2b2b2b rgba(0,0,0,0) rgba(0,0,0,0);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);left:-6px}.wpeo-tooltip.tooltip-bottom::before{border-width:0 6px 6px 6px;border-color:rgba(0,0,0,0) rgba(0,0,0,0) #2b2b2b rgba(0,0,0,0);top:-6px;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.wpeo-tooltip.tooltip-left::before{border-width:6px 0 6px 6px;border-color:rgba(0,0,0,0) rgba(0,0,0,0) rgba(0,0,0,0) #2b2b2b;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);right:-6px}.wpeo-notice{position:relative;font-size:1em;padding:1em;overflow:hidden;border-radius:3px;border:solid #eee 1px;margin:1em 0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-transition:all .2s ease-out;transition:all .2s ease-out;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.wpeo-notice::before{display:block;font-family:"Font Awesome 5 Free";font-weight:900;font-size:24px}.wpeo-notice .notice-content{width:100%;padding:0 1em;color:rgba(0,0,0,.6)}.wpeo-notice .notice-title{font-size:20px;font-weight:600;color:rgba(0,0,0,.9)}.wpeo-notice .notice-subtitle{font-size:14px}.wpeo-notice .notice-close{color:rgba(0,0,0,.3);-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.wpeo-notice .notice-close:hover{color:#0d8aff;cursor:pointer}.wpeo-notice ul{padding:0 0 0 1.4em;margin:.4em 0}.wpeo-notice.notice-info{border-left:solid #0d8aff 6px;color:#0d8aff;background:rgba(13,138,255,.05)}.wpeo-notice.notice-info::before{content:""}.wpeo-notice.notice-info .notice-title,.wpeo-notice.notice-info .notice-subtitle,.wpeo-notice.notice-info a{color:#0d8aff}.wpeo-notice.notice-error{border-left:solid #e05353 6px;color:#e05353;background:rgba(224,83,83,.05)}.wpeo-notice.notice-error::before{content:""}.wpeo-notice.notice-error .notice-title,.wpeo-notice.notice-error .notice-subtitle,.wpeo-notice.notice-error a{color:#e05353}.wpeo-notice.notice-warning{border-left:solid #e9ad4f 6px;color:#e9ad4f;background:rgba(233,173,79,.05)}.wpeo-notice.notice-warning::before{content:""}.wpeo-notice.notice-warning .notice-title,.wpeo-notice.notice-warning .notice-subtitle,.wpeo-notice.notice-warning a{color:#e9ad4f}.wpeo-notice.notice-success{border-left:solid #47e58e 6px;color:#47e58e;background:rgba(71,229,142,.05)}.wpeo-notice.notice-success::before{content:""}.wpeo-notice.notice-success .notice-title,.wpeo-notice.notice-success .notice-subtitle,.wpeo-notice.notice-success a{color:#47e58e}.tns-outer{position:relative}.tns-outer .tns-nav{text-align:center;position:absolute;width:100%;bottom:.5em;z-index:50}.tns-outer .tns-nav button{display:inline-block;margin:0 4px;padding:0;width:15px;height:15px;background:#fff;border-radius:50%;-webkit-box-shadow:0px 1px 6px 0px rgba(0,0,0,.2);box-shadow:0px 1px 6px 0px rgba(0,0,0,.2);-webkit-transition:all .2s ease-out;transition:all .2s ease-out;border:2px solid #fff}.tns-outer .tns-nav button:hover{-webkit-box-shadow:none;box-shadow:none}.tns-outer .tns-nav button.tns-nav-active{border:2px solid #0d8aff;-webkit-box-shadow:0px 0px 0px 2px #0d8aff;box-shadow:0px 0px 0px 2px #0d8aff}.tns-outer .tns-controls button[data-controls=prev],.tns-outer .tns-controls button[data-controls=next]{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);background:none;padding:0;border:0;z-index:60}.tns-outer .tns-controls button[data-controls=prev] .icon,.tns-outer .tns-controls button[data-controls=next] .icon{color:#3a3a3a;background:#fff;border-radius:50%;width:28px;height:28px;text-align:center;line-height:28px;opacity:.7;-webkit-transition:opacity .3s cubic-bezier(0.77, 0, 0.175, 1);transition:opacity .3s cubic-bezier(0.77, 0, 0.175, 1)}.tns-outer .tns-controls button[data-controls=prev]:hover,.tns-outer .tns-controls button[data-controls=next]:hover{-webkit-box-shadow:none;box-shadow:none}.tns-outer .tns-controls button[data-controls=prev]:hover .icon,.tns-outer .tns-controls button[data-controls=next]:hover .icon{opacity:1}.tns-outer .tns-controls button[data-controls=prev]:active .icon,.tns-outer .tns-controls button[data-controls=next]:active .icon{-webkit-transform:translateY(2px);transform:translateY(2px)}.tns-outer .tns-controls button[data-controls=prev][disabled] .icon,.tns-outer .tns-controls button[data-controls=next][disabled] .icon{opacity:.2}.tns-outer .tns-controls button[data-controls=prev][disabled]:active .icon,.tns-outer .tns-controls button[data-controls=next][disabled]:active .icon{-webkit-transform:none;transform:none}.tns-outer .tns-controls button[data-controls=prev]{left:15px}.tns-outer .tns-controls button[data-controls=next]{right:15px}.wpeo-form input,.wpeo-form textarea,.wpeo-form select{border:1px solid rgba(0,0,0,.2);font-size:14px;background:rgba(0,0,0,0);padding:0;margin:0;width:100%;padding:1em .5em;-webkit-box-shadow:none;box-shadow:none}.wpeo-form input:focus,.wpeo-form input:active,.wpeo-form textarea:focus,.wpeo-form textarea:active,.wpeo-form select:focus,.wpeo-form select:active{outline:none;-webkit-box-shadow:none;box-shadow:none}.wpeo-form select{padding:1em 0}.wpeo-form input[type=submit]{width:auto}.wpeo-form .group-date .mysql-date{display:none}.wpeo-form .wpeo-dropdown{display:block;width:100%}.wpeo-form .wpeo-dropdown .dropdown-toggle{width:100%;display:block;-webkit-transition:all .2s ease-out;transition:all .2s ease-out;border:0;font-size:14px;padding:1em 2em 1em 1em;margin:0}.wpeo-form .wpeo-dropdown .dropdown-toggle:hover{cursor:pointer}.wpeo-form .wpeo-dropdown .dropdown-toggle>.svg-inline--fa{position:absolute;right:1em;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.wpeo-form .form-element.disable .dropdown-toggle>.svg-inline--fa{display:none}.wpeo-form .wpeo-autocomplete{display:block;width:100%}.wpeo-form .wpeo-autocomplete .autocomplete-label{-webkit-box-shadow:none;box-shadow:none;padding:.74em 1em}.wpeo-form.form-light .wpeo-autocomplete .autocomplete-label{background:#fff}.wpeo-form.form-light .wpeo-autocomplete .autocomplete-label:hover{background:#ececec}.wpeo-form .form-element input[type=radio].form-field{display:inline-block;width:auto}.wpeo-form .form-element input[type=radio].form-field{-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:50%;width:16px;height:16px;padding:0;border:0;background:rgba(0,0,0,0) !important;border:1px solid rgba(0,0,0,.4);-webkit-transition:.2s all linear;transition:.2s all linear;outline:none;position:relative;top:2px}.wpeo-form .form-element input[type=radio].form-field::before{display:none !important;content:"" !important}.wpeo-form .form-element input[type=radio].form-field:hover{cursor:pointer;border:1px solid #0d8aff;-webkit-box-shadow:0 0 0 1px #0d8aff inset;box-shadow:0 0 0 1px #0d8aff inset;background:rgba(0,0,0,0) !important}.wpeo-form .form-element input[type=radio].form-field:checked{border:1px solid #0d8aff;-webkit-box-shadow:0 0 0 4px #0d8aff inset;box-shadow:0 0 0 4px #0d8aff inset}.wpeo-form .form-element input[type=radio].form-field+label{text-transform:none;font-weight:400;font-size:14px;display:inline-block;margin-right:1em}.wpeo-form .form-element input[type=radio].form-field+label:hover{cursor:pointer}.wpeo-form .form-element input[type=radio].form-field+label:active{outline:none}.wpeo-form .form-element input[type=checkbox].form-field{display:inline-block;width:auto}.wpeo-form .form-element input[type=checkbox].form-field{width:auto;visibility:hidden;display:none}.wpeo-form .form-element input[type=checkbox].form-field+label{text-transform:none;font-weight:400;font-size:14px;display:inline-block;margin-right:1em;position:relative}.wpeo-form .form-element input[type=checkbox].form-field+label:hover{cursor:pointer}.wpeo-form .form-element input[type=checkbox].form-field+label:active{outline:none}.wpeo-form .form-element input[type=checkbox].form-field+label::before{display:inline-block;content:"";width:14px;height:14px;background:rgba(0,0,0,0);-webkit-box-shadow:0 0 0 1px rgba(0,0,0,.4);box-shadow:0 0 0 1px rgba(0,0,0,.4);border:2px solid #fff;-webkit-transition:all .2s ease-out;transition:all .2s ease-out;margin-right:.6em}.wpeo-form .form-element input[type=checkbox].form-field:not(:checked)+label:hover::before{-webkit-box-shadow:0 0 0 2px #0d8aff;box-shadow:0 0 0 2px #0d8aff}.wpeo-form .form-element input[type=checkbox].form-field:checked+label::before{-webkit-box-shadow:0 0 0 2px #0d8aff;box-shadow:0 0 0 2px #0d8aff;background:#0d8aff}.wpeo-form .form-element{width:100%}.wpeo-form .form-element .form-label{display:block;font-size:14px;font-weight:600;margin:.6em 0;color:rgba(0,0,0,.9)}.wpeo-form .form-element .form-field-container{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-flow:row wrap;flex-flow:row wrap;-webkit-box-flex:0;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-wrap:nowrap;flex-wrap:nowrap}.wpeo-form .form-element .form-field-container:hover{-webkit-box-shadow:none;box-shadow:none}.wpeo-form .form-element .form-field{-webkit-transition:all .2s ease-out;transition:all .2s ease-out;border-radius:0}.wpeo-form .form-element .form-field:hover{-webkit-box-shadow:none;box-shadow:none}.wpeo-form .form-element .form-sublabel{font-size:12px;font-style:italic;color:rgba(0,0,0,.6)}.wpeo-form .form-element .form-field-inline{margin-right:.4em}.wpeo-form .form-element.form-align-vertical .form-field-container{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.wpeo-form .form-element.form-align-horizontal .form-field-container{-ms-flex-wrap:wrap;flex-wrap:wrap}.wpeo-form .form-element .form-field-container .form-field,.wpeo-form .form-element .form-field-container [class*=form-field-icon]{background:#ececec}.wpeo-form .form-element .form-field-container:hover .form-field,.wpeo-form .form-element .form-field-container:hover [class*=form-field-icon]{background:#dfdfdf}.wpeo-form .form-element [class*=form-field-label]{background:#dfdfdf}.wpeo-form.form-light .form-element .form-field-container .form-field,.wpeo-form.form-light .form-element .form-field-container [class*=form-field-icon]{background:#fff}.wpeo-form.form-light .form-element .form-field-container:hover .form-field,.wpeo-form.form-light .form-element .form-field-container:hover [class*=form-field-icon]{background:#ececec}.wpeo-form.form-light .form-element [class*=form-field-label]{background:#ececec}.wpeo-form .form-element [class*=form-field-icon]{padding:.8em 0 .8em .8em;color:rgba(0,0,0,.4);font-size:16px;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.wpeo-form .form-element [class*=form-field-icon] [class*=fa]{vertical-align:middle}.wpeo-form .form-element .form-field-icon-prev{padding:.8em 0 .8em .8em}.wpeo-form .form-element .form-field-icon-next{padding:.8em .8em .8em 0}.wpeo-form .form-element [class*=form-field-label]{padding:1.2em 1em;font-size:12px}.wpeo-form .form-element .form-field-label-prev{border-right:1px solid rgba(0,0,0,.1)}.wpeo-form .form-element .form-field-label-next{border-left:1px solid rgba(0,0,0,.1)}.wpeo-form .form-element.form-element-required .form-label::after{display:inline-block;content:"*";color:#e05353;padding:0 .4em}.wpeo-form .form-element.form-element-error .form-field-container{border:1px solid #e05353}.wpeo-form .form-element.form-element-disable .form-field-container{opacity:.6;pointer-events:none}.card{-webkit-box-shadow:0 4px 8px 0 rgba(0,0,0,.2);box-shadow:0 4px 8px 0 rgba(0,0,0,.2);-webkit-transition:.3s;transition:.3s}.card:hover{-webkit-box-shadow:0 8px 16px 0 rgba(0,0,0,.2);box-shadow:0 8px 16px 0 rgba(0,0,0,.2)}.card-container{display:-webkit-box;display:-ms-flexbox;display:flex;padding:2px 16px;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.page-ut-gp-list{margin-left:-30px;-webkit-box-sizing:border-box;box-sizing:border-box;display:block !important;width:100%}.page-ut-gp-list *{-webkit-box-sizing:border-box;box-sizing:border-box}.page-ut-gp-list .fiche{margin-right:0 !important}.page-ut-gp-list #id-right{padding-left:300px;width:calc(100% + 30px);display:block}.page-ut-gp-list .side-nav{position:absolute;height:100%;top:0;padding-top:50px;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:none;box-shadow:none}.page-ut-gp-list .side-nav .side-nav-responsive{display:none}.page-ut-gp-list .side-nav #id-left{width:300px;padding-top:0}.page-ut-gp-list .side-nav .digirisk-wrap{padding:0 !important}.page-ut-gp-list .side-nav .navigation-container{max-height:1000px;overflow-y:auto;height:90vh}.page-ut-gp-list .side-nav .add-container{position:absolute;right:0;bottom:5px;opacity:0;pointer-events:none;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.page-ut-gp-list .side-nav #id-left.active .add-container{opacity:1}.page-ut-gp-list .side-nav .society-header{padding-top:27px;position:relative;padding-left:10px;padding-right:10px}.page-ut-gp-list .side-nav .society-header .title{font-weight:700}.page-ut-gp-list .side-nav .society-header .linkElement{line-height:1;border-bottom:1px solid rgba(0,0,0,.2);padding-bottom:10px;display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}.page-ut-gp-list .side-nav .society-header:hover .add-container{opacity:1;pointer-events:all}.page-ut-gp-list .side-nav .toolbar{padding-left:10px;padding-right:10px}.page-ut-gp-list .side-nav .toolbar .toggle-plus,.page-ut-gp-list .side-nav .toolbar .toggle-minus{display:inline-block;padding:3px;-webkit-transition:all .2s ease-out;transition:all .2s ease-out;color:rgba(0,0,0,.6)}.page-ut-gp-list .side-nav .toolbar .toggle-plus:hover,.page-ut-gp-list .side-nav .toolbar .toggle-minus:hover{cursor:pointer;opacity:.6}.page-ut-gp-list .side-nav .workunit-list{padding-left:0}.page-ut-gp-list .side-nav .workunit-list ul,.page-ut-gp-list .side-nav .workunit-list li{list-style-type:none;margin:0}.page-ut-gp-list .side-nav .workunit-list>.unit:first-child>.unit-container:first-child>.title{border-top:1px solid rgba(0,0,0,.1)}.page-ut-gp-list .side-nav .workunit-list .unit-container{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative}.page-ut-gp-list .side-nav .workunit-list .unit-container:hover .add-container{opacity:1;pointer-events:all}.page-ut-gp-list .side-nav .workunit-list .unit-container .toggle-unit{color:rgba(0,0,0,.6);line-height:40px;font-size:18px;min-width:30px;width:30px;text-align:center;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.page-ut-gp-list .side-nav .workunit-list .unit-container .toggle-unit:hover{cursor:pointer}.page-ut-gp-list .side-nav .workunit-list .unit-container .toggle-unit .toggle-icon{line-height:40px}.page-ut-gp-list .side-nav .workunit-list .unit-container .spacer{position:relative;min-width:30px;width:30px}.page-ut-gp-list .side-nav .workunit-list .unit-container .spacer::before{display:block;position:absolute;content:"";height:1px;left:0;right:10px;top:20px;background:rgba(0,0,0,.3)}.page-ut-gp-list .side-nav .workunit-list .unit-container .photodigiriskdolibarr{display:block;width:40px;min-width:40px;height:40px;position:relative;background:#fff;text-align:center;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.page-ut-gp-list .side-nav .workunit-list .unit-container .divphotoref{max-width:50px;position:relative}.page-ut-gp-list .side-nav .workunit-list .unit-container .divphotoref .photo{-o-object-fit:cover;object-fit:cover;margin:0}.page-ut-gp-list .side-nav .workunit-list .unit-container .title{width:100%;padding-left:1em;display:-webkit-box;display:-ms-flexbox;display:flex;border-bottom:1px solid rgba(0,0,0,.1)}.page-ut-gp-list .side-nav .workunit-list .unit-container .title .linkElement{width:100%;padding-top:.5em;text-decoration:none}.page-ut-gp-list .side-nav .workunit-list .unit-container .title .linkElement:hover .name{color:#0d8aff}.page-ut-gp-list .side-nav .workunit-list .unit-container .title .title-container{margin:auto 0}.page-ut-gp-list .side-nav .workunit-list .unit-container .title .ref{font-size:10px;color:#fff;text-transform:uppercase;font-weight:600;display:inline-block;background:#263c5c;padding:.2em .4em}.page-ut-gp-list .side-nav .workunit-list .unit-container .title .name{font-size:14px;color:#000;display:block;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.page-ut-gp-list .side-nav .workunit-list .unit>.sub-list{padding:0 0 0 7px;display:none}.page-ut-gp-list .side-nav .workunit-list .unit>.sub-list>.unit:last-child::before{height:24px}.page-ut-gp-list .side-nav .workunit-list .unit>.sub-list .toggle-unit{position:relative}.page-ut-gp-list .side-nav .workunit-list .unit>.sub-list .toggle-unit::before{right:20px;display:block;position:absolute;content:"";height:1px;left:0;top:20px;background:rgba(0,0,0,.3)}.page-ut-gp-list .side-nav .workunit-list .unit>.sub-list .unit{position:relative;margin-left:.6em}.page-ut-gp-list .side-nav .workunit-list .unit>.sub-list .unit::before{display:block;position:absolute;content:"";width:1px;height:100%;left:0;top:0;background:rgba(0,0,0,.3)}.page-ut-gp-list .side-nav .workunit-list .unit.active>.unit-container .title{background:rgba(0,0,0,.1)}.page-ut-gp-list .side-nav .workunit-list .unit.active>.unit-container .title .name{font-weight:600}.page-ut-gp-list .side-nav .workunit-list .unit.type-workunit .unit-container .ref{background:#0d8aff}.page-ut-gp-list .side-nav .workunit-list .unit.toggled>.sub-list{display:block}.digirisk-signature-container{max-width:800px;background:#fff;-webkit-box-shadow:0 0 40px 0 rgba(0,0,0,.1);box-shadow:0 0 40px 0 rgba(0,0,0,.1);margin:1.5em auto 0 auto;padding:2em;-webkit-box-sizing:border-box;box-sizing:border-box}.digirisk-signature-container *{-webkit-box-sizing:border-box;box-sizing:border-box}.digirisk-signature-container .signature .signature-element .wpeo-button.modal-signature-open{display:none}.digirisk-signature-container .signature .signature-element img{width:100%;height:auto;border:1px solid rgba(0,0,0,.4) !important}.ticketpublicarea .ticket-parentCategory{width:100%;height:100%}.ticketpublicarea .ticket-parentCategory .wpeo-button{width:100%;height:100%;padding:12px 14px}.ticketpublicarea .ticket-parentCategory .wpeo-button:hover{-webkit-box-shadow:inset 0 -4.6em rgba(255,255,255,.25);box-shadow:inset 0 -4.6em rgba(255,255,255,.25)}.ticketpublicarea .ticket-parentCategory .wpeo-button.button-yellow{border-color:#e88740;background:#e88740}.ticketpublicarea .ticket-parentCategory .wpeo-button.button-blue{border-color:#009cc2;background:#009cc2}.ticketpublicarea .ticket-parentCategory .wpeo-button.button-red{border-color:#c44b2a;background:#c44b2a}.ticketpublicarea .ticket-parentCategory.active .wpeo-button{border-color:#000 !important}.ticketpublicarea .ticket-subCategory{border:1px solid rgba(0,0,0,.2);padding:1em;text-align:center;width:100%;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.ticketpublicarea .ticket-subCategory:hover{cursor:pointer;background:rgba(0,0,0,.1)}.ticketpublicarea .ticket-subCategory.active{-webkit-box-shadow:inset 0 0 0px 3px #0d8aff;box-shadow:inset 0 0 0px 3px #0d8aff}.ticketpublicarea .ticket-subCategory .button-label{display:block;margin-top:.5em}.ticketpublicarea .form-registre .wpeo-button{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.ticketpublicarea .form-registre .wpeo-button>*{margin-top:auto;margin-bottom:auto}.ticketpublicarea .form-registre .wpeo-button .button-label{margin-left:.5em}.ticketpublicarea .tableforinputfields{margin-top:1em}.ticketpublicarea .tableforinputfields input{display:block;clear:both;width:100%;max-width:none;margin-bottom:1em}@media(max-width: 480px){.ticketpublicarea .tableforinputfields .inline-block{display:block}}.ticketpublicarea .tableforinputfields .inline-block input{display:inline-block}.ticketpublicarea .tableforinputfields .inline-block #options_digiriskdolibarr_ticket_date{max-width:80px}.page-ut-gp-list .organization{position:absolute;height:100%;top:0;padding-top:50px;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:none;box-shadow:none}.page-ut-gp-list .organization .side-nav-responsive{display:none}.page-ut-gp-list .organization #id-left{width:300px;padding-top:0}.page-ut-gp-list .organization .digirisk-wrap{padding:0 !important}.page-ut-gp-list .organization .navigation-container{max-height:1000px;overflow-y:auto}.page-ut-gp-list .organization .add-container{position:absolute;right:0;bottom:5px;opacity:0;pointer-events:none;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.page-ut-gp-list .organization .society-header{padding-top:27px;position:relative;padding-left:10px;padding-right:10px}.page-ut-gp-list .organization .society-header .title{font-weight:700}.page-ut-gp-list .organization .society-header .linkElement{line-height:1;border-bottom:1px solid rgba(0,0,0,.2);padding-bottom:10px;display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}.page-ut-gp-list .organization .society-header:hover .add-container{opacity:1;pointer-events:all}.page-ut-gp-list .organization .toolbar{padding-left:10px;padding-right:10px}.page-ut-gp-list .organization .toolbar .toggle-plus,.page-ut-gp-list .organization .toolbar .toggle-minus{display:inline-block;padding:3px;-webkit-transition:all .2s ease-out;transition:all .2s ease-out;color:rgba(0,0,0,.6)}.page-ut-gp-list .organization .toolbar .toggle-plus:hover,.page-ut-gp-list .organization .toolbar .toggle-minus:hover{cursor:pointer;opacity:.6}.page-ut-gp-list .organization .workunit-list{padding-left:0}.page-ut-gp-list .organization .workunit-list ul,.page-ut-gp-list .organization .workunit-list li{list-style-type:none;margin:0}.page-ut-gp-list .organization .workunit-list .unit-container{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative}.page-ut-gp-list .organization .workunit-list .unit-container:hover .add-container{opacity:1;pointer-events:all}.page-ut-gp-list .organization .workunit-list .unit-container .toggle-unit{color:rgba(0,0,0,.6);line-height:40px;font-size:18px;min-width:30px;width:30px;text-align:center;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.page-ut-gp-list .organization .workunit-list .unit-container .toggle-unit:hover{cursor:pointer}.page-ut-gp-list .organization .workunit-list .unit-container .toggle-unit .toggle-icon{line-height:40px}.page-ut-gp-list .organization .workunit-list .unit-container .spacer{position:relative;min-width:30px;width:30px}.page-ut-gp-list .organization .workunit-list .unit-container .spacer::before{display:block;position:absolute;content:"";height:1px;left:0;right:10px;top:20px;background:rgba(0,0,0,.3)}.page-ut-gp-list .organization .workunit-list .unit-container .photodigiriskdolibarr{display:block;width:40px;min-width:40px;height:40px;position:relative;background:#fff;text-align:center;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.page-ut-gp-list .organization .workunit-list .unit-container .title{width:100%;padding-left:1em;display:-webkit-box;display:-ms-flexbox;display:flex}.page-ut-gp-list .organization .workunit-list .unit-container .title .title-container{margin:auto 0}.page-ut-gp-list .organization .workunit-list .unit-container .title .ref{font-size:10px;color:#fff;text-transform:uppercase;font-weight:600;display:inline-block;background:#263c5c;padding:.2em .4em}.page-ut-gp-list .organization .workunit-list .unit-container .title .name{font-size:14px;color:#000;display:block}.page-ut-gp-list .organization .workunit-list .unit>.unit-container{padding:4px 0 0 0;border:solid}.page-ut-gp-list .organization .workunit-list .unit>.sub-list{padding:0 0 0 7px;display:none}.page-ut-gp-list .organization .workunit-list .unit>.sub-list>.unit:last-child::before{height:24px}.page-ut-gp-list .organization .workunit-list .unit>.sub-list .toggle-unit{position:relative}.page-ut-gp-list .organization .workunit-list .unit>.sub-list .toggle-unit::before{right:20px;display:block;position:absolute;content:"";height:1px;left:0;top:20px;background:rgba(0,0,0,.3)}.page-ut-gp-list .organization .workunit-list .unit>.sub-list .unit{position:relative;margin-left:.6em}.page-ut-gp-list .organization .workunit-list .unit>.sub-list .unit::before{display:block;position:absolute;content:"";width:1px;height:100%;left:0;top:0;background:rgba(0,0,0,.3)}.page-ut-gp-list .organization .workunit-list .unit.active>.unit-container .title{background:rgba(0,0,0,.1)}.page-ut-gp-list .organization .workunit-list .unit.active>.unit-container .title .name{font-weight:600}.page-ut-gp-list .organization .workunit-list .unit.type-workunit .unit-container .ref{background:#0d8aff}.page-ut-gp-list .organization .workunit-list .unit.toggled>.sub-list{display:block}@media(max-width: 1200px){#id-container.page-ut-gp-list .organization{position:static;height:auto;padding:0 2em;background:none;border:0}#id-container.page-ut-gp-list .organization .side-nav-responsive{display:block;background:#263c5c;color:#fff;border-radius:6px;padding:.6em 1em;font-weight:600;font-size:14px;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}#id-container.page-ut-gp-list .organization .side-nav-responsive:hover{cursor:pointer;background:#446ba4}#id-container.page-ut-gp-list .organization #id-left{opacity:0;pointer-events:none;position:absolute;z-index:999;background:#efefef;border:1px solid rgba(0,0,0,.1);-webkit-box-shadow:0 0 40px 0 rgba(0,0,0,.1);box-shadow:0 0 40px 0 rgba(0,0,0,.1);-webkit-transition:all .2s ease-out;transition:all .2s ease-out;-webkit-transform:translateY(-10px);transform:translateY(-10px);max-height:500px;overflow-y:auto}#id-container.page-ut-gp-list .organization #id-left.active{opacity:1;pointer-events:auto;-webkit-transform:translateY(0px);transform:translateY(0px)}#id-container.page-ut-gp-list #id-right{padding-left:0}}.container{position:relative;min-height:500px}.container h3{position:absolute;border:0;margin:0;padding:20px 0;width:400px;pointer-events:none;margin-left:0px;width:100%}.route{position:relative;list-style-type:none;border:0;margin:0;padding:0;top:0px;margin-top:0px;max-height:100% !important;width:100%;background:#bcf;border-radius:2px;z-index:-1}.route span{position:absolute;top:26px;left:20px;-webkit-transform:scale(2);transform:scale(2);z-index:10;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.route span:hover{cursor:pointer;opacity:.6}.route .title{font-size:16px}.route .title .ref{position:static;top:auto;left:auto;-webkit-transform:none;transform:none;font-size:12px;border-radius:4px;padding:4px 6px;margin-right:.8em}.route .title.workunit{position:absolute;border:0;margin:0;padding:20px 0;width:400px;text-indent:60px;background:#ebebeb;border:1px solid rgba(0,0,0,.2);pointer-events:none}.route .title.workunit>.ref{background:#0d8aff;color:#fff}.route .title.groupment{position:absolute;border:0;margin:0;width:400px;text-indent:60px;background:#ebebeb;border:1px solid rgba(0,0,0,.2);pointer-events:none}.route .title.groupment>.ref{background:#263c5c;color:#fff}.first-title{margin-left:10px}.space{position:relative;list-style-type:none;border:0;margin:0;padding:0;margin-left:40px;width:30px;top:68px;padding-bottom:68px;height:100%;z-index:1}.space.space-0{margin-left:0}.table-cell-header{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;margin-bottom:.5em}.table-cell-header>*{margin:auto 0}.table-cell-header .wpeo-button{margin:0}.risk-container .risk-edit{color:#263c5c}.risk-container .risk-edit:hover{cursor:pointer;text-decoration:underline}.risk-container .risk-edit-no-perm{color:#333}.risk-container .risk-edit-no-perm:hover{cursor:auto;text-decoration:none}.risk-category{text-align:center}.risk-description{width:25% !important}.risksign-container .risksign-edit{color:#263c5c}.risksign-container .risksign-edit:hover{cursor:pointer;text-decoration:underline}.risksign-content{width:100%}.risksign-add{min-width:40px;margin-left:.5em}.riskassessment-tasks .riskassessment-task-container,.riskassessment-task-container{min-width:430px;border:1px solid rgba(0,0,0,.1);background:rgba(0,0,0,.05);padding:.5em}.riskassessment-tasks{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.riskassessment-tasks .riskassessment-task-container{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.riskassessment-tasks .riskassessment-task-add-wrapper{min-width:calc(40px + .5em);margin:auto 0;text-align:center}.riskassessment-task-listing-wrapper .riskassessment-task-container{margin-bottom:.5em}.riskassessment-task-single{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-sizing:border-box;box-sizing:border-box}.riskassessment-task-single *{-webkit-box-sizing:border-box;box-sizing:border-box}.riskassessment-task-single .riskassessment-task-actions{margin-left:auto}.riskassessment-task-single>*{margin-top:auto;margin-bottom:auto}.riskassessment-task-content .riskassessment-task-author,.riskassessment-task-content .riskassessment-task-timespent-list li .riskassessment-task-timespent-author,.riskassessment-task-timespent-list li .riskassessment-task-content .riskassessment-task-timespent-author{display:inline-block;width:25px;min-width:25px;height:25px;line-height:25px;background:rgba(0,0,0,.5);overflow:hidden;text-transform:uppercase;font-size:14px;font-weight:600;border-radius:50%;vertical-align:sub;text-align:center}.riskassessment-task-content .riskassessment-task-author a,.riskassessment-task-content .riskassessment-task-timespent-list li .riskassessment-task-timespent-author a,.riskassessment-task-timespent-list li .riskassessment-task-content .riskassessment-task-timespent-author a{color:#fff !important}.riskassessment-task-content .riskassessment-task-author-label{word-break:break-all}.riskassessment-task-content .riskassessment-task-data{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;font-size:14px}.riskassessment-task-content .riskassessment-task-data>*{margin:auto .2em}.riskassessment-task-content .riskassessment-task-data .riskassessment-task-reference{color:#263c5c;font-weight:600}.riskassessment-task-content .riskassessment-task-data .riskassessment-task-reference:hover{text-decoration:underline;cursor:pointer}.riskassessment-task-content .riskassessment-task-data .riskassessment-task-count{background:rgba(0,0,0,.2);font-size:12px;border-radius:4px;padding:.2em .4em}.riskassessment-task-content .riskassessment-task-data .riskassessment-task-progress{background:rgba(0,0,0,.2);font-size:12px;border-radius:4px;padding:.2em .4em;font-weight:700;color:rgba(0,0,0,.6)}.riskassessment-task-content .riskassessment-task-data .riskassessment-task-progress.progress-red{background:#e05353;color:#fff}.riskassessment-task-content .riskassessment-task-data .riskassessment-task-progress.progress-yellow{background:#e9ad4f;color:#fff}.riskassessment-task-content .riskassessment-task-data .riskassessment-task-progress.progress-green{background:#47e58e;color:#fff}.riskassessment-task-content .riskassessment-task-title{display:-webkit-box;display:-ms-flexbox;display:flex}.riskassessment-task-content .riskassessment-task-title .riskassessment-task-progress-checkbox{margin:auto 0}.riskassessment-task-content .riskassessment-task-title .riskassessment-task-progress-checkbox input{width:20px;height:20px}.riskassessment-task-content .riskassessment-task-add{min-width:40px;margin-left:.5em}.riskassessment-task-content .riskassessment-task-delete{margin-right:-0.5em}.riskassessment-task-listing-wrapper{width:100%}.riskassessment-task-add{margin:5px}.riskassessment-task-list{margin:5px}.riskassessment-task-timespent-add-container{display:-webkit-box;display:-ms-flexbox;display:flex;background:rgba(0,0,0,.1);padding:10px;margin-bottom:25px}.riskassessment-task-timespent-add-container>*{margin:auto 5px}.riskassessment-task-timespent-add-container .timespent-comment{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.riskassessment-task-timespent-add-container .timespent-date{min-width:250px}.riskassessment-task-timespent-add-container .timespent-duration{max-width:100px}.riskassessment-task-timespent-add-container .timespent-add-button{min-width:30px}.riskassessment-task-timespent-add-container .timespent-add-button .wpeo-button{margin-top:20px}.riskassessment-task-timespent-container .riskassessment-task .riskassessment-task-container{background:#fff;border:0}.riskassessment-task-timespent-container .riskassessment-task-timespent-comment{display:block}.riskassessment-task-timespent-list li:nth-of-type(even) .table-row{background:rgba(0,0,0,.05) !important}.riskassessment-task-timespent-list li:nth-of-type(odd) .table-row{background:#fff !important}td>.risk-evaluation-list-content .risk-evaluation-container:not(.advanced,.standard){min-width:340px;border:1px solid rgba(0,0,0,.1);background:rgba(0,0,0,.05);padding:.5em;margin-bottom:.5em}.risk-evaluation-container .risk-evaluation-single{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-sizing:border-box;box-sizing:border-box}.risk-evaluation-container .risk-evaluation-single *{-webkit-box-sizing:border-box;box-sizing:border-box}.risk-evaluation-container .risk-evaluation-single>*{margin-top:auto;margin-bottom:auto}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-cotation{width:40px;min-width:40px;height:40px;line-height:40px}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-photo{width:40px;min-width:40px;height:40px;line-height:40px;text-align:center;background:#ececec;color:rgba(0,0,0,.3);margin-right:.5em}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-photo .photodigiriskdolibarr{width:100%;height:auto;background:#fff}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-photo a,.risk-evaluation-container .risk-evaluation-single .risk-evaluation-photo .divphotoref{width:40px;min-width:40px;height:40px;position:relative;display:block}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-photo a .photo,.risk-evaluation-container .risk-evaluation-single .risk-evaluation-photo .divphotoref .photo{position:absolute;top:0;left:0;width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-content{width:100%}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-content .risk-evaluation-author{display:inline-block;width:25px;min-width:25px;height:25px;line-height:25px;background:rgba(0,0,0,.5);overflow:hidden;text-transform:uppercase;font-size:14px;font-weight:600;border-radius:50%;vertical-align:sub;text-align:center}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-content .risk-evaluation-author a{color:#fff !important}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-content .risk-evaluation-data{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-content .risk-evaluation-data>*{margin:auto .2em}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-content .risk-evaluation-data .risk-evaluation-reference{color:#333;font-weight:600}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-content .risk-evaluation-data .risk-evaluation-count{background:rgba(0,0,0,.2);font-size:12px;border-radius:4px;padding:.2em .4em}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-button{margin-left:.5em}.wpeo-table.evaluation-method{background:none !important}@media(max-width: 480px){.wpeo-table.evaluation-method .table-row.table-header{display:none}}.wpeo-table.evaluation-method .table-cell{margin:0;text-align:center;border:1px solid rgba(0,0,0,.1);padding:.8em .4em;position:relative}@media(max-width: 480px){.wpeo-table.evaluation-method .table-cell{width:100% !important}}.wpeo-table.evaluation-method .table-cell.can-select::after,.wpeo-table.evaluation-method .wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .table-cell.risk-evaluation-cotation::after,.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .wpeo-table.evaluation-method .table-cell.risk-evaluation-cotation::after{display:block;content:"";position:absolute;top:.4em;right:.4em;bottom:.4em;left:.4em;background:rgba(0,0,0,.1);-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.wpeo-table.evaluation-method .table-cell.can-select:hover,.wpeo-table.evaluation-method .wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .table-cell.risk-evaluation-cotation:hover,.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .wpeo-table.evaluation-method .table-cell.risk-evaluation-cotation:hover{cursor:pointer}.wpeo-table.evaluation-method .table-cell.can-select:hover::after,.wpeo-table.evaluation-method .wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .table-cell.risk-evaluation-cotation:hover::after,.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .wpeo-table.evaluation-method .table-cell.risk-evaluation-cotation:hover::after{-webkit-transform:scale(1);transform:scale(1);opacity:1}.wpeo-table.evaluation-method .table-cell.can-select.active,.wpeo-table.evaluation-method .wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .table-cell.active.risk-evaluation-cotation,.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .wpeo-table.evaluation-method .table-cell.active.risk-evaluation-cotation{color:#fff}.wpeo-table.evaluation-method .table-cell.can-select.active::after,.wpeo-table.evaluation-method .wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .table-cell.active.risk-evaluation-cotation::after,.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .wpeo-table.evaluation-method .table-cell.active.risk-evaluation-cotation::after{-webkit-transform:scale(1) !important;transform:scale(1) !important;opacity:1 !important;background:#0d8aff;z-index:-1}.wpeo-table.evaluation-method .table-row>.table-cell:first-child{background:#263c5c;color:#fff}@media(max-width: 480px){.wpeo-table.evaluation-method .table-row>.table-cell:first-child{background:#263c5c}}.wpeo-table.evaluation-method .table-row:not(.header) .table-cell:nth-of-type(2).active::after{background:#0d8aff}.wpeo-table.evaluation-method .table-row:not(.header) .table-cell:nth-of-type(3).active::after{background:#0063c0}.wpeo-table.evaluation-method .table-row:not(.header) .table-cell:nth-of-type(4).active::after{background:#003b73}.wpeo-table.evaluation-method .table-row:not(.header) .table-cell:nth-of-type(5).active::after{background:#001427}.wpeo-table.evaluation-method .table-row:not(.header) .table-cell:nth-of-type(6).active::after{background:#000}.wpeo-modal[class*=modal-risk] .modal-container .title{display:block;font-weight:600;font-size:13px;margin-bottom:.6em;color:rgba(0,0,0,.8)}.wpeo-modal[class*=modal-risk] .modal-container .title required{font-size:18px;color:#0d8aff;vertical-align:text-top;line-height:.9}.wpeo-modal[class*=modal-risk] .modal-container .section-title{font-size:16px;color:rgba(0,0,0,.8);font-weight:600;margin-bottom:.6em;display:block}.wpeo-modal[class*=modal-risk] .modal-container .maxwidthdate{max-width:125px}.wpeo-modal[class*=modal-risk] .modal-container .risk-content{display:-webkit-box;display:-ms-flexbox;display:flex;padding-bottom:1em;margin-bottom:1em;border-bottom:1px solid rgba(0,0,0,.2)}.wpeo-modal[class*=modal-risk] .modal-container .risk-content .risk-category{margin-right:1.5em}.wpeo-modal[class*=modal-risk] .modal-container .risk-content .risk-category .dropdown-toggle::after{display:none}.wpeo-modal[class*=modal-risk] .modal-container .risk-content .risk-description{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.wpeo-modal[class*=modal-risk] .modal-container .risk-content .risk-description textarea{width:100%}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container{padding-bottom:1em;margin-bottom:1em;border-bottom:1px solid rgba(0,0,0,.2)}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-header{margin-bottom:1em}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard{margin-right:1em}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .risk-evaluation-photo img{max-width:50px}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .risk-evaluation-comment{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;margin-left:1em}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .risk-evaluation-comment textarea{width:100%}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container.advanced .risk-evaluation-content-wrapper{-ms-flex-wrap:wrap;flex-wrap:wrap}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container.advanced .risk-evaluation-content{width:100%;margin-bottom:1em}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container.advanced .risk-evaluation-photo{margin-right:1em}.wpeo-modal .modal-container .risk-evaluations-list .risk-evaluation>.risk-evaluation-container{display:-webkit-box;display:-ms-flexbox;display:flex}.wpeo-modal .modal-container .risk-evaluations-list .risk-evaluation>.risk-evaluation-container .risk-evaluation-single{width:100%}.wpeo-modal .modal-container .risk-evaluations-list .risk-evaluation>.risk-evaluation-container .risk-evaluation-single .risk-evaluation-reference{color:#333}.wpeo-modal .modal-container .risk-evaluations-list .risk-evaluation>.risk-evaluation-container .risk-evaluation-actions{margin-left:auto}.wpeo-modal[class*=modal-risksign] .modal-container .title{display:block;font-weight:600;font-size:13px;margin-bottom:.6em;color:rgba(0,0,0,.8)}.wpeo-modal[class*=modal-risksign] .modal-container .title required{font-size:18px;color:#0d8aff;vertical-align:text-top;line-height:.9}.wpeo-modal[class*=modal-risksign] .modal-container .section-title{font-size:16px;color:rgba(0,0,0,.8);font-weight:600;margin-bottom:.6em;display:block}.wpeo-modal[class*=modal-risksign] .modal-container .risksign-content{display:-webkit-box;display:-ms-flexbox;display:flex;padding-bottom:1em;margin-bottom:1em;border-bottom:1px solid rgba(0,0,0,.2)}.wpeo-modal[class*=modal-risksign] .modal-container .risksign-content .risksign-category{margin-right:1.5em}.wpeo-modal[class*=modal-risksign] .modal-container .risksign-content .risksign-category .dropdown-toggle::after{display:none}.wpeo-modal[class*=modal-risksign] .modal-container .risksign-content .risksign-description{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.wpeo-modal[class*=modal-risksign] .modal-container .risksign-content .risksign-description textarea{width:100%}.wpeo-modal[class*=modal-riskassessment-task] .modal-container .title{display:block;font-weight:600;font-size:13px;margin-bottom:.6em;color:rgba(0,0,0,.8)}.wpeo-modal[class*=modal-riskassessment-task] .modal-container .title required{font-size:18px;color:#0d8aff;vertical-align:text-top;line-height:.9}.wpeo-modal[class*=modal-riskassessment-task] .modal-container .section-title{font-size:16px;color:rgba(0,0,0,.8);font-weight:600;margin-bottom:.6em;display:block}.wpeo-modal[class*=modal-riskassessment-task] .modal-container .riskassessment-task-single{display:block !important}.wpeo-modal[class*=modal-riskassessment-task] .modal-container .riskassessment-task-container{display:-webkit-box;display:-ms-flexbox;display:flex;padding-bottom:1em;margin-bottom:1em;border-bottom:1px solid rgba(0,0,0,.2)}.wpeo-modal[class*=modal-riskassessment-task] .modal-container .riskassessment-task-container .riskassessment-task{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.wpeo-modal[class*=modal-riskassessment-task] .modal-container .riskassessment-task-container .riskassessment-task input{width:100%}.wpeo-modal .modal-container .riskassessment-task-list .riskassessment-task>.riskassessment-task-container{display:-webkit-box;display:-ms-flexbox;display:flex}.wpeo-modal .modal-container .riskassessment-task-list .riskassessment-task>.riskassessment-task-container .riskassessment-task-single{width:100%}.wpeo-modal .modal-container .riskassessment-task-list .riskassessment-task>.riskassessment-task-container .riskassessment-task-actions{margin-left:auto}.riskassessment-task-edit-modal .wpeo-modal.modal-riskassessment-task.modal-active{z-index:1004}#dialog-confirm-actionButtonImportSharedRisks .confirmtext{text-align:center;padding:.2em 0 .4em 0}#dialog-confirm-actionButtonImportSharedRisks .tagtable{border-collapse:collapse}#dialog-confirm-actionButtonImportSharedRisks .tagtr{border-bottom:1px solid rgba(0,0,0,.2)}#dialog-confirm-actionButtonImportSharedRisks .tagtd{padding:.3em 0}#dialog-confirm-actionButtonImportSharedRisks .tagtr>.tagtd:first-child{display:-webkit-box;display:-ms-flexbox;display:flex}#dialog-confirm-actionButtonImportSharedRisks .tagtr>.tagtd:first-child .importsharedrisk:not(.imported):not(.risk-evaluation-cotation){width:30%}#dialog-confirm-actionButtonImportSharedRisks .tagtr>.tagtd:first-child .importsharedrisk.imported{width:10%;text-align:center;font-size:12px}#dialog-confirm-actionButtonImportSharedRisks .tagtr>.tagtd:first-child .importsharedrisk img{float:left;margin-right:.4em;max-width:35px}#dialog-confirm-actionButtonImportSharedRisks .tagtr>.tagtd:first-child .importsharedrisk>span{display:block}#dialog-confirm-actionButtonImportSharedRisks .tagtr>.tagtd:first-child .importsharedrisk .importsharedrisk-ref{font-weight:600}#dialog-confirm-actionButtonImportSharedRisks .tagtr>.tagtd:last-child{vertical-align:middle}#dialog-confirm-actionButtonImportSharedRiskSigns .confirmtext{text-align:center;padding:.2em 0 .4em 0}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtable{border-collapse:collapse}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtr{border-bottom:1px solid rgba(0,0,0,.2)}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtd{padding:.3em 0}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtr>.tagtd:first-child{display:-webkit-box;display:-ms-flexbox;display:flex}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtr>.tagtd:first-child .importsharedrisksign:not(.imported){width:30%}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtr>.tagtd:first-child .importsharedrisksign.imported{width:10%;text-align:center;font-size:12px}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtr>.tagtd:first-child .importsharedrisksign img{float:left;margin-right:.4em;max-width:35px}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtr>.tagtd:first-child .importsharedrisksign>span{display:block}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtr>.tagtd:first-child .importsharedrisksign .importsharedrisksign-ref{font-weight:600}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtr>.tagtd:last-child{vertical-align:middle}.wpeo-modal.modal-photo.modal-active{z-index:2014}.wpeo-modal.modal-photo .clickable-photo{border:5px solid #fff;-webkit-transition:all .2s ease-out;transition:all .2s ease-out;width:100%}.wpeo-modal.modal-photo .clickable-photo:hover{cursor:pointer}.wpeo-modal.modal-photo .clickable-photo:hover .photo-image .photo{opacity:.8}.wpeo-modal.modal-photo .clickable-photo .photo-image{position:relative;width:100%;max-width:120px;height:120px;margin:auto}.wpeo-modal.modal-photo .clickable-photo .photo-image .photo{position:absolute;top:0;left:0;width:100%;-o-object-fit:cover;object-fit:cover;max-width:none !important;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.wpeo-modal.modal-photo .clickable-photo .photo-image .clicked-photo-preview{position:absolute;display:inline-block;top:1em;right:1em;z-index:900;height:25px;line-height:25px;background:#fff;color:#0d8aff;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.wpeo-modal.modal-photo .clickable-photo .photo-image .clicked-photo-preview:hover{-webkit-transform:scale(1.1);transform:scale(1.1)}.wpeo-modal.modal-photo .clickable-photo .photo-image .clicked-photo-preview i{line-height:25px;font-size:14px}.wpeo-modal.modal-photo .clickable-photo .title{word-break:break-all}.wpeo-modal.modal-photo .formattachnewfile{padding-bottom:.5em}.wpeo-modal.modal-photo input[type=file]{border-bottom:0 !important}.evaluator-add-modal .time{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.risk-evaluation-add-modal .modal-container,.risk-evaluation-edit-modal .modal-container{max-height:750px}.risk-evaluation-edit-modal .wpeo-modal.modal-risk.modal-active{z-index:1004}.wpeo-modal .modal-container ul,.wpeo-modal .modal-container li{margin:0;list-style-type:none;padding:0}@media(max-width: 1200px){#id-container .side-nav .vmenu{width:30px;padding-right:0 !important;overflow:hidden}#id-container .side-nav .vmenu .menu_titre .vmenu i{margin-right:2em}#id-container .side-nav .vmenu #blockvmenusearch .select2-container--default .select2-selection--single .select2-selection__placeholder::before{display:inline-block;content:"";font-family:"Font Awesome 5 Free";font-weight:600;margin-right:2em}}@media(max-width: 1200px){#id-container.page-ut-gp-list .side-nav{position:static;height:auto;padding:0 2em;background:none;border:0}#id-container.page-ut-gp-list .side-nav .side-nav-responsive{display:block;background:#263c5c;color:#fff;border-radius:6px;padding:.6em 1em;font-weight:600;font-size:14px;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}#id-container.page-ut-gp-list .side-nav .side-nav-responsive:hover{cursor:pointer;background:#446ba4}#id-container.page-ut-gp-list .side-nav #id-left{position:absolute;z-index:999;background:#efefef;border:1px solid rgba(0,0,0,.1);-webkit-box-shadow:0 0 40px 0 rgba(0,0,0,.1);box-shadow:0 0 40px 0 rgba(0,0,0,.1);-webkit-transition:all .2s ease-out;transition:all .2s ease-out;max-height:500px;overflow-y:auto}#id-container.page-ut-gp-list .side-nav #id-left:not(.active){opacity:0;pointer-events:none;-webkit-transform:translateY(-10px);transform:translateY(-10px)}#id-container.page-ut-gp-list .side-nav #id-left:not(.active) .wpeo-button{pointer-events:none}#id-container.page-ut-gp-list #id-right{padding-left:0}}@media(max-width: 1200px){td>.riskassessment-task-container{min-width:0}}@media(max-width: 1200px){td>.risk-evaluation-container{min-width:0}}.ui-dialog.ui-corner-all.ui-widget.ui-widget-content.ui-front.ui-draggable.ui-resizable.preview-photo{z-index:2100 !important}.imgTabTitle{max-height:32px !important}.dropdown-toggle::after{display:none}.favorite-photo{border:5px solid #0d8aff}.box-flex-item{width:auto !important}ul{list-style-type:none}tr.liste_titre th.liste_titre:not(.maxwidthsearch),tr.liste_titre td.liste_titre:not(.maxwidthsearch){opacity:1}@media only screen and (max-width: 1600px){div.fichecenter{width:100%;clear:both}div.fichecenterbis{margin-top:8px}div.fichethirdleft{float:none;width:auto;padding-bottom:6px}div.fichetwothirdright{float:none;width:auto;padding-bottom:6px}div.fichehalfleft{float:none;width:auto}div.fichehalfright{float:none;width:auto}div.fichehalfright{margin-top:10px}div.firstcolumn div.box{padding-right:0px}div.secondcolumn div.box{padding-left:0px}} \ No newline at end of file +.risk-evaluation-cotation{width:50px;min-width:50px;height:50px;line-height:50px;text-align:center;border-radius:6px;background:#ececec;color:rgba(0,0,0,.8);font-size:16px;font-weight:600;margin-right:.5em}.risk-evaluation-cotation[data-scale="1"]{background:#ececec}.risk-evaluation-cotation[data-scale="2"]{background:#e9ad4f;color:#fff}.risk-evaluation-cotation[data-scale="3"]{background:#e05353;color:#fff}.risk-evaluation-cotation[data-scale="4"]{background:#2b2b2b;color:#fff}.risk-evaluation-cotation.selected-cotation{box-shadow:0 0 0 2px #0d8aff}.can-select,.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .risk-evaluation-cotation{transition:all .2s ease-out}.can-select:hover,.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .risk-evaluation-cotation:hover{cursor:pointer;opacity:.8}.wpeo-modal .title{display:block;font-weight:600;font-size:13px;margin-bottom:.6em;color:rgba(0,0,0,.8)}.wpeo-modal input[type=text],.wpeo-modal input[type=email],.wpeo-modal input[type=url],.wpeo-modal input[type=password],.wpeo-modal input[type=search],.wpeo-modal input[type=number],.wpeo-modal input[type=tel],.wpeo-modal input[type=range],.wpeo-modal input[type=date],.wpeo-modal input[type=month],.wpeo-modal input[type=week],.wpeo-modal input[type=time],.wpeo-modal input[type=datetime],.wpeo-modal input[type=datetime-local],.wpeo-modal input[type=color],.wpeo-modal select,.wpeo-modal textarea{width:100%;border:1px solid rgba(0,0,0,.2);padding:1em;box-sizing:border-box}.wpeo-modal input[type=text]:focus,.wpeo-modal input[type=email]:focus,.wpeo-modal input[type=url]:focus,.wpeo-modal input[type=password]:focus,.wpeo-modal input[type=search]:focus,.wpeo-modal input[type=number]:focus,.wpeo-modal input[type=tel]:focus,.wpeo-modal input[type=range]:focus,.wpeo-modal input[type=date]:focus,.wpeo-modal input[type=month]:focus,.wpeo-modal input[type=week]:focus,.wpeo-modal input[type=time]:focus,.wpeo-modal input[type=datetime]:focus,.wpeo-modal input[type=datetime-local]:focus,.wpeo-modal input[type=color]:focus,.wpeo-modal select:focus,.wpeo-modal textarea:focus{border:1px solid rgba(0,0,0,.6)}.wpeo-modal select{padding:1em 0}.form-label-required::after{display:inline-block;content:"*";color:#e05353;font-size:22px;line-height:0;position:relative;top:4px;left:4px}.digirisk-page-container{max-width:1000px;background:#fff;box-shadow:0 0 40px 0 rgba(0,0,0,.1);margin:1.5em auto 0 auto;padding:2em;box-sizing:border-box}.digirisk-page-container *{box-sizing:border-box}.card{box-shadow:0 4px 8px 0 rgba(0,0,0,.2);transition:.3s}.card:hover{box-shadow:0 8px 16px 0 rgba(0,0,0,.2)}.card-container{display:flex;padding:2px 16px;justify-content:center}.page-ut-gp-list{margin-left:-30px;box-sizing:border-box;display:block !important;width:100%}.page-ut-gp-list *{box-sizing:border-box}.page-ut-gp-list .fiche{margin-right:0 !important}.page-ut-gp-list #id-right{padding-left:300px;width:calc(100% + 30px);display:block}.page-ut-gp-list .side-nav{position:absolute;height:100%;top:0;padding-top:50px;box-sizing:border-box;box-shadow:none}.page-ut-gp-list .side-nav .side-nav-responsive{display:none}.page-ut-gp-list .side-nav #id-left{width:300px;padding-top:0}.page-ut-gp-list .side-nav .digirisk-wrap{padding:0 !important}.page-ut-gp-list .side-nav .navigation-container{max-height:1000px;overflow-y:auto;height:90vh}.page-ut-gp-list .side-nav .add-container{position:absolute;right:0;bottom:5px;opacity:0;pointer-events:none;transition:all .2s ease-out}.page-ut-gp-list .side-nav #id-left.active .add-container{opacity:1}.page-ut-gp-list .side-nav .society-header{padding-top:27px;position:relative;padding-left:10px;padding-right:10px}.page-ut-gp-list .side-nav .society-header .title{font-weight:700}.page-ut-gp-list .side-nav .society-header .linkElement{line-height:1;border-bottom:1px solid rgba(0,0,0,.2);padding-bottom:10px;display:flex;width:100%}.page-ut-gp-list .side-nav .society-header:hover .add-container{opacity:1;pointer-events:all}.page-ut-gp-list .side-nav .toolbar{padding-left:10px;padding-right:10px}.page-ut-gp-list .side-nav .toolbar .toggle-plus,.page-ut-gp-list .side-nav .toolbar .toggle-minus{display:inline-block;padding:3px;transition:all .2s ease-out;color:rgba(0,0,0,.6)}.page-ut-gp-list .side-nav .toolbar .toggle-plus:hover,.page-ut-gp-list .side-nav .toolbar .toggle-minus:hover{cursor:pointer;opacity:.6}.page-ut-gp-list .side-nav .workunit-list{padding-left:0}.page-ut-gp-list .side-nav .workunit-list ul,.page-ut-gp-list .side-nav .workunit-list li{list-style-type:none;margin:0}.page-ut-gp-list .side-nav .workunit-list>.unit:first-child>.unit-container:first-child>.title{border-top:1px solid rgba(0,0,0,.1)}.page-ut-gp-list .side-nav .workunit-list .unit-container{display:flex;position:relative}.page-ut-gp-list .side-nav .workunit-list .unit-container:hover .add-container{opacity:1;pointer-events:all}.page-ut-gp-list .side-nav .workunit-list .unit-container .toggle-unit{color:rgba(0,0,0,.6);line-height:40px;font-size:18px;min-width:30px;width:30px;text-align:center;transition:all .2s ease-out}.page-ut-gp-list .side-nav .workunit-list .unit-container .toggle-unit:hover{cursor:pointer}.page-ut-gp-list .side-nav .workunit-list .unit-container .toggle-unit .toggle-icon{line-height:40px}.page-ut-gp-list .side-nav .workunit-list .unit-container .spacer{position:relative;min-width:30px;width:30px}.page-ut-gp-list .side-nav .workunit-list .unit-container .spacer::before{display:block;position:absolute;content:"";height:1px;left:0;right:10px;top:20px;background:rgba(0,0,0,.3)}.page-ut-gp-list .side-nav .workunit-list .unit-container .photodigiriskdolibarr{display:block;width:40px;min-width:40px;height:40px;position:relative;background:#fff;text-align:center;transition:all .2s ease-out}.page-ut-gp-list .side-nav .workunit-list .unit-container .divphotoref{max-width:50px;position:relative}.page-ut-gp-list .side-nav .workunit-list .unit-container .divphotoref .photo{object-fit:cover;margin:0}.page-ut-gp-list .side-nav .workunit-list .unit-container .title{width:100%;padding-left:1em;display:flex;border-bottom:1px solid rgba(0,0,0,.1)}.page-ut-gp-list .side-nav .workunit-list .unit-container .title .linkElement{width:100%;padding-top:.5em;text-decoration:none}.page-ut-gp-list .side-nav .workunit-list .unit-container .title .linkElement:hover .name{color:#0d8aff}.page-ut-gp-list .side-nav .workunit-list .unit-container .title .title-container{margin:auto 0}.page-ut-gp-list .side-nav .workunit-list .unit-container .title .ref{font-size:10px;color:#fff;text-transform:uppercase;font-weight:600;display:inline-block;background:#263c5c;padding:.2em .4em}.page-ut-gp-list .side-nav .workunit-list .unit-container .title .name{font-size:14px;color:#000;display:block;transition:all .2s ease-out}.page-ut-gp-list .side-nav .workunit-list .unit>.sub-list{padding:0 0 0 7px;display:none}.page-ut-gp-list .side-nav .workunit-list .unit>.sub-list>.unit:last-child::before{height:24px}.page-ut-gp-list .side-nav .workunit-list .unit>.sub-list .toggle-unit{position:relative}.page-ut-gp-list .side-nav .workunit-list .unit>.sub-list .toggle-unit::before{right:20px;display:block;position:absolute;content:"";height:1px;left:0;top:20px;background:rgba(0,0,0,.3)}.page-ut-gp-list .side-nav .workunit-list .unit>.sub-list .unit{position:relative;margin-left:.6em}.page-ut-gp-list .side-nav .workunit-list .unit>.sub-list .unit::before{display:block;position:absolute;content:"";width:1px;height:100%;left:0;top:0;background:rgba(0,0,0,.3)}.page-ut-gp-list .side-nav .workunit-list .unit.active>.unit-container .title{background:rgba(0,0,0,.1)}.page-ut-gp-list .side-nav .workunit-list .unit.active>.unit-container .title .name{font-weight:600}.page-ut-gp-list .side-nav .workunit-list .unit.type-workunit .unit-container .ref{background:#0d8aff}.page-ut-gp-list .side-nav .workunit-list .unit.toggled>.sub-list{display:block}.digirisk-signature-container{max-width:800px;background:#fff;box-shadow:0 0 40px 0 rgba(0,0,0,.1);margin:1.5em auto 0 auto;padding:2em;box-sizing:border-box}.digirisk-signature-container *{box-sizing:border-box}.digirisk-signature-container .signature .signature-element .wpeo-button.modal-signature-open{display:none}.digirisk-signature-container .signature .signature-element img{width:100%;height:auto;border:1px solid rgba(0,0,0,.4) !important}.ticketpublicarea .ticket-parentCategory{width:100%;height:100%}.ticketpublicarea .ticket-parentCategory .wpeo-button{width:100%;height:100%;padding:12px 14px}.ticketpublicarea .ticket-parentCategory .wpeo-button:hover{box-shadow:inset 0 -4.6em rgba(255,255,255,.25)}.ticketpublicarea .ticket-parentCategory .wpeo-button.button-yellow{border-color:#e88740;background:#e88740}.ticketpublicarea .ticket-parentCategory .wpeo-button.button-blue{border-color:#009cc2;background:#009cc2}.ticketpublicarea .ticket-parentCategory .wpeo-button.button-red{border-color:#c44b2a;background:#c44b2a}.ticketpublicarea .ticket-parentCategory.active .wpeo-button{border-color:#000 !important}.ticketpublicarea .ticket-subCategory{border:1px solid rgba(0,0,0,.2);padding:1em;text-align:center;width:100%;transition:all .2s ease-out}.ticketpublicarea .ticket-subCategory:hover{cursor:pointer;background:rgba(0,0,0,.1)}.ticketpublicarea .ticket-subCategory.active{box-shadow:inset 0 0 0px 3px #0d8aff}.ticketpublicarea .ticket-subCategory .button-label{display:block;margin-top:.5em}.ticketpublicarea .form-registre .wpeo-button{display:flex;justify-content:center}.ticketpublicarea .form-registre .wpeo-button>*{margin-top:auto;margin-bottom:auto}.ticketpublicarea .form-registre .wpeo-button .button-label{margin-left:.5em}.ticketpublicarea .tableforinputfields{margin-top:1em}.ticketpublicarea .tableforinputfields input{display:block;clear:both;width:100%;max-width:none;margin-bottom:1em}@media(max-width: 480px){.ticketpublicarea .tableforinputfields .inline-block{display:block}}.ticketpublicarea .tableforinputfields .inline-block input{display:inline-block}.ticketpublicarea .tableforinputfields .inline-block #options_digiriskdolibarr_ticket_date{max-width:80px}.page-ut-gp-list .organization{position:absolute;height:100%;top:0;padding-top:50px;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:none;box-shadow:none}.page-ut-gp-list .organization .side-nav-responsive{display:none}.page-ut-gp-list .organization #id-left{width:300px;padding-top:0}.page-ut-gp-list .organization .digirisk-wrap{padding:0 !important}.page-ut-gp-list .organization .navigation-container{max-height:1000px;overflow-y:auto}.page-ut-gp-list .organization .add-container{position:absolute;right:0;bottom:5px;opacity:0;pointer-events:none;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.page-ut-gp-list .organization .society-header{padding-top:27px;position:relative;padding-left:10px;padding-right:10px}.page-ut-gp-list .organization .society-header .title{font-weight:700}.page-ut-gp-list .organization .society-header .linkElement{line-height:1;border-bottom:1px solid rgba(0,0,0,.2);padding-bottom:10px;display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}.page-ut-gp-list .organization .society-header:hover .add-container{opacity:1;pointer-events:all}.page-ut-gp-list .organization .toolbar{padding-left:10px;padding-right:10px}.page-ut-gp-list .organization .toolbar .toggle-plus,.page-ut-gp-list .organization .toolbar .toggle-minus{display:inline-block;padding:3px;-webkit-transition:all .2s ease-out;transition:all .2s ease-out;color:rgba(0,0,0,.6)}.page-ut-gp-list .organization .toolbar .toggle-plus:hover,.page-ut-gp-list .organization .toolbar .toggle-minus:hover{cursor:pointer;opacity:.6}.page-ut-gp-list .organization .workunit-list{padding-left:0}.page-ut-gp-list .organization .workunit-list ul,.page-ut-gp-list .organization .workunit-list li{list-style-type:none;margin:0}.page-ut-gp-list .organization .workunit-list .unit-container{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative}.page-ut-gp-list .organization .workunit-list .unit-container:hover .add-container{opacity:1;pointer-events:all}.page-ut-gp-list .organization .workunit-list .unit-container .toggle-unit{color:rgba(0,0,0,.6);line-height:40px;font-size:18px;min-width:30px;width:30px;text-align:center;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.page-ut-gp-list .organization .workunit-list .unit-container .toggle-unit:hover{cursor:pointer}.page-ut-gp-list .organization .workunit-list .unit-container .toggle-unit .toggle-icon{line-height:40px}.page-ut-gp-list .organization .workunit-list .unit-container .spacer{position:relative;min-width:30px;width:30px}.page-ut-gp-list .organization .workunit-list .unit-container .spacer::before{display:block;position:absolute;content:"";height:1px;left:0;right:10px;top:20px;background:rgba(0,0,0,.3)}.page-ut-gp-list .organization .workunit-list .unit-container .photodigiriskdolibarr{display:block;width:40px;min-width:40px;height:40px;position:relative;background:#fff;text-align:center;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}.page-ut-gp-list .organization .workunit-list .unit-container .title{width:100%;padding-left:1em;display:-webkit-box;display:-ms-flexbox;display:flex}.page-ut-gp-list .organization .workunit-list .unit-container .title .title-container{margin:auto 0}.page-ut-gp-list .organization .workunit-list .unit-container .title .ref{font-size:10px;color:#fff;text-transform:uppercase;font-weight:600;display:inline-block;background:#263c5c;padding:.2em .4em}.page-ut-gp-list .organization .workunit-list .unit-container .title .name{font-size:14px;color:#000;display:block}.page-ut-gp-list .organization .workunit-list .unit>.unit-container{padding:4px 0 0 0;border:solid}.page-ut-gp-list .organization .workunit-list .unit>.sub-list{padding:0 0 0 7px;display:none}.page-ut-gp-list .organization .workunit-list .unit>.sub-list>.unit:last-child::before{height:24px}.page-ut-gp-list .organization .workunit-list .unit>.sub-list .toggle-unit{position:relative}.page-ut-gp-list .organization .workunit-list .unit>.sub-list .toggle-unit::before{right:20px;display:block;position:absolute;content:"";height:1px;left:0;top:20px;background:rgba(0,0,0,.3)}.page-ut-gp-list .organization .workunit-list .unit>.sub-list .unit{position:relative;margin-left:.6em}.page-ut-gp-list .organization .workunit-list .unit>.sub-list .unit::before{display:block;position:absolute;content:"";width:1px;height:100%;left:0;top:0;background:rgba(0,0,0,.3)}.page-ut-gp-list .organization .workunit-list .unit.active>.unit-container .title{background:rgba(0,0,0,.1)}.page-ut-gp-list .organization .workunit-list .unit.active>.unit-container .title .name{font-weight:600}.page-ut-gp-list .organization .workunit-list .unit.type-workunit .unit-container .ref{background:#0d8aff}.page-ut-gp-list .organization .workunit-list .unit.toggled>.sub-list{display:block}@media(max-width: 1200px){#id-container.page-ut-gp-list .organization{position:static;height:auto;padding:0 2em;background:none;border:0}#id-container.page-ut-gp-list .organization .side-nav-responsive{display:block;background:#263c5c;color:#fff;border-radius:6px;padding:.6em 1em;font-weight:600;font-size:14px;-webkit-transition:all .2s ease-out;transition:all .2s ease-out}#id-container.page-ut-gp-list .organization .side-nav-responsive:hover{cursor:pointer;background:#446ba4}#id-container.page-ut-gp-list .organization #id-left{opacity:0;pointer-events:none;position:absolute;z-index:999;background:#efefef;border:1px solid rgba(0,0,0,.1);-webkit-box-shadow:0 0 40px 0 rgba(0,0,0,.1);box-shadow:0 0 40px 0 rgba(0,0,0,.1);-webkit-transition:all .2s ease-out;transition:all .2s ease-out;-webkit-transform:translateY(-10px);transform:translateY(-10px);max-height:500px;overflow-y:auto}#id-container.page-ut-gp-list .organization #id-left.active{opacity:1;pointer-events:auto;-webkit-transform:translateY(0px);transform:translateY(0px)}#id-container.page-ut-gp-list #id-right{padding-left:0}}.container{position:relative;min-height:500px}.container h3{position:absolute;border:0;margin:0;padding:20px 0;width:400px;pointer-events:none;margin-left:0px;width:100%}.route{position:relative;list-style-type:none;border:0;margin:0;padding:0;top:0px;margin-top:0px;max-height:100% !important;width:100%;background:#bcf;border-radius:2px;z-index:-1}.route span{position:absolute;top:26px;left:20px;transform:scale(2);z-index:10;transition:all .2s ease-out}.route span:hover{cursor:pointer;opacity:.6}.route .title{font-size:16px}.route .title .ref{position:static;top:auto;left:auto;transform:none;font-size:12px;border-radius:4px;padding:4px 6px;margin-right:.8em}.route .title.workunit{position:absolute;border:0;margin:0;padding:20px 0;width:400px;text-indent:60px;background:#ebebeb;border:1px solid rgba(0,0,0,.2);pointer-events:none}.route .title.workunit>.ref{background:#0d8aff;color:#fff}.route .title.groupment{position:absolute;border:0;margin:0;width:400px;text-indent:60px;background:#ebebeb;border:1px solid rgba(0,0,0,.2);pointer-events:none}.route .title.groupment>.ref{background:#263c5c;color:#fff}.first-title{margin-left:10px}.space{position:relative;list-style-type:none;border:0;margin:0;padding:0;margin-left:40px;width:30px;top:68px;padding-bottom:68px;height:100%;z-index:1}.space.space-0{margin-left:0}.table-cell-header{display:flex;flex-wrap:wrap;justify-content:space-between;margin-bottom:.5em}.table-cell-header>*{margin:auto 0}.table-cell-header .wpeo-button{margin:0}.risk-container .risk-edit{color:#263c5c}.risk-container .risk-edit:hover{cursor:pointer;text-decoration:underline}.risk-container .risk-edit-no-perm{color:#333}.risk-container .risk-edit-no-perm:hover{cursor:auto;text-decoration:none}.risk-category{text-align:center}.risk-description{width:25% !important}.risksign-container .risksign-edit{color:#263c5c}.risksign-container .risksign-edit:hover{cursor:pointer;text-decoration:underline}.risksign-content{width:100%}.risksign-add{min-width:40px;margin-left:.5em}.riskassessment-tasks .riskassessment-task-container,.riskassessment-task-container{min-width:430px;border:1px solid rgba(0,0,0,.1);background:rgba(0,0,0,.05);padding:.5em}.riskassessment-tasks{display:flex;flex-wrap:nowrap;align-items:center}.riskassessment-tasks .riskassessment-task-container{flex-grow:1}.riskassessment-tasks .riskassessment-task-add-wrapper{min-width:calc(40px + .5em);margin:auto 0;text-align:center}.riskassessment-task-listing-wrapper .riskassessment-task-container{margin-bottom:.5em}.riskassessment-task-single{display:flex;box-sizing:border-box}.riskassessment-task-single *{box-sizing:border-box}.riskassessment-task-single .riskassessment-task-actions{margin-left:auto}.riskassessment-task-single>*{margin-top:auto;margin-bottom:auto}.riskassessment-task-content .riskassessment-task-author,.riskassessment-task-content .riskassessment-task-timespent-list li .riskassessment-task-timespent-author,.riskassessment-task-timespent-list li .riskassessment-task-content .riskassessment-task-timespent-author{display:inline-block;width:25px;min-width:25px;height:25px;line-height:25px;background:rgba(0,0,0,.5);overflow:hidden;text-transform:uppercase;font-size:14px;font-weight:600;border-radius:50%;vertical-align:sub;text-align:center}.riskassessment-task-content .riskassessment-task-author a,.riskassessment-task-content .riskassessment-task-timespent-list li .riskassessment-task-timespent-author a,.riskassessment-task-timespent-list li .riskassessment-task-content .riskassessment-task-timespent-author a{color:#fff !important}.riskassessment-task-content .riskassessment-task-author-label{word-break:break-all}.riskassessment-task-content .riskassessment-task-data{display:flex;flex-wrap:wrap;font-size:14px}.riskassessment-task-content .riskassessment-task-data>*{margin:auto .2em}.riskassessment-task-content .riskassessment-task-data .riskassessment-task-reference{color:#263c5c;font-weight:600}.riskassessment-task-content .riskassessment-task-data .riskassessment-task-reference:hover{text-decoration:underline;cursor:pointer}.riskassessment-task-content .riskassessment-task-data .riskassessment-task-count{background:rgba(0,0,0,.2);font-size:12px;border-radius:4px;padding:.2em .4em}.riskassessment-task-content .riskassessment-task-data .riskassessment-task-progress{background:rgba(0,0,0,.2);font-size:12px;border-radius:4px;padding:.2em .4em;font-weight:700;color:rgba(0,0,0,.6)}.riskassessment-task-content .riskassessment-task-data .riskassessment-task-progress.progress-red{background:#e05353;color:#fff}.riskassessment-task-content .riskassessment-task-data .riskassessment-task-progress.progress-yellow{background:#e9ad4f;color:#fff}.riskassessment-task-content .riskassessment-task-data .riskassessment-task-progress.progress-green{background:#47e58e;color:#fff}.riskassessment-task-content .riskassessment-task-title{display:flex}.riskassessment-task-content .riskassessment-task-title .riskassessment-task-progress-checkbox{margin:auto 0}.riskassessment-task-content .riskassessment-task-title .riskassessment-task-progress-checkbox input{width:20px;height:20px}.riskassessment-task-content .riskassessment-task-add{min-width:40px;margin-left:.5em}.riskassessment-task-content .riskassessment-task-delete{margin-right:-0.5em}.riskassessment-task-listing-wrapper{width:100%}.riskassessment-task-add{margin:5px}.riskassessment-task-list{margin:5px}.riskassessment-task-timespent-add-container{display:flex;background:rgba(0,0,0,.1);padding:10px;margin-bottom:25px}.riskassessment-task-timespent-add-container>*{margin:auto 5px}.riskassessment-task-timespent-add-container .timespent-comment{flex-grow:1}.riskassessment-task-timespent-add-container .timespent-date{min-width:250px}.riskassessment-task-timespent-add-container .timespent-duration{max-width:100px}.riskassessment-task-timespent-add-container .timespent-add-button{min-width:30px}.riskassessment-task-timespent-add-container .timespent-add-button .wpeo-button{margin-top:20px}.riskassessment-task-timespent-container .riskassessment-task .riskassessment-task-container{background:#fff;border:0}.riskassessment-task-timespent-container .riskassessment-task-timespent-comment{display:block}.riskassessment-task-timespent-list li:nth-of-type(even) .table-row{background:rgba(0,0,0,.05) !important}.riskassessment-task-timespent-list li:nth-of-type(odd) .table-row{background:#fff !important}td>.risk-evaluation-list-content .risk-evaluation-container:not(.advanced,.standard){min-width:340px;border:1px solid rgba(0,0,0,.1);background:rgba(0,0,0,.05);padding:.5em;margin-bottom:.5em}.risk-evaluation-container .risk-evaluation-single{display:flex;box-sizing:border-box}.risk-evaluation-container .risk-evaluation-single *{box-sizing:border-box}.risk-evaluation-container .risk-evaluation-single>*{margin-top:auto;margin-bottom:auto}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-cotation{width:40px;min-width:40px;height:40px;line-height:40px}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-photo{width:40px;min-width:40px;height:40px;line-height:40px;text-align:center;background:#ececec;color:rgba(0,0,0,.3);margin-right:.5em}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-photo .photodigiriskdolibarr{width:100%;height:auto;background:#fff}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-photo a,.risk-evaluation-container .risk-evaluation-single .risk-evaluation-photo .divphotoref{width:40px;min-width:40px;height:40px;position:relative;display:block}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-photo a .photo,.risk-evaluation-container .risk-evaluation-single .risk-evaluation-photo .divphotoref .photo{position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-content{width:100%}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-content .risk-evaluation-author{display:inline-block;width:25px;min-width:25px;height:25px;line-height:25px;background:rgba(0,0,0,.5);overflow:hidden;text-transform:uppercase;font-size:14px;font-weight:600;border-radius:50%;vertical-align:sub;text-align:center}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-content .risk-evaluation-author a{color:#fff !important}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-content .risk-evaluation-data{display:flex;flex-wrap:wrap}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-content .risk-evaluation-data>*{margin:auto .2em}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-content .risk-evaluation-data .risk-evaluation-reference{color:#333;font-weight:600}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-content .risk-evaluation-data .risk-evaluation-count{background:rgba(0,0,0,.2);font-size:12px;border-radius:4px;padding:.2em .4em}.risk-evaluation-container .risk-evaluation-single .risk-evaluation-button{margin-left:.5em}.wpeo-table.evaluation-method{background:none !important}@media(max-width: 480px){.wpeo-table.evaluation-method .table-row.table-header{display:none}}.wpeo-table.evaluation-method .table-cell{margin:0;text-align:center;border:1px solid rgba(0,0,0,.1);padding:.8em .4em;position:relative}@media(max-width: 480px){.wpeo-table.evaluation-method .table-cell{width:100% !important}}.wpeo-table.evaluation-method .table-cell.can-select::after,.wpeo-table.evaluation-method .wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .table-cell.risk-evaluation-cotation::after,.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .wpeo-table.evaluation-method .table-cell.risk-evaluation-cotation::after{display:block;content:"";position:absolute;top:.4em;right:.4em;bottom:.4em;left:.4em;background:rgba(0,0,0,.1);transform:scale(0);opacity:0;transition:all .2s ease-out}.wpeo-table.evaluation-method .table-cell.can-select:hover,.wpeo-table.evaluation-method .wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .table-cell.risk-evaluation-cotation:hover,.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .wpeo-table.evaluation-method .table-cell.risk-evaluation-cotation:hover{cursor:pointer}.wpeo-table.evaluation-method .table-cell.can-select:hover::after,.wpeo-table.evaluation-method .wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .table-cell.risk-evaluation-cotation:hover::after,.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .wpeo-table.evaluation-method .table-cell.risk-evaluation-cotation:hover::after{transform:scale(1);opacity:1}.wpeo-table.evaluation-method .table-cell.can-select.active,.wpeo-table.evaluation-method .wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .table-cell.active.risk-evaluation-cotation,.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .wpeo-table.evaluation-method .table-cell.active.risk-evaluation-cotation{color:#fff}.wpeo-table.evaluation-method .table-cell.can-select.active::after,.wpeo-table.evaluation-method .wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .table-cell.active.risk-evaluation-cotation::after,.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard .wpeo-table.evaluation-method .table-cell.active.risk-evaluation-cotation::after{transform:scale(1) !important;opacity:1 !important;background:#0d8aff;z-index:-1}.wpeo-table.evaluation-method .table-row>.table-cell:first-child{background:#263c5c;color:#fff}@media(max-width: 480px){.wpeo-table.evaluation-method .table-row>.table-cell:first-child{background:#263c5c}}.wpeo-table.evaluation-method .table-row:not(.header) .table-cell:nth-of-type(2).active::after{background:#0d8aff}.wpeo-table.evaluation-method .table-row:not(.header) .table-cell:nth-of-type(3).active::after{background:#0063c0}.wpeo-table.evaluation-method .table-row:not(.header) .table-cell:nth-of-type(4).active::after{background:#003b73}.wpeo-table.evaluation-method .table-row:not(.header) .table-cell:nth-of-type(5).active::after{background:#001427}.wpeo-table.evaluation-method .table-row:not(.header) .table-cell:nth-of-type(6).active::after{background:#000}.wpeo-modal[class*=modal-risk] .modal-container .title{display:block;font-weight:600;font-size:13px;margin-bottom:.6em;color:rgba(0,0,0,.8)}.wpeo-modal[class*=modal-risk] .modal-container .title required{font-size:18px;color:#0d8aff;vertical-align:text-top;line-height:.9}.wpeo-modal[class*=modal-risk] .modal-container .section-title{font-size:16px;color:rgba(0,0,0,.8);font-weight:600;margin-bottom:.6em;display:block}.wpeo-modal[class*=modal-risk] .modal-container .maxwidthdate{max-width:125px}.wpeo-modal[class*=modal-risk] .modal-container .risk-content{display:flex;padding-bottom:1em;margin-bottom:1em;border-bottom:1px solid rgba(0,0,0,.2)}.wpeo-modal[class*=modal-risk] .modal-container .risk-content .risk-category{margin-right:1.5em}.wpeo-modal[class*=modal-risk] .modal-container .risk-content .risk-category .dropdown-toggle::after{display:none}.wpeo-modal[class*=modal-risk] .modal-container .risk-content .risk-description{flex-grow:1}.wpeo-modal[class*=modal-risk] .modal-container .risk-content .risk-description textarea{width:100%}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container{padding-bottom:1em;margin-bottom:1em;border-bottom:1px solid rgba(0,0,0,.2)}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-header{margin-bottom:1em}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper{display:flex}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .cotation-standard{margin-right:1em}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .risk-evaluation-photo img{max-width:50px}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .risk-evaluation-comment{flex-grow:1;margin-left:1em}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container .risk-evaluation-content-wrapper .risk-evaluation-comment textarea{width:100%}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container.advanced .risk-evaluation-content-wrapper{flex-wrap:wrap}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container.advanced .risk-evaluation-content{width:100%;margin-bottom:1em}.wpeo-modal[class*=modal-risk] .modal-container .risk-evaluation-container.advanced .risk-evaluation-photo{margin-right:1em}.wpeo-modal .modal-container .risk-evaluations-list .risk-evaluation>.risk-evaluation-container{display:flex}.wpeo-modal .modal-container .risk-evaluations-list .risk-evaluation>.risk-evaluation-container .risk-evaluation-single{width:100%}.wpeo-modal .modal-container .risk-evaluations-list .risk-evaluation>.risk-evaluation-container .risk-evaluation-single .risk-evaluation-reference{color:#333}.wpeo-modal .modal-container .risk-evaluations-list .risk-evaluation>.risk-evaluation-container .risk-evaluation-actions{margin-left:auto}.wpeo-modal[class*=modal-risksign] .modal-container .title{display:block;font-weight:600;font-size:13px;margin-bottom:.6em;color:rgba(0,0,0,.8)}.wpeo-modal[class*=modal-risksign] .modal-container .title required{font-size:18px;color:#0d8aff;vertical-align:text-top;line-height:.9}.wpeo-modal[class*=modal-risksign] .modal-container .section-title{font-size:16px;color:rgba(0,0,0,.8);font-weight:600;margin-bottom:.6em;display:block}.wpeo-modal[class*=modal-risksign] .modal-container .risksign-content{display:flex;padding-bottom:1em;margin-bottom:1em;border-bottom:1px solid rgba(0,0,0,.2)}.wpeo-modal[class*=modal-risksign] .modal-container .risksign-content .risksign-category{margin-right:1.5em}.wpeo-modal[class*=modal-risksign] .modal-container .risksign-content .risksign-category .dropdown-toggle::after{display:none}.wpeo-modal[class*=modal-risksign] .modal-container .risksign-content .risksign-description{flex-grow:1}.wpeo-modal[class*=modal-risksign] .modal-container .risksign-content .risksign-description textarea{width:100%}.wpeo-modal[class*=modal-riskassessment-task] .modal-container .title{display:block;font-weight:600;font-size:13px;margin-bottom:.6em;color:rgba(0,0,0,.8)}.wpeo-modal[class*=modal-riskassessment-task] .modal-container .title required{font-size:18px;color:#0d8aff;vertical-align:text-top;line-height:.9}.wpeo-modal[class*=modal-riskassessment-task] .modal-container .section-title{font-size:16px;color:rgba(0,0,0,.8);font-weight:600;margin-bottom:.6em;display:block}.wpeo-modal[class*=modal-riskassessment-task] .modal-container .riskassessment-task-single{display:block !important}.wpeo-modal[class*=modal-riskassessment-task] .modal-container .riskassessment-task-container{display:flex;padding-bottom:1em;margin-bottom:1em;border-bottom:1px solid rgba(0,0,0,.2)}.wpeo-modal[class*=modal-riskassessment-task] .modal-container .riskassessment-task-container .riskassessment-task{flex-grow:1}.wpeo-modal[class*=modal-riskassessment-task] .modal-container .riskassessment-task-container .riskassessment-task input{width:100%}.wpeo-modal .modal-container .riskassessment-task-list .riskassessment-task>.riskassessment-task-container{display:flex}.wpeo-modal .modal-container .riskassessment-task-list .riskassessment-task>.riskassessment-task-container .riskassessment-task-single{width:100%}.wpeo-modal .modal-container .riskassessment-task-list .riskassessment-task>.riskassessment-task-container .riskassessment-task-actions{margin-left:auto}.riskassessment-task-edit-modal .wpeo-modal.modal-riskassessment-task.modal-active{z-index:1004}#dialog-confirm-actionButtonImportSharedRisks .confirmtext{text-align:center;padding:.2em 0 .4em 0}#dialog-confirm-actionButtonImportSharedRisks .tagtable{border-collapse:collapse}#dialog-confirm-actionButtonImportSharedRisks .tagtr{border-bottom:1px solid rgba(0,0,0,.2)}#dialog-confirm-actionButtonImportSharedRisks .tagtd{padding:.3em 0}#dialog-confirm-actionButtonImportSharedRisks .tagtr>.tagtd:first-child{display:flex}#dialog-confirm-actionButtonImportSharedRisks .tagtr>.tagtd:first-child .importsharedrisk:not(.imported):not(.risk-evaluation-cotation){width:30%}#dialog-confirm-actionButtonImportSharedRisks .tagtr>.tagtd:first-child .importsharedrisk.imported{width:10%;text-align:center;font-size:12px}#dialog-confirm-actionButtonImportSharedRisks .tagtr>.tagtd:first-child .importsharedrisk img{float:left;margin-right:.4em;max-width:35px}#dialog-confirm-actionButtonImportSharedRisks .tagtr>.tagtd:first-child .importsharedrisk>span{display:block}#dialog-confirm-actionButtonImportSharedRisks .tagtr>.tagtd:first-child .importsharedrisk .importsharedrisk-ref{font-weight:600}#dialog-confirm-actionButtonImportSharedRisks .tagtr>.tagtd:last-child{vertical-align:middle}#dialog-confirm-actionButtonImportSharedRiskSigns .confirmtext{text-align:center;padding:.2em 0 .4em 0}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtable{border-collapse:collapse}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtr{border-bottom:1px solid rgba(0,0,0,.2)}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtd{padding:.3em 0}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtr>.tagtd:first-child{display:flex}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtr>.tagtd:first-child .importsharedrisksign:not(.imported){width:30%}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtr>.tagtd:first-child .importsharedrisksign.imported{width:10%;text-align:center;font-size:12px}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtr>.tagtd:first-child .importsharedrisksign img{float:left;margin-right:.4em;max-width:35px}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtr>.tagtd:first-child .importsharedrisksign>span{display:block}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtr>.tagtd:first-child .importsharedrisksign .importsharedrisksign-ref{font-weight:600}#dialog-confirm-actionButtonImportSharedRiskSigns .tagtr>.tagtd:last-child{vertical-align:middle}.wpeo-modal.modal-photo.modal-active{z-index:2014}.wpeo-modal.modal-photo .clickable-photo{border:5px solid #fff;transition:all .2s ease-out;width:100%}.wpeo-modal.modal-photo .clickable-photo:hover{cursor:pointer}.wpeo-modal.modal-photo .clickable-photo:hover .photo-image .photo{opacity:.8}.wpeo-modal.modal-photo .clickable-photo .photo-image{position:relative;width:100%;max-width:120px;height:120px;margin:auto}.wpeo-modal.modal-photo .clickable-photo .photo-image .photo{position:absolute;top:0;left:0;width:100%;object-fit:cover;max-width:none !important;transition:all .2s ease-out}.wpeo-modal.modal-photo .clickable-photo .photo-image .clicked-photo-preview{position:absolute;display:inline-block;top:1em;right:1em;z-index:900;height:25px;line-height:25px;background:#fff;color:#0d8aff;transition:all .2s ease-out}.wpeo-modal.modal-photo .clickable-photo .photo-image .clicked-photo-preview:hover{transform:scale(1.1)}.wpeo-modal.modal-photo .clickable-photo .photo-image .clicked-photo-preview i{line-height:25px;font-size:14px}.wpeo-modal.modal-photo .clickable-photo .title{word-break:break-all}.wpeo-modal.modal-photo .formattachnewfile{padding-bottom:.5em}.wpeo-modal.modal-photo input[type=file]{border-bottom:0 !important}.evaluator-add-modal .time{display:flex;align-items:center}.risk-evaluation-add-modal .modal-container,.risk-evaluation-edit-modal .modal-container{max-height:750px}.risk-evaluation-edit-modal .wpeo-modal.modal-risk.modal-active{z-index:1004}.wpeo-modal .modal-container ul,.wpeo-modal .modal-container li{margin:0;list-style-type:none;padding:0}@media(max-width: 1200px){#id-container .side-nav .vmenu{width:30px;padding-right:0 !important;overflow:hidden}#id-container .side-nav .vmenu .menu_titre .vmenu i{margin-right:2em}#id-container .side-nav .vmenu #blockvmenusearch .select2-container--default .select2-selection--single .select2-selection__placeholder::before{display:inline-block;content:"";font-family:"Font Awesome 5 Free";font-weight:600;margin-right:2em}}@media(max-width: 1200px){#id-container.page-ut-gp-list .side-nav{position:static;height:auto;padding:0 2em;background:none;border:0}#id-container.page-ut-gp-list .side-nav .side-nav-responsive{display:block;background:#263c5c;color:#fff;border-radius:6px;padding:.6em 1em;font-weight:600;font-size:14px;transition:all .2s ease-out}#id-container.page-ut-gp-list .side-nav .side-nav-responsive:hover{cursor:pointer;background:#446ba4}#id-container.page-ut-gp-list .side-nav #id-left{position:absolute;z-index:999;background:#efefef;border:1px solid rgba(0,0,0,.1);box-shadow:0 0 40px 0 rgba(0,0,0,.1);transition:all .2s ease-out;max-height:500px;overflow-y:auto}#id-container.page-ut-gp-list .side-nav #id-left:not(.active){opacity:0;pointer-events:none;transform:translateY(-10px)}#id-container.page-ut-gp-list .side-nav #id-left:not(.active) .wpeo-button{pointer-events:none}#id-container.page-ut-gp-list #id-right{padding-left:0}}@media(max-width: 1200px){td>.riskassessment-task-container{min-width:0}}@media(max-width: 1200px){td>.risk-evaluation-container{min-width:0}}.ui-dialog.ui-corner-all.ui-widget.ui-widget-content.ui-front.ui-draggable.ui-resizable.preview-photo{z-index:2100 !important}.imgTabTitle{max-height:32px !important}.dropdown-toggle::after{display:none}.favorite-photo{border:5px solid #0d8aff}.box-flex-item{width:auto !important}ul{list-style-type:none}tr.liste_titre th.liste_titre:not(.maxwidthsearch),tr.liste_titre td.liste_titre:not(.maxwidthsearch){opacity:1}@media only screen and (max-width: 1600px){div.fichecenter{width:100%;clear:both}div.fichecenterbis{margin-top:8px}div.fichethirdleft{float:none;width:auto;padding-bottom:6px}div.fichetwothirdright{float:none;width:auto;padding-bottom:6px}div.fichehalfleft{float:none;width:auto}div.fichehalfright{float:none;width:auto}div.fichehalfright{margin-top:10px}div.firstcolumn div.box{padding-right:0px}div.secondcolumn div.box{padding-left:0px}} \ No newline at end of file diff --git a/css/scss/module/_module.scss b/css/scss/module/_module.scss new file mode 100644 index 000000000..ad9f40a47 --- /dev/null +++ b/css/scss/module/_module.scss @@ -0,0 +1 @@ +@import "card/card"; From 62e330b32c9580b80849317b4bee6fe6ce16b344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20David?= Date: Tue, 29 Aug 2023 17:54:22 +0200 Subject: [PATCH 009/293] #3217 [DigiriskElement] fix: views saturne integration --- .../groupmentdocument.class.php | 3 + .../listingrisksaction.class.php | 8 +- .../listingrisksphoto.class.php | 8 +- class/digiriskelement.class.php | 48 +- .../mod_listingrisksaction_standard.php | 91 +- .../modules_listingrisksaction.php | 2 + .../mod_listingrisksphoto_standard.php | 91 +- .../modules_listingrisksphoto.php | 2 + js/digiriskdolibarr.js | 4638 ----------------- langs/fr_FR/digiriskdolibarr.lang | 3 + lib/digiriskdolibarr_digiriskelement.lib.php | 17 +- view/digiriskelement/digiriskelement_card.php | 9 +- .../digiriskelement_evaluator.php | 57 +- .../digiriskelement_listingrisksaction.php | 163 +- .../digiriskelement_listingrisksphoto.php | 173 +- .../digiriskelement_organization.php | 47 +- .../digiriskelement_register.php | 39 +- 17 files changed, 234 insertions(+), 5165 deletions(-) diff --git a/class/digiriskdolibarrdocuments/groupmentdocument.class.php b/class/digiriskdolibarrdocuments/groupmentdocument.class.php index 51f4bd066..e0d4bbac4 100644 --- a/class/digiriskdolibarrdocuments/groupmentdocument.class.php +++ b/class/digiriskdolibarrdocuments/groupmentdocument.class.php @@ -22,6 +22,9 @@ */ +// Load DigiriskDolibarr libraries +require_once __DIR__ . '/../digiriskdocuments.class.php'; + /** * Class for GroupmentDocument. */ diff --git a/class/digiriskdolibarrdocuments/listingrisksaction.class.php b/class/digiriskdolibarrdocuments/listingrisksaction.class.php index 58e86fcc6..2a0ef0a2c 100644 --- a/class/digiriskdolibarrdocuments/listingrisksaction.class.php +++ b/class/digiriskdolibarrdocuments/listingrisksaction.class.php @@ -21,18 +21,18 @@ * \brief This file is a class file for ListingRisksAction. */ -// Load Saturne libraries. -require_once __DIR__ . '/../../../saturne/class/saturnedocuments.class.php'; +// Load DigiriskDolibarr libraries +require_once __DIR__ . '/../digiriskdocuments.class.php'; /** * Class for ListingRisksAction. */ -class ListingRisksAction extends SaturneDocuments +class ListingRisksAction extends DigiriskDocuments { /** * @var string Module name. */ - public string $module = 'digiriskdolibarr'; + public $module = 'digiriskdolibarr'; /** * @var string Element type of object. diff --git a/class/digiriskdolibarrdocuments/listingrisksphoto.class.php b/class/digiriskdolibarrdocuments/listingrisksphoto.class.php index be06a003e..ad3d6a0f8 100644 --- a/class/digiriskdolibarrdocuments/listingrisksphoto.class.php +++ b/class/digiriskdolibarrdocuments/listingrisksphoto.class.php @@ -21,18 +21,18 @@ * \brief This file is a class file for ListingRisksPhoto. */ -// Load Saturne libraries. -require_once __DIR__ . '/../../../saturne/class/saturnedocuments.class.php'; +// Load DigiriskDolibarr libraries +require_once __DIR__ . '/../digiriskdocuments.class.php'; /** * Class for ListingRisksPhoto. */ -class ListingRisksPhoto extends SaturneDocuments +class ListingRisksPhoto extends DigiriskDocuments { /** * @var string Module name. */ - public string $module = 'digiriskdolibarr'; + public $module = 'digiriskdolibarr'; /** * @var string Element type of object. diff --git a/class/digiriskelement.class.php b/class/digiriskelement.class.php index 5e6adcc26..a6b20cc48 100644 --- a/class/digiriskelement.class.php +++ b/class/digiriskelement.class.php @@ -65,6 +65,9 @@ class DigiriskElement extends SaturneObject */ public string $picto = 'digiriskelement@digiriskdolibarr'; + public const STATUS_DRAFT = 0; + public const STATUS_VALIDATED = 1; + /** * 'type' field format: * 'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', @@ -176,7 +179,8 @@ public function create(User $user, bool $notrigger = false): int $this->element = $this->element_type . '@digiriskdolibarr'; $this->fk_standard = $conf->global->DIGIRISKDOLIBARR_ACTIVE_STANDARD; $this->status = 1; - return $this->createCommon($user, $notrigger || !$conf->global->DIGIRISKDOLIBARR_MAIN_AGENDA_ACTIONAUTO_DIGIRISKELEMENT_CREATE); + + return $this->createCommon($user, $notrigger); } /** @@ -240,6 +244,21 @@ public function delete(User $user, bool $notrigger = false, bool $softDelete = t return $result; } + /** + * Sets object to supplied categories. + * + * Deletes object from existing categories not supplied. + * Adds it to non-existing supplied categories. + * Existing categories are left untouched. + * + * @param int[]|int $categories Category or categories IDs. + * @return float|int + */ + public function setCategories($categories) + { + return 1; + } + /** * Output html form to select a digirisk element. * @@ -513,4 +532,31 @@ public function getActiveDigiriskElements($allEntities = 0) return $objects; } + + /** + * Return the status. + * + * @param int $status ID status. + * @param int $mode 0 = long label, 1 = short label, 2 = Picto + short label, 3 = Picto, 4 = Picto + long label, 5 = Short label + Picto, 6 = Long label + Picto. + * @return string Label of status. + */ + public function LibStatut(int $status, int $mode = 0): string + { + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { + global $langs; + + $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('StatusDraft'); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); + + $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('StatusDraft'); + $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); + } + + $statusType = 'status' . $status; + if ($status == self::STATUS_VALIDATED) { + $statusType = 'status4'; + } + + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); + } } diff --git a/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/mod_listingrisksaction_standard.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/mod_listingrisksaction_standard.php index ea5a76376..066d680f1 100644 --- a/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/mod_listingrisksaction_standard.php +++ b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/mod_listingrisksaction_standard.php @@ -17,95 +17,26 @@ */ /** - * \file core/modules/digiriskdolibarr/digiriskdocuments/listingrisksaction/mod_listingrisksaction_standard.php - * \ingroup digiriskdolibarr - * \brief File containing class for listingrisksaction numbering module Standard + * \file core/modules/digiquali/controldocument/mod_controldocument_standard.php + * \ingroup digiquali + * \brief File of class to manage controldocument numbering rules standard. */ -require_once __DIR__ . '/../modules_digiriskdocuments.php'; +// Load Saturne libraries. +require_once __DIR__ . '/../../../../../../saturne/core/modules/saturne/modules_saturne.php'; /** - * Class to manage listingrisksaction numbering rules Standard + * Class to manage controldocument numbering rules standard. */ -class mod_listingrisksaction_standard extends ModeleNumRefDigiriskDocuments +class mod_listingrisksaction_standard extends ModeleNumRefSaturne { /** - * Dolibarr version of the loaded document - * @var string + * @var string Numbering module ref prefix. */ - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' + public string $prefix = 'RLA'; /** - * @var string document prefix + * @var string Name. */ - public $prefix = 'RLA'; - - /** - * @var string model name - */ - public $name = 'Pan'; - - /** - * @var string Error code (or message) - */ - public $error = ''; - - /** - * Returns the description of the numbering model - * - * @return string Texte descriptif - */ - public function info() - { - global $langs; - $langs->load("digiriskdolibarr@digiriskdolibarr"); - return $langs->trans('DigiriskListingRisksActionStandardModel', $this->prefix); - } - - /** - * Return an example of numbering - * - * @return string Example - */ - public function getExample() - { - return $this->prefix . "1"; - } - - /** - * Return next free value - * - * @param Object $object Object we need next value for - * @return string Value if KO, <0 if KO - * @throws Exception - */ - public function getNextValue($object) - { - global $db, $conf; - - // first we get the max value - $posindice = strlen($this->prefix) + 1; - $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max"; - $sql .= " FROM " . MAIN_DB_PREFIX . "digiriskdolibarr_digiriskdocuments"; - $sql .= " WHERE ref LIKE '" . $db->escape($this->prefix) . "%'"; - if ($object->ismultientitymanaged == 1) { - $sql .= " AND entity = " . $conf->entity; - } - - $resql = $db->query($sql); - if ($resql) { - $obj = $db->fetch_object($resql); - if ($obj) $max = intval($obj->max); - else $max = 0; - } else { - dol_syslog("mod_listingrisksaction_standard::getNextValue", LOG_DEBUG); - return -1; - } - - if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is - else $num = sprintf("%s", $max + 1); - - dol_syslog("mod_listingrisksaction_standard::getNextValue return " . $this->prefix . $num); - return $this->prefix . $num; - } + public string $name = 'Pan'; } diff --git a/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/modules_listingrisksaction.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/modules_listingrisksaction.php index fb350104f..05545950a 100644 --- a/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/modules_listingrisksaction.php +++ b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksaction/modules_listingrisksaction.php @@ -64,6 +64,8 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // phpcs:enable global $user, $langs, $conf, $hookmanager, $action, $mysoc; + $digiriskelement = $digiriskelement['object']; + if (empty($srctemplatepath)) { dol_syslog("doc_listingrisksaction_odt::write_file parameter srctemplatepath empty", LOG_WARNING); return -1; diff --git a/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/mod_listingrisksphoto_standard.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/mod_listingrisksphoto_standard.php index 5723d34ca..0df2b455e 100644 --- a/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/mod_listingrisksphoto_standard.php +++ b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/mod_listingrisksphoto_standard.php @@ -17,95 +17,26 @@ */ /** - * \file core/modules/digiriskdolibarr/digiriskdocuments/listingrisksphoto/mod_listingrisksphoto_standard.php - * \ingroup digiriskdolibarr - * \brief File containing class for listingrisksphoto numbering module Standard + * \file core/modules/digiquali/controldocument/mod_controldocument_standard.php + * \ingroup digiquali + * \brief File of class to manage controldocument numbering rules standard. */ -require_once __DIR__ . '/../modules_digiriskdocuments.php'; +// Load Saturne libraries. +require_once __DIR__ . '/../../../../../../saturne/core/modules/saturne/modules_saturne.php'; /** - * Class to manage listingrisksphoto numbering rules Standard + * Class to manage controldocument numbering rules standard. */ -class mod_listingrisksphoto_standard extends ModeleNumRefDigiriskDocuments +class mod_listingrisksphoto_standard extends ModeleNumRefSaturne { /** - * Dolibarr version of the loaded document - * @var string + * @var string Numbering module ref prefix. */ - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' + public string $prefix = 'RLP'; /** - * @var string document prefix + * @var string Name. */ - public $prefix = 'RLP'; - - /** - * @var string model name - */ - public $name = 'Daphnis'; - - /** - * @var string Error code (or message) - */ - public $error = ''; - - /** - * Returns the description of the numbering model - * - * @return string Texte descriptif - */ - public function info() - { - global $langs; - $langs->load("digiriskdolibarr@digiriskdolibarr"); - return $langs->trans('DigiriskListingRisksPhotoStandardModel', $this->prefix); - } - - /** - * Return an example of numbering - * - * @return string Example - */ - public function getExample() - { - return $this->prefix . "1"; - } - - /** - * Return next free value - * - * @param Object $object Object we need next value for - * @return string Value if KO, <0 if KO - * @throws Exception - */ - public function getNextValue($object) - { - global $db, $conf; - - // first we get the max value - $posindice = strlen($this->prefix) + 1; - $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max"; - $sql .= " FROM " . MAIN_DB_PREFIX . "digiriskdolibarr_digiriskdocuments"; - $sql .= " WHERE ref LIKE '" . $db->escape($this->prefix) . "%'"; - if ($object->ismultientitymanaged == 1) { - $sql .= " AND entity = " . $conf->entity; - } - - $resql = $db->query($sql); - if ($resql) { - $obj = $db->fetch_object($resql); - if ($obj) $max = intval($obj->max); - else $max = 0; - } else { - dol_syslog("mod_listingrisksphoto_standard::getNextValue", LOG_DEBUG); - return -1; - } - - if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is - else $num = sprintf("%s", $max + 1); - - dol_syslog("mod_listingrisksphoto_standard::getNextValue return " . $this->prefix . $num); - return $this->prefix . $num; - } + public string $name = 'Daphnis'; } diff --git a/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/modules_listingrisksphoto.php b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/modules_listingrisksphoto.php index a3871947c..14e13298e 100644 --- a/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/modules_listingrisksphoto.php +++ b/core/modules/digiriskdolibarr/digiriskdolibarrdocuments/listingrisksphoto/modules_listingrisksphoto.php @@ -64,6 +64,8 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails // phpcs:enable global $user, $langs, $conf, $hookmanager, $action, $mysoc; + $digiriskelement = $digiriskelement['object']; + if (empty($srctemplatepath)) { dol_syslog("doc_listingrisksphoto_odt::write_file parameter srctemplatepath empty", LOG_WARNING); return -1; diff --git a/js/digiriskdolibarr.js b/js/digiriskdolibarr.js index b57475d16..2fb1881be 100644 --- a/js/digiriskdolibarr.js +++ b/js/digiriskdolibarr.js @@ -101,4641 +101,3 @@ if ( ! window.digiriskdolibarr.scriptsLoaded ) { $( document ).ready( window.digiriskdolibarr.init ); } - -/** - * Initialise l'objet "navigation" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. - * - * @since 1.0.0 - * @version 1.0.0 - */ - -window.eoxiaJS.navigation = {}; - -/** - * La méthode appelée automatiquement par la bibliothèque EoxiaJS. - * - * @since 1.0.0 - * @version 1.0.0 - * - * @return {void} - */ -window.eoxiaJS.navigation.init = function() { - window.eoxiaJS.navigation.event(); -}; - -/** - * La méthode contenant tous les événements pour la navigation. - * - * @since 1.0.0 - * @version 1.0.0 - * - * @return {void} - */ -window.eoxiaJS.navigation.event = function() { - // Main Menu Digirisk Society - $( document ).on( 'click', '.toggle-unit', window.eoxiaJS.navigation.switchToggle ); - $( document ).on( 'click', '#newGroupment', window.eoxiaJS.navigation.switchToggle ); - $( document ).on( 'click', '#newWorkunit', window.eoxiaJS.navigation.switchToggle ); - $( document ).on( 'click', '.digirisk-wrap .navigation-container .toolbar div', window.eoxiaJS.navigation.toggleAll ); - $( document ).on( 'click', '#slider', window.eoxiaJS.navigation.setUnitActive ); - $( document ).on( 'click', '#newGroupment', window.eoxiaJS.navigation.redirect ); - $( document ).on( 'click', '#newWorkunit', window.eoxiaJS.navigation.redirect ); - $( document ).on( 'click', '.side-nav-responsive', window.eoxiaJS.navigation.toggleMobileNav ); - $( document ).on( 'click', '.save-organization', window.eoxiaJS.navigation.saveOrganization ); -}; - -/** - * Gestion du toggle dans la navigation. - * - * @since 1.0.0 - * @version 1.0.0 - * - * @param {MouseEvent} event Les attributs lors du clic. - * @return {void} - */ -window.eoxiaJS.navigation.switchToggle = function( event ) { - event.preventDefault(); - - var MENU = localStorage.menu - if (MENU == null || MENU == '') { - MENU = new Set() - } else { - MENU = JSON.parse(MENU) - MENU = new Set(MENU) - } - - if ( $( this ).find( '.toggle-icon' ).hasClass( 'fa-chevron-down' ) ) { - - $(this).find( '.toggle-icon' ).removeClass('fa-chevron-down').addClass('fa-chevron-right'); - var idUnToggled = $(this).closest('.unit').attr('id').split('unit')[1] - $(this).closest('.unit').removeClass('toggled'); - - MENU.delete(idUnToggled) - localStorage.setItem('menu', JSON.stringify(Array.from(MENU.keys()))) - - } else if ( $( this ).find( '.toggle-icon' ).hasClass( 'fa-chevron-right' ) ){ - - $(this).find( '.toggle-icon' ).removeClass('fa-chevron-right').addClass('fa-chevron-down'); - $(this).closest('.unit').addClass('toggled'); - - var idToggled = $(this).closest('.unit').attr('id').split('unit')[1] - MENU.add(idToggled) - localStorage.setItem('menu', JSON.stringify(Array.from(MENU.keys()))) - } - -}; - -/** - * Déplies ou replies tous les éléments enfants - * - * @since 1.0.0 - * @version 1.0.0 - * - * @param {MouseEvent} event Les attributs lors du clic - * @return {void} - */ -window.eoxiaJS.navigation.toggleAll = function( event ) { - event.preventDefault(); - - if ( $( this ).hasClass( 'toggle-plus' ) ) { - - $( '.digirisk-wrap .navigation-container .workunit-list .unit .toggle-icon').removeClass( 'fa-chevron-right').addClass( 'fa-chevron-down' ); - $( '.digirisk-wrap .navigation-container .workunit-list .unit' ).addClass( 'toggled' ); - - // local storage add all - let MENU = [] - $( '.digirisk-wrap .navigation-container .workunit-list .unit .title' ).get().map(function (v){ - MENU.push($(v).attr('value')) - }) - localStorage.setItem('menu', JSON.stringify(Array.from(MENU.values())) ); - } - - if ( $( this ).hasClass( 'toggle-minus' ) ) { - $( '.digirisk-wrap .navigation-container .workunit-list .unit.toggled' ).removeClass( 'toggled' ); - $( '.digirisk-wrap .navigation-container .workunit-list .unit .toggle-icon').addClass( 'fa-chevron-right').removeClass( 'fa-chevron-down' ); - - // local storage delete all - let emptyMenu = new Set('0'); - localStorage.setItem('menu', JSON.stringify(Object.values(emptyMenu)) ); - } -}; - -/** - * Ajout la classe 'active' à l'élément. - * - * @since 1.0.0 - * @version 1.0.0 - * - * @param {MouseEvent} event Les attributs lors du clic. - * @return {void} - */ -window.eoxiaJS.navigation.setUnitActive = function( event ) { - - $( '.digirisk-wrap .navigation-container .unit.active' ).removeClass( 'active' ); - let id = $(this).attr('value'); - - $( this ).closest( '.unit' ).addClass( 'active' ); - $( this ).closest( '.unit' ).attr( 'value', id ); - -}; - -/** - * Redirection sur l'élément courant. - * - * @since 1.0.0 - * @version 1.0.0 - * - * @param {MouseEvent} event Les attributs lors du clic. - * @return {booleen} - */ -window.eoxiaJS.navigation.redirect = function( event ) { - var URLToGo = ''; - var params = new window.URLSearchParams(window.location.search); - var id = $(params.get('id')) - - //get ID from div selected in left menu - history.pushState({ path: document.URL}, '', this.href); - //change URL without refresh - if (!id) { - URLToGo = document.URL.split('?id=')[0]; - } else { - URLToGo = document.URL; - } - $( this ).closest( '.side-nav' ).find( '#id-left' ).removeClass( 'active' ); - - //empty and fill object card - $.ajax({ - url: URLToGo, - success: function( resp ) { - $('#cardContent').html($(resp).find('#cardContent')) - }, - }); - return false; -}; - -/** - * Toggle la classe "active" sur le menu des GP/UT en mobile. - * - * @since 1.1.0 - * @version 1.1.0 - */ -window.eoxiaJS.navigation.toggleMobileNav = function( event ) { - $( this ).closest( '.side-nav' ).find( '#id-left' ).toggleClass( 'active' ); -} - -/** - * Permet de sauvegarder l'organisation des groupements et unités de travail - * - * @since 8.2.2 - * @version 8.2.2 - */ -window.eoxiaJS.navigation.saveOrganization = function( event ) { - - let idArray = [] - let parentArray = [] - let id = 0 - let parent_id = 0 - - //Notices - let actionContainerSuccess = $('.messageSuccessOrganizationSaved'); - let actionContainerError = $('.messageErrorOrganizationSaved'); - let token = $('input[name="token"]').val(); - - $('.route').each(function() { - id = $(this).attr('id') - parent_id = $(this).parent('ul').attr('id').split(/space/)[1] - - idArray.push(id) - parentArray.push(parent_id) - }) - - window.eoxiaJS.loader.display($(this)); - - //ajouter sécurité si le nombre de gp à la fin n'est pas le même qu'en bdd alors on stop tout - - $.ajax({ - url: document.URL + '&action=saveOrganization&ids='+idArray.toString()+'&parent_ids='+parentArray+'&token='+token, - success: function() { - actionContainerSuccess.removeClass('hidden'); - - $('.wpeo-loader').addClass('button-disable') - $('.wpeo-loader').attr('style','background: #47e58e !important;border-color: #47e58e !important;') - $('.wpeo-loader').find('.fas.fa-check').attr('style', '') - $("a").attr("onclick", "").unbind("click"); - - $('.wpeo-loader').removeClass('wpeo-loader') - }, - error: function ( ) { - actionContainerError.removeClass('hidden'); - - $('.wpeo-loader').addClass('button-disable') - $('.wpeo-loader').attr('style','background: #e05353 !important;border-color: #e05353 !important;') - $('.wpeo-loader').find('.fas.fa-times').attr('style', '') - - $('.wpeo-loader').removeClass('wpeo-loader') - } - }); -} - - -/** - * Initialise l'objet "modal" ainsi que la méthode "init" obligatoire pour la bibliothèque EoxiaJS. - * - * @since 1.0.0 - * @version 1.0.0 - */ -window.eoxiaJS.modal = {}; - -/** - * La méthode appelée automatiquement par la bibliothèque EoxiaJS. - * - * @since 1.0.0 - * @version 1.0.0 - * - * @return {void} - */ -window.eoxiaJS.modal.init = function() { - window.eoxiaJS.modal.event(); -}; - -/** - * La méthode contenant tous les événements pour la modal. - * - * @since 1.0.0 - * @version 1.0.0 - * - * @return {void} - */ -window.eoxiaJS.modal.event = function() { - $( document ).on( 'click', '.modal-close', window.eoxiaJS.modal.closeModal ); - $( document ).on( 'click', '.modal-open', window.eoxiaJS.modal.openModal ); - $( document ).on( 'click', '.modal-refresh', window.eoxiaJS.modal.refreshModal ); -}; - -/** - * Open Modal. - * - * @since 1.0.0 - * @version 1.0.0 - * - * @param {MouseEvent} event Les attributs lors du clic. - * @return {void} - */ -window.eoxiaJS.modal.openModal = function ( event ) { - let idSelected = $(this).attr('value'); - if (document.URL.match(/#/)) { - var urlWithoutTag = document.URL.split(/#/)[0] - } else { - var urlWithoutTag = document.URL - } - history.pushState({ path: document.URL}, '', urlWithoutTag); - - // Open modal evaluation. - if ($(this).hasClass('risk-evaluation-add')) { - $('#risk_evaluation_add'+idSelected).addClass('modal-active'); - $('.risk-evaluation-create'+idSelected).attr('value', idSelected); - } else if ($(this).hasClass('risk-evaluation-list')) { - $('#risk_evaluation_list' + idSelected).addClass('modal-active'); - } else if ($(this).hasClass('open-media-gallery')) { - $('#media_gallery').addClass('modal-active'); - $('#media_gallery').attr('value', idSelected); - $('#media_gallery').find('.type-from').attr('value', $(this).find('.type-from').val()); - $('#media_gallery').find('.wpeo-button').attr('value', idSelected); - $('#media_gallery').find('.clicked-photo').attr('style', '') - $('#media_gallery').find('.clicked-photo').removeClass('clicked-photo') - } else if ($(this).hasClass('risk-evaluation-edit')) { - $('#risk_evaluation_edit' + idSelected).addClass('modal-active'); - } else if ($(this).hasClass('evaluator-add')) { - $('#evaluator_add' + idSelected).addClass('modal-active'); - } else if ($(this).hasClass('open-medias-linked') && $(this).hasClass('digirisk-element')) { - $('#digirisk_element_medias_modal_' + idSelected).addClass('modal-active'); - } - - // Open modal risk. - if ($(this).hasClass('risk-add')) { - $('#risk_add' + idSelected).addClass('modal-active'); - } - if ($(this).hasClass('risk-edit')) { - $('#risk_edit' + idSelected).addClass('modal-active'); - } - - // Open modal riskassessment task. - if ($(this).hasClass('riskassessment-task-add')) { - $('#risk_assessment_task_add' + idSelected).addClass('modal-active'); - } - if ($(this).hasClass('riskassessment-task-edit')) { - $('#risk_assessment_task_edit' + idSelected).addClass('modal-active'); - } - if ($(this).hasClass('riskassessment-task-list')) { - $('#risk_assessment_task_list' + idSelected).addClass('modal-active'); - } - if ($(this).hasClass('riskassessment-task-timespent-edit')) { - $('#risk_assessment_task_timespent_edit' + idSelected).addClass('modal-active'); - } - - // Open modal risksign. - if ($(this).hasClass('risksign-add')) { - $('#risksign_add' + idSelected).addClass('modal-active'); - } - if ($(this).hasClass('risksign-edit')) { - $('#risksign_edit' + idSelected).addClass('modal-active'); - } - if ($(this).hasClass('risksign-photo')) { - $(this).closest('.risksign-photo-container').find('#risksign_photo' + idSelected).addClass('modal-active'); - } - - // Open modal signature. - if ($(this).hasClass('modal-signature-open')) { - $('#modal-signature' + idSelected).addClass('modal-active'); - window.eoxiaJS.signature.modalSignatureOpened( $(this) ); - } - - // Open modal patch note. - if ($(this).hasClass('show-patchnote')) { - $('.fiche .wpeo-modal-patchnote').addClass('modal-active'); - } - - $('.notice').addClass('hidden'); -}; - -/** - * Close Modal. - * - * @since 1.0.0 - * @version 1.0.0 - * - * @param {MouseEvent} event Les attributs lors du clic. - * @return {void} - */ -window.eoxiaJS.modal.closeModal = function ( event ) { - if ($(event.target).hasClass('modal-active') || $(event.target).hasClass('modal-close') || $(event.target).parent().hasClass('modal-close')) { - $(this).closest('.modal-active').removeClass('modal-active') - $('.clicked-photo').attr('style', ''); - $('.clicked-photo').removeClass('clicked-photo'); - $('.notice').addClass('hidden'); - } -}; - -/** - * Refresh Modal. - * - * @since 1.0.0 - * @version 1.0.0 - * - * @param {MouseEvent} event Les attributs lors du clic. - * @return {void} - */ -window.eoxiaJS.modal.refreshModal = function ( event ) { - window.location.reload(); -}; - -// Dropdown -/** - * [dropdown description] - * - * @memberof EO_Framework_Dropdown - * - * @type {Object} - */ -window.eoxiaJS.dropdown = {}; - -/** - * [description] - * - * @memberof EO_Framework_Dropdown - * - * @returns {void} [description] - */ -window.eoxiaJS.dropdown.init = function() { - window.eoxiaJS.dropdown.event(); -}; - -/** - * [description] - * - * @memberof EO_Framework_Dropdown - * - * @returns {void} [description] - */ -window.eoxiaJS.dropdown.event = function() { - $( document ).on( 'keyup', window.eoxiaJS.dropdown.keyup ); - $( document ).on( 'keypress', window.eoxiaJS.dropdown.keypress ); - $( document ).on( 'click', '.wpeo-dropdown:not(.dropdown-active) .dropdown-toggle:not(.disabled)', window.eoxiaJS.dropdown.open ); - $( document ).on( 'click', '.wpeo-dropdown.dropdown-active .dropdown-content', function(e) { e.stopPropagation() } ); - $( document ).on( 'click', '.wpeo-dropdown.dropdown-active:not(.dropdown-force-display) .dropdown-content .dropdown-item', window.eoxiaJS.dropdown.close ); - $( document ).on( 'click', '.wpeo-dropdown.dropdown-active', function ( e ) { window.eoxiaJS.dropdown.close( e ); e.stopPropagation(); } ); - $( document ).on( 'click', 'body', window.eoxiaJS.dropdown.close ); -}; - -/** - * [description] - * - * @memberof EO_Framework_Dropdown - * - * @param {void} event [description] - * @returns {void} [description] - */ -window.eoxiaJS.dropdown.keyup = function( event ) { - if ( 27 === event.keyCode ) { - window.eoxiaJS.dropdown.close(); - } -} - -/** - * Do a barrel roll! - * - * @memberof EO_Framework_Dropdown - * - * @param {void} event [description] - * @returns {void} [description] - */ -window.eoxiaJS.dropdown.keypress = function( event ) { - - let currentString = localStorage.currentString ? localStorage.currentString : '' - let keypressNumber = localStorage.keypressNumber ? +localStorage.keypressNumber : 0 - - currentString += event.keyCode - keypressNumber += +1 - - localStorage.setItem('currentString', currentString) - localStorage.setItem('keypressNumber', keypressNumber) - - if (keypressNumber > 9) { - localStorage.setItem('currentString', '') - localStorage.setItem('keypressNumber', 0) - } - - if (currentString === '9897114114101108114111108108') { - var a="-webkit-", - b='transform:rotate(1turn);', - c='transition:4s;'; - - document.head.innerHTML += ' -'; -} -?> - - - diff --git a/core/tpl/medias/digiriskdolibarr_photo_view.tpl.php b/core/tpl/medias/digiriskdolibarr_photo_view.tpl.php deleted file mode 100644 index 9660af842..000000000 --- a/core/tpl/medias/digiriskdolibarr_photo_view.tpl.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -// Protection to avoid direct call of template -if (empty($conf) || ! is_object($conf)) { - print "Error, template page digiriskdolibarr_photo_view.tpl.php can't be called as URL"; - exit; -} - -?> - - - -rights->ecm->upload;?> -
- - trans('Photo'); ?> - -
- entity > 1) ? '/' . $riskAssessment->entity : ''; - $relativepath = 'digiriskdolibarr/medias/thumbs/'; - $modulepart = $entity . 'ecm'; - $path = DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart . '&attachment=0&file=' . str_replace('/', '%2F', $relativepath) . '/'; - $pathToThumb = DOL_URL_ROOT . '/custom/digiriskdolibarr/documents/viewimage.php?modulepart=digiriskdolibarr&entity=' . $riskAssessment->entity . '&file=' . urlencode($riskAssessment->element . '/' . $riskAssessment->ref . '/thumbs/'); - $nophoto = DOL_URL_ROOT.'/public/theme/common/nophoto.png'; - ?> - - -
-
- - diff --git a/core/tpl/medias/index.php b/core/tpl/medias/index.php deleted file mode 100644 index cd6990e24..000000000 --- a/core/tpl/medias/index.php +++ /dev/null @@ -1,2 +0,0 @@ -
- - - +
+ 0) { + $evaluation->photo = $fileName; + $showOnlyFavorite = 1; + } else { + $showOnlyFavorite = 0; + } + print saturne_show_medias_linked('digiriskdolibarr', $conf->digiriskdolibarr->multidir_output[$conf->entity] . '/riskassessment/tmp/RA0', 'small', 1, 0, 0, 0, 50, 50, 0, 0, 0, '/riskassessment/tmp/RA0', $evaluation, 'photo', 0, 0, 0, $showOnlyFavorite); ?> +
-