--- /tmp/dsg/dolibarr/htdocs/core/modules/bank/doc/github_19.0.3_pdf_ban.modules.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/bank/doc/client_pdf_ban.modules.php @@ -39,2 +39,7 @@ - * @var string Dolibarr version of the loaded document - */ + * @var Societe Issuer + */ + public $emetteur; + + /** + * @var string Dolibarr version of the loaded document + */ @@ -42,10 +46,0 @@ - - /** - * @var int posxdatestart - */ - public $posxdatestart; - - /** - * @var int posxdateend - */ - public $posxdateend; @@ -58 +53 @@ - public function __construct($db) + public function __construct($db) @@ -60 +55 @@ - global $langs, $mysoc; + global $conf, $langs, $mysoc; @@ -63 +58 @@ - $langs->loadLangs(array("main", "bank", "withdrawals", "companies")); + $langs->loadLangs(array("main", "bank", "withdrawals", "companies")); @@ -75,7 +70,8 @@ - $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 FAC_PDF_LOGO - $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION + $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 FAC_PDF_LOGO + $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION + $this->option_codeproduitservice = 1; // Affiche code produit-service @@ -85,3 +81 @@ - 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 @@ -98 +92 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -102 +96 @@ - * @param Account $object Object Account to generate + * @param Project $object Object project a generer @@ -106 +100 @@ - public function write_file($object, $outputlangs) + public function write_file($object, $outputlangs) @@ -108 +102 @@ - // phpcs:enable + // phpcs:enable @@ -111,3 +105 @@ - if (!is_object($outputlangs)) { - $outputlangs = $langs; - } + if (!is_object($outputlangs)) $outputlangs = $langs; @@ -115,3 +107 @@ - if (getDolGlobalString('MAIN_USE_FPDF')) { - $outputlangs->charset_output = 'ISO-8859-1'; - } + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; @@ -122 +112,2 @@ - if ($conf->bank->dir_output) { + if ($conf->bank->dir_output) + { @@ -125,12 +116,17 @@ - // Definition of $dir and $file - if ($object->specimen) { - $dir = $conf->bank->dir_output; - $file = $dir."/SPECIMEN.pdf"; - } else { - $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->bank->dir_output."/".$objectref; - $file = $dir."/".$objectref.".pdf"; - } - - if (!file_exists($dir)) { - if (dol_mkdir($dir) < 0) { + // Definition of $dir and $file + if ($object->specimen) + { + $dir = $conf->bank->dir_output; + $file = $dir."/SPECIMEN.pdf"; + } + else + { + $objectref = dol_sanitizeFileName($object->ref); + $dir = $conf->bank->dir_output."/".$objectref; + $file = $dir."/".$objectref.".pdf"; + } + + if (!file_exists($dir)) + { + if (dol_mkdir($dir) < 0) + { @@ -142 +138,2 @@ - if (file_exists($dir)) { + if (file_exists($dir)) + { @@ -144 +141,2 @@ - if (!is_object($hookmanager)) { + if (!is_object($hookmanager)) + { @@ -153,15 +151,14 @@ - $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)); + $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)); @@ -178,3 +175 @@ - if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { - $pdf->SetCompression(false); - } + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); @@ -192,0 +188 @@ + $tab_height = 200; @@ -194,2 +190 @@ - - $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; + $tab_height_newpage = 210; @@ -198 +193,2 @@ - if (!empty($object->note_public)) { + if (!empty($object->note_public)) + { @@ -210 +206,3 @@ - } else { + } + else + { @@ -224 +222,2 @@ - if ($pagenb == 1) { + if ($pagenb == 1) + { @@ -227 +226,3 @@ - } else { + } + else + { @@ -236,3 +237 @@ - if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); - } + if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); @@ -245 +244,2 @@ - if (!is_object($hookmanager)) { + if (!is_object($hookmanager)) + { @@ -253,6 +253,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)); @@ -263 +265,3 @@ - } else { + } + else + { @@ -269 +273 @@ - $this->error = $langs->transnoentities("ErrorConstantNotDefined", "DELIVERY_OUTPUTDIR"); + $this->error = $langs->transnoentities("ErrorConstantNotDefined", "LIVRAISON_OUTPUTDIR"); @@ -287 +291 @@ - protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) + protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) @@ -292 +296 @@ - $default_font_size = pdf_getPDFFontSize($outputlangs); + $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -299,2 +303,2 @@ - * @param TCPDF $pdf Object PDF - * @param Account $object Object to show + * @param PDF $pdf Object PDF + * @param Project $object Object to show @@ -317 +321 @@ - $posx = $this->page_largeur - $this->marge_droite - 100; + $posx = $this->page_largeur - $this->marge_droite - 100; @@ -324,5 +328,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 + { @@ -334,2 +341,0 @@ - } else { - $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0, 'L'); @@ -336,0 +343 @@ + else $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0, 'L'); @@ -359,19 +366,19 @@ - foreach($object->linkedObjects as $objecttype => $objects) - { - //var_dump($objects);exit; - if ($objecttype == 'commande') - { - $outputlangs->load('orders'); - $num=count($objects); - for ($i=0;$i<$num;$i++) - { - $posy+=4; - $pdf->SetXY($posx,$posy); - $pdf->SetFont('','', $default_font_size - 1); - $text=$objects[$i]->ref; - if ($objects[$i]->ref_client) $text.=' ('.$objects[$i]->ref_client.')'; - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R'); - } - } - } - */ + foreach($object->linkedObjects as $objecttype => $objects) + { + var_dump($objects);exit; + if ($objecttype == 'commande') + { + $outputlangs->load('orders'); + $num=count($objects); + for ($i=0;$i<$num;$i++) + { + $posy+=4; + $pdf->SetXY($posx,$posy); + $pdf->SetFont('','', $default_font_size - 1); + $text=$objects[$i]->ref; + if ($objects[$i]->ref_client) $text.=' ('.$objects[$i]->ref_client.')'; + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R'); + } + } + } + */ @@ -383,3 +390,3 @@ - * - * @param TCPDF $pdf PDF - * @param Account $object Object to show + * + * @param PDF $pdf PDF + * @param Project $object Object to show @@ -395,2 +402,2 @@ - $showdetails = !getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; - return 1; + $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + //return pdf_pagefoot($pdf,$outputlangs,'BANK_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); --- /tmp/dsg/dolibarr/htdocs/core/modules/bank/doc/github_19.0.3_pdf_sepamandate.modules.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/bank/doc/client_pdf_sepamandate.modules.php @@ -40,3 +40,9 @@ - * Dolibarr version of the loaded document - * @var string - */ + * Issuer + * @var Societe + */ + public $emetteur; + + /** + * Dolibarr version of the loaded document + * @var string + */ @@ -45,19 +50,0 @@ - /** - * @var int Height reserved to output the info and total part - */ - public $heightforinfotot; - - /** - * @var int Height reserved to output the free text on last page - */ - public $heightforfreetext; - - /** - * @var int Height reserved to output the footer (value include bottom margin) - */ - public $heightforfooter; - - /** - * @var int x coordinate reserved to output the Signature area - */ - public $xPosSignArea; @@ -69 +56 @@ - public function __construct($db) + public function __construct($db) @@ -86,7 +73,8 @@ - $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 FAC_PDF_LOGO - $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION + $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 FAC_PDF_LOGO + $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION + $this->option_codeproduitservice = 1; // Affiche code produit-service @@ -96,3 +84 @@ - 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 @@ -102,10 +87,0 @@ - - $this->update_main_doc_field=1; - - $this->heightforinfotot=50; - - $this->xPosSignArea=120; - - $this->heightforfreetext = (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT') > 0 ? getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT') : 5); - - $this->heightforfooter = $this->marge_basse + 8; @@ -114,3 +90,4 @@ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Function to create pdf of company bank account sepa mandate + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Fonction generant le projet sur le disque @@ -118,10 +95,10 @@ - * @param CompanyBankAccount $object Object bank account to generate document for - * @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 (not used for this template) - * @param int $hidedesc Do not show desc (not used for this template) - * @param int $hideref Do not show ref (not used for this template) - * @param null|array $moreparams More parameters - * @return int 1 if OK, <=0 if KO - */ - public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) + * @param Project $object Object project a generer + * @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 (not used for this template) + * @param int $hidedesc Do not show desc (not used for this template) + * @param int $hideref Do not show ref (not used for this template) + * @param null|array $moreparams More parameters + * @return int 1 if OK, <=0 if KO + */ + public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) @@ -129 +106 @@ - // phpcs:enable + // phpcs:enable @@ -132,3 +109 @@ - if (!is_object($outputlangs)) { - $outputlangs = $langs; - } + if (!is_object($outputlangs)) $outputlangs = $langs; @@ -136,3 +111 @@ - if (getDolGlobalString('MAIN_USE_FPDF')) { - $outputlangs->charset_output = 'ISO-8859-1'; - } + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; @@ -143 +116,2 @@ - if (!empty($conf->bank->dir_output)) { + if (!empty($conf->bank->dir_output)) + { @@ -146,20 +120,19 @@ - // Definition of $dir and $file - if ($object->specimen) { - if (!empty($moreparams['force_dir_output'])) { - $dir = $moreparams['force_dir_output']; - } else { - $dir = $conf->bank->dir_output; - } - $file = $dir."/SPECIMEN.pdf"; - } else { - $objectref = dol_sanitizeFileName($object->ref); - if (!empty($moreparams['force_dir_output'])) { - $dir = $moreparams['force_dir_output']; - } else { - $dir = $conf->bank->dir_output."/".$objectref; - } - $file = $dir."/".$langs->transnoentitiesnoconv("SepaMandateShort").' '.$objectref."-".dol_sanitizeFileName($object->rum).".pdf"; - } - - if (!file_exists($dir)) { - if (dol_mkdir($dir) < 0) { + // Definition of $dir and $file + if ($object->specimen) + { + if (!empty($moreparams['force_dir_output'])) $dir = $moreparams['force_dir_output']; + else $dir = $conf->bank->dir_output; + $file = $dir."/SPECIMEN.pdf"; + } + else + { + $objectref = dol_sanitizeFileName($object->ref); + if (!empty($moreparams['force_dir_output'])) $dir = $moreparams['force_dir_output']; + else $dir = $conf->bank->dir_output."/".$objectref; + $file = $dir."/".$langs->transnoentitiesnoconv("SepaMandateShort").' '.$objectref."-".dol_sanitizeFileName($object->rum).".pdf"; + } + + if (!file_exists($dir)) + { + if (dol_mkdir($dir) < 0) + { @@ -171 +144,2 @@ - if (file_exists($dir)) { + if (file_exists($dir)) + { @@ -173 +147,2 @@ - if (!is_object($hookmanager)) { + if (!is_object($hookmanager)) + { @@ -182,13 +157,14 @@ - $pdf = pdf_getInstance($this->format); - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance - - if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) { - $this->heightforfooter += 6; - } - $pdf->SetAutoPageBreak(1, 0); - - if (class_exists('TCPDF')) { - $pdf->setPrintHeader(false); - $pdf->setPrintFooter(false); - } - $pdf->SetFont(pdf_getPDFFont($outputlangs)); + $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)); @@ -205,3 +181 @@ - if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { - $pdf->SetCompression(false); - } + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); @@ -219,0 +194 @@ + $tab_height = 200; @@ -221,2 +196 @@ - - $tab_height = $this->page_hauteur - $tab_top - $this->heightforfooter - $this->heightforfreetext ; + $tab_height_newpage = 210; @@ -225 +199,2 @@ - if (!empty($object->note_public)) { + if (!empty($object->note_public)) + { @@ -237 +212,3 @@ - } else { + } + else + { @@ -258 +234,0 @@ - @@ -260,9 +236 @@ - $idbankfordirectdebit = getDolGlobalInt('PRELEVEMENT_ID_BANKACCOUNT'); - if ($idbankfordirectdebit > 0) { - $tmpbankfordirectdebit = new Account($this->db); - $tmpbankfordirectdebit->fetch($idbankfordirectdebit); - $ics = $tmpbankfordirectdebit->ics; // ICS for direct debit - } - if (empty($ics) && getDolGlobalString('PRELEVEMENT_ICS')) { - $ics = $conf->global->PRELEVEMENT_ICS; - } + if (!empty($conf->global->PRELEVEMENT_ICS)) $ics = $conf->global->PRELEVEMENT_ICS; @@ -280 +248 @@ - $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $mysoc->getFullAddress(1), 0, 'L'); + $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $mysoc->getFullAddress(), 0, 'L'); @@ -305,3 +273 @@ - if ($object->socid > 0) { - $thirdparty->fetch($object->socid); - } + if ($object->socid > 0) $thirdparty->fetch($object->socid); @@ -310,2 +276,3 @@ - if ($thirdparty->id > 0) { - $sepaname = $thirdparty->name.($object->proprio ? ' ('.$object->proprio.')' : ''); + if ($thirdparty->id > 0) + { + $sepaname = $thirdparty->name.($object->account_owner ? ' ('.$object->account_owner.')' : ''); @@ -321,3 +288 @@ - if (!empty($thirdparty->idprof1)) { - $sepavatid = $thirdparty->idprof1; - } + if (!empty($thirdparty->idprof1)) $sepavatid = $thirdparty->idprof1; @@ -332,7 +297,3 @@ - if (!empty($object->owner_address)) { - $address = $object->owner_address; - } elseif ($thirdparty->id > 0) { - $tmpaddresswithoutcountry = $thirdparty->getFullAddress(); // we test on address without country - if ($tmpaddresswithoutcountry) { - $address = $thirdparty->getFullAddress(1); // full address - } + if ($thirdparty->id > 0) + { + $address = $thirdparty->getFullAddress(); @@ -346,4 +307,5 @@ - if (preg_match('/_____/', $address)) { - $posY += 6; - $pdf->SetXY(80, $posY); - $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $address, 0, 'L'); + if (preg_match('/_____/', $address)) + { + $posY += 6; + $pdf->SetXY(80, $posY); + $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $address, 0, 'L'); @@ -353,3 +315 @@ - if (!empty($object->iban)) { - $ban = $object->iban; - } + if (!empty($object->iban)) $ban = $object->iban; @@ -364,3 +324 @@ - if (!empty($object->bic)) { - $bic = $object->bic; - } + if (!empty($object->bic)) $bic = $object->bic; @@ -382,3 +340 @@ - if ($object->frstrecur == 'RCUR') { - $pdf->MultiCell(5, 3, 'X', 0, 'L'); - } + if ($object->frstrecur == 'RECUR') $pdf->MultiCell(5, 3, 'X', 0, 'L'); @@ -391,3 +347 @@ - if ($object->frstrecur == 'FRST') { - $pdf->MultiCell(5, 3, 'X', 0, 'L'); - } + if ($object->frstrecur == 'FRST') $pdf->MultiCell(5, 3, 'X', 0, 'L'); @@ -397,5 +351,6 @@ - if (empty($object->frstrecur)) { - $posY += 6; - $pdf->SetXY(80, $posY); - $txt = '('.$langs->transnoentitiesnoconv("PleaseCheckOne").')'; - $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L'); + if (empty($object->frstrecur)) + { + $posY += 6; + $pdf->SetXY(80, $posY); + $txt = '('.$langs->transnoentitiesnoconv("PleaseCheckOne").')'; + $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L'); @@ -411,13 +366,16 @@ - if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter, 0, $outputlangs, 0, 0); - $bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1; - } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter, 0, $outputlangs, 1, 0); - $bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1; - } - - //var_dump($tab_top); - //var_dump($this->heightforinfotot ); - //var_dump($this->heightforfreetext ); - //var_dump($this->heightforfooter ); - //var_dump($bottomlasttab); + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + } + else + { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + } + + /*var_dump($tab_top); + var_dump($heightforinfotot); + var_dump($heightforfreetext); + var_dump($heightforfooter); + var_dump($bottomlasttab);*/ @@ -432,3 +390 @@ - if (method_exists($pdf, 'AliasNbPages')) { - $pdf->AliasNbPages(); - } + if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); @@ -441 +397,2 @@ - if (!is_object($hookmanager)) { + if (!is_object($hookmanager)) + { @@ -449,6 +406,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)); @@ -459 +418,3 @@ - } else { + } + else + { @@ -465 +426 @@ - $this->error = $langs->transnoentities("ErrorConstantNotDefined", "DELIVERY_OUTPUTDIR"); + $this->error = $langs->transnoentities("ErrorConstantNotDefined", "LIVRAISON_OUTPUTDIR"); @@ -474 +435 @@ - * @param TCPDF $pdf Object PDF + * @param PDF $pdf Object PDF @@ -483 +444 @@ - protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) + protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) @@ -488 +449 @@ - $default_font_size = pdf_getPDFFontSize($outputlangs); + $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -497,5 +458,5 @@ - * @param TCPDF $pdf Object PDF - * @param CompanyBankAccount $object Object to show - * @param int $posy Y - * @param Translate $outputlangs Langs object - * @return float + * @param PDF $pdf Object PDF + * @param Object $object Object to show + * @param int $posy Y + * @param Translate $outputlangs Langs object + * @return void @@ -505,12 +466,18 @@ - // phpcs:enable - global $conf, $mysoc; - - $default_font_size = pdf_getPDFFontSize($outputlangs); - - $diffsizetitle = (!getDolGlobalString('PDF_DIFFSIZE_TITLE') ? 1 : $conf->global->PDF_DIFFSIZE_TITLE); - - $posy += $this->_signature_area($pdf, $object, $posy, $outputlangs); - - $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetFont('', '', $default_font_size); - $pdf->MultiCell(100, 3, $outputlangs->transnoentitiesnoconv("PleaseReturnMandate", $mysoc->email).':', 0, 'L', 0); + // phpcs:enable + global $conf, $mysoc; + + $default_font_size = pdf_getPDFFontSize($outputlangs); + + $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 1 : $conf->global->PDF_DIFFSIZE_TITLE); + + $posy += $this->_signature_area($pdf, $object, $posy, $outputlangs); + + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('', '', $default_font_size); + $pdf->MultiCell(100, 3, $outputlangs->transnoentitiesnoconv("PleaseReturnMandate", $mysoc->email).':', 0, 'L', 0); + $posy = $pdf->GetY() + 2; + + $pdf->SetXY($this->marge_gauche, $posy); + $pdf->SetFont('', '', $default_font_size - $diffsizetitle); + $pdf->MultiCell(100, 6, $mysoc->name, 0, 'L', 0); + $pdf->MultiCell(100, 6, $outputlangs->convToOutputCharset($mysoc->getFullAddress()), 0, 'L', 0); @@ -519,7 +486 @@ - $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetFont('', '', $default_font_size - $diffsizetitle); - $pdf->MultiCell(100, 6, $mysoc->name, 0, 'L', 0); - $pdf->MultiCell(100, 6, $outputlangs->convToOutputCharset($mysoc->getFullAddress(1)), 0, 'L', 0); - $posy = $pdf->GetY() + 2; - - return $posy; + return $posy; @@ -526,0 +488 @@ + @@ -534,5 +496,5 @@ - * @param TCPDF $pdf Object PDF - * @param CompanyBankAccount $object Object invoice - * @param int $posy Position depart - * @param Translate $outputlangs Objet langs - * @return int Position pour suite + * @param PDF $pdf Object PDF + * @param Facture $object Object invoice + * @param int $posy Position depart + * @param Translate $outputlangs Objet langs + * @return int Position pour suite @@ -542,26 +504,27 @@ - // phpcs:enable - $default_font_size = pdf_getPDFFontSize($outputlangs); - $tab_top = $posy + 4; - $tab_hl = 4; - - $posx = $this->marge_gauche; - $pdf->SetXY($posx, $tab_top); - - $pdf->SetFont('', '', $default_font_size - 2); - - $pdf->MultiCell(100, 3, $outputlangs->transnoentitiesnoconv("DateSigning"), 0, 'L', 0); - $pdf->MultiCell(100, 3, ' '); - $pdf->MultiCell(100, 3, '______________________', 0, 'L', 0); - - $posx = $this->xPosSignArea; - $largcol = ($this->page_largeur - $this->marge_droite - $posx); - - // Total HT - $pdf->SetFillColor(255, 255, 255); - $pdf->SetXY($posx, $tab_top); - $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentitiesnoconv("Signature"), 0, 'L', 1); - - $pdf->SetXY($posx, $tab_top + $tab_hl); - $pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R'); - - return ($tab_hl * 7); + // phpcs:enable + $default_font_size = pdf_getPDFFontSize($outputlangs); + $tab_top = $posy + 4; + $tab_hl = 4; + + $posx = $this->marge_gauche; + $pdf->SetXY($posx, $tab_top + 0); + + $pdf->SetFont('', '', $default_font_size - 2); + + $pdf->MultiCell(100, 3, $outputlangs->transnoentitiesnoconv("DateOfSignature"), 0, 'L', 0); + $pdf->MultiCell(100, 3, ' '); + $pdf->MultiCell(100, 3, '______________________', 0, 'L', 0); + + $posx = 120; + $largcol = ($this->page_largeur - $this->marge_droite - $posx); + $useborder = 0; + $index = 0; + // Total HT + $pdf->SetFillColor(255, 255, 255); + $pdf->SetXY($posx, $tab_top + 0); + $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentitiesnoconv("Signature"), 0, 'L', 1); + + $pdf->SetXY($posx, $tab_top + $tab_hl); + $pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R'); + + return ($tab_hl * 7); @@ -575,4 +538,4 @@ - * @param TCPDF $pdf Object PDF - * @param CompanyBankAccount $object Object to show - * @param int $showaddress 0=no, 1=yes - * @param Translate $outputlangs Object lang for output + * @param PDF $pdf Object PDF + * @param Project $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output @@ -593 +556 @@ - $posx = $this->page_largeur - $this->marge_droite - 100; + $posx = $this->page_largeur - $this->marge_droite - 100; @@ -600,5 +563,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 + { @@ -610,2 +576,0 @@ - } else { - $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0, 'L'); @@ -612,0 +578 @@ + else $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0, 'L'); @@ -624,4 +590,3 @@ - if (!empty($object->date_rum)) { - $daterum = dol_print_date($object->date_rum, 'day', false, $outputlangs, true); - } else { - $daterum = dol_print_date($object->datec, 'day', false, $outputlangs, true); // For old record, the date_rum was not saved. + if (!empty($object->date_rum)) + { + $daterum = dol_print_date($object->date_rum, 'day', false, $outputlangs, true); @@ -628,0 +594 @@ + else $daterum = dol_print_date($object->datec, 'day', false, $outputlangs, true); // For old record, the date_rum was not saved. @@ -641,19 +607,19 @@ - foreach($object->linkedObjects as $objecttype => $objects) - { - var_dump($objects);exit; - if ($objecttype == 'commande') - { - $outputlangs->load('orders'); - $num=count($objects); - for ($i=0;$i<$num;$i++) - { - $posy+=4; - $pdf->SetXY($posx,$posy); - $pdf->SetFont('','', $default_font_size - 1); - $text=$objects[$i]->ref; - if ($objects[$i]->ref_client) $text.=' ('.$objects[$i]->ref_client.')'; - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R'); - } - } - } - */ + foreach($object->linkedObjects as $objecttype => $objects) + { + var_dump($objects);exit; + if ($objecttype == 'commande') + { + $outputlangs->load('orders'); + $num=count($objects); + for ($i=0;$i<$num;$i++) + { + $posy+=4; + $pdf->SetXY($posx,$posy); + $pdf->SetFont('','', $default_font_size - 1); + $text=$objects[$i]->ref; + if ($objects[$i]->ref_client) $text.=' ('.$objects[$i]->ref_client.')'; + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R'); + } + } + } + */ @@ -664,7 +630,7 @@ - * Show footer of page. Need this->emetteur object - * - * @param TCPDF $pdf PDF - * @param CompanyBankAccount $object Object to show - * @param Translate $outputlangs Object lang for output - * @param int $hidefreetext 1=Hide free text - * @return integer + * Show footer of page. Need this->emetteur object + * + * @param PDF $pdf PDF + * @param Project $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return integer @@ -675 +641,3 @@ - $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0); + global $conf; + + $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;