Clean code

This commit is contained in:
Laurent Destailleur 2026-01-29 09:56:10 +01:00
parent aa451769ce
commit 183451c607
3 changed files with 20 additions and 8 deletions

View file

@ -229,8 +229,10 @@ if (empty($reshook)) {
}
if (!$error) {
global $dolibarr_main_url_root;
// List of values to scan for a replacement
$substitutionarray = array(
// old
'%LOGIN%' => $user->login,
'%COMPANY%' => $mysoc->name,
'%ADDRESS%' => $mysoc->address,
@ -243,7 +245,21 @@ if (empty($reshook)) {
'%MONTH%' => $month,
'%DAY%' => $day,
'%DOL_MAIN_URL_ROOT%' => DOL_MAIN_URL_ROOT,
'%SERVER%' => "http://".$_SERVER["SERVER_NAME"]."/",
'%SERVER%' => $dolibarr_main_url_root,
// new
'__LOGIN__' => $user->login,
'__COMPANY__' => $mysoc->name,
'__ADDRESS__' => $mysoc->address,
'__ZIP__' => $mysoc->zip,
'__TOWN__' => $mysoc->town,
'__COUNTRY__' => $mysoc->country,
'__COUNTRY_CODE__' => $mysoc->country_code,
'__EMAIL__' => $mysoc->email,
'__YEAR__' => $year,
'__MONTH__' => $month,
'__DAY__' => $day,
'__DOL_MAIN_URL_ROOT__' => DOL_MAIN_URL_ROOT,
'__SERVER__' => $dolibarr_main_url_root,
);
complete_substitutions_array($substitutionarray, $langs);

View file

@ -162,11 +162,11 @@ class html_cerfafr extends ModeleDon
$form = str_replace('__AMOUNTLETTERS__', $this->amountToLetters($don->amount), $form);
$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_NOM__', (string) $mysoc->name, $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('__MAIN_INFO_SOCIETE_OBJECT__', (string) $mysoc->socialobject, $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);

View file

@ -567,7 +567,7 @@ class pdf_standard_supplierpayment extends ModelePDFSuppliersPayments
// City
$pdf->SetXY($this->page_largeur - $this->marge_droite - 30, $posy);
$pdf->MultiCell(150, 4, $mysoc->town, 0, 'L', true);
$pdf->MultiCell(150, 4, (string) $mysoc->town, 0, 'L', true);
$posy += 4;
// Date
@ -607,10 +607,6 @@ class pdf_standard_supplierpayment extends ModelePDFSuppliersPayments
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
/*$titre = strtoupper($mysoc->town).' - '.dol_print_date(dol_now(), 'day', 'tzserver', $outputlangs);
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3) - 60, $tab_top - 6);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);*/
$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);