From 8202bc6930a0c1d32fe378ddaad058316f3985ae Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 1 Dec 2022 13:56:14 +0100 Subject: [PATCH] NEW: Notification for Sign or Refused Propal from Online Page --- htdocs/core/ajax/onlineSign.php | 4 ++++ htdocs/core/class/notify.class.php | 24 +++++++++++++++++++ .../mysql/data/llx_c_action_trigger.sql | 2 ++ .../install/mysql/migration/16.0.0-17.0.0.sql | 2 ++ htdocs/langs/en_US/other.lang | 5 ++++ htdocs/langs/fr_FR/other.lang | 3 +++ htdocs/public/onlinesign/newonlinesign.php | 4 ++++ 7 files changed, 44 insertions(+) diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index c2823407ac6fb..47a7a2b6f1351 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -219,6 +219,10 @@ if ($result < 0) { $error++; } + $result = $object->call_trigger('PROPAL_CLOSE_SIGNED_WEB', $user); + if ($result < 0) { + $error++; + } } } else { $db->rollback(); diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 2a6fdf8def7bd..2a3a2b805da41 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -71,6 +71,9 @@ class Notify 'ORDER_VALIDATE', 'PROPAL_VALIDATE', 'PROPAL_CLOSE_SIGNED', + 'PROPAL_CLOSE_SIGNED_WEB', + 'PROPAL_CLOSE_REFUSED', + 'PROPAL_CLOSE_REFUSED_WEB', 'FICHINTER_VALIDATE', 'FICHINTER_ADD_CONTACT', 'ORDER_SUPPLIER_VALIDATE', @@ -502,6 +505,20 @@ public function send($notifcode, $object, $filename_list = array(), $mimetype_li $labeltouse = $conf->global->PROPAL_VALIDATE_TEMPLATE; $mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalValidated", $link); break; + case 'PROPAL_CLOSE_REFUSED': + $link = ''.$newref.''; + $dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); + $object_type = 'propal'; + $labeltouse = $conf->global->PROPAL_CLOSE_REFUSED_TEMPLATE; + $mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalClosedRefused", $link); + break; + case 'PROPAL_CLOSE_REFUSED_WEB': + $link = ''.$newref.''; + $dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); + $object_type = 'propal'; + $labeltouse = $conf->global->PROPAL_CLOSE_REFUSED_TEMPLATE; + $mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalClosedRefusedWeb", $link); + break; case 'PROPAL_CLOSE_SIGNED': $link = ''.$newref.''; $dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); @@ -509,6 +526,13 @@ public function send($notifcode, $object, $filename_list = array(), $mimetype_li $labeltouse = $conf->global->PROPAL_CLOSE_SIGNED_TEMPLATE; $mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalClosedSigned", $link); break; + case 'PROPAL_CLOSE_SIGNED_WEB': + $link = ''.$newref.''; + $dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); + $object_type = 'propal'; + $labeltouse = $conf->global->PROPAL_CLOSE_SIGNED_TEMPLATE; + $mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalClosedSigned", $link); + break; case 'FICHINTER_ADD_CONTACT': $link = ''.$newref.''; $dir_output = $conf->ficheinter->dir_output; diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index 9aa28c116c82b..ae0ac58be6275 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -43,7 +43,9 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_MODIFY','Customer proposal modified','Executed when a customer proposal is modified','propal',2); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_SENTBYMAIL','Commercial proposal sent by mail','Executed when a commercial proposal is sent by mail','propal',3); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_SIGNED','Customer proposal closed signed','Executed when a customer proposal is closed signed','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_SIGNED_WEB','Customer proposal closed signed on portal','Executed when a customer proposal is closed signed on portal','propal',2); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_REFUSED','Customer proposal closed refused','Executed when a customer proposal is closed refused','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_REFUSED_WEB','Customer proposal closed refused on portal','Executed when a customer proposal is closed refused on portal','propal',2); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLASSIFY_BILLED','Customer proposal set billed','Executed when a customer proposal is set to billed','propal',2); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_DELETE','Customer proposal deleted','Executed when a customer proposal is deleted','propal',2); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_VALIDATE','Customer order validate','Executed when a customer order is validated','commande',4); diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index ba633ec671a1a..750bb993bea61 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -238,7 +238,9 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_MODIFY','Customer proposal modified','Executed when a customer proposal is modified','propal',2); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_SENTBYMAIL','Commercial proposal sent by mail','Executed when a commercial proposal is sent by mail','propal',3); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_SIGNED','Customer proposal closed signed','Executed when a customer proposal is closed signed','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_SIGNED_WEB','Customer proposal closed signed on portal','Executed when a customer proposal is closed signed on portal','propal',2); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_REFUSED','Customer proposal closed refused','Executed when a customer proposal is closed refused','propal',2); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_REFUSED_WEB','Customer proposal closed refused on portal','Executed when a customer proposal is closed refused on portal','propal',2); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLASSIFY_BILLED','Customer proposal set billed','Executed when a customer proposal is set to billed','propal',2); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_DELETE','Customer proposal deleted','Executed when a customer proposal is deleted','propal',2); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_VALIDATE','Customer order validate','Executed when a customer order is validated','commande',4); diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index d5701ba222436..3d92fe4f69b4b 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -46,7 +46,9 @@ Notify_ORDER_SUPPLIER_APPROVE=Purchase order approved Notify_ORDER_SUPPLIER_REFUSE=Purchase order refused Notify_PROPAL_VALIDATE=Customer proposal validated Notify_PROPAL_CLOSE_SIGNED=Customer proposal closed signed +Notify_PROPAL_CLOSE_SIGNED_WEB=Customer proposal closed signed on portal page Notify_PROPAL_CLOSE_REFUSED=Customer proposal closed refused +Notify_PROPAL_CLOSE_REFUSED_WEB=Customer proposal closed refused on portal page Notify_PROPAL_SENTBYMAIL=Commercial proposal sent by mail Notify_WITHDRAW_TRANSMIT=Transmission withdrawal Notify_WITHDRAW_CREDIT=Credit withdrawal @@ -211,6 +213,9 @@ EMailTextInvoiceValidated=Invoice %s has been validated. EMailTextInvoicePayed=Invoice %s has been paid. EMailTextProposalValidated=Proposal %s has been validated. EMailTextProposalClosedSigned=Proposal %s has been closed signed. +EMailTextProposalClosedSignedWeb=Proposal %s has been closed signed on portal page. +EMailTextProposalClosedRefused=Proposal %s has been closed refused. +EMailTextProposalClosedRefusedWeb=Proposal %s has been closed refuse on portal page. EMailTextOrderValidated=Order %s has been validated. EMailTextOrderApproved=Order %s has been approved. EMailTextOrderValidatedBy=Order %s has been recorded by %s. diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index 6c714be2c4d72..6a6288a6dfc29 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -46,7 +46,9 @@ Notify_ORDER_SUPPLIER_APPROVE=Commande fournisseur approuvée Notify_ORDER_SUPPLIER_REFUSE=Commande fournisseur refusée Notify_PROPAL_VALIDATE=Validation proposition commerciale client Notify_PROPAL_CLOSE_SIGNED=Proposition client fermée signée +Notify_PROPAL_CLOSE_SIGNED_WEB=Proposition client fermée signée sur la page en ligne Notify_PROPAL_CLOSE_REFUSED=Proposition client fermée refusée +Notify_PROPAL_CLOSE_REFUSED_WEB=Proposition client fermée refusée sur la page en ligne Notify_PROPAL_SENTBYMAIL=Envoi proposition commerciale par email Notify_WITHDRAW_TRANSMIT=Transmission prélèvement Notify_WITHDRAW_CREDIT=Crédit prélèvement @@ -210,6 +212,7 @@ EMailTextInvoiceValidated=La facture %s vous concernant a été validée. EMailTextInvoicePayed=La facture %s a été payée. EMailTextProposalValidated=La proposition commerciale %s vous concernant a été validée. EMailTextProposalClosedSigned=La proposition %s a été clôturée signée. +EMailTextProposalClosedSignedWeb=La proposition %s a été clôturée signée via la page du portail client. EMailTextOrderValidated=La commande %s a été validée. EMailTextOrderApproved=La commande %s a été approuvée. EMailTextOrderValidatedBy=La commande %s a été enregistrée par %s diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index f0738f0e42071..de6b27cba9005 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -188,6 +188,10 @@ if ($result < 0) { $error++; } + $result = $object->call_trigger('PROPAL_CLOSE_REFUSED_WEB', $user); + if ($result < 0) { + $error++; + } } } else { $db->rollback();