41include_once DOL_DOCUMENT_ROOT.
'/core/lib/signature.lib.php';
56 $head[$h][0] = DOL_URL_ROOT.
'/admin/pdf.php';
57 $head[$h][1] = $langs->trans(
"GlobalParameters");
58 $head[$h][2] =
'general';
68 $head[$h][0] = DOL_URL_ROOT.
'/admin/pdf_other.php';
69 $head[$h][1] = $langs->trans(
"SpecificParameters");
70 $head[$h][2] =
'other';
89 global $conf, $db, $langs;
91 dol_syslog(
"pdf_getFormat Get paper format with mode=".$mode.
" MAIN_PDF_FORMAT=".
getDolGlobalString(
'MAIN_PDF_FORMAT').
" outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang :
'null').
" and langs->defaultlang=".(is_object($langs) ? $langs->defaultlang :
'null'));
99 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
105 $sql =
"SELECT code, label, width, height, unit FROM ".MAIN_DB_PREFIX.
"c_paper_format";
106 $sql .=
" WHERE code = '".$db->escape($pdfformat).
"'";
107 $resql = $db->query($sql);
109 $obj = $db->fetch_object($resql);
111 $width = (int) $obj->width;
112 $height = (int) $obj->height;
118 return array(
'width' => $width,
'height' => $height,
'unit' => $unit);
134 if (!defined(
'K_TCPDF_EXTERNAL_CONFIG')) {
135 define(
'K_TCPDF_EXTERNAL_CONFIG', 1);
136 define(
'K_PATH_CACHE', DOL_DATA_ROOT.
'/admin/temp/');
137 define(
'K_PATH_URL_CACHE', DOL_DATA_ROOT.
'/admin/temp/');
139 define(
'K_BLANK_IMAGE',
'_blank.png');
140 define(
'PDF_PAGE_FORMAT',
'A4');
141 define(
'PDF_PAGE_ORIENTATION',
'P');
142 define(
'PDF_CREATOR',
'TCPDF');
143 define(
'PDF_AUTHOR',
'TCPDF');
144 define(
'PDF_HEADER_TITLE',
'TCPDF Example');
145 define(
'PDF_HEADER_STRING',
"by Dolibarr ERP CRM");
146 define(
'PDF_UNIT',
'mm');
147 define(
'PDF_MARGIN_HEADER', 5);
148 define(
'PDF_MARGIN_FOOTER', 10);
149 define(
'PDF_MARGIN_TOP', 27);
150 define(
'PDF_MARGIN_BOTTOM', 25);
151 define(
'PDF_MARGIN_LEFT', 15);
152 define(
'PDF_MARGIN_RIGHT', 15);
153 define(
'PDF_FONT_NAME_MAIN',
'helvetica');
154 define(
'PDF_FONT_SIZE_MAIN', 10);
155 define(
'PDF_FONT_NAME_DATA',
'helvetica');
156 define(
'PDF_FONT_SIZE_DATA', 8);
157 define(
'PDF_FONT_MONOSPACED',
'courier');
158 define(
'PDF_IMAGE_SCALE_RATIO', 1.25);
159 define(
'HEAD_MAGNIFICATION', 1.1);
160 define(
'K_CELL_HEIGHT_RATIO', 1.25);
161 define(
'K_TITLE_MAGNIFICATION', 1.3);
162 define(
'K_SMALL_RATIO', 2 / 3);
163 define(
'K_THAI_TOPCHARS',
true);
164 define(
'K_TCPDF_CALLS_IN_HTML',
true);
166 define(
'K_TCPDF_THROW_EXCEPTION_ERROR',
true);
168 define(
'K_TCPDF_THROW_EXCEPTION_ERROR',
false);
173 require_once TCPDF_PATH.
'tcpdf.php';
177 require_once TCPDI_PATH.
'tcpdi.php';
188 $pdf =
new TCPDI($pagetype, $metric, $format,
true,
'UTF-8',
false, $pdfa);
190 $pdf =
new TCPDF($pagetype, $metric, $format,
true,
'UTF-8',
false, $pdfa);
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 $tmp = $parser->getParsedData();
247 $data = $tmp[1] ??
null;
251 if (isset($xref[
'trailer'][
'encrypt'])) {
275 if (class_exists(
'TCPDF')) {
276 if ($outputlangs->trans(
'FONTFORPDF') !=
'FONTFORPDF') {
277 $font = $outputlangs->trans(
'FONTFORPDF');
292 if (class_exists(
'TCPDF')) {
293 if ($outputlangs->trans(
'FONTSIZEFORPDF') !=
'FONTSIZEFORPDF') {
294 $size = (int) $outputlangs->trans(
'FONTSIZEFORPDF');
316 include_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
318 if ($tmp[
'height']) {
319 $width = round($height * $tmp[
'width'] / $tmp[
'height']);
320 if ($width > $maxwidth) {
321 $height = $height * $maxwidth / $width;
340 $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();
393 if ($thirdparty instanceof
Societe) {
394 $socname = $thirdparty->name;
395 if (($includealias ||
getDolGlobalInt(
'PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) && !empty($thirdparty->name_alias)) {
397 $socname = $thirdparty->name_alias.
" - ".$thirdparty->name;
399 $socname = $thirdparty->name.
" - ".$thirdparty->name_alias;
402 } elseif ($thirdparty instanceof
Contact) {
403 if ($thirdparty->socid > 0) {
404 $thirdparty->fetch_thirdparty();
405 $socname = $thirdparty->thirdparty->name;
406 if (($includealias ||
getDolGlobalInt(
'PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) && !empty($thirdparty->thirdparty->name_alias)) {
408 $socname = $thirdparty->thirdparty->name_alias.
" - ".$thirdparty->thirdparty->name;
410 $socname = $thirdparty->thirdparty->name.
" - ".$thirdparty->thirdparty->name_alias;
415 throw new InvalidArgumentException(
'Parameter 1 $thirdparty is not a Societe nor Contact');
418 return $outputlangs->convToOutputCharset((
string) $socname);
433function pdf_build_address($outputlangs, $sourcecompany, $targetcompany =
'', $targetcontact =
'', $usecontact = 0, $mode =
'source',
$object =
null)
437 if ($mode ==
'source' && !is_object($sourcecompany)) {
440 if ($mode ==
'target' && !is_object($targetcompany)) {
444 if (!empty($sourcecompany->state_id) && empty($sourcecompany->state)) {
445 $sourcecompany->state =
getState($sourcecompany->state_id);
447 if (!empty($targetcompany->state_id) && empty($targetcompany->state)) {
448 $targetcompany->state =
getState($targetcompany->state_id);
453 if (is_object($hookmanager)) {
454 $parameters = array(
'sourcecompany' => &$sourcecompany,
'targetcompany' => &$targetcompany,
'targetcontact' => &$targetcontact,
'outputlangs' => $outputlangs,
'mode' => $mode,
'usecontact' => $usecontact);
457 $reshook = $hookmanager->executeHooks(
'pdf_build_address', $parameters,
$object, $action);
458 $stringaddress .= $hookmanager->resPrint;
460 if (empty($reshook)) {
461 if ($mode ==
'source') {
463 if (isset($targetcompany->country_code) && !empty($sourcecompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) {
469 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset($fulladdress).
"\n";
474 if ($sourcecompany->phone) {
475 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"PhoneShort").
": ".$outputlangs->convToOutputCharset($sourcecompany->phone);
478 if ($sourcecompany->phone_mobile &&
getDolGlobalString(
'MAIN_PDF_SHOW_SOURCE_PHONE_MOBILE')) {
479 $stringaddress .= ($stringaddress ? ($sourcecompany->phone ?
" - " :
"\n") :
'').$outputlangs->transnoentities(
"PhoneShort").
": ".$outputlangs->convToOutputCharset($sourcecompany->phone_mobile);
482 if ($sourcecompany->fax) {
483 $stringaddress .= ($stringaddress ? ($sourcecompany->phone ?
" - " :
"\n") :
'').$outputlangs->transnoentities(
"Fax").
": ".$outputlangs->convToOutputCharset($sourcecompany->fax);
486 if ($sourcecompany->email) {
487 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Email").
": ".$outputlangs->convToOutputCharset($sourcecompany->email);
490 if ($sourcecompany->url) {
491 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Web").
": ".$outputlangs->convToOutputCharset($sourcecompany->url);
496 if ($sourcecompany->tva_intra) {
497 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"VATIntraShort").
': '.$outputlangs->convToOutputCharset($sourcecompany->tva_intra);
502 if (
getDolGlobalString(
'MAIN_PROFID1_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof1)) {
503 $tmp = $outputlangs->transcountrynoentities(
"ProfId1", $sourcecompany->country_code);
504 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
507 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof1);
509 if (
getDolGlobalString(
'MAIN_PROFID2_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof2)) {
510 $tmp = $outputlangs->transcountrynoentities(
"ProfId2", $sourcecompany->country_code);
511 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
514 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof2);
516 if (
getDolGlobalString(
'MAIN_PROFID3_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof3)) {
517 $tmp = $outputlangs->transcountrynoentities(
"ProfId3", $sourcecompany->country_code);
518 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
521 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof3);
523 if (
getDolGlobalString(
'MAIN_PROFID4_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof4)) {
524 $tmp = $outputlangs->transcountrynoentities(
"ProfId4", $sourcecompany->country_code);
525 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
528 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof4);
530 if (
getDolGlobalString(
'MAIN_PROFID5_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof5)) {
531 $tmp = $outputlangs->transcountrynoentities(
"ProfId5", $sourcecompany->country_code);
532 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
535 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof5);
537 if (
getDolGlobalString(
'MAIN_PROFID6_IN_SOURCE_ADDRESS') && !empty($sourcecompany->idprof6)) {
538 $tmp = $outputlangs->transcountrynoentities(
"ProfId6", $sourcecompany->country_code);
539 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
542 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($sourcecompany->idprof6);
545 $stringaddress .= ($stringaddress ?
"\n" :
'') .
getDolGlobalString(
'PDF_ADD_MORE_AFTER_SOURCE_ADDRESS');
549 if ($mode ==
'target' || preg_match(
'/targetwithdetails/', $mode)) {
550 if ($usecontact && (is_object($targetcontact))) {
551 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs, 1));
553 if (!empty($targetcontact->address)) {
554 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset(
dol_format_address($targetcontact)).
"\n";
555 } elseif (is_object($targetcompany)) {
556 $companytouseforaddress = $targetcompany;
559 if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id) {
560 $targetcontact->fetch_thirdparty();
561 $companytouseforaddress = $targetcontact->thirdparty;
564 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset(
dol_format_address($companytouseforaddress)).
"\n";
567 if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) {
568 $stringaddress .= (($stringaddress && !
getDolGlobalString(
'MAIN_PDF_REMOVE_BREAK_BEFORE_COUNTRY')) ?
"\n" :
'').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv(
"Country".$targetcontact->country_code));
569 } elseif (empty($targetcontact->country_code) && !empty($targetcompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) {
570 $stringaddress .= (($stringaddress && !
getDolGlobalString(
'MAIN_PDF_REMOVE_BREAK_BEFORE_COUNTRY')) ?
"\n" :
'').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv(
"Country".$targetcompany->country_code));
573 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || preg_match(
'/targetwithdetails/', $mode)) {
575 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_phone/', $mode)) {
576 if (!empty($targetcontact->phone_pro) || !empty($targetcontact->phone_mobile)) {
577 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Phone").
": ";
579 if (!empty($targetcontact->phone_pro)) {
580 $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro);
582 if (!empty($targetcontact->phone_pro) && !empty($targetcontact->phone_mobile)) {
583 $stringaddress .=
" / ";
585 if (!empty($targetcontact->phone_mobile)) {
586 $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile);
590 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_fax/', $mode)) {
591 if ($targetcontact->fax) {
592 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Fax").
": ".$outputlangs->convToOutputCharset($targetcontact->fax);
596 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_email/', $mode)) {
597 if ($targetcontact->email) {
598 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Email").
": ".$outputlangs->convToOutputCharset($targetcontact->email);
602 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_url/', $mode)) {
603 if ($targetcontact->url) {
604 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Web").
": ".$outputlangs->convToOutputCharset((
string) $targetcontact->url);
609 if (is_object($targetcompany)) {
610 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset(
dol_format_address($targetcompany));
612 if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) {
613 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv(
"Country".$targetcompany->country_code));
615 $stringaddress .= ($stringaddress ?
"\n" :
'');
618 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || preg_match(
'/targetwithdetails/', $mode)) {
620 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_phone/', $mode)) {
621 if (!empty($targetcompany->phone) || !empty($targetcompany->phone_mobile)) {
622 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Phone").
": ";
624 if (!empty($targetcompany->phone)) {
625 $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone);
627 if (!empty($targetcompany->phone) && !empty($targetcompany->phone_mobile)) {
628 $stringaddress .=
" / ";
630 if (!empty($targetcompany->phone_mobile)) {
631 $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone_mobile);
635 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_fax/', $mode)) {
636 if ($targetcompany->fax) {
637 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Fax").
": ".$outputlangs->convToOutputCharset($targetcompany->fax);
641 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_email/', $mode)) {
642 if ($targetcompany->email) {
643 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Email").
": ".$outputlangs->convToOutputCharset($targetcompany->email);
647 if (
getDolGlobalString(
'MAIN_PDF_ADDALSOTARGETDETAILS') || $mode ==
'targetwithdetails' || preg_match(
'/targetwithdetails_url/', $mode)) {
648 if ($targetcompany->url) {
649 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"Web").
": ".$outputlangs->convToOutputCharset($targetcompany->url);
658 if ($usecontact && is_object($targetcontact) &&
getDolGlobalInt(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')) {
659 $targetcontact->fetch_thirdparty();
660 if (!empty($targetcontact->thirdparty->id) && $targetcontact->thirdparty->tva_intra) {
661 $stringaddress .= ($stringaddress ?
"\n" :
'') . $outputlangs->transnoentities(
"VATIntraShort") .
': ' . $outputlangs->convToOutputCharset($targetcontact->thirdparty->tva_intra);
663 } elseif (!empty($targetcompany->tva_intra)) {
664 $stringaddress .= ($stringaddress ?
"\n" :
'').$outputlangs->transnoentities(
"VATIntraShort").
': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra);
669 if (
getDolGlobalString(
'MAIN_LEGALFORM_IN_ADDRESS') && !empty($targetcompany->forme_juridique_code)) {
671 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp;
675 if (
getDolGlobalString(
'MAIN_PROFID1_IN_ADDRESS') && !empty($targetcompany->idprof1)) {
676 $tmp = $outputlangs->transcountrynoentities(
"ProfId1", $targetcompany->country_code);
677 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
680 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof1);
682 if (
getDolGlobalString(
'MAIN_PROFID2_IN_ADDRESS') && !empty($targetcompany->idprof2)) {
683 $tmp = $outputlangs->transcountrynoentities(
"ProfId2", $targetcompany->country_code);
684 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
687 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof2);
689 if (
getDolGlobalString(
'MAIN_PROFID3_IN_ADDRESS') && !empty($targetcompany->idprof3)) {
690 $tmp = $outputlangs->transcountrynoentities(
"ProfId3", $targetcompany->country_code);
691 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
694 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof3);
696 if (
getDolGlobalString(
'MAIN_PROFID4_IN_ADDRESS') && !empty($targetcompany->idprof4)) {
697 $tmp = $outputlangs->transcountrynoentities(
"ProfId4", $targetcompany->country_code);
698 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
701 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof4);
703 if (
getDolGlobalString(
'MAIN_PROFID5_IN_ADDRESS') && !empty($targetcompany->idprof5)) {
704 $tmp = $outputlangs->transcountrynoentities(
"ProfId5", $targetcompany->country_code);
705 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
708 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof5);
710 if (
getDolGlobalString(
'MAIN_PROFID6_IN_ADDRESS') && !empty($targetcompany->idprof6)) {
711 $tmp = $outputlangs->transcountrynoentities(
"ProfId6", $targetcompany->country_code);
712 if (preg_match(
'/\((.+)\)/', $tmp, $reg)) {
715 $stringaddress .= ($stringaddress ?
"\n" :
'').$tmp.
': '.$outputlangs->convToOutputCharset($targetcompany->idprof6);
720 if ($mode ==
'source' && !empty($sourcecompany->note_public)) {
721 $stringaddress .= ($stringaddress ?
"\n" :
'').
dol_string_nohtmltag($sourcecompany->note_public);
723 if (($mode ==
'target' || preg_match(
'/targetwithdetails/', $mode)) && !empty($targetcompany->note_public)) {
724 $stringaddress .= ($stringaddress ?
"\n" :
'').
dol_string_nohtmltag($targetcompany->note_public);
730 return $stringaddress;
748 $filepath = $conf->mycompany->dir_output.
'/logos/' .
getDolGlobalString(
'MAIN_USE_BACKGROUND_ON_PDF');
749 if (file_exists($filepath)) {
750 $pdf->setAutoPageBreak(
false, 0);
759 $pdf->setAutoPageBreak(
true, 0);
785 include_once DOL_DOCUMENT_ROOT.
'/blockedlog/lib/blockedlog.lib.php';
788 if (
$object->status > $object::STATUS_DRAFT) {
789 $unalterablelogid =
'UNDEFINED';
790 $sql =
"SELECT signature FROM ".MAIN_DB_PREFIX.
"blockedlog";
791 $sql .=
" WHERE action = 'BILL_VALIDATE' AND element = 'facture' AND ref_object = '".$db->escape(
$object->ref).
"'";
792 $sql .= $db->order(
'rowid',
'DESC');
793 $sql .= $db->plimit(1);
795 $resql = $db->query($sql);
797 $obj = $db->fetch_object($resql);
799 $unalterablelogid = $obj->signature;
803 if ($unalterablelogid !=
'UNDEFINED') {
805 $pdf->SetXY($posx, $posy);
806 $pdf->SetTextColor(0, 0, 60);
807 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"SignatureID").
" : ".
dol_trunc(strtoupper($unalterablelogid), 10),
'',
'R');
826 $substitutionarray = getCommonSubstitutionArray($outputlangs, $onlykey, $exclude,
$object, $include);
827 $substitutionarray[
'__FROM_NAME__'] =
'__FROM_NAME__';
828 $substitutionarray[
'__FROM_EMAIL__'] =
'__FROM_EMAIL__';
829 return $substitutionarray;
849 } elseif ($unit ==
'mm') {
851 } elseif ($unit ==
'cm') {
853 } elseif ($unit ==
'in') {
857 dol_print_error(
null,
'Unexpected unit "'.$unit.
'" for pdf_watermark');
864 $text = $outputlangs->convToOutputCharset($text);
866 $savx = $pdf->getX();
867 $savy = $pdf->getY();
869 $watermark_angle = atan($h / $w) / 2;
870 $watermark_x_pos = 0;
871 $watermark_y_pos = $h / 3;
872 $watermark_x = $w / 2;
873 $watermark_y = $h / 3;
874 $pdf->SetFont(
'',
'B', 40);
875 $pdf->SetTextColor(255, 0, 0);
878 $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));
881 $pdf->SetXY($watermark_x_pos, $watermark_y_pos);
885 $pdf->Cell($w - 20, 25, $outputlangs->convToOutputCharset($text),
"", 2,
"C",
false);
890 $pdf->SetXY($savx, $savy);
908function pdfCertifMention(&$pdf, $outputlangs, $seller, $default_font_size, &$posy, $pdftemplate)
910 include_once DOL_DOCUMENT_ROOT.
'/blockedlog/lib/blockedlog.lib.php';
928function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0, $default_font_size = 10)
930 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formbank.class.php';
934 $pdf->SetXY($curx, $cury);
936 if (empty($onlynumber)) {
937 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
938 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
'PaymentByTransferOnThisBankAccount').
':', 0,
'L',
false);
942 $outputlangs->load(
"banks");
945 $bickey =
"BICNumber";
946 if ($account->getCountryCode() ==
'IN') {
951 $usedetailedbban = $account->useDetailedBBAN();
954 if ($usedetailedbban) {
957 if (empty($onlynumber)) {
958 $pdf->SetFont(
'',
'', $default_font_size - $diffsizecontent);
959 $pdf->SetXY($curx, $cury);
960 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Bank").
': '.$outputlangs->convToOutputCharset($account->bank), 0,
'L',
false);
970 if (empty($onlynumber)) {
971 $pdf->line($curx + 1, $cury + 1, $curx + 1, $cury + 6);
974 $bank_number_length = 0;
975 foreach ($account->getFieldsToShow() as $val) {
976 $pdf->SetXY($curx, $cury + 4);
977 $pdf->SetFont(
'',
'', $default_font_size - 3);
979 if ($val ==
'BankCode') {
982 $content = $account->code_banque;
983 } elseif ($val ==
'DeskCode') {
986 $content = $account->code_guichet;
987 } elseif ($val ==
'BankAccountNumber') {
990 $content = $account->number;
991 } elseif ($val ==
'BankAccountNumberKey') {
994 $content = $account->cle_rib;
995 } elseif ($val ==
'IBAN' || $val ==
'BIC') {
1000 dol_print_error($account->db,
'Unexpected value for getFieldsToShow: '.$val);
1004 if ($content ==
'') {
1008 $pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($content), 0,
'C',
false);
1009 $pdf->SetXY($curx, $cury + 1);
1010 $curx += $tmplength;
1011 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizecontent);
1012 $pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities($val), 0,
'C',
false);
1013 if (empty($onlynumber)) {
1014 $pdf->line($curx, $cury + 1, $curx, $cury + 7);
1018 $bank_number_length = 8;
1022 $cury += $bank_number_length;
1024 } elseif (!empty($account->number)) {
1025 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizecontent);
1026 $pdf->SetXY($curx, $cury);
1027 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Bank").
': '.$outputlangs->convToOutputCharset($account->bank), 0,
'L',
false);
1030 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizecontent);
1031 $pdf->SetXY($curx, $cury);
1032 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"BankAccountNumber").
': '.$outputlangs->convToOutputCharset($account->number), 0,
'L',
false);
1035 if ($diffsizecontent <= 2) {
1040 $pdf->SetFont(
'',
'', $default_font_size - $diffsizecontent);
1042 if (empty($onlynumber) && !empty($account->address)) {
1043 $pdf->SetXY($curx, $cury);
1044 $val = $outputlangs->transnoentities(
"Residence").
': '.$outputlangs->convToOutputCharset($account->address);
1045 $pdf->MultiCell(100, 3, $val, 0,
'L',
false);
1048 $tmpy = $pdf->getStringHeight(100, $val);
1052 if (!empty($account->owner_name)) {
1053 $pdf->SetXY($curx, $cury);
1054 $val = $outputlangs->transnoentities(
"BankAccountOwner").
': '.$outputlangs->convToOutputCharset($account->owner_name);
1055 $pdf->MultiCell(100, 3, $val, 0,
'L',
false);
1056 $tmpy = $pdf->getStringHeight(100, $val);
1058 } elseif (!$usedetailedbban) {
1065 if (!empty($account->iban)) {
1067 $ibanDisplay_temp = str_replace(
' ',
'', $outputlangs->convToOutputCharset($account->iban));
1070 $nbIbanDisplay_temp =
dol_strlen($ibanDisplay_temp);
1071 for ($i = 0; $i < $nbIbanDisplay_temp; $i++) {
1072 $ibanDisplay .= $ibanDisplay_temp[$i];
1073 if ($i % 4 == 3 && $i > 0) {
1074 $ibanDisplay .=
" ";
1078 $pdf->SetFont(
'',
'B', $default_font_size - 3);
1079 $pdf->SetXY($curx, $cury);
1080 $pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey).
': '.$ibanDisplay, 0,
'L',
false);
1084 if (!empty($account->bic)) {
1085 $pdf->SetFont(
'',
'B', $default_font_size - 3);
1086 $pdf->SetXY($curx, $cury);
1087 $pdf->MultiCell(100, 3, $outputlangs->transnoentities($bickey).
': '.$outputlangs->convToOutputCharset($account->bic), 0,
'L',
false);
1090 return $pdf->getY();
1110function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur,
$object, $showdetails = 0, $hidefreetext = 0, $page_largeur = 0, $watermark =
'')
1112 global $conf, $hookmanager;
1114 $outputlangs->load(
"dict");
1117 $marginwithfooter = 0;
1119 $dims = $pdf->getPageDimensions();
1125 if (is_object($fromcompany)) {
1126 $substitutionarray[
'__FROM_NAME__'] = $fromcompany->name;
1127 $substitutionarray[
'__FROM_EMAIL__'] = $fromcompany->email;
1136 $newfreetext = preg_replace(
'/(<img.*src=")[^\"]*viewimage\.php[^\"]*modulepart=medias[^\"]*file=([^\"]*)("[^\/]*\/>)/',
'\1file:/'.DOL_DATA_ROOT.
'/medias/\2\3', $newfreetext);
1138 $line .= $outputlangs->convToOutputCharset($newfreetext);
1147 if (is_object($fromcompany) && in_array($showdetails, array(1, 3))) {
1149 if ($fromcompany->name) {
1150 $line1 .= ($line1 ?
" - " :
"").$outputlangs->transnoentities(
"RegisteredOffice").
": ".$fromcompany->name;
1153 if ($fromcompany->address) {
1154 $line1 .= ($line1 ?
" - " :
"").str_replace(
"\n",
", ", $fromcompany->address);
1157 if ($fromcompany->zip) {
1158 $line1 .= ($line1 ?
" - " :
"").$fromcompany->zip;
1161 if ($fromcompany->town) {
1162 $line1 .= ($line1 ?
" " :
"").$fromcompany->town;
1165 if ($fromcompany->country) {
1166 $line1 .= ($line1 ?
", " :
"").$fromcompany->country;
1169 if ($fromcompany->phone) {
1170 $line2 .= ($line2 ?
" - " :
"").$outputlangs->transnoentities(
"Phone").
": ".$fromcompany->phone;
1173 if ($fromcompany->fax) {
1174 $line2 .= ($line2 ?
" - " :
"").$outputlangs->transnoentities(
"Fax").
": ".$fromcompany->fax;
1178 if ($fromcompany->url) {
1179 $line2 .= ($line2 ?
" - " :
"").$fromcompany->url;
1182 if ($fromcompany->email) {
1183 $line2 .= ($line2 ?
" - " :
"").$fromcompany->email;
1186 if ($showdetails == 2 || $showdetails == 3 || (!empty($fromcompany->country_code) && $fromcompany->country_code ==
'DE')) {
1188 if ($fromcompany->managers) {
1189 $line2 .= ($line2 ?
" - " :
"").$fromcompany->managers;
1195 if (!empty($fromcompany->forme_juridique_code)) {
1196 $line3 .= ($line3 ?
" - " :
"").$outputlangs->convToOutputCharset(
getFormeJuridiqueLabel((
string) $fromcompany->forme_juridique_code));
1199 if (!empty($fromcompany->capital)) {
1200 $tmpamounttoshow =
price2num($fromcompany->capital);
1201 if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) {
1202 $line3 .= ($line3 ?
" - " :
"").$outputlangs->transnoentities(
"CapitalOf",
price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0,
getDolCurrency()));
1203 } elseif (!empty($fromcompany->capital)) {
1204 $line3 .= ($line3 ?
" - " :
"").$outputlangs->transnoentities(
"CapitalOf", (
string) $fromcompany->capital);
1208 if (!empty($fromcompany->idprof1) && ($fromcompany->country_code !=
'FR' || (empty($fromcompany->idprof2) || strpos($fromcompany->idprof2, $fromcompany->idprof1) !== 0))) {
1209 $field = $outputlangs->transcountrynoentities(
"ProfId1", $fromcompany->country_code);
1210 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1213 $line3 .= ($line3 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof1);
1216 if (!empty($fromcompany->idprof2)) {
1217 $field = $outputlangs->transcountrynoentities(
"ProfId2", $fromcompany->country_code);
1218 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1221 $line3 .= ($line3 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof2);
1226 if (!empty($fromcompany->idprof3)) {
1227 $field = $outputlangs->transcountrynoentities(
"ProfId3", $fromcompany->country_code);
1228 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1231 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof3);
1234 if (!empty($fromcompany->idprof4)) {
1235 $field = $outputlangs->transcountrynoentities(
"ProfId4", $fromcompany->country_code);
1236 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1239 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof4);
1242 if (!empty($fromcompany->idprof5)) {
1243 $field = $outputlangs->transcountrynoentities(
"ProfId5", $fromcompany->country_code);
1244 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1247 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof5);
1250 if (!empty($fromcompany->idprof6)) {
1251 $field = $outputlangs->transcountrynoentities(
"ProfId6", $fromcompany->country_code);
1252 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1255 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof6);
1258 if (!empty($fromcompany->idprof7)) {
1259 $field = $outputlangs->transcountrynoentities(
"ProfId7", $fromcompany->country_code);
1260 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1263 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof7);
1266 if (!empty($fromcompany->idprof8)) {
1267 $field = $outputlangs->transcountrynoentities(
"ProfId8", $fromcompany->country_code);
1268 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1271 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof8);
1274 if (!empty($fromcompany->idprof9)) {
1275 $field = $outputlangs->transcountrynoentities(
"ProfId9", $fromcompany->country_code);
1276 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1279 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof9);
1282 if (!empty($fromcompany->idprof10)) {
1283 $field = $outputlangs->transcountrynoentities(
"ProfId10", $fromcompany->country_code);
1284 if (preg_match(
'/\((.*)\)/i', $field, $reg)) {
1287 $line4 .= ($line4 ?
" - " :
"").$field.
": ".$outputlangs->convToOutputCharset($fromcompany->idprof10);
1290 if (!empty($fromcompany->tva_intra) && $fromcompany->tva_intra !=
'') {
1291 $line4 .= ($line4 ?
" - " :
"").$outputlangs->transnoentities(
"VATIntraShort").
": ".$outputlangs->convToOutputCharset($fromcompany->tva_intra);
1294 $pdf->SetFont(
'',
'', 7);
1295 $pdf->SetDrawColor(224, 224, 224);
1302 $pdf->SetTextColor($r, $g, $b);
1306 $freetextheight = 0;
1317 $freetextheight = $pdf->getStringHeight($width, $line);
1326 if (is_object($hookmanager)) {
1327 $parameters = array(
'line1' => $line1,
'line2' => $line2,
'line3' => $line3,
'line4' => $line4,
'outputlangs' => $outputlangs);
1329 $hookmanager->executeHooks(
'pdf_pagefoot', $parameters,
$object, $action);
1330 if (!empty($hookmanager->resPrint) && $hidefreetext == 0) {
1331 $mycustomfooter = $hookmanager->resPrint;
1334 $marginwithfooter = $marge_basse + $freetextheight + $mycustomfooterheight;
1335 $posy = (float) $marginwithfooter;
1343 $pdf->setAutoPageBreak(
false, 0);
1344 $pdf->Rect(0, $dims[
'hk'] - $posy + $freetextheight, $dims[
'wk'] + 1, $marginwithfooter + 1,
'F', array(), $fill_color = array($r, $g, $b));
1345 $pdf->setAutoPageBreak(
true, 0);
1349 $pdf->setAutoPageBreak(
false, 0);
1352 $pdf->SetXY($dims[
'lm'], -$posy);
1354 $pdf->MultiCell(0, 3, $line, 0, $align,
false);
1356 $pdf->writeHTMLCell($dims[
'wk'] - $dims[
'lm'] - $dims[
'rm'], $freetextheight, $dims[
'lm'], $dims[
'hk'] - $marginwithfooter,
dol_htmlentitiesbr($line, 1,
'UTF-8', 0));
1358 $posy -= $freetextheight;
1361 $pdf->setAutoPageBreak(
true, 0);
1368 $pdf->line($dims[
'lm'], $dims[
'hk'] - $posy, $dims[
'wk'] - $dims[
'rm'], $dims[
'hk'] - $posy);
1379 $pdf->setAutoPageBreak(
false, 0);
1381 $pdf->writeHTMLCell($dims[
'wk'] - $dims[
'lm'] - $dims[
'rm'], $mycustomfooterheight, $dims[
'lm'], $dims[
'hk'] - $posy,
dol_htmlentitiesbr($mycustomfooter, 1,
'UTF-8', 0));
1383 $pdf->setAutoPageBreak(
true, 0);
1386 $posy -= $mycustomfooterheight - 3;
1389 $marginwithfooter = $marge_basse + $freetextheight + (!empty($line1) ? 3 : 0) + (!empty($line2) ? 3 : 0) + (!empty($line3) ? 3 : 0) + (!empty($line4) ? 3 : 0);
1390 $posy = (float) $marginwithfooter;
1398 $pdf->setAutoPageBreak(
false, 0);
1399 $pdf->Rect(0, $dims[
'hk'] - $posy + $freetextheight, $dims[
'wk'] + 1, $marginwithfooter + 1,
'F', array(), $fill_color = array($r, $g, $b));
1400 $pdf->setAutoPageBreak(
true, 0);
1404 $pdf->setAutoPageBreak(
false, 0);
1407 $pdf->SetXY($dims[
'lm'], -$posy);
1409 $pdf->MultiCell(0, 3, $line, 0, $align,
false);
1411 $pdf->writeHTMLCell($dims[
'wk'] - $dims[
'lm'] - $dims[
'rm'], $freetextheight, $dims[
'lm'], $dims[
'hk'] - $marginwithfooter,
dol_htmlentitiesbr($line, 1,
'UTF-8', 0));
1413 $posy -= $freetextheight;
1416 $pdf->setAutoPageBreak(
true, 0);
1425 $pdf->line($dims[
'lm'], $dims[
'hk'] - $posy, $dims[
'wk'] - $dims[
'rm'], $dims[
'hk'] - $posy);
1435 if (!empty($line1)) {
1436 $pdf->SetFont(
'',
'B', 7);
1437 $pdf->SetXY($dims[
'lm'], -$posy);
1438 $pdf->MultiCell($dims[
'wk'] - $dims[
'rm'] - $dims[
'lm'], 2, $line1, 0,
'C',
false);
1440 $pdf->SetFont(
'',
'', 7);
1443 if (!empty($line2)) {
1444 $pdf->SetFont(
'',
'B', 7);
1445 $pdf->SetXY($dims[
'lm'], -$posy);
1446 $pdf->MultiCell($dims[
'wk'] - $dims[
'rm'] - $dims[
'lm'], 2, $line2, 0,
'C',
false);
1448 $pdf->SetFont(
'',
'', 7);
1451 if (!empty($line3)) {
1452 $pdf->SetXY($dims[
'lm'], -$posy);
1453 $pdf->MultiCell($dims[
'wk'] - $dims[
'rm'] - $dims[
'lm'], 2, $line3, 0,
'C',
false);
1456 if (!empty($line4)) {
1458 $pdf->SetXY($dims[
'lm'], -$posy);
1459 $pdf->MultiCell($dims[
'wk'] - $dims[
'rm'] - $dims[
'lm'], 2, $line4, 0,
'C',
false);
1466 $pdf->SetXY($dims[
'wk'] - $dims[
'rm'] - 18 -
getDolGlobalInt(
'PDF_FOOTER_PAGE_NUMBER_X', 0), -$posy -
getDolGlobalInt(
'PDF_FOOTER_PAGE_NUMBER_Y', 0));
1468 $pagination = $pdf->PageNo().
' / '.$pdf->getAliasNbPages();
1469 $fontRenderCorrection = 0;
1470 if (in_array(
pdf_getPDFFont($outputlangs), array(
'freemono',
'DejaVuSans'))) {
1471 $fontRenderCorrection = 10;
1473 $pdf->MultiCell(18 + $fontRenderCorrection, 2, $pagination, 0,
'R',
false);
1476 if (!empty($watermark)) {
1477 pdf_watermark($pdf, $outputlangs, $page_hauteur, $page_largeur,
'mm', $watermark);
1480 return $marginwithfooter;
1499 $linkedobjects = pdf_getLinkedObjects(
$object, $outputlangs);
1501 if (!empty($linkedobjects)) {
1502 foreach ($linkedobjects as $linkedobject) {
1503 $reftoshow = $linkedobject[
"ref_title"].
' : '.$linkedobject[
"ref_value"];
1504 if (!empty($linkedobject[
"date_value"])) {
1505 $reftoshow .=
' / '.$linkedobject[
"date_value"];
1509 $pdf->SetXY($posx, $posy);
1510 $pdf->SetFont(
'',
'', (
float) $default_font_size - 2);
1511 $pdf->MultiCell($w, $h, $reftoshow,
'', $align);
1515 return $pdf->getY();
1535function pdf_writelinedesc(&$pdf,
$object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref = 0, $hidedesc = 0, $issupplierline = 0, $align =
'J')
1537 global $hookmanager;
1542 if (is_object($hookmanager)) {
1543 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
1544 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
1545 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
1547 $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);
1551 $reshook = $hookmanager->executeHooks(
'pdf_writelinedesc', $parameters,
$object, $action);
1553 if (!empty($hookmanager->resPrint)) {
1554 $result .= $hookmanager->resPrint;
1557 if (empty($reshook)) {
1559 $labelproductservice = preg_replace(
'/(<img[^>]*src=")[^\"]*viewimage\.php[^\"]*modulepart=medias[^\"]*file=([^\"]*)/',
'\1file:/'.DOL_DATA_ROOT.
'/medias/\2\3', $labelproductservice, -1, $nbrep);
1566 $labelproductservice = preg_replace(
'/(<img[^>]*src=")([^"]*)(&)([^"]*")/',
'\1\2&\4', $labelproductservice, -1, $nbrep);
1569 $pdf->setListIndentWidth(5);
1570 $TMarginList = [
'ul' => [[
'h' => 0.1, ],[
'h' => 0.1, ]],
'li' => [[
'h' => 0.1, ],],];
1571 $pdf->setHtmlVSpace($TMarginList);
1575 $pdf->writeHTMLCell($w, $h, $posx, $posy, $outputlangs->convToOutputCharset($labelproductservice), 0, 1,
false,
true, $align,
true);
1576 $result .= $labelproductservice;
1594 global $db, $conf, $langs;
1596 $idprod = (!empty(
$object->lines[$i]->fk_product) ?
$object->lines[$i]->fk_product :
false);
1597 $label = (!empty(
$object->lines[$i]->label) ?
$object->lines[$i]->label : (!empty(
$object->lines[$i]->product_label) ?
$object->lines[$i]->product_label :
''));
1598 $product_barcode = (!empty(
$object->lines[$i]->product_barcode) ?
$object->lines[$i]->product_barcode :
"");
1599 $desc = (!empty(
$object->lines[$i]->desc) ?
$object->lines[$i]->desc : (!empty(
$object->lines[$i]->description) ?
$object->lines[$i]->description :
''));
1600 $ref_supplier = (!empty(
$object->lines[$i]->ref_supplier) ?
$object->lines[$i]->ref_supplier : (!empty(
$object->lines[$i]->ref_fourn) ?
$object->lines[$i]->ref_fourn :
''));
1601 $note = (!empty(
$object->lines[$i]->note) ?
$object->lines[$i]->note :
'');
1602 $dbatch = (!empty(
$object->lines[$i]->detail_batch) ?
$object->lines[$i]->detail_batch :
false);
1606 if ($issupplierline) {
1607 include_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
1610 include_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
1614 include_once DOL_DOCUMENT_ROOT .
'/product/class/productcustomerprice.class.php';
1619 $idprod = (!empty(
$object->lines[$i]->fk_product) ?
$object->lines[$i]->fk_product :
false);
1621 $prodser->fetch($idprod);
1623 if ($multilangsactive) {
1624 $prodser->getMultiLangs();
1625 $object->lines[$i]->multilangs = $prodser->multilangs;
1629 if (!empty(
$object->lines[$i]->label)) {
1630 $label =
$object->lines[$i]->label;
1632 if (!empty(
$object->lines[$i]->multilangs[$outputlangs->defaultlang][
'label']) && $multilangsactive) {
1633 $label =
$object->lines[$i]->multilangs[$outputlangs->defaultlang][
'label'];
1635 if (!empty(
$object->lines[$i]->product_label)) {
1636 $label =
$object->lines[$i]->product_label;
1643 if (!empty(
$object->lines[$i]->desc)) {
1644 $desc =
$object->lines[$i]->desc;
1646 if (!empty(
$object->lines[$i]->multilangs[$outputlangs->defaultlang][
'description']) && $multilangsactive) {
1647 $desc =
$object->lines[$i]->multilangs[$outputlangs->defaultlang][
'description'];
1649 if (!empty(
$object->lines[$i]->description)) {
1650 $desc =
$object->lines[$i]->description;
1657 $ref_supplier = (!empty(
$object->lines[$i]->ref_supplier) ?
$object->lines[$i]->ref_supplier : (!empty(
$object->lines[$i]->ref_fourn) ?
$object->lines[$i]->ref_fourn :
''));
1659 $note = (!empty(
$object->lines[$i]->note) ?
$object->lines[$i]->note :
'');
1661 $dbatch = (!empty(
$object->lines[$i]->detail_batch) ?
$object->lines[$i]->detail_batch :
false);
1665 if ($multilangsactive && ($outputlangs->defaultlang != $langs->defaultlang)) {
1666 $translatealsoifmodified =
getDolGlobalString(
'MAIN_MULTILANG_TRANSLATE_EVEN_IF_MODIFIED');
1674 $textwasnotmodified = ($label == $prodser->label);
1675 if (!empty($prodser->multilangs[$outputlangs->defaultlang][
"label"]) && ($textwasnotmodified || $translatealsoifmodified)) {
1676 $label = $prodser->multilangs[$outputlangs->defaultlang][
"label"];
1681 $textwasnotmodified =
false;
1685 $textwasnotmodified = ($desc == $prodser->description);
1687 if (!empty($prodser->multilangs[$outputlangs->defaultlang][
"description"])) {
1688 if ($textwasnotmodified) {
1689 $desc = str_replace($prodser->description, $prodser->multilangs[$outputlangs->defaultlang][
"description"], $desc);
1690 } elseif ($translatealsoifmodified) {
1691 $desc = $prodser->multilangs[$outputlangs->defaultlang][
"description"];
1696 $textwasnotmodified = ($note == $prodser->note_public);
1697 if (!empty($prodser->multilangs[$outputlangs->defaultlang][
"other"]) && ($textwasnotmodified || $translatealsoifmodified)) {
1698 $note = $prodser->multilangs[$outputlangs->defaultlang][
"other"];
1701 } elseif ((
$object->element ==
'facture' ||
$object->element ==
'facturefourn') && preg_match(
'/^\(DEPOSIT\).+/', $desc)) {
1702 $desc = str_replace(
'(DEPOSIT)', $outputlangs->trans(
'Deposit'), $desc);
1705 $libelleproduitservice =
'';
1708 $libelleproduitservice = $label;
1709 if (!empty($libelleproduitservice) &&
getDolGlobalString(
'PDF_BOLD_PRODUCT_LABEL')) {
1713 $libelleproduitservice = str_replace(
"\n",
'<br>', $libelleproduitservice);
1715 $libelleproduitservice =
'<b>'.$libelleproduitservice.
'</b>';
1722 $prodser->get_sousproduits_arbo();
1723 if (!empty($prodser->sousprods) && is_array($prodser->sousprods) && count($prodser->sousprods)) {
1724 $outputlangs->load(
'mrp');
1725 $tmparrayofsubproducts = reset($prodser->sousprods);
1728 if (isset(
$object->lines[$i]->qty) && !empty(
$object->lines[$i]->qty)) {
1729 $qtyText =
$object->lines[$i]->qty;
1730 } elseif (isset(
$object->lines[$i]->qty_shipped) && !empty(
$object->lines[$i]->qty_shipped)) {
1731 $qtyText =
$object->lines[$i]->qty;
1735 foreach ($tmparrayofsubproducts as $subprodval) {
1739 $outputlangs->trans(
'Qty').
':'.$qtyText.
' x '.$outputlangs->trans(
'AssociatedProducts').
':'.$subprodval[1].
'= '.$outputlangs->trans(
'QtyTot').
':'.$subprodval[1] * $qtyText :
1740 $outputlangs->trans(
'Qty').
' '.$outputlangs->trans(
'AssociatedProducts').
':'.$subprodval[1])
1744 foreach ($tmparrayofsubproducts as $subprodval) {
1746 dol_concatdesc($libelleproduitservice,
" * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ?
' - ' :
'').$subprodval[3]),
1748 $outputlangs->trans(
'Qty').
':'.$qtyText.
' x '.$outputlangs->trans(
'AssociatedProducts').
':'.$subprodval[1].
'= '.$outputlangs->trans(
'QtyTot').
':'.$subprodval[1] * $qtyText :
1749 $outputlangs->trans(
'Qty').
' '.$outputlangs->trans(
'AssociatedProducts').
':'.$subprodval[1])
1757 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $outputlangs->trans(
"BarCode").
" ".$product_barcode);
1761 if (!empty($desc) && ($desc != $label)) {
1762 if ($desc ==
'(CREDIT_NOTE)' &&
$object->lines[$i]->fk_remise_except) {
1764 $discount->fetch(
$object->lines[$i]->fk_remise_except);
1765 $sourceref = !empty($discount->discount_type) ? $discount->ref_invoice_supplier_source : $discount->ref_facture_source;
1766 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromCreditNote", $sourceref);
1767 } elseif ($desc ==
'(DEPOSIT)' &&
$object->lines[$i]->fk_remise_except) {
1769 $discount->fetch(
$object->lines[$i]->fk_remise_except);
1770 $sourceref = !empty($discount->discount_type) ? $discount->ref_invoice_supplier_source : $discount->ref_facture_source;
1771 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromDeposit", $sourceref);
1774 $libelleproduitservice .=
' ('.dol_print_date($discount->datec,
'day',
'', $outputlangs).
')';
1776 } elseif ($desc ==
'(EXCESS RECEIVED)' &&
$object->lines[$i]->fk_remise_except) {
1778 $discount->fetch(
$object->lines[$i]->fk_remise_except);
1779 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromExcessReceived", $discount->ref_facture_source);
1780 } elseif ($desc ==
'(EXCESS PAID)' &&
$object->lines[$i]->fk_remise_except) {
1782 $discount->fetch(
$object->lines[$i]->fk_remise_except);
1783 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromExcessPaid", $discount->ref_invoice_supplier_source);
1787 if (!empty(
$object->element)) {
1788 $tmpkey =
'MAIN_DOCUMENTS_HIDE_DESCRIPTION_FOR_'.strtoupper(
$object->element);
1793 if (empty($hidedesc)) {
1795 $libelleproduitservice =
dol_concatdesc($desc, $libelleproduitservice);
1798 $libelleproduitservice = $desc;
1800 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $desc);
1805 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $desc);
1811 $prefix_prodserv =
"";
1814 if ($prodser->isService()) {
1815 $prefix_prodserv = $outputlangs->transnoentitiesnoconv(
"Service").
" ";
1817 $prefix_prodserv = $outputlangs->transnoentitiesnoconv(
"Product").
" ";
1821 if (empty($hideref)) {
1822 if ($issupplierline) {
1824 $ref_prodserv = $prodser->ref;
1825 if ($ref_supplier) {
1826 $ref_prodserv .= ($prodser->ref ?
' (' :
'').$outputlangs->transnoentitiesnoconv(
"SupplierRef").
' '.$ref_supplier.($prodser->ref ?
')' :
'');
1828 } elseif (
getDolGlobalInt(
'PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES') == 1) {
1829 $ref_prodserv = $ref_supplier;
1830 } elseif (
getDolGlobalInt(
'PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES') == 2) {
1831 $ref_prodserv = $ref_supplier.
' ('.$outputlangs->transnoentitiesnoconv(
"InternalRef").
' '.$prodser->ref.
')';
1834 $ref_prodserv = $prodser->ref;
1838 $filter = array(
'fk_product' => (
string) $idprod,
'fk_soc' => (
string)
$object->socid);
1840 $nbCustomerPrices = $productCustomerPriceStatic->fetchAll(
'',
'', 1, 0, $filter);
1842 if ($nbCustomerPrices > 0) {
1843 $productCustomerPrice =
null;
1844 if (count($productCustomerPriceStatic->lines) > 0) {
1845 $date_now = (int) floor(
dol_now() / 86400) * 86400;
1846 foreach ($productCustomerPriceStatic->lines as $k => $custprice_line) {
1847 if ($custprice_line->date_begin <= $date_now && (empty($custprice_line->date_end) || $date_now <= $custprice_line->date_end)) {
1848 $productCustomerPrice = $custprice_line;
1854 if (isset($productCustomerPrice) && !empty($productCustomerPrice->ref_customer)) {
1855 $idcustprice =
getDolGlobalInt(
'PRODUIT_CUSTOMER_PRICES_PDF_REF_MODE');
1856 switch ($idcustprice) {
1858 $ref_prodserv = $productCustomerPrice->ref_customer;
1862 $ref_prodserv = $productCustomerPrice->ref_customer .
' (' . $outputlangs->transnoentitiesnoconv(
'InternalRef') .
' ' . $ref_prodserv .
')';
1866 $ref_prodserv = $ref_prodserv .
' (' . $outputlangs->transnoentitiesnoconv(
'RefCustomer') .
' ' . $productCustomerPrice->ref_customer .
')';
1873 if (!empty($libelleproduitservice) && !empty($ref_prodserv)) {
1874 $ref_prodserv .=
" - ";
1878 if (!empty($ref_prodserv) &&
getDolGlobalString(
'PDF_BOLD_PRODUCT_REF_AND_PERIOD')) {
1880 $libelleproduitservice = str_replace(
"\n",
'<br>', $libelleproduitservice);
1882 $ref_prodserv =
'<b>'.$ref_prodserv.
'</b>';
1885 $libelleproduitservice = $prefix_prodserv.$ref_prodserv.$libelleproduitservice;
1889 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1892 $tblcateg = $categstatic->containing($idprod, Categorie::TYPE_PRODUCT);
1893 foreach ($tblcateg as $cate) {
1895 $desccateg = $cate->description;
1897 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $desccateg);
1902 if (!empty(
$object->lines[$i]->date_start) || !empty(
$object->lines[$i]->date_end)) {
1906 if (
$object->lines[$i]->date_start &&
$object->lines[$i]->date_end) {
1907 $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)).
')';
1909 if (
$object->lines[$i]->date_start && !
$object->lines[$i]->date_end) {
1910 $period =
'('.$outputlangs->transnoentitiesnoconv(
'DateFrom',
dol_print_date(
$object->lines[$i]->date_start, $format,
false, $outputlangs)).
')';
1912 if (!
$object->lines[$i]->date_start &&
$object->lines[$i]->date_end) {
1913 $period =
'('.$outputlangs->transnoentitiesnoconv(
'DateUntil',
dol_print_date(
$object->lines[$i]->date_end, $format,
false, $outputlangs)).
')';
1918 $libelleproduitservice = str_replace(
"\n",
'<br>', $libelleproduitservice);
1920 $libelleproduitservice .=
'<br><b style="color:#333666;" ><em>'.$period.
'</em></b>';
1922 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $period);
1928 if (!empty($dbatch)) {
1933 include_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1934 include_once DOL_DOCUMENT_ROOT.
'/product/class/productbatch.class.php';
1939 foreach ($dbatch as $detail) {
1941 if ($detail->eatby) {
1942 $dte[] = $outputlangs->transnoentitiesnoconv(
'printEatby',
dol_print_date($detail->eatby, $format,
false, $outputlangs));
1944 if ($detail->sellby) {
1945 $dte[] = $outputlangs->transnoentitiesnoconv(
'printSellby',
dol_print_date($detail->sellby, $format,
false, $outputlangs));
1947 if ($detail->batch) {
1948 $dte[] = $outputlangs->transnoentitiesnoconv(
'printBatch', $detail->batch);
1951 $dte[] = $outputlangs->transnoentitiesnoconv(
'printQty', (
string) $detail->qty);
1955 if (
$object->element ==
'shipping' && $detail->fk_origin_stock > 0 &&
getDolGlobalInt(
'PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT')) {
1956 $resproductbatch = $tmpproductbatch->fetch($detail->fk_origin_stock);
1957 if ($resproductbatch > 0) {
1958 $reswarehouse = $tmpwarehouse->fetch($tmpproductbatch->warehouseid);
1959 if ($reswarehouse > 0) {
1960 $dte[] = $tmpwarehouse->ref;
1965 $libelleproduitservice .=
"__N__ ".implode(
" - ", $dte);
1975 $libelleproduitservice = preg_replace(
'/__N__/',
'<br>', $libelleproduitservice);
1977 $libelleproduitservice = preg_replace(
'/__N__/',
"\n", $libelleproduitservice);
1981 return $libelleproduitservice;
1995 global $hookmanager;
2000 if (is_object($hookmanager)) {
2001 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2002 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2003 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2005 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2007 $reshook = $hookmanager->executeHooks(
'pdf_getlinenum', $parameters,
$object, $action);
2008 $result .= $hookmanager->resPrint;
2010 if (empty($reshook)) {
2028 global $hookmanager;
2033 if (is_object($hookmanager)) {
2034 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2035 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2036 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2038 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2040 $reshook = $hookmanager->executeHooks(
'pdf_getlineref', $parameters,
$object, $action);
2041 $result .= $hookmanager->resPrint;
2043 if (empty($reshook)) {
2061 global $hookmanager;
2066 if (is_object($hookmanager)) {
2067 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2068 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2069 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2071 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2073 $reshook = $hookmanager->executeHooks(
'pdf_getlineref_supplier', $parameters,
$object, $action);
2074 $result .= $hookmanager->resPrint;
2076 if (empty($reshook)) {
2093 global $conf, $hookmanager,
$mysoc;
2098 if (is_object($hookmanager)) {
2099 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2100 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2101 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2103 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2105 $reshook = $hookmanager->executeHooks(
'pdf_getlinevatrate', $parameters,
$object, $action);
2107 if (!empty($hookmanager->resPrint)) {
2108 $result .= $hookmanager->resPrint;
2111 if (empty($reshook)) {
2112 if (empty($hidedetails) || $hidedetails > 1) {
2118 if (preg_replace(
'/[\s0%]/',
'', $tmpresult)) {
2123 $tmpresult .=
vatrate((
string) abs(
$object->lines[$i]->localtax1_tx),
false);
2128 if (preg_replace(
'/[\s0%]/',
'', $tmpresult)) {
2133 $tmpresult .=
vatrate((
string) abs(
$object->lines[$i]->localtax2_tx),
false);
2138 $result .= $tmpresult;
2155 global $hookmanager;
2165 if (is_object($hookmanager)) {
2166 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2167 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2168 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2170 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2172 $reshook = $hookmanager->executeHooks(
'pdf_getlineupexcltax', $parameters,
$object, $action);
2174 if (!empty($hookmanager->resPrint)) {
2175 $result .= $hookmanager->resPrint;
2178 if (empty($reshook)) {
2179 if (empty($hidedetails) || $hidedetails > 1) {
2181 $result .=
price($sign * $subprice, 0, $outputlangs);
2198 global $hookmanager;
2208 if (is_object($hookmanager)) {
2209 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2210 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2211 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2213 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2215 $reshook = $hookmanager->executeHooks(
'pdf_getlineupwithtax', $parameters,
$object, $action);
2217 if (!empty($hookmanager->resPrint)) {
2218 $result .= $hookmanager->resPrint;
2221 if (empty($reshook)) {
2222 if (empty($hidedetails) || $hidedetails > 1) {
2223 $result .=
price($sign * ((
$object->lines[$i]->subprice) + (
$object->lines[$i]->subprice) * (
$object->lines[$i]->tva_tx) / 100), 0, $outputlangs);
2240 global $hookmanager;
2245 if (is_object($hookmanager)) {
2246 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2247 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2248 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2250 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2252 $reshook = $hookmanager->executeHooks(
'pdf_getlineqty', $parameters,
$object, $action);
2254 if (!empty($hookmanager->resPrint)) {
2255 $result = $hookmanager->resPrint;
2258 if (empty($reshook)) {
2259 if (
$object->lines[$i]->special_code == 3) {
2262 if (empty($hidedetails) || $hidedetails > 1) {
2263 $result .=
$object->lines[$i]->qty;
2280 global $hookmanager;
2285 if (is_object($hookmanager)) {
2286 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2287 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2288 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2290 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2292 $reshook = $hookmanager->executeHooks(
'pdf_getlineqty_asked', $parameters,
$object, $action);
2294 if (!empty($hookmanager->resPrint)) {
2295 $result .= $hookmanager->resPrint;
2298 if (empty($reshook)) {
2299 if (
$object->lines[$i]->special_code == 3) {
2302 if (empty($hidedetails) || $hidedetails > 1) {
2303 $result .=
$object->lines[$i]->qty_asked;
2320 global $hookmanager;
2325 if (is_object($hookmanager)) {
2326 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2327 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2328 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2330 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2332 $reshook = $hookmanager->executeHooks(
'pdf_getlineqty_shipped', $parameters,
$object, $action);
2334 if (!empty($hookmanager->resPrint)) {
2335 $result .= $hookmanager->resPrint;
2338 if (empty($reshook)) {
2339 if (
$object->lines[$i]->special_code == 3) {
2342 if (empty($hidedetails) || $hidedetails > 1) {
2343 $result .=
$object->lines[$i]->qty_shipped;
2360 global $hookmanager;
2365 if (is_object($hookmanager)) {
2366 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2367 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2368 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2370 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2372 $reshook = $hookmanager->executeHooks(
'pdf_getlineqty_keeptoship', $parameters,
$object, $action);
2374 if (!empty($hookmanager->resPrint)) {
2375 $result .= $hookmanager->resPrint;
2378 if (empty($reshook)) {
2379 if (
$object->lines[$i]->special_code == 3) {
2382 if (empty($hidedetails) || $hidedetails > 1) {
2383 $result .= (
$object->lines[$i]->qty_asked -
$object->lines[$i]->qty_shipped);
2400 global $hookmanager;
2405 if (is_object($hookmanager)) {
2406 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2407 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2408 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2410 $parameters = array(
2412 'outputlangs' => $outputlangs,
2413 'hidedetails' => $hidedetails,
2414 'special_code' => $special_code
2417 $reshook = $hookmanager->executeHooks(
'pdf_getlineunit', $parameters,
$object, $action);
2419 if (!empty($hookmanager->resPrint)) {
2420 $result .= $hookmanager->resPrint;
2423 if (empty($reshook)) {
2424 if (empty($hidedetails) || $hidedetails > 1) {
2425 $result .=
$object->lines[$i]->getLabelOfUnit(
'short', $outputlangs, 1);
2443 global $hookmanager;
2445 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
2450 if (is_object($hookmanager)) {
2451 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2452 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2453 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2455 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2457 $reshook = $hookmanager->executeHooks(
'pdf_getlineremisepercent', $parameters,
$object, $action);
2459 if (!empty($hookmanager->resPrint)) {
2460 $result .= $hookmanager->resPrint;
2463 if (empty($reshook)) {
2464 if (
$object->lines[$i]->special_code == 3) {
2467 if (empty($hidedetails) || $hidedetails > 1) {
2486 if (empty($hookmanager)) {
2487 global $hookmanager;
2493 if (is_object($hookmanager)) {
2494 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2495 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2496 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2498 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2500 $reshook = $hookmanager->executeHooks(
'pdf_getlineprogress', $parameters,
$object, $action);
2502 if (!empty($hookmanager->resPrint)) {
2503 return $hookmanager->resPrint;
2506 if (empty($reshook)) {
2507 if (
$object->lines[$i]->special_code == 3) {
2510 if (empty($hidedetails) || $hidedetails > 1) {
2516 if ($isCumulative xor $showDelta) {
2520 $result =
$object->lines[$i]->situation_percent;
2526 if (method_exists(
$object->lines[$i],
'get_prev_progress')) {
2527 $prev_progress =
$object->lines[$i]->get_prev_progress(
$object->id);
2529 $result = $isCumulative ?
2531 $object->lines[$i]->situation_percent - $prev_progress :
2533 $prev_progress +
$object->lines[$i]->situation_percent;
2535 $result = round($result, 1).
'%';
2552 global $hookmanager;
2562 if (is_object($hookmanager)) {
2563 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2564 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2565 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2567 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code,
'sign' => $sign);
2569 $reshook = $hookmanager->executeHooks(
'pdf_getlinetotalexcltax', $parameters,
$object, $action);
2571 if (!empty($hookmanager->resPrint)) {
2572 $result .= $hookmanager->resPrint;
2575 if (empty($reshook)) {
2576 if (!empty(
$object->lines[$i]) &&
$object->lines[$i]->special_code == 3) {
2577 $result .= $outputlangs->transnoentities(
"Option");
2578 } elseif (empty($hidedetails) || $hidedetails > 1) {
2580 if (!empty(
$object->lines[$i]->situation_percent) &&
$object->lines[$i]->situation_percent > 0) {
2581 if (method_exists(
$object->lines[$i],
'getSituationRatio')) {
2582 $total_ht *=
$object->lines[$i]->getSituationRatio();
2585 $result .=
price($sign * $total_ht, 0, $outputlangs);
2602 global $hookmanager;
2612 if (is_object($hookmanager)) {
2613 $special_code = empty(
$object->lines[$i]->special_code) ?
'' :
$object->lines[$i]->special_code;
2614 if (!empty(
$object->lines[$i]->fk_parent_line) &&
$object->lines[$i]->fk_parent_line > 0) {
2615 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2617 $parameters = array(
'i' => $i,
'outputlangs' => $outputlangs,
'hidedetails' => $hidedetails,
'special_code' => $special_code);
2619 $reshook = $hookmanager->executeHooks(
'pdf_getlinetotalwithtax', $parameters,
$object, $action);
2621 if (!empty($hookmanager->resPrint)) {
2622 $result .= $hookmanager->resPrint;
2625 if (empty($reshook)) {
2626 if (
$object->lines[$i]->special_code == 3) {
2627 $result .= $outputlangs->transnoentities(
"Option");
2628 } elseif (empty($hidedetails) || $hidedetails > 1) {
2630 if (isset(
$object->lines[$i]->situation_percent) &&
$object->lines[$i]->situation_percent > 0) {
2631 $total_ttc *=
$object->lines[$i]->getSituationRatio();
2633 $result .=
price($sign * $total_ttc, 0, $outputlangs);
2658 if (!empty($objectSocId) && !empty($elementSocId) && $objectSocId != $elementSocId) {
2673function pdf_getLinkedObjects(&
$object, $outputlangs)
2675 global $db, $hookmanager;
2677 $linkedobjects = array();
2681 foreach (
$object->linkedObjects as $objecttype => $objects) {
2682 if ($objecttype ==
'facture') {
2684 } elseif ($objecttype ==
'propal' || $objecttype ==
'supplier_proposal') {
2685 '@phan-var-force array<Propal|SupplierProposal> $objects';
2687 $outputlangs->load(
'propal');
2689 foreach ($objects as $elementobject) {
2690 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"RefProposal");
2691 $linkedobjects[$objecttype][
'ref_value'] = $outputlangs->transnoentities($elementobject->ref);
2692 $linkedobjects[$objecttype][
'date_title'] = $outputlangs->transnoentities(
"DatePropal");
2693 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date($elementobject->date,
'day',
'', $outputlangs);
2695 } elseif ($objecttype ==
'commande' || $objecttype ==
'supplier_order' || $objecttype ==
'order_supplier') {
2696 $optiontohidelinkedorders =
"PDF_HIDE_LINKED_ORDERS_ON_SAME_THIRDPARTY";
2697 if ($objecttype ==
'supplier_order' || $objecttype ==
'order_supplier') {
2698 $optiontohidelinkedorders =
"PDF_HIDE_LINKED_PURCHASE_ORDERS_ON_SAME_THIRDPARTY";
2700 '@phan-var-force array<Commande|CommandeFournisseur> $objects';
2701 $outputlangs->load(
'orders');
2704 if (empty(
$object->context[
'DolPublicNoteAppendedGetLinkedObjects'])) {
2706 foreach ($objects as $elementobject) {
2708 $outputList =
dol_concatdesc($outputList, $outputlangs->transnoentities($elementobject->ref) . (empty($elementobject->ref_client) ?
'' :
' (' . $elementobject->ref_client .
')') . (empty($elementobject->ref_supplier) ?
'' :
' (' . $elementobject->ref_supplier .
')') .
' ');
2709 $outputList =
dol_concatdesc($outputList, $outputlangs->transnoentities(
"OrderDate") .
' : ' .
dol_print_date($elementobject->date,
'day',
'', $outputlangs));
2713 if (!empty($outputList)) {
2719 $elementobject = array_shift($objects);
2721 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"RefOrder");
2722 $linkedobjects[$objecttype][
'ref_value'] = $outputlangs->transnoentities($elementobject->ref).(!empty($elementobject->ref_client) ?
' ('.$elementobject->ref_client.
')' :
'').(!empty($elementobject->ref_supplier) ?
' ('.$elementobject->ref_supplier.
')' :
'');
2723 $linkedobjects[$objecttype][
'date_title'] = $outputlangs->transnoentities(
"OrderDate");
2724 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date($elementobject->date,
'day',
'', $outputlangs);
2727 } elseif ($objecttype ==
'contrat') {
2728 '@phan-var-force Contrat[] $objects';
2729 $outputlangs->load(
'contracts');
2730 foreach ($objects as $elementobject) {
2732 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"RefContract");
2733 $linkedobjects[$objecttype][
'ref_value'] = $outputlangs->transnoentities($elementobject->ref);
2734 $linkedobjects[$objecttype][
'date_title'] = $outputlangs->transnoentities(
"DateContract");
2735 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date($elementobject->date_contrat,
'day',
'', $outputlangs);
2738 } elseif ($objecttype ==
'fichinter') {
2739 '@phan-var-force Fichinter[] $objects';
2740 $outputlangs->load(
'interventions');
2741 foreach ($objects as $elementobject) {
2743 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"InterRef");
2744 $linkedobjects[$objecttype][
'ref_value'] = $outputlangs->transnoentities($elementobject->ref);
2745 $linkedobjects[$objecttype][
'date_title'] = $outputlangs->transnoentities(
"InterDate");
2746 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date($elementobject->datec,
'day',
'', $outputlangs);
2749 } elseif ($objecttype ==
'shipping') {
2750 '@phan-var-force Expedition[] $objects';
2751 $outputlangs->loadLangs(array(
"orders",
"sendings"));
2753 if (count($objects) > 1) {
2757 if (empty(
$object->linkedObjects[
'commande']) &&
$object->element !=
'commande') {
2758 $refListsTxt .= $outputlangs->transnoentities(
"RefOrder").
' / '.$outputlangs->transnoentities(
"RefSending").
' :';
2760 $refListsTxt .= $outputlangs->transnoentities(
"RefSending").
' :';
2763 foreach ($objects as $elementobject) {
2764 if (empty(
$object->linkedObjects[
'commande']) &&
$object->element !=
'commande') {
2765 $elementobject->fetchObjectLinked(
null,
'',
null,
'',
'OR', 1,
'sourcetype', 0);
2766 if (!empty($elementobject->linkedObjectsIds[
'commande'])) {
2767 include_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
2769 $ret = $order->fetch(reset($elementobject->linkedObjectsIds[
'commande']));
2775 $refListsTxt .= (!empty($refListsTxt) ?
' ' :
'');
2776 if (! is_object($order)) {
2777 $refListsTxt .= $outputlangs->transnoentities($elementobject->ref);
2779 $refListsTxt .= $outputlangs->convToOutputCharset($order->ref).($order->ref_client ?
' ('.$order->ref_client.
')' :
'');
2780 $refListsTxt .=
' / '.$outputlangs->transnoentities($elementobject->ref);
2784 if (empty(
$object->context[
'DolPublicNoteAppendedGetLinkedObjects']) && !
getDolGlobalString(
"PDF_HIDE_LINKED_OBJECT_IN_PUBLIC_NOTE")) {
2787 } elseif (count($objects) == 1) {
2788 $elementobject = array_shift($objects);
2791 if (empty(
$object->linkedObjects[
'commande']) &&
$object->element !=
'commande') {
2792 $elementobject->fetchObjectLinked(
null,
'',
null,
'',
'OR', 1,
'sourcetype', 0);
2793 if (!empty($elementobject->linkedObjectsIds[
'commande'])) {
2794 include_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
2796 $ret = $order->fetch(reset($elementobject->linkedObjectsIds[
'commande']));
2803 if (! is_object($order)) {
2804 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"RefSending");
2805 if (empty($linkedobjects[$objecttype][
'ref_value'])) {
2806 $linkedobjects[$objecttype][
'ref_value'] =
'';
2808 $linkedobjects[$objecttype][
'ref_value'] .=
' / ';
2810 $linkedobjects[$objecttype][
'ref_value'] .= $outputlangs->transnoentities($elementobject->ref);
2811 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date(empty($elementobject->date_shipping) ? $elementobject->date_delivery : $elementobject->date_shipping,
'day',
'', $outputlangs);
2813 $linkedobjects[$objecttype][
'ref_title'] = $outputlangs->transnoentities(
"RefOrder").
' / '.$outputlangs->transnoentities(
"RefSending");
2814 if (empty($linkedobjects[$objecttype][
'ref_value'])) {
2815 $linkedobjects[$objecttype][
'ref_value'] = $outputlangs->convToOutputCharset($order->ref).($order->ref_client ?
' ('.$order->ref_client.
')' :
'');
2817 $linkedobjects[$objecttype][
'ref_value'] .=
' / '.$outputlangs->transnoentities($elementobject->ref);
2818 $linkedobjects[$objecttype][
'date_value'] =
dol_print_date(empty($elementobject->date_shipping) ? $elementobject->date_delivery : $elementobject->date_shipping,
'day',
'', $outputlangs);
2824 $object->context[
'DolPublicNoteAppendedGetLinkedObjects'] = 1;
2827 if (is_object($hookmanager)) {
2828 $parameters = array(
'linkedobjects' => $linkedobjects,
'outputlangs' => $outputlangs);
2830 $reshook = $hookmanager->executeHooks(
'pdf_getLinkedObjects', $parameters,
$object, $action);
2831 if (empty($reshook)) {
2832 $linkedobjects = array_replace($linkedobjects, $hookmanager->resArray);
2833 } elseif ($reshook > 0) {
2835 $linkedobjects = $hookmanager->resArray;
2839 return $linkedobjects;
2852 $maxheight =
getDolGlobalInt(
'MAIN_DOCUMENTS_WITH_PICTURE_HEIGHT', 32);
2854 include_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
2858 if ($tmp[
'height']) {
2859 $width = (int) round($maxheight * $tmp[
'width'] / $tmp[
'height']);
2860 if ($width > $maxwidth) {
2862 $height = (int) round($maxwidth * $tmp[
'height'] / $tmp[
'width']);
2864 $height = $maxheight;
2867 return array(
'width' => $width,
'height' => $height);
2883 global $hookmanager;
2889 if (
$object->lines[$i]->special_code == 3) {
2891 return $outputlangs->transnoentities(
"Option");
2893 if (is_object($hookmanager)) {
2894 $special_code =
$object->lines[$i]->special_code;
2895 if (!empty(
$object->lines[$i]->fk_parent_line)) {
2896 $special_code =
$object->getSpecialCode(
$object->lines[$i]->fk_parent_line);
2899 $parameters = array(
2901 'outputlangs' => $outputlangs,
2902 'hidedetails' => $hidedetails,
2903 'special_code' => $special_code,
2904 'multicurrency' => $multicurrency
2909 if ($hookmanager->executeHooks(
'getlinetotalremise', $parameters,
$object, $action) > 0) {
2910 if (isset($hookmanager->resArray[
'linetotalremise'])) {
2911 return (
float) $hookmanager->resArray[
'linetotalremise'];
2913 return (
float) $hookmanager->resPrint;
2918 if (empty($hidedetails) || $hidedetails > 1) {
2919 if (empty($multicurrency)) {
2922 return (
float)
price2num($sign * ((
$object->lines[$i]->multicurrency_subprice * (
float)
$object->lines[$i]->qty) -
$object->lines[$i]->multicurrency_total_ht),
'MT', 1);
2939 return "ERROR: FILE NOT FOUND OR NOT VALID";
2950 $content = preg_replace(
'/[^(\x20-\x7F)]*/',
'', $content);
2951 if (preg_match(
'/\/' . preg_quote($field,
'/') .
'\s*\((.*?)\)/', $content, $matches)) {
2952 return trim($matches[1]);
2954 return "ERROR: NOT FOUND";
2956 return "ERROR: FAILED TO READ PDF";
2987 bool $isSubtotal =
false,
2988 bool $applySubtotalLogic =
true
2990 $savePage = $pdf->getPage();
2991 $saveX = $pdf->GetX();
2992 $prevAlign = $generator->cols[
'desc'][
'content'][
'align'];
2994 if ($isSubtotal && $applySubtotalLogic &&
$object->lines[$i]->qty < 0) {
2995 $outputlangs->load(
"subtotals");
2996 $object->lines[$i]->desc = $outputlangs->trans(
"SubtotalOf",
$object->lines[$i]->desc);
2997 $generator->cols[
'desc'][
'content'][
'align'] = ($prevAlign ===
'L') ?
'R' :
'L';
3000 $pdf->startTransaction();
3001 $pdf->SetXY($saveX, $curY);
3003 $pageAfter = $pdf->getPage();
3004 $yAfter = $pdf->GetY();
3005 $pdf->rollbackTransaction(
true);
3007 $pdf->SetFillColor($bgColor[0], $bgColor[1], $bgColor[2]);
3008 $width = $generator->page_largeur - $generator->marge_droite - $generator->marge_gauche;
3010 $pdf->SetXY($generator->marge_gauche, $curY);
3011 if ($pageAfter === $savePage) {
3012 $pdf->MultiCell($width, max(0, $yAfter - $curY),
'', 0,
'',
true);
3014 $pdf->MultiCell($width, $pdf->getPageHeight() - $pdf->getBreakMargin() - $curY,
'', 0,
'',
true);
3016 $pdf->setPage($pageAfter);
3017 $pdf->SetXY($generator->marge_gauche, $pdf->getMargins()[
'top']);
3018 $pdf->MultiCell($width, max(0, $yAfter - $pdf->getMargins()[
'top']),
'', 0,
'',
true);
3020 $pdf->setPage($savePage);
3023 $pdf->SetTextColor(
colorIsLight(implode(
',', $bgColor)));
3024 $pdf->SetXY($saveX, $curY);
3028 $generator->cols[
'desc'][
'content'][
'align'] = $prevAlign;
if(! $sortfield) if(! $sortorder) $object
pdfCertifMentionblockedLog(&$pdf, $outputlangs, $seller, $default_font_size, &$posy, $pdftemplate)
Add legal mention.
isALNERunningVersion($blockedlogtestalreadydone=0)
Return if the application is executed with the LNE requirements on.
Class to manage categories.
Class to manage customers orders.
Parent class for documents (PDF, ODT, ...) generators.
printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref=0, $hidedesc=0, $issupplierline=0)
print description column content
setAfterColsLinePositionsData(string $colId, float $y, int $pageNumb)
Used for to set afterColsLinePositions var in a pdf draw line loop.
Parent class of all other business classes (invoices, contracts, proposals, 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_is_file($pathoffile)
Return if path is a file.
dol_print_reduction($reduction, $langs)
Returns formatted reduction.
dol_getDefaultFormat($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.
dol_now($mode='gmt')
Return date for now.
getDolGlobalFloat($key, $default=0)
Return a Dolibarr global constant float value.
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_osencode($str)
Return a string encoded into OS filesystem encoding.
getObjectSocId($obj)
Get the socid of an object, supporting legacy attribute names.
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_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
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.
colorIsLight($stringcolor)
Return true if the color is light.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalBool($key, $default=false)
Return a Dolibarr global constant boolean value.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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
pdf_getFormat($outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails=0, $multicurrency=0)
Return line total amount discount.
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
pdfExtractMetadata($file, $field='Keywords')
Function to extract metadata from a PDF file by doing a binary parsing of the PDF file.
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.
pdfCertifMention(&$pdf, $outputlangs, $seller, $default_font_size, &$posy, $pdftemplate)
Add legal certificate mention.
pdf_getlineupwithtax($object, $i, $outputlangs, $hidedetails=0)
Return line unit price including tax.
pdfWriteBlockedLogSignature(&$pdf, $outputlangs, $page_height, $object, &$w, &$posx, &$posy)
Show header of page for PDF 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.
canDisplayLinkedObjectInPDF($object, $elementobject)
Check if a linked object can be displayed based on third-party privacy rules.
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_render_subtotals(TCPDF $pdf, CommonDocGenerator $generator, float $curY, CommonObject $object, int $i, Translate $outputlangs, int $hideref, int $hidedesc, array $bgColor, bool $isSubtotal=false, bool $applySubtotalLogic=true)
Render subtotals line with a colored background and adapted text color .
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.