diff --git a/class/accidentinvestigation.class.php b/class/accidentinvestigation.class.php
index 3f58ade92..050883631 100644
--- a/class/accidentinvestigation.class.php
+++ b/class/accidentinvestigation.class.php
@@ -119,8 +119,8 @@ class AccidentInvestigation extends SaturneObject
'import_key' => ['type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 0, 'index' => 0],
'status' => ['type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 70, 'notnull' => 1, 'visible' => 2, 'noteditable' => 1, 'default' => 0, 'index' => 0, 'arrayofkeyval' => [0 => 'StatusDraft', 1 => 'Validated', 2 => 'Locked', 3 => 'Archived']],
'seniority_in_position' => ['type' => 'varchar(255)', 'label' => 'SeniorityInPosition', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'visible' => 1, 'css' => 'maxwidth200'],
- 'date_start' => ['type' => 'datetime', 'label' => 'StartDate', 'enabled' => 1, 'position' => 90, 'notnull' => 0, 'visible' => 1,],
- 'date_end' => ['type' => 'datetime', 'label' => 'EndDate', 'enabled' => 1, 'position' => 100, 'notnull' => 0, 'visible' => 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,],
'note_public' => ['type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 110, 'notnull' => 0, 'visible' => -1,],
'note_private' => ['type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 120, 'notnull' => 0, 'visible' => 0,],
'victim_skills' => ['type' => 'html', 'label' => 'VictimSkills', 'enabled' => 1, 'position' => 130, 'notnull' => 0, 'visible' => -1,],
@@ -128,7 +128,7 @@ class AccidentInvestigation extends SaturneObject
'individual_equipment' => ['type' => 'html', 'label' => 'IndividualEquipment', 'enabled' => 1, 'position' => 150, 'notnull' => 0, 'visible' => -1,],
'circumstances' => ['type' => 'html', 'label' => 'Circumstances', 'enabled' => 1, 'position' => 160, 'notnull' => 0, 'visible' => -1,],
'causality_tree' => ['type' => 'text', 'label' => 'CausalityTree', 'enabled' => 1, 'position' => 170, 'notnull' => 0, 'visible' => 0,],
- 'fk_accident' => ['type' => 'integer:Accident:digiriskdolibarr/class/accident/accident.class.php', 'label' => 'Accident', 'picto' => 'fontawesome_fa-user-injured_fas' ,'enabled' => 1, 'position' => 11, 'notnull' => 1, 'visible' => 1, 'foreignkey' => 'digiriskdolibarr_accident.rowid', 'css' => 'maxwidth300'],
+ 'fk_accident' => ['type' => 'integer:Accident@digiriskdolibarr:digiriskdolibarr/class/accident/accident.class.php', 'label' => 'Accident', 'picto' => 'fontawesome_fa-user-injured_fas' ,'enabled' => 1, 'position' => 11, 'notnull' => 1, 'visible' => 1, 'foreignkey' => 'digiriskdolibarr_accident.rowid', 'css' => 'maxwidth300'],
'fk_task' => ['type' => 'integer:Task:projet/class/task.class.php', 'label' => 'Task', 'picto' => 'task', 'enabled' => 1, 'position' => 12, 'notnull' => 1, 'visible' => 5, 'noteditable' => 1, 'default' => 0, 'foreignkey' => 'projet_task.rowid', 'help' => 'TaskWillBeCreatedAfterValidation'],
'fk_project' => ['type' => 'integer:Project:projet/class/project.class.php', 'label' => 'Project', 'picto' => 'project', 'enabled' => 1, 'position' => 13, 'notnull' => 1, 'visible' => 0,],
'fk_user_creat' => ['type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'picto' => 'user', 'enabled' => 1, 'position' => 190, 'notnull' => 1, 'visible' => 0, 'foreignkey' => 'user.rowid'],
diff --git a/langs/fr_FR/digiriskdolibarr.lang b/langs/fr_FR/digiriskdolibarr.lang
index 58bf2dd75..4cf61f535 100644
--- a/langs/fr_FR/digiriskdolibarr.lang
+++ b/langs/fr_FR/digiriskdolibarr.lang
@@ -255,10 +255,8 @@ PriorVisitText = Note de l'inspection
CSSCTIntervention = Intervention du CSSCT
CSSCTInterventionText = Intervention du CSSCT ?
MasterWorker = Responsable de l'Entreprise Utilisatrice
-MasterWorker = Responsable de l'Entreprise Utilisatrice
ExtSociety = Entreprise Extérieure
ExtSocietyResponsible = Responsable de l'Entreprise Extérieure
-ExtSocietyResponsible = Responsable de l'Entreprise Extérieure
ExtSocietyAttendant = Intervenant de l'Entreprise Extérieure
ActionsDescription = Description des actions
INRSRisk = Risque (INRS)
@@ -269,13 +267,6 @@ ModifyPreventionPlan = Modifier le plan de pré
ActionsDescriptionTooltip = Description des actions réalisées par l'intervenant
INRSRiskTooltip = Liste des catégories de risques proposée dans le référentiel de l'INRS
PreventionMethodTooltip = Moyen de prévention à mettre en place pour limiter le risque
-LockPreventionPlan = Verrouiller le plan de prévention
-ConfirmLockPreventionPlan = Êtes-vous sûr de vouloir verrouiller le plan de prévention ?
Ce verrouillage permet de figer les données et la génération du document.
-AllSignatoriesMustHaveSigned = Tous les participants doivent avoir signé pour verrouiller l'objet
-ValidatePreventionPlan = Valider le plan de prévention
-ConfirmValidatePreventionPlan = Êtes-vous sûr de vouloir valider le plan de prévention ?
La validation permet aux participants de signer le document mais empêche l'ajout de nouveaux participants ou la modification du plan de prévention .
-ReOpenPreventionPlan = Ouvrir à nouveau le plan de prévention
-ConfirmReOpenPreventionPlan = Êtes-vous sûr de vouloir rouvrir le plan de prévention ? La réouverture permet la modification du plan de prévention et l'ajout de nouveaux participants mais toutes les signatures du document seront perdues.
PreventionPlanRiskList = Liste des risques du plan de prévention
ActionsPreventionPlanRisk = Actions
PreventionPlanDescription = Projet des plans de prévention
@@ -286,9 +277,6 @@ DeletePreventionPlanLine = Suppression du risque
PreventionPlanDet = Risque du plan de prévention
Preventionplandet = Risque du plan de prévention
PreventionPlanMessage = au plan de prévention
-PreventionPlanMustBeValidated = Le plan de prévention doit être validé pour le rouvrir
-PreventionPlanMustBeInProgress = Le plan de prévention doit être en cours pour accéder à cette fonctionnalité
-PreventionPlanMustBeInProgressToValidate = Le plan de prévention est déjà validé
CSEMustBeAlerted3DaysBeforeVisit = Le CSE doit être prévenu 3 jours avant l'inspection commune préalable (art. R. 4514-1 1°, R. 4514-3 et R. 4514-9 du Code du travail)
PreventionPlanData = Données du Plan de prévention
MasterWorkerDescription = L'utilisateur utilisé par défaut comme Responsable de l'Entreprise Utilisatrice
@@ -300,12 +288,10 @@ NewLabelForClonePreventionPlan = Libellé du nouveau plan
ClonePreventionPlanRisk = Cloner les risques du plan de prévention
CloneAttendantsPreventionPlan = Cloner les participants du plan de prévention
CloneSchedulePreventionPlan = Cloner les horaires du plan de prévention
-ConfirmClonePreventionPlan = Êtes-vous sûr de vouloir cloner le plan de prévention %s ?
preventionplandocument.odt = Plan de prévention
preventionplandocument_custom.odt = Plan de prévention personnalisé
ErrorThirdPartyHasAtLeastOneChildOfTypePreventionPlan = Le tiers est lié à au moins un enfant de type Plan de Prévention :
ErrorContactHasAtLeastOneChildOfTypePreventionPlan = Le contact est lié à au moins un enfant de type Plan de Prévention :
-ConfirmDeletePreventionPlan = Êtes-vous sûr de vouloir supprimer ce plan de prévention ?
PreventionPlanRole = Les rôles du plan de prévention
# Email - Mail
@@ -363,15 +349,10 @@ DeleteFirePermitLine = Suppression du risque
FirePermitMessage = au permis de feu
UsedMaterialTooltip = Matériel à utiliser pour limiter le risque
ActionsFirePermitRisk = Actions
-ConfirmValidateFirePermit = Êtes-vous sûr de vouloir valider le permis de feu ?
La validation permet aux participants de signer le document mais empêche l'ajout de nouveaux participants ou la modification du permis de feu .
-ConfirmReOpenFirePermit = Êtes-vous sûr de vouloir rouvrir le permis de feu ? La réouverture permet la modification du permsi de feu et l'ajout de nouveaux participants mais toutes les signatures du document seront perdues.
-ConfirmLockFirePermit = Êtes-vous sûr de vouloir verrouiller le permis de feu ?
Ce verrouillage permet de figer les données et la génération du document.
-FirePermitMustBeInProgress = Le permis de feu doit être en cours pour accéder à cette fonctionnalité
NewLabelForCloneFirePermit = Libellé du nouveau permis de feu
CloneFirePermitRisk = Cloner les risques du permis de feu
CloneAttendantsFirePermit = Cloner les participants du permis de feu
CloneScheduleFirePermit = Cloner les horaires du permis de feu
-ConfirmCloneFirePermit = Êtes-vous sûr de vouloir cloner le permis de feu %s ?
FirePermitDescription = Projet des permis de feu
FirePermitData = Données du Permis de feu
FirePermitManagement = Gestion des permis de feu
@@ -381,7 +362,6 @@ firepermitdocument_custom.odt = Permis de feu personnalisé
UsedEquipment = Matériel utilisé
ErrorThirdPartyHasAtLeastOneChildOfTypeFirePermit = Le tiers est lié à au moins un enfant de type Permis de Feu :
ErrorContactHasAtLeastOneChildOfTypeFirePermit = Le contact est lié à au moins un enfant de type Permis de Feu :
-ConfirmDeleteFirePermit = Êtes-vous sûr de vouloir supprimer ce permis de feu ?
FirePermitRole = Les rôles du permis de feu
FirepermitSchedules = Horaires du permis de feu
LinkDigiriskdolibarr_firepermit = Activer le lien avec les permis de feu
@@ -536,7 +516,6 @@ WorkStopDocument = Déclaration d'arrêt de travail
AccidentMetaDataSave = Les données complémentaires de l'accident ont bien été enregistrées
ErrorFieldNotEmpty = Erreur : le champ '%s' ne peut pas être vide
ErrorFieldMustBeGreaterOrEqualZero = Erreur : le champ '%s' doit être supérieur ou égal à 0
-ConfirmDeleteAccidentWorkStop = Êtes-vous sûr de vouloir supprimer l'arrêt de travail %s sur l'accident ?
AccidentMetaDataLesion = Données complémentaires des lésions
TotalWorkStopDays = Nombre total de jours d'arrêt de travail
RegisterAccident = Accident bénin
@@ -558,7 +537,6 @@ NbPresquAccidents = Nombre de presqu'accidents
NbAccidentInvestigations = Nombre d'enquête accidents
AccidentInvestigationsMin = enquêtes accident
NbWorkedHours = Nombre d\'heures travaillées
-ConfirmDeleteAccident = Êtes-vous sûr de vouloir supprimer l'accident ?
TheAccident = l'accident
AccidentInvestigation = Enquête accident
Accident_investigation = Enquête accident
@@ -730,7 +708,7 @@ ActionPreventionCompletedTaskDone = Les actions soldées
AppliedOn = Actif sur :
RiskAssessmentDocumentMethod = * Étape 1 : Récupération des informations
- Visite des locaux
- Récupération des données du personnel
* Étape 2 : Définition de la méthodologie et de document
- Validation des fiches d'unité de travail standard
- Validation de l'arborescence des unités
* Étape 3 : Réalisation de l'étude de risques
- Sensibilisation des personnels aux risques et aux dangers
- Création des unités de travail avec le personnel et le ou les responsables
- Évaluations des risques par unités de travail avec le personnel
* Étape 4
- Traitement et rédaction du document unique
RiskAssessmentDocumentSources = La sensibilisation des risques est définie dans l'ED840 édité par L'INRS.
Dans ce document vous trouverez:
- La définition d'un risque, d'un danger et un schéma explicatif
- Les explications concernant les différentes méthodes d'évaluation
-RiskAssessmentDocumentImportantNote = Notes importantes :
Vous pouvez lire la documentation de DigiRisk ici
https://wiki.dolibarr.org/index.php?title=Module_Digirisk
Vous pouvez suivre le projet ici :
https://github.com/Evarisk/Digirisk/projects?type=classic
Reporter un bug ici
https://github.com/Evarisk/Digirisk/issues
+RiskAssessmentDocumentImportantNote = Notes importantes :
Vous pouvez lire la documentation de DigiRisk ici
https://wiki.dolibarr.org/index.php?title=Module_Digirisk
Vous pouvez suivre le projet ici :
https://github.com/Evarisk/Digirisk/projects?query=is%3Aopen
Reporter un bug ici
https://github.com/Evarisk/Digirisk/issues
GenerateZipArchiveWithDigiriskElementDocuments = Génération d'une archive ZIP avec le Document Unique
GenerateZipArchiveWithDigiriskElementDocumentsDescription = Génération automatique d'une archive ZIP contenant le Document Unique et toutes les fiches de poste lors de la génération du Document Unique
RiskAssessmentDocumentDescription = Plan d'action Document Unique
diff --git a/view/accident/accident_card.php b/view/accident/accident_card.php
index a4fbf7790..4384011ba 100644
--- a/view/accident/accident_card.php
+++ b/view/accident/accident_card.php
@@ -38,6 +38,7 @@
require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
+require_once __DIR__ . '/../../../saturne/class/saturneform.class.php';
require_once __DIR__ . '/../../class/digiriskelement.class.php';
require_once __DIR__ . '/../../class/accident.class.php';
require_once __DIR__ . '/../../class/digiriskstandard.class.php';
@@ -589,8 +590,8 @@
include_once __DIR__ . '/../../core/tpl/accident/digiriskdolibarr_accident_lesion_actions.tpl.php';
- // Action confirm_lock, confirm_archive.
- require_once __DIR__ . '/../../../saturne/core/tpl/signature/signature_action_workflow.tpl.php';
+ // Action confirm_lock, confirm_archive
+ require_once __DIR__ . '/../../../saturne/core/tpl/actions/object_workflow_actions.tpl.php';
// Actions set_thirdparty, set_project
require_once __DIR__ . '/../../../saturne/core/tpl/actions/banner_actions.tpl.php';
@@ -897,63 +898,23 @@
$object->fetch($id);
saturne_banner_tab($object, 'id', '', 1, 'rowid', 'ref', $moreHtmlRef, dol_strlen($object->photo) > 0, $moreParams);
- $formConfirm = '';
+ $formQuestionClone = [
+ ['type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans('NewLabelForClone', $langs->transnoentities('The' . ucfirst($object->element))), 'value' => $langs->trans('CopyOf') . ' ' . $object->ref, 'size' => 24],
+ ['type' => 'checkbox', 'name' => 'clone_workstop', 'label' => $langs->trans('CloneWorkStop'), 'value' => 1],
+ ['type' => 'checkbox', 'name' => 'clone_metadata', 'label' => $langs->trans('CloneMetadata'), 'value' => 1],
+ ['type' => 'checkbox', 'name' => 'clone_lesion', 'label' => $langs->trans('CloneLesion'), 'value' => 1],
+ ['type' => 'checkbox', 'name' => 'clone_photos', 'label' => $langs->trans('ClonePhotos'), 'value' => 1],
+ ['type' => 'checkbox', 'name' => 'clone_categories', 'label' => $langs->trans('CloneCategories'), 'value' => 1],
+ ['type' => 'checkbox', 'name' => 'clone_attendants', 'label' => $langs->trans('CloneAttendants'), 'value' => 1]
+ ];
- // Confirmation to delete
- if ($action == 'delete' && $permissiontodelete) {
- $formConfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id=' . $object->id, $langs->trans('DeleteAccident'), $langs->trans('ConfirmDeleteAccident'), 'confirm_delete', '', 0, 1);
- }
-
- // Confirmation to delete line
- if ($action == 'deleteline') {
- $objectline->fetch($lineid);
- $formConfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteAccidentWorkStop'), $langs->trans('ConfirmDeleteAccidentWorkStop', $objectline->ref), 'confirm_deleteLine', '', 0, 1);
- }
-
- // Clone confirmation
- if (($action == 'clone' && (empty($conf->use_javascript_ajax) || !empty($conf->dol_use_jmobile))) || (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) {
- $formQuestionClone = [
- ['type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans('NewLabelForClone', $langs->transnoentities('The' . ucfirst($object->element))), 'value' => $langs->trans('CopyOf') . ' ' . $object->ref, 'size' => 24],
- ['type' => 'checkbox', 'name' => 'clone_workstop', 'label' => $langs->trans('CloneWorkStop'), 'value' => 1],
- ['type' => 'checkbox', 'name' => 'clone_metadata', 'label' => $langs->trans('CloneMetadata'), 'value' => 1],
- ['type' => 'checkbox', 'name' => 'clone_lesion', 'label' => $langs->trans('CloneLesion'), 'value' => 1],
- ['type' => 'checkbox', 'name' => 'clone_photos', 'label' => $langs->trans('ClonePhotos'), 'value' => 1],
- ['type' => 'checkbox', 'name' => 'clone_categories', 'label' => $langs->trans('CloneCategories'), 'value' => 1],
- ['type' => 'checkbox', 'name' => 'clone_attendants', 'label' => $langs->trans('CloneAttendants'), 'value' => 1]
- ];
-
- $formConfirm .= $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id, $langs->trans('CloneObject', $langs->transnoentities('The' . ucfirst($object->element))), $langs->trans('ConfirmCloneObject', $langs->transnoentities('The' . ucfirst($object->element))), 'confirm_clone', $formQuestionClone, 'yes', 'actionButtonClone', 350, 600);
- }
-
- // SetValidated confirmation
- if (($action == 'setValidated' && (empty($conf->use_javascript_ajax) || !empty($conf->dol_use_jmobile))) || (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) {
- $questionConfirmInfo = $langs->trans('ConfirmValidateObject', $langs->trans('TheAccident'), $langs->transnoentities('LesionsOrWorkStop'));
- $formConfirm .= $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id, $langs->trans('ValidateObject', $langs->trans('TheAccident')), $questionConfirmInfo, 'confirm_validate', '', 'yes', 'actionButtonValidate', 250);
- }
-
- // SetReOpen confirmation
- if (($action == 'setReOpen' && (empty($conf->use_javascript_ajax) || !empty($conf->dol_use_jmobile))) || (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) {
- $questionConfirmInfo = $langs->trans('ConfirmReOpenObject', $langs->trans('TheAccident'));
- $formConfirm .= $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id, $langs->trans('ReOpenObject', $langs->trans('TheAccident')), $questionConfirmInfo, 'confirm_setdraft', '', 'yes', 'actionButtonReOpen', 250);
- }
+ $moreParams['cloneConfirmation'] = ['formQuestion' => $formQuestionClone, 'width' => 600];
+ $moreParams['validateConfirmation'] = ['question' => $langs->transnoentities('ConfirmValidateObject', $langs->transnoentities('The' . ucfirst($object->element)), $langs->transnoentities('LesionsOrWorkStop'))];
- // Confirmation to lock
- if (($action == 'lock' && (empty($conf->use_javascript_ajax) || !empty($conf->dol_use_jmobile))) || (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) {
- $formConfirm .= $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id, $langs->trans('LockObject', $langs->transnoentities('The' . ucfirst($object->element))), $langs->trans('ConfirmLockObject', $langs->transnoentities('The' . ucfirst($object->element))), 'confirm_lock', '', 'yes', 'actionButtonLock', 350, 600);
- }
-
- // Call Hook formConfirm.
- $parameters = ['formConfirm' => $formConfirm];
- $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook.
-
- if (empty($reshook)) {
- $formConfirm .= $hookmanager->resPrint;
- } elseif ($reshook > 0) {
- $formConfirm = $hookmanager->resPrint;
- }
+ $formConfirm = saturneForm::actionConfirmation($action, $moreParams);
- // Print form confirm
- print $formConfirm;
+ // Print form confirm
+ print $formConfirm;
print '
| '; - print $langs->trans("Attendants"); - print ' | '; - print ''; - $attendants = count($signatory->fetchSignatory('MasterWorker', $object->id, 'firepermit')); - $attendants += count($signatory->fetchSignatory('ExtSocietyResponsible', $object->id, 'firepermit')); - $attendants += count($signatory->fetchSignatory('ExtSocietyAttendant', $object->id, 'firepermit')); - $url = dol_buildpath('/custom/saturne/view/saturne_attendants.php?id=' . $object->id . '&module_name=DigiriskDolibarr&object_type=' . $object->element . '&document_type=FirePermitDocument', 3); - $displayButton = $onPhone ? '' : ' ' . $langs->trans('AddAttendants'); - print 'status == 1 ? 'href="' . $url . '"' : '') . '">' . $attendants; - print '' . $displayButton . ''; - print ' |
| '.$langs->trans("Categories").' | ';
@@ -1074,83 +957,11 @@
print dol_get_fiche_end();
- if ($object->id > 0) {
- // Buttons for actions
- print ' ';
- $parameters = array();
- $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');
-
- if (empty($reshook) && $permissiontoadd) {
- // Modify
- $displayButton = $onPhone ? '' : '' . ' ' . $langs->trans('Modify');
- if ($object->status == $object::STATUS_DRAFT) {
- print '' . $displayButton . '';
- } else {
- print '' . $displayButton . '';
- }
-
- // Validate
- $displayButton = $onPhone ? '' : '' . ' ' . $langs->trans('Validate');
- if ($object->status == $object::STATUS_DRAFT) {
- print '' . $displayButton . '';
- } else {
- print '' . $displayButton . '';
- }
-
- // ReOpen
- $displayButton = $onPhone ? '' : '' . ' ' . $langs->trans('ReOpenDoli');
- if ($object->status == $object::STATUS_VALIDATED) {
- print '' . $displayButton . '';
- } else {
- print '' . $displayButton . '';
- }
-
- // Sign
- $displayButton = $onPhone ? '' : '' . ' ' . $langs->trans('Sign');
- if ($object->status == $object::STATUS_VALIDATED && !$signatory->checkSignatoriesSignatures($object->id, $object->element)) {
- print '' . $displayButton . '';
- } else {
- print '' . $displayButton . '';
- }
-
- // Lock
- $displayButton = $onPhone ? '' : '' . ' ' . $langs->trans('Lock');
- if ($object->status == $object::STATUS_VALIDATED && $signatory->checkSignatoriesSignatures($object->id, $object->element)) {
- print '' . $displayButton . '';
- } else {
- print '' . $displayButton . '';
- }
-
- // Send email
- $displayButton = $onPhone ? '' : '' . ' ' . $langs->trans('SendMail') . ' ';
- if ($object->status == FirePermit::STATUS_LOCKED) {
- $fileParams = dol_most_recent_file($upload_dir . '/' . $object->element . 'document' . '/' . $object->ref);
- $file = $fileParams['fullname'];
- if (file_exists($file) && !strstr($fileParams['name'], 'specimen')) {
- $forcebuilddoc = 0;
- } else {
- $forcebuilddoc = 1;
- }
- print dolGetButtonAction($displayButton, '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&forcebuilddoc=' . $forcebuilddoc . '&mode=init#formmailbeforetitle');
- } else {
- print '' . $displayButton . '';
- }
-
- // Archive
- $displayButton = $onPhone ? '' : '' . ' ' . $langs->trans('Archive');
- if ($object->status == $object::STATUS_LOCKED) {
- print '' . $displayButton . '';
- } else {
- print '' . $displayButton . '';
- }
-
- // Clone
- $displayButton = $onPhone ? '' : '' . ' ' . $langs->trans('ToClone');
- print '' . $displayButton . '';
- }
- print ' ';
-
+ if ($object->id > 0) {
+ // Buttons for actions
+ print '';
+ saturneForm::showButtons($object, $action);
+ print ' ';
// PREVENTIONPLAN LINES
print '';
diff --git a/view/preventionplan/preventionplan_card.php b/view/preventionplan/preventionplan_card.php
index 95b169459..774d077ed 100644
--- a/view/preventionplan/preventionplan_card.php
+++ b/view/preventionplan/preventionplan_card.php
@@ -38,6 +38,7 @@
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
// Load Saturne libraries.
+require_once __DIR__ . '/../../../saturne/class/saturneform.class.php';
require_once __DIR__ . '/../../../saturne/class/saturnesignature.class.php';
// Load DigiriskDolibarr libraries.
@@ -507,114 +508,44 @@
}
}
- // Actions set_thirdparty, set_project
- require_once __DIR__ . '/../../../saturne/core/tpl/actions/banner_actions.tpl.php';
+ // Action clone object
+ if ($action == 'confirm_clone' && $confirm == 'yes') {
+ $options['clone_label'] = GETPOST('clone_label');
+ $options['preventionplan_risk'] = GETPOST('clone_preventionplan_risk');
+ $options['attendants'] = GETPOST('clone_attendants');
+ $options['schedule'] = GETPOST('clone_schedule');
+ $options['categories'] = GETPOST('clone_categories');
- // Actions builddoc, forcebuilddoc, remove_file.
- require_once __DIR__ . '/../../../saturne/core/tpl/documents/documents_action.tpl.php';
+ if (1 == 0 && ! GETPOST('clone_preventionplan_risk') && ! GETPOST('clone_attendants') && ! GETPOST('clone_schedule')) {
+ setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
+ } else {
+ if ($object->id > 0) {
+ $result = $object->createFromClone($user, $object->id, $options);
+ if ($result > 0) {
+ header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
+ exit();
+ } else {
+ setEventMessages($object->error, $object->errors, 'errors');
+ $action = '';
+ }
+ }
+ }
+ }
- // Action to generate pdf from odt file
- require_once __DIR__ . '/../../../saturne/core/tpl/documents/saturne_manual_pdf_generation_action.tpl.php';
+ // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
+ require_once DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php';
- // Action to set status STATUS_INPROGRESS
- if ($action == 'confirm_setInProgress') {
- $object->fetch($id);
- if ( ! $error) {
- $result = $object->setInProgress($user, false);
- if ($result > 0) {
- // Set In progress 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 {
- // Set In progress KO
- if ( ! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
- else setEventMessages($object->error, null, 'errors');
- }
- }
- }
-
- // Action to set status STATUS_VALIDATED
- if ($action == 'confirm_setPendingSignature') {
- $object->fetch($id);
- if ( ! $error) {
- $result = $object->setPendingSignature($user, false);
- if ($result > 0) {
- // Set pending signature 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 {
- // Set pending signature KO
- if ( ! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
- else setEventMessages($object->error, null, 'errors');
- }
- }
- }
+ // Actions set_thirdparty, set_project
+ require_once __DIR__ . '/../../../saturne/core/tpl/actions/banner_actions.tpl.php';
- // Action to set status STATUS_LOCKED
- if ($action == 'confirm_setLocked') {
- $object->fetch($id);
- if ( ! $error) {
- $result = $object->setLocked($user, false);
- if ($result > 0) {
- // Set locked 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 {
- // Set locked KO
- if ( ! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
- else setEventMessages($object->error, null, 'errors');
- }
- }
- }
+ // Action confirm_lock, confirm_archive
+ require_once __DIR__ . '/../../../saturne/core/tpl/actions/object_workflow_actions.tpl.php';
- // Action to set status STATUS_ARCHIVED
- if ($action == 'setArchived') {
- $object->fetch($id);
- if ( ! $error) {
- $result = $object->setArchived($user, false);
- if ($result > 0) {
- // Set Archived 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 {
- // Set Archived KO
- if ( ! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
- else setEventMessages($object->error, null, 'errors');
- }
- }
- }
+ // Actions builddoc, forcebuilddoc, remove_file
+ require_once __DIR__ . '/../../../saturne/core/tpl/documents/documents_action.tpl.php';
- // Action clone object
- if ($action == 'confirm_clone' && $confirm == 'yes') {
- $options['clone_label'] = GETPOST('clone_label');
- $options['preventionplan_risk'] = GETPOST('clone_preventionplan_risk');
- $options['attendants'] = GETPOST('clone_attendants');
- $options['schedule'] = GETPOST('clone_schedule');
- $options['categories'] = GETPOST('clone_categories');
-
- if (1 == 0 && ! GETPOST('clone_preventionplan_risk') && ! GETPOST('clone_attendants') && ! GETPOST('clone_schedule')) {
- setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
- } else {
- if ($object->id > 0) {
- $result = $object->createFromClone($user, $object->id, $options);
- if ($result > 0) {
- header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
- exit();
- } else {
- setEventMessages($object->error, $object->errors, 'errors');
- $action = '';
- }
- }
- }
- }
+ // 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 = 'PREVENTIONPLAN_SENTBYMAIL';
@@ -958,55 +889,6 @@
print '';
}
-$formconfirm = '';
-
-// SetLocked confirmation
-if (($action == 'setLocked' && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js
- || ( ! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) { // Always output when not jmobile nor js
- $formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('LockObject', $langs->transnoentities('The' . ucfirst($object->element))), $langs->trans('ConfirmLockObject', $langs->transnoentities('The' . ucfirst($object->element))), 'confirm_setLocked', '', 'yes', 'actionButtonLock', 350, 600);
-}
-
-// setPendingSignature confirmation
-if (($action == 'setPendingSignature' && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js
- || ( ! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) { // Always output when not jmobile nor js
- $formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ValidatePreventionPlan'), $langs->trans('ConfirmValidatePreventionPlan', $object->ref), 'confirm_setPendingSignature', '', 'yes', 'actionButtonPendingSignature', 350, 600);
-}
-
-// setInProgress confirmation
-if (($action == 'setInProgress' && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js
- || ( ! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) { // Always output when not jmobile nor js
- $formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ReOpenPreventionPlan'), $langs->trans('ConfirmReOpenPreventionPlan', $object->ref), 'confirm_setInProgress', '', 'yes', 'actionButtonInProgress', 350, 600);
-}
-
-// Clone confirmation
-if (($action == 'clone' && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js
- || ( ! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) { // Always output when not jmobile nor js
- // Define confirmation messages
- $formquestionclone = ['text' => $langs->trans("ConfirmClone"),
- ['type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans("NewLabelForClonePreventionPlan"), 'value' => empty($tmpcode) ? $langs->trans("CopyOf") . ' ' . $object->ref : $tmpcode, 'size' => 24],
- ['type' => 'checkbox', 'name' => 'clone_preventionplan_risk', 'label' => $langs->trans("ClonePreventionPlanRisk"), 'value' => 1],
- ['type' => 'checkbox', 'name' => 'clone_attendants', 'label' => $langs->trans("CloneAttendantsPreventionPlan"), 'value' => 1],
- ['type' => 'checkbox', 'name' => 'clone_schedule', 'label' => $langs->trans("CloneSchedulePreventionPlan"), 'value' => 1],
- ['type' => 'checkbox', 'name' => 'clone_categories', 'label' => $langs->trans('CloneCategories'), 'value' => 1]
- ];
-
- $formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePreventionPlan', $object->ref), 'confirm_clone', $formquestionclone, 'yes', 'actionButtonClone', 350, 600);
-}
-
-// Delete confirmation
-if ($action == 'delete' && $permissiontodelete) {
- $formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("DeletePreventionPlan"), $langs->trans('ConfirmDeletePreventionPlan'), "confirm_delete", '', '', 1);
-}
-
-// Call Hook formConfirm
-$parameters = array('formConfirm' => $formconfirm, 'object' => $object);
-$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
-if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
-elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
-
-// Print form confirm
-print $formconfirm;
-
// Part to show record
if ((empty($action) || ($action != 'create' && $action != 'edit'))) {
// Object card
@@ -1016,6 +898,22 @@
saturne_get_fiche_head($object, 'card', $title);
+ $formQuestionClone = ['text' => $langs->trans('ConfirmClone'),
+ ['type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans('NewLabelForClonePreventionPlan'), 'value' => $langs->trans('CopyOf') . ' ' . $object->ref, 'size' => 24],
+ ['type' => 'checkbox', 'name' => 'clone_preventionplan_risk', 'label' => $langs->trans('ClonePreventionPlanRisk'), 'value' => 1],
+ ['type' => 'checkbox', 'name' => 'clone_attendants', 'label' => $langs->trans('CloneAttendantsPreventionPlan'), 'value' => 1],
+ ['type' => 'checkbox', 'name' => 'clone_schedule', 'label' => $langs->trans('CloneSchedulePreventionPlan'), 'value' => 1],
+ ['type' => 'checkbox', 'name' => 'clone_categories', 'label' => $langs->trans('CloneCategories'), 'value' => 1]
+ ];
+
+ $moreParams['cloneConfirmation'] = ['formQuestion' => $formQuestionClone, 'width' => 600];
+
+ $formConfirm = saturneForm::actionConfirmation($action, $moreParams);
+
+ // Print form confirm
+ print $formConfirm;
+
+
// External Society -- Société extérieure
$extSociety = $digiriskresources->fetchResourcesFromObject('ExtSociety', $object);
$moreHtmlRef = $langs->trans('ExtSociety') . ' : ' . $extSociety->getNomUrl(1) . ' '; @@ -1117,20 +1015,6 @@ } print ' |
| '; - print $langs->trans("Attendants"); - print ' | '; - print ''; - $attendants = count($signatory->fetchSignatory('MasterWorker', $object->id, 'preventionplan')); - $attendants += count($signatory->fetchSignatory('ExtSocietyResponsible', $object->id, 'preventionplan')); - $attendants += count($signatory->fetchSignatory('ExtSocietyAttendant', $object->id, 'preventionplan')); - $url = dol_buildpath('/custom/saturne/view/saturne_attendants.php?id=' . $object->id . '&module_name=DigiriskDolibarr&object_type=' . $object->element . '&document_type=PreventionPlanDocument', 3); - $displayButton = $onPhone ? '' : ' ' . $langs->trans('AddAttendants'); - print 'status == 1 ? 'href="' . $url . '"' : '') . '">' . $attendants; - print '' . $displayButton . ''; - print ' |
| '.$langs->trans("Categories").' | ';
@@ -1144,82 +1028,11 @@
print dol_get_fiche_end();
- if ($object->id > 0) {
- // Buttons for actions
- print ' ';
- $parameters = array();
- $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');
-
- if (empty($reshook) && $permissiontoadd) {
- // Modify
- $displayButton = $onPhone ? '' : '' . ' ' . $langs->trans('Modify');
- if ($object->status == $object::STATUS_DRAFT) {
- print '' . $displayButton . '';
- } else {
- print '' . $displayButton . '';
- }
-
- // Validate
- $displayButton = $onPhone ? '' : '' . ' ' . $langs->trans('Validate');
- if ($object->status == $object::STATUS_DRAFT) {
- print '' . $displayButton . '';
- } else {
- print '' . $displayButton . '';
- }
-
- // ReOpen
- $displayButton = $onPhone ? '' : '' . ' ' . $langs->trans('ReOpenDoli');
- if ($object->status == $object::STATUS_VALIDATED) {
- print '' . $displayButton . '';
- } else {
- print '' . $displayButton . '';
- }
-
- // Sign
- $displayButton = $onPhone ? '' : '' . ' ' . $langs->trans('Sign');
- if ($object->status == $object::STATUS_VALIDATED && !$signatory->checkSignatoriesSignatures($object->id, $object->element)) {
- print '' . $displayButton . '';
- } else {
- print '' . $displayButton . '';
- }
-
- // Lock
- $displayButton = $onPhone ? '' : '' . ' ' . $langs->trans('Lock');
- if ($object->status == $object::STATUS_VALIDATED && $signatory->checkSignatoriesSignatures($object->id, $object->element)) {
- print '' . $displayButton . '';
- } else {
- print '' . $displayButton . '';
- }
-
- // Send email
- $displayButton = $onPhone ? '' : '' . ' ' . $langs->trans('SendMail') . ' ';
- if ($object->status == PreventionPlan::STATUS_LOCKED) {
- $fileParams = dol_most_recent_file($upload_dir . '/' . $object->element . 'document' . '/' . $object->ref);
- $file = $fileParams['fullname'];
- if (file_exists($file) && !strstr($fileParams['name'], 'specimen')) {
- $forcebuilddoc = 0;
- } else {
- $forcebuilddoc = 1;
- }
- print dolGetButtonAction($displayButton, '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&forcebuilddoc=' . $forcebuilddoc . '&mode=init#formmailbeforetitle');
- } else {
- print '' . $displayButton . '';
- }
-
- // Archive
- $displayButton = $onPhone ? '' : '' . ' ' . $langs->trans('Archive');
- if ($object->status == $object::STATUS_LOCKED) {
- print '' . $displayButton . '';
- } else {
- print '' . $displayButton . '';
- }
-
- // Clone
- $displayButton = $onPhone ? '' : '' . ' ' . $langs->trans('ToClone');
- print '' . $displayButton . '';
- }
- print ' ';
+ if ($object->id > 0) {
+ // Buttons for actions
+ print '';
+ saturneForm::showButtons($object, $action);
+ print ' ';
// PREVENTIONPLAN LINES
print '';
|