Skip to content

Commit

Permalink
Merge pull request Evarisk#3340 from nicolas-eoxia/fix_firepermit
Browse files Browse the repository at this point in the history
Evarisk#3280 [FirePermit] fix: document/workflow/view/SQLfix: document/workflow/view/SQL
  • Loading branch information
nicolas-eoxia authored Oct 9, 2023
2 parents eab279a + 2d07a38 commit 67d3709
Show file tree
Hide file tree
Showing 7 changed files with 455 additions and 448 deletions.
10 changes: 9 additions & 1 deletion class/digiriskdolibarrdocuments/firepermitdocument.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
// Load Saturne libraries.
require_once __DIR__ . '/../../../saturne/class/saturnedocuments.class.php';

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

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

$firepermitlines = $firepermitline->fetchAll('', '', 0, 0, array(), 'AND', GETPOST('id'));
$preventionplanlines = $preventionplanline->fetchAll('', '', 0, 0, array(), 'AND', $firepermit->fk_preventionplan);
Expand Down
322 changes: 152 additions & 170 deletions class/firepermit.class.php

Large diffs are not rendered by default.

Large diffs are not rendered by default.

29 changes: 14 additions & 15 deletions sql/firepermit/llx_digiriskdolibarr_firepermit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,18 @@
-- along with this program. If not, see https://www.gnu.org/licenses/.

CREATE TABLE llx_digiriskdolibarr_firepermit(
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,
last_email_sent_date datetime DEFAULT NULL,
fk_project integer,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
fk_preventionplan integer
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,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
fk_project integer NOT NULL,
fk_preventionplan integer NOT NULL
) ENGINE=innodb;
23 changes: 12 additions & 11 deletions sql/firepermit/llx_digiriskdolibarr_firepermitdet.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_firepermitdet(
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),
used_equipment text,
fk_firepermit 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),
used_equipment text,
fk_firepermit integer NOT NULL,
fk_element integer NOT NULL
) ENGINE=innodb;
7 changes: 7 additions & 0 deletions sql/update.sql
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,13 @@ ALTER TABLE llx_digiriskdolibarr_preventionplan CHANGE `fk_project` `fk_project`
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_digiriskdolibarr_firepermit CHANGE `status` `status` INT(11) NOT NULL;
ALTER TABLE llx_digiriskdolibarr_firepermit CHANGE `date_start` `date_start` DATETIME NULL;
ALTER TABLE llx_digiriskdolibarr_firepermit CHANGE `fk_project` `fk_project` INT(11) NOT NULL;
ALTER TABLE llx_digiriskdolibarr_firepermit CHANGE `fk_preventionplan` `fk_preventionplan` INT(11) NOT NULL;
ALTER TABLE llx_digiriskdolibarr_firepermit DROP COLUMN `last_email_sent_date`;
ALTER TABLE llx_digiriskdolibarr_firepermitdet 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 67d3709

Please sign in to comment.