Merge pull request #24608 from solution-libre/fix-notification-templates
Fix notification templates
This commit is contained in:
commit
b3ea71f8f9
@ -487,21 +487,18 @@ class Notify
|
||||
$link = '<a href="'.$urlwithroot.'/compta/facture/card.php?facid='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice');
|
||||
$object_type = 'facture';
|
||||
$labeltouse = $conf->global->BILL_VALIDATE_TEMPLATE;
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextInvoiceValidated", $link);
|
||||
break;
|
||||
case 'BILL_PAYED':
|
||||
$link = '<a href="'.$urlwithroot.'/compta/facture/card.php?facid='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice');
|
||||
$object_type = 'facture';
|
||||
$labeltouse = $conf->global->BILL_PAYED_TEMPLATE;
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextInvoicePayed", $link);
|
||||
break;
|
||||
case 'ORDER_VALIDATE':
|
||||
$link = '<a href="'.$urlwithroot.'/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->commande->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'commande');
|
||||
$object_type = 'order';
|
||||
$labeltouse = $conf->global->ORDER_VALIDATE_TEMPLATE;
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextOrderValidated", $link);
|
||||
break;
|
||||
case 'ORDER_CLOSE':
|
||||
@ -515,7 +512,6 @@ class Notify
|
||||
$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_VALIDATE_TEMPLATE;
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalValidated", $link);
|
||||
break;
|
||||
case 'PROPAL_CLOSE_REFUSED':
|
||||
@ -532,7 +528,6 @@ class Notify
|
||||
$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);
|
||||
if (!empty($object->context['closedfromonlinesignature'])) {
|
||||
$mesg .= ' - From online page';
|
||||
@ -578,49 +573,42 @@ class Notify
|
||||
$link = '<a href="'.$urlwithroot.'/expedition/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->expedition->dir_output."/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment');
|
||||
$object_type = 'shipping';
|
||||
$labeltouse = $conf->global->SHIPPING_VALIDATE_TEMPLATE;
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpeditionValidated", $link);
|
||||
break;
|
||||
case 'EXPENSE_REPORT_VALIDATE':
|
||||
$link = '<a href="'.$urlwithroot.'/expensereport/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->expensereport->dir_output;
|
||||
$object_type = 'expensereport';
|
||||
$labeltouse = $conf->global->EXPENSE_REPORT_VALIDATE_TEMPLATE;
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpenseReportValidated", $link);
|
||||
break;
|
||||
case 'EXPENSE_REPORT_APPROVE':
|
||||
$link = '<a href="'.$urlwithroot.'/expensereport/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->expensereport->dir_output;
|
||||
$object_type = 'expensereport';
|
||||
$labeltouse = $conf->global->EXPENSE_REPORT_APPROVE_TEMPLATE;
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpenseReportApproved", $link);
|
||||
break;
|
||||
case 'HOLIDAY_VALIDATE':
|
||||
$link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->holiday->dir_output;
|
||||
$object_type = 'holiday';
|
||||
$labeltouse = $conf->global->HOLIDAY_VALIDATE_TEMPLATE;
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayValidated", $link);
|
||||
break;
|
||||
case 'HOLIDAY_APPROVE':
|
||||
$link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->holiday->dir_output;
|
||||
$object_type = 'holiday';
|
||||
$labeltouse = $conf->global->HOLIDAY_APPROVE_TEMPLATE;
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayApproved", $link);
|
||||
break;
|
||||
case 'ACTION_CREATE':
|
||||
$link = '<a href="'.$urlwithroot.'/comm/action/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->agenda->dir_output;
|
||||
$object_type = 'action';
|
||||
$labeltouse = $conf->global->ACTION_CREATE_TEMPLATE;
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextActionAdded", $link);
|
||||
break;
|
||||
default:
|
||||
$object_type = $object->element;
|
||||
$dir_output = $conf->$object_type->multidir_output[$object->entity ? $object->entity : $conf->entity]."/".get_exdir(0, 0, 0, 1, $object, $object_type);
|
||||
$template = $notifcode.'_TEMPLATE';
|
||||
$labeltouse = $conf->global->$template;
|
||||
$mesg = $outputlangs->transnoentitiesnoconv('Notify_'.$notifcode).' '.$newref.' '.$dir_output;
|
||||
break;
|
||||
}
|
||||
@ -629,6 +617,8 @@ class Notify
|
||||
$formmail = new FormMail($this->db);
|
||||
$arraydefaultmessage = null;
|
||||
|
||||
$template = $notifcode.'_TEMPLATE';
|
||||
$labeltouse = $conf->global->$template;
|
||||
if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($this->db, $object_type.'_send', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user