Fix substitution in public notes of pdf

This commit is contained in:
Laurent Destailleur 2018-01-21 20:53:36 +01:00
parent dfc7d47747
commit 3987033aab
8 changed files with 45 additions and 16 deletions

View File

@ -5620,10 +5620,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
}
/**
* Make substition into a text string, replacing keys with vals from $substitutionarray (oldval=>newval).
* Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newval).
* Texts like __(TranslationKey|langfile)__ and __[ConstantKey]__ are also replaced
*
* @param string $text Source string in which we must do substitution
* @param array $substitutionarray Array with key->val to substitute. Example: array('__MYKEY__' => 'MyVal')
* @param array $substitutionarray Array with key->val to substitute. Example: array('__MYKEY__' => 'MyVal', ...)
* @param Translate $outputlangs Output language
* @return string Output string after substitutions
* @see complete_substitutions_array

View File

@ -348,6 +348,10 @@ class pdf_einstein extends ModelePDFCommandes
}
if ($notetoshow)
{
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$tab_top = 88 + $height_incoterms;
$pdf->SetFont('','', $default_font_size - 1);

View File

@ -262,10 +262,14 @@ class pdf_standard extends ModeleExpenseReport
}
if ($notetoshow)
{
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$tab_top = 95;
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxpiece-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
$pdf->writeHTMLCell(190, 3, $this->posxpiece-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
$nexY = $pdf->GetY();
$height_note=$nexY-$tab_top;
@ -299,7 +303,7 @@ class pdf_standard extends ModeleExpenseReport
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1);
// Accountancy piece
$pdf->SetXY($this->posxpiece, $curY);
$pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-0.8, 4, $this->posxpiece-1, $curY, $piece_comptable, 0, 1);
@ -327,7 +331,7 @@ class pdf_standard extends ModeleExpenseReport
$pdf->MultiCell($nextColumnPosX-$this->posxtype-0.8, 4, dol_trunc($outputlangs->transnoentities($object->lines[$i]->type_fees_code), 12), 0, 'C');
// Project
if (! empty($conf->projet->enabled))
if (! empty($conf->projet->enabled))
{
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxprojet, $curY);
@ -429,7 +433,7 @@ class pdf_standard extends ModeleExpenseReport
}
$pdf->SetFont('','', 10);
// Show total area box
$posy=$bottomlasttab+5;
$pdf->SetXY(100, $posy);
@ -475,7 +479,7 @@ class pdf_standard extends ModeleExpenseReport
@chmod($file, octdec($conf->global->MAIN_UMASK));
$this->result = array('fullpath'=>$file);
return 1; // Pas d'erreur
}
else
@ -585,7 +589,7 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetFont('','B', $default_font_size + 2);
$pdf->SetTextColor(111,81,124);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $object->getLibStatut(0), '', 'R');
if ($showaddress)
{
// Sender properties
@ -731,7 +735,7 @@ class pdf_standard extends ModeleExpenseReport
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='')
{
global $conf;
// Force to disable hidetop and hidebottom
$hidebottom=0;
if ($hidetop) $hidetop=-1;
@ -789,7 +793,7 @@ class pdf_standard extends ModeleExpenseReport
$pdf->MultiCell($this->posxprojet-$this->posxtype - 1, 2, $outputlangs->transnoentities("Type"), '', 'C');
}
if (!empty($conf->projet->enabled))
if (!empty($conf->projet->enabled))
{
// Project
$pdf->line($this->posxprojet - 1, $tab_top, $this->posxprojet - 1, $tab_top + $tab_height);

View File

@ -382,6 +382,10 @@ class pdf_crabe extends ModelePDFFactures
}
if ($notetoshow)
{
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$tab_top = 88 + $height_incoterms;
$pdf->SetFont('','', $default_font_size - 1);

View File

@ -211,6 +211,10 @@ class pdf_soleil extends ModelePDFFicheinter
$notetoshow=empty($object->note_public)?'':$object->note_public;
if ($notetoshow)
{
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$tab_top = 88;
$pdf->SetFont('','', $default_font_size - 1);
@ -401,7 +405,7 @@ class pdf_soleil extends ModelePDFFicheinter
@chmod($file, octdec($conf->global->MAIN_UMASK));
$this->result = array('fullpath'=>$file);
return 1;
}
else

View File

@ -287,6 +287,10 @@ class pdf_standard extends ModelePDFProduct
}
if ($notetoshow)
{
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$tab_top = 88;
$pdf->SetFont('','', $default_font_size - 1);
@ -540,7 +544,7 @@ class pdf_standard extends ModelePDFProduct
@chmod($file, octdec($conf->global->MAIN_UMASK));
$this->result = array('fullpath'=>$file);
return 1; // Pas d'erreur
}
else

View File

@ -388,6 +388,10 @@ class pdf_azur extends ModelePDFPropales
}
if ($notetoshow)
{
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$tab_top = 88 + $height_incoterms;
$pdf->SetFont('','', $default_font_size - 1);

View File

@ -314,6 +314,10 @@ class pdf_aurore extends ModelePDFSupplierProposal
}
if ($notetoshow)
{
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$tab_top = 88;
$pdf->SetFont('','', $default_font_size - 1);
@ -380,11 +384,11 @@ class pdf_aurore extends ModelePDFSupplierProposal
$curX = $this->posxdesc-1;
$pdf->startTransaction();
if ($posYAfterImage > 0)
if ($posYAfterImage > 0)
{
$descWidth = $this->posxpicture-$curX;
}
else
}
else
{
$descWidth = $this->posxtva-$curX;
}
@ -606,7 +610,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
@chmod($file, octdec($conf->global->MAIN_UMASK));
$this->result = array('fullpath'=>$file);
return 1; // Pas d'erreur
}
else