Fix: Bad ref used into notification message

This commit is contained in:
Laurent Destailleur 2015-04-01 11:30:48 +02:00
parent 5fe5ec939d
commit 293495467f
2 changed files with 20 additions and 18 deletions

View File

@ -109,7 +109,7 @@ class Commande extends CommonOrder
// Pour board // Pour board
var $nbtodo; var $nbtodo;
var $nbtodolate; var $nbtodolate;
/** /**
* ERR Not engouch stock * ERR Not engouch stock
*/ */
@ -299,7 +299,7 @@ class Commande extends CommonOrder
// Rename directory if dir was a temporary ref // Rename directory if dir was a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref)) if (preg_match('/^[\(]?PROV/i', $this->ref))
{ {
// On renomme repertoire ($this->ref = ancienne ref, $numfa = nouvelle ref) // On renomme repertoire ($this->ref = ancienne ref, $num = nouvelle ref)
// in order not to lose the attachments // in order not to lose the attachments
$oldref = dol_sanitizeFileName($this->ref); $oldref = dol_sanitizeFileName($this->ref);
$newref = dol_sanitizeFileName($num); $newref = dol_sanitizeFileName($num);

View File

@ -171,6 +171,8 @@ class Notify
return 0; return 0;
} }
$oldref=(empty($object->oldref)?$object->ref:$object->oldref);
$newref=(empty($object->newref)?$object->ref:$object->newref);
// Check notification per third party // Check notification per third party
$sql = "SELECT s.nom, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,"; $sql = "SELECT s.nom, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,";
@ -215,32 +217,32 @@ class Notify
$link='/compta/facture.php?facid='.$object->id; $link='/compta/facture.php?facid='.$object->id;
$dir_output = $conf->facture->dir_output; $dir_output = $conf->facture->dir_output;
$object_type = 'facture'; $object_type = 'facture';
$mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$object->ref); $mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$newref);
break; break;
case 'ORDER_VALIDATE': case 'ORDER_VALIDATE':
$link='/commande/card.php?id='.$object->id; $link='/commande/card.php?id='.$object->id;
$dir_output = $conf->commande->dir_output; $dir_output = $conf->commande->dir_output;
$object_type = 'order'; $object_type = 'order';
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$object->ref); $mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$newref);
break; break;
case 'PROPAL_VALIDATE': case 'PROPAL_VALIDATE':
$link='/comm/propal.php?id='.$object->id; $link='/comm/propal.php?id='.$object->id;
$dir_output = $conf->propal->dir_output; $dir_output = $conf->propal->dir_output;
$object_type = 'propal'; $object_type = 'propal';
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$object->ref); $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref);
break; break;
case 'FICHINTER_VALIDATE': case 'FICHINTER_VALIDATE':
$link='/fichinter/card.php?id='.$object->id; $link='/fichinter/card.php?id='.$object->id;
$dir_output = $conf->facture->dir_output; $dir_output = $conf->facture->dir_output;
$object_type = 'ficheinter'; $object_type = 'ficheinter';
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref); $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$newref);
break; break;
case 'ORDER_SUPPLIER_APPROVE': case 'ORDER_SUPPLIER_APPROVE':
$link='/fourn/commande/card.php?id='.$object->id; $link='/fourn/commande/card.php?id='.$object->id;
$dir_output = $conf->fournisseur->dir_output.'/commande/'; $dir_output = $conf->fournisseur->dir_output.'/commande/';
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$object->ref,$user->getFullName($langs)); $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$newref,$user->getFullName($langs));
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
break; break;
case 'ORDER_SUPPLIER_REFUSE': case 'ORDER_SUPPLIER_REFUSE':
@ -248,16 +250,16 @@ class Notify
$dir_output = $conf->fournisseur->dir_output.'/commande/'; $dir_output = $conf->fournisseur->dir_output.'/commande/';
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$object->ref,$user->getFullName($langs)); $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$newref,$user->getFullName($langs));
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
break; break;
case 'SHIPPING_VALIDATE': case 'SHIPPING_VALIDATE':
$dir_output = $conf->expedition->dir_output.'/sending/'; $dir_output = $conf->expedition->dir_output.'/sending/';
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$object->ref); $mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$newref);
break; break;
} }
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($newref);
$pdf_path = $dir_output."/".$ref."/".$ref.".pdf"; $pdf_path = $dir_output."/".$ref."/".$ref.".pdf";
if (! dol_is_file($pdf_path)) if (! dol_is_file($pdf_path))
{ {
@ -344,32 +346,32 @@ class Notify
$link='/compta/facture.php?facid='.$object->id; $link='/compta/facture.php?facid='.$object->id;
$dir_output = $conf->facture->dir_output; $dir_output = $conf->facture->dir_output;
$object_type = 'facture'; $object_type = 'facture';
$mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$object->ref); $mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$newref);
break; break;
case 'ORDER_VALIDATE': case 'ORDER_VALIDATE':
$link='/commande/card.php?id='.$object->id; $link='/commande/card.php?id='.$object->id;
$dir_output = $conf->commande->dir_output; $dir_output = $conf->commande->dir_output;
$object_type = 'order'; $object_type = 'order';
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$object->ref); $mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$newref);
break; break;
case 'PROPAL_VALIDATE': case 'PROPAL_VALIDATE':
$link='/comm/propal.php?id='.$object->id; $link='/comm/propal.php?id='.$object->id;
$dir_output = $conf->propal->dir_output; $dir_output = $conf->propal->dir_output;
$object_type = 'propal'; $object_type = 'propal';
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$object->ref); $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref);
break; break;
case 'FICHINTER_VALIDATE': case 'FICHINTER_VALIDATE':
$link='/fichinter/card.php?id='.$object->id; $link='/fichinter/card.php?id='.$object->id;
$dir_output = $conf->facture->dir_output; $dir_output = $conf->facture->dir_output;
$object_type = 'ficheinter'; $object_type = 'ficheinter';
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref); $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$newref);
break; break;
case 'ORDER_SUPPLIER_APPROVE': case 'ORDER_SUPPLIER_APPROVE':
$link='/fourn/commande/card.php?id='.$object->id; $link='/fourn/commande/card.php?id='.$object->id;
$dir_output = $conf->fournisseur->dir_output.'/commande/'; $dir_output = $conf->fournisseur->dir_output.'/commande/';
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$object->ref,$user->getFullName($langs)); $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$newref,$user->getFullName($langs));
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
break; break;
case 'ORDER_SUPPLIER_REFUSE': case 'ORDER_SUPPLIER_REFUSE':
@ -377,16 +379,16 @@ class Notify
$dir_output = $conf->fournisseur->dir_output.'/commande/'; $dir_output = $conf->fournisseur->dir_output.'/commande/';
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$object->ref,$user->getFullName($langs)); $mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$newref,$user->getFullName($langs));
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; $mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
break; break;
case 'SHIPPING_VALIDATE': case 'SHIPPING_VALIDATE':
$dir_output = $conf->expedition->dir_output.'/sending/'; $dir_output = $conf->expedition->dir_output.'/sending/';
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$object->ref); $mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$newref);
break; break;
} }
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($newref);
$pdf_path = $dir_output."/".$ref."/".$ref.".pdf"; $pdf_path = $dir_output."/".$ref."/".$ref.".pdf";
if (! dol_is_file($pdf_path)) if (! dol_is_file($pdf_path))
{ {