@@ -27,7 +27,7 @@ |
||
27 | 27 | * \brief File containing class for advanced numbering model of StockTransfer |
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 | |
32 | 32 | |
33 | 33 | /** |
@@ -434,7 +434,7 @@ |
||
434 | 434 | $invoicecredits[] = $facavoir->getNomUrl(1); |
435 | 435 | } |
436 | 436 | print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir"); |
437 | - print ' '. (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits); |
|
437 | + print ' '.(count($invoicecredits) ? ' ' : '').implode(',', $invoicecredits); |
|
438 | 438 | print '</span>'; |
439 | 439 | } |
440 | 440 | /* |
@@ -394,7 +394,7 @@ |
||
394 | 394 | print '<tr class="oddeven" height="24">'; |
395 | 395 | print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&mode='.$mode.($socid > 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$year.'</a></td>'; |
396 | 396 | print '<td class="right">'.$val['nb'].'</td>'; |
397 | - print '<td class="right opacitylow" style="'.((!isset($val['nb_diff']) || $val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(isset($val['nb_diff']) ? round($val['nb_diff']): "0").'%</td>'; |
|
397 | + print '<td class="right opacitylow" style="'.((!isset($val['nb_diff']) || $val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(isset($val['nb_diff']) ? round($val['nb_diff']) : "0").'%</td>'; |
|
398 | 398 | print '<td class="right">'.price(price2num($val['total'], 'MT'), 1).'</td>'; |
399 | 399 | print '<td class="right opacitylow" style="'.((!isset($val['total_diff']) || $val['total_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(isset($val['total_diff']) ? round($val['total_diff']) : "0").'%</td>'; |
400 | 400 | print '<td class="right">'.price(price2num($val['avg'], 'MT'), 1).'</td>'; |
@@ -66,26 +66,26 @@ |
||
66 | 66 | $rep = new stdClass(); |
67 | 67 | $rep->response_status = 0; |
68 | 68 | $rep->data = null; |
69 | -$rep->error = '';//@todo deprecated use error_message instead |
|
69 | +$rep->error = ''; //@todo deprecated use error_message instead |
|
70 | 70 | $rep->errorMessage = ''; |
71 | 71 | |
72 | 72 | |
73 | 73 | if (empty($fk_expense) || $fk_expense < 0) { |
74 | - $rep->errorMessage = $langs->transnoentitiesnoconv('ErrorBadValueForParameter', $fk_expense, 'fk_expense'); |
|
74 | + $rep->errorMessage = $langs->transnoentitiesnoconv('ErrorBadValueForParameter', $fk_expense, 'fk_expense'); |
|
75 | 75 | } elseif (empty($fk_c_exp_tax_cat) || $fk_c_exp_tax_cat < 0) { |
76 | - $rep->errorMessage = $langs->transnoentitiesnoconv('ErrorBadValueForParameter', $fk_c_exp_tax_cat, 'fk_c_exp_tax_cat'); |
|
76 | + $rep->errorMessage = $langs->transnoentitiesnoconv('ErrorBadValueForParameter', $fk_c_exp_tax_cat, 'fk_c_exp_tax_cat'); |
|
77 | 77 | |
78 | 78 | $rep->response_status = 'error'; |
79 | 79 | } else { |
80 | 80 | // @see ndfp.class.php:3576 (method: compute_total_km) |
81 | 81 | $expense = new ExpenseReport($db); |
82 | 82 | if ($expense->fetch($fk_expense) <= 0) { |
83 | - $rep->errorMessage = $langs->transnoentitiesnoconv('ErrorRecordNotFound'); |
|
83 | + $rep->errorMessage = $langs->transnoentitiesnoconv('ErrorRecordNotFound'); |
|
84 | 84 | $rep->response_status = 'error'; |
85 | 85 | } else { |
86 | 86 | $userauthor = new User($db); |
87 | 87 | if ($userauthor->fetch($expense->fk_user_author) <= 0) { |
88 | - $rep->errorMessage = $langs->transnoentitiesnoconv('ErrorRecordNotFound'); |
|
88 | + $rep->errorMessage = $langs->transnoentitiesnoconv('ErrorRecordNotFound'); |
|
89 | 89 | $rep->response_status = 'error'; |
90 | 90 | } else { |
91 | 91 | $expense = new ExpenseReport($db); |
@@ -113,7 +113,7 @@ |
||
113 | 113 | $out .= '>'.$langs->trans("AutoDetectLang").'</option>'; |
114 | 114 | } |
115 | 115 | |
116 | - asort($langs_available); // array('XX' => 'Language (Country)', ...) |
|
116 | + asort($langs_available); // array('XX' => 'Language (Country)', ...) |
|
117 | 117 | |
118 | 118 | foreach ($langs_available as $key => $value) { |
119 | 119 | $valuetoshow = $value; |
@@ -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)) { |
@@ -140,7 +140,10 @@ discard block |
||
140 | 140 | |
141 | 141 | // Get source company |
142 | 142 | $this->emetteur = $mysoc; |
143 | - if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined |
|
143 | + if (!$this->emetteur->country_code) { |
|
144 | + $this->emetteur->country_code = substr($langs->defaultlang, -2); |
|
145 | + } |
|
146 | + // By default if not defined |
|
144 | 147 | |
145 | 148 | // Define position of columns |
146 | 149 | $this->posxdesc = $this->marge_gauche + 1; |
@@ -159,7 +162,9 @@ discard block |
||
159 | 162 | $this->posxtotalht = $this->page_largeur - $this->marge_droite - 20; |
160 | 163 | }*/ |
161 | 164 | |
162 | - if (!empty($conf->global->STOCKTRANSFER_PDF_HIDE_WEIGHT_AND_VOLUME)) $this->posxweightvol = $this->posxqty; |
|
165 | + if (!empty($conf->global->STOCKTRANSFER_PDF_HIDE_WEIGHT_AND_VOLUME)) { |
|
166 | + $this->posxweightvol = $this->posxqty; |
|
167 | + } |
|
163 | 168 | |
164 | 169 | $this->posxpicture = $this->posxweightvol - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images |
165 | 170 | //var_dump($this->posxpicture, $this->posxweightvol);exit; |
@@ -200,9 +205,13 @@ discard block |
||
200 | 205 | |
201 | 206 | $this->atLeastOneBatch = $this->atLeastOneBatch($object); |
202 | 207 | |
203 | - if (!is_object($outputlangs)) $outputlangs = $langs; |
|
208 | + if (!is_object($outputlangs)) { |
|
209 | + $outputlangs = $langs; |
|
210 | + } |
|
204 | 211 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
205 | - if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; |
|
212 | + if (!empty($conf->global->MAIN_USE_FPDF)) { |
|
213 | + $outputlangs->charset_output = 'ISO-8859-1'; |
|
214 | + } |
|
206 | 215 | |
207 | 216 | // Load traductions files required by page |
208 | 217 | $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch", "stocks", "stocktransfer@stocktransfer")); |
@@ -215,7 +224,9 @@ discard block |
||
215 | 224 | $objphoto = new Product($this->db); |
216 | 225 | |
217 | 226 | for ($i = 0; $i < $nblines; $i++) { |
218 | - if (empty($object->lines[$i]->fk_product)) continue; |
|
227 | + if (empty($object->lines[$i]->fk_product)) { |
|
228 | + continue; |
|
229 | + } |
|
219 | 230 | |
220 | 231 | $objphoto = new Product($this->db); |
221 | 232 | $objphoto->fetch($object->lines[$i]->fk_product); |
@@ -245,16 +256,23 @@ discard block |
||
245 | 256 | break; |
246 | 257 | } |
247 | 258 | |
248 | - if ($realpath) $realpatharray[$i] = $realpath; |
|
259 | + if ($realpath) { |
|
260 | + $realpatharray[$i] = $realpath; |
|
261 | + } |
|
249 | 262 | } |
250 | 263 | } |
251 | 264 | |
252 | - if (count($realpatharray) == 0) $this->posxpicture = $this->posxweightvol; |
|
265 | + if (count($realpatharray) == 0) { |
|
266 | + $this->posxpicture = $this->posxweightvol; |
|
267 | + } |
|
253 | 268 | |
254 | 269 | |
255 | 270 | if (!empty($this->atLeastOneBatch)) { |
256 | 271 | $this->posxpicture = $this->posxlot; |
257 | - 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 |
|
272 | + if (!empty($conf->global->MAIN_GENERATE_STOCKTRANSFER_WITH_PICTURE)) { |
|
273 | + $this->posxpicture -= (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); |
|
274 | + } |
|
275 | + // width of images |
|
258 | 276 | } |
259 | 277 | |
260 | 278 | if ($conf->stocktransfer->dir_output) { |
@@ -294,7 +312,9 @@ discard block |
||
294 | 312 | $heightforinfotot = 8; // Height reserved to output the info and total part |
295 | 313 | $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 |
296 | 314 | $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
297 | - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; |
|
315 | + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) { |
|
316 | + $heightforfooter += 6; |
|
317 | + } |
|
298 | 318 | $pdf->SetAutoPageBreak(1, 0); |
299 | 319 | |
300 | 320 | if (class_exists('TCPDF')) { |
@@ -312,7 +332,9 @@ discard block |
||
312 | 332 | $pagenb = 0; |
313 | 333 | $pdf->SetDrawColor(128, 128, 128); |
314 | 334 | |
315 | - if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); |
|
335 | + if (method_exists($pdf, 'AliasNbPages')) { |
|
336 | + $pdf->AliasNbPages(); |
|
337 | + } |
|
316 | 338 | |
317 | 339 | $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
318 | 340 | $pdf->SetSubject($outputlangs->transnoentities("Shipment")); |
@@ -327,7 +349,9 @@ discard block |
||
327 | 349 | |
328 | 350 | // New page |
329 | 351 | $pdf->AddPage(); |
330 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
352 | + if (!empty($tplidx)) { |
|
353 | + $pdf->useTemplate($tplidx); |
|
354 | + } |
|
331 | 355 | $pagenb++; |
332 | 356 | $this->_pagehead($pdf, $object, 1, $outputlangs); |
333 | 357 | $pdf->SetFont('', '', $default_font_size - 1); |
@@ -379,7 +403,9 @@ discard block |
||
379 | 403 | // Get code using getLabelFromKey |
380 | 404 | $code = $outputlangs->getLabelFromKey($this->db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); |
381 | 405 | $label = ''; |
382 | - if ($object->tracking_url != $object->tracking_number) $label .= $outputlangs->trans("LinkToTrackYourPackage")."<br>"; |
|
406 | + if ($object->tracking_url != $object->tracking_number) { |
|
407 | + $label .= $outputlangs->trans("LinkToTrackYourPackage")."<br>"; |
|
408 | + } |
|
383 | 409 | $label .= $outputlangs->trans("SendingMethod").": ".$outputlangs->trans("SendingMethod".strtoupper($code)); |
384 | 410 | //var_dump($object->tracking_url != $object->tracking_number);exit; |
385 | 411 | if ($object->tracking_url != $object->tracking_number) { |
@@ -426,7 +452,9 @@ discard block |
||
426 | 452 | |
427 | 453 | // Define size of image if we need it |
428 | 454 | $imglinesize = array(); |
429 | - if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]); |
|
455 | + if (!empty($realpatharray[$i])) { |
|
456 | + $imglinesize = pdf_getSizeForImage($realpatharray[$i]); |
|
457 | + } |
|
430 | 458 | |
431 | 459 | $pdf->setTopMargin($tab_top_newpage); |
432 | 460 | $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
@@ -439,16 +467,22 @@ discard block |
||
439 | 467 | // We start with Photo of product line |
440 | 468 | 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 |
441 | 469 | $pdf->AddPage('', '', true); |
442 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
443 | - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
470 | + if (!empty($tplidx)) { |
|
471 | + $pdf->useTemplate($tplidx); |
|
472 | + } |
|
473 | + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { |
|
474 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
475 | + } |
|
444 | 476 | $pdf->setPage($pageposbefore + 1); |
445 | 477 | |
446 | 478 | $curY = $tab_top_newpage; |
447 | 479 | |
448 | 480 | // Allows data in the first page if description is long enough to break in multiples pages |
449 | - if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) |
|
450 | - $showpricebeforepagebreak = 1; |
|
451 | - else $showpricebeforepagebreak = 0; |
|
481 | + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) { |
|
482 | + $showpricebeforepagebreak = 1; |
|
483 | + } else { |
|
484 | + $showpricebeforepagebreak = 0; |
|
485 | + } |
|
452 | 486 | } |
453 | 487 | |
454 | 488 | if (isset($imglinesize['width']) && isset($imglinesize['height'])) { |
@@ -495,17 +529,23 @@ discard block |
||
495 | 529 | if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text |
496 | 530 | if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page |
497 | 531 | $pdf->AddPage('', '', true); |
498 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
499 | - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
532 | + if (!empty($tplidx)) { |
|
533 | + $pdf->useTemplate($tplidx); |
|
534 | + } |
|
535 | + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { |
|
536 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
537 | + } |
|
500 | 538 | $pdf->setPage($pageposafter + 1); |
501 | 539 | } |
502 | 540 | } else { |
503 | 541 | // We found a page break |
504 | 542 | |
505 | 543 | // Allows data in the first page if description is long enough to break in multiples pages |
506 | - if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) |
|
507 | - $showpricebeforepagebreak = 1; |
|
508 | - else $showpricebeforepagebreak = 0; |
|
544 | + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) { |
|
545 | + $showpricebeforepagebreak = 1; |
|
546 | + } else { |
|
547 | + $showpricebeforepagebreak = 0; |
|
548 | + } |
|
509 | 549 | } |
510 | 550 | } else // No pagebreak |
511 | 551 | { |
@@ -562,8 +602,9 @@ discard block |
||
562 | 602 | |
563 | 603 | // Warehouse source |
564 | 604 | $wh_source = new Entrepot($db); |
565 | - if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_source])) $wh_source = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_source]; |
|
566 | - else { |
|
605 | + if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_source])) { |
|
606 | + $wh_source = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_source]; |
|
607 | + } else { |
|
567 | 608 | $wh_source->fetch($object->lines[$i]->fk_warehouse_source); |
568 | 609 | $TCacheEntrepots[$object->lines[$i]->fk_warehouse_source] = $wh_source; |
569 | 610 | } |
@@ -572,8 +613,9 @@ discard block |
||
572 | 613 | |
573 | 614 | // Warehouse destination |
574 | 615 | $wh_destination = new Entrepot($db); |
575 | - if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination])) $wh_destination = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination]; |
|
576 | - else { |
|
616 | + if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination])) { |
|
617 | + $wh_destination = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination]; |
|
618 | + } else { |
|
577 | 619 | $wh_destination->fetch($object->lines[$i]->fk_warehouse_destination); |
578 | 620 | $TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination] = $wh_destination; |
579 | 621 | } |
@@ -589,7 +631,9 @@ discard block |
||
589 | 631 | } |
590 | 632 | |
591 | 633 | $nexY += 3; |
592 | - if ($weighttxt && $voltxt) $nexY += 2; |
|
634 | + if ($weighttxt && $voltxt) { |
|
635 | + $nexY += 2; |
|
636 | + } |
|
593 | 637 | |
594 | 638 | // Add line |
595 | 639 | if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) { |
@@ -612,7 +656,9 @@ discard block |
||
612 | 656 | $pagenb++; |
613 | 657 | $pdf->setPage($pagenb); |
614 | 658 | $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
615 | - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
659 | + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { |
|
660 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
661 | + } |
|
616 | 662 | } |
617 | 663 | if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { |
618 | 664 | if ($pagenb == 1) { |
@@ -623,9 +669,13 @@ discard block |
||
623 | 669 | $this->_pagefoot($pdf, $object, $outputlangs, 1); |
624 | 670 | // New page |
625 | 671 | $pdf->AddPage(); |
626 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
672 | + if (!empty($tplidx)) { |
|
673 | + $pdf->useTemplate($tplidx); |
|
674 | + } |
|
627 | 675 | $pagenb++; |
628 | - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
676 | + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { |
|
677 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
678 | + } |
|
629 | 679 | } |
630 | 680 | } |
631 | 681 | |
@@ -643,7 +693,9 @@ discard block |
||
643 | 693 | |
644 | 694 | // Pied de page |
645 | 695 | $this->_pagefoot($pdf, $object, $outputlangs); |
646 | - if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); |
|
696 | + if (method_exists($pdf, 'AliasNbPages')) { |
|
697 | + $pdf->AliasNbPages(); |
|
698 | + } |
|
647 | 699 | |
648 | 700 | $pdf->Close(); |
649 | 701 | |
@@ -705,8 +757,11 @@ discard block |
||
705 | 757 | { |
706 | 758 | $col2x-=20; |
707 | 759 | }*/ |
708 | - if (empty($conf->global->STOCKTRANSFER_PDF_HIDE_ORDERED)) $largcol2 = ($this->posxwarehousesource - $this->posxqty); |
|
709 | - else $largcol2 = ($this->posxwarehousedestination - $this->posxqty); |
|
760 | + if (empty($conf->global->STOCKTRANSFER_PDF_HIDE_ORDERED)) { |
|
761 | + $largcol2 = ($this->posxwarehousesource - $this->posxqty); |
|
762 | + } else { |
|
763 | + $largcol2 = ($this->posxwarehousedestination - $this->posxqty); |
|
764 | + } |
|
710 | 765 | |
711 | 766 | $useborder = 0; |
712 | 767 | $index = 0; |
@@ -719,20 +774,29 @@ discard block |
||
719 | 774 | $totalWeight = $tmparray['weight']; |
720 | 775 | $totalVolume = $tmparray['volume']; |
721 | 776 | $totalQty = 0; |
722 | - if (!empty($object->lines)) |
|
723 | - foreach ($object->lines as $line) { |
|
777 | + if (!empty($object->lines)) { |
|
778 | + foreach ($object->lines as $line) { |
|
724 | 779 | $totalQty+=$line->qty; |
725 | 780 | } |
781 | + } |
|
726 | 782 | // Set trueVolume and volume_units not currently stored into database |
727 | 783 | if ($object->trueWidth && $object->trueHeight && $object->trueDepth) { |
728 | 784 | $object->trueVolume = price(($object->trueWidth * $object->trueHeight * $object->trueDepth), 0, $outputlangs, 0, 0); |
729 | 785 | $object->volume_units = $object->size_units * 3; |
730 | 786 | } |
731 | 787 | |
732 | - if ($totalWeight != '') $totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs); |
|
733 | - if ($totalVolume != '') $totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs); |
|
734 | - if ($object->trueWeight) $totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs); |
|
735 | - if ($object->trueVolume) $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); |
|
788 | + if ($totalWeight != '') { |
|
789 | + $totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs); |
|
790 | + } |
|
791 | + if ($totalVolume != '') { |
|
792 | + $totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs); |
|
793 | + } |
|
794 | + if ($object->trueWeight) { |
|
795 | + $totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs); |
|
796 | + } |
|
797 | + if ($object->trueVolume) { |
|
798 | + $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); |
|
799 | + } |
|
736 | 800 | |
737 | 801 | $pdf->SetFillColor(255, 255, 255); |
738 | 802 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
@@ -765,7 +829,9 @@ discard block |
||
765 | 829 | |
766 | 830 | $index++; |
767 | 831 | } |
768 | - if (!$totalWeighttoshow && !$totalVolumetoshow) $index++; |
|
832 | + if (!$totalWeighttoshow && !$totalVolumetoshow) { |
|
833 | + $index++; |
|
834 | + } |
|
769 | 835 | } |
770 | 836 | |
771 | 837 | $pdf->SetTextColor(0, 0, 0); |
@@ -793,7 +859,9 @@ discard block |
||
793 | 859 | |
794 | 860 | // Force to disable hidetop and hidebottom |
795 | 861 | $hidebottom = 0; |
796 | - if ($hidetop) $hidetop = -1; |
|
862 | + if ($hidetop) { |
|
863 | + $hidetop = -1; |
|
864 | + } |
|
797 | 865 | |
798 | 866 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
799 | 867 | |
@@ -879,7 +947,9 @@ discard block |
||
879 | 947 | |
880 | 948 | $atLeastOneBatch = false; |
881 | 949 | |
882 | - if (empty($conf->productbatch->enabled)) return false; |
|
950 | + if (empty($conf->productbatch->enabled)) { |
|
951 | + return false; |
|
952 | + } |
|
883 | 953 | |
884 | 954 | foreach ($object->lines as $line) { |
885 | 955 | if (!empty($line->batch)) { |
@@ -1041,7 +1111,9 @@ discard block |
||
1041 | 1111 | |
1042 | 1112 | $pdf->SetFont('', '', $default_font_size - 2); |
1043 | 1113 | $text = $linkedobject->ref; |
1044 | - if ($linkedobject->ref_client) $text .= ' ('.$linkedobject->ref_client.')'; |
|
1114 | + if ($linkedobject->ref_client) { |
|
1115 | + $text .= ' ('.$linkedobject->ref_client.')'; |
|
1116 | + } |
|
1045 | 1117 | $Yoff = $Yoff + 8; |
1046 | 1118 | $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); |
1047 | 1119 | $pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), 0, 'R'); |
@@ -1066,18 +1138,28 @@ discard block |
||
1066 | 1138 | $result = $object->fetch_contact($arrayidcontact[0]); |
1067 | 1139 | } |
1068 | 1140 | |
1069 | - if ($usecontact) $thirdparty = $object->contact; |
|
1070 | - else $thirdparty = $this->emetteur; |
|
1141 | + if ($usecontact) { |
|
1142 | + $thirdparty = $object->contact; |
|
1143 | + } else { |
|
1144 | + $thirdparty = $this->emetteur; |
|
1145 | + } |
|
1071 | 1146 | |
1072 | - if (!empty($thirdparty)) $carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); |
|
1147 | + if (!empty($thirdparty)) { |
|
1148 | + $carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); |
|
1149 | + } |
|
1073 | 1150 | |
1074 | - if ($usecontact) $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, 1, 'targetwithdetails', $object); |
|
1075 | - else $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); |
|
1151 | + if ($usecontact) { |
|
1152 | + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, 1, 'targetwithdetails', $object); |
|
1153 | + } else { |
|
1154 | + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); |
|
1155 | + } |
|
1076 | 1156 | |
1077 | 1157 | // Show sender |
1078 | 1158 | $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; |
1079 | 1159 | $posx = $this->marge_gauche; |
1080 | - if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; |
|
1160 | + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) { |
|
1161 | + $posx = $this->page_largeur - $this->marge_droite - 80; |
|
1162 | + } |
|
1081 | 1163 | |
1082 | 1164 | $hautcadre = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40; |
1083 | 1165 | $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82; |
@@ -1121,16 +1203,23 @@ discard block |
||
1121 | 1203 | $thirdparty = $object->thirdparty; |
1122 | 1204 | } |
1123 | 1205 | |
1124 | - if (!empty($thirdparty)) $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); |
|
1206 | + if (!empty($thirdparty)) { |
|
1207 | + $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); |
|
1208 | + } |
|
1125 | 1209 | |
1126 | 1210 | $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (!empty($object->contact) ? $object->contact : null), $usecontact, 'targetwithdetails', $object); |
1127 | 1211 | |
1128 | 1212 | // Show recipient |
1129 | 1213 | $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100; |
1130 | - if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format |
|
1214 | + if ($this->page_largeur < 210) { |
|
1215 | + $widthrecbox = 84; |
|
1216 | + } |
|
1217 | + // To work with US executive format |
|
1131 | 1218 | $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; |
1132 | 1219 | $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; |
1133 | - if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; |
|
1220 | + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) { |
|
1221 | + $posx = $this->marge_gauche; |
|
1222 | + } |
|
1134 | 1223 | |
1135 | 1224 | // Show recipient frame |
1136 | 1225 | $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) { |