More complete substitution system.

Add __CONTRACT_NEXT_EXPIRATION_DATE__  and
__CONTRACT_NEXT_EXPIRATION_DATETIME__
This commit is contained in:
Laurent Destailleur 2017-09-16 03:13:44 +02:00
parent a4086b52ef
commit 961d475a9d
6 changed files with 131 additions and 91 deletions

View File

@ -2241,9 +2241,19 @@ else
$formmail->withbody = 1; $formmail->withbody = 1;
$formmail->withdeliveryreceipt = 1; $formmail->withdeliveryreceipt = 1;
$formmail->withcancel = 1; $formmail->withcancel = 1;
// Tableau des substitutions // Array of substitutions
$formmail->withsubstit='AvailableVariables';
$formmail->setSubstitFromObject($object); $formmail->setSubstitFromObject($object);
$formmail->substit ['__CONTRACTREF__'] = $object->ref; $datenextexpiration='';
foreach($object->lines as $line)
{
if ($line->statut != 4) continue;
if ($line->date_fin_prevue > $datenextexpiration) $datenextexpiration = $line->date_fin_prevue;
}
$formmail->substit['__CONTRACT_NEXT_EXPIRATION_DATE__'] = dol_print_date($datenextexpiration, 'dayrfc');
$formmail->substit['__CONTRACT_NEXT_EXPIRATION_DATETIME__'] = dol_print_date($datenextexpiration, 'standard');
$formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']='';
$custcontact = ''; $custcontact = '';
$contactarr = array(); $contactarr = array();
@ -2255,7 +2265,7 @@ else
{ {
if ($contact['libelle'] == $langs->trans('TypeContact_contract_external_CUSTOMER')) { // TODO Use code and not label if ($contact['libelle'] == $langs->trans('TypeContact_contract_external_CUSTOMER')) { // TODO Use code and not label
$contactstatic = new Contact($db); $contactstatic = new Contact($db);
$contactstatic->fetch($contact ['id']); $contactstatic->fetch($contact['id']);
$custcontact = $contactstatic->getFullName($langs, 1); $custcontact = $contactstatic->getFullName($langs, 1);
} }
} }

View File

@ -275,28 +275,18 @@ if (! $error && $massaction == 'confirm_presend')
if ($objectclass == 'CommandeFournisseur') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO); if ($objectclass == 'CommandeFournisseur') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO);
if ($objectclass == 'FactureFournisseur') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO); if ($objectclass == 'FactureFournisseur') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO);
$objecttmp=new $objectclass($db);
$objecttmp->thirdparty = $thirdparty;
$substitutionarray=array( // Make substitution in email content
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, $substitutionarray=getCommonSubstitutionArray($langs, 0, null, $objecttmp);
'__ID__' => join(', ',array_keys($listofqualifiedid)), $substitutionarray['__ID__'] = join(', ',array_keys($listofqualifiedid));
'__EMAIL__' => $thirdparty->email, $substitutionarray['__EMAIL__'] = $thirdparty->email;
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>', $substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
'__FACREF__' => join(', ',$listofqualifiedref), // For backward compatibility $substitutionarray['__REF__'] = join(', ',$listofqualifiedref);
'__ORDERREF__' => join(', ',$listofqualifiedref), // For backward compatibility
'__PROPREF__' => join(', ',$listofqualifiedref), // For backward compatibility $parameters=array('mode'=>'formemail');
'__REF__' => join(', ',$listofqualifiedref), complete_substitutions_array($substitutionarray, $langs, $objecttmp, $parameters);
'__REFCLIENT__' => $thirdparty->name,
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?dol_string_nohtmltag($user->signature):'')
/* not available on all object
/'__FIRSTNAME__'=>(is_object($object)?$object->firstname:''),
'__LASTNAME__'=>(is_object($object)?$object->lastname:''),
'__FULLNAME__'=>(is_object($object)?$object->getFullName($langs):''),
'__ADDRESS__'=>(is_object($object)?$object->address:''),
'__ZIP__'=>(is_object($object)?$object->zip:''),
'__TOWN_'=>(is_object($object)?$object->town:''),
'__COUNTRY__'=>(is_object($object)?$object->country:''),
*/
);
$subject=make_substitutions($subject, $substitutionarray); $subject=make_substitutions($subject, $substitutionarray);
$message=make_substitutions($message, $substitutionarray); $message=make_substitutions($message, $substitutionarray);
@ -458,15 +448,15 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
if (!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT)) if (!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT))
{ {
// Create output dir if not exists // Create output dir if not exists
dol_mkdir($diroutputmassaction); dol_mkdir($diroutputmassaction);
// Defined name of merged file // Defined name of merged file
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel)));
$filename=preg_replace('/\s/','_',$filename); $filename=preg_replace('/\s/','_',$filename);
// Save merged file // Save merged file
if ($filter=='paye:0') if ($filter=='paye:0')
{ {

View File

@ -344,23 +344,25 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
} }
} }
$substitutionarray=array( // Make substitution in email content
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, $substitutionarray=getCommonSubstitutionArray($langs, 0, null, $object);
'__ID__' => (is_object($object)?$object->id:''), $substitutionarray['__EMAIL__'] = $sendto;
'__EMAIL__' => $sendto, $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty))?'<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>':'';
'__CHECK_READ__' => (is_object($object) && is_object($object->thirdparty))?'<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>':'', // Add specific substitution for contracts
'__REF__' => (is_object($object)?$object->ref:''), if (is_object($object) && $object->element == 'contrat' && is_array($object->lines))
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?dol_string_nohtmltag($user->signature):'') {
/* not available on all object $datenextexpiration='';
/'__FIRSTNAME__'=>(is_object($object)?$object->firstname:''), foreach($object->lines as $line)
'__LASTNAME__'=>(is_object($object)?$object->lastname:''), {
'__FULLNAME__'=>(is_object($object)?$object->getFullName($langs):''), if ($line->statut != 4) continue;
'__ADDRESS__'=>(is_object($object)?$object->address:''), if ($line->date_fin_prevue > $datenextexpiration) $datenextexpiration = $line->date_fin_prevue;
'__ZIP__'=>(is_object($object)?$object->zip:''), }
'__TOWN_'=>(is_object($object)?$object->town:''), $substitutionarray['__CONTRACT_NEXT_EXPIRATION_DATE__'] = dol_print_date($datenextexpiration, 'dayrfc');
'__COUNTRY__'=>(is_object($object)?$object->country:''), $substitutionarray['__CONTRACT_NEXT_EXPIRATION_DATETIME__'] = dol_print_date($datenextexpiration, 'standard');
*/ }
);
$parameters=array('mode'=>'formemail');
complete_substitutions_array($substitutionarray, $langs, $object, $parameters);
$subject=make_substitutions($subject, $substitutionarray); $subject=make_substitutions($subject, $substitutionarray);
$message=make_substitutions($message, $substitutionarray); $message=make_substitutions($message, $substitutionarray);

View File

@ -359,13 +359,14 @@ class FormMail extends Form
// Substitution array // Substitution array
if (! empty($this->withsubstit)) if (! empty($this->withsubstit))
{ {
$out.= '<tr><td colspan="2">'; $out.= '<tr><td colspan="2" align="right">';
$help=""; $help="";
foreach($this->substit as $key => $val) foreach($this->substit as $key => $val)
{ {
$help.=$key.' -> '.$langs->trans($val).'<br>'; $help.=$key.' -> '.$langs->trans(dol_string_nohtmltag($val)).'<br>';
} }
$out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $help); if (is_numeric($this->withsubstit)) $out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $help, 1, 'help', '', 0, 2, 'substittooltip'); // Old usage
else $out.= $form->textwithpicto($langs->trans($this->withsubstit), $help, 1, 'help', '', 0, 2, 'substittooltip'); // New usage
$out.= "</td></tr>\n"; $out.= "</td></tr>\n";
} }
@ -997,17 +998,19 @@ class FormMail extends Form
/** /**
* Set substit array from object * Set substit array from object. This is call when suggesting the email template into forms to send email.
* TODO Replace with getCommonSubstitutionArray with param onlykey = 2
* *
* @param CommonObject $object Object to use * @param CommonObject $object Object to use
* @param Translate $outputlangs Object lang * @param Translate $outputlangs Object lang
* @return void * @return void
* @see getCommonSubstitutionArray
*/ */
function setSubstitFromObject($object, $outputlangs=null) function setSubstitFromObject($object, $outputlangs=null)
{ {
global $conf, $user; global $conf, $user;
$this->substit['__REF__'] = $object->ref; $this->substit['__REF__'] = $object->ref;
$this->substit['__REFCLIENT__'] = isset($object->ref_client) ? $object->ref_client : ''; $this->substit['__REFCLIENT__'] = isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : '');
$this->substit['__REFSUPPLIER__'] = isset($object->ref_supplier) ? $object->ref_supplier : ''; $this->substit['__REFSUPPLIER__'] = isset($object->ref_supplier) ? $object->ref_supplier : '';
$this->substit['__DATE_YMD__'] = isset($object->date) ? dol_print_date($object->date, 'day', 0, $outputlangs) : ''; $this->substit['__DATE_YMD__'] = isset($object->date) ? dol_print_date($object->date, 'day', 0, $outputlangs) : '';
@ -1027,7 +1030,7 @@ class FormMail extends Form
$this->substit['__PERSONALIZED__'] = ''; $this->substit['__PERSONALIZED__'] = '';
$this->substit['__CONTACTCIVNAME__'] = ''; // Will be replace just before sending $this->substit['__CONTACTCIVNAME__'] = ''; // Will be replace just before sending
// Create dinamic tags for __EXTRAFIELD_FIELD__ // Create dynamic tags for __EXTRAFIELD_FIELD__
$extrafields = new ExtraFields($this->db); $extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element, true); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element, true);
$object->fetch_optionals($object->id, $extralabels); $object->fetch_optionals($object->id, $extralabels);
@ -1035,7 +1038,7 @@ class FormMail extends Form
$this->substit['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key]; $this->substit['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key];
} }
//Fill substit_lines with each object lines content // Fill substit_lines with each object lines content
if (is_array($object->lines)) if (is_array($object->lines))
{ {
foreach ($object->lines as $line) foreach ($object->lines as $line)
@ -1073,13 +1076,14 @@ class FormMail extends Form
} }
/** /**
* Get list of substition keys available for emails. * Get list of substitution keys available for emails.
* This include the complete_substitutions_array. TODO Include the getCommonSubstitutionArray(). * This include the complete_substitutions_array.
* *
* @param string $mode 'formemail', 'formemailwithlines', 'formemailforlines', 'emailing', ... * @param string $mode 'formemail', 'formemailwithlines', 'formemailforlines', 'emailing', ...
* @param Object $object Object if applicable
* @return array Array of substitution values for emails. * @return array Array of substitution values for emails.
*/ */
static function getAvailableSubstitKey($mode='formemail') static function getAvailableSubstitKey($mode='formemail', $object=null)
{ {
global $conf, $langs; global $conf, $langs;
@ -1088,20 +1092,20 @@ class FormMail extends Form
if ($mode == 'formemail' || $mode == 'formemailwithlines' || $mode == 'formemailforlines') if ($mode == 'formemail' || $mode == 'formemailwithlines' || $mode == 'formemailforlines')
{ {
$vars=array( $vars=array(
'__REF__', '__REF__'=>'__REF__',
'__REFCLIENT__', '__REFCLIENT__'=>'__REFCLIENT__',
'__REFSUPPLIER__', '__REFSUPPLIER__'=>'__REFSUPPLIER__',
'__THIRDPARTY_ID__', '__THIRDPARTY_ID__'=>'__THIRDPARTY_ID__',
'__THIRDPARTY_NAME__', '__THIRDPARTY_NAME__'=>'__THIRDPARTY_NAME__',
'__PROJECT_ID__', '__PROJECT_ID__'=>'__PROJECT_ID__',
'__PROJECT_REF__', '__PROJECT_REF__'=>'__PROJECT_REF__',
'__PROJECT_NAME__', '__PROJECT_NAME__'=>'__PROJECT_NAME__',
'__CONTACTCIVNAME__', '__CONTACTCIVNAME__'=>'__CONTACTCIVNAME__',
'__AMOUNT__', '__AMOUNT__'=>'__AMOUNT__',
'__AMOUNT_WO_TAX__', '__AMOUNT_WO_TAX__'=>'__AMOUNT_WO_TAX__',
'__AMOUNT_VAT__', '__AMOUNT_VAT__'=>'__AMOUNT_VAT__',
'__PERSONALIZED__', // Paypal link will be added here in form mode '__PERSONALIZED__'=>'__PERSONALIZED__', // Paypal link will be added here in form mode
'__SIGNATURE__', '__SIGNATURE__'=>'__SIGNATURE__',
); );
if ($mode == 'formwithlines') if ($mode == 'formwithlines')
{ {
@ -1179,7 +1183,7 @@ class FormMail extends Form
} }
$parameters=array('mode'=>$mode); $parameters=array('mode'=>$mode);
$tmparray=getCommonSubstitutionArray($langs); $tmparray=getCommonSubstitutionArray($langs, 0, null, $object);
complete_substitutions_array($tmparray, $langs, null, $parameters); complete_substitutions_array($tmparray, $langs, null, $parameters);
foreach($tmparray as $key => $val) foreach($tmparray as $key => $val)
{ {

View File

@ -5186,25 +5186,32 @@ function dol_concatdesc($text1,$text2,$forxml=false)
/** /**
* Return array of possible common substitutions. * Return array of possible common substitutions. This includes several families like: 'system', 'mycompany', 'object', 'objectamount', 'date', 'user'
* *
* @param Translate $outputlangs Output language * @param Translate $outputlangs Output language
* @param int $onlykey Do not calculate heavy values of keys (performance enhancement when we need only the keys) * @param int $onlykey 1=Do not calculate some heavy values of keys (performance enhancement when we need only the keys), 2=Values are trunc and html sanitized (to use for help tooltip)
* @param array $exclude Array of family keys we want to exclude. For example array('mycompany', 'objectamount', 'date', 'user', ...) * @param array $exclude Array of family keys we want to exclude. For example array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...)
* @param Object $object Object for keys on object * @param Object $object Object for keys on object
* @return array Array of substitutions * @return array Array of substitutions
* @see setSubstitFromObject
*/ */
function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null) function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
{ {
global $conf, $mysoc, $user; global $db, $conf, $mysoc, $user;
$substitutionarray=array(); $substitutionarray=array();
if (empty($exclude) || ! in_array('system', $exclude))
{
$substitutionarray=array_merge($substitutionarray, array(
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT
));
}
if (empty($exclude) || ! in_array('mycompany', $exclude)) if (empty($exclude) || ! in_array('mycompany', $exclude))
{ {
$substitutionarray=array_merge($substitutionarray, array( $substitutionarray=array_merge($substitutionarray, array(
'__MYCOMPANY_NAME__' => $mysoc->name, '__MYCOMPANY_NAME__' => $mysoc->name,
'__MYCOMPANY_EMAIL__' => $mysoc->email, '__MYCOMPANY_EMAIL__' => $mysoc->email,
'__MYCOMPANY_PROFID1__' => $mysoc->idprof1, '__MYCOMPANY_PROFID1__' => $mysoc->idprof1,
'__MYCOMPANY_PROFID2__' => $mysoc->idprof2, '__MYCOMPANY_PROFID2__' => $mysoc->idprof2,
'__MYCOMPANY_PROFID3__' => $mysoc->idprof3, '__MYCOMPANY_PROFID3__' => $mysoc->idprof3,
@ -5215,17 +5222,42 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
'__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id '__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id
)); ));
} }
if (is_object($object) && (empty($exclude) || ! in_array('object', $exclude)))
{
$substitutionarray['__ID__'] = $object->id;
$substitutionarray['__REF__'] = $object->ref;
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : ''));
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : '');
$substitutionarray['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:'');
$substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty)?$object->thirdparty->name:'');
$substitutionarray['__PROJECT_ID__'] = (is_object($object->projet)?$object->projet->id:'');
$substitutionarray['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
$substitutionarray['__PROJECT_NAME__'] = (is_object($object->projet)?$object->projet->title:'');
// Create dynamic tags for __EXTRAFIELD_FIELD__
if ($object->table_element && $object->id > 0)
{
$extrafieldstmp = new ExtraFields($db);
$extralabels = $extrafieldstmp->fetch_name_optionals_label($object->table_element, true);
$object->fetch_optionals($object->id, $extralabels);
foreach ($extrafieldstmp->attribute_label as $key => $label) {
$substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key];
}
}
}
if (empty($exclude) || ! in_array('objectamount', $exclude)) if (empty($exclude) || ! in_array('objectamount', $exclude))
{ {
if (is_object($object)) // For backward compatibility $substitutionarray['__DATE_YMD__'] = is_object($object)?(isset($object->date) ? dol_print_date($object->date, 'day', 0, $outputlangs) : '') : '';
{ $substitutionarray['__DATE_DUE_YMD__'] = is_object($object)?(isset($object->date_lim_reglement)? dol_print_date($object->date_lim_reglement, 'day', 0, $outputlangs) : '') : '';
$substitutionarray['__TOTAL_TTC__'] =is_object($object)?$object->total_ttc:''; $substitutionarray['__AMOUNT__'] = is_object($object)?$object->total_ttc:'';
$substitutionarray['__TOTAL_HT__'] =is_object($object)?$object->total_ht:''; $substitutionarray['__AMOUNT_WO_TAX__']= is_object($object)?$object->total_ht:'';
$substitutionarray['__TOTAL_VAT__'] =is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):''; $substitutionarray['__AMOUNT_VAT__'] = is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):'';
} // For backward compatibility
$substitutionarray['__AMOUNT__'] =is_object($object)?$object->total_ttc:''; $substitutionarray['__TOTAL_TTC__'] = is_object($object)?$object->total_ttc:'';
$substitutionarray['__AMOUNT_WO_TAX__']=is_object($object)?$object->total_ht:''; $substitutionarray['__TOTAL_HT__'] = is_object($object)?$object->total_ht:'';
$substitutionarray['__AMOUNT_VAT__'] =is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):''; $substitutionarray['__TOTAL_VAT__'] = is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):'';
} }
if (empty($exclude) || ! in_array('date', $exclude)) if (empty($exclude) || ! in_array('date', $exclude))
@ -5265,7 +5297,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
'__USER_LASTNAME__' => $user->lastname, '__USER_LASTNAME__' => $user->lastname,
'__USER_FIRSTNAME__' => $user->firstname, '__USER_FIRSTNAME__' => $user->firstname,
'__USER_FULLNAME__' => $user->getFullName($outputlangs), '__USER_FULLNAME__' => $user->getFullName($outputlangs),
'__USER_SUPERVISOR_ID__' => $user->fk_user '__USER_SUPERVISOR_ID__' => $user->fk_user,
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($user->signature), 30) : $user->signature) : '')
)); ));
} }
if (! empty($conf->multicompany->enabled)) if (! empty($conf->multicompany->enabled))

View File

@ -2484,10 +2484,11 @@ else
$formmail->withbody=1; $formmail->withbody=1;
$formmail->withdeliveryreceipt=1; $formmail->withdeliveryreceipt=1;
$formmail->withcancel=1; $formmail->withcancel=1;
// Tableau des substitutions // Array of substitutions
//$formmail->setSubstitFromObject($object); $formmail->withsubstit='AvailableVariables';
$formmail->substit['__THIRDPARTY_NAME__']=$object->name; $formmail->setSubstitFromObject($object);
$formmail->substit['__SIGNATURE__']=$user->signature; $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__']=''; $formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']=''; $formmail->substit['__CONTACTCIVNAME__']='';