dolibarr 21.0.0-alpha
pdf_storm.modules.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
4 * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
5 * Copyright (C) 2008 Chiptronik
6 * Copyright (C) 2011-2021 Philippe Grand <philippe.grand@atoo-net.com>
7 * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
8 * Copyright (C) 2020 John BOTELLA
9 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
10 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
11 * Copyright (C) 2024 Nick Fragoulis
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <https://www.gnu.org/licenses/>.
25 * or see https://www.gnu.org/
26 */
27
34require_once DOL_DOCUMENT_ROOT.'/core/modules/delivery/modules_delivery.php';
35require_once DOL_DOCUMENT_ROOT.'/delivery/class/delivery.class.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
37require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
38
39
44{
48 public $db;
49
53 public $name;
54
58 public $description;
59
63 public $update_main_doc_field;
64
68 public $type;
69
74 public $version = 'dolibarr';
75
76
82 public function __construct($db)
83 {
84 global $langs, $mysoc;
85
86 // Translations
87 $langs->loadLangs(array("main", "bills", "sendings", "companies"));
88
89 $this->db = $db;
90 $this->name = "Storm";
91 $this->description = $langs->trans("DocumentModelStorm");
92 $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
93
94 // Page size for A4 format
95 $this->type = 'pdf';
96 $formatarray = pdf_getFormat();
97 $this->page_largeur = $formatarray['width'];
98 $this->page_hauteur = $formatarray['height'];
99 $this->format = array($this->page_largeur, $this->page_hauteur);
100 $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10);
101 $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10);
102 $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10);
103 $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10);
104 $this->corner_radius = getDolGlobalInt('MAIN_PDF_FRAME_CORNER_RADIUS', 0);
105 $this->option_logo = 1; // Display logo FAC_PDF_LOGO
106 $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
107
108 if ($mysoc === null) {
109 dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR);
110 return;
111 }
112
113 // Get source company
114 $this->emetteur = $mysoc;
115 if (empty($this->emetteur->country_code)) {
116 $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
117 }
118 }
119
120
121 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
133 public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
134 {
135 // phpcs:enable
136 global $user, $langs, $conf, $mysoc, $hookmanager;
137
138 if (!is_object($outputlangs)) {
139 $outputlangs = $langs;
140 }
141 // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
142 if (getDolGlobalString('MAIN_USE_FPDF')) {
143 $outputlangs->charset_output = 'ISO-8859-1';
144 }
145
146 // Load translation files required by the page
147 $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "sendings", "deliveries"));
148
149 if ($conf->expedition->dir_output) {
150 $object->fetch_thirdparty();
151
152 // Definition of $dir and $file
153 if ($object->specimen) {
154 $dir = $conf->expedition->dir_output."/receipt";
155 $file = $dir."/SPECIMEN.pdf";
156 } else {
157 $objectref = dol_sanitizeFileName($object->ref);
158 $dir = $conf->expedition->dir_output."/receipt/".$objectref;
159 $file = $dir."/".$objectref.".pdf";
160 }
161
162 if (!file_exists($dir)) {
163 if (dol_mkdir($dir) < 0) {
164 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
165 return 0;
166 }
167 }
168
169 if (file_exists($dir)) {
170 // Add pdfgeneration hook
171 if (!is_object($hookmanager)) {
172 include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
173 $hookmanager = new HookManager($this->db);
174 }
175 $hookmanager->initHooks(array('pdfgeneration'));
176 $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
177 global $action;
178 $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
179
180 $nblines = count($object->lines);
181
182
183 // Loop on each lines to detect if there is at least one image to show
184 $realpatharray = array();
185 $this->atleastonephoto = false;
186 if (getDolGlobalString('MAIN_GENERATE_DELIVERY_WITH_PICTURE')) {
187 $objphoto = new Product($this->db);
188
189 for ($i = 0; $i < $nblines; $i++) {
190 if (empty($object->lines[$i]->fk_product)) {
191 continue;
192 }
193
194 $objphoto->fetch($object->lines[$i]->fk_product);
195 $pdir = array();
196
197 if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) {
198 $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/";
199 $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/';
200 } else {
201 $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default
202 $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative
203 }
204
205 $arephoto = false;
206 foreach ($pdir as $midir) {
207 if (!$arephoto) {
208 $dir = $conf->product->dir_output.'/'.$midir;
209
210 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
211 if (!getDolGlobalInt('CAT_HIGH_QUALITY_IMAGES')) { // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
212 if ($obj['photo_vignette']) {
213 $filename = $obj['photo_vignette'];
214 } else {
215 $filename = $obj['photo'];
216 }
217 } else {
218 $filename = $obj['photo'];
219 }
220
221 $realpath = $dir.$filename;
222 $arephoto = true;
223 $this->atleastonephoto = true;
224 }
225 }
226 }
227
228 if ($realpath && $arephoto) {
229 $realpatharray[$i] = $realpath;
230 }
231 }
232 }
233
234
235 // Create pdf instance
236 $pdf = pdf_getInstance($this->format);
237 $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
238 $heightforinfotot = 30; // Height reserved to output the info and total part
239 $heightforfreetext = getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5); // Height reserved to output the free text on last page
240 $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
241 if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) {
242 $heightforfooter += 6;
243 }
244 $pdf->SetAutoPageBreak(1, 0);
245
246 if (class_exists('TCPDF')) {
247 $pdf->setPrintHeader(false);
248 $pdf->setPrintFooter(false);
249 }
250 $pdf->SetFont(pdf_getPDFFont($outputlangs));
251 // Set path to the background PDF File
252 if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) {
253 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
254 $tplidx = $pdf->importPage(1);
255 }
256
257 // We get the shipment that is the origin of delivery receipt
258 $expedition = new Expedition($this->db);
259 $result = $expedition->fetch($object->origin_id);
260 // Now we get the order that is origin of shipment
261 $commande = new Commande($this->db);
262 if ($expedition->origin == 'commande') {
263 $commande->fetch($expedition->origin_id);
264 }
265 $object->commande = $commande; // We set order of shipment onto delivery.
266 $object->commande->loadExpeditions();
267
268
269 $pdf->Open();
270 $pagenb = 0;
271 $pdf->SetDrawColor(128, 128, 128);
272
273 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
274 $pdf->SetSubject($outputlangs->transnoentities("DeliveryOrder"));
275 $pdf->SetCreator("Dolibarr ".DOL_VERSION);
276 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
277 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder"));
278 if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
279 $pdf->SetCompression(false);
280 }
281
282 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
283 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
284
285
286 // New page
287 $pdf->AddPage();
288 if (!empty($tplidx)) {
289 $pdf->useTemplate($tplidx);
290 }
291 $pagenb++;
292 $this->_pagehead($pdf, $object, 1, $outputlangs);
293 $pdf->SetFont('', '', $default_font_size - 1);
294 $pdf->MultiCell(0, 3, ''); // Set interline to 3
295 $pdf->SetTextColor(0, 0, 0);
296
297 $tab_top = 90;
298 $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
299
300 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
301
302 $this->posxdesc = $this->marge_gauche + 1;
303
304 // Incoterm
305 $height_incoterms = 0;
306 if (isModEnabled('incoterm')) {
307 $desc_incoterms = $object->getIncotermsForPDF();
308 if ($desc_incoterms) {
309 $tab_top -= 2;
310
311 $pdf->SetFont('', '', $default_font_size - 1);
312 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
313 $nexY = $pdf->GetY();
314 $height_incoterms = $nexY - $tab_top;
315
316 // Rect takes a length in 3rd parameter
317 $pdf->SetDrawColor(192, 192, 192);
318 $pdf->RoundedRect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 3, $this->corner_radius, '1234', 'D');
319
320 $tab_top = $nexY + 6;
321 $height_incoterms += 4;
322 }
323 }
324
325 // display note
326 $notetoshow = empty($object->note_public) ? '' : $object->note_public;
327
328 // Extrafields in note
329 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
330 if (!empty($extranote)) {
331 $notetoshow = dol_concatdesc($notetoshow, $extranote);
332 }
333
334 if (!empty($notetoshow)) {
335 $tab_top = 88 + $height_incoterms;
336
337 $pdf->SetFont('', '', $default_font_size - 1);
338 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
339 $nexY = $pdf->GetY();
340 $height_note = $nexY - $tab_top;
341
342 // Rect takes a length in 3rd parameter
343 $pdf->SetDrawColor(192, 192, 192);
344 $pdf->RoundedRect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 2, $this->corner_radius, '1234', 'D');
345
346 $tab_height -= $height_note;
347 $tab_top = $nexY + 6;
348 } else {
349 $height_note = 0;
350 }
351
352 // Use new auto column system
353 $this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
354
355 // Table simulation to know the height of the title line
356 $pdf->startTransaction();
357 $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, 0);
358 $pdf->rollbackTransaction(true);
359
360 $iniY = $tab_top + $this->tabTitleHeight + 2;
361 $curY = $tab_top + $this->tabTitleHeight + 2;
362 $nexY = $tab_top + $this->tabTitleHeight + 2;
363
364 // Loop on each lines
365 for ($i = 0; $i < $nblines; $i++) {
366 // Fetch optionals
367 if (empty($object->lines[$i]->array_options)) {
368 $object->lines[$i]->fetch_optionals();
369 }
370
371 $curY = $nexY;
372 $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
373 $pdf->SetTextColor(0, 0, 0);
374
375 // Define size of image if we need it
376 $imglinesize = array();
377 if (!empty($realpatharray[$i])) {
378 $imglinesize = pdf_getSizeForImage($realpatharray[$i]);
379 }
380
381
382 $pdf->setTopMargin($tab_top_newpage);
383 $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
384 $pageposbefore = $pdf->getPage();
385
386 // Description of product line
387 $curX = $this->posxdesc - 1;
388
389 $showpricebeforepagebreak = 1;
390
391 $posYAfterImage = 0;
392 $posYAfterDescription = 0;
393 if ($this->getColumnStatus('photo')) {
394 // We start with Photo of product line
395 if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page
396 $pdf->AddPage('', '', true);
397 if (!empty($tplidx)) {
398 $pdf->useTemplate($tplidx);
399 }
400 //if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
401 $pdf->setPage($pageposbefore + 1);
402
403 $curY = $tab_top_newpage;
404
405 // Allows data in the first page if description is long enough to break in multiples pages
406 if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) {
407 $showpricebeforepagebreak = 1;
408 } else {
409 $showpricebeforepagebreak = 0;
410 }
411 }
412
413
414 if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) {
415 $pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
416 // $pdf->Image does not increase value return by getY, so we save it manually
417 $posYAfterImage = $curY + $imglinesize['height'];
418 }
419 }
420
421
422 // Description of product line
423 if ($this->getColumnStatus('desc')) {
424 $pdf->startTransaction();
425 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
426 $pageposafter = $pdf->getPage();
427 if ($pageposafter > $pageposbefore) { // There is a pagebreak
428 $pdf->rollbackTransaction(true);
429 $pageposafter = $pageposbefore;
430 //print $pageposafter.'-'.$pageposbefore;exit;
431 $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
432 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 4, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
433 $posyafter = $pdf->GetY();
434 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text
435 if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page
436 $pdf->AddPage('', '', true);
437 if (!empty($tplidx)) {
438 $pdf->useTemplate($tplidx);
439 }
440 if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
441 $this->_pagehead($pdf, $object, 0, $outputlangs);
442 }
443 $pdf->setPage($pageposafter + 1);
444 }
445 } else {
446 // We found a page break
447 // Allows data in the first page if description is long enough to break in multiples pages
448 if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) {
449 $showpricebeforepagebreak = 1;
450 } else {
451 $showpricebeforepagebreak = 0;
452 }
453 }
454 } else { // No pagebreak
455 $pdf->commitTransaction();
456 }
457
458 $posYAfterDescription = $pdf->GetY();
459 }
460
461 $nexY = $pdf->GetY();
462 $pageposafter = $pdf->getPage();
463 $pdf->setPage($pageposbefore);
464 $pdf->setTopMargin($this->marge_haute);
465 $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
466
467 // We suppose that a too long description is moved completely on next page
468 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
469 $pdf->setPage($pageposafter);
470 $curY = $tab_top_newpage;
471 }
472
473 $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par default
474
475
476 // Quantity
477 if ($this->getColumnStatus('qty_shipped')) {
478 $this->printStdColumnContent($pdf, $curY, 'qty_shipped', $object->lines[$i]->qty_shipped);
479 $nexY = max($pdf->GetY(), $nexY);
480 }
481
482 // Remaining to ship
483 if ($this->getColumnStatus('qty_remaining')) {
484 $qtyRemaining = $object->lines[$i]->qty_asked - $object->commande->expeditions[$object->lines[$i]->fk_origin_line];
485 $this->printStdColumnContent($pdf, $curY, 'qty_remaining', $qtyRemaining);
486 $nexY = max($pdf->GetY(), $nexY);
487 }
488
489 $nexY = max($nexY, $posYAfterImage);
490
491 // Extrafields
492 if (!empty($object->lines[$i]->array_options)) {
493 foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
494 if ($this->getColumnStatus($extrafieldColKey)) {
495 $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs);
496 $this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue);
497 $nexY = max($pdf->GetY(), $nexY);
498 }
499 }
500 }
501
502 // Add line
503 if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) {
504 $pdf->setPage($pageposafter);
505 $pdf->SetLineStyle(array('dash' => '1,1', 'color' => array(80, 80, 80)));
506 //$pdf->SetDrawColor(190,190,200);
507 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
508 $pdf->SetLineStyle(array('dash' => 0));
509 }
510
511 $nexY += 2; // Add space between lines
512
513 // Detect if some page were added automatically and output _tableau for past pages
514 while ($pagenb < $pageposafter) {
515 $pdf->setPage($pagenb);
516 if ($pagenb == 1) {
517 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
518 } else {
519 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
520 }
521 $this->_pagefoot($pdf, $object, $outputlangs, 1);
522 $pagenb++;
523 $pdf->setPage($pagenb);
524 $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
525 if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
526 $this->_pagehead($pdf, $object, 0, $outputlangs);
527 }
528 if (!empty($tplidx)) {
529 $pdf->useTemplate($tplidx);
530 }
531 }
532 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { // @phan-suppress-current-line PhanUndeclaredProperty
533 if ($pagenb == 1) {
534 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
535 } else {
536 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
537 }
538 $this->_pagefoot($pdf, $object, $outputlangs, 1);
539 // New page
540 $pdf->AddPage();
541 if (!empty($tplidx)) {
542 $pdf->useTemplate($tplidx);
543 }
544 $pagenb++;
545 if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
546 $this->_pagehead($pdf, $object, 0, $outputlangs);
547 }
548 }
549 }
550
551 // Show square
552 if ($pagenb == 1) {
553 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
554 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
555 } else {
556 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
557 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
558 }
559
560 // Affiche zone infos
561 $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
562
563 // Pied de page
564 $this->_pagefoot($pdf, $object, $outputlangs);
565
566 if (method_exists($pdf, 'AliasNbPages')) {
567 $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
568 }
569
570 $pdf->Close();
571
572 $pdf->Output($file, 'F');
573
574 // Add pdfgeneration hook
575 if (!is_object($hookmanager)) {
576 include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
577 $hookmanager = new HookManager($this->db);
578 }
579 $hookmanager->initHooks(array('pdfgeneration'));
580 $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
581 global $action;
582 $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
583 if ($reshook < 0) {
584 $this->error = $hookmanager->error;
585 $this->errors = $hookmanager->errors;
586 }
587
588 dolChmod($file);
589
590 $this->result = array('fullpath' => $file);
591
592 return 1; // No error
593 } else {
594 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
595 return 0;
596 }
597 }
598
599 $this->error = $langs->transnoentities("ErrorConstantNotDefined", "LIVRAISON_OUTPUTDIR");
600 return 0;
601 }
602
603 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
604 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
614 protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
615 {
616 // phpcs:enable
617 global $conf, $mysoc;
618 $default_font_size = pdf_getPDFFontSize($outputlangs);
619
620 $pdf->SetFont('', '', $default_font_size);
621 $pdf->SetXY($this->marge_gauche, $posy);
622
623 $larg_sign = ($this->page_largeur - $this->marge_gauche - $this->marge_droite) / 3;
624 $pdf->RoundedRect($this->marge_gauche, $posy + 1, $larg_sign, 25, $this->corner_radius, '1234', 'D');
625 $pdf->SetXY($this->marge_gauche + 2, $posy + 2);
626 $pdf->MultiCell($larg_sign, 2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":", '', 'L');
627
628 $pdf->RoundedRect(2 * $larg_sign + $this->marge_gauche, $posy + 1, $larg_sign, 25, $this->corner_radius, '1234', 'D');
629 $pdf->SetXY(2 * $larg_sign + $this->marge_gauche + 2, $posy + 2);
630 $pdf->MultiCell($larg_sign, 2, $outputlangs->trans("ForCustomer").':', '', 'L');
631 }
632
633
634 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
647 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
648 {
649 global $conf;
650
651 // Force to disable hidetop and hidebottom
652 $hidebottom = 0;
653 if ($hidetop) {
654 $hidetop = -1;
655 }
656
657 $default_font_size = pdf_getPDFFontSize($outputlangs);
658
659 // Amount in (at tab_top - 1)
660 $pdf->SetTextColor(0, 0, 0);
661 $pdf->SetFont('', '', $default_font_size - 2);
662
663 if (empty($hidetop)) {
664 //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
665 if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
666 $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
667 }
668 }
669
670 $pdf->SetDrawColor(128, 128, 128);
671 $pdf->SetFont('', '', $default_font_size - 1);
672
673 // Output Rect
674 $this->printRoundedRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $this->corner_radius, $hidetop, $hidebottom, 'D'); // Rect takes a length in 3rd parameter and 4th parameter
675
676
677 $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
678
679 if (empty($hidetop)) {
680 $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter
681 }
682 }
683
684 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
694 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
695 {
696 global $conf, $langs;
697
698 $default_font_size = pdf_getPDFFontSize($outputlangs);
699
700 pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
701
702 // Show Draft Watermark
703 if ($object->statut == 0 && getDolGlobalString('COMMANDE_DRAFT_WATERMARK')) {
704 pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', getDolGlobalString('COMMANDE_DRAFT_WATERMARK'));
705 }
706
707 $pdf->SetTextColor(0, 0, 60);
708 $pdf->SetFont('', 'B', $default_font_size + 3);
709
710 $posy = $this->marge_haute;
711 $posx = $this->page_largeur - $this->marge_droite - 100;
712
713 $pdf->SetXY($this->marge_gauche, $posy);
714
715 // Logo
716 $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
717 if ($this->emetteur->logo) {
718 if (is_readable($logo)) {
719 $height = pdf_getHeightForLogo($logo);
720 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
721 } else {
722 $pdf->SetTextColor(200, 0, 0);
723 $pdf->SetFont('', 'B', $default_font_size - 2);
724 $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
725 $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
726 }
727 } else {
728 $pdf->MultiCell(100, 4, $this->emetteur->name, 0, 'L');
729 }
730
731 $pdf->SetFont('', 'B', $default_font_size + 2);
732 $pdf->SetXY($posx, $posy);
733 $pdf->SetTextColor(0, 0, 60);
734 $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DeliveryOrder")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
735
736 $pdf->SetFont('', '', $default_font_size + 2);
737
738 $posy += 5;
739 $pdf->SetXY($posx, $posy);
740 $pdf->SetTextColor(0, 0, 60);
741 if ($object->date_valid) {
742 $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date_delivery, "%d %b %Y", false, $outputlangs, true), '', 'R');
743 } else {
744 $pdf->SetTextColor(255, 0, 0);
745 $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DeliveryNotValidated"), '', 'R');
746 $pdf->SetTextColor(0, 0, 60);
747 }
748
749 if ($object->thirdparty->code_client) {
750 $posy += 5;
751 $pdf->SetXY($posx, $posy);
752 $pdf->SetTextColor(0, 0, 60);
753 $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
754 }
755
756 $pdf->SetTextColor(0, 0, 60);
757
758 $posy += 2;
759
760 // Show list of linked objects
761 $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
762
763 if ($showaddress) {
764 // Sender properties
765 $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
766
767 // Show sender
768 $posy = 42;
769 $posx = $this->marge_gauche;
770 if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) {
771 $posx = $this->page_largeur - $this->marge_droite - 80;
772 }
773 $hautcadre = 40;
774
775 // Show sender frame
776 $pdf->SetTextColor(0, 0, 0);
777 $pdf->SetFont('', '', $default_font_size - 2);
778 $pdf->SetXY($posx, $posy - 5);
779 $pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, 'L');
780 $pdf->SetXY($posx, $posy);
781 $pdf->SetFillColor(230, 230, 230);
782 $pdf->RoundedRect($posx, $posy, 82, $hautcadre, $this->corner_radius, '1234', 'F');
783 $pdf->SetTextColor(0, 0, 60);
784
785 // Show sender name
786 $pdf->SetXY($posx + 2, $posy + 3);
787 $pdf->SetFont('', 'B', $default_font_size);
788 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
789 $posy = $pdf->getY();
790
791 // Show sender information
792 $pdf->SetXY($posx + 2, $posy);
793 $pdf->SetFont('', '', $default_font_size - 1);
794 $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
795
796 // Client destinataire
797 $posy = 42;
798 $posx = 102;
799 if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) {
800 $posx = $this->marge_gauche;
801 }
802 $pdf->SetTextColor(0, 0, 0);
803 $pdf->SetFont('', '', $default_font_size - 2);
804 $pdf->SetXY($posx, $posy - 5);
805 $pdf->MultiCell(80, 5, $outputlangs->transnoentities("DeliveryAddress"), 0, 'L');
806
807 // If SHIPPING contact defined on order, we use it
808 $usecontact = false;
809 $arrayidcontact = $object->commande->getIdContact('external', 'SHIPPING');
810 if (count($arrayidcontact) > 0) {
811 $usecontact = true;
812 $result = $object->fetch_contact($arrayidcontact[0]);
813 }
814
815 // Recipient name
816 if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || getDolGlobalString('MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
817 $thirdparty = $object->contact;
818 } else {
819 $thirdparty = $object->thirdparty;
820 }
821
822 $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
823
824 $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), ($usecontact ? 1 : 0), 'target', $object);
825
826 // Show recipient
827 $widthrecbox = 100;
828 if ($this->page_largeur < 210) {
829 $widthrecbox = 84; // To work with US executive format
830 }
831 $posy = 42;
832 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
833 if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) {
834 $posx = $this->marge_gauche;
835 }
836
837 // Show recipient frame
838 $pdf->SetTextColor(0, 0, 0);
839 $pdf->SetFont('', '', $default_font_size - 2);
840 $pdf->SetXY($posx + 2, $posy - 5);
841 //$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L');
842 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius, '1234', 'D');
843
844 // Show recipient name
845 $pdf->SetXY($posx + 2, $posy + 3);
846 $pdf->SetFont('', 'B', $default_font_size);
847 $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
848
849 $posy = $pdf->getY();
850
851 // Show recipient information
852 $pdf->SetFont('', '', $default_font_size - 1);
853 $pdf->SetXY($posx + 2, $posy);
854 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
855 }
856
857 $pdf->SetTextColor(0, 0, 60);
858
859 return 0;
860 }
861
862 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
872 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
873 {
874 $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
875 return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
876 }
877
878
879
890 public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
891 {
892 global $conf, $hookmanager;
893
894 // Default field style for content
895 $this->defaultContentsFieldsStyle = array(
896 'align' => 'R', // R,C,L
897 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
898 );
899
900 // Default field style for content
901 $this->defaultTitlesFieldsStyle = array(
902 'align' => 'C', // R,C,L
903 'padding' => array(0.5, 0, 0.5, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
904 );
905
906 /*
907 * For example
908 $this->cols['theColKey'] = array(
909 'rank' => $rank, // int : use for ordering columns
910 'width' => 20, // the column width in mm
911 'title' => array(
912 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
913 'label' => ' ', // the final label : used fore final generated text
914 'align' => 'L', // text alignment : R,C,L
915 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
916 ),
917 'content' => array(
918 'align' => 'L', // text alignment : R,C,L
919 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
920 ),
921 );
922 */
923
924 $rank = 0; // do not use negative rank
925 $this->cols['desc'] = array(
926 'rank' => $rank,
927 'width' => false, // only for desc
928 'status' => true,
929 'title' => array(
930 'textkey' => 'Designation', // use lang key is useful in somme case with module
931 'align' => 'L',
932 // 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
933 // 'label' => ' ', // the final label
934 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
935 ),
936 'content' => array(
937 'align' => 'L',
938 ),
939 );
940
941 $rank += 10;
942 $this->cols['photo'] = array(
943 'rank' => $rank,
944 'width' => getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20), // in mm
945 'status' => false,
946 'title' => array(
947 'textkey' => 'Photo',
948 'label' => ' '
949 ),
950 'content' => array(
951 'padding' => array(0, 0, 0, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
952 ),
953 'border-left' => false, // remove left line separator
954 );
955
956 if (getDolGlobalString('MAIN_GENERATE_DELIVERY_WITH_PICTURE') && !empty($this->atleastonephoto)) {
957 $this->cols['photo']['status'] = true;
958 }
959
960
961 $rank += 10;
962 $this->cols['Comments'] = array(
963 'rank' => $rank,
964 'width' => 50, // in mm
965 'status' => true,
966 'title' => array(
967 'textkey' => 'Comments'
968 ),
969 'border-left' => true, // add left line separator
970 );
971
972 // $rank += 10;
973 // $this->cols['weight'] = array(
974 // 'rank' => $rank,
975 // 'width' => 30, // in mm
976 // 'status' => false,
977 // 'title' => array(
978 // 'textkey' => 'WeightVolShort'
979 // ),
980 // 'border-left' => true, // add left line separator
981 // );
982
983 $rank += 10;
984 $this->cols['qty_shipped'] = array(
985 'rank' => $rank,
986 'width' => 20, // in mm
987 'status' => true,
988 'title' => array(
989 'textkey' => 'QtyShippedShort'
990 ),
991 'border-left' => true, // add left line separator
992 );
993
994 $rank += 10;
995 $this->cols['qty_remaining'] = array(
996 'rank' => $rank,
997 'width' => 20, // in mm
998 'status' => 1,
999 'title' => array(
1000 'textkey' => 'KeepToShipShort'
1001 ),
1002 'border-left' => true, // add left line separator
1003 );
1004
1005
1006 // Add extrafields cols
1007 if (!empty($object->lines)) {
1008 $line = reset($object->lines);
1009 $this->defineColumnExtrafield($line, $outputlangs, $hidedetails);
1010 }
1011
1012 $parameters = array(
1013 'object' => $object,
1014 'outputlangs' => $outputlangs,
1015 'hidedetails' => $hidedetails,
1016 'hidedesc' => $hidedesc,
1017 'hideref' => $hideref
1018 );
1019
1020 $reshook = $hookmanager->executeHooks('defineColumnField', $parameters, $this); // Note that $object may have been modified by hook
1021 if ($reshook < 0) {
1022 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1023 } elseif (empty($reshook)) {
1024 // @phan-suppress-next-line PhanPluginSuspiciousParamOrderInternal
1025 $this->cols = array_replace($this->cols, $hookmanager->resArray); // array_replace is used to preserve keys
1026 } else {
1027 $this->cols = $hookmanager->resArray;
1028 }
1029 }
1030}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
Class to manage customers orders.
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.
getColumnContentXStart($colKey)
get column content X (abscissa) left position from column key
getColumnContentWidth($colKey)
get column content width from column key
getExtrafieldContent($object, $extrafieldKey, $outputlangs=null)
get extrafield content for pdf writeHtmlCell compatibility usage for PDF line columns and object note...
printRoundedRect($pdf, $x, $y, $w, $h, $r, $hidetop=0, $hidebottom=0, $style='D')
Print a rounded rectangle on the PDF.
defineColumnExtrafield($object, $outputlangs, $hidedetails=0)
Define Array Column Field for extrafields.
Class to manage hooks.
Class mere des modeles de bon de livraison.
Class to manage products or services.
Class to build Delivery Order documents with storm model.
defineColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Define Array Column Field.
_tableau_info(&$pdf, $object, $posy, $outputlangs)
Show miscellaneous information (payment mode, payment term, ...)
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
Show table for lines.
__construct($db)
Constructor.
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
getCallerInfoString()
Get caller info as a string that can be appended to a log message.
dolChmod($filepath, $newmask='')
Change mod of a file.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
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 a Dolibarr global constant string value.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
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)
pdf_getSizeForImage($realpath)
Return dimensions to use for images onto PDF checking that width and height are not higher than maxim...
Definition pdf.lib.php:2648
pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0, $align='J')
Output line description into PDF.
Definition pdf.lib.php:1442
pdf_getFormat($outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
Definition pdf.lib.php:86
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
Definition pdf.lib.php:288
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
Definition pdf.lib.php:313
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.
Definition pdf.lib.php:1027
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
Definition pdf.lib.php:729
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
Definition pdf.lib.php:1405
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
Definition pdf.lib.php:265
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.
Definition pdf.lib.php:434
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
Definition pdf.lib.php:128
pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includealias=0)
Returns the name of the thirdparty.
Definition pdf.lib.php:386
pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
Add a draft watermark on PDF files.
Definition pdf.lib.php:785
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:137
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:140