Fix undefined var

This commit is contained in:
Laurent Destailleur
2017-09-26 16:07:46 +02:00
parent d1bee67b40
commit d7dd6ed334
6 changed files with 11 additions and 8 deletions

View File

@@ -329,6 +329,7 @@ class FormMail extends Form
$out.= '<input type="hidden" id="'.$key.'" name="'.$key.'" value="'.$value.'" />'."\n";
}
$modelmail_array=array();
if ($this->param['models'] != 'none')
{
$result = $this->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs);
@@ -336,7 +337,6 @@ class FormMail extends Form
{
setEventMessages($this->error, $this->errors, 'errors');
}
$modelmail_array=array();
foreach($this->lines_model as $line)
{
$langs->trans("members");
@@ -1076,11 +1076,11 @@ class FormMail extends Form
* @return void
* @see getCommonSubstitutionArray
*/
function setSubstitFromObject($object, $outputlangs=null)
function setSubstitFromObject($object, $outputlangs)
{
global $conf, $user;
$parameters=array('mode'=>$mode);
$parameters=array();
$tmparray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($tmparray, $outputlangs, null, $parameters);
@@ -1135,6 +1135,7 @@ class FormMail extends Form
{
global $conf, $langs;
$tmparray=array();
if ($mode == 'formemail' || $mode == 'formemailwithlines' || $mode == 'formemailforlines')
{
$parameters=array('mode'=>$mode);

View File

@@ -5280,10 +5280,12 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
// TODO USe this ?
$msgishtml = 0;
$birthday = dol_print_date($object->birth,'day');
if (method_exists($object, 'getCivilityLabel')) $substitutionarray['__MEMBER_CIVILITY__'] = $object->getCivilityLabel();
$substitutionarray['__MEMBER_FIRSTNAME__']=$msgishtml?dol_htmlentitiesbr($object->firstname):$object->firstname;
$substitutionarray['__MEMBER_LASTNAME__']=$msgishtml?dol_htmlentitiesbr($object->lastname):$object->lastname;
if (method_exists($object, 'getFullName')) $substitutionarray['__MEMBER_FULLNAME__']=$msgishtml?dol_htmlentitiesbr($object->getFullName($langs)):$object->getFullName($langs);
if (method_exists($object, 'getFullName')) $substitutionarray['__MEMBER_FULLNAME__']=$msgishtml?dol_htmlentitiesbr($object->getFullName($outputlangs)):$object->getFullName($outputlangs);
$substitutionarray['__MEMBER_COMPANY__']=$msgishtml?dol_htmlentitiesbr($object->societe):$object->societe;
$substitutionarray['__MEMBER_ADDRESS__']=$msgishtml?dol_htmlentitiesbr($object->address):$object->address;
$substitutionarray['__MEMBER_ZIP__']=$msgishtml?dol_htmlentitiesbr($object->zip):$object->zip;

View File

@@ -2221,7 +2221,7 @@ else if ($id || $ref)
$formmail->withdeliveryreceipt=1;
$formmail->withcancel=1;
// Tableau des substitutions
$formmail->setSubstitFromObject($object);
$formmail->setSubstitFromObject($object, $outputlangs);
$formmail->substit['__SHIPPINGREF__']=$object->ref;
$formmail->substit['__SHIPPINGTRACKNUM__']=$object->tracking_number;
$formmail->substit['__SHIPPINGTRACKNUMURL__']=$object->tracking_url;

View File

@@ -542,7 +542,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$formmail->withdeliveryreceipt = 1;
$formmail->withcancel = 1;
// Tableau des substitutions
$formmail->setSubstitFromObject($object);
$formmail->setSubstitFromObject($object, $outputlangs);
$formmail->substit ['__ORDERREF__'] = $object->ref;
$custcontact = '';

View File

@@ -2485,7 +2485,7 @@ else
$formmail->withdeliveryreceipt=1;
$formmail->withcancel=1;
// Array of substitutions
$formmail->setSubstitFromObject($object);
$formmail->setSubstitFromObject($object, $outputlangs);
$formmail->substit['__THIRDPARTY_ID__']=$object->id; // substit in setSubstitFromObject was wrong for this one
$formmail->substit['__THIRDPARTY_NAME__']=$object->name; // substit in setSubstitFromObject was wrong for this one
$formmail->substit['__PERSONALIZED__']=''; // deprecated

View File

@@ -1760,7 +1760,7 @@ else
$formmail->withdeliveryreceipt=1;
$formmail->withcancel=1;
// Tableau des substitutions
$formmail->setSubstitFromObject($object);
$formmail->setSubstitFromObject($object, $outputlangs);
$formmail->substit['__LASTNAME__']=$object->lastname;
$formmail->substit['__FIRSTNAME__']=$object->firstname;