27 require_once DOL_DOCUMENT_ROOT.
'/core/modules/project/modules_project.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/compta/deplacement/class/deplacement.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
75 public $update_main_doc_field;
86 public $phpmin = array(7, 0);
92 public $version =
'dolibarr';
102 public $page_hauteur;
112 public $marge_gauche;
117 public $marge_droite;
133 private $orientation;
144 public $posxamountht;
145 public $posxamountttc;
156 global $conf, $langs, $mysoc;
159 $langs->loadLangs(array(
"main",
"projects",
"companies"));
162 $this->
name =
"beluga";
163 $this->
description = $langs->trans(
"DocumentModelBeluga");
164 $this->update_main_doc_field = 1;
169 $this->orientation =
'L';
170 if ($this->orientation ==
'L' || $this->orientation ==
'Landscape') {
171 $this->page_largeur = $formatarray[
'height'];
172 $this->page_hauteur = $formatarray[
'width'];
174 $this->page_largeur = $formatarray[
'width'];
175 $this->page_hauteur = $formatarray[
'height'];
177 $this->format = array($this->page_largeur, $this->page_hauteur);
183 $this->option_logo = 1;
184 $this->option_tva = 1;
187 $this->emetteur = $mysoc;
188 if (!$this->emetteur->country_code) {
189 $this->emetteur->country_code = substr($langs->defaultlang, -2);
193 if ($this->orientation ==
'L' || $this->orientation ==
'Landscape') {
194 $this->posxref = $this->marge_gauche + 1;
195 $this->posxdate = $this->marge_gauche + 105;
196 $this->posxsociety = $this->marge_gauche + 126;
197 $this->posxamountht = $this->marge_gauche + 190;
198 $this->posxamountttc = $this->marge_gauche + 215;
199 $this->posxstatut = $this->marge_gauche + 245;
201 $this->posxref = $this->marge_gauche + 1;
202 $this->posxdate = $this->marge_gauche + 25;
203 $this->posxsociety = $this->marge_gauche + 46;
204 $this->posxamountht = $this->marge_gauche + 110;
205 $this->posxamountttc = $this->marge_gauche + 135;
206 $this->posxstatut = $this->marge_gauche + 165;
208 if ($this->page_largeur < 210) {
209 $this->posxref -= 20;
210 $this->posxdate -= 20;
211 $this->posxsociete -= 20;
212 $this->posxamountht -= 20;
213 $this->posxamountttc -= 20;
214 $this->posstatut -= 20;
230 global $conf, $hookmanager, $langs, $user;
234 if (!is_object($outputlangs)) {
235 $outputlangs = $langs;
238 if (!empty($conf->global->MAIN_USE_FPDF)) {
239 $outputlangs->charset_output =
'ISO-8859-1';
243 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"projects"));
245 if ($conf->project->dir_output) {
249 $dir = $conf->project->dir_output;
250 if (!preg_match(
'/specimen/i', $objectref)) {
251 $dir .=
"/".$objectref;
253 $file = $dir.
"/".$objectref.
".pdf";
255 if (!file_exists($dir)) {
257 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
262 if (file_exists($dir)) {
264 if (!is_object($hookmanager)) {
265 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
268 $hookmanager->initHooks(array(
'pdfgeneration'));
269 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
271 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
276 $pdf->SetAutoPageBreak(1, 0);
278 $heightforinfotot = 40;
279 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
280 $heightforfooter = $this->marge_basse + 8;
281 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) {
282 $heightforfooter += 6;
285 if (class_exists(
'TCPDF')) {
286 $pdf->setPrintHeader(
false);
287 $pdf->setPrintFooter(
false);
291 if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
292 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
293 $tplidx = $pdf->importPage(1);
297 $task =
new Task($this->
db);
298 $tasksarray = array();
299 $tasksarray = $task->getTasksArray(0, 0, $object->id);
302 if (!$object->id > 0) {
303 $tasksarray = array_slice($tasksarray, 0, min(5, count($tasksarray)));
306 $object->lines = $tasksarray;
307 $nblines = count($object->lines);
311 $pdf->SetDrawColor(128, 128, 128);
313 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
314 $pdf->SetSubject($outputlangs->transnoentities(
"Project"));
315 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
316 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
317 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"Project"));
319 $pdf->SetCompression(
false);
322 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
325 $pdf->AddPage($this->orientation);
326 if (!empty($tplidx)) {
327 $pdf->useTemplate($tplidx);
330 $this->
_pagehead($pdf, $object, 1, $outputlangs);
331 $pdf->SetFont(
'',
'', $default_font_size - 1);
332 $pdf->MultiCell(0, 3,
'');
333 $pdf->SetTextColor(0, 0, 0);
336 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
338 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
341 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
350 $pdf->SetFont(
'',
'', $default_font_size - 1);
351 $pdf->writeHTMLCell(190, 3, $this->posxref - 1, $tab_top - 2,
dol_htmlentitiesbr($notetoshow), 0, 1);
352 $nexY = $pdf->GetY();
353 $height_note = $nexY - $tab_top;
356 $pdf->SetDrawColor(192, 192, 192);
357 $pdf->Rect($this->marge_gauche, $tab_top - 2, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 2);
359 $tab_height = $tab_height - $height_note;
360 $tab_top = $nexY + 6;
365 $heightoftitleline = 10;
366 $iniY = $tab_top + $heightoftitleline + 1;
367 $curY = $tab_top + $heightoftitleline + 1;
368 $nexY = $tab_top + $heightoftitleline + 1;
370 $listofreferent = array(
373 'title'=>
"ListProposalsAssociatedProject",
376 'datefieldname'=>
'datep',
377 'test'=>$conf->propal->enabled && $user->rights->propal->lire,
380 'name'=>
"CustomersOrders",
381 'title'=>
"ListOrdersAssociatedProject",
384 'datefieldname'=>
'date_commande',
385 'test'=>$conf->commande->enabled && $user->rights->commande->lire,
388 'name'=>
"CustomersInvoices",
389 'title'=>
"ListInvoicesAssociatedProject",
393 'datefieldname'=>
'datef',
394 'test'=>$conf->facture->enabled && $user->rights->facture->lire,
396 'invoice_predefined'=>array(
397 'name'=>
"PredefinedInvoices",
398 'title'=>
"ListPredefinedInvoicesAssociatedProject",
399 'class'=>
'FactureRec',
400 'table'=>
'facture_rec',
401 'datefieldname'=>
'datec',
402 'test'=>$conf->facture->enabled && $user->rights->facture->lire,
404 'order_supplier'=>array(
405 'name'=>
"SuppliersOrders",
406 'title'=>
"ListSupplierOrdersAssociatedProject",
407 'class'=>
'CommandeFournisseur',
408 'table'=>
'commande_fournisseur',
409 'datefieldname'=>
'date_commande',
410 'test'=>(
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (
isModEnabled(
"supplier_order") && $user->rights->supplier_order->lire),
412 'invoice_supplier'=>array(
413 'name'=>
"BillsSuppliers",
414 'title'=>
"ListSupplierInvoicesAssociatedProject",
415 'class'=>
'FactureFournisseur',
417 'table'=>
'facture_fourn',
418 'datefieldname'=>
'datef',
419 'test'=>(
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (
isModEnabled(
"supplier_invoice") && $user->rights->supplier_invoice->lire),
423 'title'=>
"ListContractAssociatedProject",
426 'datefieldname'=>
'date_contrat',
427 'test'=>$conf->contrat->enabled && $user->rights->contrat->lire,
429 'intervention'=>array(
430 'name'=>
"Interventions",
431 'title'=>
"ListFichinterAssociatedProject",
432 'class'=>
'Fichinter',
433 'table'=>
'fichinter',
434 'datefieldname'=>
'date_valid',
436 'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire,
437 'lang'=>
'interventions'),
439 'name'=>
"TripsAndExpenses",
440 'title'=>
"ListExpenseReportsAssociatedProject",
441 'class'=>
'Deplacement',
442 'table'=>
'deplacement',
443 'datefieldname'=>
'dated',
446 'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire,
448 'expensereport'=>array(
449 'name'=>
"ExpensesReports",
450 'title'=>
"ListExpenseReportsAssociatedProject",
451 'class'=>
'ExpenseReport',
452 'table'=>
'expensereport',
453 'datefieldname'=>
'dated',
456 'test'=>$conf->expensereport->enabled && $user->rights->expensereport->lire,
460 'title'=>
"ListActionsAssociatedProject",
461 'class'=>
'ActionComm',
462 'table'=>
'actioncomm',
463 'datefieldname'=>
'datep',
465 'test'=>$conf->agenda->enabled && $user->rights->agenda->allactions->read,
469 $hookmanager->initHooks(array(
'completeListOfReferent'));
470 $hookmanager->executeHooks(
'completeListOfReferent', [
'listofreferent'=>$listofreferent], $object, $action);
471 if (!empty($hookmanager->resArray)) {
472 $listofreferent = array_merge($listofreferent, $hookmanager->resArray);
475 foreach ($listofreferent as $key => $value) {
476 $title = $value[
'title'];
477 $classname = $value[
'class'];
478 $tablename = $value[
'table'];
479 $datefieldname = $value[
'datefieldname'];
480 $qualified = $value[
'test'];
481 $langstoload = $value[
'lang'];
482 $projectField = isset($value[
'project_field']) ? $value[
'project_field'] :
'fk_projet';
483 $langs->load($langstoload);
490 $elementarray = $object->get_element_list($key, $tablename, $datefieldname,
'',
'', $projectField);
492 $num = count($elementarray);
494 $nexY = $pdf->GetY() + 5;
497 $pdf->SetFont(
'',
'', $default_font_size - 1);
498 $pdf->SetTextColor(0, 0, 0);
500 $pdf->SetXY($this->posxref, $curY);
501 $pdf->MultiCell($this->posxstatut - $this->posxref, 3, $outputlangs->transnoentities($title), 0,
'L');
503 $selectList = $formproject->select_element($tablename, $object->thirdparty->id,
'', -2, $projectField);
504 $nexY = $pdf->GetY() + 1;
506 $pdf->SetXY($this->posxref, $curY);
507 $pdf->MultiCell($this->posxdate - $this->posxref, 3, $outputlangs->transnoentities(
"Ref"), 1,
'L');
508 $pdf->SetXY($this->posxdate, $curY);
509 $pdf->MultiCell($this->posxsociety - $this->posxdate, 3, $outputlangs->transnoentities(
"Date"), 1,
'C');
510 $pdf->SetXY($this->posxsociety, $curY);
511 $titlethirdparty = $outputlangs->transnoentities(
"ThirdParty");
512 if ($classname ==
'ExpenseReport') {
513 $titlethirdparty = $langs->trans(
"User");
515 $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $titlethirdparty, 1,
'L');
516 if (empty($value[
'disableamount'])) {
517 $pdf->SetXY($this->posxamountht, $curY);
518 $pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, $outputlangs->transnoentities(
"AmountHTShort"), 1,
'R');
519 $pdf->SetXY($this->posxamountttc, $curY);
520 $pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, $outputlangs->transnoentities(
"AmountTTCShort"), 1,
'R');
522 $pdf->SetXY($this->posxamountht, $curY);
523 $pdf->MultiCell($this->posxstatut - $this->posxamountht, 3,
"", 1,
'R');
525 $pdf->SetXY($this->posxstatut, $curY);
526 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities(
"Status"), 1,
'R');
528 if (is_array($elementarray) && count($elementarray) > 0) {
529 $nexY = $pdf->GetY();
533 $num = count($elementarray);
536 for ($i = 0; $i < $num; $i++) {
538 $pdf->SetFont(
'',
'', $default_font_size - 1);
539 $pdf->SetTextColor(0, 0, 0);
541 $pdf->setTopMargin($tab_top_newpage);
542 $pdf->setPageOrientation($this->orientation, 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
543 $pageposbefore = $pdf->getPage();
546 $idofelement = $elementarray[$i];
547 if ($classname ==
'ExpenseReport') {
550 $expensereportline->fetch($idofelement);
551 $idofelement = $expensereportline->fk_expensereport;
554 $element =
new $classname($this->
db);
555 $element->fetch($idofelement);
556 $element->fetch_thirdparty();
559 $qualifiedfortotal =
true;
560 if ($key ==
'invoice') {
561 if ($element->close_code ==
'replaced') {
562 $qualifiedfortotal =
false;
566 $showpricebeforepagebreak = 1;
568 $pdf->startTransaction();
570 $pdf->SetXY($this->posxref, $curY);
571 $pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1,
'L');
572 $pageposafter = $pdf->getPage();
573 if ($pageposafter > $pageposbefore) {
574 $pdf->rollbackTransaction(
true);
575 $pageposafter = $pageposbefore;
577 $pdf->setPageOrientation($this->orientation, 1, $heightforfooter);
579 $pdf->SetXY($this->posxref, $curY);
580 $posybefore = $pdf->GetY();
581 $pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1,
'L');
582 $pageposafter = $pdf->getPage();
583 $posyafter = $pdf->GetY();
584 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
585 if ($i == ($num - 1)) {
586 $pdf->AddPage($this->orientation,
'',
true);
587 if (!empty($tplidx)) {
588 $pdf->useTemplate($tplidx);
591 $this->
_pagehead($pdf, $object, 0, $outputlangs);
593 $pdf->setPage($pageposafter + 1);
599 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
600 $showpricebeforepagebreak = 1;
602 $showpricebeforepagebreak = 0;
605 $forcedesconsamepage = 1;
606 if ($forcedesconsamepage) {
607 $pdf->rollbackTransaction(
true);
608 $pageposafter = $pageposbefore;
609 $pdf->setPageOrientation($this->orientation, 1, $heightforfooter);
611 $pdf->AddPage($this->orientation,
'',
true);
612 if (!empty($tplidx)) {
613 $pdf->useTemplate($tplidx);
616 $this->
_pagehead($pdf, $object, 0, $outputlangs);
618 $pdf->setPage($pageposafter + 1);
619 $pdf->SetFont(
'',
'', $default_font_size - 1);
620 $pdf->MultiCell(0, 3,
'');
621 $pdf->SetTextColor(0, 0, 0);
623 $pdf->setPageOrientation($this->orientation, 1, $heightforfooter);
624 $curY = $tab_top_newpage + $heightoftitleline + 1;
627 $pdf->SetXY($this->posxref, $curY);
628 $posybefore = $pdf->GetY();
629 $pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1,
'L');
630 $pageposafter = $pdf->getPage();
631 $posyafter = $pdf->GetY();
637 $pdf->commitTransaction();
639 $posYAfterDescription = $pdf->GetY();
641 $nexY = $pdf->GetY();
642 $pageposafter = $pdf->getPage();
643 $pdf->setPage($pageposbefore);
644 $pdf->setTopMargin($this->marge_haute);
645 $pdf->setPageOrientation($this->orientation, 1, 0);
648 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
650 $pdf->setPage($pageposafter);
651 $curY = $tab_top_newpage + $heightoftitleline + 1;
654 $pdf->SetFont(
'',
'', $default_font_size - 1);
657 if ($tablename ==
'commande_fournisseur' || $tablename ==
'supplier_order') {
658 $date = $element->date_commande;
660 $date = $element->date;
662 $date = $element->datep;
665 $date = $element->date_contrat;
668 $date = $element->datev;
672 $pdf->SetXY($this->posxdate, $curY);
673 $pdf->MultiCell($this->posxsociety - $this->posxdate, 3,
dol_print_date($date,
'day'), 1,
'C');
675 $pdf->SetXY($this->posxsociety, $curY);
676 if ($classname ==
'ExpenseReport') {
677 $fuser =
new User($this->
db);
678 $fuser->fetch($element->fk_user_author);
679 $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $fuser->getFullName($outputlangs), 1,
'L');
681 $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, (is_object($element->thirdparty) ? $element->thirdparty->name :
''), 1,
'L');
685 if (empty($value[
'disableamount'])) {
686 $pdf->SetXY($this->posxamountht, $curY);
687 $pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ?
price($element->total_ht) :
''), 1,
'R');
688 $pdf->SetXY($this->posxamountttc, $curY);
689 $pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ?
price($element->total_ttc) :
''), 1,
'R');
691 $pdf->SetXY($this->posxamountht, $curY);
692 if ($key ==
'agenda') {
693 $textforamount =
dol_trunc($element->label, 26);
694 $pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, $textforamount, 1,
'L');
696 $pdf->MultiCell($this->posxstatut - $this->posxamountht, 3,
"", 1,
'R');
703 $outputstatut = $element->getLibStatut(1, $element->getSommePaiement());
705 $outputstatut = $element->getLibStatut(1);
707 $pdf->SetXY($this->posxstatut, $curY);
708 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputstatut, 1,
'R',
false, 1,
'',
'',
true, 0,
true);
710 if ($qualifiedfortotal) {
711 $total_ht = $total_ht + $element->total_ht;
712 $total_ttc = $total_ttc + $element->total_ttc;
714 $nexY = $pdf->GetY();
718 if (empty($value[
'disableamount'])) {
720 $pdf->SetXY($this->posxref, $curY);
721 $pdf->MultiCell($this->posxamountttc - $this->posxref, 3,
"TOTAL", 1,
'L');
722 $pdf->SetXY($this->posxamountht, $curY);
723 $pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ?
price($total_ht) :
''), 1,
'R');
724 $pdf->SetXY($this->posxamountttc, $curY);
725 $pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ?
price($total_ttc) :
''), 1,
'R');
726 $pdf->SetXY($this->posxstatut, $curY);
727 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities(
"Nb").
" ".$num, 1,
'L');
729 $nexY = $pdf->GetY() + 5;
737 while ($pagenb < $pageposafter) {
738 $pdf->setPage($pagenb);
739 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
741 $pdf->setPage($pagenb);
742 $pdf->setPageOrientation($this->orientation, 1, 0);
744 $this->
_pagehead($pdf, $object, 0, $outputlangs);
746 if (!empty($tplidx)) {
747 $pdf->useTemplate($tplidx);
753 $this->
_pagefoot($pdf, $object, $outputlangs);
754 if (method_exists($pdf,
'AliasNbPages')) {
755 $pdf->AliasNbPages();
760 $pdf->Output($file,
'F');
763 $hookmanager->initHooks(array(
'pdfgeneration'));
764 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
766 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
768 $this->error = $hookmanager->error;
769 $this->errors = $hookmanager->errors;
772 if (!empty($conf->global->MAIN_UMASK)) {
773 @chmod($file, octdec($conf->global->MAIN_UMASK));
776 $this->result = array(
'fullpath'=>$file);
780 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
784 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"PROJECT_OUTPUTDIR");
802 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
804 $heightoftitleline = 10;
808 $pdf->SetDrawColor(128, 128, 128);
811 $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height);
814 $pdf->line($this->marge_gauche, $tab_top + $heightoftitleline, $this->page_largeur - $this->marge_droite, $tab_top + $heightoftitleline);
816 $pdf->SetTextColor(0, 0, 0);
817 $pdf->SetFont(
'',
'', $default_font_size);
830 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
832 global $langs, $conf, $mysoc;
838 $pdf->SetTextColor(0, 0, 60);
839 $pdf->SetFont(
'',
'B', $default_font_size + 3);
841 $posx = $this->page_largeur - $this->marge_droite - 100;
842 $posy = $this->marge_haute;
844 $pdf->SetXY($this->marge_gauche, $posy);
847 $logo = $conf->mycompany->dir_output.
'/logos/'.$mysoc->logo;
849 if (is_readable($logo)) {
851 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
853 $pdf->SetTextColor(200, 0, 0);
854 $pdf->SetFont(
'',
'B', $default_font_size - 2);
855 $pdf->MultiCell(100, 3, $langs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
856 $pdf->MultiCell(100, 3, $langs->transnoentities(
"ErrorGoToModuleSetup"), 0,
'L');
859 $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0,
'L');
862 $pdf->SetFont(
'',
'B', $default_font_size + 3);
863 $pdf->SetXY($posx, $posy);
864 $pdf->SetTextColor(0, 0, 60);
865 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Project").
" ".$outputlangs->convToOutputCharset($object->ref),
'',
'R');
866 $pdf->SetFont(
'',
'', $default_font_size + 2);
869 $pdf->SetXY($posx, $posy);
870 $pdf->SetTextColor(0, 0, 60);
871 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"DateStart").
" : ".
dol_print_date($object->date_start,
'day',
false, $outputlangs,
true),
'',
'R');
874 $pdf->SetXY($posx, $posy);
875 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"DateEnd").
" : ".
dol_print_date($object->date_end,
'day',
false, $outputlangs,
true),
'',
'R');
877 if (is_object($object->thirdparty)) {
879 $pdf->SetXY($posx, $posy);
880 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"ThirdParty").
" : ".$object->thirdparty->getFullName($outputlangs),
'',
'R');
883 $pdf->SetTextColor(0, 0, 60);
896 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
898 $showdetails =
getDolGlobalInt(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
899 return pdf_pagefoot($pdf, $outputlangs,
'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
Superclass for invoices classes.
Class of expense report details lines.
Parent class for projects models.
Class to manage Dolibarr users.
Class to manage generation of project document Beluga.
write_file($object, $outputlangs)
Fonction generant le projet sur le disque.
__construct($db)
Constructor.
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
Show table for lines.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
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...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
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...
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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.
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...
isModEnabled($module)
Is Dolibarr module enabled.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
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_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0)
Return array of possible substitutions for PDF content (without external module substitutions).
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
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.
$conf db
API class for accounts.