--- /tmp/dsg/dolibarr/htdocs/core/modules/supplier_payment/doc/github_19.0.3_pdf_standard.modules.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/supplier_payment/doc/client_pdf_standard.modules.php @@ -5 +4,0 @@ - * Copyright (C) 2022 Ferran Marcet @@ -42,2 +41,70 @@ - /** - * @var DoliDb Database handler + /** + * @var DoliDb Database handler + */ + public $db; + + /** + * @var string model name + */ + public $name; + + /** + * @var string model description (short text) + */ + public $description; + + /** + * @var string document type + */ + public $type; + + /** + * @var array Minimum version of PHP required by module. + * e.g.: PHP ≥ 5.5 = array(5, 5) + */ + public $phpmin = array(5, 5); + + /** + * Dolibarr version of the loaded document + * @var string + */ + public $version = 'dolibarr'; + + /** + * @var int page_largeur + */ + public $page_largeur; + + /** + * @var int page_hauteur + */ + public $page_hauteur; + + /** + * @var array format + */ + public $format; + + /** + * @var int marge_gauche + */ + public $marge_gauche; + + /** + * @var int marge_droite + */ + public $marge_droite; + + /** + * @var int marge_haute + */ + public $marge_haute; + + /** + * @var int marge_basse + */ + public $marge_basse; + + /** + * Issuer + * @var Societe @@ -45,35 +112 @@ - public $db; - - /** - * @var string model name - */ - public $name; - - /** - * @var string model description (short text) - */ - public $description; - - /** - * @var int Save the name of generated file as the main doc when generating a doc with this template - */ - public $update_main_doc_field; - - /** - * @var string document type - */ - public $type; - - /** - * Dolibarr version of the loaded document - * @var string - */ - public $version = 'dolibarr'; - - public $posxdate; - public $posxreffacturefourn; - public $posxreffacture; - public $posxtype; - public $posxtotalht; - public $posxtva; - public $posxtotalttc; + public $emetteur; @@ -89 +122 @@ - global $langs, $mysoc; + global $conf, $langs, $mysoc; @@ -97 +129,0 @@ - $this->update_main_doc_field = 0; // Save the name of generated file as the main doc when generating a doc with this template @@ -105,9 +137,9 @@ - $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); - $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); - $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); - $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); - - $this->option_logo = 1; // Display logo - $this->option_multilang = 1; // Available in several languages - - // Define column position + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + + $this->option_logo = 1; // Affiche logo + $this->option_multilang = 1; // Dispo en plusieurs langues + + // Define column position @@ -122 +154,3 @@ - if ($this->page_largeur < 210) { // To work with US executive format + //if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; + if ($this->page_largeur < 210) // To work with US executive format + { @@ -132,3 +166,2 @@ - $this->tva_array = array(); - $this->localtax1 = array(); - $this->localtax2 = array(); + $this->localtax1 = array(); + $this->localtax2 = array(); @@ -138 +171 @@ - // Get source company + // Recupere emetteur @@ -140,3 +173 @@ - if (!$this->emetteur->country_code) { - $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined - } + if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined @@ -146,12 +177,12 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Function to build pdf onto disk - * - * @param PaiementFourn $object Id of object to generate - * @param Translate $outputlangs Lang output object - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return int 1=OK, 0=KO - */ + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to build pdf onto disk + * + * @param PaiementFourn $object Id of object to generate + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @return int 1=OK, 0=KO + */ @@ -160 +191 @@ - // phpcs:enable + // phpcs:enable @@ -163,3 +194 @@ - if (!is_object($outputlangs)) { - $outputlangs = $langs; - } + if (!is_object($outputlangs)) $outputlangs = $langs; @@ -167,3 +196 @@ - if (getDolGlobalString('MAIN_USE_FPDF')) { - $outputlangs->charset_output = 'ISO-8859-1'; - } + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; @@ -176 +203,2 @@ - if ($conf->fournisseur->payment->dir_output) { + if ($conf->fournisseur->payment->dir_output) + { @@ -185 +213 @@ - $sql .= ' AND pf.fk_paiementfourn = '.((int) $object->id); + $sql .= ' AND pf.fk_paiementfourn = '.$object->id; @@ -187,2 +215,4 @@ - if ($resql) { - if ($this->db->num_rows($resql) > 0) { + if ($resql) + { + if ($this->db->num_rows($resql) > 0) + { @@ -196 +226 @@ - $total = $object->amount; + $total = $object->montant; @@ -199 +229,2 @@ - if ($object->specimen) { + if ($object->specimen) + { @@ -202 +233,3 @@ - } else { + } + else + { @@ -204,2 +237,2 @@ - //$objectrefsupplier = dol_sanitizeFileName($object->ref_supplier); - $dir = $conf->fournisseur->payment->dir_output.'/'.$objectref; + $objectrefsupplier = dol_sanitizeFileName($object->ref_supplier); + $dir = $conf->fournisseur->payment->dir_output.'/'.$objectref; @@ -207,3 +240 @@ - //if (!empty($conf->global->SUPPLIER_REF_IN_NAME)) { - // $file = $dir."/".$objectref.($objectrefsupplier ? "_".$objectrefsupplier : "").".pdf"; - //} + if (!empty($conf->global->SUPPLIER_REF_IN_NAME)) $file = $dir."/".$objectref.($objectrefsupplier ? "_".$objectrefsupplier : "").".pdf"; @@ -212,2 +243,4 @@ - if (!file_exists($dir)) { - if (dol_mkdir($dir) < 0) { + if (!file_exists($dir)) + { + if (dol_mkdir($dir) < 0) + { @@ -219 +252,2 @@ - if (file_exists($dir)) { + if (file_exists($dir)) + { @@ -221 +255,2 @@ - if (!is_object($hookmanager)) { + if (!is_object($hookmanager)) + { @@ -230,22 +265,22 @@ - $nblines = (empty($object->lines) ? 0 : count($object->lines)); - - $pdf = pdf_getInstance($this->format); - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance - $heightforinfotot = 50; // Height reserved to output the info and total 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 + 8; // Height reserved to output the footer (value include bottom margin) - if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) { - $heightforfooter += 6; - } - $pdf->SetAutoPageBreak(1, 0); - - if (class_exists('TCPDF')) { - $pdf->setPrintHeader(false); - $pdf->setPrintFooter(false); - } - $pdf->SetFont(pdf_getPDFFont($outputlangs)); - // Set path to the background PDF File - if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { - $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); - $tplidx = $pdf->importPage(1); - } + $nblines = count($object->lines); + + $pdf = pdf_getInstance($this->format); + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $heightforinfotot = 50; // Height reserved to output the info and total 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 + 8; // Height reserved to output the footer (value include bottom margin) + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; + $pdf->SetAutoPageBreak(1, 0); + + if (class_exists('TCPDF')) + { + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + } + $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->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + $tplidx = $pdf->importPage(1); + } @@ -262,3 +297 @@ - if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { - $pdf->SetCompression(false); - } + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); @@ -269 +302 @@ - // New page + // New page @@ -271,3 +304 @@ - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); - } + if (!empty($tplidx)) $pdf->useTemplate($tplidx); @@ -281,3 +312,3 @@ - $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10); - - $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); + $tab_height = 130; + $tab_height_newpage = 150; @@ -295 +326,2 @@ - for ($i = 0; $i < $nblines; $i++) { + for ($i = 0; $i < $nblines; $i++) + { @@ -312 +344,2 @@ - if ($pageposafter > $pageposbefore) { // There is a pagebreak + if ($pageposafter > $pageposbefore) // There is a pagebreak + { @@ -320,2 +353,4 @@ - if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text - if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text + { + if ($i == ($nblines - 1)) // No more lines, and no space left to show total, so we create a new page + { @@ -323,6 +358,2 @@ - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); - } - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { - $this->_pagehead($pdf, $object, 0, $outputlangs); - } + if (!empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); @@ -331 +362,3 @@ - } else { + } + else + { @@ -334 +367 @@ - if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) { + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) @@ -336 +369 @@ - } else { + else @@ -338 +370,0 @@ - } @@ -340 +372,3 @@ - } else { // No pagebreak + } + else // No pagebreak + { @@ -345 +379 @@ - $pageposafter = $pdf->getPage(); + $pageposafter = $pdf->getPage(); @@ -352,2 +386 @@ - $pdf->setPage($pageposafter); - $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); $curY = $tab_top_newpage; @@ -360 +393 @@ - $pdf->MultiCell($this->posxreffacturefourn - 0.8, 3, $object->lines[$i]->ref_supplier, 0, 'L', 0); + $pdf->MultiCell($this->posxreffacturefourn - $this->posxup - 0.8, 3, $object->lines[$i]->ref_supplier, 0, 'L', 0); @@ -364 +397 @@ - $pdf->MultiCell($this->posxreffacture - 0.8, 3, $object->lines[$i]->ref, 0, 'L', 0); + $pdf->MultiCell($this->posxreffacture - $this->posxup - 0.8, 3, $object->lines[$i]->ref, 0, 'L', 0); @@ -368 +401 @@ - $pdf->MultiCell($this->posxtype - 0.8, 3, $object->lines[$i]->type, 0, 'L', 0); + $pdf->MultiCell($this->posxtype - $this->posxup - 0.8, 3, $object->lines[$i]->type, 0, 'L', 0); @@ -372 +405 @@ - $pdf->MultiCell($this->posxtotalht - 0.8, 3, price($object->lines[$i]->total_ht), 0, 'R', 0); + $pdf->MultiCell($this->posxtotalht - $this->posxup - 0.8, 3, price($object->lines[$i]->total_ht), 0, 'R', 0); @@ -376 +409 @@ - $pdf->MultiCell($this->posxtva - 0.8, 3, price($object->lines[$i]->total_tva), 0, 'R', 0); + $pdf->MultiCell($this->posxtva - $this->posxup - 0.8, 3, price($object->lines[$i]->total_tva), 0, 'R', 0); @@ -379,2 +412,2 @@ - $pdf->SetXY($this->posxtotalttc, $curY); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxtotalttc, 3, price($object->lines[$i]->total_ttc), 0, 'R', 0); + $pdf->SetXY($this->posxtotalttc, $curY); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxtotalttc, 3, price($object->lines[$i]->total_ttc), 0, 'R', 0); @@ -384 +417,2 @@ - if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) { + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) + { @@ -395 +429,2 @@ - while ($pagenb < $pageposafter) { + while ($pagenb < $pageposafter) + { @@ -397 +432,2 @@ - if ($pagenb == 1) { + if ($pagenb == 1) + { @@ -399 +435,3 @@ - } else { + } + else + { @@ -406,2 +444,7 @@ - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { - $this->_pagehead($pdf, $object, 0, $outputlangs); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + } + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) + { + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); @@ -409,8 +452,2 @@ - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); - } - } - if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { - if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); - } else { + else + { @@ -422,3 +459 @@ - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); - } + if (!empty($tplidx)) $pdf->useTemplate($tplidx); @@ -426,3 +461 @@ - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { - $this->_pagehead($pdf, $object, 0, $outputlangs); - } + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); @@ -433 +466,2 @@ - if ($pagenb == 1) { + if ($pagenb == 1) + { @@ -436 +470,3 @@ - } else { + } + else + { @@ -441 +477 @@ - // Display check zone + // Affiche zone cheèque @@ -447 +483 @@ - // Footer page + // Pied de page @@ -449,3 +485 @@ - if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); - } + if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); @@ -462,3 +496,4 @@ - if ($reshook < 0) { - $this->error = $hookmanager->error; - $this->errors = $hookmanager->errors; + if ($reshook < 0) + { + $this->error = $hookmanager->error; + $this->errors = $hookmanager->errors; @@ -467 +502,2 @@ - dolChmod($file); + if (!empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); @@ -472 +508,3 @@ - } else { + } + else + { @@ -476 +514,3 @@ - } else { + } + else + { @@ -487 +527 @@ - * @param TCPDF $pdf Object PDF + * @param PDF $pdf Object PDF @@ -495 +535 @@ - // phpcs:enable + // phpcs:enable @@ -498 +538 @@ - $default_font_size = pdf_getPDFFontSize($outputlangs); + $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -513 +553 @@ - $pdf->MultiCell(50, 4, price($object->amount), 0, 'R', 1); + $pdf->MultiCell(50, 4, price($object->montant), 0, 'R', 1); @@ -518 +558 @@ - $translateinletter = strtoupper(dol_convertToWord(price2num($object->amount, 'MT'), $outputlangs, $currency)); + $translateinletter = strtoupper(dol_convertToWord($object->montant, $outputlangs, $currency)); @@ -520 +559,0 @@ - $pdf->SetFont('', '', $default_font_size - 3); @@ -522 +560,0 @@ - $pdf->SetFont('', '', $default_font_size - 1); @@ -527,5 +565,4 @@ - $pdf->MultiCell(150, 4, $object->thirdparty->name, 0, 'L', 1); - - $LENGTHAMOUNT = 35; - $pdf->SetXY($this->page_largeur - $this->marge_droite - $LENGTHAMOUNT, $posy); - $pdf->MultiCell($LENGTHAMOUNT, 4, str_pad(price($object->amount).' '.$currency, 18, '*', STR_PAD_LEFT), 0, 'R', 1); + $pdf->MultiCell(150, 4, $object->thirdparty->nom, 0, 'L', 1); + + $pdf->SetXY($this->page_largeur - $this->marge_droite - 30, $posy); + $pdf->MultiCell(35, 4, str_pad(price($object->montant).' '.$currency, 18, '*', STR_PAD_LEFT), 0, 'R', 1); @@ -532,0 +570 @@ + @@ -542 +579,0 @@ - return $posy; @@ -549 +586 @@ - * @param TCPDF $pdf Object PDF + * @param PDF $pdf Object PDF @@ -565,3 +602 @@ - if ($hidetop) { - $hidetop = -1; - } + if ($hidetop) $hidetop = -1; @@ -572 +607 @@ - // Amount in (at tab_top - 1) + // Amount in (at tab_top - 1) @@ -576 +611 @@ - /*$titre = strtoupper($mysoc->town).' - '.dol_print_date(dol_now(), 'day', 'tzserver', $outputlangs); + $titre = strtoupper($mysoc->town).', le '.date("d").' '.$outputlangs->transnoentitiesnoconv(date("F")).' '.date("Y"); @@ -578 +613 @@ - $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);*/ + $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); @@ -596,4 +631,4 @@ - * @param TCPDF $pdf Object PDF - * @param PaiementFourn $object Object to show - * @param int $showaddress 0=no, 1=yes - * @param Translate $outputlangs Object lang for output + * @param PDF $pdf Object PDF + * @param FactureFournisseur $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output @@ -624,5 +659,9 @@ - if ($mysoc->logo) { - if (is_readable($logo)) { - $height = pdf_getHeightForLogo($logo); - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) - } else { + if ($mysoc->logo) + { + if (is_readable($logo)) + { + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + } + else + { @@ -634 +673,3 @@ - } else { + } + else + { @@ -638 +679 @@ - /* + /* @@ -647 +688 @@ - $posy+=4; + $posy+=4; @@ -649 +690 @@ - $pdf->SetXY($posx,$posy); + $pdf->SetXY($posx,$posy); @@ -651 +692 @@ - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefSupplier")." : " . $object->ref_supplier, '', 'R'); + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefSupplier")." : " . $object->ref_supplier, '', 'R'); @@ -657 +698,2 @@ - if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { + if (! empty($conf->global->PDF_SHOW_PROJECT)) + { @@ -659,12 +701 @@ - if (!empty($object->project->ref)) { - $posy += 3; - $pdf->SetXY($posx, $posy); - $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->project->title), '', 'R'); - } - } - - if (!empty($conf->global->PDF_SHOW_PROJECT)) - { - $object->fetch_projet(); - if (!empty($object->project->ref)) + if (! empty($object->project->ref)) @@ -672,2 +703 @@ - $outputlangs->load("projects"); - $posy+=4; + $posy+=4; @@ -675 +705 @@ - $langs->load("projects"); + $langs->load("projects"); @@ -677 +707 @@ - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->ref)?'':$object->project->ref), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); @@ -709,2 +739,3 @@ - */ - if ($showaddress) { + */ + if ($showaddress) + { @@ -717,3 +748 @@ - if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) { - $posx = $this->page_largeur - $this->marge_droite - 80; - } + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; @@ -726 +755 @@ - $pdf->MultiCell(80, 5, $outputlangs->transnoentities("PayedBy"), 0, 'L'); + $pdf->MultiCell(66, 5, $outputlangs->transnoentities("PayedBy").":", 0, 'L'); @@ -743 +772 @@ - // Paid + // Payed @@ -748,3 +777 @@ - $usecontact = 0; - - $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ((!empty($object->contact)) ? $object->contact : null), $usecontact, 'target', $object); + $carac_client = pdf_build_address($outputlangs, $this->emetteur, $mysoc, ((!empty($object->contact)) ? $object->contact : null), $usecontact, 'target', $object); @@ -754,3 +781 @@ - if ($this->page_largeur < 210) { - $widthrecbox = 84; // To work with US executive format - } + if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format @@ -759,3 +784 @@ - if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) { - $posx = $this->marge_gauche; - } + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; @@ -767 +790 @@ - $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("PayedTo"), 0, 'L'); + $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("PayedTo").":", 0, 'L'); @@ -781,22 +803,0 @@ - - // Show default IBAN account - $iban = ''; - $sql = "SELECT iban_prefix as iban"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as rib"; - $sql .= " WHERE fk_soc = ".($object->thirdparty->id); - $sql .= " AND rib.default_rib = 1"; - $sql .= " AND rib.type = 'ban'"; - $sql .= " LIMIT 1"; - $resql = $this->db->query($sql); - if ($resql) { - $obj = $this->db->fetch_object($resql); - if ($obj) { - $iban = $obj->iban; - } - } - - if (!empty($iban)) { - $pdf->SetFont('', '', $default_font_size - 1); - $pdf->SetXY($posx + 2, $posy + 15); - $pdf->MultiCell($widthrecbox, 4, $langs->trans("IBAN").': '.$iban, 0, 'L'); - } @@ -809,6 +810,6 @@ - * - * @param TCPDF $pdf PDF - * @param PaiementFourn $object Object to show - * @param Translate $outputlangs Object lang for output - * @param int $hidefreetext 1=Hide free text - * @return int Return height of bottom margin including footer text + * + * @param PDF $pdf PDF + * @param FactureFournisseur $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return int Return height of bottom margin including footer text @@ -818 +819,2 @@ - $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0); + global $conf; + $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;