Debug the double language feature in pdf
This commit is contained in:
parent
97b0cabb14
commit
770fca0b33
@ -1466,6 +1466,7 @@ abstract class CommonDocGenerator
|
||||
// save curent cell padding
|
||||
$curentCellPaddinds = $pdf->getCellPaddings();
|
||||
|
||||
// Add space for lines (more if we need to show a second alternative language)
|
||||
global $outputlangsbis;
|
||||
if (is_object($outputlangsbis)) {
|
||||
// set cell padding with column title definition
|
||||
@ -1480,8 +1481,8 @@ abstract class CommonDocGenerator
|
||||
$textWidth = $colDef['width'];
|
||||
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
|
||||
|
||||
|
||||
if (is_object($outputlangsbis)) {
|
||||
// Add variant of translation if $outputlangsbis is an object
|
||||
if (is_object($outputlangsbis) && trim($colDef['title']['label'])) {
|
||||
$pdf->setCellPaddings($colDef['title']['padding'][3], 0, $colDef['title']['padding'][1], $colDef['title']['padding'][2]);
|
||||
$pdf->SetXY($colDef['xStartPos'], $pdf->GetY());
|
||||
$textbis = $outputlangsbis->transnoentities($colDef['title']['textkey']);
|
||||
@ -1495,6 +1496,7 @@ abstract class CommonDocGenerator
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->tabTitleHeight;
|
||||
}
|
||||
|
||||
|
||||
@ -1272,7 +1272,15 @@ class pdf_sponge extends ModelePDFFactures
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
$tab2_top = $posy;
|
||||
$outputlangsbis = null;
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
|
||||
$outputlangsbis = new Translate('', $conf);
|
||||
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
|
||||
$outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));
|
||||
$default_font_size--;
|
||||
}
|
||||
|
||||
$tab2_top = $posy;
|
||||
$tab2_hl = 4;
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
|
||||
@ -1287,13 +1295,6 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$useborder = 0;
|
||||
$index = 0;
|
||||
|
||||
$outputlangsbis = null;
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
|
||||
$outputlangsbis = new Translate('', $conf);
|
||||
$outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
|
||||
$outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));
|
||||
}
|
||||
|
||||
// Add trigger to allow to edit $object
|
||||
$parameters = array(
|
||||
'object' => &$object,
|
||||
@ -1708,7 +1709,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
|
||||
$retainedWarrantyToPayOn = $outputlangs->transnoentities("RetainedWarranty").' ('.$object->retained_warranty.'%)';
|
||||
$retainedWarrantyToPayOn = $outputlangs->transnoentities("RetainedWarranty").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("RetainedWarranty") : '').' ('.$object->retained_warranty.'%)';
|
||||
$retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("toPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : '';
|
||||
|
||||
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1);
|
||||
@ -2028,7 +2029,12 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("DateInvoice")." : ".dol_print_date($object->date, "day", false, $outputlangs), '', 'R');
|
||||
|
||||
$title = $outputlangs->transnoentities("DateInvoice");
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
|
||||
$title .= ' - '.$outputlangsbis->transnoentities("DateInvoice");
|
||||
}
|
||||
$pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->date, "day", false, $outputlangs), '', 'R');
|
||||
|
||||
if (!empty($conf->global->INVOICE_POINTOFTAX_DATE))
|
||||
{
|
||||
@ -2043,7 +2049,11 @@ class pdf_sponge extends ModelePDFFactures
|
||||
$posy += 3;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("DateDue")." : ".dol_print_date($object->date_lim_reglement, "day", false, $outputlangs, true), '', 'R');
|
||||
$title = $outputlangs->transnoentities("DateDue");
|
||||
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
|
||||
$title .= ' - '.$outputlangsbis->transnoentities("DateDue");
|
||||
}
|
||||
$pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->date_lim_reglement, "day", false, $outputlangs, true), '', 'R');
|
||||
}
|
||||
|
||||
if ($object->thirdparty->code_client)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user