@@ -77,8 +77,12 @@ |
||
77 | 77 | //if ($user->socid > 0) $socid = $user->socid; |
78 | 78 | //$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
79 | 79 | //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
80 | -if (empty($conf->intracommreport->enabled)) accessforbidden(); |
|
81 | -if (!$permissiontoread) accessforbidden(); |
|
80 | +if (empty($conf->intracommreport->enabled)) { |
|
81 | + accessforbidden(); |
|
82 | +} |
|
83 | +if (!$permissiontoread) { |
|
84 | + accessforbidden(); |
|
85 | +} |
|
82 | 86 | |
83 | 87 | |
84 | 88 |
@@ -118,7 +118,7 @@ |
||
118 | 118 | if ($action == 'add' && $permissiontoadd) { |
119 | 119 | $object->label = trim($label); |
120 | 120 | $object->type = trim($exporttype); |
121 | - $object->type_declaration = $type_declaration; |
|
121 | + $object->type_declaration = $type_declaration; |
|
122 | 122 | //$object->subscription = (int) $subscription; |
123 | 123 | |
124 | 124 | // Fill array 'array_options' with data from add form |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * \brief Class file used to generate the dispatch slips for the Eagle model |
28 | 28 | */ |
29 | 29 | |
30 | -require_once DOL_DOCUMENT_ROOT . '/core/modules/stocktransfer/modules_stocktransfer.php'; |
|
30 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/stocktransfer/modules_stocktransfer.php'; |
|
31 | 31 | require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
32 | 32 | require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
33 | 33 | require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | $curY = $tab_top + 7; |
416 | 416 | $nexY = $tab_top + 7; |
417 | 417 | |
418 | - $TCacheEntrepots=array(); |
|
418 | + $TCacheEntrepots = array(); |
|
419 | 419 | // Loop on each lines |
420 | 420 | for ($i = 0; $i < $nblines; $i++) { |
421 | 421 | $curY = $nexY; |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | $totalQty = 0; |
721 | 721 | if (!empty($object->lines)) |
722 | 722 | foreach ($object->lines as $line) { |
723 | - $totalQty+=$line->qty; |
|
723 | + $totalQty += $line->qty; |
|
724 | 724 | } |
725 | 725 | // Set trueVolume and volume_units not currently stored into database |
726 | 726 | if ($object->trueWidth && $object->trueHeight && $object->trueDepth) { |
@@ -844,8 +844,8 @@ discard block |
||
844 | 844 | |
845 | 845 | $pdf->line($this->posxwarehousedestination - 1, $tab_top, $this->posxwarehousedestination - 1, $tab_top + $tab_height); |
846 | 846 | if (empty($hidetop)) { |
847 | - $pdf->SetXY($this->posxwarehousedestination-2.5, $tab_top + 1); |
|
848 | - $pdf->MultiCell(($this->posxpuht - $this->posxwarehousedestination+4), 2, $outputlangs->transnoentities("WarehouseTarget"), '', 'C'); |
|
847 | + $pdf->SetXY($this->posxwarehousedestination - 2.5, $tab_top + 1); |
|
848 | + $pdf->MultiCell(($this->posxpuht - $this->posxwarehousedestination + 4), 2, $outputlangs->transnoentities("WarehouseTarget"), '', 'C'); |
|
849 | 849 | } |
850 | 850 | |
851 | 851 | /*if (!empty($conf->global->STOCKTRANSFER_PDF_DISPLAY_AMOUNT_HT)) { |
@@ -105,7 +105,10 @@ discard block |
||
105 | 105 | |
106 | 106 | // Get source company |
107 | 107 | $this->emetteur = $mysoc; |
108 | - if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined |
|
108 | + if (!$this->emetteur->country_code) { |
|
109 | + $this->emetteur->country_code = substr($langs->defaultlang, -2); |
|
110 | + } |
|
111 | + // By default if not defined |
|
109 | 112 | |
110 | 113 | // Define position of columns |
111 | 114 | $this->posxdesc = $this->marge_gauche + 1; |
@@ -124,7 +127,9 @@ discard block |
||
124 | 127 | $this->posxtotalht = $this->page_largeur - $this->marge_droite - 20; |
125 | 128 | }*/ |
126 | 129 | |
127 | - if (!empty($conf->global->STOCKTRANSFER_PDF_HIDE_WEIGHT_AND_VOLUME)) $this->posxweightvol = $this->posxqty; |
|
130 | + if (!empty($conf->global->STOCKTRANSFER_PDF_HIDE_WEIGHT_AND_VOLUME)) { |
|
131 | + $this->posxweightvol = $this->posxqty; |
|
132 | + } |
|
128 | 133 | |
129 | 134 | $this->posxpicture = $this->posxweightvol - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images |
130 | 135 | //var_dump($this->posxpicture, $this->posxweightvol);exit; |
@@ -165,9 +170,13 @@ discard block |
||
165 | 170 | |
166 | 171 | $this->atLeastOneBatch = $this->atLeastOneBatch($object); |
167 | 172 | |
168 | - if (!is_object($outputlangs)) $outputlangs = $langs; |
|
173 | + if (!is_object($outputlangs)) { |
|
174 | + $outputlangs = $langs; |
|
175 | + } |
|
169 | 176 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
170 | - if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; |
|
177 | + if (!empty($conf->global->MAIN_USE_FPDF)) { |
|
178 | + $outputlangs->charset_output = 'ISO-8859-1'; |
|
179 | + } |
|
171 | 180 | |
172 | 181 | // Load traductions files required by page |
173 | 182 | $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch", "stocks", "stocktransfer@stocktransfer")); |
@@ -180,7 +189,9 @@ discard block |
||
180 | 189 | $objphoto = new Product($this->db); |
181 | 190 | |
182 | 191 | for ($i = 0; $i < $nblines; $i++) { |
183 | - if (empty($object->lines[$i]->fk_product)) continue; |
|
192 | + if (empty($object->lines[$i]->fk_product)) { |
|
193 | + continue; |
|
194 | + } |
|
184 | 195 | |
185 | 196 | $objphoto = new Product($this->db); |
186 | 197 | $objphoto->fetch($object->lines[$i]->fk_product); |
@@ -210,16 +221,23 @@ discard block |
||
210 | 221 | break; |
211 | 222 | } |
212 | 223 | |
213 | - if ($realpath) $realpatharray[$i] = $realpath; |
|
224 | + if ($realpath) { |
|
225 | + $realpatharray[$i] = $realpath; |
|
226 | + } |
|
214 | 227 | } |
215 | 228 | } |
216 | 229 | |
217 | - if (count($realpatharray) == 0) $this->posxpicture = $this->posxweightvol; |
|
230 | + if (count($realpatharray) == 0) { |
|
231 | + $this->posxpicture = $this->posxweightvol; |
|
232 | + } |
|
218 | 233 | |
219 | 234 | |
220 | 235 | if (!empty($this->atLeastOneBatch)) { |
221 | 236 | $this->posxpicture = $this->posxlot; |
222 | - if (!empty($conf->global->MAIN_GENERATE_STOCKTRANSFER_WITH_PICTURE)) $this->posxpicture -= (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images |
|
237 | + if (!empty($conf->global->MAIN_GENERATE_STOCKTRANSFER_WITH_PICTURE)) { |
|
238 | + $this->posxpicture -= (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); |
|
239 | + } |
|
240 | + // width of images |
|
223 | 241 | } |
224 | 242 | |
225 | 243 | if ($conf->stocktransfer->dir_output) { |
@@ -259,7 +277,9 @@ discard block |
||
259 | 277 | $heightforinfotot = 8; // Height reserved to output the info and total part |
260 | 278 | $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page |
261 | 279 | $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
262 | - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; |
|
280 | + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) { |
|
281 | + $heightforfooter += 6; |
|
282 | + } |
|
263 | 283 | $pdf->SetAutoPageBreak(1, 0); |
264 | 284 | |
265 | 285 | if (class_exists('TCPDF')) { |
@@ -277,7 +297,9 @@ discard block |
||
277 | 297 | $pagenb = 0; |
278 | 298 | $pdf->SetDrawColor(128, 128, 128); |
279 | 299 | |
280 | - if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); |
|
300 | + if (method_exists($pdf, 'AliasNbPages')) { |
|
301 | + $pdf->AliasNbPages(); |
|
302 | + } |
|
281 | 303 | |
282 | 304 | $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
283 | 305 | $pdf->SetSubject($outputlangs->transnoentities("Shipment")); |
@@ -292,7 +314,9 @@ discard block |
||
292 | 314 | |
293 | 315 | // New page |
294 | 316 | $pdf->AddPage(); |
295 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
317 | + if (!empty($tplidx)) { |
|
318 | + $pdf->useTemplate($tplidx); |
|
319 | + } |
|
296 | 320 | $pagenb++; |
297 | 321 | $this->_pagehead($pdf, $object, 1, $outputlangs); |
298 | 322 | $pdf->SetFont('', '', $default_font_size - 1); |
@@ -344,7 +368,9 @@ discard block |
||
344 | 368 | // Get code using getLabelFromKey |
345 | 369 | $code = $outputlangs->getLabelFromKey($this->db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); |
346 | 370 | $label = ''; |
347 | - if ($object->tracking_url != $object->tracking_number) $label .= $outputlangs->trans("LinkToTrackYourPackage")."<br>"; |
|
371 | + if ($object->tracking_url != $object->tracking_number) { |
|
372 | + $label .= $outputlangs->trans("LinkToTrackYourPackage")."<br>"; |
|
373 | + } |
|
348 | 374 | $label .= $outputlangs->trans("SendingMethod").": ".$outputlangs->trans("SendingMethod".strtoupper($code)); |
349 | 375 | //var_dump($object->tracking_url != $object->tracking_number);exit; |
350 | 376 | if ($object->tracking_url != $object->tracking_number) { |
@@ -391,7 +417,9 @@ discard block |
||
391 | 417 | |
392 | 418 | // Define size of image if we need it |
393 | 419 | $imglinesize = array(); |
394 | - if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]); |
|
420 | + if (!empty($realpatharray[$i])) { |
|
421 | + $imglinesize = pdf_getSizeForImage($realpatharray[$i]); |
|
422 | + } |
|
395 | 423 | |
396 | 424 | $pdf->setTopMargin($tab_top_newpage); |
397 | 425 | $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
@@ -404,16 +432,22 @@ discard block |
||
404 | 432 | // We start with Photo of product line |
405 | 433 | 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 |
406 | 434 | $pdf->AddPage('', '', true); |
407 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
408 | - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
435 | + if (!empty($tplidx)) { |
|
436 | + $pdf->useTemplate($tplidx); |
|
437 | + } |
|
438 | + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { |
|
439 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
440 | + } |
|
409 | 441 | $pdf->setPage($pageposbefore + 1); |
410 | 442 | |
411 | 443 | $curY = $tab_top_newpage; |
412 | 444 | |
413 | 445 | // Allows data in the first page if description is long enough to break in multiples pages |
414 | - if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) |
|
415 | - $showpricebeforepagebreak = 1; |
|
416 | - else $showpricebeforepagebreak = 0; |
|
446 | + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) { |
|
447 | + $showpricebeforepagebreak = 1; |
|
448 | + } else { |
|
449 | + $showpricebeforepagebreak = 0; |
|
450 | + } |
|
417 | 451 | } |
418 | 452 | |
419 | 453 | if (isset($imglinesize['width']) && isset($imglinesize['height'])) { |
@@ -460,17 +494,23 @@ discard block |
||
460 | 494 | if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text |
461 | 495 | if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page |
462 | 496 | $pdf->AddPage('', '', true); |
463 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
464 | - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
497 | + if (!empty($tplidx)) { |
|
498 | + $pdf->useTemplate($tplidx); |
|
499 | + } |
|
500 | + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { |
|
501 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
502 | + } |
|
465 | 503 | $pdf->setPage($pageposafter + 1); |
466 | 504 | } |
467 | 505 | } else { |
468 | 506 | // We found a page break |
469 | 507 | |
470 | 508 | // Allows data in the first page if description is long enough to break in multiples pages |
471 | - if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) |
|
472 | - $showpricebeforepagebreak = 1; |
|
473 | - else $showpricebeforepagebreak = 0; |
|
509 | + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) { |
|
510 | + $showpricebeforepagebreak = 1; |
|
511 | + } else { |
|
512 | + $showpricebeforepagebreak = 0; |
|
513 | + } |
|
474 | 514 | } |
475 | 515 | } else // No pagebreak |
476 | 516 | { |
@@ -527,8 +567,9 @@ discard block |
||
527 | 567 | |
528 | 568 | // Warehouse source |
529 | 569 | $wh_source = new Entrepot($db); |
530 | - if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_source])) $wh_source = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_source]; |
|
531 | - else { |
|
570 | + if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_source])) { |
|
571 | + $wh_source = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_source]; |
|
572 | + } else { |
|
532 | 573 | $wh_source->fetch($object->lines[$i]->fk_warehouse_source); |
533 | 574 | $TCacheEntrepots[$object->lines[$i]->fk_warehouse_source] = $wh_source; |
534 | 575 | } |
@@ -537,8 +578,9 @@ discard block |
||
537 | 578 | |
538 | 579 | // Warehouse destination |
539 | 580 | $wh_destination = new Entrepot($db); |
540 | - if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination])) $wh_destination = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination]; |
|
541 | - else { |
|
581 | + if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination])) { |
|
582 | + $wh_destination = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination]; |
|
583 | + } else { |
|
542 | 584 | $wh_destination->fetch($object->lines[$i]->fk_warehouse_destination); |
543 | 585 | $TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination] = $wh_destination; |
544 | 586 | } |
@@ -554,7 +596,9 @@ discard block |
||
554 | 596 | } |
555 | 597 | |
556 | 598 | $nexY += 3; |
557 | - if ($weighttxt && $voltxt) $nexY += 2; |
|
599 | + if ($weighttxt && $voltxt) { |
|
600 | + $nexY += 2; |
|
601 | + } |
|
558 | 602 | |
559 | 603 | // Add line |
560 | 604 | if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) { |
@@ -577,7 +621,9 @@ discard block |
||
577 | 621 | $pagenb++; |
578 | 622 | $pdf->setPage($pagenb); |
579 | 623 | $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
580 | - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
624 | + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { |
|
625 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
626 | + } |
|
581 | 627 | } |
582 | 628 | if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { |
583 | 629 | if ($pagenb == 1) { |
@@ -588,9 +634,13 @@ discard block |
||
588 | 634 | $this->_pagefoot($pdf, $object, $outputlangs, 1); |
589 | 635 | // New page |
590 | 636 | $pdf->AddPage(); |
591 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
637 | + if (!empty($tplidx)) { |
|
638 | + $pdf->useTemplate($tplidx); |
|
639 | + } |
|
592 | 640 | $pagenb++; |
593 | - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
641 | + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { |
|
642 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
643 | + } |
|
594 | 644 | } |
595 | 645 | } |
596 | 646 | |
@@ -608,7 +658,9 @@ discard block |
||
608 | 658 | |
609 | 659 | // Pied de page |
610 | 660 | $this->_pagefoot($pdf, $object, $outputlangs); |
611 | - if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); |
|
661 | + if (method_exists($pdf, 'AliasNbPages')) { |
|
662 | + $pdf->AliasNbPages(); |
|
663 | + } |
|
612 | 664 | |
613 | 665 | $pdf->Close(); |
614 | 666 | |
@@ -670,8 +722,11 @@ discard block |
||
670 | 722 | { |
671 | 723 | $col2x-=20; |
672 | 724 | }*/ |
673 | - if (empty($conf->global->STOCKTRANSFER_PDF_HIDE_ORDERED)) $largcol2 = ($this->posxwarehousesource - $this->posxqty); |
|
674 | - else $largcol2 = ($this->posxwarehousedestination - $this->posxqty); |
|
725 | + if (empty($conf->global->STOCKTRANSFER_PDF_HIDE_ORDERED)) { |
|
726 | + $largcol2 = ($this->posxwarehousesource - $this->posxqty); |
|
727 | + } else { |
|
728 | + $largcol2 = ($this->posxwarehousedestination - $this->posxqty); |
|
729 | + } |
|
675 | 730 | |
676 | 731 | $useborder = 0; |
677 | 732 | $index = 0; |
@@ -684,20 +739,29 @@ discard block |
||
684 | 739 | $totalWeight = $tmparray['weight']; |
685 | 740 | $totalVolume = $tmparray['volume']; |
686 | 741 | $totalQty = 0; |
687 | - if (!empty($object->lines)) |
|
688 | - foreach ($object->lines as $line) { |
|
742 | + if (!empty($object->lines)) { |
|
743 | + foreach ($object->lines as $line) { |
|
689 | 744 | $totalQty+=$line->qty; |
690 | 745 | } |
746 | + } |
|
691 | 747 | // Set trueVolume and volume_units not currently stored into database |
692 | 748 | if ($object->trueWidth && $object->trueHeight && $object->trueDepth) { |
693 | 749 | $object->trueVolume = price(($object->trueWidth * $object->trueHeight * $object->trueDepth), 0, $outputlangs, 0, 0); |
694 | 750 | $object->volume_units = $object->size_units * 3; |
695 | 751 | } |
696 | 752 | |
697 | - if ($totalWeight != '') $totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs); |
|
698 | - if ($totalVolume != '') $totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs); |
|
699 | - if ($object->trueWeight) $totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs); |
|
700 | - if ($object->trueVolume) $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); |
|
753 | + if ($totalWeight != '') { |
|
754 | + $totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs); |
|
755 | + } |
|
756 | + if ($totalVolume != '') { |
|
757 | + $totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs); |
|
758 | + } |
|
759 | + if ($object->trueWeight) { |
|
760 | + $totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs); |
|
761 | + } |
|
762 | + if ($object->trueVolume) { |
|
763 | + $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); |
|
764 | + } |
|
701 | 765 | |
702 | 766 | $pdf->SetFillColor(255, 255, 255); |
703 | 767 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
@@ -730,7 +794,9 @@ discard block |
||
730 | 794 | |
731 | 795 | $index++; |
732 | 796 | } |
733 | - if (!$totalWeighttoshow && !$totalVolumetoshow) $index++; |
|
797 | + if (!$totalWeighttoshow && !$totalVolumetoshow) { |
|
798 | + $index++; |
|
799 | + } |
|
734 | 800 | } |
735 | 801 | |
736 | 802 | $pdf->SetTextColor(0, 0, 0); |
@@ -758,7 +824,9 @@ discard block |
||
758 | 824 | |
759 | 825 | // Force to disable hidetop and hidebottom |
760 | 826 | $hidebottom = 0; |
761 | - if ($hidetop) $hidetop = -1; |
|
827 | + if ($hidetop) { |
|
828 | + $hidetop = -1; |
|
829 | + } |
|
762 | 830 | |
763 | 831 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
764 | 832 | |
@@ -1002,7 +1070,9 @@ discard block |
||
1002 | 1070 | |
1003 | 1071 | $pdf->SetFont('', '', $default_font_size - 2); |
1004 | 1072 | $text = $linkedobject->ref; |
1005 | - if ($linkedobject->ref_client) $text .= ' ('.$linkedobject->ref_client.')'; |
|
1073 | + if ($linkedobject->ref_client) { |
|
1074 | + $text .= ' ('.$linkedobject->ref_client.')'; |
|
1075 | + } |
|
1006 | 1076 | $Yoff = $Yoff + 8; |
1007 | 1077 | $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); |
1008 | 1078 | $pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), 0, 'R'); |
@@ -1027,18 +1097,28 @@ discard block |
||
1027 | 1097 | $result = $object->fetch_contact($arrayidcontact[0]); |
1028 | 1098 | } |
1029 | 1099 | |
1030 | - if ($usecontact) $thirdparty = $object->contact; |
|
1031 | - else $thirdparty = $this->emetteur; |
|
1100 | + if ($usecontact) { |
|
1101 | + $thirdparty = $object->contact; |
|
1102 | + } else { |
|
1103 | + $thirdparty = $this->emetteur; |
|
1104 | + } |
|
1032 | 1105 | |
1033 | - if (!empty($thirdparty)) $carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); |
|
1106 | + if (!empty($thirdparty)) { |
|
1107 | + $carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); |
|
1108 | + } |
|
1034 | 1109 | |
1035 | - if ($usecontact) $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, 1, 'targetwithdetails', $object); |
|
1036 | - else $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); |
|
1110 | + if ($usecontact) { |
|
1111 | + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, 1, 'targetwithdetails', $object); |
|
1112 | + } else { |
|
1113 | + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); |
|
1114 | + } |
|
1037 | 1115 | |
1038 | 1116 | // Show sender |
1039 | 1117 | $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; |
1040 | 1118 | $posx = $this->marge_gauche; |
1041 | - if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; |
|
1119 | + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) { |
|
1120 | + $posx = $this->page_largeur - $this->marge_droite - 80; |
|
1121 | + } |
|
1042 | 1122 | |
1043 | 1123 | $hautcadre = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40; |
1044 | 1124 | $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82; |
@@ -1082,16 +1162,23 @@ discard block |
||
1082 | 1162 | $thirdparty = $object->thirdparty; |
1083 | 1163 | } |
1084 | 1164 | |
1085 | - if (!empty($thirdparty)) $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); |
|
1165 | + if (!empty($thirdparty)) { |
|
1166 | + $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); |
|
1167 | + } |
|
1086 | 1168 | |
1087 | 1169 | $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (!empty($object->contact) ? $object->contact : null), $usecontact, 'targetwithdetails', $object); |
1088 | 1170 | |
1089 | 1171 | // Show recipient |
1090 | 1172 | $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100; |
1091 | - if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format |
|
1173 | + if ($this->page_largeur < 210) { |
|
1174 | + $widthrecbox = 84; |
|
1175 | + } |
|
1176 | + // To work with US executive format |
|
1092 | 1177 | $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; |
1093 | 1178 | $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; |
1094 | - if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; |
|
1179 | + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) { |
|
1180 | + $posx = $this->marge_gauche; |
|
1181 | + } |
|
1095 | 1182 | |
1096 | 1183 | // Show recipient frame |
1097 | 1184 | $pdf->SetTextColor(0, 0, 0); |
@@ -615,7 +615,7 @@ |
||
615 | 615 | |
616 | 616 | $ref = dol_sanitizeFileName($newref); |
617 | 617 | $pdf_path = $dir_output."/".$ref.".pdf"; |
618 | - if (!dol_is_file($pdf_path)||(is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0 && !$arraydefaultmessage->joinfiles)) { |
|
618 | + if (!dol_is_file($pdf_path) || (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0 && !$arraydefaultmessage->joinfiles)) { |
|
619 | 619 | // We can't add PDF as it is not generated yet. |
620 | 620 | $filepdf = ''; |
621 | 621 | } else { |
@@ -340,7 +340,7 @@ |
||
340 | 340 | $staticrecruitmentcandidature = new RecruitmentCandidature($db); |
341 | 341 | $staticrecruitmentjobposition = new RecruitmentJobPosition($db); |
342 | 342 | $sql = "SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status,"; |
343 | - $sql.= " rp.rowid as jobid, rp.ref as jobref, rp.label"; |
|
343 | + $sql .= " rp.rowid as jobid, rp.ref as jobref, rp.label"; |
|
344 | 344 | $sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc"; |
345 | 345 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as rp ON rc.fk_recruitmentjobposition = rp.rowid"; |
346 | 346 | if (isModEnabled('societe') && empty($user->rights->societe->client->voir) && !$socid) { |
@@ -214,8 +214,8 @@ |
||
214 | 214 | // Total debit-credit |
215 | 215 | print '<tr class="liste_total"><td><b>'.$langs->trans("Total")."</b></td>"; |
216 | 216 | for ($annee = $year_start; $annee <= $year_end; $annee++) { |
217 | - print '<td class="right nowraponall"><b>'. (isset($totsorties[$annee]) ? price($totsorties[$annee]) : '') .'</b></td>'; |
|
218 | - print '<td class="right nowraponall"><b>'. (isset($totentrees[$annee]) ? price($totentrees[$annee]) : '') .'</b></td>'; |
|
217 | + print '<td class="right nowraponall"><b>'.(isset($totsorties[$annee]) ? price($totsorties[$annee]) : '').'</b></td>'; |
|
218 | + print '<td class="right nowraponall"><b>'.(isset($totentrees[$annee]) ? price($totentrees[$annee]) : '').'</b></td>'; |
|
219 | 219 | } |
220 | 220 | print "</tr>\n"; |
221 | 221 |
@@ -315,16 +315,25 @@ |
||
315 | 315 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
316 | 316 | if (empty($reshook)) { |
317 | 317 | if (empty($object->date_trans)) { |
318 | - if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->send); |
|
319 | - else print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->send); |
|
318 | + if ($object->type == 'bank-transfer') { |
|
319 | + print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->send); |
|
320 | + } else { |
|
321 | + print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->send); |
|
322 | + } |
|
320 | 323 | } |
321 | 324 | if (!empty($object->date_trans) && empty($object->date_credit)) { |
322 | - if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("ClassDebited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->debit); |
|
323 | - else print dolGetButtonAction($langs->trans("ClassCredited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->credit); |
|
325 | + if ($object->type == 'bank-transfer') { |
|
326 | + print dolGetButtonAction($langs->trans("ClassDebited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->debit); |
|
327 | + } else { |
|
328 | + print dolGetButtonAction($langs->trans("ClassCredited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->credit); |
|
329 | + } |
|
324 | 330 | } |
325 | 331 | |
326 | - if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->create); |
|
327 | - else print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->creer); |
|
332 | + if ($object->type == 'bank-transfer') { |
|
333 | + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->create); |
|
334 | + } else { |
|
335 | + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->creer); |
|
336 | + } |
|
328 | 337 | } |
329 | 338 | print '</div>'; |
330 | 339 | } |
@@ -343,7 +343,7 @@ |
||
343 | 343 | $sql .= ", ".MAIN_DB_PREFIX."societe as s"; |
344 | 344 | $sql .= " WHERE pl.fk_prelevement_bons = ".((int) $id); |
345 | 345 | $sql .= " AND pl.fk_prelevement_bons = pb.rowid"; |
346 | - $sql .= " AND pb.entity = ".((int) $conf->entity); // No sharing of entity here |
|
346 | + $sql .= " AND pb.entity = ".((int) $conf->entity); // No sharing of entity here |
|
347 | 347 | $sql .= " AND pl.fk_soc = s.rowid"; |
348 | 348 | if ($socid) { |
349 | 349 | $sql .= " AND s.rowid = ".((int) $socid); |
@@ -76,13 +76,13 @@ |
||
76 | 76 | * Boolean that indicates whether the product is available for sale '1' or not '0' |
77 | 77 | * @var int |
78 | 78 | */ |
79 | - public $product_tosell=0; |
|
79 | + public $product_tosell = 0; |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Boolean that indicates whether the product is available for purchase '1' or not '0' |
83 | 83 | * @var int |
84 | 84 | */ |
85 | - public $product_tobuy=0; |
|
85 | + public $product_tobuy = 0; |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Product description |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $search_date_endday = GETPOST('search_date_endday', 'int'); |
66 | 66 | $search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
67 | 67 | $search_date_endyear = GETPOST('search_date_endyear', 'int'); |
68 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
68 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
69 | 69 | $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
70 | 70 | |
71 | 71 | // Load variable for pagination |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $permissiontoread = $user->hasRight('accounting', 'read'); |
154 | 154 | $permissiontodelete = $user->hasRight('accounting', 'delete'); |
155 | 155 | $uploaddir = $conf->expensereport->dir_output; |
156 | - include DOL_DOCUMENT_ROOT . '/core/actions_massactions.inc.php'; |
|
156 | + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 |
@@ -314,7 +314,9 @@ |
||
314 | 314 | } |
315 | 315 | // Now loop on each link of record in bank (code similar to bankentries_list.php) |
316 | 316 | foreach ($links as $key => $val) { |
317 | - if ($links[$key]['type'] == 'user' && !$is_sc) continue; |
|
317 | + if ($links[$key]['type'] == 'user' && !$is_sc) { |
|
318 | + continue; |
|
319 | + } |
|
318 | 320 | if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various'))) { |
319 | 321 | // So we excluded 'company' and 'user' here. We want only payment lines |
320 | 322 |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu4 ON bu4.fk_bank = b.rowid AND bu4.type='payment_supplier'"; |
139 | 139 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc on bu1.url_id=soc.rowid"; |
140 | 140 | if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { |
141 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = soc.rowid AND spe.entity = " . ((int) $conf->entity); |
|
141 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_perentity as spe ON spe.fk_soc = soc.rowid AND spe.entity = ".((int) $conf->entity); |
|
142 | 142 | } |
143 | 143 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on bu2.url_id=u.rowid"; |
144 | 144 | $sql .= " WHERE ba.fk_accountancy_journal=".((int) $id_journal); |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | // Line into bank account |
612 | 612 | foreach ($tabbq[$key] as $k => $mt) { |
613 | 613 | if ($mt) { |
614 | - $accountingaccount->fetch(null, $k, true); // $k is accounting bank account. TODO We should use a cache here to avoid this fetch |
|
614 | + $accountingaccount->fetch(null, $k, true); // $k is accounting bank account. TODO We should use a cache here to avoid this fetch |
|
615 | 615 | $account_label = $accountingaccount->label; |
616 | 616 | |
617 | 617 | $reflabel = ''; |
@@ -727,43 +727,43 @@ discard block |
||
727 | 727 | } elseif (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution |
728 | 728 | $bookkeeping->subledger_account = ''; |
729 | 729 | $bookkeeping->subledger_label = ''; |
730 | - $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
730 | + $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
731 | 731 | $bookkeeping->numero_compte = $k; |
732 | 732 | $bookkeeping->label_compte = $accountingaccount->label; |
733 | 733 | } elseif ($tabtype[$key] == 'payment_vat') { |
734 | 734 | $bookkeeping->subledger_account = ''; |
735 | 735 | $bookkeeping->subledger_label = ''; |
736 | - $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
736 | + $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
737 | 737 | $bookkeeping->numero_compte = $k; |
738 | 738 | $bookkeeping->label_compte = $accountingaccount->label; |
739 | 739 | } elseif ($tabtype[$key] == 'payment_donation') { |
740 | 740 | $bookkeeping->subledger_account = ''; |
741 | 741 | $bookkeeping->subledger_label = ''; |
742 | - $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
742 | + $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
743 | 743 | $bookkeeping->numero_compte = $k; |
744 | 744 | $bookkeeping->label_compte = $accountingaccount->label; |
745 | 745 | } elseif ($tabtype[$key] == 'member') { |
746 | 746 | $bookkeeping->subledger_account = ''; |
747 | 747 | $bookkeeping->subledger_label = ''; |
748 | - $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
748 | + $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
749 | 749 | $bookkeeping->numero_compte = $k; |
750 | 750 | $bookkeeping->label_compte = $accountingaccount->label; |
751 | 751 | } elseif ($tabtype[$key] == 'payment_loan') { |
752 | 752 | $bookkeeping->subledger_account = ''; |
753 | 753 | $bookkeeping->subledger_label = ''; |
754 | - $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
754 | + $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
755 | 755 | $bookkeeping->numero_compte = $k; |
756 | 756 | $bookkeeping->label_compte = $accountingaccount->label; |
757 | 757 | } elseif ($tabtype[$key] == 'payment_various') { |
758 | 758 | $bookkeeping->subledger_account = $k; |
759 | 759 | $bookkeeping->subledger_label = $tabcompany[$key]['name']; |
760 | - $accountingaccount->fetch(null, $tabpay[$key]["account_various"], true); // TODO Use a cache |
|
760 | + $accountingaccount->fetch(null, $tabpay[$key]["account_various"], true); // TODO Use a cache |
|
761 | 761 | $bookkeeping->numero_compte = $tabpay[$key]["account_various"]; |
762 | 762 | $bookkeeping->label_compte = $accountingaccount->label; |
763 | 763 | } elseif ($tabtype[$key] == 'banktransfert') { |
764 | 764 | $bookkeeping->subledger_account = ''; |
765 | 765 | $bookkeeping->subledger_label = ''; |
766 | - $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
766 | + $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
767 | 767 | $bookkeeping->numero_compte = $k; |
768 | 768 | $bookkeeping->label_compte = $accountingaccount->label; |
769 | 769 | } else { |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | } |
795 | 795 | } else { |
796 | 796 | if ($lettering && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) { |
797 | - require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; |
|
797 | + require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php'; |
|
798 | 798 | $lettering_static = new Lettering($db); |
799 | 799 | $nb_lettering = $lettering_static->bookkeepingLetteringAll(array($bookkeeping->id)); |
800 | 800 | } |
@@ -1190,7 +1190,7 @@ discard block |
||
1190 | 1190 | |
1191 | 1191 | // Label operation |
1192 | 1192 | print '<td>'; |
1193 | - print $reflabel; // This is already html escaped content |
|
1193 | + print $reflabel; // This is already html escaped content |
|
1194 | 1194 | print "</td>"; |
1195 | 1195 | |
1196 | 1196 | print '<td class="center">'.$val["type_payment"]."</td>"; |
@@ -1281,7 +1281,7 @@ discard block |
||
1281 | 1281 | } |
1282 | 1282 | } |
1283 | 1283 | print '<td class="maxwidth300" title="'.dol_escape_htmltag(dol_string_nohtmltag($accounttoshow)).'">'; |
1284 | - print $accounttoshow; // This is a HTML string |
|
1284 | + print $accounttoshow; // This is a HTML string |
|
1285 | 1285 | print "</td>"; |
1286 | 1286 | |
1287 | 1287 | // Subledger account |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | } |
1311 | 1311 | } |
1312 | 1312 | print '<td class="maxwidth300">'; |
1313 | - print $accounttoshowsubledger; // This is a html string |
|
1313 | + print $accounttoshowsubledger; // This is a html string |
|
1314 | 1314 | print "</td>"; |
1315 | 1315 | |
1316 | 1316 | print "<td>".$reflabel."</td>"; |