40include_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
55 $head[$h][0] = DOL_URL_ROOT.
'/admin/pdf.php';
56 $head[$h][1] = $langs->trans(
"Parameters");
57 $head[$h][2] =
'general';
66 if (isModEnabled(
"propal") || isModEnabled(
'invoice') || isModEnabled(
'reception')) {
67 $head[$h][0] = DOL_URL_ROOT.
'/admin/pdf_other.php';
68 $head[$h][1] = $langs->trans(
"Others");
69 $head[$h][2] =
'other';
88 global $conf, $db, $langs;
90 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'));
98 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
104 $sql =
"SELECT code, label, width, height, unit FROM ".MAIN_DB_PREFIX.
"c_paper_format";
105 $sql .=
" WHERE code = '".$db->escape($pdfformat).
"'";
106 $resql = $db->query($sql);
108 $obj = $db->fetch_object($resql);
110 $width = (int) $obj->width;
111 $height = (int) $obj->height;
117 return array(
'width' => $width,
'height' => $height,
'unit' => $unit);
133 if (!defined(
'K_TCPDF_EXTERNAL_CONFIG')) {
134 define(
'K_TCPDF_EXTERNAL_CONFIG', 1);
135 define(
'K_PATH_CACHE', DOL_DATA_ROOT.
'/admin/temp/');
136 define(
'K_PATH_URL_CACHE', DOL_DATA_ROOT.
'/admin/temp/');
138 define(
'K_BLANK_IMAGE',
'_blank.png');
139 define(
'PDF_PAGE_FORMAT',
'A4');
140 define(
'PDF_PAGE_ORIENTATION',
'P');
141 define(
'PDF_CREATOR',
'TCPDF');
142 define(
'PDF_AUTHOR',
'TCPDF');
143 define(
'PDF_HEADER_TITLE',
'TCPDF Example');
144 define(
'PDF_HEADER_STRING',
"by Dolibarr ERP CRM");
145 define(
'PDF_UNIT',
'mm');
146 define(
'PDF_MARGIN_HEADER', 5);
147 define(
'PDF_MARGIN_FOOTER', 10);
148 define(
'PDF_MARGIN_TOP', 27);
149 define(
'PDF_MARGIN_BOTTOM', 25);
150 define(
'PDF_MARGIN_LEFT', 15);
151 define(
'PDF_MARGIN_RIGHT', 15);
152 define(
'PDF_FONT_NAME_MAIN',
'helvetica');
153 define(
'PDF_FONT_SIZE_MAIN', 10);
154 define(
'PDF_FONT_NAME_DATA',
'helvetica');
155 define(
'PDF_FONT_SIZE_DATA', 8);
156 define(
'PDF_FONT_MONOSPACED',
'courier');
157 define(
'PDF_IMAGE_SCALE_RATIO', 1.25);
158 define(
'HEAD_MAGNIFICATION', 1.1);
159 define(
'K_CELL_HEIGHT_RATIO', 1.25);
160 define(
'K_TITLE_MAGNIFICATION', 1.3);
161 define(
'K_SMALL_RATIO', 2 / 3);
162 define(
'K_THAI_TOPCHARS',
true);
163 define(
'K_TCPDF_CALLS_IN_HTML',
true);
165 define(
'K_TCPDF_THROW_EXCEPTION_ERROR',
true);
167 define(
'K_TCPDF_THROW_EXCEPTION_ERROR',
false);
172 require_once TCPDF_PATH.
'tcpdf.php';
176 require_once TCPDI_PATH.
'tcpdi.php';
189 $pdf =
new TCPDI($pagetype, $metric, $format,
true,
'UTF-8',
false, $pdfa);
191 $pdf =
new TCPDF($pagetype, $metric, $format,
true,
'UTF-8',
false, $pdfa);
209 $pdfrights = (
getDolGlobalString(
'PDF_SECURITY_ENCRYPTION_RIGHTS') ? json_decode($conf->global->PDF_SECURITY_ENCRYPTION_RIGHTS,
true) : array(
'modify',
'copy'));
212 $pdfuserpass = (
getDolGlobalString(
'PDF_SECURITY_ENCRYPTION_USERPASS') ? $conf->global->PDF_SECURITY_ENCRYPTION_USERPASS :
'');
215 $pdfownerpass = (
getDolGlobalString(
'PDF_SECURITY_ENCRYPTION_OWNERPASS') ? $conf->global->PDF_SECURITY_ENCRYPTION_OWNERPASS :
null);
218 $encstrength = (
getDolGlobalString(
'PDF_SECURITY_ENCRYPTION_STRENGTH') ? $conf->global->PDF_SECURITY_ENCRYPTION_STRENGTH : 0);
222 $pubkeys = (
getDolGlobalString(
'PDF_SECURITY_ENCRYPTION_PUBKEYS') ? json_decode($conf->global->PDF_SECURITY_ENCRYPTION_PUBKEYS,
true) :
null);
224 $pdf->SetProtection($pdfrights, $pdfuserpass, $pdfownerpass, $encstrength, $pubkeys);
238 require_once TCPDF_PATH.
'tcpdf_parser.php';
240 $isencrypted =
false;
242 $content = file_get_contents($pathoffile);
245 @($parser =
new TCPDF_PARSER(ltrim($content)));
246 list($xref, $data) = $parser->getParsedData();
250 if (isset($xref[
'trailer'][
'encrypt'])) {
272 return $conf->global->MAIN_PDF_FORCE_FONT;
276 if (class_exists(
'TCPDF')) {
277 if ($outputlangs->trans(
'FONTFORPDF') !=
'FONTFORPDF') {
278 $font = $outputlangs->trans(
'FONTFORPDF');
295 if (class_exists(
'TCPDF')) {
296 if ($outputlangs->trans(
'FONTSIZEFORPDF') !=
'FONTSIZEFORPDF') {
297 $size = (int) $outputlangs->trans(
'FONTSIZEFORPDF');
318 $height = (!
getDolGlobalString(
'MAIN_DOCUMENTS_LOGO_HEIGHT') ? 20 : $conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT);
320 include_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
322 if ($tmp[
'height']) {
323 $width = round($height * $tmp[
'width'] / $tmp[
'height']);
324 if ($width > $maxwidth) {
325 $height = $height * $maxwidth / $width;
343 $pdf->startTransaction();
345 $start_y = $pdf->GetY();
347 $start_page = $pdf->getPage();
349 $pdf->writeHTMLCell(0, 0, 0, $start_y, $htmlcontent, 0, 1,
false,
true,
'J',
true);
351 $end_y = $pdf->GetY();
352 $end_page = $pdf->getPage();
355 if ($end_page == $start_page) {
356 $height = $end_y - $start_y;
358 for ($page = $start_page; $page <= $end_page; ++$page) {
359 $pdf->setPage($page);
360 $tmpm = $pdf->getMargins();
361 $tMargin = $tmpm[
'top'];
362 if ($page == $start_page) {
364 $height = $pdf->getPageHeight() - $start_y - $pdf->getBreakMargin();
365 } elseif ($page == $end_page) {
367 $height = $end_y - $tMargin;
369 $height = $pdf->getPageHeight() - $tMargin - $pdf->getBreakMargin();
374 $pdf = $pdf->rollbackTransaction();
395 if ($thirdparty instanceof
Societe) {
396 $socname = $thirdparty->name;
397 if (($includealias ||
getDolGlobalInt(
'PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) && !empty($thirdparty->name_alias)) {
399 $socname = $thirdparty->name_alias.
" - ".$thirdparty->name;
401 $socname = $thirdparty->name.
" - ".$thirdparty->name_alias;
404 } elseif ($thirdparty instanceof
Contact) {
405 if ($thirdparty->socid > 0) {
406 $thirdparty->fetch_thirdparty();
407 $socname = $thirdparty->thirdparty->name;
408 if (($includealias ||
getDolGlobalInt(
'PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) && !empty($thirdparty->thirdparty->name_alias)) {
410 $socname = $thirdparty->thirdparty->name_alias.
" - ".$thirdparty->thirdparty->name;
412 $socname = $thirdparty->thirdparty->name.
" - ".$thirdparty->thirdparty->name_alias;
417 throw new InvalidArgumentException(
'Parameter 1 $thirdparty is not a Societe nor Contact');
420 return $outputlangs->convToOutputCharset($socname);
436function pdf_build_address($outputlangs, $sourcecompany, $targetcompany =
'', $targetcontact =
'', $usecontact = 0, $mode =
'source',
$object =
null)
440 if ($mode ==
'source' && !is_object($sourcecompany)) {
443 if ($mode ==
'target' && !is_object($targetcompany)) {
447 if (!empty($sourcecompany->state_id) && empty($sourcecompany->state)) {
448 $sourcecompany->state =
getState($sourcecompany->state_id);
450 if (!empty($targetcompany->state_id) && empty($targetcompany->state)) {
451 $targetcompany->state =
getState($targetcompany->state_id);
456 if (is_object($hookmanager)) {
457 $parameters = array(
'sourcecompany' => &$sourcecompany,
'targetcompany' => &$targetcompany,
'targetcontact' => &$targetcontact,
'outputlangs' => $outputlangs,
'mode' => $mode,
'usecontact' => $usecontact);
459 $reshook = $hookmanager->executeHooks(
'pdf_build_address', $parameters,
$object, $action);
460 $stringaddress .= $hookmanager->resPrint;
462 if (empty($reshook)) {
463 if ($mode ==
'source') {
465 if (isset($targetcompany->country_code) && !empty($sourcecompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) {
469 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset(
dol_format_address($sourcecompany, $withCountry,
"\n", $outputlangs)).
"\n";
473 if ($sourcecompany->phone) {
474 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"PhoneShort").
": ".$outputlangs->convToOutputCharset($sourcecompany->phone);
477 if ($sourcecompany->fax) {
478 $stringaddress .= ($stringaddress ? ($sourcecompany->phone ?
" - " :
"\n") :
'').$outputlangs->transnoentities(
"Fax").
": ".$outputlangs->convToOutputCharset($sourcecompany->fax);
481 if ($sourcecompany->email) {
482 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Email").
": ".$outputlangs->convToOutputCharset($sourcecompany->email);
485 if ($sourcecompany->url) {
486 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Web").
": ".$outputlangs->convToOutputCharset($sourcecompany->url);
491 if ($sourcecompany->tva_intra) {
492 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"VATIntraShort").
': '.$outputlangs->convToOutputCharset($sourcecompany->tva_intra);
497 if (
getDolGlobalString(
'MAIN_PROFID1_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof1)) {
498 $tmp = $outputlangs->transcountrynoentities(
"ProfId1", $sourcecompany->country_code);
499 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
502 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof1);
504 if (
getDolGlobalString(
'MAIN_PROFID2_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof2)) {
505 $tmp = $outputlangs->transcountrynoentities(
"ProfId2", $sourcecompany->country_code);
506 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
509 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof2);
511 if (
getDolGlobalString(
'MAIN_PROFID3_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof3)) {
512 $tmp = $outputlangs->transcountrynoentities(
"ProfId3", $sourcecompany->country_code);
513 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
516 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof3);
518 if (
getDolGlobalString(
'MAIN_PROFID4_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof4)) {
519 $tmp = $outputlangs->transcountrynoentities(
"ProfId4", $sourcecompany->country_code);
520 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
523 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof4);
525 if (
getDolGlobalString(
'MAIN_PROFID5_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof5)) {
526 $tmp = $outputlangs->transcountrynoentities(
"ProfId5", $sourcecompany->country_code);
527 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
530 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof5);
532 if (
getDolGlobalString(
'MAIN_PROFID6_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof6)) {
533 $tmp = $outputlangs->transcountrynoentities(
"ProfId6", $sourcecompany->country_code);
534 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
537 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof6);
540 $stringaddress .= ($stringaddress ?
"\n" :
'') .
getDolGlobalString(
'PDF_ADD_MORE_AFTER_SOURCE_ADDRESS');
544 if ($mode ==
'target' || preg_match(
'/targetwithdetails/', $mode)) {
546 if (is_object($targetcontact)) {
547 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs, 1));
549 if (!empty($targetcontact->address)) {
550 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset(
dol_format_address($targetcontact)).
"\n";
552 $companytouseforaddress = $targetcompany;
555 if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id) {
556 $targetcontact->fetch_thirdparty();
557 $companytouseforaddress = $targetcontact->thirdparty;
560 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset(
dol_format_address($companytouseforaddress)).
"\n";
563 if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) {
564 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv(
"Country".$targetcontact->country_code));
565 } elseif (empty($targetcontact->country_code) && !empty($targetcompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) {
566 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv(
"Country".$targetcompany->country_code));
569 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || preg_match(
'/targetwithdetails/', $mode)) {
571 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_phone/', $mode)) {
572 if (!empty($targetcontact->phone_pro) || !empty($targetcontact->phone_mobile)) {
573 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Phone").
": ";
575 if (!empty($targetcontact->phone_pro)) {
576 $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro);
578 if (!empty($targetcontact->phone_pro) && !empty($targetcontact->phone_mobile)) {
579 $stringaddress .=
" / ";
581 if (!empty($targetcontact->phone_mobile)) {
582 $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile);
586 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_fax/', $mode)) {
587 if ($targetcontact->fax) {
588 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Fax").
": ".$outputlangs->convToOutputCharset($targetcontact->fax);
592 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_email/', $mode)) {
593 if ($targetcontact->email) {
594 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Email").
": ".$outputlangs->convToOutputCharset($targetcontact->email);
598 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_url/', $mode)) {
599 if ($targetcontact->url) {
600 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Web").
": ".$outputlangs->convToOutputCharset($targetcontact->url);
606 if (is_object($targetcompany)) {
607 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset(
dol_format_address($targetcompany));
609 if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) {
610 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv(
"Country".$targetcompany->country_code));
612 $stringaddress .= ($stringaddress ?
"\n" :
'');
615 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || preg_match(
'/targetwithdetails/', $mode)) {
617 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_phone/', $mode)) {
618 if (!empty($targetcompany->phone)) {
619 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Phone").
": ";
621 if (!empty($targetcompany->phone)) {
622 $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone);
626 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_fax/', $mode)) {
627 if ($targetcompany->fax) {
628 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Fax").
": ".$outputlangs->convToOutputCharset($targetcompany->fax);
632 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_email/', $mode)) {
633 if ($targetcompany->email) {
634 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Email").
": ".$outputlangs->convToOutputCharset($targetcompany->email);
638 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_url/', $mode)) {
639 if ($targetcompany->url) {
640 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Web").
": ".$outputlangs->convToOutputCharset($targetcompany->url);
649 if ($usecontact && is_object($targetcontact) &&
getDolGlobalInt(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')) {
650 $targetcontact->fetch_thirdparty();
651 if (!empty($targetcontact->thirdparty->id) && $targetcontact->thirdparty->tva_intra) {
652 $stringaddress .= ($stringaddress ?
"\n" :
'') . $outputlangs->transnoentities(
"VATIntraShort") .
': ' . $outputlangs->convToOutputCharset($targetcontact->thirdparty->tva_intra);
654 } elseif (!empty($targetcompany->tva_intra)) {
655 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"VATIntraShort").
': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra);
660 if (
getDolGlobalString(
'MAIN_LEGALFORM_IN_ADDRESS') && !empty($targetcompany->forme_juridique_code)) {
662 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp;
666 if (
getDolGlobalString(
'MAIN_PROFID1_IN_ADDRESS') && !empty($targetcompany->idprof1)) {
667 $tmp = $outputlangs->transcountrynoentities(
"ProfId1", $targetcompany->country_code);
668 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
671 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof1);
673 if (
getDolGlobalString(
'MAIN_PROFID2_IN_ADDRESS') && !empty($targetcompany->idprof2)) {
674 $tmp = $outputlangs->transcountrynoentities(
"ProfId2", $targetcompany->country_code);
675 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
678 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof2);
680 if (
getDolGlobalString(
'MAIN_PROFID3_IN_ADDRESS') && !empty($targetcompany->idprof3)) {
681 $tmp = $outputlangs->transcountrynoentities(
"ProfId3", $targetcompany->country_code);
682 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
685 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof3);
687 if (
getDolGlobalString(
'MAIN_PROFID4_IN_ADDRESS') && !empty($targetcompany->idprof4)) {
688 $tmp = $outputlangs->transcountrynoentities(
"ProfId4", $targetcompany->country_code);
689 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
692 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof4);
694 if (
getDolGlobalString(
'MAIN_PROFID5_IN_ADDRESS') && !empty($targetcompany->idprof5)) {
695 $tmp = $outputlangs->transcountrynoentities(
"ProfId5", $targetcompany->country_code);
696 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
699 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof5);
701 if (
getDolGlobalString(
'MAIN_PROFID6_IN_ADDRESS') && !empty($targetcompany->idprof6)) {
702 $tmp = $outputlangs->transcountrynoentities(
"ProfId6", $targetcompany->country_code);
703 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
706 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof6);
711 if ($mode ==
'source' && !empty($sourcecompany->note_public)) {
712 $stringaddress .= ($stringaddress ?
"\n" :
'').
dol_string_nohtmltag($sourcecompany->note_public);
714 if (($mode ==
'target' || preg_match(
'/targetwithdetails/', $mode)) && !empty($targetcompany->note_public)) {
715 $stringaddress .= ($stringaddress ?
"\n" :
'').
dol_string_nohtmltag($targetcompany->note_public);
721 return $stringaddress;
739 $filepath = $conf->mycompany->dir_output.
'/logos/' .
getDolGlobalString(
'MAIN_USE_BACKGROUND_ON_PDF');
740 if (file_exists($filepath)) {
741 $pdf->SetAutoPageBreak(0, 0);
743 $pdf->SetAlpha($conf->global->MAIN_USE_BACKGROUND_ON_PDF_ALPHA);
745 $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);
750 $pdf->SetAutoPageBreak(1, 0);
772 $substitutionarray[
'__FROM_NAME__'] =
'__FROM_NAME__';
773 $substitutionarray[
'__FROM_EMAIL__'] =
'__FROM_EMAIL__';
774 return $substitutionarray;
794 } elseif ($unit ==
'mm') {
796 } elseif ($unit ==
'cm') {
798 } elseif ($unit ==
'in') {
806 $text = $outputlangs->convToOutputCharset($text);
808 $savx = $pdf->getX();
809 $savy = $pdf->getY();
811 $watermark_angle = atan($h / $w) / 2;
812 $watermark_x_pos = 0;
813 $watermark_y_pos = $h / 3;
814 $watermark_x = $w / 2;
815 $watermark_y = $h / 3;
816 $pdf->SetFont(
'',
'B', 40);
817 $pdf->SetTextColor(255, 0, 0);
820 $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));
822 $pdf->SetXY($watermark_x_pos, $watermark_y_pos);
826 $pdf->Cell($w - 20, 25, $outputlangs->convToOutputCharset($text),
"", 2,
"C", 0);
831 $pdf->SetXY($savx, $savy);
850function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0, $default_font_size = 10)
852 global $mysoc, $conf;
854 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formbank.class.php';
858 $pdf->SetXY($curx, $cury);
860 if (empty($onlynumber)) {
861 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
862 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByTransferOnThisBankAccount').
':', 0,
'L', 0);
866 $outputlangs->load(
"banks");
869 $bickey =
"BICNumber";
870 if ($account->getCountryCode() ==
'IN') {
875 $usedetailedbban = $account->useDetailedBBAN();
878 if ($usedetailedbban) {
881 if (empty($onlynumber)) {
882 $pdf->SetFont(
'',
'', $default_font_size - $diffsizecontent);
883 $pdf->SetXY($curx, $cury);
884 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Bank").
': '.$outputlangs->convToOutputCharset($account->bank), 0,
'L', 0);
894 if (empty($onlynumber)) {
895 $pdf->line($curx + 1, $cury + 1, $curx + 1, $cury + 6);
899 foreach ($account->getFieldsToShow() as $val) {
900 $pdf->SetXY($curx, $cury + 4);
901 $pdf->SetFont(
'',
'', $default_font_size - 3);
903 if ($val ==
'BankCode') {
906 $content = $account->code_banque;
907 } elseif ($val ==
'DeskCode') {
910 $content = $account->code_guichet;
911 } elseif ($val ==
'BankAccountNumber') {
914 $content = $account->number;
915 } elseif ($val ==
'BankAccountNumberKey') {
918 $content = $account->cle_rib;
919 } elseif ($val ==
'IBAN' || $val ==
'BIC') {
924 dol_print_error($account->db,
'Unexpected value for getFieldsToShow: '.$val);
928 $pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($content), 0,
'C', 0);
929 $pdf->SetXY($curx, $cury + 1);
931 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizecontent);
932 $pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities($val), 0,
'C', 0);
933 if (empty($onlynumber)) {
934 $pdf->line($curx, $cury + 1, $curx, $cury + 7);
941 } elseif (!empty($account->number)) {
942 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizecontent);
943 $pdf->SetXY($curx, $cury);
944 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Bank").
': '.$outputlangs->convToOutputCharset($account->bank), 0,
'L', 0);
947 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizecontent);
948 $pdf->SetXY($curx, $cury);
949 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"BankAccountNumber").
': '.$outputlangs->convToOutputCharset($account->number), 0,
'L', 0);
952 if ($diffsizecontent <= 2) {
957 $pdf->SetFont(
'',
'', $default_font_size - $diffsizecontent);
959 if (empty($onlynumber) && (!empty($account->domiciliation) || !empty($account->address))) {
960 $pdf->SetXY($curx, $cury);
961 $val = $outputlangs->transnoentities(
"Residence").
': '.$outputlangs->convToOutputCharset(empty($account->address) ? $account->domiciliation : $account->address);
962 $pdf->MultiCell(100, 3, $val, 0,
'L', 0);
965 $tmpy = $pdf->getStringHeight(100, $val);
969 if (!empty($account->owner_name)) {
970 $pdf->SetXY($curx, $cury);
971 $val = $outputlangs->transnoentities(
"BankAccountOwner").
': '.$outputlangs->convToOutputCharset($account->owner_name);
972 $pdf->MultiCell(100, 3, $val, 0,
'L', 0);
973 $tmpy = $pdf->getStringHeight(100, $val);
975 } elseif (!$usedetailedbban) {
982 if (!empty($account->iban)) {
984 $ibanDisplay_temp = str_replace(
' ',
'', $outputlangs->convToOutputCharset($account->iban));
987 $nbIbanDisplay_temp =
dol_strlen($ibanDisplay_temp);
988 for ($i = 0; $i < $nbIbanDisplay_temp; $i++) {
989 $ibanDisplay .= $ibanDisplay_temp[$i];
990 if ($i % 4 == 3 && $i > 0) {
995 $pdf->SetFont(
'',
'B', $default_font_size - 3);
996 $pdf->SetXY($curx, $cury);
997 $pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey).
': '.$ibanDisplay, 0,
'L', 0);
1001 if (!empty($account->bic)) {
1002 $pdf->SetFont(
'',
'B', $default_font_size - 3);
1003 $pdf->SetXY($curx, $cury);
1004 $pdf->MultiCell(100, 3, $outputlangs->transnoentities($bickey).
': '.$outputlangs->convToOutputCharset($account->bic), 0,
'L', 0);
1007 return $pdf->getY();
1027function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur,
$object, $showdetails = 0, $hidefreetext = 0, $page_largeur = 0, $watermark =
'')
1029 global $conf, $hookmanager;
1031 $outputlangs->load(
"dict");
1034 $marginwithfooter = 0;
1036 $dims = $pdf->getPageDimensions();
1039 if (empty($hidefreetext) && !empty($conf->global->$paramfreetext)) {
1042 $substitutionarray[
'__FROM_NAME__'] = $fromcompany->name;
1043 $substitutionarray[
'__FROM_EMAIL__'] = $fromcompany->email;
1051 $newfreetext = preg_replace(
'/(<img.*src=")[^\"]*viewimage\.php[^\"]*modulepart=medias[^\"]*file=([^\"]*)("[^\/]*\/>)/',
'\1file:/'.DOL_DATA_ROOT.
'/medias/\2\3', $newfreetext);
1053 $line .= $outputlangs->convToOutputCharset($newfreetext);
1062 if ($showdetails == 1 || $showdetails == 3) {
1064 if ($fromcompany->name) {
1065 $line1 .= ($line1 ?
" - " :
"").$outputlangs->transnoentities(
"RegisteredOffice").
": ".$fromcompany->name;
1068 if ($fromcompany->address) {
1069 $line1 .= ($line1 ?
" - " :
"").str_replace(
"\n",
", ", $fromcompany->address);
1072 if ($fromcompany->zip) {
1073 $line1 .= ($line1 ?
" - " :
"").$fromcompany->zip;
1076 if ($fromcompany->town) {
1077 $line1 .= ($line1 ?
" " :
"").$fromcompany->town;
1080 if ($fromcompany->country) {
1081 $line1 .= ($line1 ?
", " :
"").$fromcompany->country;
1084 if ($fromcompany->phone) {
1085 $line2 .= ($line2 ?
" - " :
"").$outputlangs->transnoentities(
"Phone").
": ".$fromcompany->phone;
1088 if ($fromcompany->fax) {
1089 $line2 .= ($line2 ?
" - " :
"").$outputlangs->transnoentities(
"Fax").
": ".$fromcompany->fax;
1093 if ($fromcompany->url) {
1094 $line2 .= ($line2 ?
" - " :
"").$fromcompany->url;
1097 if ($fromcompany->email) {
1098 $line2 .= ($line2 ?
" - " :
"").$fromcompany->email;
1101 if ($showdetails == 2 || $showdetails == 3 || (!empty($fromcompany->country_code) && $fromcompany->country_code ==
'DE')) {
1103 if ($fromcompany->managers) {
1104 $line2 .= ($line2 ?
" - " :
"").$fromcompany->managers;
1110 if (!empty($fromcompany->forme_juridique_code) && $fromcompany->forme_juridique_code) {
1111 $line3 .= ($line3 ?
" - " :
"").$outputlangs->convToOutputCharset(
getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
1114 if (!empty($fromcompany->capital)) {
1115 $tmpamounttoshow =
price2num($fromcompany->capital);
1116 if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) {
1117 $line3 .= ($line3 ?
" - " :
"").$outputlangs->transnoentities(
"CapitalOf",
price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency));
1118 } elseif (!empty($fromcompany->capital)) {
1119 $line3 .= ($line3 ?
" - " :
"").$outputlangs->transnoentities(
"CapitalOf", $fromcompany->capital, $outputlangs);
1123 if (!empty($fromcompany->idprof1) && $fromcompany->idprof1 && ($fromcompany->country_code !=
'FR' || !$fromcompany->idprof2)) {
1124 $field = $outputlangs->transcountrynoentities(
"ProfId1", $fromcompany->country_code);
1125 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1128 $line3 .= ($line3 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof1);
1131 if (!empty($fromcompany->idprof2) && $fromcompany->idprof2) {
1132 $field = $outputlangs->transcountrynoentities(
"ProfId2", $fromcompany->country_code);
1133 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1136 $line3 .= ($line3 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof2);
1141 if (!empty($fromcompany->idprof3) && $fromcompany->idprof3) {
1142 $field = $outputlangs->transcountrynoentities(
"ProfId3", $fromcompany->country_code);
1143 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1146 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof3);
1149 if (!empty($fromcompany->idprof4) && $fromcompany->idprof4) {
1150 $field = $outputlangs->transcountrynoentities(
"ProfId4", $fromcompany->country_code);
1151 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1154 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof4);
1157 if (!empty($fromcompany->idprof5) && $fromcompany->idprof5) {
1158 $field = $outputlangs->transcountrynoentities(
"ProfId5", $fromcompany->country_code);
1159 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1162 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof5);
1165 if (!empty($fromcompany->idprof6) && $fromcompany->idprof6) {
1166 $field = $outputlangs->transcountrynoentities(
"ProfId6", $fromcompany->country_code);
1167 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1170 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof6);
1173 if (!empty($fromcompany->idprof7) && $fromcompany->idprof7) {
1174 $field = $outputlangs->transcountrynoentities(
"ProfId7", $fromcompany->country_code);
1175 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1178 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof7);
1181 if (!empty($fromcompany->idprof8) && $fromcompany->idprof8) {
1182 $field = $outputlangs->transcountrynoentities(
"ProfId8", $fromcompany->country_code);
1183 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1186 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof8);
1189 if (!empty($fromcompany->idprof9) && $fromcompany->idprof9) {
1190 $field = $outputlangs->transcountrynoentities(
"ProfId9", $fromcompany->country_code);
1191 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1194 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof9);
1197 if (!empty($fromcompany->idprof10) && $fromcompany->idprof10) {
1198 $field = $outputlangs->transcountrynoentities(
"ProfId10", $fromcompany->country_code);
1199 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1202 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof10);
1205 if (!empty($fromcompany->tva_intra) && $fromcompany->tva_intra !=
'') {
1206 $line4 .= ($line4 ?
" - " :
"").$outputlangs->transnoentities(
"VATIntraShort").
": ".$outputlangs->convToOutputCharset($fromcompany->tva_intra);
1209 $pdf->SetFont(
'',
'', 7);
1210 $pdf->SetDrawColor(224, 224, 224);
1213 list($r, $g, $b) = sscanf($conf->global->PDF_FOOTER_TEXT_COLOR,
'%d, %d, %d');
1214 $pdf->SetTextColor($r, $g, $b);
1218 $freetextheight = 0;
1228 $freetextheight = $pdf->getStringHeight($width, $line);
1236 if (is_object($hookmanager)) {
1237 $parameters = array(
'line1' => $line1,
'line2' => $line2,
'line3' => $line3,
'line4' => $line4,
'outputlangs' => $outputlangs);
1239 $hookmanager->executeHooks(
'pdf_pagefoot', $parameters,
$object, $action);
1240 if (!empty($hookmanager->resPrint) && $hidefreetext == 0) {
1241 $mycustomfooter = $hookmanager->resPrint;
1244 $marginwithfooter = $marge_basse + $freetextheight + $mycustomfooterheight;
1245 $posy = (float) $marginwithfooter;
1249 list($r, $g, $b) = sscanf($conf->global->PDF_FOOTER_BACKGROUND_COLOR,
'%d, %d, %d');
1250 $pdf->SetAutoPageBreak(0, 0);
1251 $pdf->Rect(0, $dims[
'hk'] - $posy + $freetextheight, $dims[
'wk'] + 1, $marginwithfooter + 1,
'F',
'', $fill_color = array($r, $g, $b));
1252 $pdf->SetAutoPageBreak(1, 0);
1256 $pdf->SetAutoPageBreak(0, 0);
1259 $pdf->SetXY($dims[
'lm'], -$posy);
1261 $pdf->MultiCell(0, 3, $line, 0, $align, 0);
1263 $pdf->writeHTMLCell($dims[
'wk'] - $dims[
'lm'] - $dims[
'rm'], $freetextheight, $dims[
'lm'], $dims[
'hk'] - $marginwithfooter,
dol_htmlentitiesbr($line, 1,
'UTF-8', 0));
1265 $posy -= $freetextheight;
1268 $pdf->SetAutoPageBreak(1, 0);
1275 $pdf->line($dims[
'lm'], $dims[
'hk'] - $posy, $dims[
'wk'] - $dims[
'rm'], $dims[
'hk'] - $posy);
1286 $pdf->SetAutoPageBreak(0, 0);
1288 $pdf->writeHTMLCell($dims[
'wk'] - $dims[
'lm'] - $dims[
'rm'], $mycustomfooterheight, $dims[
'lm'], $dims[
'hk'] - $posy,
dol_htmlentitiesbr($mycustomfooter, 1,
'UTF-8', 0));
1290 $pdf->SetAutoPageBreak(1, 0);
1293 $posy -= $mycustomfooterheight - 3;
1296 $marginwithfooter = $marge_basse + $freetextheight + (!empty($line1) ? 3 : 0) + (!empty($line2) ? 3 : 0) + (!empty($line3) ? 3 : 0) + (!empty($line4) ? 3 : 0);
1297 $posy = (float) $marginwithfooter;
1301 list($r, $g, $b) = sscanf($conf->global->PDF_FOOTER_BACKGROUND_COLOR,
'%d, %d, %d');
1302 $pdf->SetAutoPageBreak(0, 0);
1303 $pdf->Rect(0, $dims[
'hk'] - $posy + $freetextheight, $dims[
'wk'] + 1, $marginwithfooter + 1,
'F',
'', $fill_color = array($r, $g, $b));
1304 $pdf->SetAutoPageBreak(1, 0);
1308 $pdf->SetAutoPageBreak(0, 0);
1311 $pdf->SetXY($dims[
'lm'], -$posy);
1313 $pdf->MultiCell(0, 3, $line, 0, $align, 0);
1315 $pdf->writeHTMLCell($dims[
'wk'] - $dims[
'lm'] - $dims[
'rm'], $freetextheight, $dims[
'lm'], $dims[
'hk'] - $marginwithfooter,
dol_htmlentitiesbr($line, 1,
'UTF-8', 0));
1317 $posy -= $freetextheight;
1320 $pdf->SetAutoPageBreak(1, 0);
1329 $pdf->line($dims[
'lm'], $dims[
'hk'] - $posy, $dims[
'wk'] - $dims[
'rm'], $dims[
'hk'] - $posy);
1339 if (!empty($line1)) {
1340 $pdf->SetFont(
'',
'B', 7);
1341 $pdf->SetXY($dims[
'lm'], -$posy);
1342 $pdf->MultiCell($dims[
'wk'] - $dims[
'rm'] - $dims[
'lm'], 2, $line1, 0,
'C', 0);
1344 $pdf->SetFont(
'',
'', 7);
1347 if (!empty($line2)) {
1348 $pdf->SetFont(
'',
'B', 7);
1349 $pdf->SetXY($dims[
'lm'], -$posy);
1350 $pdf->MultiCell($dims[
'wk'] - $dims[
'rm'] - $dims[
'lm'], 2, $line2, 0,
'C', 0);
1352 $pdf->SetFont(
'',
'', 7);
1355 if (!empty($line3)) {
1356 $pdf->SetXY($dims[
'lm'], -$posy);
1357 $pdf->MultiCell($dims[
'wk'] - $dims[
'rm'] - $dims[
'lm'], 2, $line3, 0,
'C', 0);
1360 if (!empty($line4)) {
1362 $pdf->SetXY($dims[
'lm'], -$posy);
1363 $pdf->MultiCell($dims[
'wk'] - $dims[
'rm'] - $dims[
'lm'], 2, $line4, 0,
'C', 0);
1370 $pdf->SetXY($dims[
'wk'] - $dims[
'rm'] - 18 -
getDolGlobalInt(
'PDF_FOOTER_PAGE_NUMBER_X', 0), -$posy -
getDolGlobalInt(
'PDF_FOOTER_PAGE_NUMBER_Y', 0));
1372 $pagination = $pdf->PageNo().
' / '.$pdf->getAliasNbPages();
1373 $fontRenderCorrection = 0;
1374 if (in_array(
pdf_getPDFFont($outputlangs), array(
'freemono',
'DejaVuSans'))) {
1375 $fontRenderCorrection = 10;
1377 $pdf->MultiCell(18 + $fontRenderCorrection, 2, $pagination, 0,
'R', 0);
1380 if (!empty($watermark)) {
1381 pdf_watermark($pdf, $outputlangs, $page_hauteur, $page_largeur,
'mm', $watermark);
1384 return $marginwithfooter;
1404 if (!empty($linkedobjects)) {
1405 foreach ($linkedobjects as $linkedobject) {
1406 $reftoshow = $linkedobject[
"ref_title"].
' : '.$linkedobject[
"ref_value"];
1407 if (!empty($linkedobject[
"date_value"])) {
1408 $reftoshow .=
' / '.$linkedobject[
"date_value"];
1412 $pdf->SetXY($posx, $posy);
1413 $pdf->SetFont(
'',
'', $default_font_size - 2);
1414 $pdf->MultiCell($w, $h, $reftoshow,
'', $align);
1418 return $pdf->getY();
1438function pdf_writelinedesc(&$pdf,
$object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref = 0, $hidedesc = 0, $issupplierline = 0, $align =
'J')
1440 global $db, $conf, $langs, $hookmanager;
1445 if (is_object($hookmanager)) {
1446 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
1447 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
1448 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
1450 $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);
1452 $reshook = $hookmanager->executeHooks(
'pdf_writelinedesc', $parameters,
$object, $action);
1454 if (!empty($hookmanager->resPrint)) {
1455 $result .= $hookmanager->resPrint;
1458 if (empty($reshook)) {
1460 $labelproductservice = preg_replace(
'/(<img[^>]*src=")[^\"]*viewimage\.php[^\"]*modulepart=medias[^\"]*file=([^\"]*)/',
'\1file:/'.DOL_DATA_ROOT.
'/medias/\2\3', $labelproductservice, -1, $nbrep);
1467 $labelproductservice = preg_replace(
'/(<img[^>]*src=")([^"]*)(&)([^"]*")/',
'\1\2&\4', $labelproductservice, -1, $nbrep);
1470 $pdf->setListIndentWidth(5);
1471 $TMarginList = [
'ul' => [[
'h'=>0.1, ],[
'h'=>0.1, ]],
'li' => [[
'h'=>0.1, ],],];
1472 $pdf->setHtmlVSpace($TMarginList);
1476 $pdf->writeHTMLCell($w, $h, $posx, $posy, $outputlangs->convToOutputCharset($labelproductservice), 0, 1,
false,
true, $align,
true);
1477 $result .= $labelproductservice;
1495 global $db, $conf, $langs;
1497 $idprod = (!empty(
$object->lines[$i]->fk_product) ?
$object->lines[$i]->fk_product :
false);
1498 $label = (!empty(
$object->lines[$i]->label) ?
$object->lines[$i]->label : (!empty(
$object->lines[$i]->product_label) ?
$object->lines[$i]->product_label :
''));
1499 $product_barcode = (!empty(
$object->lines[$i]->product_barcode) ?
$object->lines[$i]->product_barcode :
"");
1500 $desc = (!empty(
$object->lines[$i]->desc) ?
$object->lines[$i]->desc : (!empty(
$object->lines[$i]->description) ?
$object->lines[$i]->description :
''));
1501 $ref_supplier = (!empty(
$object->lines[$i]->ref_supplier) ?
$object->lines[$i]->ref_supplier : (!empty(
$object->lines[$i]->ref_fourn) ?
$object->lines[$i]->ref_fourn :
''));
1502 $note = (!empty(
$object->lines[$i]->note) ?
$object->lines[$i]->note :
'');
1503 $dbatch = (!empty(
$object->lines[$i]->detail_batch) ?
$object->lines[$i]->detail_batch :
false);
1507 if ($issupplierline) {
1508 include_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
1511 include_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
1515 include_once DOL_DOCUMENT_ROOT .
'/product/class/productcustomerprice.class.php';
1520 $idprod = (!empty(
$object->lines[$i]->fk_product) ?
$object->lines[$i]->fk_product :
false);
1522 $prodser->fetch($idprod);
1524 if ($multilangsactive) {
1525 $prodser->getMultiLangs();
1526 $object->lines[$i]->multilangs = $prodser->multilangs;
1530 if (!empty(
$object->lines[$i]->label)) {
1531 $label =
$object->lines[$i]->label;
1533 if (!empty(
$object->lines[$i]->multilangs[$outputlangs->defaultlang][
'label']) && $multilangsactive) {
1534 $label =
$object->lines[$i]->multilangs[$outputlangs->defaultlang][
'label'];
1536 if (!empty(
$object->lines[$i]->product_label)) {
1537 $label =
$object->lines[$i]->product_label;
1544 if (!empty(
$object->lines[$i]->desc)) {
1545 $desc =
$object->lines[$i]->desc;
1547 if (!empty(
$object->lines[$i]->multilangs[$outputlangs->defaultlang][
'description']) && $multilangsactive) {
1548 $desc =
$object->lines[$i]->multilangs[$outputlangs->defaultlang][
'description'];
1550 if (!empty(
$object->lines[$i]->description)) {
1551 $desc =
$object->lines[$i]->description;
1558 $ref_supplier = (!empty(
$object->lines[$i]->ref_supplier) ?
$object->lines[$i]->ref_supplier : (!empty(
$object->lines[$i]->ref_fourn) ?
$object->lines[$i]->ref_fourn :
''));
1560 $note = (!empty(
$object->lines[$i]->note) ?
$object->lines[$i]->note :
'');
1562 $dbatch = (!empty(
$object->lines[$i]->detail_batch) ?
$object->lines[$i]->detail_batch :
false);
1566 if ($multilangsactive && ($outputlangs->defaultlang != $langs->defaultlang)) {
1567 $translatealsoifmodified =
getDolGlobalString(
'MAIN_MULTILANG_TRANSLATE_EVEN_IF_MODIFIED');
1575 $textwasnotmodified = ($label == $prodser->label);
1576 if (!empty($prodser->multilangs[$outputlangs->defaultlang][
"label"]) && ($textwasnotmodified || $translatealsoifmodified)) {
1577 $label = $prodser->multilangs[$outputlangs->defaultlang][
"label"];
1582 $textwasnotmodified =
false;
1586 $textwasnotmodified = ($desc == $prodser->description);
1588 if (!empty($prodser->multilangs[$outputlangs->defaultlang][
"description"])) {
1589 if ($textwasnotmodified) {
1590 $desc = str_replace($prodser->description, $prodser->multilangs[$outputlangs->defaultlang][
"description"], $desc);
1591 } elseif ($translatealsoifmodified) {
1592 $desc = $prodser->multilangs[$outputlangs->defaultlang][
"description"];
1597 $textwasnotmodified = ($note == $prodser->note_public);
1598 if (!empty($prodser->multilangs[$outputlangs->defaultlang][
"other"]) && ($textwasnotmodified || $translatealsoifmodified)) {
1599 $note = $prodser->multilangs[$outputlangs->defaultlang][
"other"];
1602 } elseif ((
$object->element ==
'facture' ||
$object->element ==
'facturefourn') && preg_match(
'/^\(DEPOSIT\).+/', $desc)) {
1603 $desc = str_replace(
'(DEPOSIT)', $outputlangs->trans(
'Deposit'), $desc);
1608 $libelleproduitservice = $label;
1609 if (!empty($libelleproduitservice) &&
getDolGlobalString(
'PDF_BOLD_PRODUCT_LABEL')) {
1613 $libelleproduitservice = str_replace(
"\n",
'<br>', $libelleproduitservice);
1615 $libelleproduitservice =
'<b>'.$libelleproduitservice.
'</b>';
1622 $prodser->get_sousproduits_arbo();
1623 if (!empty($prodser->sousprods) && is_array($prodser->sousprods) && count($prodser->sousprods)) {
1624 $outputlangs->load(
'mrp');
1625 $tmparrayofsubproducts = reset($prodser->sousprods);
1628 if (isset(
$object->lines[$i]->qty) && !empty(
$object->lines[$i]->qty)) {
1629 $qtyText =
$object->lines[$i]->qty;
1630 } elseif (isset(
$object->lines[$i]->qty_shipped) && !empty(
$object->lines[$i]->qty_shipped)) {
1631 $qtyText =
$object->lines[$i]->qty;
1635 foreach ($tmparrayofsubproducts as $subprodval) {
1639 $outputlangs->trans(
'Qty').
':'.$qtyText.
' x '.$outputlangs->trans(
'AssociatedProducts').
':'.$subprodval[1].
'= '.$outputlangs->trans(
'QtyTot').
':'.$subprodval[1] * $qtyText :
1640 $outputlangs->trans(
'Qty').
' '.$outputlangs->trans(
'AssociatedProducts').
':'.$subprodval[1])
1644 foreach ($tmparrayofsubproducts as $subprodval) {
1646 dol_concatdesc($libelleproduitservice,
" * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ?
' - ' :
'').$subprodval[3]),
1648 $outputlangs->trans(
'Qty').
':'.$qtyText.
' x '.$outputlangs->trans(
'AssociatedProducts').
':'.$subprodval[1].
'= '.$outputlangs->trans(
'QtyTot').
':'.$subprodval[1] * $qtyText :
1649 $outputlangs->trans(
'Qty').
' '.$outputlangs->trans(
'AssociatedProducts').
':'.$subprodval[1])
1656 if (isModEnabled(
'barcode') &&
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE') && !empty($product_barcode)) {
1657 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $outputlangs->trans(
"BarCode").
" ".$product_barcode);
1661 if (!empty($desc) && ($desc != $label)) {
1662 if ($desc ==
'(CREDIT_NOTE)' &&
$object->lines[$i]->fk_remise_except) {
1664 $discount->fetch(
$object->lines[$i]->fk_remise_except);
1665 $sourceref = !empty($discount->discount_type) ? $discount->ref_invoice_supplier_source : $discount->ref_facture_source;
1666 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromCreditNote", $sourceref);
1667 } elseif ($desc ==
'(DEPOSIT)' &&
$object->lines[$i]->fk_remise_except) {
1669 $discount->fetch(
$object->lines[$i]->fk_remise_except);
1670 $sourceref = !empty($discount->discount_type) ? $discount->ref_invoice_supplier_source : $discount->ref_facture_source;
1671 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromDeposit", $sourceref);
1674 $libelleproduitservice .=
' ('.dol_print_date($discount->datec,
'day',
'', $outputlangs).
')';
1676 } elseif ($desc ==
'(EXCESS RECEIVED)' &&
$object->lines[$i]->fk_remise_except) {
1678 $discount->fetch(
$object->lines[$i]->fk_remise_except);
1679 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromExcessReceived", $discount->ref_facture_source);
1680 } elseif ($desc ==
'(EXCESS PAID)' &&
$object->lines[$i]->fk_remise_except) {
1682 $discount->fetch(
$object->lines[$i]->fk_remise_except);
1683 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromExcessPaid", $discount->ref_invoice_supplier_source);
1687 if (!empty(
$object->element)) {
1688 $tmpkey =
'MAIN_DOCUMENTS_HIDE_DESCRIPTION_FOR_'.strtoupper(
$object->element);
1689 if (!empty($conf->global->$tmpkey)) {
1693 if (empty($hidedesc)) {
1695 $libelleproduitservice =
dol_concatdesc($desc, $libelleproduitservice);
1698 $libelleproduitservice = $desc;
1700 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $desc);
1705 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $desc);
1711 $prefix_prodserv =
"";
1714 if ($prodser->isService()) {
1715 $prefix_prodserv = $outputlangs->transnoentitiesnoconv(
"Service").
" ";
1717 $prefix_prodserv = $outputlangs->transnoentitiesnoconv(
"Product").
" ";
1721 if (empty($hideref)) {
1722 if ($issupplierline) {
1724 $ref_prodserv = $prodser->ref;
1725 if ($ref_supplier) {
1726 $ref_prodserv .= ($prodser->ref ?
' (' :
'').$outputlangs->transnoentitiesnoconv(
"SupplierRef").
' '.$ref_supplier.($prodser->ref ?
')' :
'');
1728 } elseif (
getDolGlobalInt(
'PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES') == 1) {
1729 $ref_prodserv = $ref_supplier;
1730 } elseif (
getDolGlobalInt(
'PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES') == 2) {
1731 $ref_prodserv = $ref_supplier.
' ('.$outputlangs->transnoentitiesnoconv(
"InternalRef").
' '.$prodser->ref.
')';
1734 $ref_prodserv = $prodser->ref;
1738 $filter = array(
'fk_product' => $idprod,
'fk_soc' =>
$object->socid);
1740 $nbCustomerPrices = $productCustomerPriceStatic->fetchAll(
'',
'', 1, 0, $filter);
1742 if ($nbCustomerPrices > 0) {
1743 $productCustomerPrice = $productCustomerPriceStatic->lines[0];
1745 if (!empty($productCustomerPrice->ref_customer)) {
1746 switch ($conf->global->PRODUIT_CUSTOMER_PRICES_PDF_REF_MODE) {
1748 $ref_prodserv = $productCustomerPrice->ref_customer;
1752 $ref_prodserv = $productCustomerPrice->ref_customer .
' (' . $outputlangs->transnoentitiesnoconv(
'InternalRef') .
' ' . $ref_prodserv .
')';
1756 $ref_prodserv = $ref_prodserv .
' (' . $outputlangs->transnoentitiesnoconv(
'RefCustomer') .
' ' . $productCustomerPrice->ref_customer .
')';
1763 if (!empty($libelleproduitservice) && !empty($ref_prodserv)) {
1764 $ref_prodserv .=
" - ";
1768 if (!empty($ref_prodserv) &&
getDolGlobalString(
'PDF_BOLD_PRODUCT_REF_AND_PERIOD')) {
1770 $libelleproduitservice = str_replace(
"\n",
'<br>', $libelleproduitservice);
1772 $ref_prodserv =
'<b>'.$ref_prodserv.
'</b>';
1775 $libelleproduitservice = $prefix_prodserv.$ref_prodserv.$libelleproduitservice;
1778 if (
getDolGlobalString(
'CATEGORY_ADD_DESC_INTO_DOC') && $idprod && isModEnabled(
'category')) {
1779 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1782 $tblcateg = $categstatic->containing($idprod, Categorie::TYPE_PRODUCT);
1783 foreach ($tblcateg as $cate) {
1785 $desccateg = $cate->description;
1787 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $desccateg);
1792 if (!empty(
$object->lines[$i]->date_start) || !empty(
$object->lines[$i]->date_end)) {
1796 if (
$object->lines[$i]->date_start &&
$object->lines[$i]->date_end) {
1797 $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)).
')';
1799 if (
$object->lines[$i]->date_start && !
$object->lines[$i]->date_end) {
1800 $period =
'('.$outputlangs->transnoentitiesnoconv(
'DateFrom',
dol_print_date(
$object->lines[$i]->date_start, $format,
false, $outputlangs)).
')';
1802 if (!
$object->lines[$i]->date_start &&
$object->lines[$i]->date_end) {
1803 $period =
'('.$outputlangs->transnoentitiesnoconv(
'DateUntil',
dol_print_date(
$object->lines[$i]->date_end, $format,
false, $outputlangs)).
')';
1808 $libelleproduitservice = str_replace(
"\n",
'<br>', $libelleproduitservice);
1810 $libelleproduitservice .=
'<br><b style="color:#333666;" ><em>'.$period.
'</em></b>';
1812 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $period);
1818 if (!empty($dbatch)) {
1823 include_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1824 include_once DOL_DOCUMENT_ROOT.
'/product/class/productbatch.class.php';
1829 foreach ($dbatch as $detail) {
1831 if ($detail->eatby) {
1832 $dte[] = $outputlangs->transnoentitiesnoconv(
'printEatby',
dol_print_date($detail->eatby, $format,
false, $outputlangs));
1834 if ($detail->sellby) {
1835 $dte[] = $outputlangs->transnoentitiesnoconv(
'printSellby',
dol_print_date($detail->sellby, $format,
false, $outputlangs));
1837 if ($detail->batch) {
1838 $dte[] = $outputlangs->transnoentitiesnoconv(
'printBatch', $detail->batch);
1840 $dte[] = $outputlangs->transnoentitiesnoconv(
'printQty', $detail->qty);
1843 if (
$object->element ==
'shipping' && $detail->fk_origin_stock > 0 &&
getDolGlobalInt(
'PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT')) {
1844 $resproductbatch = $tmpproductbatch->fetch($detail->fk_origin_stock);
1845 if ($resproductbatch > 0) {
1846 $reswarehouse = $tmpwarehouse->fetch($tmpproductbatch->warehouseid);
1847 if ($reswarehouse > 0) {
1848 $dte[] = $tmpwarehouse->ref;
1853 $libelleproduitservice .=
"__N__ ".implode(
" - ", $dte);
1863 $libelleproduitservice = preg_replace(
'/__N__/',
'<br>', $libelleproduitservice);
1865 $libelleproduitservice = preg_replace(
'/__N__/',
"\n", $libelleproduitservice);
1869 return $libelleproduitservice;
1883 global $hookmanager;
1888 if (is_object($hookmanager)) {
1889 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
1890 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
1891 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
1893 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
1895 $reshook = $hookmanager->executeHooks(
'pdf_getlinenum', $parameters,
$object, $action);
1896 $result .= $hookmanager->resPrint;
1898 if (empty($reshook)) {
1916 global $hookmanager;
1921 if (is_object($hookmanager)) {
1922 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
1923 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
1924 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
1926 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
1928 $reshook = $hookmanager->executeHooks(
'pdf_getlineref', $parameters,
$object, $action);
1929 $result .= $hookmanager->resPrint;
1931 if (empty($reshook)) {
1948 global $hookmanager;
1953 if (is_object($hookmanager)) {
1954 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
1955 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
1956 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
1958 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
1960 $reshook = $hookmanager->executeHooks(
'pdf_getlineref_supplier', $parameters,
$object, $action);
1961 $result .= $hookmanager->resPrint;
1963 if (empty($reshook)) {
1980 global $conf, $hookmanager, $mysoc;
1985 if (is_object($hookmanager)) {
1986 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
1987 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
1988 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
1990 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
1992 $reshook = $hookmanager->executeHooks(
'pdf_getlinevatrate', $parameters,
$object, $action);
1994 if (!empty($hookmanager->resPrint)) {
1995 $result .= $hookmanager->resPrint;
1998 if (empty($reshook)) {
1999 if (empty($hidedetails) || $hidedetails > 1) {
2004 if (
$object->lines[$i]->total_localtax1 != 0) {
2005 if (preg_replace(
'/[\s0%]/',
'', $tmpresult)) {
2014 if (
$object->lines[$i]->total_localtax2 != 0) {
2015 if (preg_replace(
'/[\s0%]/',
'', $tmpresult)) {
2025 $result .= $tmpresult;
2042 global $conf, $hookmanager;
2052 if (is_object($hookmanager)) {
2053 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2054 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2055 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2057 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2059 $reshook = $hookmanager->executeHooks(
'pdf_getlineupexcltax', $parameters,
$object, $action);
2061 if (!empty($hookmanager->resPrint)) {
2062 $result .= $hookmanager->resPrint;
2065 if (empty($reshook)) {
2066 if (empty($hidedetails) || $hidedetails > 1) {
2067 $subprice = (isModEnabled(
"multicurrency") &&
$object->multicurrency_tx != 1 ?
$object->lines[$i]->multicurrency_subprice :
$object->lines[$i]->subprice);
2068 $result .=
price($sign * $subprice, 0, $outputlangs);
2085 global $hookmanager, $conf;
2095 if (is_object($hookmanager)) {
2096 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2097 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2098 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2100 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2102 $reshook = $hookmanager->executeHooks(
'pdf_getlineupwithtax', $parameters,
$object, $action);
2104 if (!empty($hookmanager->resPrint)) {
2105 $result .= $hookmanager->resPrint;
2108 if (empty($reshook)) {
2109 if (empty($hidedetails) || $hidedetails > 1) {
2110 $result .=
price($sign * ((
$object->lines[$i]->subprice) + (
$object->lines[$i]->subprice) * (
$object->lines[$i]->tva_tx) / 100), 0, $outputlangs);
2127 global $hookmanager;
2132 if (is_object($hookmanager)) {
2133 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2134 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2135 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2137 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2139 $reshook = $hookmanager->executeHooks(
'pdf_getlineqty', $parameters,
$object, $action);
2141 if (!empty($hookmanager->resPrint)) {
2142 $result = $hookmanager->resPrint;
2145 if (empty($reshook)) {
2146 if (
$object->lines[$i]->special_code == 3) {
2149 if (empty($hidedetails) || $hidedetails > 1) {
2150 $result .=
$object->lines[$i]->qty;
2167 global $hookmanager;
2172 if (is_object($hookmanager)) {
2173 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2174 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2175 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2177 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2179 $reshook = $hookmanager->executeHooks(
'pdf_getlineqty_asked', $parameters,
$object, $action);
2181 if (!empty($hookmanager->resPrint)) {
2182 $result .= $hookmanager->resPrint;
2185 if (empty($reshook)) {
2186 if (
$object->lines[$i]->special_code == 3) {
2189 if (empty($hidedetails) || $hidedetails > 1) {
2190 $result .=
$object->lines[$i]->qty_asked;
2207 global $hookmanager;
2212 if (is_object($hookmanager)) {
2213 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2214 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2215 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2217 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2219 $reshook = $hookmanager->executeHooks(
'pdf_getlineqty_shipped', $parameters,
$object, $action);
2221 if (!empty($hookmanager->resPrint)) {
2222 $result .= $hookmanager->resPrint;
2225 if (empty($reshook)) {
2226 if (
$object->lines[$i]->special_code == 3) {
2229 if (empty($hidedetails) || $hidedetails > 1) {
2230 $result .=
$object->lines[$i]->qty_shipped;
2247 global $hookmanager;
2252 if (is_object($hookmanager)) {
2253 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2254 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2255 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2257 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2259 $reshook = $hookmanager->executeHooks(
'pdf_getlineqty_keeptoship', $parameters,
$object, $action);
2261 if (!empty($hookmanager->resPrint)) {
2262 $result .= $hookmanager->resPrint;
2265 if (empty($reshook)) {
2266 if (
$object->lines[$i]->special_code == 3) {
2269 if (empty($hidedetails) || $hidedetails > 1) {
2270 $result .= (
$object->lines[$i]->qty_asked -
$object->lines[$i]->qty_shipped);
2287 global $hookmanager, $langs;
2292 if (is_object($hookmanager)) {
2293 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2294 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2295 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2297 $parameters = array(
2299 'outputlangs' => $outputlangs,
2300 'hidedetails' => $hidedetails,
2301 'special_code' => $special_code
2304 $reshook = $hookmanager->executeHooks(
'pdf_getlineunit', $parameters,
$object, $action);
2306 if (!empty($hookmanager->resPrint)) {
2307 $result .= $hookmanager->resPrint;
2310 if (empty($reshook)) {
2311 if (empty($hidedetails) || $hidedetails > 1) {
2312 $result .= $langs->transnoentitiesnoconv(
$object->lines[$i]->getLabelOfUnit(
'short'));
2330 global $hookmanager;
2332 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
2337 if (is_object($hookmanager)) {
2338 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2339 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2340 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2342 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2344 $reshook = $hookmanager->executeHooks(
'pdf_getlineremisepercent', $parameters,
$object, $action);
2346 if (!empty($hookmanager->resPrint)) {
2347 $result .= $hookmanager->resPrint;
2350 if (empty($reshook)) {
2351 if (
$object->lines[$i]->special_code == 3) {
2354 if (empty($hidedetails) || $hidedetails > 1) {
2373 if (empty($hookmanager)) {
2374 global $hookmanager;
2381 if (is_object($hookmanager)) {
2382 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2383 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2384 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2386 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2388 $reshook = $hookmanager->executeHooks(
'pdf_getlineprogress', $parameters,
$object, $action);
2390 if (!empty($hookmanager->resPrint)) {
2391 return $hookmanager->resPrint;
2394 if (empty($reshook)) {
2395 if (
$object->lines[$i]->special_code == 3) {
2398 if (empty($hidedetails) || $hidedetails > 1) {
2401 if (method_exists(
$object->lines[$i],
'get_prev_progress')) {
2402 $prev_progress =
$object->lines[$i]->get_prev_progress(
$object->id);
2404 $result = round(
$object->lines[$i]->situation_percent - $prev_progress, 1).
'%';
2406 $result = round(
$object->lines[$i]->situation_percent, 1).
'%';
2424 global $conf, $hookmanager;
2434 if (is_object($hookmanager)) {
2435 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2436 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2437 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2439 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code,
'sign' => $sign);
2441 $reshook = $hookmanager->executeHooks(
'pdf_getlinetotalexcltax', $parameters,
$object, $action);
2443 if (!empty($hookmanager->resPrint)) {
2444 $result .= $hookmanager->resPrint;
2447 if (empty($reshook)) {
2448 if (!empty(
$object->lines[$i]) &&
$object->lines[$i]->special_code == 3) {
2449 $result .= $outputlangs->transnoentities(
"Option");
2450 } elseif (empty($hidedetails) || $hidedetails > 1) {
2451 $total_ht = (isModEnabled(
"multicurrency") &&
$object->multicurrency_tx != 1 ?
$object->lines[$i]->multicurrency_total_ht :
$object->lines[$i]->total_ht);
2452 if (!empty(
$object->lines[$i]->situation_percent) &&
$object->lines[$i]->situation_percent > 0) {
2456 if (method_exists(
$object->lines[$i],
'get_prev_progress')) {
2457 $prev_progress =
$object->lines[$i]->get_prev_progress(
$object->id);
2458 $progress = (
$object->lines[$i]->situation_percent - $prev_progress) / 100;
2460 $result .=
price($sign * ($total_ht / (
$object->lines[$i]->situation_percent / 100)) * $progress, 0, $outputlangs);
2462 $result .=
price($sign * $total_ht, 0, $outputlangs);
2480 global $hookmanager, $conf;
2490 if (is_object($hookmanager)) {
2491 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2492 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2493 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2495 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2497 $reshook = $hookmanager->executeHooks(
'pdf_getlinetotalwithtax', $parameters,
$object, $action);
2499 if (!empty($hookmanager->resPrint)) {
2500 $result .= $hookmanager->resPrint;
2503 if (empty($reshook)) {
2504 if (
$object->lines[$i]->special_code == 3) {
2505 $result .= $outputlangs->transnoentities(
"Option");
2506 } elseif (empty($hidedetails) || $hidedetails > 1) {
2507 $total_ttc = (isModEnabled(
"multicurrency") &&
$object->multicurrency_tx != 1 ?
$object->lines[$i]->multicurrency_total_ttc :
$object->lines[$i]->total_ttc);
2508 if (isset(
$object->lines[$i]->situation_percent) &&
$object->lines[$i]->situation_percent > 0) {
2512 if (method_exists(
$object->lines[$i],
'get_prev_progress')) {
2513 $prev_progress =
$object->lines[$i]->get_prev_progress(
$object->id);
2514 $progress = (
$object->lines[$i]->situation_percent - $prev_progress) / 100;
2516 $result .=
price($sign * ($total_ttc / (
$object->lines[$i]->situation_percent / 100)) * $progress, 0, $outputlangs);
2518 $result .=
price($sign * $total_ttc, 0, $outputlangs);
2535 global $db, $hookmanager;
2537 $linkedobjects = array();
2541 foreach (
$object->linkedObjects as $objecttype => $objects) {
2542 if ($objecttype ==
'facture') {
2544 } elseif ($objecttype ==
'propal' || $objecttype ==
'supplier_proposal') {
2545 $outputlangs->load(
'propal');
2547 foreach ($objects as $elementobject) {
2548 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"RefProposal");
2549 $linkedobjects[$objecttype][
'ref_value'] = $outputlangs->transnoentities($elementobject->ref);
2550 $linkedobjects[$objecttype][
'date_title'] = $outputlangs->transnoentities(
"DatePropal");
2551 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date($elementobject->date,
'day',
'', $outputlangs);
2553 } elseif ($objecttype ==
'commande' || $objecttype ==
'supplier_order') {
2554 $outputlangs->load(
'orders');
2557 if (empty(
$object->context[
'DolPublicNoteAppendedGetLinkedObjects'])) {
2559 foreach ($objects as $elementobject) {
2560 $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.
')').
' ');
2564 } elseif (count($objects) == 1) {
2565 $elementobject = array_shift($objects);
2566 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"RefOrder");
2567 $linkedobjects[$objecttype][
'ref_value'] = $outputlangs->transnoentities($elementobject->ref).(!empty($elementobject->ref_client) ?
' ('.$elementobject->ref_client.
')' :
'').(!empty($elementobject->ref_supplier) ?
' ('.$elementobject->ref_supplier.
')' :
'');
2568 $linkedobjects[$objecttype][
'date_title'] = $outputlangs->transnoentities(
"OrderDate");
2569 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date($elementobject->date,
'day',
'', $outputlangs);
2571 } elseif ($objecttype ==
'contrat') {
2572 $outputlangs->load(
'contracts');
2573 foreach ($objects as $elementobject) {
2574 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"RefContract");
2575 $linkedobjects[$objecttype][
'ref_value'] = $outputlangs->transnoentities($elementobject->ref);
2576 $linkedobjects[$objecttype][
'date_title'] = $outputlangs->transnoentities(
"DateContract");
2577 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date($elementobject->date_contrat,
'day',
'', $outputlangs);
2579 } elseif ($objecttype ==
'fichinter') {
2580 $outputlangs->load(
'interventions');
2581 foreach ($objects as $elementobject) {
2582 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"InterRef");
2583 $linkedobjects[$objecttype][
'ref_value'] = $outputlangs->transnoentities($elementobject->ref);
2584 $linkedobjects[$objecttype][
'date_title'] = $outputlangs->transnoentities(
"InterDate");
2585 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date($elementobject->datec,
'day',
'', $outputlangs);
2587 } elseif ($objecttype ==
'shipping') {
2588 $outputlangs->loadLangs(array(
"orders",
"sendings"));
2590 if (count($objects) > 1) {
2594 if (empty(
$object->linkedObjects[
'commande']) &&
$object->element !=
'commande') {
2595 $refListsTxt.= $outputlangs->transnoentities(
"RefOrder").
' / '.$outputlangs->transnoentities(
"RefSending").
' :';
2597 $refListsTxt.=$outputlangs->transnoentities(
"RefSending").
' :';
2600 foreach ($objects as $elementobject) {
2601 if (empty(
$object->linkedObjects[
'commande']) &&
$object->element !=
'commande') {
2602 $elementobject->fetchObjectLinked(
null,
'',
null,
'',
'OR', 1,
'sourcetype', 0);
2603 if (!empty($elementobject->linkedObjectsIds[
'commande'])) {
2604 include_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
2606 $ret = $order->fetch(reset($elementobject->linkedObjectsIds[
'commande']));
2612 $refListsTxt.= (!empty($refListsTxt)?
' ':
'');
2613 if (! is_object($order)) {
2614 $refListsTxt.= $outputlangs->transnoentities($elementobject->ref);
2616 $refListsTxt.= $outputlangs->convToOutputCharset($order->ref).($order->ref_client ?
' ('.$order->ref_client.
')' :
'');
2617 $refListsTxt.=
' / '.$outputlangs->transnoentities($elementobject->ref);
2621 if (empty(
$object->context[
'DolPublicNoteAppendedGetLinkedObjects'])) {
2624 } elseif (count($objects) == 1) {
2625 $elementobject = array_shift($objects);
2628 if (empty(
$object->linkedObjects[
'commande']) &&
$object->element !=
'commande') {
2629 $elementobject->fetchObjectLinked(
null,
'',
null,
'',
'OR', 1,
'sourcetype', 0);
2630 if (!empty($elementobject->linkedObjectsIds[
'commande'])) {
2631 include_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
2633 $ret = $order->fetch(reset($elementobject->linkedObjectsIds[
'commande']));
2640 if (! is_object($order)) {
2641 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"RefSending");
2642 if (empty($linkedobjects[$objecttype][
'ref_value'])) {
2643 $linkedobjects[$objecttype][
'ref_value'] =
'';
2645 $linkedobjects[$objecttype][
'ref_value'] .=
' / ';
2647 $linkedobjects[$objecttype][
'ref_value'] .= $outputlangs->transnoentities($elementobject->ref);
2648 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date(empty($elementobject->date_shipping) ? $elementobject->date_delivery : $elementobject->date_shipping,
'day',
'', $outputlangs);
2650 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"RefOrder").
' / '.$outputlangs->transnoentities(
"RefSending");
2651 if (empty($linkedobjects[$objecttype][
'ref_value'])) {
2652 $linkedobjects[$objecttype][
'ref_value'] = $outputlangs->convToOutputCharset($order->ref).($order->ref_client ?
' ('.$order->ref_client.
')' :
'');
2654 $linkedobjects[$objecttype][
'ref_value'] .=
' / '.$outputlangs->transnoentities($elementobject->ref);
2655 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date(empty($elementobject->date_shipping) ? $elementobject->date_delivery : $elementobject->date_shipping,
'day',
'', $outputlangs);
2661 $object->context[
'DolPublicNoteAppendedGetLinkedObjects'] = 1;
2664 if (is_object($hookmanager)) {
2665 $parameters = array(
'linkedobjects' => $linkedobjects,
'outputlangs' => $outputlangs);
2667 $reshook = $hookmanager->executeHooks(
'pdf_getLinkedObjects', $parameters,
$object, $action);
2668 if (empty($reshook)) {
2669 $linkedobjects = array_replace($linkedobjects, $hookmanager->resArray);
2670 } elseif ($reshook>0) {
2672 $linkedobjects = $hookmanager->resArray;
2676 return $linkedobjects;
2691 $maxheight =
getDolGlobalInt(
'MAIN_DOCUMENTS_WITH_PICTURE_HEIGHT', 32);
2692 include_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
2696 if ($tmp[
'height']) {
2697 $width = (int) round($maxheight * $tmp[
'width'] / $tmp[
'height']);
2698 if ($width > $maxwidth) {
2700 $height = (int) round($maxwidth * $tmp[
'height'] / $tmp[
'width']);
2702 $height = $maxheight;
2705 return array(
'width' => $width,
'height' => $height);
2719 global $conf, $hookmanager;
2725 if (
$object->lines[$i]->special_code == 3) {
2726 return $outputlangs->transnoentities(
"Option");
2728 if (is_object($hookmanager)) {
2729 $special_code =
$object->lines[$i]->special_code;
2730 if (!empty(
$object->lines[$i]->fk_parent_line)) {
2731 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2734 $parameters = array(
2736 'outputlangs' => $outputlangs,
2737 'hidedetails' => $hidedetails,
2738 'special_code' => $special_code
2743 if ($hookmanager->executeHooks(
'getlinetotalremise', $parameters,
$object, $action) > 0) {
2744 if (isset($hookmanager->resArray[
'linetotalremise'])) {
2745 return $hookmanager->resArray[
'linetotalremise'];
2747 return (
float) $hookmanager->resPrint;
2752 if (empty($hidedetails) || $hidedetails > 1) {
2753 return $sign * ((
$object->lines[$i]->subprice * (float)
$object->lines[$i]->qty) -
$object->lines[$i]->total_ht);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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='0', $dbtouse=null, $withregion=0, $outputlangs=null, $entconv=1)
Return state translated from an id.
getFormeJuridiqueLabel($code)
Return the name translated of juridical status.
dol_print_reduction($reduction, $langs)
Returns formatted 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 formatted for view output Used into pdf and HTML pages.
dol_format_address($object, $withcountry=0, $sep="\n", $outputlangs=null, $mode=0, $extralangcode='')
Return a formatted address (part address/zip/town/state) according to country rules.
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_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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0, $align='J')
Output line description into PDF.
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_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.
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 information.
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 information 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 formatted for output on PDF documents.
pdf_getlineunit($object, $i, $outputlangs, $hidedetails=0)
Return line unit.
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.