FIX substitution of vars in donation templates
This commit is contained in:
parent
1ddbaf1181
commit
a452dfb596
5 changed files with 22 additions and 35 deletions
|
|
@ -10800,7 +10800,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
|||
*/
|
||||
function make_substitutions($text, $substitutionarray, $outputlangs = null, $converttextinhtmlifnecessary = 0)
|
||||
{
|
||||
global $conf, $db, $langs;
|
||||
global $db, $langs;
|
||||
|
||||
if (!is_array($substitutionarray)) {
|
||||
return 'ErrorBadParameterSubstitutionArrayWhenCalling_make_substitutions';
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@
|
|||
<td>
|
||||
<font size="+1"><b>Nom ou dénomination :</b></font><br>
|
||||
__MAIN_INFO_SOCIETE_NOM__<br>
|
||||
<font size="+1"><b>Adresse :</b></font><br>
|
||||
<font size="+1"><b>__(Address)__ :</b></font><br>
|
||||
__MAIN_INFO_SOCIETE_ADDRESS__<br>
|
||||
<font size="+1">Code postal </font> __MAIN_INFO_SOCIETE_ZIP__ <font size="+1">Commune </font> __MAIN_INFO_SOCIETE_TOWN__<br>
|
||||
<font size="+1"><b>__(Zip)__ </b></font> __MAIN_INFO_SOCIETE_ZIP__ <font size="+1"><b>__(Town)__ </b></font> __MAIN_INFO_SOCIETE_TOWN__<br>
|
||||
<font size="+1"><b>Objet:</b></font><br>
|
||||
__MAIN_INFO_SOCIETE_OBJECT__
|
||||
</td>
|
||||
|
|
@ -195,7 +195,7 @@
|
|||
<td>
|
||||
<font size="+1"><b>Adresse :</b></font><br>
|
||||
__DONATOR_ADDRESS__<br>
|
||||
<font size="+1"><b>Code postal </b></font> __DONATOR_ZIP__ <font size="+1"><b>Commune </b></font> __DONATOR_TOWN__
|
||||
<font size="+1"><b>__(Zip)__ </b></font> __DONATOR_ZIP__ <font size="+1"><b>__(Town)__ </b></font> __DONATOR_TOWN__
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -152,7 +152,9 @@ class html_cerfafr extends ModeleDon
|
|||
|
||||
// Define contents
|
||||
$donmodel = DOL_DOCUMENT_ROOT."/core/modules/dons/html_cerfafr.html";
|
||||
$form = implode('', file($donmodel));
|
||||
|
||||
$form = file_get_contents($donmodel);
|
||||
|
||||
$form = str_replace('__REF__', (string) $don->id, $form);
|
||||
$form = str_replace('__DATE__', dol_print_date($don->date, 'day', false, $outputlangs), $form);
|
||||
//$form = str_replace('__IP__',$user->ip,$form); // TODO $user->ip not exist
|
||||
|
|
@ -161,39 +163,24 @@ class html_cerfafr extends ModeleDon
|
|||
$form = str_replace('__CURRENCY__', $outputlangs->transnoentitiesnoconv("Currency".$currency), $form);
|
||||
$form = str_replace('__CURRENCYCODE__', $conf->currency, $form);
|
||||
$form = str_replace('__MAIN_INFO_SOCIETE_NOM__', $mysoc->name, $form);
|
||||
$form = str_replace('__MAIN_INFO_SOCIETE_ADDRESS__', $mysoc->address, $form);
|
||||
$form = str_replace('__MAIN_INFO_SOCIETE_ZIP__', $mysoc->zip, $form);
|
||||
$form = str_replace('__MAIN_INFO_SOCIETE_TOWN__', $mysoc->town, $form);
|
||||
$form = str_replace('__MAIN_INFO_SOCIETE_ADDRESS__', (string) $mysoc->address, $form);
|
||||
$form = str_replace('__MAIN_INFO_SOCIETE_ZIP__', (string) $mysoc->zip, $form);
|
||||
$form = str_replace('__MAIN_INFO_SOCIETE_TOWN__', (string) $mysoc->town, $form);
|
||||
$form = str_replace('__MAIN_INFO_SOCIETE_OBJECT__', $mysoc->socialobject, $form);
|
||||
$form = str_replace('__DONATOR_FIRSTNAME__', $don->firstname, $form);
|
||||
$form = str_replace('__DONATOR_LASTNAME__', $don->lastname, $form);
|
||||
$form = str_replace('__DONATOR_SOCIETE__', $don->societe, $form);
|
||||
$form = str_replace('__DONATOR_FIRSTNAME__', (string) $don->firstname, $form);
|
||||
$form = str_replace('__DONATOR_LASTNAME__', (string) $don->lastname, $form);
|
||||
$form = str_replace('__DONATOR_SOCIETE__', (string) $don->societe, $form);
|
||||
$form = str_replace('__DONATOR_STATUT__', (string) $don->statut, $form);
|
||||
$form = str_replace('__DONATOR_ADDRESS__', $don->address, $form);
|
||||
$form = str_replace('__DONATOR_ZIP__', $don->zip, $form);
|
||||
$form = str_replace('__DONATOR_TOWN__', $don->town, $form);
|
||||
$form = str_replace('__DONATOR_ADDRESS__', (string) $don->address, $form);
|
||||
$form = str_replace('__DONATOR_ZIP__', (string) $don->zip, $form);
|
||||
$form = str_replace('__DONATOR_TOWN__', (string) $don->town, $form);
|
||||
$form = str_replace('__PAYMENTMODE_LIB__ ', (string) $paymentmode, $form);
|
||||
$form = str_replace('__NOW__', dol_print_date($now, 'day', false, $outputlangs), $form);
|
||||
$form = str_replace('__DonationRef__', $outputlangs->trans("DonationRef"), $form);
|
||||
$form = str_replace('__DonationTitle__', $outputlangs->trans("DonationTitle"), $form);
|
||||
$form = str_replace('__DonationReceipt__', $outputlangs->trans("DonationReceipt"), $form);
|
||||
$form = str_replace('__DonationRecipient__', $outputlangs->trans("DonationRecipient"), $form);
|
||||
$form = str_replace('__DonationDatePayment__', $outputlangs->trans("DonationDatePayment"), $form);
|
||||
$form = str_replace('__PaymentMode__', $outputlangs->trans("PaymentMode"), $form);
|
||||
// $form = str_replace('__CodeDon__',$CodeDon,$form);
|
||||
$form = str_replace('__Name__', $outputlangs->trans("Name"), $form);
|
||||
$form = str_replace('__Address__', $outputlangs->trans("Address"), $form);
|
||||
$form = str_replace('__Zip__', $outputlangs->trans("Zip"), $form);
|
||||
$form = str_replace('__Town__', $outputlangs->trans("Town"), $form);
|
||||
$form = str_replace('__Object__', $outputlangs->trans("Object"), $form);
|
||||
$form = str_replace('__Donor__', $outputlangs->trans("Donor"), $form);
|
||||
$form = str_replace('__Date__', $outputlangs->trans("Date"), $form);
|
||||
$form = str_replace('__Signature__', $outputlangs->trans("Signature"), $form);
|
||||
$form = str_replace('__Message__', $outputlangs->trans("Message"), $form);
|
||||
$form = str_replace('__IConfirmDonationReception__', $outputlangs->trans("IConfirmDonationReception"), $form);
|
||||
$form = str_replace('__DonationMessage__', $conf->global->DONATION_MESSAGE, $form);
|
||||
$form = str_replace('__DONATION_PAYMENT_MODE__', $ModePaiement, $form);
|
||||
$form = str_replace('__DONATION_MESSAGE__', getDolGlobalString('DONATION_MESSAGE'), $form);
|
||||
|
||||
$form = str_replace('__ModePaiement__', $ModePaiement, $form);
|
||||
// Replace with a generic replacement feature '__(XXX)__' must become $outputlangs->trans('XXX')
|
||||
$form = make_substitutions($form, array(), $outputlangs);
|
||||
|
||||
$frencharticle = '';
|
||||
if (preg_match('/fr/i', $outputlangs->defaultlang)) {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,6 @@
|
|||
<p><span class="label">__PaymentMode__:</span> __PAYMENTMODE_LABEL__</p>
|
||||
<p><span class="label">__Amount__:</span> __AMOUNT__ __CURRENCY_CODE__</p>
|
||||
__NOTE_PUBLIC__
|
||||
__DONATION_MESAGE__
|
||||
__DONATION_MESSAGE__
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ class html_generic extends ModeleDon
|
|||
if (getDolGlobalString('DONATION_MESSAGE')) {
|
||||
$donationMessage = '<div id="donation-message"><p>' . getDolGlobalString('DONATION_MESSAGE').'</p></div>';
|
||||
}
|
||||
$form = str_replace('__DONATION_MESAGE__', $donationMessage, $form);
|
||||
$form = str_replace('__DONATION_MESSAGE__', $donationMessage, $form);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue