Skip to content

Commit

Permalink
Merge pull request #23065 from FHenry/dev_add_PropalNotificationTriggers
Browse files Browse the repository at this point in the history
NEW: Notification for Sign or Refused Propal from Online Page
  • Loading branch information
eldy authored Dec 17, 2022
2 parents 41d841f + 8202bc6 commit 63fe461
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 0 deletions.
4 changes: 4 additions & 0 deletions htdocs/core/ajax/onlineSign.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@
if ($result < 0) {
$error++;
}
$result = $object->call_trigger('PROPAL_CLOSE_SIGNED_WEB', $user);
if ($result < 0) {
$error++;
}
}
} else {
$db->rollback();
Expand Down
24 changes: 24 additions & 0 deletions htdocs/core/class/notify.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -502,13 +505,34 @@ 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 = '<a href="'.$urlwithroot.'/comm/propal/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
$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 = '<a href="'.$urlwithroot.'/comm/propal/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
$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 = '<a href="'.$urlwithroot.'/comm/propal/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
$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 'PROPAL_CLOSE_SIGNED_WEB':
$link = '<a href="'.$urlwithroot.'/comm/propal/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
$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 = '<a href="'.$urlwithroot.'/fichinter/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
$dir_output = $conf->ficheinter->dir_output;
Expand Down
2 changes: 2 additions & 0 deletions htdocs/install/mysql/data/llx_c_action_trigger.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions htdocs/install/mysql/migration/16.0.0-17.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,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);
Expand Down
5 changes: 5 additions & 0 deletions htdocs/langs/en_US/other.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions htdocs/langs/fr_FR/other.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions htdocs/public/onlinesign/newonlinesign.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@
if ($result < 0) {
$error++;
}
$result = $object->call_trigger('PROPAL_CLOSE_REFUSED_WEB', $user);
if ($result < 0) {
$error++;
}
}
} else {
$db->rollback();
Expand Down

0 comments on commit 63fe461

Please sign in to comment.