32 require_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_proposal/modules_supplier_proposal.php';
33 require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
63 public $update_main_doc_field;
74 public $version =
'dolibarr';
84 global $conf, $langs, $mysoc;
87 $langs->loadLangs(array(
"main",
"bills"));
90 $this->
name =
"zenith";
91 $this->
description = $langs->trans(
'DocModelZenithDescription');
92 $this->update_main_doc_field = 1;
97 $this->page_largeur = $formatarray[
'width'];
98 $this->page_hauteur = $formatarray[
'height'];
99 $this->format = array($this->page_largeur, $this->page_hauteur);
105 $this->option_logo = 1;
106 $this->option_tva = 1;
107 $this->option_modereg = 1;
108 $this->option_condreg = 1;
109 $this->option_multilang = 1;
110 $this->option_escompte = 0;
111 $this->option_credit_note = 0;
112 $this->option_freetext = 1;
113 $this->option_draft_watermark = 1;
116 $this->emetteur = $mysoc;
117 if (empty($this->emetteur->country_code)) {
118 $this->emetteur->country_code = substr($langs->defaultlang, -2);
122 $this->posxdesc = $this->marge_gauche + 1;
124 $this->tabTitleHeight = 5;
126 $this->tva = array();
127 $this->tva_array = array();
128 $this->localtax1 = array();
129 $this->localtax2 = array();
130 $this->atleastoneratenotnull = 0;
131 $this->atleastonediscount = 0;
147 public function write_file(
$object, $outputlangs =
null, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
150 global $user, $langs, $conf, $hookmanager, $mysoc, $nblines;
152 if (!is_object($outputlangs)) {
153 $outputlangs = $langs;
157 $outputlangs->charset_output =
'ISO-8859-1';
161 $outputlangs->loadLangs(array(
"main",
"supplier_proposal",
"companies",
"bills",
"dict",
"products"));
163 global $outputlangsbis;
164 $outputlangsbis =
null;
166 $outputlangsbis =
new Translate(
'', $conf);
168 $outputlangsbis->loadLangs(array(
"main",
"supplier_proposal",
"companies",
"bills",
"dict",
"products"));
171 $nblines = count(
$object->lines);
179 $realpatharray = array();
181 for ($i = 0; $i < $nblines; $i++) {
182 if (empty(
$object->lines[$i]->fk_product)) {
186 $objphoto =
new Product($this->db);
187 $objphoto->fetch(
$object->lines[$i]->fk_product);
190 $pdir =
get_exdir($objphoto->id, 2, 0, 0, $objphoto,
'product').$object->lines[$i]->fk_product.
"/photos/";
191 $dir = $conf->product->dir_output.
'/'.$pdir;
193 $pdir =
get_exdir($objphoto->id, 0, 0, 0, $objphoto,
'product');
194 $dir = $conf->product->dir_output.
'/'.$pdir;
198 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
200 if ($obj[
'photo_vignette']) {
201 $filename = $obj[
'photo_vignette'];
203 $filename = $obj[
'photo'];
206 $filename = $obj[
'photo'];
208 $realpath = $dir.$filename;
213 $realpatharray[$i] = $realpath;
217 if (count($realpatharray) == 0) {
218 $this->posxpicture = $this->posxtva;
221 if ($conf->supplier_proposal->dir_output) {
225 $amount_credit_notes_included = 0;
226 $amount_deposits_included = 0;
232 $dir = $conf->supplier_proposal->dir_output;
233 $file = $dir.
"/SPECIMEN.pdf";
237 $dir = $conf->supplier_proposal->dir_output.
'/'.$objectref;
238 $file = $dir.
"/".$objectref.
".pdf";
240 $file = $dir.
"/".$objectref.($objectrefsupplier ?
"_".$objectrefsupplier :
"").
".pdf";
244 if (!file_exists($dir)) {
246 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
251 if (file_exists($dir)) {
253 if (!is_object($hookmanager)) {
254 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
257 $hookmanager->initHooks(array(
'pdfgeneration'));
258 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
260 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
262 $nblines = count(
$object->lines);
266 $heightforinfotot = 50;
267 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
268 $heightforfooter = $this->marge_basse + 8;
270 $heightforfooter += 6;
272 $pdf->SetAutoPageBreak(1, 0);
274 if (class_exists(
'TCPDF')) {
275 $pdf->setPrintHeader(
false);
276 $pdf->setPrintFooter(
false);
281 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
282 $tplidx = $pdf->importPage(1);
287 $pdf->SetDrawColor(128, 128, 128);
289 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
290 $pdf->SetSubject($outputlangs->transnoentities(
"SupplierProposal"));
291 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
292 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
293 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"SupplierProposal").
" ".$outputlangs->convToOutputCharset(
$object->thirdparty->name));
295 $pdf->SetCompression(
false);
299 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
302 foreach (
$object->lines as $line) {
303 if ($line->remise_percent) {
304 $this->atleastonediscount =
true;
311 if (!empty($tplidx)) {
312 $pdf->useTemplate($tplidx);
316 $pdf->SetFont(
'',
'', $default_font_size - 1);
317 $pdf->MultiCell(0, 3,
'');
318 $pdf->SetTextColor(0, 0, 0);
320 $tab_top = 90 + $top_shift;
321 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
323 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
327 $desc_incoterms =
$object->getIncotermsForPDF();
328 if ($desc_incoterms) {
331 $pdf->SetFont(
'',
'', $default_font_size - 1);
332 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
333 $nexY = $pdf->GetY();
334 $height_incoterms = $nexY - $tab_top;
337 $pdf->SetDrawColor(192, 192, 192);
338 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
340 $tab_top = $nexY + 6;
345 $notetoshow = empty(
$object->note_public) ?
'' :
$object->note_public;
348 $extranote = $this->getExtrafieldsInHtml(
$object, $outputlangs);
349 if (!empty($extranote)) {
353 $pagenb = $pdf->getPage();
355 $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
356 $pageposbeforenote = $pagenb;
365 $pdf->startTransaction();
367 $pdf->SetFont(
'',
'', $default_font_size - 1);
368 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
370 $pageposafternote = $pdf->getPage();
371 $posyafter = $pdf->GetY();
373 if ($pageposafternote > $pageposbeforenote) {
374 $pdf->rollbackTransaction(
true);
377 while ($pagenb < $pageposafternote) {
380 if (!empty($tplidx)) {
381 $pdf->useTemplate($tplidx);
387 $pdf->setTopMargin($tab_top_newpage);
389 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
393 $pdf->setPage($pageposbeforenote);
394 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
395 $pdf->SetFont(
'',
'', $default_font_size - 1);
396 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
397 $pageposafternote = $pdf->getPage();
399 $posyafter = $pdf->GetY();
401 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
402 $pdf->AddPage(
'',
'',
true);
405 $pdf->setPage($pageposafternote);
406 $pdf->setTopMargin($tab_top_newpage);
408 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
414 $i = $pageposbeforenote;
415 while ($i < $pageposafternote) {
419 $pdf->SetDrawColor(128, 128, 128);
421 if ($i > $pageposbeforenote) {
422 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
423 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
425 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
426 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
430 $pdf->setPageOrientation(
'', 1, 0);
437 $pdf->setPage($pageposafternote);
438 if (!empty($tplidx)) {
439 $pdf->useTemplate($tplidx);
444 $height_note = $posyafter - $tab_top_newpage;
445 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
448 $pdf->commitTransaction();
449 $posyafter = $pdf->GetY();
450 $height_note = $posyafter - $tab_top;
451 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
454 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
456 $pdf->AddPage(
'',
'',
true);
459 $pdf->setPage($pageposafternote);
460 if (!empty($tplidx)) {
461 $pdf->useTemplate($tplidx);
467 $posyafter = $tab_top_newpage;
471 $tab_height = $tab_height - $height_note;
472 $tab_top = $posyafter + 6;
480 $nexY = $tab_top + $this->tabTitleHeight;
483 $pageposbeforeprintlines = $pdf->getPage();
484 $pagenb = $pageposbeforeprintlines;
485 for ($i = 0; $i < $nblines; $i++) {
487 $pdf->SetFont(
'',
'', $default_font_size - 1);
488 $pdf->SetTextColor(0, 0, 0);
491 $imglinesize = array();
492 if (!empty($realpatharray[$i])) {
496 $pdf->setTopMargin($tab_top_newpage);
497 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
498 $pageposbefore = $pdf->getPage();
500 $showpricebeforepagebreak = 1;
502 $posYAfterDescription = 0;
507 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
508 $pdf->AddPage(
'',
'',
true);
509 if (!empty($tplidx)) {
510 $pdf->useTemplate($tplidx);
512 $pdf->setPage($pageposbefore + 1);
514 $curY = $tab_top_newpage;
518 $showpricebeforepagebreak = 1;
520 $showpricebeforepagebreak = 0;
524 if (!empty($this->cols[
'photo']) && isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
525 $pdf->Image($realpatharray[$i], $this->
getColumnContentXStart(
'photo'), $curY + 1, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
527 $posYAfterImage = $curY + $imglinesize[
'height'];
531 $curX = $this->posxdesc - 1;
532 $showpricebeforepagebreak = 1;
535 $pdf->startTransaction();
538 $pageposafter = $pdf->getPage();
539 if ($pageposafter > $pageposbefore) {
540 $pdf->rollbackTransaction(
true);
544 $pageposafter = $pdf->getPage();
545 $posyafter = $pdf->GetY();
546 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
547 if ($i == ($nblines - 1)) {
548 $pdf->AddPage(
'',
'',
true);
549 if (!empty($tplidx)) {
550 $pdf->useTemplate($tplidx);
553 $pdf->setPage($pageposafter + 1);
559 $showpricebeforepagebreak = 1;
561 $showpricebeforepagebreak = 0;
565 $pdf->commitTransaction();
567 $posYAfterDescription = $pdf->GetY();
570 $nexY = $pdf->GetY();
571 $pageposafter = $pdf->getPage();
572 $pdf->setPage($pageposbefore);
573 $pdf->setTopMargin($this->marge_haute);
574 $pdf->setPageOrientation(
'', 1, 0);
577 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
578 $pdf->setPage($pageposafter);
579 $curY = $tab_top_newpage;
582 $pdf->SetFont(
'',
'', $default_font_size - 1);
588 $nexY = max($pdf->GetY(), $nexY);
595 $nexY = max($pdf->GetY(), $nexY);
603 $nexY = max($pdf->GetY(), $nexY);
611 $nexY = max($pdf->GetY(), $nexY);
618 $nexY = max($pdf->GetY(), $nexY);
625 $nexY = max($pdf->GetY(), $nexY);
629 if (!empty(
$object->lines[$i]->array_options)) {
630 foreach (
$object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
634 $nexY = max($pdf->GetY(), $nexY);
645 'outputlangs' => $outputlangs,
646 'hidedetails' => $hidedetails
648 $reshook = $hookmanager->executeHooks(
'printPDFline', $parameters, $this);
653 $tvaligne =
$object->lines[$i]->multicurrency_total_tva;
655 $tvaligne =
$object->lines[$i]->total_tva;
658 $localtax1ligne =
$object->lines[$i]->total_localtax1;
659 $localtax2ligne =
$object->lines[$i]->total_localtax2;
660 $localtax1_rate =
$object->lines[$i]->localtax1_tx;
661 $localtax2_rate =
$object->lines[$i]->localtax2_tx;
662 $localtax1_type =
$object->lines[$i]->localtax1_type;
663 $localtax2_type =
$object->lines[$i]->localtax2_type;
676 $vatrate = (string)
$object->lines[$i]->tva_tx;
679 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
680 && (!empty($localtax1_rate) || !empty($localtax2_rate))) {
682 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] :
'';
683 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] :
'';
687 if ($localtax1_type && $localtax1ligne != 0) {
688 if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
689 $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
691 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
694 if ($localtax2_type && $localtax2ligne != 0) {
695 if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
696 $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
698 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
702 if ((
$object->lines[$i]->info_bits & 0x01) == 0x01) {
707 if (!isset($this->tva[$vatrate])) {
708 $this->tva[$vatrate] = 0;
710 $this->tva[$vatrate] += $tvaligne;
711 $vatcode =
$object->lines[$i]->vat_src_code;
712 if (empty($this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'])) {
713 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] = 0;
715 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')] = array(
'vatrate' => $vatrate,
'vatcode' => $vatcode,
'amount' => $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] + $tvaligne);
717 if ($posYAfterImage > $posYAfterDescription) {
718 $nexY = $posYAfterImage;
723 $pdf->setPage($pageposafter);
724 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
726 $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
727 $pdf->SetLineStyle(array(
'dash' => 0));
731 while ($pagenb < $pageposafter) {
732 $pdf->setPage($pagenb);
733 if ($pagenb == $pageposbeforeprintlines) {
734 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1,
$object->multicurrency_code);
736 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object->multicurrency_code);
740 $pdf->setPage($pagenb);
741 $pdf->setPageOrientation(
'', 1, 0);
745 if (!empty($tplidx)) {
746 $pdf->useTemplate($tplidx);
749 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
750 if ($pagenb == $pageposafter) {
751 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1,
$object->multicurrency_code);
753 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object->multicurrency_code);
758 if (!empty($tplidx)) {
759 $pdf->useTemplate($tplidx);
769 if ($pagenb == $pageposbeforeprintlines) {
770 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0,
$object->multicurrency_code);
771 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
773 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0,
$object->multicurrency_code);
774 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
784 if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) {
790 if (method_exists($pdf,
'AliasNbPages')) {
791 $pdf->AliasNbPages();
796 $pdf->Output($file,
'F');
799 $hookmanager->initHooks(array(
'pdfgeneration'));
800 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
802 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
804 $this->error = $hookmanager->error;
805 $this->errors = $hookmanager->errors;
810 $this->result = array(
'fullpath' => $file);
814 $this->error = $langs->trans(
"ErrorCanNotCreateDir", $dir);
818 $this->error = $langs->trans(
"ErrorConstantNotDefined",
"SUPPLIER_OUTPUTDIR");
854 global $conf, $mysoc;
857 $diffsizetitle = (!
getDolGlobalString(
'PDF_DIFFSIZE_TITLE') ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
860 if ($this->emetteur->country_code ==
'FR' && empty($mysoc->tva_assuj)) {
861 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
862 $pdf->SetXY($this->marge_gauche, $posy);
863 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"VATIsNotUsedForInvoice"), 0,
'L', 0);
865 $posy = $pdf->GetY() + 4;
871 if (!empty(
$object->cond_reglement_code) ||
$object->cond_reglement) {
872 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
873 $pdf->SetXY($this->marge_gauche, $posy);
874 $titre = $outputlangs->transnoentities(
"PaymentConditions").
':';
875 $pdf->MultiCell(80, 4, $titre, 0,
'L');
877 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
878 $pdf->SetXY($posxval, $posy);
879 $lib_condition_paiement = ($outputlangs->transnoentities(
"PaymentCondition".
$object->cond_reglement_code) !=
'PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities(
"PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset(
$object->cond_reglement_doc ?
$object->cond_reglement_doc :
$object->cond_reglement_label);
880 $lib_condition_paiement = str_replace(
'\n',
"\n", $lib_condition_paiement);
881 $pdf->MultiCell(80, 4, $lib_condition_paiement, 0,
'L');
883 $posy = $pdf->GetY() + 3;
887 if (!empty(
$object->mode_reglement_code)) {
888 $pdf->SetFont(
'',
'B', $default_font_size - $diffsizetitle);
889 $pdf->SetXY($this->marge_gauche, $posy);
890 $titre = $outputlangs->transnoentities(
"PaymentMode").
':';
891 $pdf->MultiCell(80, 5, $titre, 0,
'L');
893 $pdf->SetFont(
'',
'', $default_font_size - $diffsizetitle);
894 $pdf->SetXY($posxval, $posy);
895 $lib_mode_reg = $outputlangs->transnoentities(
"PaymentType".
$object->mode_reglement_code) !=
'PaymentType'.$object->mode_reglement_code ? $outputlangs->transnoentities(
"PaymentType".
$object->mode_reglement_code) : $outputlangs->convToOutputCharset(
$object->mode_reglement);
896 $pdf->MultiCell(80, 5, $lib_mode_reg, 0,
'L');
898 $posy = $pdf->GetY() + 2;
920 global $conf, $mysoc;
926 $pdf->SetFont(
'',
'', $default_font_size - 1);
931 if ($this->page_largeur < 210) {
934 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
940 $pdf->SetFillColor(255, 255, 255);
941 $pdf->SetXY($col1x, $tab2_top);
942 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalHT"), 0,
'L', 1);
945 $pdf->SetXY($col2x, $tab2_top);
946 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ht + (!empty(
$object->remise) ?
$object->remise : 0)), 0,
'R', 1);
949 $pdf->SetFillColor(248, 248, 248);
951 $this->atleastoneratenotnull = 0;
952 foreach ($this->tva as $tvakey => $tvaval) {
954 $this->atleastoneratenotnull++;
957 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
961 if (preg_match(
'/\*/', $tvakey)) {
962 $tvakey = str_replace(
'*',
'', $tvakey);
963 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
966 $totalvat = $outputlangs->transcountrynoentities(
"TotalVAT", $mysoc->country_code).
' ';
967 $totalvat .=
vatrate($tvakey, 1).$tvacompl;
968 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
970 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
971 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval), 0,
'R', 1);
974 if (!$this->atleastoneratenotnull) {
976 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
977 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalVAT", $mysoc->country_code), 0,
'L', 1);
979 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
980 $pdf->MultiCell($largcol2, $tab2_hl,
price(
$object->total_tva), 0,
'R', 1);
985 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
986 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code), 0,
'L', 1);
987 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
988 $pdf->MultiCell($largcol2, $tab2_hl,
price(
$object->total_localtax1), $useborder,
'R', 1);
994 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
995 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code), 0,
'L', 1);
996 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
997 $pdf->MultiCell($largcol2, $tab2_hl,
price(
$object->total_localtax2), $useborder,
'R', 1);
1003 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1004 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1008 foreach ($localtax_rate as $tvakey => $tvaval) {
1013 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1016 if (preg_match(
'/\*/', $tvakey)) {
1017 $tvakey = str_replace(
'*',
'', $tvakey);
1018 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1020 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT1", $mysoc->country_code).
' ';
1021 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
1022 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1024 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1025 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval, 0, $outputlangs), 0,
'R', 1);
1033 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1034 if (in_array((
string) $localtax_type, array(
'2',
'4',
'6'))) {
1038 foreach ($localtax_rate as $tvakey => $tvaval) {
1043 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1046 if (preg_match(
'/\*/', $tvakey)) {
1047 $tvakey = str_replace(
'*',
'', $tvakey);
1048 $tvacompl =
" (".$outputlangs->transnoentities(
"NonPercuRecuperable").
")";
1050 $totalvat = $outputlangs->transcountrynoentities(
"TotalLT2", $mysoc->country_code).
' ';
1051 $totalvat .=
vatrate(abs($tvakey), 1).$tvacompl;
1052 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0,
'L', 1);
1054 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1055 $pdf->MultiCell($largcol2, $tab2_hl,
price($tvaval), 0,
'R', 1);
1063 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1064 $pdf->SetTextColor(0, 0, 60);
1065 $pdf->SetFillColor(224, 224, 224);
1066 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"TotalTTC"), $useborder,
'L', 1);
1069 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1070 $pdf->MultiCell($largcol2, $tab2_hl,
price($total_ttc), $useborder,
'R', 1);
1071 $pdf->SetFont(
'',
'', $default_font_size - 1);
1072 $pdf->SetTextColor(0, 0, 0);
1074 $creditnoteamount = 0;
1075 $depositsamount = 0;
1079 $resteapayer =
price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount,
'MT');
1084 if ($deja_regle > 0) {
1088 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1089 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"AlreadyPaid"), 0,
'L', 0);
1090 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1091 $pdf->MultiCell($largcol2, $tab2_hl,
price($deja_regle), 0,
'R', 0);
1094 $pdf->SetTextColor(0, 0, 60);
1095 $pdf->SetFillColor(224, 224, 224);
1096 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1097 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"RemainderToPay"), $useborder,
'L', 1);
1099 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1100 $pdf->MultiCell($largcol2, $tab2_hl,
price($resteapayer), $useborder,
'R', 1);
1102 $pdf->SetFont(
'',
'', $default_font_size - 1);
1103 $pdf->SetTextColor(0, 0, 0);
1107 return ($tab2_top + ($tab2_hl * $index));
1124 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'')
1134 $currency = !empty($currency) ? $currency : $conf->currency;
1138 $pdf->SetTextColor(0, 0, 0);
1139 $pdf->SetFont(
'',
'', $default_font_size - 2);
1141 if (empty($hidetop)) {
1142 $titre = $outputlangs->transnoentities(
"AmountInCurrency", $outputlangs->transnoentitiesnoconv(
"Currency".$currency));
1143 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1144 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1148 $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight,
'F',
null, explode(
',',
getDolGlobalString(
'MAIN_PDF_TITLE_BACKGROUND_COLOR')));
1152 $pdf->SetDrawColor(128, 128, 128);
1153 $pdf->SetFont(
'',
'', $default_font_size - 1);
1156 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
1158 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
1160 if (empty($hidetop)) {
1161 $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight);
1177 global $langs, $conf, $mysoc;
1179 $ltrdirection =
'L';
1180 if ($outputlangs->trans(
"DIRECTION") ==
'rtl') {
1181 $ltrdirection =
'R';
1185 $outputlangs->loadLangs(array(
"main",
"supplier_proposal",
"companies",
"bills",
"sendings"));
1199 $pdf->SetTextColor(0, 0, 60);
1200 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1202 $posx = $this->page_largeur - $this->marge_droite - 100;
1203 $posy = $this->marge_haute;
1205 $pdf->SetXY($this->marge_gauche, $posy);
1209 if ($this->emetteur->logo) {
1210 $logodir = $conf->mycompany->dir_output;
1211 if (!empty($conf->mycompany->multidir_output[
$object->entity])) {
1212 $logodir = $conf->mycompany->multidir_output[
$object->entity];
1215 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
1217 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
1219 if (is_readable($logo)) {
1221 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1223 $pdf->SetTextColor(200, 0, 0);
1224 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1225 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1226 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
1229 $text = $this->emetteur->name;
1230 $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
1234 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1235 $pdf->SetXY($posx, $posy);
1236 $pdf->SetTextColor(0, 0, 60);
1237 $title = $outputlangs->transnoentities(
"SupplierProposal").
" ".$outputlangs->convToOutputCharset(
$object->ref);
1238 $pdf->MultiCell(100, 3, $title,
'',
'R');
1243 $pdf->SetFont(
'',
'B', $default_font_size);
1244 $pdf->SetXY($posx, $posy);
1245 $pdf->SetTextColor(0, 0, 60);
1246 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"RefSupplier").
" : ".$outputlangs->convToOutputCharset(
$object->ref_supplier),
'',
'R');
1250 $pdf->SetFont(
'',
'', $default_font_size - 1);
1254 if (!empty(
$object->project->ref)) {
1256 $pdf->SetXY($posx, $posy);
1257 $pdf->SetTextColor(0, 0, 60);
1258 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty(
$object->project->title) ?
'' :
$object->project->title),
'',
'R');
1264 if (!empty(
$object->project->ref)) {
1265 $outputlangs->load(
"projects");
1267 $pdf->SetXY($posx, $posy);
1268 $langs->load(
"projects");
1269 $pdf->SetTextColor(0, 0, 60);
1270 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty(
$object->project->ref) ?
'' :
$object->project->ref),
'',
'R');
1276 $pdf->SetXY($posx, $posy);
1277 $pdf->SetTextColor(0, 0, 60);
1278 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Date").
" : ".
dol_print_date(
$object->date,
"day",
false, $outputlangs,
true),
'',
'R');
1281 $pdf->SetXY($posx, $posy);
1282 $pdf->SetTextColor(255, 0, 0);
1283 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"Draft"),
'',
'R');
1286 $pdf->SetTextColor(0, 0, 60);
1287 $usehourmin =
'day';
1289 $usehourmin =
'dayhour';
1291 if (!empty(
$object->delivery_date)) {
1293 $pdf->SetXY($posx - 90, $posy);
1294 $pdf->MultiCell(190, 3, $outputlangs->transnoentities(
"DateDeliveryPlanned").
" : ".
dol_print_date(
$object->delivery_date, $usehourmin,
false, $outputlangs,
true),
'',
'R');
1297 if (
$object->thirdparty->code_fournisseur) {
1299 $pdf->SetXY($posx, $posy);
1300 $pdf->SetTextColor(0, 0, 60);
1301 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"SupplierCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_fournisseur),
'',
'R');
1306 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1307 if (count($arrayidcontact) > 0) {
1308 $usertmp =
new User($this->db);
1309 $usertmp->fetch($arrayidcontact[0]);
1311 $pdf->SetXY($posx, $posy);
1312 $pdf->SetTextColor(0, 0, 60);
1313 $pdf->MultiCell(100, 3, $langs->trans(
"BuyerName").
" : ".$usertmp->getFullName($langs),
'',
'R');
1318 $pdf->SetTextColor(0, 0, 60);
1322 $current_y = $pdf->getY();
1324 if ($current_y < $pdf->getY()) {
1325 $top_shift = $pdf->getY() - $current_y;
1330 $carac_emetteur =
'';
1332 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1333 if (count($arrayidcontact) > 0) {
1334 $object->fetch_user($arrayidcontact[0]);
1335 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1336 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
": ".$outputlangs->convToOutputCharset(
$object->user->getFullName($outputlangs));
1338 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty(
$object->user->office_phone)) ?
$object->user->office_phone :
'';
1342 $carac_emetteur .=
"\n";
1348 $posy = 42 + $top_shift;
1349 $posx = $this->marge_gauche;
1351 $posx = $this->page_largeur - $this->marge_droite - 80;
1356 $pdf->SetTextColor(0, 0, 0);
1357 $pdf->SetFont(
'',
'', $default_font_size - 2);
1358 $pdf->SetXY($posx, $posy - 5);
1359 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"BillFrom"), 0, $ltrdirection);
1360 $pdf->SetXY($posx, $posy);
1361 $pdf->SetFillColor(230, 230, 230);
1362 $pdf->MultiCell(82, $hautcadre,
"", 0,
'R', 1);
1363 $pdf->SetTextColor(0, 0, 60);
1366 $pdf->SetXY($posx + 2, $posy + 3);
1367 $pdf->SetFont(
'',
'B', $default_font_size);
1368 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
1369 $posy = $pdf->getY();
1372 $pdf->SetXY($posx + 2, $posy);
1373 $pdf->SetFont(
'',
'', $default_font_size - 1);
1374 $pdf->MultiCell(80, 4, $carac_emetteur, 0, $ltrdirection);
1379 $usecontact =
false;
1380 $arrayidcontact =
$object->getIdContact(
'external',
'CUSTOMER');
1381 if (count($arrayidcontact) > 0) {
1383 $result =
$object->fetch_contact($arrayidcontact[0]);
1387 if ($usecontact && (
$object->contact->socid !=
$object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) ||
getDolGlobalString(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1388 $thirdparty =
$object->contact;
1390 $thirdparty =
$object->thirdparty;
1399 if ($this->page_largeur < 210) {
1402 $posy = 42 + $top_shift;
1403 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1405 $posx = $this->marge_gauche;
1409 $pdf->SetTextColor(0, 0, 0);
1410 $pdf->SetFont(
'',
'', $default_font_size - 2);
1411 $pdf->SetXY($posx + 2, $posy - 5);
1412 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillTo"), 0, $ltrdirection);
1413 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1416 $pdf->SetXY($posx + 2, $posy + 3);
1417 $pdf->SetFont(
'',
'B', $default_font_size);
1419 $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, $ltrdirection);
1421 $posy = $pdf->getY();
1424 $pdf->SetFont(
'',
'', $default_font_size - 1);
1425 $pdf->SetXY($posx + 2, $posy);
1427 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
1445 $showdetails =
getDolGlobalInt(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
1446 return pdf_pagefoot($pdf, $outputlangs,
'SUPPLIER_PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur,
$object, $showdetails, $hidefreetext);
1463 global $conf, $hookmanager;
1466 $this->defaultContentsFieldsStyle = array(
1468 'padding' => array(1, 0.5, 1, 0.5),
1472 $this->defaultTitlesFieldsStyle = array(
1474 'padding' => array(0.5, 0, 0.5, 0),
1478 $this->cols[
'desc'] = array(
1483 'textkey' =>
'Designation',
1487 'padding' => array(0.5, 0.5, 0.5, 0.5),
1491 'padding' => array(1, 0.5, 1, 1.5),
1496 $this->cols[
'photo'] = array(
1501 'textkey' =>
'Photo',
1505 'padding' => array(0, 0, 0, 0),
1507 'border-left' =>
false,
1511 $this->cols[
'photo'][
'status'] =
true;
1516 $this->cols[
'vat'] = array(
1523 'border-left' =>
true,
1527 $this->cols[
'vat'][
'status'] =
true;
1531 $this->cols[
'subprice'] = array(
1536 'textkey' =>
'PriceUHT'
1538 'border-left' =>
true,
1541 if (!
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE')) {
1542 $this->cols[
'subprice'][
'status'] =
true;
1546 $this->cols[
'qty'] = array(
1553 'border-left' =>
true,
1557 $this->cols[
'unit'] = array(
1564 'border-left' =>
true,
1567 $this->cols[
'unit'][
'status'] =
true;
1571 $this->cols[
'discount'] = array(
1576 'textkey' =>
'ReductionShort'
1578 'border-left' =>
true,
1580 if ($this->atleastonediscount) {
1581 $this->cols[
'discount'][
'status'] =
true;
1584 $rank = $rank + 1000;
1585 $this->cols[
'totalexcltax'] = array(
1590 'textkey' =>
'TotalHT'
1592 'border-left' =>
true,
1595 if (!
getDolGlobalString(
'MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN')) {
1596 $this->cols[
'totalexcltax'][
'status'] =
true;
1601 $line = reset(
$object->lines);
1605 $parameters = array(
1607 'outputlangs' => $outputlangs,
1608 'hidedetails' => $hidedetails,
1609 'hidedesc' => $hidedesc,
1610 'hideref' => $hideref
1613 $reshook = $hookmanager->executeHooks(
'defineColumnField', $parameters, $this);
1616 } elseif (empty($reshook)) {
1618 $this->cols = array_replace($this->cols, $hookmanager->resArray);
1620 $this->cols = $hookmanager->resArray;
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
prepareArrayColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Prepare Array Column Field.
getColumnStatus($colKey)
get column status from column key
printStdColumnContent($pdf, &$curY, $colKey, $columnText='')
print standard column content
pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop=0)
Print standard column content.
printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref=0, $hidedesc=0, $issupplierline=0)
print description column content
getColumnContentXStart($colKey)
get column content X (abscissa) left position from column key
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
getExtrafieldContent($object, $extrafieldKey, $outputlangs=null)
get extrafield content for pdf writeHtmlCell compatibility usage for PDF line columns and object note...
defineColumnExtrafield($object, $outputlangs, $hidedetails=0)
Define Array Column Field for extrafields.
Perent class of the Proposal models.
Class to manage products or services.
Class to manage translations.
Class to manage Dolibarr users.
Class to generate the supplier proposals with the zenith model.
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='')
Show table for lines.
_tableau_info(&$pdf, $object, $posy, $outputlangs)
Show miscellaneous information (payment mode, payment term, ...)
__construct($db)
Constructor.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
_tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
Show total to pay.
defineColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Define Array Column Field.
_tableau_versements(&$pdf, $object, $posy, $outputlangs)
Show payments table.
write_file($object, $outputlangs=null, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
if(!function_exists('dolEscapeXML')) convertBackOfficeMediasLinksToPublicLinks($notetoshow)
Convert links to local wrapper to medias files into a string into a public external URL readable on i...
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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
dolChmod($filepath, $newmask='')
Change mod of a file.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
Get type and rate of localtaxes for a particular vat rate/country of a thirdparty.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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 dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
pdf_getSizeForImage($realpath)
Return dimensions to use for images onto PDF checking that width and height are not higher than maxim...
pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails=0)
Return line total excluding tax.
pdf_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_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
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_getlinevatrate($object, $i, $outputlangs, $hidedetails=0)
Return line vat rate.
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
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($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.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.