|
@@ -172,32 +172,32 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
$outputlangs = $langs;
|
|
|
}
|
|
|
// 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)) {
|
|
|
+ if (getDolGlobalInt('MAIN_USE_FPDF')) {
|
|
|
$outputlangs->charset_output = 'ISO-8859-1';
|
|
|
}
|
|
|
|
|
|
// Load translation files required by the page
|
|
|
$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) {
|
|
|
+ if (!empty(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) && $outputlangs->defaultlang != getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) {
|
|
|
global $outputlangsbis;
|
|
|
$outputlangsbis = new Translate('', $conf);
|
|
|
- $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
|
|
|
+ $outputlangsbis->setDefaultLang(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE'));
|
|
|
$outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies"));
|
|
|
}
|
|
|
|
|
|
$nblines = (is_array($object->lines) ? count($object->lines) : 0);
|
|
|
|
|
|
$hidetop = 0;
|
|
|
- if (!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)) {
|
|
|
- $hidetop = $conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE;
|
|
|
+ if (getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE')) {
|
|
|
+ $hidetop = getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE');
|
|
|
}
|
|
|
|
|
|
// Loop on each lines to detect if there is at least one image to show
|
|
|
$realpatharray = array();
|
|
|
$this->atleastonephoto = false;
|
|
|
/*
|
|
|
- if (!empty($conf->global->MAIN_GENERATE_MYOBJECT_WITH_PICTURE))
|
|
|
+ if (getDolGlobalInt('MAIN_GENERATE_MYOBJECT_WITH_PICTURE')))
|
|
|
{
|
|
|
$objphoto = new Product($this->db);
|
|
|
|
|
@@ -285,7 +285,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
|
|
|
$heightforinfotot = 50; // Height reserved to output the info and total part and payment part
|
|
|
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
|
|
|
- $heightforfooter = $this->marge_basse + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 12 : 22); // Height reserved to output the footer (value include bottom margin)
|
|
|
+ $heightforfooter = $this->marge_basse + (getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin)
|
|
|
|
|
|
if (class_exists('TCPDF')) {
|
|
|
$pdf->setPrintHeader(false);
|
|
@@ -294,8 +294,8 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
$pdf->SetFont(pdf_getPDFFont($outputlangs));
|
|
|
|
|
|
// Set path to the background PDF File
|
|
|
- if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
|
|
|
- $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
|
|
|
+ if (getDolGlobalInt('MAIN_ADD_PDF_BACKGROUND')) {
|
|
|
+ $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
|
|
|
$tplidx = $pdf->importPage(1);
|
|
|
}
|
|
|
|
|
@@ -316,7 +316,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
$cert = empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT;
|
|
|
// If user has no certificate, we try to take the company one
|
|
|
if (!$cert) {
|
|
|
- $cert = empty($conf->global->CERTIFICATE_CRT) ? '' : $conf->global->CERTIFICATE_CRT;
|
|
|
+ $cert = getDolGlobalString('CERTIFICATE_CRT') ? '' : getDolGlobalString('CERTIFICATE_CRT');
|
|
|
}
|
|
|
// If a certificate is found
|
|
|
if ($cert) {
|
|
@@ -344,10 +344,10 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
$pdf->SetTextColor(0, 0, 0);
|
|
|
|
|
|
$tab_top = 90 + $top_shift;
|
|
|
- $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
|
|
|
+ $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
|
|
|
$tab_height = 130 - $top_shift;
|
|
|
$tab_height_newpage = 150;
|
|
|
- if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
|
|
+ if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
|
|
|
$tab_height_newpage -= $top_shift;
|
|
|
}
|
|
|
|
|
@@ -391,7 +391,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
if (!empty($tplidx)) {
|
|
|
$pdf->useTemplate($tplidx);
|
|
|
}
|
|
|
- if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
|
|
+ if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
|
|
|
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
|
|
}
|
|
|
// $this->_pagefoot($pdf,$object,$outputlangs,1);
|
|
@@ -449,7 +449,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
if (!empty($tplidx)) {
|
|
|
$pdf->useTemplate($tplidx);
|
|
|
}
|
|
|
- if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
|
|
+ if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
|
|
|
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
|
|
}
|
|
|
$height_note = $posyafter - $tab_top_newpage;
|
|
@@ -471,7 +471,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
if (!empty($tplidx)) {
|
|
|
$pdf->useTemplate($tplidx);
|
|
|
}
|
|
|
- if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
|
|
+ if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
|
|
|
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
|
|
}
|
|
|
|
|
@@ -528,7 +528,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
$curY = $tab_top_newpage;
|
|
|
|
|
|
// Allows data in the first page if description is long enough to break in multiples pages
|
|
|
- if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
|
|
|
+ if (getDolGlobalInt('MAIN_PDF_DATA_ON_FIRST_PAGE')) {
|
|
|
$showpricebeforepagebreak = 1;
|
|
|
} else {
|
|
|
$showpricebeforepagebreak = 0;
|
|
@@ -569,7 +569,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
} else {
|
|
|
// We found a page break
|
|
|
// Allows data in the first page if description is long enough to break in multiples pages
|
|
|
- if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
|
|
|
+ if (getDolGlobalInt('MAIN_PDF_DATA_ON_FIRST_PAGE')) {
|
|
|
$showpricebeforepagebreak = 1;
|
|
|
} else {
|
|
|
$showpricebeforepagebreak = 0;
|
|
@@ -689,7 +689,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
$nexY = max($nexY, $posYAfterImage);
|
|
|
|
|
|
// Add line
|
|
|
- if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
|
|
|
+ if (getDolGlobalInt('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) {
|
|
|
$pdf->setPage($pageposafter);
|
|
|
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
|
|
|
//$pdf->SetDrawColor(190,190,200);
|
|
@@ -709,7 +709,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
$pagenb++;
|
|
|
$pdf->setPage($pagenb);
|
|
|
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
|
|
- if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
|
|
+ if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
|
|
|
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
|
|
}
|
|
|
if (!empty($tplidx)) {
|
|
@@ -730,7 +730,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
$pdf->useTemplate($tplidx);
|
|
|
}
|
|
|
$pagenb++;
|
|
|
- if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
|
|
+ if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
|
|
|
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
|
|
}
|
|
|
}
|
|
@@ -753,7 +753,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
|
|
|
// Display payment area
|
|
|
/*
|
|
|
- if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS))
|
|
|
+ if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && !getDolGlobalInt('INVOICE_NO_PAYMENT_DETAILS')))
|
|
|
{
|
|
|
$posy = $this->drawPaymentsTable($pdf, $object, $posy, $outputlangs);
|
|
|
}
|
|
@@ -842,7 +842,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
|
|
|
if (empty($hidetop)) {
|
|
|
$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
|
|
|
- if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
|
|
|
+ if (getDolGlobalInt('PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
|
|
|
$titre .= ' - '.$outputlangsbis->transnoentities("AmountInCurrency", $outputlangsbis->transnoentitiesnoconv("Currency".$currency));
|
|
|
}
|
|
|
|
|
@@ -850,8 +850,8 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
|
|
|
|
|
//$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, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
|
|
+ if (getDolGlobalString('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(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -937,7 +937,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
$pdf->SetXY($posx, $posy);
|
|
|
$pdf->SetTextColor(0, 0, 60);
|
|
|
$title = $outputlangs->transnoentities("PdfTitle");
|
|
|
- if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
|
|
|
+ if (!empty(getDolGlobalInt('MAIN_ODT_AS_PDF')) && is_object($outputlangsbis)) {
|
|
|
$title .= ' - ';
|
|
|
$title .= $outputlangsbis->transnoentities("PdfTitle");
|
|
|
}
|
|
@@ -965,7 +965,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
|
|
|
}
|
|
|
|
|
|
- if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) {
|
|
|
+ if (getDolGlobalInt('PDF_SHOW_PROJECT_TITLE')) {
|
|
|
$object->fetch_projet();
|
|
|
if (!empty($object->project->ref)) {
|
|
|
$posy += 3;
|
|
@@ -975,7 +975,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (!empty($conf->global->PDF_SHOW_PROJECT)) {
|
|
|
+ if (getDolGlobalInt('PDF_SHOW_PROJECT')) {
|
|
|
$object->fetch_projet();
|
|
|
if (!empty($object->project->ref)) {
|
|
|
$outputlangs->load("projects");
|
|
@@ -991,7 +991,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
$pdf->SetTextColor(0, 0, 60);
|
|
|
|
|
|
$title = $outputlangs->transnoentities("Date");
|
|
|
- if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
|
|
|
+ if (getDolGlobalInt('PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
|
|
|
$title .= ' - '.$outputlangsbis->transnoentities("Date");
|
|
|
}
|
|
|
$pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->date, "day", false, $outputlangs), '', 'R');
|
|
@@ -1004,7 +1004,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
}
|
|
|
|
|
|
// Get contact
|
|
|
- if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) {
|
|
|
+ if (getDolGlobalInt('DOC_SHOW_FIRST_SALES_REP')) {
|
|
|
$arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
|
|
|
if (count($arrayidcontact) > 0) {
|
|
|
$usertmp = new User($this->db);
|
|
@@ -1031,15 +1031,15 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
|
|
|
|
|
// Show sender
|
|
|
- $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
|
|
|
+ $posy = getDolGlobalInt('MAIN_PDF_USE_ISO_LOCATION') ? 40 : 42;
|
|
|
$posy += $top_shift;
|
|
|
$posx = $this->marge_gauche;
|
|
|
- if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
|
|
|
+ if (getDolGlobalInt('MAIN_INVERT_SENDER_RECIPIENT')) {
|
|
|
$posx = $this->page_largeur - $this->marge_droite - 80;
|
|
|
}
|
|
|
|
|
|
- $hautcadre = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40;
|
|
|
- $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
|
|
|
+ $hautcadre = getDolGlobalInt('MAIN_PDF_USE_ISO_LOCATION') ? 38 : 40;
|
|
|
+ $widthrecbox = getDolGlobalInt('MAIN_PDF_USE_ISO_LOCATION') ? 92 : 82;
|
|
|
|
|
|
|
|
|
// Show sender frame
|
|
@@ -1085,14 +1085,14 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);
|
|
|
|
|
|
// Show recipient
|
|
|
- $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
|
|
|
+ $widthrecbox = getDolGlobalInt('MAIN_PDF_USE_ISO_LOCATION') ? 92 : 100;
|
|
|
if ($this->page_largeur < 210) {
|
|
|
$widthrecbox = 84; // To work with US executive format
|
|
|
}
|
|
|
- $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
|
|
|
+ $posy = getDolGlobalInt('MAIN_PDF_USE_ISO_LOCATION') ? 40 : 42;
|
|
|
$posy += $top_shift;
|
|
|
$posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
|
|
|
- if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
|
|
|
+ if (getDolGlobalInt('MAIN_INVERT_SENDER_RECIPIENT')) {
|
|
|
$posx = $this->marge_gauche;
|
|
|
}
|
|
|
|
|
@@ -1133,7 +1133,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
|
|
|
{
|
|
|
global $conf;
|
|
|
- $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
|
|
|
+ $showdetails = !getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 0 : getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS');
|
|
|
return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
|
|
|
}
|
|
|
|
|
@@ -1203,7 +1203,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
$rank = $rank + 10;
|
|
|
$this->cols['photo'] = array(
|
|
|
'rank' => $rank,
|
|
|
- 'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH), // in mm
|
|
|
+ 'width' => (!getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH') ? 20 : getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH')), // in mm
|
|
|
'status' => false,
|
|
|
'title' => array(
|
|
|
'textkey' => 'Photo',
|
|
@@ -1215,7 +1215,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
'border-left' => false, // remove left line separator
|
|
|
);
|
|
|
|
|
|
- if (!empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE) && !empty($this->atleastonephoto)) {
|
|
|
+ if (getDolGlobalInt('MAIN_GENERATE_INVOICES_WITH_PICTURE') && !empty($this->atleastonephoto)) {
|
|
|
$this->cols['photo']['status'] = true;
|
|
|
}
|
|
|
|
|
@@ -1231,7 +1231,7 @@ class pdf_standard_myobject extends ModelePDFMyObject
|
|
|
'border-left' => true, // add left line separator
|
|
|
);
|
|
|
|
|
|
- if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) {
|
|
|
+ if (getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT') && !getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN')) {
|
|
|
$this->cols['vat']['status'] = true;
|
|
|
}
|
|
|
|