diff --git a/README.md b/README.md index 2b648ba3f..588c466af 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Informations - Numéro du module : 436302 -- Dernière mise à jour : 08/04/2024 +- Dernière mise à jour : 23/04/2024 - Éditeur : [Evarisk](https://evarisk.com) - Thème : Eldy Menu - Licence : GPLv3 @@ -11,7 +11,7 @@ ### Version -- Version : 9.15.0 +- Version : 10.0.0 - PHP : 7.4.33 - Compatibilité : Dolibarr 16.0.0 - 19.0.1 - Saturne Framework : 1.3.0 diff --git a/admin/config/riskassessmentdocument.php b/admin/config/riskassessmentdocument.php index 4ab9e6f16..413d402e7 100644 --- a/admin/config/riskassessmentdocument.php +++ b/admin/config/riskassessmentdocument.php @@ -81,6 +81,8 @@ if (($action == 'update' && ! GETPOST("cancel", 'alpha')) || ($action == 'updateedit')) { $DUProject = GETPOST('DUProject', 'none'); $DUProject = preg_split('/_/', $DUProject); + $EnvironmentProject = GETPOST('EnvironmentProject', 'none'); + $EnvironmentProject = preg_split('/_/', $EnvironmentProject); $evaluatorDuration = GETPOST('EvaluatorDuration', 'alpha'); $taskTimeSpentDuration = GETPOST('TaskTimeSpentDuration', 'alpha'); @@ -101,6 +103,23 @@ } } + if ($EnvironmentProject[0] > 0 && $EnvironmentProject[0] != $conf->global->DIGIRISKDOLIBARR_ENVIRONMENT_PROJECT) { + dolibarr_set_const($db, "DIGIRISKDOLIBARR_ENVIRONMENT_PROJECT", $EnvironmentProject[0], 'integer', 0, '', $conf->entity); + + $url = '/projet/tasks.php?id=' . $EnvironmentProject[0]; + + $sql = "UPDATE ".MAIN_DB_PREFIX."menu SET"; + $sql .= " url='".$db->escape($url)."'"; + $sql .= " WHERE leftmenu='digiriskenvironmentalactionplan'"; + $sql .= " AND entity=" . $conf->entity; + + $resql = $db->query($sql); + if (!$resql) { + $error = "Error ".$db->lasterror(); + return -1; + } + } + if (!empty($evaluatorDuration) || $evaluatorDuration === '0') { dolibarr_set_const($db, "DIGIRISKDOLIBARR_EVALUATOR_DURATION", $evaluatorDuration, 'integer', 0, '', $conf->entity); } @@ -193,6 +212,11 @@ 'name' => 'RiskListParentView', 'description' => 'RiskListParentViewDescription', 'code' => 'DIGIRISKDOLIBARR_RISK_LIST_PARENT_VIEW', + ], + 'CategoryOnRisk' => [ + 'name' => 'CategoryOnRisk', + 'description' => 'CategoryOnRiskDescription', + 'code' => 'DIGIRISKDOLIBARR_CATEGORY_ON_RISK', ], 'ShowInheritedRisksInDocuments' => [ 'name' => 'ShowInheritedRisksInDocuments', @@ -278,6 +302,12 @@ print ''; print ''; + print ''; + $formproject->select_projects(-1, $conf->global->DIGIRISKDOLIBARR_ENVIRONMENT_PROJECT, 'EnvironmentProject', 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 'maxwidth500'); + print ' id) . '">'; + print ''; + print ''; + print ''; $formcompany->selectTypeContact($project, $conf->global->DIGIRISKDOLIBARR_DEFAULT_PROJECT_CONTACT_TYPE, 'project_contact_type', 'internal', 'position', 0, 'minwidth500'); print ''; diff --git a/class/actions_digiriskdolibarr.class.php b/class/actions_digiriskdolibarr.class.php index a953b17fd..747eae69b 100644 --- a/class/actions_digiriskdolibarr.class.php +++ b/class/actions_digiriskdolibarr.class.php @@ -72,7 +72,7 @@ public function constructCategory($parameters, &$object) { $error = 0; // Error counter - if (($parameters['currentcontext'] == 'category')) { + if (strpos($parameters['context'], 'category') !== false) { $tags = [ 'accident' => [ 'id' => 436302001, @@ -92,6 +92,12 @@ public function constructCategory($parameters, &$object) 'obj_class' => 'FirePermit', 'obj_table' => 'digiriskdolibarr_firepermit', ], + 'risk' => [ + 'id' => 436302004, + 'code' => 'risk', + 'obj_class' => 'Risk', + 'obj_table' => 'digiriskdolibarr_risk', + ], ]; } @@ -210,7 +216,7 @@ public function printCommonFooter($parameters) $fileDir = $upload_dir . '/' . $dirFiles; $urlSource = $_SERVER['PHP_SELF'] . '?id=' . $object->id; - $out = saturne_show_documents('digiriskdolibarr:TicketDocument', $dirFiles, $fileDir, $urlSource, $user->rights->ticket->write, $user->rights->ticket->delete, getDolGlobalString('DIGIRISKDOLIBARR_TICKET_DEFAULT_MODEL'), 1, 0, 0, 0, '', '', '', '', '', $object); ?> + $out = saturne_show_documents('digiriskdolibarr:TicketDocument', $dirFiles, $fileDir, $urlSource, $user->rights->ticket->write, $user->rights->ticket->delete, getDolGlobalString('DIGIRISKDOLIBARR_TICKETDOCUMENT_DEFAULT_MODEL'), 1, 0, 0, 0, '', '', '', '', '', $object); ?>