From 32c5ca68edb29fc9a97cd0123a79f523f97e8eef Mon Sep 17 00:00:00 2001 From: yannis Date: Fri, 31 May 2024 15:38:20 +0200 Subject: [PATCH 1/6] FIX propal dates: setting sign date only if signed --- htdocs/comm/propal/class/propal.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 2998753192595..03667d95d36e5 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2629,7 +2629,11 @@ public function closeProposal($user, $status, $note = '', $notrigger = 0) $newprivatenote = dol_concatdesc($this->note_private, $note); $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; - $sql .= " SET fk_statut = ".((int) $status).", note_private = '".$this->db->escape($newprivatenote)."', date_signature='".$this->db->idate($now)."', fk_user_signature=".$user->id; + $sql .= " SET fk_statut = ".((int) $status).", note_private = '".$this->db->escape($newprivatenote)."',"; + if ($status == self::STATUS_SIGNED) { + $sql .= " date_signature='".$this->db->idate($now)."',"; + } + $sql .= " fk_user_signature=".$user->id; $sql .= " WHERE rowid = ".((int) $this->id); $resql = $this->db->query($sql); From e9cdfbe37b4a98c8a6a731b9db862e583c482f99 Mon Sep 17 00:00:00 2001 From: yannis Date: Fri, 31 May 2024 15:39:47 +0200 Subject: [PATCH 2/6] FIX propal dates: clearing sign date when reopenning a propal --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 03667d95d36e5..bef1a8b77a77d 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2567,7 +2567,7 @@ public function reopen($user, $status, $note = '', $notrigger = 0) if (!empty($note)) { $sql .= " note_private = '".$this->db->escape($note)."',"; } - $sql .= " date_cloture=NULL, fk_user_cloture=NULL"; + $sql .= " date_cloture=NULL, fk_user_cloture=NULL, date_signature=NULL, fk_user_signature=NULL"; $sql .= " WHERE rowid = ".((int) $this->id); $this->db->begin(); From a6e1578d813896856739004fc7a2e70def4ba573 Mon Sep 17 00:00:00 2001 From: yannis Date: Mon, 3 Jun 2024 11:44:02 +0200 Subject: [PATCH 3/6] FIX propal dates: reworked + not clearing sign date Not clearing the sign date anymore because of 17.0 configuration that allow the user to choose if he wants to keep the previous sign date or the current date. --- htdocs/comm/propal/class/propal.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index bef1a8b77a77d..856690afbc473 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2567,7 +2567,7 @@ public function reopen($user, $status, $note = '', $notrigger = 0) if (!empty($note)) { $sql .= " note_private = '".$this->db->escape($note)."',"; } - $sql .= " date_cloture=NULL, fk_user_cloture=NULL, date_signature=NULL, fk_user_signature=NULL"; + $sql .= " date_cloture=NULL, fk_user_cloture=NULL"; $sql .= " WHERE rowid = ".((int) $this->id); $this->db->begin(); @@ -2631,9 +2631,8 @@ public function closeProposal($user, $status, $note = '', $notrigger = 0) $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; $sql .= " SET fk_statut = ".((int) $status).", note_private = '".$this->db->escape($newprivatenote)."',"; if ($status == self::STATUS_SIGNED) { - $sql .= " date_signature='".$this->db->idate($now)."',"; + $sql .= " date_signature='".$this->db->idate($now)."', fk_user_signature=".$user->id; } - $sql .= " fk_user_signature=".$user->id; $sql .= " WHERE rowid = ".((int) $this->id); $resql = $this->db->query($sql); From d7a5a5dfe6ffce355fd2c92f33aa5ef288c6f8dd Mon Sep 17 00:00:00 2001 From: yannis Date: Mon, 3 Jun 2024 16:21:55 +0200 Subject: [PATCH 4/6] FIX propal dates: move comma to fix sql syntax error --- htdocs/comm/propal/class/propal.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 856690afbc473..a33d0864a6c6d 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2629,9 +2629,9 @@ public function closeProposal($user, $status, $note = '', $notrigger = 0) $newprivatenote = dol_concatdesc($this->note_private, $note); $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; - $sql .= " SET fk_statut = ".((int) $status).", note_private = '".$this->db->escape($newprivatenote)."',"; + $sql .= " SET fk_statut = ".((int) $status).", note_private = '".$this->db->escape($newprivatenote)."'"; if ($status == self::STATUS_SIGNED) { - $sql .= " date_signature='".$this->db->idate($now)."', fk_user_signature=".$user->id; + $sql .= ", date_signature='".$this->db->idate($now)."', fk_user_signature=".$user->id; } $sql .= " WHERE rowid = ".((int) $this->id); From 349de54835d7455ff1a4b10d95e8ab774463301f Mon Sep 17 00:00:00 2001 From: yannis Date: Mon, 3 Jun 2024 16:27:32 +0200 Subject: [PATCH 5/6] FIX propal dates: add SQL request to update database This SQL request is meant to set the sign date and the signing user to null to match the fix --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 0bc83dee74c2b..79b31aa87cae5 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -774,3 +774,5 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, p INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipCanceled)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipCanceledTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipCanceledContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipRefused)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipRefusedTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipRefusedContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipAccepted)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipAcceptedTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipAcceptedContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); + +UPDATE llx_propal SET date_signature=null, fk_user_signature=null WHERE fk_statut=3; From 4a6ad85f8ced926a5545bf3eb6a9a3e925cf1045 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Jun 2024 10:51:41 +0200 Subject: [PATCH 6/6] Update 15.0.0-16.0.0.sql --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 79b31aa87cae5..0bc83dee74c2b 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -774,5 +774,3 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, p INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipCanceled)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipCanceledTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipCanceledContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipRefused)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipRefusedTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipRefusedContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipAccepted)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipAcceptedTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipAcceptedContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); - -UPDATE llx_propal SET date_signature=null, fk_user_signature=null WHERE fk_statut=3;