39include_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
54 $head[$h][0] = DOL_URL_ROOT.
'/admin/pdf.php';
55 $head[$h][1] = $langs->trans(
"Parameters");
56 $head[$h][2] =
'general';
65 if (isModEnabled(
"propal") || isModEnabled(
'facture') || isModEnabled(
'reception')) {
66 $head[$h][0] = DOL_URL_ROOT.
'/admin/pdf_other.php';
67 $head[$h][1] = $langs->trans(
"Others");
68 $head[$h][2] =
'other';
87 global $conf, $db, $langs;
89 dol_syslog(
"pdf_getFormat Get paper format with mode=".$mode.
" MAIN_PDF_FORMAT=".(!
getDolGlobalString(
'MAIN_PDF_FORMAT') ?
'null' : $conf->global->MAIN_PDF_FORMAT).
" outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang :
'null').
" and langs->defaultlang=".(is_object($langs) ? $langs->defaultlang :
'null'));
97 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
100 $pdfformat = $conf->global->MAIN_PDF_FORMAT;
103 $sql =
"SELECT code, label, width, height, unit FROM ".MAIN_DB_PREFIX.
"c_paper_format";
104 $sql .=
" WHERE code = '".$db->escape($pdfformat).
"'";
105 $resql = $db->query($sql);
107 $obj = $db->fetch_object($resql);
109 $width = (int) $obj->width;
110 $height = (int) $obj->height;
116 return array(
'width'=>$width,
'height'=>$height,
'unit'=>$unit);
132 if (!defined(
'K_TCPDF_EXTERNAL_CONFIG')) {
133 define(
'K_TCPDF_EXTERNAL_CONFIG', 1);
134 define(
'K_PATH_CACHE', DOL_DATA_ROOT.
'/admin/temp/');
135 define(
'K_PATH_URL_CACHE', DOL_DATA_ROOT.
'/admin/temp/');
137 define(
'K_BLANK_IMAGE',
'_blank.png');
138 define(
'PDF_PAGE_FORMAT',
'A4');
139 define(
'PDF_PAGE_ORIENTATION',
'P');
140 define(
'PDF_CREATOR',
'TCPDF');
141 define(
'PDF_AUTHOR',
'TCPDF');
142 define(
'PDF_HEADER_TITLE',
'TCPDF Example');
143 define(
'PDF_HEADER_STRING',
"by Dolibarr ERP CRM");
144 define(
'PDF_UNIT',
'mm');
145 define(
'PDF_MARGIN_HEADER', 5);
146 define(
'PDF_MARGIN_FOOTER', 10);
147 define(
'PDF_MARGIN_TOP', 27);
148 define(
'PDF_MARGIN_BOTTOM', 25);
149 define(
'PDF_MARGIN_LEFT', 15);
150 define(
'PDF_MARGIN_RIGHT', 15);
151 define(
'PDF_FONT_NAME_MAIN',
'helvetica');
152 define(
'PDF_FONT_SIZE_MAIN', 10);
153 define(
'PDF_FONT_NAME_DATA',
'helvetica');
154 define(
'PDF_FONT_SIZE_DATA', 8);
155 define(
'PDF_FONT_MONOSPACED',
'courier');
156 define(
'PDF_IMAGE_SCALE_RATIO', 1.25);
157 define(
'HEAD_MAGNIFICATION', 1.1);
158 define(
'K_CELL_HEIGHT_RATIO', 1.25);
159 define(
'K_TITLE_MAGNIFICATION', 1.3);
160 define(
'K_SMALL_RATIO', 2 / 3);
161 define(
'K_THAI_TOPCHARS',
true);
162 define(
'K_TCPDF_CALLS_IN_HTML',
true);
164 define(
'K_TCPDF_THROW_EXCEPTION_ERROR',
true);
166 define(
'K_TCPDF_THROW_EXCEPTION_ERROR',
false);
171 require_once TCPDF_PATH.
'tcpdf.php';
175 require_once TCPDI_PATH.
'tcpdi.php';
184 $pdfa = $conf->global->PDF_USE_A;
187 if (class_exists(
'TCPDI')) {
188 $pdf =
new TCPDI($pagetype, $metric, $format,
true,
'UTF-8',
false, $pdfa);
190 $pdf =
new TCPDF($pagetype, $metric, $format,
true,
'UTF-8',
false, $pdfa);
208 $pdfrights = (
getDolGlobalString(
'PDF_SECURITY_ENCRYPTION_RIGHTS') ? json_decode($conf->global->PDF_SECURITY_ENCRYPTION_RIGHTS,
true) : array(
'modify',
'copy'));
211 $pdfuserpass = (
getDolGlobalString(
'PDF_SECURITY_ENCRYPTION_USERPASS') ? $conf->global->PDF_SECURITY_ENCRYPTION_USERPASS :
'');
214 $pdfownerpass = (
getDolGlobalString(
'PDF_SECURITY_ENCRYPTION_OWNERPASS') ? $conf->global->PDF_SECURITY_ENCRYPTION_OWNERPASS :
null);
217 $encstrength = (
getDolGlobalString(
'PDF_SECURITY_ENCRYPTION_STRENGTH') ? $conf->global->PDF_SECURITY_ENCRYPTION_STRENGTH : 0);
221 $pubkeys = (
getDolGlobalString(
'PDF_SECURITY_ENCRYPTION_PUBKEYS') ? json_decode($conf->global->PDF_SECURITY_ENCRYPTION_PUBKEYS,
true) :
null);
223 $pdf->SetProtection($pdfrights, $pdfuserpass, $pdfownerpass, $encstrength, $pubkeys);
237 require_once TCPDF_PATH.
'tcpdf_parser.php';
239 $isencrypted =
false;
241 $content = file_get_contents($pathoffile);
244 @($parser =
new TCPDF_PARSER(ltrim($content)));
245 list($xref, $data) = $parser->getParsedData();
249 if (isset($xref[
'trailer'][
'encrypt'])) {
271 return $conf->global->MAIN_PDF_FORCE_FONT;
275 if (class_exists(
'TCPDF')) {
276 if ($outputlangs->trans(
'FONTFORPDF') !=
'FONTFORPDF') {
277 $font = $outputlangs->trans(
'FONTFORPDF');
294 if (class_exists(
'TCPDF')) {
295 if ($outputlangs->trans(
'FONTSIZEFORPDF') !=
'FONTSIZEFORPDF') {
296 $size = (int) $outputlangs->trans(
'FONTSIZEFORPDF');
300 $size = $conf->global->MAIN_PDF_FORCE_FONT_SIZE;
317 $height = (!
getDolGlobalString(
'MAIN_DOCUMENTS_LOGO_HEIGHT') ? 20 : $conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT);
319 include_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
321 if ($tmp[
'height']) {
322 $width = round($height * $tmp[
'width'] / $tmp[
'height']);
323 if ($width > $maxwidth) {
324 $height = $height * $maxwidth / $width;
342 $pdf->startTransaction();
344 $start_y = $pdf->GetY();
346 $start_page = $pdf->getPage();
348 $pdf->writeHTMLCell(0, 0, 0, $start_y, $htmlcontent, 0, 1,
false,
true,
'J',
true);
350 $end_y = $pdf->GetY();
351 $end_page = $pdf->getPage();
354 if ($end_page == $start_page) {
355 $height = $end_y - $start_y;
357 for ($page = $start_page; $page <= $end_page; ++$page) {
358 $pdf->setPage($page);
359 $tmpm = $pdf->getMargins();
360 $tMargin = $tmpm[
'top'];
361 if ($page == $start_page) {
363 $height = $pdf->getPageHeight() - $start_y - $pdf->getBreakMargin();
364 } elseif ($page == $end_page) {
366 $height = $end_y - $tMargin;
368 $height = $pdf->getPageHeight() - $tMargin - $pdf->getBreakMargin();
373 $pdf = $pdf->rollbackTransaction();
394 if ($thirdparty instanceof
Societe) {
395 $socname = $thirdparty->name;
396 if (($includealias ||
getDolGlobalInt(
'PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) && !empty($thirdparty->name_alias)) {
398 $socname = $thirdparty->name_alias.
" - ".$thirdparty->name;
400 $socname = $thirdparty->name.
" - ".$thirdparty->name_alias;
403 } elseif ($thirdparty instanceof
Contact) {
404 if ($thirdparty->socid > 0) {
405 $thirdparty->fetch_thirdparty();
406 $socname = $thirdparty->thirdparty->name;
407 if (($includealias ||
getDolGlobalInt(
'PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) && !empty($thirdparty->thirdparty->name_alias)) {
409 $socname = $thirdparty->thirdparty->name_alias.
" - ".$thirdparty->thirdparty->name;
411 $socname = $thirdparty->thirdparty->name.
" - ".$thirdparty->thirdparty->name_alias;
416 throw new InvalidArgumentException(
'Parameter 1 $thirdparty is not a Societe nor Contact');
419 return $outputlangs->convToOutputCharset($socname);
435function pdf_build_address($outputlangs, $sourcecompany, $targetcompany =
'', $targetcontact =
'', $usecontact = 0, $mode =
'source', $object =
null)
437 global $conf, $hookmanager;
439 if ($mode ==
'source' && !is_object($sourcecompany)) {
442 if ($mode ==
'target' && !is_object($targetcompany)) {
446 if (!empty($sourcecompany->state_id) && empty($sourcecompany->state)) {
447 $sourcecompany->state =
getState($sourcecompany->state_id);
449 if (!empty($targetcompany->state_id) && empty($targetcompany->state)) {
450 $targetcompany->state =
getState($targetcompany->state_id);
455 if (is_object($hookmanager)) {
456 $parameters = array(
'sourcecompany' => &$sourcecompany,
'targetcompany' => &$targetcompany,
'targetcontact' => &$targetcontact,
'outputlangs' => $outputlangs,
'mode' => $mode,
'usecontact' => $usecontact);
458 $reshook = $hookmanager->executeHooks(
'pdf_build_address', $parameters, $object, $action);
459 $stringaddress .= $hookmanager->resPrint;
461 if (empty($reshook)) {
462 if ($mode ==
'source') {
464 if (isset($targetcompany->country_code) && !empty($sourcecompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) {
468 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset(
dol_format_address($sourcecompany, $withCountry,
"\n", $outputlangs)).
"\n";
472 if ($sourcecompany->phone) {
473 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"PhoneShort").
": ".$outputlangs->convToOutputCharset($sourcecompany->phone);
476 if ($sourcecompany->fax) {
477 $stringaddress .= ($stringaddress ? ($sourcecompany->phone ?
" - " :
"\n") :
'').$outputlangs->transnoentities(
"Fax").
": ".$outputlangs->convToOutputCharset($sourcecompany->fax);
480 if ($sourcecompany->email) {
481 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Email").
": ".$outputlangs->convToOutputCharset($sourcecompany->email);
484 if ($sourcecompany->url) {
485 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Web").
": ".$outputlangs->convToOutputCharset($sourcecompany->url);
490 if ($sourcecompany->tva_intra) {
491 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"VATIntraShort").
': '.$outputlangs->convToOutputCharset($sourcecompany->tva_intra);
496 if (
getDolGlobalString(
'MAIN_PROFID1_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof1)) {
497 $tmp = $outputlangs->transcountrynoentities(
"ProfId1", $sourcecompany->country_code);
498 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
501 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof1);
503 if (
getDolGlobalString(
'MAIN_PROFID2_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof2)) {
504 $tmp = $outputlangs->transcountrynoentities(
"ProfId2", $sourcecompany->country_code);
505 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
508 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof2);
510 if (
getDolGlobalString(
'MAIN_PROFID3_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof3)) {
511 $tmp = $outputlangs->transcountrynoentities(
"ProfId3", $sourcecompany->country_code);
512 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
515 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof3);
517 if (
getDolGlobalString(
'MAIN_PROFID4_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof4)) {
518 $tmp = $outputlangs->transcountrynoentities(
"ProfId4", $sourcecompany->country_code);
519 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
522 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof4);
524 if (
getDolGlobalString(
'MAIN_PROFID5_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof5)) {
525 $tmp = $outputlangs->transcountrynoentities(
"ProfId5", $sourcecompany->country_code);
526 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
529 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof5);
531 if (
getDolGlobalString(
'MAIN_PROFID6_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof6)) {
532 $tmp = $outputlangs->transcountrynoentities(
"ProfId6", $sourcecompany->country_code);
533 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
536 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof6);
539 $stringaddress .= ($stringaddress ?
"\n" :
'') .
getDolGlobalString(
'PDF_ADD_MORE_AFTER_SOURCE_ADDRESS');
543 if ($mode ==
'target' || preg_match(
'/targetwithdetails/', $mode)) {
545 if (is_object($targetcontact)) {
546 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs, 1));
548 if (!empty($targetcontact->address)) {
549 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset(
dol_format_address($targetcontact)).
"\n";
551 $companytouseforaddress = $targetcompany;
554 if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id) {
555 $targetcontact->fetch_thirdparty();
556 $companytouseforaddress = $targetcontact->thirdparty;
559 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset(
dol_format_address($companytouseforaddress)).
"\n";
562 if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) {
563 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv(
"Country".$targetcontact->country_code));
564 } elseif (empty($targetcontact->country_code) && !empty($targetcompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) {
565 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv(
"Country".$targetcompany->country_code));
568 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || preg_match(
'/targetwithdetails/', $mode)) {
570 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_phone/', $mode)) {
571 if (!empty($targetcontact->phone_pro) || !empty($targetcontact->phone_mobile)) {
572 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Phone").
": ";
574 if (!empty($targetcontact->phone_pro)) {
575 $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro);
577 if (!empty($targetcontact->phone_pro) && !empty($targetcontact->phone_mobile)) {
578 $stringaddress .=
" / ";
580 if (!empty($targetcontact->phone_mobile)) {
581 $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile);
585 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_fax/', $mode)) {
586 if ($targetcontact->fax) {
587 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Fax").
": ".$outputlangs->convToOutputCharset($targetcontact->fax);
591 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_email/', $mode)) {
592 if ($targetcontact->email) {
593 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Email").
": ".$outputlangs->convToOutputCharset($targetcontact->email);
597 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_url/', $mode)) {
598 if ($targetcontact->url) {
599 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Web").
": ".$outputlangs->convToOutputCharset($targetcontact->url);
605 if (is_object($targetcompany)) {
606 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset(
dol_format_address($targetcompany));
608 if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) {
609 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv(
"Country".$targetcompany->country_code));
611 $stringaddress .= ($stringaddress ?
"\n" :
'');
614 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || preg_match(
'/targetwithdetails/', $mode)) {
616 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_phone/', $mode)) {
617 if (!empty($targetcompany->phone)) {
618 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Phone").
": ";
620 if (!empty($targetcompany->phone)) {
621 $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone);
625 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_fax/', $mode)) {
626 if ($targetcompany->fax) {
627 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Fax").
": ".$outputlangs->convToOutputCharset($targetcompany->fax);
631 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_email/', $mode)) {
632 if ($targetcompany->email) {
633 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Email").
": ".$outputlangs->convToOutputCharset($targetcompany->email);
637 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_url/', $mode)) {
638 if ($targetcompany->url) {
639 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Web").
": ".$outputlangs->convToOutputCharset($targetcompany->url);
648 if ($usecontact && is_object($targetcontact) &&
getDolGlobalInt(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')) {
649 $targetcontact->fetch_thirdparty();
650 if (!empty($targetcontact->thirdparty->id) && $targetcontact->thirdparty->tva_intra) {
651 $stringaddress .= ($stringaddress ?
"\n" :
'') . $outputlangs->transnoentities(
"VATIntraShort") .
': ' . $outputlangs->convToOutputCharset($targetcontact->thirdparty->tva_intra);
653 } elseif ($targetcompany->tva_intra) {
654 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"VATIntraShort").
': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra);
659 if (
getDolGlobalString(
'MAIN_PROFID1_IN_ADDRESS') && !empty($targetcompany->idprof1)) {
660 $tmp = $outputlangs->transcountrynoentities(
"ProfId1", $targetcompany->country_code);
661 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
664 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof1);
666 if (
getDolGlobalString(
'MAIN_PROFID2_IN_ADDRESS') && !empty($targetcompany->idprof2)) {
667 $tmp = $outputlangs->transcountrynoentities(
"ProfId2", $targetcompany->country_code);
668 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
671 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof2);
673 if (
getDolGlobalString(
'MAIN_PROFID3_IN_ADDRESS') && !empty($targetcompany->idprof3)) {
674 $tmp = $outputlangs->transcountrynoentities(
"ProfId3", $targetcompany->country_code);
675 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
678 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof3);
680 if (
getDolGlobalString(
'MAIN_PROFID4_IN_ADDRESS') && !empty($targetcompany->idprof4)) {
681 $tmp = $outputlangs->transcountrynoentities(
"ProfId4", $targetcompany->country_code);
682 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
685 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof4);
687 if (
getDolGlobalString(
'MAIN_PROFID5_IN_ADDRESS') && !empty($targetcompany->idprof5)) {
688 $tmp = $outputlangs->transcountrynoentities(
"ProfId5", $targetcompany->country_code);
689 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
692 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof5);
694 if (
getDolGlobalString(
'MAIN_PROFID6_IN_ADDRESS') && !empty($targetcompany->idprof6)) {
695 $tmp = $outputlangs->transcountrynoentities(
"ProfId6", $targetcompany->country_code);
696 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
699 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof6);
704 if ($mode ==
'source' && !empty($sourcecompany->note_public)) {
705 $stringaddress .= ($stringaddress ?
"\n" :
'').
dol_string_nohtmltag($sourcecompany->note_public);
707 if (($mode ==
'target' || preg_match(
'/targetwithdetails/', $mode)) && !empty($targetcompany->note_public)) {
708 $stringaddress .= ($stringaddress ?
"\n" :
'').
dol_string_nohtmltag($targetcompany->note_public);
714 return $stringaddress;
732 $filepath = $conf->mycompany->dir_output.
'/logos/' .
getDolGlobalString(
'MAIN_USE_BACKGROUND_ON_PDF');
733 if (file_exists($filepath)) {
734 $pdf->SetAutoPageBreak(0, 0);
736 $pdf->SetAlpha($conf->global->MAIN_USE_BACKGROUND_ON_PDF_ALPHA);
738 $pdf->Image($filepath, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_X : 0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y : 0), 0, $page_height);
743 $pdf->SetAutoPageBreak(1, 0);
765 $substitutionarray[
'__FROM_NAME__'] =
'__FROM_NAME__';
766 $substitutionarray[
'__FROM_EMAIL__'] =
'__FROM_EMAIL__';
767 return $substitutionarray;
784 global $langs, $mysoc, $user;
789 } elseif ($unit ==
'mm') {
791 } elseif ($unit ==
'cm') {
793 } elseif ($unit ==
'in') {
801 $text = $outputlangs->convToOutputCharset($text);
803 $savx = $pdf->getX();
804 $savy = $pdf->getY();
806 $watermark_angle = atan($h / $w) / 2;
807 $watermark_x_pos = 0;
808 $watermark_y_pos = $h / 3;
809 $watermark_x = $w / 2;
810 $watermark_y = $h / 3;
811 $pdf->SetFont(
'',
'B', 40);
812 $pdf->SetTextColor(255, 192, 203);
814 $pdf->_out(sprintf(
'q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm', cos($watermark_angle), sin($watermark_angle), -sin($watermark_angle), cos($watermark_angle), $watermark_x * $k, ($h - $watermark_y) * $k, -$watermark_x * $k, -($h - $watermark_y) * $k));
816 $pdf->SetXY($watermark_x_pos, $watermark_y_pos);
817 $pdf->Cell($w - 20, 25, $outputlangs->convToOutputCharset($text),
"", 2,
"C", 0);
821 $pdf->SetXY($savx, $savy);
837function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0, $default_font_size = 10)
839 global $mysoc, $conf;
841 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formbank.class.php';
843 $diffsizetitle = (!
getDolGlobalString(
'PDF_DIFFSIZE_TITLE') ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
844 $diffsizecontent = (!
getDolGlobalString(
'PDF_DIFFSIZE_CONTENT') ? 4 : $conf->global->PDF_DIFFSIZE_CONTENT);
845 $pdf->SetXY($curx, $cury);
847 if (empty($onlynumber)) {
848 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
849 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByTransferOnThisBankAccount').
':', 0,
'L', 0);
853 $outputlangs->load(
"banks");
856 $bickey =
"BICNumber";
857 if ($account->getCountryCode() ==
'IN') {
862 $usedetailedbban = $account->useDetailedBBAN();
865 if ($usedetailedbban) {
868 if (empty($onlynumber)) {
869 $pdf->SetFont(
'',
'', $default_font_size - $diffsizecontent);
870 $pdf->SetXY($curx, $cury);
871 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Bank").
': '.$outputlangs->convToOutputCharset($account->bank), 0,
'L', 0);
881 if (empty($onlynumber)) {
882 $pdf->line($curx + 1, $cury + 1, $curx + 1, $cury + 6);
886 foreach ($account->getFieldsToShow() as $val) {
887 $pdf->SetXY($curx, $cury + 4);
888 $pdf->SetFont(
'',
'', $default_font_size - 3);
890 if ($val ==
'BankCode') {
893 $content = $account->code_banque;
894 } elseif ($val ==
'DeskCode') {
897 $content = $account->code_guichet;
898 } elseif ($val ==
'BankAccountNumber') {
901 $content = $account->number;
902 } elseif ($val ==
'BankAccountNumberKey') {
905 $content = $account->cle_rib;
906 } elseif ($val ==
'IBAN' || $val ==
'BIC') {
911 dol_print_error($account->db,
'Unexpected value for getFieldsToShow: '.$val);
915 $pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($content), 0,
'C', 0);
916 $pdf->SetXY($curx, $cury + 1);
918 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizecontent);
919 $pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities($val), 0,
'C', 0);
920 if (empty($onlynumber)) {
921 $pdf->line($curx, $cury + 1, $curx, $cury + 7);
929 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizecontent);
930 $pdf->SetXY($curx, $cury);
931 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Bank").
': '.$outputlangs->convToOutputCharset($account->bank), 0,
'L', 0);
934 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizecontent);
935 $pdf->SetXY($curx, $cury);
936 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"BankAccountNumber").
': '.$outputlangs->convToOutputCharset($account->number), 0,
'L', 0);
939 if ($diffsizecontent <= 2) {
944 $pdf->SetFont(
'',
'', $default_font_size - $diffsizecontent);
946 if (empty($onlynumber) && !empty($account->domiciliation)) {
947 $pdf->SetXY($curx, $cury);
948 $val = $outputlangs->transnoentities(
"Residence").
': '.$outputlangs->convToOutputCharset($account->domiciliation);
949 $pdf->MultiCell(100, 3, $val, 0,
'L', 0);
952 $tmpy = $pdf->getStringHeight(100, $val);
956 if (!empty($account->proprio)) {
957 $pdf->SetXY($curx, $cury);
958 $val = $outputlangs->transnoentities(
"BankAccountOwner").
': '.$outputlangs->convToOutputCharset($account->proprio);
959 $pdf->MultiCell(100, 3, $val, 0,
'L', 0);
960 $tmpy = $pdf->getStringHeight(100, $val);
962 } elseif (!$usedetailedbban) {
969 if (!empty($account->iban)) {
971 $ibanDisplay_temp = str_replace(
' ',
'', $outputlangs->convToOutputCharset($account->iban));
974 $nbIbanDisplay_temp =
dol_strlen($ibanDisplay_temp);
975 for ($i = 0; $i < $nbIbanDisplay_temp; $i++) {
976 $ibanDisplay .= $ibanDisplay_temp[$i];
977 if ($i % 4 == 3 && $i > 0) {
982 $pdf->SetFont(
'',
'B', $default_font_size - 3);
983 $pdf->SetXY($curx, $cury);
984 $pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey).
': '.$ibanDisplay, 0,
'L', 0);
988 if (!empty($account->bic)) {
989 $pdf->SetFont(
'',
'B', $default_font_size - 3);
990 $pdf->SetXY($curx, $cury);
991 $pdf->MultiCell(100, 3, $outputlangs->transnoentities($bickey).
': '.$outputlangs->convToOutputCharset($account->bic), 0,
'L', 0);
1014function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails = 0, $hidefreetext = 0, $page_largeur = 0, $watermark =
'')
1016 global $conf, $user, $mysoc, $hookmanager;
1018 $outputlangs->load(
"dict");
1022 $dims = $pdf->getPageDimensions();
1025 if (empty($hidefreetext) && !empty($conf->global->$paramfreetext)) {
1028 $substitutionarray[
'__FROM_NAME__'] = $fromcompany->name;
1029 $substitutionarray[
'__FROM_EMAIL__'] = $fromcompany->email;
1037 $newfreetext = preg_replace(
'/(<img.*src=")[^\"]*viewimage\.php[^\"]*modulepart=medias[^\"]*file=([^\"]*)("[^\/]*\/>)/',
'\1file:/'.DOL_DATA_ROOT.
'/medias/\2\3', $newfreetext);
1039 $line .= $outputlangs->convToOutputCharset($newfreetext);
1048 if ($showdetails == 1 || $showdetails == 3) {
1050 if ($fromcompany->name) {
1051 $line1 .= ($line1 ?
" - " :
"").$outputlangs->transnoentities(
"RegisteredOffice").
": ".$fromcompany->name;
1054 if ($fromcompany->address) {
1055 $line1 .= ($line1 ?
" - " :
"").str_replace(
"\n",
", ", $fromcompany->address);
1058 if ($fromcompany->zip) {
1059 $line1 .= ($line1 ?
" - " :
"").$fromcompany->zip;
1062 if ($fromcompany->town) {
1063 $line1 .= ($line1 ?
" " :
"").$fromcompany->town;
1066 if ($fromcompany->country) {
1067 $line1 .= ($line1 ?
", " :
"").$fromcompany->country;
1070 if ($fromcompany->phone) {
1071 $line2 .= ($line2 ?
" - " :
"").$outputlangs->transnoentities(
"Phone").
": ".$fromcompany->phone;
1074 if ($fromcompany->fax) {
1075 $line2 .= ($line2 ?
" - " :
"").$outputlangs->transnoentities(
"Fax").
": ".$fromcompany->fax;
1079 if ($fromcompany->url) {
1080 $line2 .= ($line2 ?
" - " :
"").$fromcompany->url;
1083 if ($fromcompany->email) {
1084 $line2 .= ($line2 ?
" - " :
"").$fromcompany->email;
1087 if ($showdetails == 2 || $showdetails == 3 || (!empty($fromcompany->country_code) && $fromcompany->country_code ==
'DE')) {
1089 if ($fromcompany->managers) {
1090 $line2 .= ($line2 ?
" - " :
"").$fromcompany->managers;
1096 if (!empty($fromcompany->forme_juridique_code) && $fromcompany->forme_juridique_code) {
1097 $line3 .= ($line3 ?
" - " :
"").$outputlangs->convToOutputCharset(
getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
1100 if (!empty($fromcompany->capital)) {
1101 $tmpamounttoshow =
price2num($fromcompany->capital);
1102 if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) {
1103 $line3 .= ($line3 ?
" - " :
"").$outputlangs->transnoentities(
"CapitalOf",
price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency));
1104 } elseif (!empty($fromcompany->capital)) {
1105 $line3 .= ($line3 ?
" - " :
"").$outputlangs->transnoentities(
"CapitalOf", $fromcompany->capital, $outputlangs);
1109 if (!empty($fromcompany->idprof1) && $fromcompany->idprof1 && ($fromcompany->country_code !=
'FR' || !$fromcompany->idprof2)) {
1110 $field = $outputlangs->transcountrynoentities(
"ProfId1", $fromcompany->country_code);
1111 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1114 $line3 .= ($line3 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof1);
1117 if (!empty($fromcompany->idprof2) && $fromcompany->idprof2) {
1118 $field = $outputlangs->transcountrynoentities(
"ProfId2", $fromcompany->country_code);
1119 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1122 $line3 .= ($line3 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof2);
1127 if (!empty($fromcompany->idprof3) && $fromcompany->idprof3) {
1128 $field = $outputlangs->transcountrynoentities(
"ProfId3", $fromcompany->country_code);
1129 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1132 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof3);
1135 if (!empty($fromcompany->idprof4) && $fromcompany->idprof4) {
1136 $field = $outputlangs->transcountrynoentities(
"ProfId4", $fromcompany->country_code);
1137 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1140 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof4);
1143 if (!empty($fromcompany->idprof5) && $fromcompany->idprof5) {
1144 $field = $outputlangs->transcountrynoentities(
"ProfId5", $fromcompany->country_code);
1145 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1148 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof5);
1151 if (!empty($fromcompany->idprof6) && $fromcompany->idprof6) {
1152 $field = $outputlangs->transcountrynoentities(
"ProfId6", $fromcompany->country_code);
1153 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1156 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof6);
1159 if (!empty($fromcompany->idprof7) && $fromcompany->idprof7) {
1160 $field = $outputlangs->transcountrynoentities(
"ProfId7", $fromcompany->country_code);
1161 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1164 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof7);
1167 if (!empty($fromcompany->idprof8) && $fromcompany->idprof8) {
1168 $field = $outputlangs->transcountrynoentities(
"ProfId8", $fromcompany->country_code);
1169 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1172 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof8);
1175 if (!empty($fromcompany->idprof9) && $fromcompany->idprof9) {
1176 $field = $outputlangs->transcountrynoentities(
"ProfId9", $fromcompany->country_code);
1177 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1180 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof9);
1183 if (!empty($fromcompany->idprof10) && $fromcompany->idprof10) {
1184 $field = $outputlangs->transcountrynoentities(
"ProfId10", $fromcompany->country_code);
1185 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1188 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof10);
1191 if (!empty($fromcompany->tva_intra) && $fromcompany->tva_intra !=
'') {
1192 $line4 .= ($line4 ?
" - " :
"").$outputlangs->transnoentities(
"VATIntraShort").
": ".$outputlangs->convToOutputCharset($fromcompany->tva_intra);
1195 $pdf->SetFont(
'',
'', 7);
1196 $pdf->SetDrawColor(224, 224, 224);
1199 list($r, $g, $b) = sscanf($conf->global->PDF_FOOTER_TEXT_COLOR,
'%d, %d, %d');
1200 $pdf->SetTextColor($r, $g, $b);
1204 $freetextheight = 0;
1214 $freetextheight = $pdf->getStringHeight($width, $line);
1222 if (is_object($hookmanager)) {
1223 $parameters = array(
'line1' => $line1,
'line2' => $line2,
'line3' => $line3,
'line4' => $line4,
'outputlangs'=>$outputlangs);
1225 $hookmanager->executeHooks(
'pdf_pagefoot', $parameters, $object, $action);
1226 if (!empty($hookmanager->resPrint) && $hidefreetext == 0) {
1227 $mycustomfooter = $hookmanager->resPrint;
1230 $marginwithfooter = $marge_basse + $freetextheight + $mycustomfooterheight;
1231 $posy = (float) $marginwithfooter;
1235 list($r, $g, $b) = sscanf($conf->global->PDF_FOOTER_BACKGROUND_COLOR,
'%d, %d, %d');
1236 $pdf->SetAutoPageBreak(0, 0);
1237 $pdf->Rect(0, $dims[
'hk'] - $posy + $freetextheight, $dims[
'wk'] + 1, $marginwithfooter + 1,
'F',
'', $fill_color = array($r, $g, $b));
1238 $pdf->SetAutoPageBreak(1, 0);
1242 $pdf->SetAutoPageBreak(0, 0);
1245 $pdf->SetXY($dims[
'lm'], -$posy);
1247 $pdf->MultiCell(0, 3, $line, 0, $align, 0);
1249 $pdf->writeHTMLCell($dims[
'wk'] - $dims[
'lm'] - $dims[
'rm'], $freetextheight, $dims[
'lm'], $dims[
'hk'] - $marginwithfooter,
dol_htmlentitiesbr($line, 1,
'UTF-8', 0));
1251 $posy -= $freetextheight;
1254 $pdf->SetAutoPageBreak(1, 0);
1261 $pdf->line($dims[
'lm'], $dims[
'hk'] - $posy, $dims[
'wk'] - $dims[
'rm'], $dims[
'hk'] - $posy);
1272 $pdf->SetAutoPageBreak(0, 0);
1274 $pdf->writeHTMLCell($dims[
'wk'] - $dims[
'lm'] - $dims[
'rm'], $mycustomfooterheight, $dims[
'lm'], $dims[
'hk'] - $posy,
dol_htmlentitiesbr($mycustomfooter, 1,
'UTF-8', 0));
1276 $pdf->SetAutoPageBreak(1, 0);
1279 $posy -= $mycustomfooterheight - 3;
1282 $marginwithfooter = $marge_basse + $freetextheight + (!empty($line1) ? 3 : 0) + (!empty($line2) ? 3 : 0) + (!empty($line3) ? 3 : 0) + (!empty($line4) ? 3 : 0);
1283 $posy = (float) $marginwithfooter;
1287 list($r, $g, $b) = sscanf($conf->global->PDF_FOOTER_BACKGROUND_COLOR,
'%d, %d, %d');
1288 $pdf->SetAutoPageBreak(0, 0);
1289 $pdf->Rect(0, $dims[
'hk'] - $posy + $freetextheight, $dims[
'wk'] + 1, $marginwithfooter + 1,
'F',
'', $fill_color = array($r, $g, $b));
1290 $pdf->SetAutoPageBreak(1, 0);
1294 $pdf->SetAutoPageBreak(0, 0);
1297 $pdf->SetXY($dims[
'lm'], -$posy);
1299 $pdf->MultiCell(0, 3, $line, 0, $align, 0);
1301 $pdf->writeHTMLCell($dims[
'wk'] - $dims[
'lm'] - $dims[
'rm'], $freetextheight, $dims[
'lm'], $dims[
'hk'] - $marginwithfooter,
dol_htmlentitiesbr($line, 1,
'UTF-8', 0));
1303 $posy -= $freetextheight;
1306 $pdf->SetAutoPageBreak(1, 0);
1315 $pdf->line($dims[
'lm'], $dims[
'hk'] - $posy, $dims[
'wk'] - $dims[
'rm'], $dims[
'hk'] - $posy);
1325 if (!empty($line1)) {
1326 $pdf->SetFont(
'',
'B', 7);
1327 $pdf->SetXY($dims[
'lm'], -$posy);
1328 $pdf->MultiCell($dims[
'wk'] - $dims[
'rm'] - $dims[
'lm'], 2, $line1, 0,
'C', 0);
1330 $pdf->SetFont(
'',
'', 7);
1333 if (!empty($line2)) {
1334 $pdf->SetFont(
'',
'B', 7);
1335 $pdf->SetXY($dims[
'lm'], -$posy);
1336 $pdf->MultiCell($dims[
'wk'] - $dims[
'rm'] - $dims[
'lm'], 2, $line2, 0,
'C', 0);
1338 $pdf->SetFont(
'',
'', 7);
1341 if (!empty($line3)) {
1342 $pdf->SetXY($dims[
'lm'], -$posy);
1343 $pdf->MultiCell($dims[
'wk'] - $dims[
'rm'] - $dims[
'lm'], 2, $line3, 0,
'C', 0);
1346 if (!empty($line4)) {
1348 $pdf->SetXY($dims[
'lm'], -$posy);
1349 $pdf->MultiCell($dims[
'wk'] - $dims[
'rm'] - $dims[
'lm'], 2, $line4, 0,
'C', 0);
1356 $pdf->SetXY($dims[
'wk'] - $dims[
'rm'] - 18 -
getDolGlobalInt(
'PDF_FOOTER_PAGE_NUMBER_X', 0), -$posy -
getDolGlobalInt(
'PDF_FOOTER_PAGE_NUMBER_Y', 0));
1357 $pagination = $pdf->PageNo().
' / '.$pdf->getAliasNbPages();
1358 $fontRenderCorrection = 0;
1359 if (in_array(
pdf_getPDFFont($outputlangs), array(
'freemono',
'DejaVuSans'))) {
1360 $fontRenderCorrection = 10;
1362 $pdf->MultiCell(18 + $fontRenderCorrection, 2, $pagination, 0,
'R', 0);
1365 if (!empty($watermark)) {
1366 pdf_watermark($pdf, $outputlangs, $page_hauteur, $page_largeur,
'mm', $watermark);
1369 return $marginwithfooter;
1389 if (!empty($linkedobjects)) {
1390 foreach ($linkedobjects as $linkedobject) {
1391 $reftoshow = $linkedobject[
"ref_title"].
' : '.$linkedobject[
"ref_value"];
1392 if (!empty($linkedobject[
"date_value"])) {
1393 $reftoshow .=
' / '.$linkedobject[
"date_value"];
1397 $pdf->SetXY($posx, $posy);
1398 $pdf->SetFont(
'',
'', $default_font_size - 2);
1399 $pdf->MultiCell($w, $h, $reftoshow,
'', $align);
1403 return $pdf->getY();
1422function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
1424 global $db, $conf, $langs, $hookmanager;
1429 if (is_object($hookmanager)) {
1430 $special_code = empty($object->lines[$i]->special_code) ?
'' : $object->lines[$i]->special_code;
1431 if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
1432 $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
1434 $parameters = array(
'pdf'=>$pdf,
'i'=>$i,
'outputlangs'=>$outputlangs,
'w'=>$w,
'h'=>$h,
'posx'=>$posx,
'posy'=>$posy,
'hideref'=>$hideref,
'hidedesc'=>$hidedesc,
'issupplierline'=>$issupplierline,
'special_code'=>$special_code);
1436 $reshook = $hookmanager->executeHooks(
'pdf_writelinedesc', $parameters, $object, $action);
1438 if (!empty($hookmanager->resPrint)) {
1439 $result .= $hookmanager->resPrint;
1442 if (empty($reshook)) {
1443 $labelproductservice =
pdf_getlinedesc($object, $i, $outputlangs, $hideref, $hidedesc, $issupplierline);
1450 $labelproductservice = preg_replace(
'/(<img[^>]*src=")([^"]*)(&)([^"]*")/',
'\1\2&\4', $labelproductservice, -1, $nbrep);
1453 $pdf->setListIndentWidth(5);
1454 $TMarginList = [
'ul' => [[
'h'=>0.1, ],[
'h'=>0.1, ]],
'li' => [[
'h'=>0.1, ],],];
1455 $pdf->setHtmlVSpace($TMarginList);
1459 $pdf->writeHTMLCell($w, $h, $posx, $posy, $outputlangs->convToOutputCharset($labelproductservice), 0, 1,
false,
true,
'J',
true);
1460 $result .= $labelproductservice;
1476function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
1478 global $db, $conf, $langs;
1480 $idprod = (!empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product :
false);
1481 $label = (!empty($object->lines[$i]->label) ? $object->lines[$i]->label : (!empty($object->lines[$i]->product_label) ? $object->lines[$i]->product_label :
''));
1482 $product_barcode = (!empty($object->lines[$i]->product_barcode) ? $object->lines[$i]->product_barcode :
"");
1483 $desc = (!empty($object->lines[$i]->desc) ? $object->lines[$i]->desc : (!empty($object->lines[$i]->description) ? $object->lines[$i]->description :
''));
1484 $ref_supplier = (!empty($object->lines[$i]->ref_supplier) ? $object->lines[$i]->ref_supplier : (!empty($object->lines[$i]->ref_fourn) ? $object->lines[$i]->ref_fourn :
''));
1485 $note = (!empty($object->lines[$i]->note) ? $object->lines[$i]->note :
'');
1486 $dbatch = (!empty($object->lines[$i]->detail_batch) ? $object->lines[$i]->detail_batch :
false);
1488 if ($issupplierline) {
1489 include_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
1492 include_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
1496 include_once DOL_DOCUMENT_ROOT .
'/product/class/productcustomerprice.class.php';
1501 $prodser->fetch($idprod);
1503 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && ($outputlangs->defaultlang != $langs->defaultlang)) {
1504 $translatealsoifmodified = (
getDolGlobalString(
'MAIN_MULTILANG_TRANSLATE_EVEN_IF_MODIFIED'));
1512 $textwasnotmodified = ($label == $prodser->label);
1513 if (!empty($prodser->multilangs[$outputlangs->defaultlang][
"label"]) && ($textwasnotmodified || $translatealsoifmodified)) {
1514 $label = $prodser->multilangs[$outputlangs->defaultlang][
"label"];
1519 $textwasnotmodified =
false;
1523 $textwasnotmodified = ($desc == $prodser->description);
1525 if (!empty($prodser->multilangs[$outputlangs->defaultlang][
"description"])) {
1526 if ($textwasnotmodified) {
1527 $desc = str_replace($prodser->description, $prodser->multilangs[$outputlangs->defaultlang][
"description"], $desc);
1528 } elseif ($translatealsoifmodified) {
1529 $desc = $prodser->multilangs[$outputlangs->defaultlang][
"description"];
1534 $textwasnotmodified = ($note == $prodser->note_public);
1535 if (!empty($prodser->multilangs[$outputlangs->defaultlang][
"other"]) && ($textwasnotmodified || $translatealsoifmodified)) {
1536 $note = $prodser->multilangs[$outputlangs->defaultlang][
"other"];
1539 } elseif (($object->element ==
'facture' || $object->element ==
'facturefourn') && preg_match(
'/^\(DEPOSIT\).+/', $desc)) {
1540 $desc = str_replace(
'(DEPOSIT)', $outputlangs->trans(
'Deposit'), $desc);
1545 $libelleproduitservice = $label;
1546 if (!empty($libelleproduitservice) &&
getDolGlobalString(
'PDF_BOLD_PRODUCT_LABEL')) {
1550 $libelleproduitservice = str_replace(
"\n",
'<br>', $libelleproduitservice);
1552 $libelleproduitservice =
'<b>'.$libelleproduitservice.
'</b>';
1559 $prodser->get_sousproduits_arbo();
1560 if (!empty($prodser->sousprods) && is_array($prodser->sousprods) && count($prodser->sousprods)) {
1561 $outputlangs->load(
'mrp');
1562 $tmparrayofsubproducts = reset($prodser->sousprods);
1565 if (isset($object->lines[$i]->qty) && !empty($object->lines[$i]->qty)) {
1566 $qtyText = $object->lines[$i]->qty;
1567 } elseif (isset($object->lines[$i]->qty_shipped) && !empty($object->lines[$i]->qty_shipped)) {
1568 $qtyText = $object->lines[$i]->qty;
1572 foreach ($tmparrayofsubproducts as $subprodval) {
1576 $outputlangs->trans(
'Qty').
':'.$qtyText.
' x '.$outputlangs->trans(
'AssociatedProducts').
':'.$subprodval[1].
'= '.$outputlangs->trans(
'QtyTot').
':'.$subprodval[1]*$qtyText :
1577 $outputlangs->trans(
'Qty').
' '.$outputlangs->trans(
'AssociatedProducts').
':'.$subprodval[1])
1581 foreach ($tmparrayofsubproducts as $subprodval) {
1583 dol_concatdesc($libelleproduitservice,
" * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ?
' - ' :
'').$subprodval[3]),
1585 $outputlangs->trans(
'Qty').
':'.$qtyText.
' x '.$outputlangs->trans(
'AssociatedProducts').
':'.$subprodval[1].
'= '.$outputlangs->trans(
'QtyTot').
':'.$subprodval[1]*$qtyText :
1586 $outputlangs->trans(
'Qty').
' '.$outputlangs->trans(
'AssociatedProducts').
':'.$subprodval[1])
1593 if (isModEnabled(
'barcode') &&
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE') && !empty($product_barcode)) {
1594 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $outputlangs->trans(
"BarCode").
" ".$product_barcode);
1598 if (!empty($desc) && ($desc != $label)) {
1599 if ($desc ==
'(CREDIT_NOTE)' && $object->lines[$i]->fk_remise_except) {
1601 $discount->fetch($object->lines[$i]->fk_remise_except);
1602 $sourceref = !empty($discount->discount_type) ? $discount->ref_invoice_supplier_source : $discount->ref_facture_source;
1603 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromCreditNote", $sourceref);
1604 } elseif ($desc ==
'(DEPOSIT)' && $object->lines[$i]->fk_remise_except) {
1606 $discount->fetch($object->lines[$i]->fk_remise_except);
1607 $sourceref = !empty($discount->discount_type) ? $discount->ref_invoice_supplier_source : $discount->ref_facture_source;
1608 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromDeposit", $sourceref);
1611 $libelleproduitservice .=
' ('.dol_print_date($discount->datec,
'day',
'', $outputlangs).
')';
1613 } elseif ($desc ==
'(EXCESS RECEIVED)' && $object->lines[$i]->fk_remise_except) {
1615 $discount->fetch($object->lines[$i]->fk_remise_except);
1616 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromExcessReceived", $discount->ref_facture_source);
1617 } elseif ($desc ==
'(EXCESS PAID)' && $object->lines[$i]->fk_remise_except) {
1619 $discount->fetch($object->lines[$i]->fk_remise_except);
1620 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromExcessPaid", $discount->ref_invoice_supplier_source);
1624 if (!empty($object->element)) {
1625 $tmpkey =
'MAIN_DOCUMENTS_HIDE_DESCRIPTION_FOR_'.strtoupper($object->element);
1626 if (!empty($conf->global->$tmpkey)) {
1630 if (empty($hidedesc)) {
1632 $libelleproduitservice =
dol_concatdesc($desc, $libelleproduitservice);
1635 $libelleproduitservice = $desc;
1637 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $desc);
1642 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $desc);
1648 $prefix_prodserv =
"";
1651 if ($prodser->isService()) {
1652 $prefix_prodserv = $outputlangs->transnoentitiesnoconv(
"Service").
" ";
1654 $prefix_prodserv = $outputlangs->transnoentitiesnoconv(
"Product").
" ";
1658 if (empty($hideref)) {
1659 if ($issupplierline) {
1661 $ref_prodserv = $prodser->ref;
1662 if ($ref_supplier) {
1663 $ref_prodserv .= ($prodser->ref ?
' (' :
'').$outputlangs->transnoentitiesnoconv(
"SupplierRef").
' '.$ref_supplier.($prodser->ref ?
')' :
'');
1665 } elseif (
getDolGlobalInt(
'PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES') == 1) {
1666 $ref_prodserv = $ref_supplier;
1667 } elseif (
getDolGlobalInt(
'PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES') == 2) {
1668 $ref_prodserv = $ref_supplier.
' ('.$outputlangs->transnoentitiesnoconv(
"InternalRef").
' '.$prodser->ref.
')';
1671 $ref_prodserv = $prodser->ref;
1675 $filter = array(
'fk_product' => $idprod,
'fk_soc' => $object->socid);
1677 $nbCustomerPrices = $productCustomerPriceStatic->fetchAll(
'',
'', 1, 0, $filter);
1679 if ($nbCustomerPrices > 0) {
1680 $productCustomerPrice = $productCustomerPriceStatic->lines[0];
1682 if (!empty($productCustomerPrice->ref_customer)) {
1683 switch ($conf->global->PRODUIT_CUSTOMER_PRICES_PDF_REF_MODE) {
1685 $ref_prodserv = $productCustomerPrice->ref_customer;
1689 $ref_prodserv = $productCustomerPrice->ref_customer .
' (' . $outputlangs->transnoentitiesnoconv(
'InternalRef') .
' ' . $ref_prodserv .
')';
1693 $ref_prodserv = $ref_prodserv .
' (' . $outputlangs->transnoentitiesnoconv(
'RefCustomer') .
' ' . $productCustomerPrice->ref_customer .
')';
1700 if (!empty($libelleproduitservice) && !empty($ref_prodserv)) {
1701 $ref_prodserv .=
" - ";
1705 if (!empty($ref_prodserv) &&
getDolGlobalString(
'PDF_BOLD_PRODUCT_REF_AND_PERIOD')) {
1707 $libelleproduitservice = str_replace(
"\n",
'<br>', $libelleproduitservice);
1709 $ref_prodserv =
'<b>'.$ref_prodserv.
'</b>';
1712 $libelleproduitservice = $prefix_prodserv.$ref_prodserv.$libelleproduitservice;
1715 if (
getDolGlobalString(
'CATEGORY_ADD_DESC_INTO_DOC') && $idprod && isModEnabled(
'categorie')) {
1716 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1719 $tblcateg = $categstatic->containing($idprod, Categorie::TYPE_PRODUCT);
1720 foreach ($tblcateg as $cate) {
1722 $desccateg = $cate->description;
1724 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $desccateg);
1729 if (!empty($object->lines[$i]->date_start) || !empty($object->lines[$i]->date_end)) {
1733 if ($object->lines[$i]->date_start && $object->lines[$i]->date_end) {
1734 $period =
'('.$outputlangs->transnoentitiesnoconv(
'DateFromTo',
dol_print_date($object->lines[$i]->date_start, $format,
false, $outputlangs),
dol_print_date($object->lines[$i]->date_end, $format,
false, $outputlangs)).
')';
1736 if ($object->lines[$i]->date_start && !$object->lines[$i]->date_end) {
1737 $period =
'('.$outputlangs->transnoentitiesnoconv(
'DateFrom',
dol_print_date($object->lines[$i]->date_start, $format,
false, $outputlangs)).
')';
1739 if (!$object->lines[$i]->date_start && $object->lines[$i]->date_end) {
1740 $period =
'('.$outputlangs->transnoentitiesnoconv(
'DateUntil',
dol_print_date($object->lines[$i]->date_end, $format,
false, $outputlangs)).
')';
1745 $libelleproduitservice = str_replace(
"\n",
'<br>', $libelleproduitservice);
1747 $libelleproduitservice .=
'<br><b style="color:#333666;" ><em>'.$period.
'</em></b>';
1749 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $period);
1755 if (!empty($dbatch)) {
1760 include_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1761 include_once DOL_DOCUMENT_ROOT.
'/product/class/productbatch.class.php';
1766 foreach ($dbatch as $detail) {
1768 if ($detail->eatby) {
1769 $dte[] = $outputlangs->transnoentitiesnoconv(
'printEatby',
dol_print_date($detail->eatby, $format,
false, $outputlangs));
1771 if ($detail->sellby) {
1772 $dte[] = $outputlangs->transnoentitiesnoconv(
'printSellby',
dol_print_date($detail->sellby, $format,
false, $outputlangs));
1774 if ($detail->batch) {
1775 $dte[] = $outputlangs->transnoentitiesnoconv(
'printBatch', $detail->batch);
1777 $dte[] = $outputlangs->transnoentitiesnoconv(
'printQty', $detail->qty);
1780 if ($object->element ==
'shipping' && $detail->fk_origin_stock > 0 &&
getDolGlobalInt(
'PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT')) {
1781 $resproductbatch = $tmpproductbatch->fetch($detail->fk_origin_stock);
1782 if ($resproductbatch > 0) {
1783 $reswarehouse = $tmpwarehouse->fetch($tmpproductbatch->warehouseid);
1784 if ($reswarehouse > 0) {
1785 $dte[] = $tmpwarehouse->ref;
1790 $libelleproduitservice .=
"__N__ ".implode(
" - ", $dte);
1800 $libelleproduitservice = preg_replace(
'/__N__/',
'<br>', $libelleproduitservice);
1802 $libelleproduitservice = preg_replace(
'/__N__/',
"\n", $libelleproduitservice);
1806 return $libelleproduitservice;
1820 global $hookmanager;
1825 if (is_object($hookmanager)) {
1826 $special_code = empty($object->lines[$i]->special_code) ?
'' : $object->lines[$i]->special_code;
1827 if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
1828 $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
1830 $parameters = array(
'i'=>$i,
'outputlangs'=>$outputlangs,
'hidedetails'=>$hidedetails,
'special_code'=>$special_code);
1832 $reshook = $hookmanager->executeHooks(
'pdf_getlinenum', $parameters, $object, $action);
1833 $result .= $hookmanager->resPrint;
1835 if (empty($reshook)) {
1853 global $hookmanager;
1858 if (is_object($hookmanager)) {
1859 $special_code = empty($object->lines[$i]->special_code) ?
'' : $object->lines[$i]->special_code;
1860 if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
1861 $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
1863 $parameters = array(
'i'=>$i,
'outputlangs'=>$outputlangs,
'hidedetails'=>$hidedetails,
'special_code'=>$special_code);
1865 $reshook = $hookmanager->executeHooks(
'pdf_getlineref', $parameters, $object, $action);
1866 $result .= $hookmanager->resPrint;
1868 if (empty($reshook)) {
1885 global $hookmanager;
1890 if (is_object($hookmanager)) {
1891 $special_code = empty($object->lines[$i]->special_code) ?
'' : $object->lines[$i]->special_code;
1892 if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
1893 $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
1895 $parameters = array(
'i'=>$i,
'outputlangs'=>$outputlangs,
'hidedetails'=>$hidedetails,
'special_code'=>$special_code);
1897 $reshook = $hookmanager->executeHooks(
'pdf_getlineref_supplier', $parameters, $object, $action);
1898 $result .= $hookmanager->resPrint;
1900 if (empty($reshook)) {
1917 global $conf, $hookmanager, $mysoc;
1922 if (is_object($hookmanager)) {
1923 $special_code = empty($object->lines[$i]->special_code) ?
'' : $object->lines[$i]->special_code;
1924 if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
1925 $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
1927 $parameters = array(
'i'=>$i,
'outputlangs'=>$outputlangs,
'hidedetails'=>$hidedetails,
'special_code'=>$special_code);
1929 $reshook = $hookmanager->executeHooks(
'pdf_getlinevatrate', $parameters, $object, $action);
1931 if (!empty($hookmanager->resPrint)) {
1932 $result .= $hookmanager->resPrint;
1935 if (empty($reshook)) {
1936 if (empty($hidedetails) || $hidedetails > 1) {
1939 $tmpresult .=
vatrate($object->lines[$i]->tva_tx, 0, $object->lines[$i]->info_bits, -1);
1941 if ($object->lines[$i]->total_localtax1 != 0) {
1942 if (preg_replace(
'/[\s0%]/',
'', $tmpresult)) {
1947 $tmpresult .=
vatrate(abs($object->lines[$i]->localtax1_tx), 0);
1951 if ($object->lines[$i]->total_localtax2 != 0) {
1952 if (preg_replace(
'/[\s0%]/',
'', $tmpresult)) {
1957 $tmpresult .=
vatrate(abs($object->lines[$i]->localtax2_tx), 0);
1962 $result .= $tmpresult;
1979 global $conf, $hookmanager;
1982 if (isset($object->type) && $object->type == 2 &&
getDolGlobalString(
'INVOICE_POSITIVE_CREDIT_NOTE')) {
1989 if (is_object($hookmanager)) {
1990 $special_code = empty($object->lines[$i]->special_code) ?
'' : $object->lines[$i]->special_code;
1991 if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
1992 $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
1994 $parameters = array(
'i'=>$i,
'outputlangs'=>$outputlangs,
'hidedetails'=>$hidedetails,
'special_code'=>$special_code);
1996 $reshook = $hookmanager->executeHooks(
'pdf_getlineupexcltax', $parameters, $object, $action);
1998 if (!empty($hookmanager->resPrint)) {
1999 $result .= $hookmanager->resPrint;
2002 if (empty($reshook)) {
2003 if (empty($hidedetails) || $hidedetails > 1) {
2004 $subprice = (isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_subprice : $object->lines[$i]->subprice);
2005 $result .=
price($sign * $subprice, 0, $outputlangs);
2022 global $hookmanager, $conf;
2025 if (isset($object->type) && $object->type == 2 &&
getDolGlobalString(
'INVOICE_POSITIVE_CREDIT_NOTE')) {
2032 if (is_object($hookmanager)) {
2033 $special_code = empty($object->lines[$i]->special_code) ?
'' : $object->lines[$i]->special_code;
2034 if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
2035 $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
2037 $parameters = array(
'i'=>$i,
'outputlangs'=>$outputlangs,
'hidedetails'=>$hidedetails,
'special_code'=>$special_code);
2039 $reshook = $hookmanager->executeHooks(
'pdf_getlineupwithtax', $parameters, $object, $action);
2041 if (!empty($hookmanager->resPrint)) {
2042 $result .= $hookmanager->resPrint;
2045 if (empty($reshook)) {
2046 if (empty($hidedetails) || $hidedetails > 1) {
2047 $result .=
price($sign * (($object->lines[$i]->subprice) + ($object->lines[$i]->subprice) * ($object->lines[$i]->tva_tx) / 100), 0, $outputlangs);
2064 global $hookmanager;
2069 if (is_object($hookmanager)) {
2070 $special_code = empty($object->lines[$i]->special_code) ?
'' : $object->lines[$i]->special_code;
2071 if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
2072 $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
2074 $parameters = array(
'i'=>$i,
'outputlangs'=>$outputlangs,
'hidedetails'=>$hidedetails,
'special_code'=>$special_code);
2076 $reshook = $hookmanager->executeHooks(
'pdf_getlineqty', $parameters, $object, $action);
2078 if (!empty($hookmanager->resPrint)) {
2079 $result = $hookmanager->resPrint;
2082 if (empty($reshook)) {
2083 if ($object->lines[$i]->special_code == 3) {
2086 if (empty($hidedetails) || $hidedetails > 1) {
2087 $result .= $object->lines[$i]->qty;
2104 global $hookmanager;
2109 if (is_object($hookmanager)) {
2110 $special_code = empty($object->lines[$i]->special_code) ?
'' : $object->lines[$i]->special_code;
2111 if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
2112 $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
2114 $parameters = array(
'i'=>$i,
'outputlangs'=>$outputlangs,
'hidedetails'=>$hidedetails,
'special_code'=>$special_code);
2116 $reshook = $hookmanager->executeHooks(
'pdf_getlineqty_asked', $parameters, $object, $action);
2118 if (!empty($hookmanager->resPrint)) {
2119 $result .= $hookmanager->resPrint;
2122 if (empty($reshook)) {
2123 if ($object->lines[$i]->special_code == 3) {
2126 if (empty($hidedetails) || $hidedetails > 1) {
2127 $result .= $object->lines[$i]->qty_asked;
2144 global $hookmanager;
2149 if (is_object($hookmanager)) {
2150 $special_code = empty($object->lines[$i]->special_code) ?
'' : $object->lines[$i]->special_code;
2151 if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
2152 $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
2154 $parameters = array(
'i'=>$i,
'outputlangs'=>$outputlangs,
'hidedetails'=>$hidedetails,
'special_code'=>$special_code);
2156 $reshook = $hookmanager->executeHooks(
'pdf_getlineqty_shipped', $parameters, $object, $action);
2158 if (!empty($hookmanager->resPrint)) {
2159 $result .= $hookmanager->resPrint;
2162 if (empty($reshook)) {
2163 if ($object->lines[$i]->special_code == 3) {
2166 if (empty($hidedetails) || $hidedetails > 1) {
2167 $result .= $object->lines[$i]->qty_shipped;
2184 global $hookmanager;
2189 if (is_object($hookmanager)) {
2190 $special_code = empty($object->lines[$i]->special_code) ?
'' : $object->lines[$i]->special_code;
2191 if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
2192 $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
2194 $parameters = array(
'i'=>$i,
'outputlangs'=>$outputlangs,
'hidedetails'=>$hidedetails,
'special_code'=>$special_code);
2196 $reshook = $hookmanager->executeHooks(
'pdf_getlineqty_keeptoship', $parameters, $object, $action);
2198 if (!empty($hookmanager->resPrint)) {
2199 $result .= $hookmanager->resPrint;
2202 if (empty($reshook)) {
2203 if ($object->lines[$i]->special_code == 3) {
2206 if (empty($hidedetails) || $hidedetails > 1) {
2207 $result .= ($object->lines[$i]->qty_asked - $object->lines[$i]->qty_shipped);
2223function pdf_getlineunit($object, $i, $outputlangs, $hidedetails = 0, $hookmanager =
false)
2230 if (is_object($hookmanager)) {
2231 $special_code = empty($object->lines[$i]->special_code) ?
'' : $object->lines[$i]->special_code;
2232 if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
2233 $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
2235 $parameters = array(
2237 'outputlangs' => $outputlangs,
2238 'hidedetails' => $hidedetails,
2239 'special_code' => $special_code
2242 $reshook = $hookmanager->executeHooks(
'pdf_getlineunit', $parameters, $object, $action);
2244 if (!empty($hookmanager->resPrint)) {
2245 $result .= $hookmanager->resPrint;
2248 if (empty($reshook)) {
2249 if (empty($hidedetails) || $hidedetails > 1) {
2250 $result .= $langs->transnoentitiesnoconv($object->lines[$i]->getLabelOfUnit(
'short'));
2268 global $hookmanager;
2270 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
2275 if (is_object($hookmanager)) {
2276 $special_code = empty($object->lines[$i]->special_code) ?
'' : $object->lines[$i]->special_code;
2277 if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
2278 $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
2280 $parameters = array(
'i'=>$i,
'outputlangs'=>$outputlangs,
'hidedetails'=>$hidedetails,
'special_code'=>$special_code);
2282 $reshook = $hookmanager->executeHooks(
'pdf_getlineremisepercent', $parameters, $object, $action);
2284 if (!empty($hookmanager->resPrint)) {
2285 $result .= $hookmanager->resPrint;
2288 if (empty($reshook)) {
2289 if ($object->lines[$i]->special_code == 3) {
2292 if (empty($hidedetails) || $hidedetails > 1) {
2311 if (empty($hookmanager)) {
2312 global $hookmanager;
2319 if (is_object($hookmanager)) {
2320 $special_code = empty($object->lines[$i]->special_code) ?
'' : $object->lines[$i]->special_code;
2321 if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
2322 $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
2324 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2326 $reshook = $hookmanager->executeHooks(
'pdf_getlineprogress', $parameters, $object, $action);
2328 if (!empty($hookmanager->resPrint)) {
2329 return $hookmanager->resPrint;
2332 if (empty($reshook)) {
2333 if ($object->lines[$i]->special_code == 3) {
2336 if (empty($hidedetails) || $hidedetails > 1) {
2339 if (method_exists($object->lines[$i],
'get_prev_progress')) {
2340 $prev_progress = $object->lines[$i]->get_prev_progress($object->id);
2342 $result = round($object->lines[$i]->situation_percent - $prev_progress, 1).
'%';
2344 $result = round($object->lines[$i]->situation_percent, 1).
'%';
2362 global $conf, $hookmanager;
2365 if (isset($object->type) && $object->type == 2 &&
getDolGlobalString(
'INVOICE_POSITIVE_CREDIT_NOTE')) {
2372 if (is_object($hookmanager)) {
2373 $special_code = empty($object->lines[$i]->special_code) ?
'' : $object->lines[$i]->special_code;
2374 if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
2375 $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
2377 $parameters = array(
'i'=>$i,
'outputlangs'=>$outputlangs,
'hidedetails'=>$hidedetails,
'special_code'=>$special_code,
'sign'=>$sign);
2379 $reshook = $hookmanager->executeHooks(
'pdf_getlinetotalexcltax', $parameters, $object, $action);
2381 if (!empty($hookmanager->resPrint)) {
2382 $result .= $hookmanager->resPrint;
2385 if (empty($reshook)) {
2386 if (!empty($object->lines[$i]) && $object->lines[$i]->special_code == 3) {
2387 $result .= $outputlangs->transnoentities(
"Option");
2388 } elseif (empty($hidedetails) || $hidedetails > 1) {
2389 $total_ht = (isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ht : $object->lines[$i]->total_ht);
2390 if (!empty($object->lines[$i]->situation_percent) && $object->lines[$i]->situation_percent > 0) {
2394 if (method_exists($object->lines[$i],
'get_prev_progress')) {
2395 $prev_progress = $object->lines[$i]->get_prev_progress($object->id);
2396 $progress = ($object->lines[$i]->situation_percent - $prev_progress) / 100;
2398 $result .=
price($sign * ($total_ht / ($object->lines[$i]->situation_percent / 100)) * $progress, 0, $outputlangs);
2400 $result .=
price($sign * $total_ht, 0, $outputlangs);
2418 global $hookmanager, $conf;
2421 if (isset($object->type) && $object->type == 2 &&
getDolGlobalString(
'INVOICE_POSITIVE_CREDIT_NOTE')) {
2428 if (is_object($hookmanager)) {
2429 $special_code = empty($object->lines[$i]->special_code) ?
'' : $object->lines[$i]->special_code;
2430 if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) {
2431 $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
2433 $parameters = array(
'i'=>$i,
'outputlangs'=>$outputlangs,
'hidedetails'=>$hidedetails,
'special_code'=>$special_code);
2435 $reshook = $hookmanager->executeHooks(
'pdf_getlinetotalwithtax', $parameters, $object, $action);
2437 if (!empty($hookmanager->resPrint)) {
2438 $result .= $hookmanager->resPrint;
2441 if (empty($reshook)) {
2442 if ($object->lines[$i]->special_code == 3) {
2443 $result .= $outputlangs->transnoentities(
"Option");
2444 } elseif (empty($hidedetails) || $hidedetails > 1) {
2445 $total_ttc = (isModEnabled(
"multicurrency") && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ttc : $object->lines[$i]->total_ttc);
2446 if (isset($object->lines[$i]->situation_percent) && $object->lines[$i]->situation_percent > 0) {
2450 if (method_exists($object->lines[$i],
'get_prev_progress')) {
2451 $prev_progress = $object->lines[$i]->get_prev_progress($object->id);
2452 $progress = ($object->lines[$i]->situation_percent - $prev_progress) / 100;
2454 $result .=
price($sign * ($total_ttc / ($object->lines[$i]->situation_percent / 100)) * $progress, 0, $outputlangs);
2456 $result .=
price($sign * $total_ttc, 0, $outputlangs);
2473 global $db, $hookmanager;
2475 $linkedobjects = array();
2477 $object->fetchObjectLinked();
2479 foreach ($object->linkedObjects as $objecttype => $objects) {
2480 if ($objecttype ==
'facture') {
2482 } elseif ($objecttype ==
'propal' || $objecttype ==
'supplier_proposal') {
2483 $outputlangs->load(
'propal');
2485 foreach ($objects as $elementobject) {
2486 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"RefProposal");
2487 $linkedobjects[$objecttype][
'ref_value'] = $outputlangs->transnoentities($elementobject->ref);
2488 $linkedobjects[$objecttype][
'date_title'] = $outputlangs->transnoentities(
"DatePropal");
2489 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date($elementobject->date,
'day',
'', $outputlangs);
2491 } elseif ($objecttype ==
'commande' || $objecttype ==
'supplier_order') {
2492 $outputlangs->load(
'orders');
2495 $object->note_public =
dol_concatdesc($object->note_public, $outputlangs->transnoentities(
"RefOrder").
' :');
2496 foreach ($objects as $elementobject) {
2497 $object->note_public =
dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).(empty($elementobject->ref_client) ?
'' :
' ('.$elementobject->ref_client.
')').(empty($elementobject->ref_supplier) ?
'' :
' ('.$elementobject->ref_supplier.
')').
' ');
2498 $object->note_public =
dol_concatdesc($object->note_public, $outputlangs->transnoentities(
"OrderDate").
' : '.
dol_print_date($elementobject->date,
'day',
'', $outputlangs));
2500 } elseif (count($objects) == 1) {
2501 $elementobject = array_shift($objects);
2502 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"RefOrder");
2503 $linkedobjects[$objecttype][
'ref_value'] = $outputlangs->transnoentities($elementobject->ref).(!empty($elementobject->ref_client) ?
' ('.$elementobject->ref_client.
')' :
'').(!empty($elementobject->ref_supplier) ?
' ('.$elementobject->ref_supplier.
')' :
'');
2504 $linkedobjects[$objecttype][
'date_title'] = $outputlangs->transnoentities(
"OrderDate");
2505 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date($elementobject->date,
'day',
'', $outputlangs);
2507 } elseif ($objecttype ==
'contrat') {
2508 $outputlangs->load(
'contracts');
2509 foreach ($objects as $elementobject) {
2510 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"RefContract");
2511 $linkedobjects[$objecttype][
'ref_value'] = $outputlangs->transnoentities($elementobject->ref);
2512 $linkedobjects[$objecttype][
'date_title'] = $outputlangs->transnoentities(
"DateContract");
2513 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date($elementobject->date_contrat,
'day',
'', $outputlangs);
2515 } elseif ($objecttype ==
'fichinter') {
2516 $outputlangs->load(
'interventions');
2517 foreach ($objects as $elementobject) {
2518 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"InterRef");
2519 $linkedobjects[$objecttype][
'ref_value'] = $outputlangs->transnoentities($elementobject->ref);
2520 $linkedobjects[$objecttype][
'date_title'] = $outputlangs->transnoentities(
"InterDate");
2521 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date($elementobject->datec,
'day',
'', $outputlangs);
2523 } elseif ($objecttype ==
'shipping') {
2524 $outputlangs->loadLangs(array(
"orders",
"sendings"));
2526 if (count($objects) > 1) {
2528 if (empty($object->linkedObjects[
'commande']) && $object->element !=
'commande') {
2529 $object->note_public =
dol_concatdesc($object->note_public, $outputlangs->transnoentities(
"RefOrder").
' / '.$outputlangs->transnoentities(
"RefSending").
' :');
2531 $object->note_public =
dol_concatdesc($object->note_public, $outputlangs->transnoentities(
"RefSending").
' :');
2534 foreach ($objects as $elementobject) {
2535 if (empty($object->linkedObjects[
'commande']) && $object->element !=
'commande') {
2536 $elementobject->fetchObjectLinked(
null,
'',
null,
'',
'OR', 1,
'sourcetype', 0);
2537 if (!empty($elementobject->linkedObjectsIds[
'commande'])) {
2538 include_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
2540 $ret = $order->fetch(reset($elementobject->linkedObjectsIds[
'commande']));
2547 if (! is_object($order)) {
2548 $object->note_public =
dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref));
2550 $object->note_public =
dol_concatdesc($object->note_public, $outputlangs->convToOutputCharset($order->ref).($order->ref_client ?
' ('.$order->ref_client.
')' :
''));
2551 $object->note_public =
dol_concatdesc($object->note_public,
' / '.$outputlangs->transnoentities($elementobject->ref));
2554 } elseif (count($objects) == 1) {
2555 $elementobject = array_shift($objects);
2558 if (empty($object->linkedObjects[
'commande']) && $object->element !=
'commande') {
2559 $elementobject->fetchObjectLinked(
null,
'',
null,
'',
'OR', 1,
'sourcetype', 0);
2560 if (!empty($elementobject->linkedObjectsIds[
'commande'])) {
2561 include_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
2563 $ret = $order->fetch(reset($elementobject->linkedObjectsIds[
'commande']));
2570 if (! is_object($order)) {
2571 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"RefSending");
2572 if (empty($linkedobjects[$objecttype][
'ref_value'])) {
2573 $linkedobjects[$objecttype][
'ref_value'] =
'';
2575 $linkedobjects[$objecttype][
'ref_value'] .=
' / ';
2577 $linkedobjects[$objecttype][
'ref_value'] .= $outputlangs->transnoentities($elementobject->ref);
2578 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date(empty($elementobject->date_shipping) ? $elementobject->date_delivery : $elementobject->date_shipping,
'day',
'', $outputlangs);
2580 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"RefOrder").
' / '.$outputlangs->transnoentities(
"RefSending");
2581 if (empty($linkedobjects[$objecttype][
'ref_value'])) {
2582 $linkedobjects[$objecttype][
'ref_value'] = $outputlangs->convToOutputCharset($order->ref).($order->ref_client ?
' ('.$order->ref_client.
')' :
'');
2584 $linkedobjects[$objecttype][
'ref_value'] .=
' / '.$outputlangs->transnoentities($elementobject->ref);
2585 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date(empty($elementobject->date_shipping) ? $elementobject->date_delivery : $elementobject->date_shipping,
'day',
'', $outputlangs);
2592 if (is_object($hookmanager)) {
2593 $parameters = array(
'linkedobjects' => $linkedobjects,
'outputlangs'=>$outputlangs);
2595 $hookmanager->executeHooks(
'pdf_getLinkedObjects', $parameters, $object, $action);
2596 if (!empty($hookmanager->resArray)) {
2597 $linkedobjects = $hookmanager->resArray;
2601 return $linkedobjects;
2615 $maxwidth = (!
getDolGlobalString(
'MAIN_DOCUMENTS_WITH_PICTURE_WIDTH') ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH);
2616 $maxheight = (!
getDolGlobalString(
'MAIN_DOCUMENTS_WITH_PICTURE_HEIGHT') ? 32 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_HEIGHT);
2617 include_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
2621 if ($tmp[
'height']) {
2622 $width = (int) round($maxheight * $tmp[
'width'] / $tmp[
'height']);
2623 if ($width > $maxwidth) {
2625 $height = (int) round($maxwidth * $tmp[
'height'] / $tmp[
'width']);
2627 $height = $maxheight;
2630 return array(
'width'=>$width,
'height'=>$height);
2644 global $conf, $hookmanager;
2647 if (isset($object->type) && $object->type == 2 &&
getDolGlobalString(
'INVOICE_POSITIVE_CREDIT_NOTE')) {
2650 if ($object->lines[$i]->special_code == 3) {
2651 return $outputlangs->transnoentities(
"Option");
2653 if (is_object($hookmanager)) {
2654 $special_code = $object->lines[$i]->special_code;
2655 if (!empty($object->lines[$i]->fk_parent_line)) {
2656 $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
2659 $parameters = array(
2661 'outputlangs'=>$outputlangs,
2662 'hidedetails'=>$hidedetails,
2663 'special_code'=>$special_code
2668 if ($hookmanager->executeHooks(
'getlinetotalremise', $parameters, $object, $action) > 0) {
2669 if (isset($hookmanager->resArray[
'linetotalremise'])) {
2670 return $hookmanager->resArray[
'linetotalremise'];
2672 return (
float) $hookmanager->resPrint;
2677 if (empty($hidedetails) || $hidedetails > 1) {
2678 return $sign * (($object->lines[$i]->subprice * $object->lines[$i]->qty) - $object->lines[$i]->total_ht);
Class to manage categories.
Class to manage customers orders.
Class to manage absolute discounts.
Class to manage warehouses.
File of class to manage predefined price products or services by customer.
Class to manage predefined suppliers products.
Class to manage products or services.
Manage record for batch number management.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
getState($id, $withcode='', $dbtouse=0, $withregion=0, $outputlangs='', $entconv=1)
Return state translated from an id.
getFormeJuridiqueLabel($code)
Return the name translated of juridical status.
dol_print_reduction($reduction, $langs)
Returns formated reduction.
dol_getDefaultFormat(Translate $outputlangs=null)
Try to guess default paper format according to language into $langs.
dol_html_entity_decode($a, $b, $c='UTF-8', $keepsomeentities=0)
Replace html_entity_decode functions to manage errors.
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_format_address($object, $withcountry=0, $sep="\n", $outputlangs='', $mode=0, $extralangcode='')
Return a formated address (part address/zip/town/state) according to country rules.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
dol_textishtml($msg, $option=0)
Return if a text is a html content.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_getImageSize($file, $url=false)
Return size of image file on disk (Supported extensions are gif, jpg, png, bmp and webp)
pdf_getSizeForImage($realpath)
Return dimensions to use for images onto PDF checking that width and height are not higher than maxim...
pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails=0)
Return line total excluding tax.
pdf_getlinedesc($object, $i, $outputlangs, $hideref=0, $hidedesc=0, $issupplierline=0)
Return line description translated in outputlangs and encoded into htmlentities and with
pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails=0)
Return line total amount discount.
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
pdf_getFormat(Translate $outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
pdf_getlineqty_shipped($object, $i, $outputlangs, $hidedetails=0)
Return line quantity shipped.
pdf_getlinenum($object, $i, $outputlangs, $hidedetails=0)
Return line num.
pdf_getEncryption($pathoffile)
Return if pdf file is protected/encrypted.
pdf_getlineupwithtax($object, $i, $outputlangs, $hidedetails=0)
Return line unit price including tax.
pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0)
Output line description into PDF.
pdf_getLinkedObjects(&$object, $outputlangs)
Return linked objects to use for document generation.
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
pdf_getlineref_supplier($object, $i, $outputlangs, $hidedetails=0)
Return line ref_supplier.
pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails=0)
Return line total including tax.
pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails=0, $hidefreetext=0, $page_largeur=0, $watermark='')
Show footer of page for PDF generation.
pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails=0)
Return line unit price excluding tax.
pdf_getlineprogress($object, $i, $outputlangs, $hidedetails=0, $hookmanager=null)
Return line percent.
pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails=0)
Return line vat rate.
pdf_getlineunit($object, $i, $outputlangs, $hidedetails=0, $hookmanager=false)
Return line unit.
pdfGetHeightForHtmlContent(&$pdf, $htmlcontent)
Function to try to calculate height of a HTML Content.
pdf_admin_prepare_head()
Return array head with list of tabs to view object informations.
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber=0, $default_font_size=10)
Show bank informations for PDF generation.
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
pdf_getlineqty_keeptoship($object, $i, $outputlangs, $hidedetails=0)
Return line keep to ship quantity.
pdf_getlineref($object, $i, $outputlangs, $hidedetails=0)
Return line product ref.
pdf_build_address($outputlangs, $sourcecompany, $targetcompany='', $targetcontact='', $usecontact=0, $mode='source', $object=null)
Return a string with full address formated for output on documents.
pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails=0)
Return line remise percent.
pdf_getlineqty_asked($object, $i, $outputlangs, $hidedetails=0)
Return line quantity asked.
pdf_getlineqty($object, $i, $outputlangs, $hidedetails=0)
Return line quantity.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0, $include=null)
Return array of possible substitutions for PDF content (without external module substitutions).
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includealias=0)
Returns the name of the thirdparty.
pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
Add a draft watermark on PDF files.