Skip to content

Commit

Permalink
Merge pull request Evarisk#3339 from nicolas-eoxia/fix_preventionplan
Browse files Browse the repository at this point in the history
Evarisk#3280 [PreventionPlan] fix: document/workflow/view/SQL
  • Loading branch information
nicolas-eoxia authored Oct 9, 2023
2 parents a10b254 + 6c6e86c commit eab279a
Show file tree
Hide file tree
Showing 8 changed files with 247 additions and 262 deletions.
13 changes: 9 additions & 4 deletions class/digiriskdolibarrdocuments/preventionplandocument.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
*/

/**
* \file class/digiriskdocuments/preventionplandocument.class.php
* \ingroup digiriskdolibarr
* \brief This file is a class file for PreventionPlanDocument
* \file class/digiriskdolibarrdocuments/preventionplandocument.class.php
* \ingroup digiriskdolibarr
* \brief This file is a class file for PreventionPlanDocument
*/

// Load DigiriskDolibarr libraries
require_once __DIR__ . '/../digiriskdocuments.class.php';
require_once __DIR__ . '/../digiriskresources.class.php';

/**
* Class for PreventionPlanDocument
Expand Down Expand Up @@ -72,7 +73,11 @@ public function PreventionPlanDocumentFillJSON()
$id = GETPOST('id');
if ($id > 0) {
$preventionplan->fetch($id);
}
} else {
$track_id = GETPOST('track_id', 'alpha');
$signatory->fetch(0, '', ' AND signature_url =' . "'" . $track_id . "'");
$preventionplan->fetch($signatory->fk_object);
}

$preventionplanlines = $preventionplanline->fetchAll('', '', 0, 0, array(), 'AND', GETPOST('id'));
$digirisk_resources = $resources->fetchDigiriskResources();
Expand Down
339 changes: 152 additions & 187 deletions class/preventionplan.class.php

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public function write_file(SaturneDocuments $objectDocument, Translate $outputLa
$tmpArray['maitre_oeuvre_email'] = $maitreoeuvre->email;
$tmpArray['maitre_oeuvre_phone'] = $maitreoeuvre->phone;

$tmpArray['maitre_oeuvre_signature_date'] = dol_print_date($maitreoeuvre->signature_date, 'dayhoursec');
$tmpArray['maitre_oeuvre_signature_date'] = dol_print_date($maitreoeuvre->signature_date, 'dayhour', 'tzuser');
if ((!preg_match('/specimen/i', $tempfilepath[1]) && $object->status >= $object::STATUS_LOCKED)) {
$encoded_image = explode(",", $maitreoeuvre->signature)[1];
$decoded_image = base64_decode($encoded_image);
Expand All @@ -388,7 +388,7 @@ public function write_file(SaturneDocuments $objectDocument, Translate $outputLa
$tmpArray['intervenant_exterieur_email'] = $extsocietyresponsible->email;
$tmpArray['intervenant_exterieur_phone'] = $extsocietyresponsible->phone;

$tmpArray['intervenant_exterieur_signature_date'] = dol_print_date($extsocietyresponsible->signature_date, 'dayhoursec');
$tmpArray['intervenant_exterieur_signature_date'] = dol_print_date($extsocietyresponsible->signature_date, 'dayhour', 'tzuser');
if ((!preg_match('/specimen/i', $tempfilepath[1]) && $object->status >= $object::STATUS_LOCKED)) {
$encoded_image = explode(",", $extsocietyresponsible->signature)[1];
$decoded_image = base64_decode($encoded_image);
Expand Down
2 changes: 2 additions & 0 deletions documents/temp/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
//Silence is golden
35 changes: 17 additions & 18 deletions sql/preventionplan/llx_digiriskdolibarr_preventionplan.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,21 @@
-- along with this program. If not, see https://www.gnu.org/licenses/.

CREATE TABLE llx_digiriskdolibarr_preventionplan(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) NOT NULL,
ref_ext varchar(128),
entity integer DEFAULT 1 NOT NULL,
date_creation datetime NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
status smallint,
label varchar(255) NOT NULL,
date_start datetime NOT NULL,
date_end datetime,
prior_visit_bool boolean,
prior_visit_date datetime,
prior_visit_text text,
cssct_intervention boolean,
fk_project integer,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
last_email_sent_date datetime DEFAULT NULL
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) NOT NULL,
ref_ext varchar(128),
entity integer DEFAULT 1 NOT NULL,
date_creation datetime NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
status integer NOT NULL,
label varchar(255) NOT NULL,
date_start datetime,
date_end datetime,
prior_visit_bool boolean,
prior_visit_date datetime,
prior_visit_text text,
cssct_intervention boolean,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
fk_project integer NOT NULL
) ENGINE=innodb;
23 changes: 12 additions & 11 deletions sql/preventionplan/llx_digiriskdolibarr_preventionplandet.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@
-- along with this program. If not, see https://www.gnu.org/licenses/.

CREATE TABLE llx_digiriskdolibarr_preventionplandet(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) NOT NULL,
ref_ext varchar(128),
entity integer DEFAULT 1 NOT NULL,
date_creation datetime NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
description text,
category varchar(255),
prevention_method text,
fk_preventionplan integer NOT NULL,
fk_element integer NOT NULL
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) NOT NULL,
ref_ext varchar(128),
entity integer DEFAULT 1 NOT NULL,
date_creation datetime NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
status integer NOT NULL,
description text,
category varchar(255),
prevention_method text,
fk_preventionplan integer NOT NULL,
fk_element integer NOT NULL
) ENGINE=innodb;
6 changes: 6 additions & 0 deletions sql/update.sql
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ ALTER TABLE llx_c_relative_location ADD position integer DEFAULT 0 AFTER active;
ALTER TABLE llx_c_lesion_localization ADD position integer DEFAULT 0 AFTER active;
ALTER TABLE llx_c_lesion_nature ADD position integer DEFAULT 0 AFTER active;

-- ALTER TABLE llx_digiriskdolibarr_preventionplan CHANGE `status` `status` INT(11) NOT NULL;
ALTER TABLE llx_digiriskdolibarr_preventionplan CHANGE `date_start` `date_start` DATETIME NULL;
ALTER TABLE llx_digiriskdolibarr_preventionplan CHANGE `fk_project` `fk_project` INT(11) NOT NULL;
ALTER TABLE llx_digiriskdolibarr_preventionplan DROP COLUMN `last_email_sent_date`;
ALTER TABLE llx_digiriskdolibarr_preventionplandet ADD status INTEGER NOT NULL AFTER tms;

ALTER TABLE llx_c_accident_investigation_attendants_role RENAME TO llx_c_accidentinvestigation_attendants_role;
ALTER TABLE llx_categorie_accident_investigation RENAME TO llx_categorie_accidentinvestigation;
ALTER TABLE llx_categorie_accidentinvestigation CHANGE `fk_accident_investigation` `fk_accidentinvestigation`;
Expand Down
Loading

0 comments on commit eab279a

Please sign in to comment.