Prepare PDF templates to use 2 languages for titles
This commit is contained in:
parent
acdb28ba25
commit
4598538b42
@ -1123,7 +1123,7 @@ abstract class CommonDocGenerator
|
|||||||
*/
|
*/
|
||||||
public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
|
public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
|
||||||
{
|
{
|
||||||
global $hookmanager;
|
global $hookmanager, $conf;
|
||||||
|
|
||||||
foreach ($this->cols as $colKey => $colDef) {
|
foreach ($this->cols as $colKey => $colDef) {
|
||||||
$parameters = array(
|
$parameters = array(
|
||||||
@ -1153,6 +1153,14 @@ abstract class CommonDocGenerator
|
|||||||
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
|
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
|
||||||
$textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1];
|
$textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1];
|
||||||
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
|
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
|
||||||
|
|
||||||
|
global $outputlangsbis;
|
||||||
|
if (is_object($outputlangsbis)) {
|
||||||
|
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0] + 4);
|
||||||
|
$textbis = $outputlangsbis->transnoentities($colDef['title']['textkey']);
|
||||||
|
$pdf->MultiCell($textWidth, 2, $textbis, '', $colDef['title']['align']);
|
||||||
|
}
|
||||||
|
|
||||||
$this->tabTitleHeight = max($pdf->GetY() - $tab_top + $colDef['title']['padding'][2], $this->tabTitleHeight);
|
$this->tabTitleHeight = max($pdf->GetY() - $tab_top + $colDef['title']['padding'][2], $this->tabTitleHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -203,6 +203,13 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries"));
|
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries"));
|
||||||
|
|
||||||
|
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
|
||||||
|
global $outputlangsbis;
|
||||||
|
$outputlangsbis = new Translate('', $conf);
|
||||||
|
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
|
||||||
|
$outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries"));
|
||||||
|
}
|
||||||
|
|
||||||
$nblines = count($object->lines);
|
$nblines = count($object->lines);
|
||||||
|
|
||||||
$hidetop=0;
|
$hidetop=0;
|
||||||
@ -1333,7 +1340,9 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||||||
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
||||||
|
|
||||||
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
|
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
|
||||||
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
|
||||||
|
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdf->SetDrawColor(128, 128, 128);
|
$pdf->SetDrawColor(128, 128, 128);
|
||||||
@ -1458,7 +1467,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||||||
$pdf->SetTextColor(0, 0, 60);
|
$pdf->SetTextColor(0, 0, 60);
|
||||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get contact
|
// Get contact
|
||||||
if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP))
|
if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -168,6 +168,13 @@ class pdf_espadon extends ModelePdfExpedition
|
|||||||
// Load traductions files required by page
|
// Load traductions files required by page
|
||||||
$outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch"));
|
$outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch"));
|
||||||
|
|
||||||
|
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
|
||||||
|
global $outputlangsbis;
|
||||||
|
$outputlangsbis = new Translate('', $conf);
|
||||||
|
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
|
||||||
|
$outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch"));
|
||||||
|
}
|
||||||
|
|
||||||
$nblines = count($object->lines);
|
$nblines = count($object->lines);
|
||||||
|
|
||||||
// Loop on each lines to detect if there is at least one image to show
|
// Loop on each lines to detect if there is at least one image to show
|
||||||
@ -781,7 +788,9 @@ class pdf_espadon extends ModelePdfExpedition
|
|||||||
if (empty($hidetop))
|
if (empty($hidetop))
|
||||||
{
|
{
|
||||||
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
|
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
|
||||||
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
|
||||||
|
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdf->SetDrawColor(128, 128, 128);
|
$pdf->SetDrawColor(128, 128, 128);
|
||||||
|
|||||||
@ -212,7 +212,7 @@ class pdf_sponge extends ModelePDFFactures
|
|||||||
global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
|
global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
|
||||||
|
|
||||||
dol_syslog("write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null'));
|
dol_syslog("write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null'));
|
||||||
|
|
||||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||||
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
|
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
|
||||||
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
|
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
|
||||||
@ -220,6 +220,13 @@ class pdf_sponge extends ModelePDFFactures
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies"));
|
$outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies"));
|
||||||
|
|
||||||
|
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
|
||||||
|
global $outputlangsbis;
|
||||||
|
$outputlangsbis = new Translate('', $conf);
|
||||||
|
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
|
||||||
|
$outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies"));
|
||||||
|
}
|
||||||
|
|
||||||
$nblines = count($object->lines);
|
$nblines = count($object->lines);
|
||||||
|
|
||||||
$hidetop=0;
|
$hidetop=0;
|
||||||
@ -1780,7 +1787,9 @@ class pdf_sponge extends ModelePDFFactures
|
|||||||
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
||||||
|
|
||||||
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
|
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
|
||||||
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
|
||||||
|
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdf->SetDrawColor(128, 128, 128);
|
$pdf->SetDrawColor(128, 128, 128);
|
||||||
|
|||||||
@ -202,6 +202,13 @@ class pdf_cyan extends ModelePDFPropales
|
|||||||
// Load traductions files required by page
|
// Load traductions files required by page
|
||||||
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));
|
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));
|
||||||
|
|
||||||
|
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
|
||||||
|
global $outputlangsbis;
|
||||||
|
$outputlangsbis = new Translate('', $conf);
|
||||||
|
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
|
||||||
|
$outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));
|
||||||
|
}
|
||||||
|
|
||||||
$nblines = count($object->lines);
|
$nblines = count($object->lines);
|
||||||
|
|
||||||
$hidetop=0;
|
$hidetop=0;
|
||||||
@ -1449,7 +1456,9 @@ class pdf_cyan extends ModelePDFPropales
|
|||||||
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
||||||
|
|
||||||
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
|
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
|
||||||
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
|
||||||
|
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdf->SetDrawColor(128, 128, 128);
|
$pdf->SetDrawColor(128, 128, 128);
|
||||||
@ -1458,7 +1467,6 @@ class pdf_cyan extends ModelePDFPropales
|
|||||||
// Output Rect
|
// Output Rect
|
||||||
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter
|
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter
|
||||||
|
|
||||||
|
|
||||||
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
|
||||||
|
|
||||||
if (empty($hidetop)){
|
if (empty($hidetop)){
|
||||||
|
|||||||
@ -194,6 +194,13 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$outputlangs->loadLangs(array("main", "orders", "companies", "bills", "dict", "products"));
|
$outputlangs->loadLangs(array("main", "orders", "companies", "bills", "dict", "products"));
|
||||||
|
|
||||||
|
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
|
||||||
|
global $outputlangsbis;
|
||||||
|
$outputlangsbis = new Translate('', $conf);
|
||||||
|
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
|
||||||
|
$outputlangsbis->loadLangs(array("main", "orders", "companies", "bills", "dict", "products"));
|
||||||
|
}
|
||||||
|
|
||||||
$nblines = count($object->lines);
|
$nblines = count($object->lines);
|
||||||
|
|
||||||
$hidetop=0;
|
$hidetop=0;
|
||||||
@ -1132,7 +1139,9 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
|||||||
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
||||||
|
|
||||||
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
|
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
|
||||||
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
|
||||||
|
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdf->SetDrawColor(128, 128, 128);
|
$pdf->SetDrawColor(128, 128, 128);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user