--- /tmp/dsg/dolibarr/htdocs/core/modules/supplier_proposal/doc/github_19.0.3_doc_generic_supplier_proposal_odt.modules.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/supplier_proposal/doc/client_doc_generic_supplier_proposal_odt.modules.php @@ -42,2 +42,2 @@ - * Dolibarr version of the loaded document - * @var string + * Issuer + * @var Societe @@ -44,0 +45,12 @@ + public $emetteur; + + /** + * @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 + */ @@ -58 +70 @@ - $langs->loadLangs(array("main", "companies")); + $langs->loadLangs(array("main", "companies")); @@ -75,6 +87,7 @@ - $this->option_logo = 1; // Display logo - $this->option_tva = 0; // Manage the vat option PROPALE_TVAOPTION - $this->option_modereg = 0; // Display payment mode - $this->option_condreg = 0; // Display payment terms - $this->option_multilang = 1; // Available in several languages - $this->option_escompte = 0; // Displays if there has been a discount + $this->option_logo = 1; // Affiche logo + $this->option_tva = 0; // Gere option tva PROPALE_TVAOPTION + $this->option_modereg = 0; // Affiche mode reglement + $this->option_condreg = 0; // Affiche conditions reglement + $this->option_codeproduitservice = 0; // Affiche code produit-service + $this->option_multilang = 1; // Dispo en plusieurs langues + $this->option_escompte = 0; // Affiche si il y a eu escompte @@ -87,3 +100 @@ - 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 @@ -101 +112 @@ - global $langs; + global $conf, $langs; @@ -104 +115 @@ - $langs->loadLangs(array('companies', 'errors')); + $langs->loadLangs(array('companies', 'errors')); @@ -107,3 +117,0 @@ - - $odtChosen = getDolGlobalInt('MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT') > 0; - $odtPath = trim(getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH')); @@ -114 +121,0 @@ - $texte .= ''; @@ -117 +124,2 @@ - if ($odtChosen) { + if ($conf->global->MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT > 0) + { @@ -127 +135 @@ - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath)); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH))); @@ -129 +137,2 @@ - foreach ($listofdir as $key => $tmpdir) { + foreach ($listofdir as $key=>$tmpdir) + { @@ -133,6 +142,5 @@ - unset($listofdir[$key]); - continue; - } - if (!is_dir($tmpdir)) { - $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - } else { + unset($listofdir[$key]); continue; + } + if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); + else + { @@ -140,3 +148 @@ - if (count($tmpfiles)) { - $listoffiles = array_merge($listoffiles, $tmpfiles); - } + if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); @@ -146 +151,0 @@ - $texthelp .= '

'.$langs->trans("ExampleOfDirectoriesForModelGen").''; @@ -151 +156 @@ - $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name); + $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); @@ -154 +159 @@ - $texte .= $odtPath; + $texte .= $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH; @@ -157 +162 @@ - $texte .= ''; + $texte .= ''; @@ -162 +167,2 @@ - if (!empty($odtPath)) { + if (!empty($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH)) + { @@ -170,11 +176,11 @@ - if ($nbofiles) { - $texte .= '
'; - // Show list of found files - foreach ($listoffiles as $file) { - $texte .= '- '.$file['name'].' '.img_picto('', 'listlight').''; - $texte .= '   '.img_picto('', 'delete').''; - $texte .= '
'; - } - $texte .= '
'; - - if ($odtChosen) { + if ($nbofiles) + { + $texte .= ''; + + if ($conf->global->MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT > 0) + { @@ -182 +188 @@ - $list = ModelePDFSupplierProposal::liste_modeles($this->db); + $liste = ModelePDFSupplierProposal::liste_modeles($this->db); @@ -187 +193 @@ - $texte .= $form->selectarray('value2', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT')); + $texte .= $form->selectarray('value2', $liste, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT); @@ -193 +199 @@ - $texte .= $form->selectarray('value3', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL')); + $texte .= $form->selectarray('value3', $liste, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL); @@ -199 +205 @@ - $texte .= $form->selectarray('value4', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED')); + $texte .= $form->selectarray('value4', $liste, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED); @@ -206,0 +213,3 @@ + $texte .= ''; + $texte .= $langs->trans("ExampleOfDirectoriesForModelGen"); + $texte .= ''; @@ -215 +224 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -229 +238 @@ - // phpcs:enable + // phpcs:enable @@ -232 +241,2 @@ - if (empty($srctemplatepath)) { + if (empty($srctemplatepath)) + { @@ -238 +248,2 @@ - if (!is_object($hookmanager)) { + if (!is_object($hookmanager)) + { @@ -245,3 +256 @@ - if (!is_object($outputlangs)) { - $outputlangs = $langs; - } + if (!is_object($outputlangs)) $outputlangs = $langs; @@ -254 +263,2 @@ - if ($conf->supplier_proposal->dir_output) { + if ($conf->supplier_proposal->dir_output) + { @@ -256 +266,2 @@ - if (!is_object($object)) { + if (!is_object($object)) + { @@ -260 +271,2 @@ - if ($result < 0) { + if ($result < 0) + { @@ -266,2 +277,0 @@ - $object->fetch_thirdparty(); - @@ -270,3 +280 @@ - if (!preg_match('/specimen/i', $objectref)) { - $dir .= "/".$objectref; - } + if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; @@ -275,2 +283,4 @@ - if (!file_exists($dir)) { - if (dol_mkdir($dir) < 0) { + if (!file_exists($dir)) + { + if (dol_mkdir($dir) < 0) + { @@ -282 +292,2 @@ - if (file_exists($dir)) { + if (file_exists($dir)) + { @@ -285 +296 @@ - $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); + $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); @@ -289 +300 @@ - $newfiletmp = $objectref . '_' . $newfiletmp; + $newfiletmp = $objectref.'_'.$newfiletmp; @@ -293,10 +304,11 @@ - if (getDolGlobalString('MAIN_DOC_USE_TIMING')) { - $format = getDolGlobalString('MAIN_DOC_USE_TIMING'); - if ($format == '1') { - $format = '%Y%m%d%H%M%S'; - } - $filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat; - } else { - $filename = $newfiletmp . '.' . $newfileformat; - } - $file = $dir . '/' . $filename; + if (!empty($conf->global->MAIN_DOC_USE_TIMING)) + { + $format = $conf->global->MAIN_DOC_USE_TIMING; + if ($format == '1') $format = '%Y%m%d%H%M%S'; + $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; + } + else + { + $filename = $newfiletmp.'.'.$newfileformat; + } + $file = $dir.'/'.$filename; @@ -309,5 +321 @@ - if (!is_writable($conf->supplier_proposal->dir_temp)) { - $this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->supplier_proposal->dir_temp); - dol_syslog('Error in write_file: ' . $this->error, LOG_ERR); - return -1; - } + @@ -318 +326,2 @@ - if (count($arrayidcontact) > 0) { + if (count($arrayidcontact) > 0) + { @@ -325,5 +334,11 @@ - if (!empty($usecontact)) { - // We can use the company of contact instead of thirdparty company - if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || getDolGlobalString('MAIN_USE_COMPANY_NAME_OF_CONTACT'))) { - $object->contact->fetch_thirdparty(); - $socobject = $object->contact->thirdparty; + if (!empty($usecontact)) + { + // On peut utiliser le nom de la societe du contact + if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) + { + $socobject = $object->contact; + } + else + { + $socobject = $object->thirdparty; + // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use @@ -331,6 +346,4 @@ - } else { - $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use - $contactobject = $object->contact; - } - } else { + } + } + else + { @@ -346 +359 @@ - '__TOTAL_VAT__' => $object->total_tva + '__TOTAL_VAT__' => $object->total_vat @@ -356,2 +369,3 @@ - if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); + if (!empty($conf->global->$paramfreetext)) + { + $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); @@ -363 +377 @@ - $odfHandler = new Odf( + $odfHandler = new odf( @@ -372 +386,3 @@ - } catch (Exception $e) { + } + catch (Exception $e) + { @@ -387 +403,3 @@ - } catch (OdfException $e) { + } + catch (OdfException $e) + { @@ -400,3 +418 @@ - if ($usecontact && is_object($contactobject)) { - $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact'); - } + if ($usecontact && is_object($contactobject)) $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact'); @@ -411 +427,2 @@ - foreach ($tmparray as $key => $value) { + foreach ($tmparray as $key=>$value) + { @@ -413,7 +430,7 @@ - if (preg_match('/logo$/', $key)) { // Image - if (file_exists($value)) { - $odfHandler->setImage($key, $value); - } else { - $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); - } - } else { // Text + if (preg_match('/logo$/', $key)) // Image + { + if (file_exists($value)) $odfHandler->setImage($key, $value); + else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); + } + else // Text + { @@ -422,2 +439,4 @@ - } catch (OdfException $e) { - dol_syslog($e->getMessage(), LOG_INFO); + } + catch (OdfException $e) + { + dol_syslog($e->getMessage(), LOG_INFO); @@ -427 +446,2 @@ - try { + try + { @@ -431 +451,3 @@ - } catch (OdfExceptionSegmentNotFound $e) { + } + catch (OdfException $e) + { @@ -435,5 +457,3 @@ - } catch (OdfException $e) { - $foundtagforlines = 0; - dol_syslog($e->getMessage(), LOG_INFO); - } - if ($foundtagforlines) { + } + if ($foundtagforlines) + { @@ -441 +461,2 @@ - foreach ($object->lines as $line) { + foreach ($object->lines as $line) + { @@ -448,2 +469,4 @@ - foreach ($tmparray as $key => $val) { - try { + foreach ($tmparray as $key => $val) + { + try + { @@ -451 +474,3 @@ - } catch (OdfException $e) { + } + catch (OdfException $e) + { @@ -453 +478,3 @@ - } catch (SegmentException $e) { + } + catch (SegmentException $e) + { @@ -461 +488,3 @@ - } catch (OdfException $e) { + } + catch (OdfException $e) + { @@ -469 +498,2 @@ - foreach ($tmparray as $key => $value) { + foreach ($tmparray as $key=>$value) + { @@ -472,2 +502,4 @@ - } catch (OdfException $e) { - dol_syslog($e->getMessage(), LOG_INFO); + } + catch (OdfException $e) + { + dol_syslog($e->getMessage(), LOG_INFO); @@ -482 +514 @@ - if (getDolGlobalString('MAIN_ODT_AS_PDF')) { + if (!empty($conf->global->MAIN_ODT_AS_PDF)) { @@ -487 +519 @@ - dol_syslog($e->getMessage(), LOG_INFO); + dol_syslog($e->getMessage(), LOG_INFO); @@ -490 +522,2 @@ - } else { + } + else { @@ -495 +528 @@ - dol_syslog($e->getMessage(), LOG_INFO); + dol_syslog($e->getMessage(), LOG_INFO); @@ -502 +535,2 @@ - dolChmod($file); + if (!empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); @@ -509 +543,3 @@ - } else { + } + else + { --- /tmp/dsg/dolibarr/htdocs/core/modules/supplier_proposal/doc/github_19.0.3_pdf_aurore.modules.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/supplier_proposal/doc/client_pdf_aurore.modules.php @@ -25 +25 @@ - * \file htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php + * \file htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -27 +27 @@ - * \brief File of the class allowing to generate the supplier proposals to the Aurore model + * \brief File of the class allowing to generate the supplier propals to the Aurore model @@ -42,28 +42,29 @@ - * @var DoliDb Database handler - */ - 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 - */ + * @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 + */ @@ -70,0 +72,41 @@ + + /** + * @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 + */ + public $emetteur; @@ -88 +129,0 @@ - $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template @@ -96,11 +137,12 @@ - $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_tva = 1; // Manage the vat option FACTURE_TVAOPTION - $this->option_modereg = 1; // Display payment mode - $this->option_condreg = 1; // Display payment terms - $this->option_multilang = 1; // Available in several languages - $this->option_escompte = 1; // Displays if there has been a discount + $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_tva = 1; // Gere option tva FACTURE_TVAOPTION + $this->option_modereg = 1; // Affiche mode reglement + $this->option_condreg = 1; // Affiche conditions reglement + $this->option_codeproduitservice = 1; // Affiche code produit-service + $this->option_multilang = 1; // Dispo en plusieurs langues + $this->option_escompte = 1; // Affiche si il y a eu escompte @@ -110 +151,0 @@ - $this->watermark = ''; @@ -114,3 +155 @@ - if (empty($this->emetteur->country_code)) { - $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined - } + if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined @@ -120,12 +158,0 @@ - - if (getDolGlobalInt('PRODUCT_USE_UNITS')) { - //$this->posxtva = 101; - $this->posxup = 112; - $this->posxqty = 135; - $this->posxunit = 151; - } else { - //$this->posxtva = 106; - $this->posxup = 122; - $this->posxqty = 145; - $this->posxunit = 162; - } @@ -135,2 +162,17 @@ - $this->posxpicture = $this->posxup - (!getDolGlobalString('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH') ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images - if ($this->page_largeur < 210) { // To work with US executive format + if ($conf->global->PRODUCT_USE_UNITS) + { + $this->posxtva = 101; + $this->posxup = 118; + $this->posxqty = 135; + $this->posxunit = 151; + } else { + $this->posxtva = 102; + $this->posxup = 126; + $this->posxqty = 145; + $this->posxunit = 162; + } + + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || !empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxup = $this->posxtva; + $this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images + if ($this->page_largeur < 210) // To work with US executive format + { @@ -137,0 +180 @@ + $this->posxtva -= 20; @@ -146 +188,0 @@ - $this->tva_array = array(); @@ -153,11 +195,11 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Function to build pdf onto disk - * - * @param SupplierProposal $object 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 Object $object 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 @@ -167 +209 @@ - // phpcs:enable + // phpcs:enable @@ -170,3 +212 @@ - if (!is_object($outputlangs)) { - $outputlangs = $langs; - } + if (!is_object($outputlangs)) $outputlangs = $langs; @@ -174,3 +214 @@ - if (getDolGlobalString('MAIN_USE_FPDF')) { - $outputlangs->charset_output = 'ISO-8859-1'; - } + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; @@ -181,5 +218,0 @@ - // Show Draft Watermark - if ($object->statut == $object::STATUS_DRAFT && (getDolGlobalString('SUPPLIER_PROPOSAL_DRAFT_WATERMARK'))) { - $this->watermark = $conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK; - } - @@ -190,5 +223,5 @@ - if (getDolGlobalString('MAIN_GENERATE_SUPPLIER_PROPOSAL_WITH_PICTURE')) { - for ($i = 0; $i < $nblines; $i++) { - if (empty($object->lines[$i]->fk_product)) { - continue; - } + if (!empty($conf->global->MAIN_GENERATE_SUPPLIER_PROPOSAL_WITH_PICTURE)) + { + for ($i = 0; $i < $nblines; $i++) + { + if (empty($object->lines[$i]->fk_product)) continue; @@ -199 +232,2 @@ - if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) { + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) + { @@ -202,2 +236,4 @@ - } else { - $pdir = get_exdir(0, 0, 0, 0, $objphoto, 'product'); + } + else + { + $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; @@ -208,10 +244,4 @@ - foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) { - if (!getDolGlobalInt('CAT_HIGH_QUALITY_IMAGES')) { // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo - if ($obj['photo_vignette']) { - $filename = $obj['photo_vignette']; - } else { - $filename = $obj['photo']; - } - } else { - $filename = $obj['photo']; - } + foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) + { + $filename = $obj['photo']; + //if ($obj['photo_vignette']) $filename='thumbs/'.$obj['photo_vignette']; @@ -222,10 +252,7 @@ - if ($realpath) { - $realpatharray[$i] = $realpath; - } - } - } - if (count($realpatharray) == 0) { - $this->posxpicture = $this->posxup; - } - - if ($conf->supplier_proposal->dir_output) { + if ($realpath) $realpatharray[$i] = $realpath; + } + } + if (count($realpatharray) == 0) $this->posxpicture = $this->posxtva; + + if ($conf->supplier_proposal->dir_output) + { @@ -237 +264,2 @@ - if ($object->specimen) { + if ($object->specimen) + { @@ -240 +268,3 @@ - } else { + } + else + { @@ -246,2 +276,4 @@ - if (!file_exists($dir)) { - if (dol_mkdir($dir) < 0) { + if (!file_exists($dir)) + { + if (dol_mkdir($dir) < 0) + { @@ -253 +285,2 @@ - if (file_exists($dir)) { + if (file_exists($dir)) + { @@ -255 +288,2 @@ - if (!is_object($hookmanager)) { + if (!is_object($hookmanager)) + { @@ -265,20 +299,20 @@ - $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); - } + $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); + } @@ -295,3 +329 @@ - if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { - $pdf->SetCompression(false); - } + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); @@ -302,2 +334,4 @@ - for ($i = 0; $i < $nblines; $i++) { - if ($object->lines[$i]->remise_percent) { + for ($i = 0; $i < $nblines; $i++) + { + if ($object->lines[$i]->remise_percent) + { @@ -307,8 +341,10 @@ - if (empty($this->atleastonediscount)) { - $delta = ($this->postotalht - $this->posxdiscount); - $this->posxpicture += $delta; - $this->posxup += $delta; - $this->posxqty += $delta; - $this->posxunit += $delta; - $this->posxdiscount += $delta; - // post of fields after are not modified, stay at same position + if (empty($this->atleastonediscount)) + { + $delta = ($this->postotalht - $this->posxdiscount); + $this->posxpicture += $delta; + $this->posxtva += $delta; + $this->posxup += $delta; + $this->posxqty += $delta; + $this->posxunit += $delta; + $this->posxdiscount += $delta; + // post of fields after are not modified, stay at same position @@ -319,3 +355 @@ - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); - } + if (!empty($tplidx)) $pdf->useTemplate($tplidx); @@ -329 +363 @@ - $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10); + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); @@ -333 +367,2 @@ - if (getDolGlobalString('MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE')) { + if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) + { @@ -335 +370,2 @@ - if (is_object($object->thirdparty)) { + if (is_object($object->thirdparty)) + { @@ -339,13 +375,5 @@ - if (!empty($salerepobj->signature)) { - $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); - } - } - } - - // Extrafields in note - $extranote = $this->getExtrafieldsInHtml($object, $outputlangs); - if (!empty($extranote)) { - $notetoshow = dol_concatdesc($notetoshow, $extranote); - } - - if ($notetoshow) { + if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); + } + } + if ($notetoshow) + { @@ -354 +382 @@ - $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); + $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); @@ -376 +404,2 @@ - for ($i = 0; $i < $nblines; $i++) { + for ($i = 0; $i < $nblines; $i++) + { @@ -383,3 +412 @@ - if (!empty($realpatharray[$i])) { - $imglinesize = pdf_getSizeForImage($realpatharray[$i]); - } + if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]); @@ -396 +423,2 @@ - if (!empty($imglinesize['width']) && !empty($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page + if (!empty($imglinesize['width']) && !empty($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // If photo too high, we moved completely on new page + { @@ -398,6 +426,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); @@ -409 +433 @@ - if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) { + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) @@ -411 +435 @@ - } else { + else @@ -413,4 +437,4 @@ - } - } - - if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) { + } + + if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) + { @@ -418 +442 @@ - $pdf->Image($realpatharray[$i], $curX + (($this->posxup - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + $pdf->Image($realpatharray[$i], $curX + (($this->posxtva - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi @@ -427 +451,2 @@ - if ($posYAfterImage > 0) { + if ($posYAfterImage > 0) + { @@ -429,2 +454,4 @@ - } else { - $descWidth = $this->posxup - $curX; + } + else + { + $descWidth = $this->posxtva - $curX; @@ -435 +462,2 @@ - if ($pageposafter > $pageposbefore) { // There is a pagebreak + if ($pageposafter > $pageposbefore) // There is a pagebreak + { @@ -440 +468 @@ - pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1); + pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc); @@ -445,2 +473,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 + { @@ -448,6 +478,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); @@ -456 +482,3 @@ - } else { + } + else + { @@ -459 +487 @@ - if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) { + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) @@ -461 +489 @@ - } else { + else @@ -463 +490,0 @@ - } @@ -465 +492,3 @@ - } else { // No pagebreak + } + else // No pagebreak + { @@ -479,2 +508 @@ - $pdf->setPage($pageposafter); - $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); $curY = $tab_top_newpage; @@ -483,0 +512,16 @@ + + // VAT Rate + /* + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) + { + $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); + $pdf->SetXY($this->posxtva, $curY); + $pdf->MultiCell($this->posxup-$this->posxtva-3, 3, $vat_rate, 0, 'R'); + } + + // Unit price before discount + $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); + $pdf->SetXY($this->posxup, $curY); + if ($up_excl_tax > 0) + $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0); + */ @@ -491,4 +535,5 @@ - if (getDolGlobalInt('PRODUCT_USE_UNITS')) { - $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager); - $pdf->SetXY($this->posxunit, $curY); - $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0, 'L'); + if ($conf->global->PRODUCT_USE_UNITS) + { + $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager); + $pdf->SetXY($this->posxunit, $curY); + $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0, 'L'); @@ -511 +556 @@ - */ + */ @@ -514,5 +559,2 @@ - if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { - $tvaligne = $object->lines[$i]->multicurrency_total_tva; - } else { - $tvaligne = $object->lines[$i]->total_tva; - } + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva; + else $tvaligne = $object->lines[$i]->total_tva; @@ -527,10 +569,3 @@ - // TODO remise_percent is an obsolete field for object parent - /*if ($object->remise_percent) { - $tvaligne -= ($tvaligne * $object->remise_percent) / 100; - } - if ($object->remise_percent) { - $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; - } - if ($object->remise_percent) { - $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100; - }*/ + if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100; + if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; + if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100; @@ -542 +577,2 @@ - && (!empty($localtax1_rate) || !empty($localtax2_rate))) { // and there is local tax + && (!empty($localtax1_rate) || !empty($localtax2_rate))) // and there is local tax + { @@ -544,28 +580,12 @@ - $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] : ''; - $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] : ''; - } - - // retrieve global local tax - if ($localtax1_type && $localtax1ligne != 0) { - if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) { - $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne; - } else { - $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; - } - } - if ($localtax2_type && $localtax2ligne != 0) { - if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) { - $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne; - } else { - $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; - } - } - - if (($object->lines[$i]->info_bits & 0x01) == 0x01) { - $vatrate .= '*'; - } - - // Fill $this->tva and $this->tva_array - if (!isset($this->tva[$vatrate])) { - $this->tva[$vatrate] = 0; - } + $localtax1_type = $localtaxtmp_array[0]; + $localtax2_type = $localtaxtmp_array[2]; + } + + // retrieve global local tax + if ($localtax1_type && $localtax1ligne != 0) + $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; + if ($localtax2_type && $localtax2ligne != 0) + $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; + + if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*'; + if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = 0; @@ -573,9 +593,2 @@ - $vatcode = $object->lines[$i]->vat_src_code; - if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) { - $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0; - } - $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne); - - if ($posYAfterImage > $posYAfterDescription) { - $nexY = $posYAfterImage; - } + + if ($posYAfterImage > $posYAfterDescription) $nexY = $posYAfterImage; @@ -584 +597,2 @@ - if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) { + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) + { @@ -595 +609,2 @@ - while ($pagenb < $pageposafter) { + while ($pagenb < $pageposafter) + { @@ -597 +612,2 @@ - if ($pagenb == 1) { + if ($pagenb == 1) + { @@ -599 +615,3 @@ - } else { + } + else + { @@ -606,2 +624,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); @@ -609,8 +632,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 + { @@ -622,3 +639 @@ - if (!empty($tplidx)) { - $pdf->useTemplate($tplidx); - } + if (!empty($tplidx)) $pdf->useTemplate($tplidx); @@ -626,3 +641 @@ - 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); @@ -633 +646,2 @@ - if ($pagenb == 1) { + if ($pagenb == 1) + { @@ -636 +650,3 @@ - } else { + } + else + { @@ -657,3 +673 @@ - if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); - } + if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); @@ -670,6 +684,8 @@ - if ($reshook < 0) { - $this->error = $hookmanager->error; - $this->errors = $hookmanager->errors; - } - - dolChmod($file); + if ($reshook < 0) + { + $this->error = $hookmanager->error; + $this->errors = $hookmanager->errors; + } + + if (!empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); @@ -680 +696,3 @@ - } else { + } + else + { @@ -684 +702,3 @@ - } else { + } + else + { @@ -691 +711 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -695,5 +715,5 @@ - * @param TCPDF $pdf Object PDF - * @param Object $object Object proposal - * @param int $posy Position y in PDF - * @param Translate $outputlangs Object langs for output - * @return int Return integer <0 if KO, >0 if OK + * @param PDF $pdf Object PDF + * @param Object $object Object proposal + * @param int $posy Position y in PDF + * @param Translate $outputlangs Object langs for output + * @return int <0 if KO, >0 if OK @@ -703,2 +723 @@ - // phpcs:enable - return 1; + // phpcs:enable @@ -708 +727 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -712 +731 @@ - * @param TCPDF $pdf Object PDF + * @param PDF $pdf Object PDF @@ -716 +735 @@ - * @return int + * @return void @@ -720 +739 @@ - // phpcs:enable + // phpcs:enable @@ -724,2 +742,0 @@ - $diffsizetitle = (!getDolGlobalString('PDF_DIFFSIZE_TITLE') ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); - @@ -730,4 +747,5 @@ - // Show shipping date - if (!empty($object->delivery_date)) { - $outputlangs->load("sendings"); - $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); + // Show shipping date + if (!empty($object->date_livraison)) + { + $outputlangs->load("sendings"); + $pdf->SetFont('', 'B', $default_font_size - 2); @@ -737 +755 @@ - $pdf->SetFont('', '', $default_font_size - $diffsizetitle); + $pdf->SetFont('', '', $default_font_size - 2); @@ -739 +757 @@ - $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); @@ -742,2 +760,3 @@ - $posy = $pdf->GetY() + 1; - } else { + $posy = $pdf->GetY() + 1; + } + else { @@ -745 +764 @@ - $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); + $pdf->SetFont('', 'B', $default_font_size - 2); @@ -749 +768 @@ - $pdf->SetFont('', '', $default_font_size - $diffsizetitle); + $pdf->SetFont('', '', $default_font_size - 2); @@ -751,6 +770,6 @@ - //$dlp=dol_print_date($object->delivery_date,"daytext",false,$outputlangs,true); - $pdf->MultiCell(80, 4, '', 0, 'L'); - - $posy = $pdf->GetY() + 1; - } - /* + //$dlp=dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true); + $pdf->MultiCell(80, 4, $dlp, 0, 'L'); + + $posy = $pdf->GetY() + 1; + } + /* PHFAVRE @@ -774,2 +793,3 @@ - if (!getDolGlobalString('SUPPLIER_PROPOSAL_PDF_HIDE_PAYMENTTERMCOND') && ($object->cond_reglement_code || $object->cond_reglement)) { - $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); + if (empty($conf->global->SUPPLIER_PROPOSAL_PDF_HIDE_PAYMENTTERMCOND) && ($object->cond_reglement_code || $object->cond_reglement)) + { + $pdf->SetFont('', 'B', $default_font_size - 2); @@ -780 +800 @@ - $pdf->SetFont('', '', $default_font_size - $diffsizetitle); + $pdf->SetFont('', '', $default_font_size - 2); @@ -782 +802 @@ - $lib_condition_paiement = ($outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != 'PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label); + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc); @@ -789 +809,2 @@ - if (getDolGlobalString('SUPPLIER_PROPOSAL_PDF_SHOW_PAYMENTTERMMODE')) { + if (!empty($conf->global->SUPPLIER_PROPOSAL_PDF_SHOW_PAYMENTTERMMODE)) + { @@ -793,2 +814,3 @@ - && $object->mode_reglement_code != 'VIR') { - $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); + && $object->mode_reglement_code != 'VIR') + { + $pdf->SetFont('', 'B', $default_font_size - 2); @@ -798 +820 @@ - $pdf->SetFont('', '', $default_font_size - $diffsizetitle); + $pdf->SetFont('', '', $default_font_size - 2); @@ -800 +822 @@ - $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != 'PaymentType'.$object->mode_reglement_code ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); + $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); @@ -807 +829,2 @@ - if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { + if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') + { @@ -809,2 +832,6 @@ - if (getDolGlobalInt('FACTURE_CHQ_NUMBER')) { - if (getDolGlobalInt('FACTURE_CHQ_NUMBER') > 0) { + if (!empty($conf->global->FACTURE_CHQ_NUMBER)) + { + $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE); + + if ($conf->global->FACTURE_CHQ_NUMBER > 0) + { @@ -812 +839 @@ - $account->fetch(getDolGlobalInt('FACTURE_CHQ_NUMBER')); + $account->fetch($conf->global->FACTURE_CHQ_NUMBER); @@ -819 +846,2 @@ - if (!getDolGlobalString('MAIN_PDF_HIDE_CHQ_ADDRESS')) { + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) + { @@ -824,3 +852,4 @@ - } - } - if (getDolGlobalInt('FACTURE_CHQ_NUMBER') == -1) { + } + } + if ($conf->global->FACTURE_CHQ_NUMBER == -1) + { @@ -832 +861,2 @@ - if (!getDolGlobalString('MAIN_PDF_HIDE_CHQ_ADDRESS')) { + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) + { @@ -837 +867 @@ - } + } @@ -843,2 +873,4 @@ - if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { - if (!empty($object->fk_bank) || getDolGlobalInt('FACTURE_RIB_NUMBER')) { + if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') + { + if (!empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER)) + { @@ -863 +895 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -867 +899 @@ - * @param TCPDF $pdf Object PDF + * @param PDF $pdf Object PDF @@ -876 +908 @@ - // phpcs:enable + // phpcs:enable @@ -885,3 +917,3 @@ - $col1x = 120; - $col2x = 170; - if ($this->page_largeur < 210) { // To work with US executive format + $col1x = 120; $col2x = 170; + if ($this->page_largeur < 210) // To work with US executive format + { @@ -897 +929 @@ - $pdf->SetXY($col1x, $tab2_top); + $pdf->SetXY($col1x, $tab2_top + 0); @@ -900,3 +932,2 @@ - $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); - $pdf->SetXY($col2x, $tab2_top); - $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1); + $pdf->SetXY($col2x, $tab2_top + 0); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1); @@ -908 +939,2 @@ - if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) { + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) + { @@ -910 +942,2 @@ - if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL') && $tvaisnull) { + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL) && $tvaisnull) + { @@ -912 +945,3 @@ - } else { + } + else + { @@ -914 +949 @@ - //if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') @@ -916,7 +951,8 @@ - foreach ($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('1', '3', '5'))) { - continue; - } - - foreach ($localtax_rate as $tvakey => $tvaval) { - if ($tvakey != 0) { // On affiche pas taux 0 + foreach ($this->localtax1 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; + + foreach ($localtax_rate as $tvakey => $tvaval) + { + if ($tvakey != 0) // On affiche pas taux 0 + { @@ -929 +965,2 @@ - if (preg_match('/\*/', $tvakey)) { + if (preg_match('/\*/', $tvakey)) + { @@ -942 +979 @@ - //} + //} @@ -944 +981 @@ - //if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') @@ -946,7 +983,8 @@ - foreach ($this->localtax2 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('1', '3', '5'))) { - continue; - } - - foreach ($localtax_rate as $tvakey => $tvaval) { - if ($tvakey != 0) { // On affiche pas taux 0 + foreach ($this->localtax2 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; + + foreach ($localtax_rate as $tvakey => $tvaval) + { + if ($tvakey != 0) // On affiche pas taux 0 + { @@ -961 +999,2 @@ - if (preg_match('/\*/', $tvakey)) { + if (preg_match('/\*/', $tvakey)) + { @@ -976,2 +1015,4 @@ - foreach ($this->tva as $tvakey => $tvaval) { - if ($tvakey > 0) { // On affiche pas taux 0 + foreach ($this->tva as $tvakey => $tvaval) + { + if ($tvakey > 0) // On affiche pas taux 0 + { @@ -984 +1025,2 @@ - if (preg_match('/\*/', $tvakey)) { + if (preg_match('/\*/', $tvakey)) + { @@ -998 +1040 @@ - //if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') @@ -1000,7 +1042,8 @@ - foreach ($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2', '4', '6'))) { - continue; - } - - foreach ($localtax_rate as $tvakey => $tvaval) { - if ($tvakey != 0) { // On affiche pas taux 0 + foreach ($this->localtax1 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; + + foreach ($localtax_rate as $tvakey => $tvaval) + { + if ($tvakey != 0) // On affiche pas taux 0 + { @@ -1013 +1056,2 @@ - if (preg_match('/\*/', $tvakey)) { + if (preg_match('/\*/', $tvakey)) + { @@ -1026 +1070 @@ - //} + //} @@ -1028 +1072 @@ - //if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') @@ -1030,8 +1074,9 @@ - foreach ($this->localtax2 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2', '4', '6'))) { - continue; - } - - foreach ($localtax_rate as $tvakey => $tvaval) { - // retrieve global local tax - if ($tvakey != 0) { // On affiche pas taux 0 + foreach ($this->localtax2 as $localtax_type => $localtax_rate) + { + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; + + foreach ($localtax_rate as $tvakey => $tvaval) + { + // retrieve global local tax + if ($tvakey != 0) // On affiche pas taux 0 + { @@ -1044 +1089,2 @@ - if (preg_match('/\*/', $tvakey)) { + if (preg_match('/\*/', $tvakey)) + { @@ -1073,0 +1120 @@ + /* @@ -1075,5 +1122,5 @@ - if (!empty($object->paye)) { - $resteapayer = 0; - } - - if ($deja_regle > 0) { + if (! empty($object->paye)) $resteapayer=0; + */ + + if ($deja_regle > 0) + { @@ -1086,0 +1134,16 @@ + + /* + if ($object->close_code == 'discount_vat') + { + $index++; + $pdf->SetFillColor(255,255,255); + + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1); + + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle, 0, $outputlangs), $useborder, 'R', 1); + + $resteapayer=0; + } + */ @@ -1109 +1172 @@ - * @param TCPDF $pdf Object PDF + * @param PDF $pdf Object PDF @@ -1125,3 +1188 @@ - if ($hidetop) { - $hidetop = -1; - } + if ($hidetop) $hidetop = -1; @@ -1136 +1197,2 @@ - if (empty($hidetop)) { + if (empty($hidetop)) + { @@ -1142,3 +1204 @@ - if (getDolGlobalString('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(',', getDolGlobalString('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, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); @@ -1153 +1213,2 @@ - if (empty($hidetop)) { + if (empty($hidetop)) + { @@ -1160,2 +1221,14 @@ - $pdf->line($this->posxup + 1, $tab_top, $this->posxup + 1, $tab_top + $tab_height); - if (empty($hidetop)) { + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) + { + $pdf->line($this->posxtva, $tab_top, $this->posxtva, $tab_top + $tab_height); + //$pdf->line($this->posxtva-2, $tab_top, $this->posxtva-2, $tab_top + $tab_height); + if (empty($hidetop)) + { + $pdf->SetXY($this->posxtva - 5, $tab_top + 1); + $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C'); + } + } + + $pdf->line($this->posxup - 3, $tab_top, $this->posxup - 3, $tab_top + $tab_height); + if (empty($hidetop)) + { @@ -1167,11 +1240,12 @@ - if (empty($hidetop)) { - $pdf->SetXY($this->posxqty - 1, $tab_top + 1); - $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); - } - - if (getDolGlobalInt('PRODUCT_USE_UNITS')) { - $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); - if (empty($hidetop)) { - $pdf->SetXY($this->posxunit - 1, $tab_top + 1); - $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("Unit"), '', 'C'); - } + if (empty($hidetop)) + { + $pdf->SetXY($this->posxqty - 1, $tab_top + 1); + $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); + } + + if ($conf->global->PRODUCT_USE_UNITS) { + $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); + if (empty($hidetop)) { + $pdf->SetXY($this->posxunit - 1, $tab_top + 1); + $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("Unit"), '', 'C'); + } @@ -1181,2 +1255,4 @@ - if (empty($hidetop)) { - if ($this->atleastonediscount) { + if (empty($hidetop)) + { + if ($this->atleastonediscount) + { @@ -1187 +1263,2 @@ - if ($this->atleastonediscount) { + if ($this->atleastonediscount) + { @@ -1190 +1267,2 @@ - if (empty($hidetop)) { + if (empty($hidetop)) + { @@ -1192 +1270 @@ - $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHTShort"), '', 'C'); + $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C'); @@ -1200 +1278 @@ - * @param TCPDF $pdf Object PDF + * @param PDF $pdf Object PDF @@ -1204 +1282 @@ - * @return float|int + * @return void @@ -1216,0 +1295,6 @@ + // Show Draft Watermark + if ($object->statut == 0 && (!empty($conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK))) + { + pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK); + } + @@ -1226,24 +1310,20 @@ - if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) { - if ($this->emetteur->logo) { - $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; - } - if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { - $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; - } else { - $logo = $logodir.'/logos/'.$this->emetteur->logo; - } - if (is_readable($logo)) { - $height = pdf_getHeightForLogo($logo); - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) - } else { - $pdf->SetTextColor(200, 0, 0); - $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); - } - } else { - $text = $this->emetteur->name; - $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0); - } + $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + if ($this->emetteur->logo) + { + if (is_readable($logo)) + { + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + } + else + { + $pdf->SetTextColor(200, 0, 0); + $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); + } + } + else + { + $text = $this->emetteur->name; + $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); @@ -1268 +1348,2 @@ - if ($object->ref_fourn) { + if ($object->ref_client) + { @@ -1272,4 +1353,11 @@ - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_fourn), 65), '', 'R'); - } - - if ($object->thirdparty->code_fournisseur) { + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); + } + /* PHFAVRE + $posy+=4; + $pdf->SetXY($posx,$posy); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->date_livraison, "day", false, $outputlangs, true), '', 'R'); + */ + + if ($object->thirdparty->code_fournisseur) + { @@ -1283,10 +1371,12 @@ - if (getDolGlobalString('DOC_SHOW_FIRST_SALES_REP')) { - $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL'); - if (count($arrayidcontact) > 0) { - $usertmp = new User($this->db); - $usertmp->fetch($arrayidcontact[0]); - $posy += 4; - $pdf->SetXY($posx, $posy); - $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R'); - } + if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) + { + $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL'); + if (count($arrayidcontact) > 0) + { + $usertmp = new User($this->db); + $usertmp->fetch($arrayidcontact[0]); + $posy += 4; + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R'); + } @@ -1301 +1391,2 @@ - if ($current_y < $pdf->getY()) { + if ($current_y < $pdf->getY()) + { @@ -1305 +1396,2 @@ - if ($showaddress) { + if ($showaddress) + { @@ -1308 +1400 @@ - // Add internal contact of object if defined + // Add internal contact of proposal if defined @@ -1310,13 +1402,8 @@ - if (count($arrayidcontact) > 0) { - $object->fetch_user($arrayidcontact[0]); - $labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name")); - $carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs)); - $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : ''; - $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : ''; - $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : ''; - $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : ''; - $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : ''; - $carac_emetteur .= "\n"; - } - - $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); + if (count($arrayidcontact) > 0) + { + $object->fetch_user($arrayidcontact[0]); + $labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name")); + $carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; + } + + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); @@ -1326,4 +1413,2 @@ - $posx = $this->marge_gauche; - if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) { - $posx = $this->page_largeur - $this->marge_droite - 80; - } + $posx = $this->marge_gauche; + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; @@ -1336 +1421 @@ - $pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, 'L'); + $pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); @@ -1356,6 +1441,3 @@ - if (!getDolGlobalInt('SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT')) { - $arrayidcontact = $object->getIdContact('external', 'CUSTOMER'); - } else { - $arrayidcontact = array_merge($object->getIdContact('external', 'CUSTOMER'), $object->getIdContact('external', 'BILLING')); - } - if (count($arrayidcontact) > 0) { + $arrayidcontact = $object->getIdContact('external', 'CUSTOMER'); + if (count($arrayidcontact) > 0) + { @@ -1367,11 +1449,11 @@ - if (!empty($usecontact)) { - if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || getDolGlobalString('MAIN_USE_COMPANY_NAME_OF_CONTACT')))) { - $socname = $object->contact; - } else { - $socname = $object->thirdparty; - } - } else { - $socname = $object->thirdparty; - } - - $carac_client_name = pdfBuildThirdpartyName($socname, $outputlangs); + if (!empty($usecontact)) + { + // On peut utiliser le nom de la societe du contact + if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; + else $socname = $object->thirdparty->name; + $carac_client_name = $outputlangs->convToOutputCharset($socname); + } + else + { + $carac_client_name = $outputlangs->convToOutputCharset($object->thirdparty->name); + } @@ -1383,3 +1465 @@ - 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 @@ -1388,3 +1468 @@ - if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) { - $posx = $this->marge_gauche; - } + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; @@ -1396 +1474 @@ - $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, 'L'); + $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":", 0, 'L'); @@ -1415,10 +1493,10 @@ - /** - * Show footer of page. Need this->emetteur object - * - * @param TCPDF $pdf PDF - * @param Object $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 - */ - protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) + /** + * Show footer of page. Need this->emetteur object + * + * @param PDF $pdf PDF + * @param Object $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 + */ + protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) @@ -1426,2 +1504,3 @@ - $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0); - return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark); + global $conf; + $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);