@@ -120,8 +120,9 @@ |
||
120 | 120 | |
121 | 121 | $return[] = $tmp; |
122 | 122 | } |
123 | + } else { |
|
124 | + dol_print_error($this->db); |
|
123 | 125 | } |
124 | - else dol_print_error($this->db); |
|
125 | 126 | |
126 | 127 | return $return; |
127 | 128 | } |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies', 'bills')); |
41 | 41 | |
42 | 42 | // Security check |
43 | -if ($user->socid) $socid = $user->socid; |
|
43 | +if ($user->socid) { |
|
44 | + $socid = $user->socid; |
|
45 | +} |
|
44 | 46 | $result = restrictedArea($user, 'prelevement', '', '', 'bons'); |
45 | 47 | |
46 | 48 | $type = GETPOST('type', 'aZ09'); |
@@ -63,7 +65,9 @@ discard block |
||
63 | 65 | |
64 | 66 | $parameters = array('mode' => $mode, 'format' => $format, 'limit' => $limit, 'page' => $page, 'offset' => $offset); |
65 | 67 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
66 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
68 | +if ($reshook < 0) { |
|
69 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
70 | +} |
|
67 | 71 | |
68 | 72 | if (empty($reshook)) |
69 | 73 | { |
@@ -180,7 +184,9 @@ discard block |
||
180 | 184 | print '</table>'; |
181 | 185 | print '</div>'; |
182 | 186 | |
183 | -if ($mesg) print $mesg; |
|
187 | +if ($mesg) { |
|
188 | + print $mesg; |
|
189 | +} |
|
184 | 190 | |
185 | 191 | print '<div class="tabsAction">'."\n"; |
186 | 192 | |
@@ -279,16 +285,20 @@ discard block |
||
279 | 285 | } else { |
280 | 286 | $sql .= " AND pfd.fk_facture = f.rowid"; |
281 | 287 | } |
282 | -if ($socid > 0) $sql .= " AND f.fk_soc = ".$socid; |
|
288 | +if ($socid > 0) { |
|
289 | + $sql .= " AND f.fk_soc = ".$socid; |
|
290 | +} |
|
283 | 291 | |
284 | 292 | $nbtotalofrecords = ''; |
285 | 293 | if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) |
286 | 294 | { |
287 | 295 | $result = $db->query($sql); |
288 | 296 | $nbtotalofrecords = $db->num_rows($result); |
289 | - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
297 | + if (($page * $limit) > $nbtotalofrecords) { |
|
298 | + // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
290 | 299 | { |
291 | 300 | $page = 0; |
301 | + } |
|
292 | 302 | $offset = 0; |
293 | 303 | } |
294 | 304 | } |
@@ -302,9 +312,15 @@ discard block |
||
302 | 312 | $i = 0; |
303 | 313 | |
304 | 314 | $param = ''; |
305 | - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); |
|
306 | - if ($socid) $param .= '&socid='.urlencode($socid); |
|
307 | - if ($option) $param .= "&option=".urlencode($option); |
|
315 | + if ($limit > 0 && $limit != $conf->liste_limit) { |
|
316 | + $param .= '&limit='.urlencode($limit); |
|
317 | + } |
|
318 | + if ($socid) { |
|
319 | + $param .= '&socid='.urlencode($socid); |
|
320 | + } |
|
321 | + if ($option) { |
|
322 | + $param .= "&option=".urlencode($option); |
|
323 | + } |
|
308 | 324 | |
309 | 325 | print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; |
310 | 326 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
@@ -363,7 +379,9 @@ discard block |
||
363 | 379 | // RIB |
364 | 380 | print '<td>'; |
365 | 381 | print $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic; |
366 | - if ($bac->verif() <= 0) print img_warning('Error on default bank number for IBAN : '.$bac->error_message); |
|
382 | + if ($bac->verif() <= 0) { |
|
383 | + print img_warning('Error on default bank number for IBAN : '.$bac->error_message); |
|
384 | + } |
|
367 | 385 | print '</td>'; |
368 | 386 | |
369 | 387 | // RUM |
@@ -373,7 +391,9 @@ discard block |
||
373 | 391 | print $rumtoshow; |
374 | 392 | $format = $thirdpartystatic->display_rib('format'); |
375 | 393 | if ($type != 'bank-transfer') { |
376 | - if ($format) print ' ('.$format.')'; |
|
394 | + if ($format) { |
|
395 | + print ' ('.$format.')'; |
|
396 | + } |
|
377 | 397 | } |
378 | 398 | } else { |
379 | 399 | print img_warning($langs->trans("NoBankAccount")); |
@@ -35,7 +35,9 @@ discard block |
||
35 | 35 | $langs->loadLangs(array('banks', 'categories', 'bills', 'companies', 'withdrawals')); |
36 | 36 | |
37 | 37 | // Securite acces client |
38 | -if ($user->socid > 0) accessforbidden(); |
|
38 | +if ($user->socid > 0) { |
|
39 | + accessforbidden(); |
|
40 | +} |
|
39 | 41 | |
40 | 42 | // Get supervariables |
41 | 43 | $id = GETPOST('id', 'int'); |
@@ -52,8 +54,12 @@ discard block |
||
52 | 54 | $offset = $limit * $page; |
53 | 55 | $pageprev = $page - 1; |
54 | 56 | $pagenext = $page + 1; |
55 | -if (!$sortfield) $sortfield = 'p.ref'; |
|
56 | -if (!$sortorder) $sortorder = 'DESC'; |
|
57 | +if (!$sortfield) { |
|
58 | + $sortfield = 'p.ref'; |
|
59 | +} |
|
60 | +if (!$sortorder) { |
|
61 | + $sortorder = 'DESC'; |
|
62 | +} |
|
57 | 63 | |
58 | 64 | $object = new BonPrelevement($db); |
59 | 65 | |
@@ -129,22 +135,29 @@ discard block |
||
129 | 135 | |
130 | 136 | print '<tr><td class="titlefield">'; |
131 | 137 | $labelofbankfield = "BankToReceiveWithdraw"; |
132 | - if ($object->type == 'bank-transfer') $labelofbankfield = 'BankToPayCreditTransfer'; |
|
138 | + if ($object->type == 'bank-transfer') { |
|
139 | + $labelofbankfield = 'BankToPayCreditTransfer'; |
|
140 | + } |
|
133 | 141 | print $langs->trans($labelofbankfield); |
134 | 142 | print '</td>'; |
135 | 143 | print '<td>'; |
136 | - if ($acc->id > 0) |
|
137 | - print $acc->getNomUrl(1); |
|
144 | + if ($acc->id > 0) { |
|
145 | + print $acc->getNomUrl(1); |
|
146 | + } |
|
138 | 147 | print '</td>'; |
139 | 148 | print '</tr>'; |
140 | 149 | |
141 | 150 | print '<tr><td class="titlefield">'; |
142 | 151 | $labelfororderfield = 'WithdrawalFile'; |
143 | - if ($object->type == 'bank-transfer') $labelfororderfield = 'CreditTransferFile'; |
|
152 | + if ($object->type == 'bank-transfer') { |
|
153 | + $labelfororderfield = 'CreditTransferFile'; |
|
154 | + } |
|
144 | 155 | print $langs->trans($labelfororderfield).'</td><td>'; |
145 | 156 | $relativepath = 'receipts/'.$object->ref.'.xml'; |
146 | 157 | $modulepart = 'prelevement'; |
147 | - if ($object->type == 'bank-transfer') $modulepart = 'paymentbybanktransfer'; |
|
158 | + if ($object->type == 'bank-transfer') { |
|
159 | + $modulepart = 'paymentbybanktransfer'; |
|
160 | + } |
|
148 | 161 | print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$relativepath.'</a>'; |
149 | 162 | print '</td></tr></table>'; |
150 | 163 | |
@@ -183,8 +196,12 @@ discard block |
||
183 | 196 | } else { |
184 | 197 | $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; |
185 | 198 | } |
186 | -if ($object->id > 0) $sql .= " AND p.rowid=".$object->id; |
|
187 | -if ($socid) $sql .= " AND s.rowid = ".$socid; |
|
199 | +if ($object->id > 0) { |
|
200 | + $sql .= " AND p.rowid=".$object->id; |
|
201 | +} |
|
202 | +if ($socid) { |
|
203 | + $sql .= " AND s.rowid = ".$socid; |
|
204 | +} |
|
188 | 205 | $sql .= $db->order($sortfield, $sortorder); |
189 | 206 | |
190 | 207 | // Count total nb of records |
@@ -193,9 +210,11 @@ discard block |
||
193 | 210 | { |
194 | 211 | $resql = $db->query($sql); |
195 | 212 | $nbtotalofrecords = $db->num_rows($resql); |
196 | - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
213 | + if (($page * $limit) > $nbtotalofrecords) { |
|
214 | + // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
197 | 215 | { |
198 | 216 | $page = 0; |
217 | + } |
|
199 | 218 | $offset = 0; |
200 | 219 | } |
201 | 220 | } |
@@ -212,7 +231,9 @@ discard block |
||
212 | 231 | |
213 | 232 | // Lines of title fields |
214 | 233 | print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; |
215 | - if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
234 | + if ($optioncss != '') { |
|
235 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
236 | + } |
|
216 | 237 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
217 | 238 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
218 | 239 | print '<input type="hidden" name="action" value="list">'; |
@@ -307,7 +328,9 @@ discard block |
||
307 | 328 | print '<td> </td>'; |
308 | 329 | print '<td class="right">'; |
309 | 330 | //if ($totalinvoices != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices"); // It is normal to have total that differs. For an amount of invoice of 100, request to pay may be 50 only. |
310 | - if ($totalamount_requested != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices"); |
|
331 | + if ($totalamount_requested != $object->amount) { |
|
332 | + print img_warning("AmountOfFileDiffersFromSumOfInvoices"); |
|
333 | + } |
|
311 | 334 | print "</td>\n"; |
312 | 335 | print '<td class="right">'; |
313 | 336 | print price($totalamount_requested); |
@@ -174,7 +174,10 @@ discard block |
||
174 | 174 | |
175 | 175 | // Get source company |
176 | 176 | $this->emetteur = $mysoc; |
177 | - if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined |
|
177 | + if (empty($this->emetteur->country_code)) { |
|
178 | + $this->emetteur->country_code = substr($langs->defaultlang, -2); |
|
179 | + } |
|
180 | + // By default, if was not defined |
|
178 | 181 | |
179 | 182 | // Define position of columns |
180 | 183 | $this->posxdesc = $this->marge_gauche + 1; // used for notes ans other stuff |
@@ -212,9 +215,13 @@ discard block |
||
212 | 215 | |
213 | 216 | dol_syslog("write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null')); |
214 | 217 | |
215 | - if (!is_object($outputlangs)) $outputlangs = $langs; |
|
218 | + if (!is_object($outputlangs)) { |
|
219 | + $outputlangs = $langs; |
|
220 | + } |
|
216 | 221 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
217 | - if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; |
|
222 | + if (!empty($conf->global->MAIN_USE_FPDF)) { |
|
223 | + $outputlangs->charset_output = 'ISO-8859-1'; |
|
224 | + } |
|
218 | 225 | |
219 | 226 | // Load translation files required by the page |
220 | 227 | $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies")); |
@@ -362,7 +369,9 @@ discard block |
||
362 | 369 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
363 | 370 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
364 | 371 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$object->label." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); |
365 | - if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
372 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
373 | + $pdf->SetCompression(false); |
|
374 | + } |
|
366 | 375 | |
367 | 376 | // Set certificate |
368 | 377 | $cert = empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT; |
@@ -385,7 +394,9 @@ discard block |
||
385 | 394 | |
386 | 395 | // New page |
387 | 396 | $pdf->AddPage(); |
388 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
397 | + if (!empty($tplidx)) { |
|
398 | + $pdf->useTemplate($tplidx); |
|
399 | + } |
|
389 | 400 | $pagenb++; |
390 | 401 | |
391 | 402 | $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs, $outputlangsbis); |
@@ -397,7 +408,9 @@ discard block |
||
397 | 408 | $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10); |
398 | 409 | $tab_height = 130 - $top_shift; |
399 | 410 | $tab_height_newpage = 150; |
400 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $tab_height_newpage -= $top_shift; |
|
411 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
412 | + $tab_height_newpage -= $top_shift; |
|
413 | + } |
|
401 | 414 | |
402 | 415 | $nexY = $tab_top - 1; |
403 | 416 | |
@@ -439,8 +452,12 @@ discard block |
||
439 | 452 | while ($pagenb < $pageposafternote) { |
440 | 453 | $pdf->AddPage(); |
441 | 454 | $pagenb++; |
442 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
443 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
455 | + if (!empty($tplidx)) { |
|
456 | + $pdf->useTemplate($tplidx); |
|
457 | + } |
|
458 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
459 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
460 | + } |
|
444 | 461 | // $this->_pagefoot($pdf,$object,$outputlangs,1); |
445 | 462 | $pdf->setTopMargin($tab_top_newpage); |
446 | 463 | // The only function to edit the bottom margin of current page to set it. |
@@ -456,9 +473,11 @@ discard block |
||
456 | 473 | |
457 | 474 | $posyafter = $pdf->GetY(); |
458 | 475 | |
459 | - if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) // There is no space left for total+free text |
|
476 | + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) { |
|
477 | + // There is no space left for total+free text |
|
460 | 478 | { |
461 | 479 | $pdf->AddPage('', '', true); |
480 | + } |
|
462 | 481 | $pagenb++; |
463 | 482 | $pageposafternote++; |
464 | 483 | $pdf->setPage($pageposafternote); |
@@ -494,8 +513,12 @@ discard block |
||
494 | 513 | |
495 | 514 | // apply note frame to last page |
496 | 515 | $pdf->setPage($pageposafternote); |
497 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
498 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
516 | + if (!empty($tplidx)) { |
|
517 | + $pdf->useTemplate($tplidx); |
|
518 | + } |
|
519 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
520 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
521 | + } |
|
499 | 522 | $height_note = $posyafter - $tab_top_newpage; |
500 | 523 | $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1); |
501 | 524 | } else // No pagebreak |
@@ -512,8 +535,12 @@ discard block |
||
512 | 535 | $pagenb++; |
513 | 536 | $pageposafternote++; |
514 | 537 | $pdf->setPage($pageposafternote); |
515 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
516 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
538 | + if (!empty($tplidx)) { |
|
539 | + $pdf->useTemplate($tplidx); |
|
540 | + } |
|
541 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
542 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
543 | + } |
|
517 | 544 | |
518 | 545 | $posyafter = $tab_top_newpage; |
519 | 546 | } |
@@ -546,7 +573,9 @@ discard block |
||
546 | 573 | |
547 | 574 | // Define size of image if we need it |
548 | 575 | $imglinesize = array(); |
549 | - if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]); |
|
576 | + if (!empty($realpatharray[$i])) { |
|
577 | + $imglinesize = pdf_getSizeForImage($realpatharray[$i]); |
|
578 | + } |
|
550 | 579 | |
551 | 580 | $pdf->setTopMargin($tab_top_newpage); |
552 | 581 | $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
@@ -558,18 +587,24 @@ discard block |
||
558 | 587 | if ($this->getColumnStatus('photo')) |
559 | 588 | { |
560 | 589 | // We start with Photo of product line |
561 | - 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 |
|
590 | + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { |
|
591 | + // If photo too high, we moved completely on new page |
|
562 | 592 | { |
563 | 593 | $pdf->AddPage('', '', true); |
564 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
594 | + } |
|
595 | + if (!empty($tplidx)) { |
|
596 | + $pdf->useTemplate($tplidx); |
|
597 | + } |
|
565 | 598 | $pdf->setPage($pageposbefore + 1); |
566 | 599 | |
567 | 600 | $curY = $tab_top_newpage; |
568 | 601 | |
569 | 602 | // Allows data in the first page if description is long enough to break in multiples pages |
570 | - if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) |
|
571 | - $showpricebeforepagebreak = 1; |
|
572 | - else $showpricebeforepagebreak = 0; |
|
603 | + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) { |
|
604 | + $showpricebeforepagebreak = 1; |
|
605 | + } else { |
|
606 | + $showpricebeforepagebreak = 0; |
|
607 | + } |
|
573 | 608 | } |
574 | 609 | |
575 | 610 | if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) |
@@ -588,9 +623,11 @@ discard block |
||
588 | 623 | $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); |
589 | 624 | $pageposafter = $pdf->getPage(); |
590 | 625 | |
591 | - if ($pageposafter > $pageposbefore) // There is a pagebreak |
|
626 | + if ($pageposafter > $pageposbefore) { |
|
627 | + // There is a pagebreak |
|
592 | 628 | { |
593 | 629 | $pdf->rollbackTransaction(true); |
630 | + } |
|
594 | 631 | $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
595 | 632 | |
596 | 633 | $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); |
@@ -598,20 +635,26 @@ discard block |
||
598 | 635 | $pageposafter = $pdf->getPage(); |
599 | 636 | $posyafter = $pdf->GetY(); |
600 | 637 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
601 | - if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text |
|
638 | + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { |
|
639 | + // There is no space left for total+free text |
|
602 | 640 | { |
603 | 641 | if ($i == ($nblines - 1)) // No more lines, and no space left to show total, so we create a new page |
604 | 642 | { |
605 | 643 | $pdf->AddPage('', '', true); |
606 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
644 | + } |
|
645 | + if (!empty($tplidx)) { |
|
646 | + $pdf->useTemplate($tplidx); |
|
647 | + } |
|
607 | 648 | $pdf->setPage($pageposafter + 1); |
608 | 649 | } |
609 | 650 | } else { |
610 | 651 | // We found a page break |
611 | 652 | // Allows data in the first page if description is long enough to break in multiples pages |
612 | - if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) |
|
613 | - $showpricebeforepagebreak = 1; |
|
614 | - else $showpricebeforepagebreak = 0; |
|
653 | + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) { |
|
654 | + $showpricebeforepagebreak = 1; |
|
655 | + } else { |
|
656 | + $showpricebeforepagebreak = 0; |
|
657 | + } |
|
615 | 658 | } |
616 | 659 | } else // No pagebreak |
617 | 660 | { |
@@ -659,7 +702,9 @@ discard block |
||
659 | 702 | $pagenb++; |
660 | 703 | $pdf->setPage($pagenb); |
661 | 704 | $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
662 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
705 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
706 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
707 | + } |
|
663 | 708 | } |
664 | 709 | |
665 | 710 | if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { |
@@ -671,9 +716,13 @@ discard block |
||
671 | 716 | $this->_pagefoot($pdf, $object, $outputlangs, 1); |
672 | 717 | // New page |
673 | 718 | $pdf->AddPage(); |
674 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
719 | + if (!empty($tplidx)) { |
|
720 | + $pdf->useTemplate($tplidx); |
|
721 | + } |
|
675 | 722 | $pagenb++; |
676 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
723 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
724 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
725 | + } |
|
677 | 726 | } |
678 | 727 | } |
679 | 728 | |
@@ -703,7 +752,9 @@ discard block |
||
703 | 752 | |
704 | 753 | // Pagefoot |
705 | 754 | $this->_pagefoot($pdf, $object, $outputlangs); |
706 | - if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); |
|
755 | + if (method_exists($pdf, 'AliasNbPages')) { |
|
756 | + $pdf->AliasNbPages(); |
|
757 | + } |
|
707 | 758 | |
708 | 759 | $pdf->Close(); |
709 | 760 | |
@@ -720,8 +771,9 @@ discard block |
||
720 | 771 | $this->errors = $hookmanager->errors; |
721 | 772 | } |
722 | 773 | |
723 | - if (!empty($conf->global->MAIN_UMASK)) |
|
724 | - @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
774 | + if (!empty($conf->global->MAIN_UMASK)) { |
|
775 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
776 | + } |
|
725 | 777 | |
726 | 778 | $this->result = array('fullpath'=>$file); |
727 | 779 | |
@@ -771,7 +823,9 @@ discard block |
||
771 | 823 | |
772 | 824 | // Force to disable hidetop and hidebottom |
773 | 825 | $hidebottom = 0; |
774 | - if ($hidetop) $hidetop = -1; |
|
826 | + if ($hidetop) { |
|
827 | + $hidetop = -1; |
|
828 | + } |
|
775 | 829 | |
776 | 830 | $currency = !empty($currency) ? $currency : $conf->currency; |
777 | 831 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
@@ -846,7 +900,9 @@ discard block |
||
846 | 900 | if ($this->emetteur->logo) |
847 | 901 | { |
848 | 902 | $logodir = $conf->mycompany->dir_output; |
849 | - if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; |
|
903 | + if (!empty($conf->mycompany->multidir_output[$object->entity])) { |
|
904 | + $logodir = $conf->mycompany->multidir_output[$object->entity]; |
|
905 | + } |
|
850 | 906 | if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) |
851 | 907 | { |
852 | 908 | $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; |
@@ -965,7 +1021,9 @@ discard block |
||
965 | 1021 | $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; |
966 | 1022 | $posy += $top_shift; |
967 | 1023 | $posx = $this->marge_gauche; |
968 | - if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; |
|
1024 | + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) { |
|
1025 | + $posx = $this->page_largeur - $this->marge_droite - 80; |
|
1026 | + } |
|
969 | 1027 | |
970 | 1028 | $hautcadre = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40; |
971 | 1029 | $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82; |
@@ -645,7 +645,9 @@ |
||
645 | 645 | } |
646 | 646 | |
647 | 647 | $statusType = 'status5'; |
648 | - if ($status == self::STATUS_VALIDATED) $statusType = 'status4'; |
|
648 | + if ($status == self::STATUS_VALIDATED) { |
|
649 | + $statusType = 'status4'; |
|
650 | + } |
|
649 | 651 | |
650 | 652 | return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); |
651 | 653 | } |
@@ -24,7 +24,9 @@ discard block |
||
24 | 24 | */ |
25 | 25 | |
26 | 26 | include_once 'inc.php'; |
27 | -if (file_exists($conffile)) include_once $conffile; |
|
27 | +if (file_exists($conffile)) { |
|
28 | + include_once $conffile; |
|
29 | +} |
|
28 | 30 | require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php'; |
29 | 31 | include_once $dolibarr_main_document_root.'/core/lib/images.lib.php'; |
30 | 32 | require_once $dolibarr_main_document_root.'/core/class/extrafields.class.php'; |
@@ -47,13 +49,21 @@ discard block |
||
47 | 49 | |
48 | 50 | $langs->loadLangs(array("admin", "install", "other")); |
49 | 51 | |
50 | -if ($dolibarr_main_db_type == "mysqli") $choix = 1; |
|
51 | -if ($dolibarr_main_db_type == "pgsql") $choix = 2; |
|
52 | -if ($dolibarr_main_db_type == "mssql") $choix = 3; |
|
52 | +if ($dolibarr_main_db_type == "mysqli") { |
|
53 | + $choix = 1; |
|
54 | +} |
|
55 | +if ($dolibarr_main_db_type == "pgsql") { |
|
56 | + $choix = 2; |
|
57 | +} |
|
58 | +if ($dolibarr_main_db_type == "mssql") { |
|
59 | + $choix = 3; |
|
60 | +} |
|
53 | 61 | |
54 | 62 | |
55 | 63 | dolibarr_install_syslog("--- repair: entering upgrade.php page"); |
56 | -if (!is_object($conf)) dolibarr_install_syslog("repair: conf file not initialized", LOG_ERR); |
|
64 | +if (!is_object($conf)) { |
|
65 | + dolibarr_install_syslog("repair: conf file not initialized", LOG_ERR); |
|
66 | +} |
|
57 | 67 | |
58 | 68 | |
59 | 69 | /* |
@@ -99,8 +109,10 @@ discard block |
||
99 | 109 | $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); |
100 | 110 | $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); |
101 | 111 | $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted |
102 | - } else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); |
|
103 | -} |
|
112 | + } else { |
|
113 | + $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); |
|
114 | + } |
|
115 | + } |
|
104 | 116 | |
105 | 117 | // $conf is already instancied inside inc.php |
106 | 118 | $conf->db->type = $dolibarr_main_db_type; |
@@ -156,7 +168,9 @@ discard block |
||
156 | 168 | |
157 | 169 | $conf->setValues($db); |
158 | 170 | // Reset forced setup after the setValues |
159 | -if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); |
|
171 | +if (defined('SYSLOG_FILE')) { |
|
172 | + $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); |
|
173 | +} |
|
160 | 174 | $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; |
161 | 175 | |
162 | 176 | |
@@ -191,7 +205,9 @@ discard block |
||
191 | 205 | { |
192 | 206 | while (($file = readdir($handle)) !== false) |
193 | 207 | { |
194 | - if (preg_match('/\.sql$/i', $file)) $filesindir[] = $file; |
|
208 | + if (preg_match('/\.sql$/i', $file)) { |
|
209 | + $filesindir[] = $file; |
|
210 | + } |
|
195 | 211 | } |
196 | 212 | } |
197 | 213 | sort($filesindir); |
@@ -256,8 +272,12 @@ discard block |
||
256 | 272 | $fieldtype = isset($obj->Type) ? $obj->Type : 'varchar'; |
257 | 273 | } |
258 | 274 | |
259 | - if (empty($fieldname)) continue; |
|
260 | - if (in_array($fieldname, array('rowid', 'tms', 'fk_object', 'import_key'))) continue; |
|
275 | + if (empty($fieldname)) { |
|
276 | + continue; |
|
277 | + } |
|
278 | + if (in_array($fieldname, array('rowid', 'tms', 'fk_object', 'import_key'))) { |
|
279 | + continue; |
|
280 | + } |
|
261 | 281 | $arrayoffieldsfound[$fieldname] = array('type'=>$fieldtype); |
262 | 282 | } |
263 | 283 | |
@@ -500,7 +520,9 @@ discard block |
||
500 | 520 | |
501 | 521 | $tmp = explode('.', $obj->logo); |
502 | 522 | $name = $tmp[0]; |
503 | - if (isset($tmp[1])) $ext = '.'.$tmp[1]; |
|
523 | + if (isset($tmp[1])) { |
|
524 | + $ext = '.'.$tmp[1]; |
|
525 | + } |
|
504 | 526 | |
505 | 527 | if (!empty($name)) |
506 | 528 | { |
@@ -583,7 +605,9 @@ discard block |
||
583 | 605 | |
584 | 606 | $tmp = explode('.', $obj->photo); |
585 | 607 | $name = $tmp[0]; |
586 | - if (isset($tmp[1])) $ext = '.'.$tmp[1]; |
|
608 | + if (isset($tmp[1])) { |
|
609 | + $ext = '.'.$tmp[1]; |
|
610 | + } |
|
587 | 611 | |
588 | 612 | if (!empty($name)) |
589 | 613 | { |
@@ -765,16 +789,25 @@ discard block |
||
765 | 789 | |
766 | 790 | $db->begin(); |
767 | 791 | |
768 | - if ($modulecond) // And menu entry for module $modulecond was found in database. |
|
792 | + if ($modulecond) { |
|
793 | + // And menu entry for module $modulecond was found in database. |
|
769 | 794 | { |
770 | 795 | $moduleok = 0; |
796 | + } |
|
771 | 797 | foreach ($modulecondarray as $tmpname) |
772 | 798 | { |
773 | - if ($tmpname == 'margins') $tmpname = 'margin'; // TODO Remove this when normalized |
|
799 | + if ($tmpname == 'margins') { |
|
800 | + $tmpname = 'margin'; |
|
801 | + } |
|
802 | + // TODO Remove this when normalized |
|
774 | 803 | |
775 | 804 | $result = 0; |
776 | - if (!empty($conf->$tmpname)) $result = $conf->$tmpname->enabled; |
|
777 | - if ($result) $moduleok++; |
|
805 | + if (!empty($conf->$tmpname)) { |
|
806 | + $result = $conf->$tmpname->enabled; |
|
807 | + } |
|
808 | + if ($result) { |
|
809 | + $moduleok++; |
|
810 | + } |
|
778 | 811 | } |
779 | 812 | |
780 | 813 | if (!$moduleok && $modulecond) |
@@ -788,7 +821,9 @@ discard block |
||
788 | 821 | { |
789 | 822 | $error++; |
790 | 823 | dol_print_error($db); |
791 | - } else print ' - <span class="warning">Cleaned</span>'; |
|
824 | + } else { |
|
825 | + print ' - <span class="warning">Cleaned</span>'; |
|
826 | + } |
|
792 | 827 | } else { |
793 | 828 | print ' - <span class="warning">Canceled (test mode)</span>'; |
794 | 829 | } |
@@ -797,12 +832,17 @@ discard block |
||
797 | 832 | } |
798 | 833 | } |
799 | 834 | |
800 | - if (!$error) $db->commit(); |
|
801 | - else $db->rollback(); |
|
835 | + if (!$error) { |
|
836 | + $db->commit(); |
|
837 | + } else { |
|
838 | + $db->rollback(); |
|
839 | + } |
|
802 | 840 | |
803 | 841 | print'</td></tr>'; |
804 | 842 | |
805 | - if ($error) break; |
|
843 | + if ($error) { |
|
844 | + break; |
|
845 | + } |
|
806 | 846 | |
807 | 847 | $i++; |
808 | 848 | } |
@@ -824,14 +864,29 @@ discard block |
||
824 | 864 | { |
825 | 865 | $filearray = array(); |
826 | 866 | $upload_dir = isset($conf->$modulepart->dir_output) ? $conf->$modulepart->dir_output : ''; |
827 | - if ($modulepart == 'company') $upload_dir = $conf->societe->dir_output; // TODO change for multicompany sharing |
|
828 | - if ($modulepart == 'invoice') $upload_dir = $conf->facture->dir_output; |
|
829 | - if ($modulepart == 'invoice_supplier') $upload_dir = $conf->fournisseur->facture->dir_output; |
|
830 | - if ($modulepart == 'order') $upload_dir = $conf->commande->dir_output; |
|
831 | - if ($modulepart == 'order_supplier') $upload_dir = $conf->fournisseur->commande->dir_output; |
|
832 | - if ($modulepart == 'contract') $upload_dir = $conf->contrat->dir_output; |
|
867 | + if ($modulepart == 'company') { |
|
868 | + $upload_dir = $conf->societe->dir_output; |
|
869 | + } |
|
870 | + // TODO change for multicompany sharing |
|
871 | + if ($modulepart == 'invoice') { |
|
872 | + $upload_dir = $conf->facture->dir_output; |
|
873 | + } |
|
874 | + if ($modulepart == 'invoice_supplier') { |
|
875 | + $upload_dir = $conf->fournisseur->facture->dir_output; |
|
876 | + } |
|
877 | + if ($modulepart == 'order') { |
|
878 | + $upload_dir = $conf->commande->dir_output; |
|
879 | + } |
|
880 | + if ($modulepart == 'order_supplier') { |
|
881 | + $upload_dir = $conf->fournisseur->commande->dir_output; |
|
882 | + } |
|
883 | + if ($modulepart == 'contract') { |
|
884 | + $upload_dir = $conf->contrat->dir_output; |
|
885 | + } |
|
833 | 886 | |
834 | - if (empty($upload_dir)) continue; |
|
887 | + if (empty($upload_dir)) { |
|
888 | + continue; |
|
889 | + } |
|
835 | 890 | |
836 | 891 | print '<tr><td colspan="2"><br>*** Clean orphelins files into files '.$upload_dir.'</td></tr>'; |
837 | 892 | |
@@ -915,10 +970,12 @@ discard block |
||
915 | 970 | //print 'Fetch '.$id.' or '.$ref.'<br>'; |
916 | 971 | $result = $object_instance->fetch($id, $ref); |
917 | 972 | //print $result.'<br>'; |
918 | - if ($result == 0) // Not found but no error |
|
973 | + if ($result == 0) { |
|
974 | + // Not found but no error |
|
919 | 975 | { |
920 | 976 | // Clean of orphelins directories are done into repair.php |
921 | 977 | print '<tr><td colspan="2">'; |
978 | + } |
|
922 | 979 | print 'Delete orphelins file '.$file['fullname'].'<br>'; |
923 | 980 | if (GETPOST('clean_orphelin_dir', 'alpha') == 'confirmed') |
924 | 981 | { |
@@ -926,7 +983,9 @@ discard block |
||
926 | 983 | dol_delete_dir(dirname($file['fullname']), 1); |
927 | 984 | } |
928 | 985 | print "</td></tr>"; |
929 | - } elseif ($result < 0) print 'Error in '.get_class($object_instance).'.fetch of id'.$id.' ref='.$ref.', result='.$result.'<br>'; |
|
986 | + } elseif ($result < 0) { |
|
987 | + print 'Error in '.get_class($object_instance).'.fetch of id'.$id.' ref='.$ref.', result='.$result.'<br>'; |
|
988 | + } |
|
930 | 989 | } |
931 | 990 | } |
932 | 991 | } |
@@ -1009,8 +1068,11 @@ discard block |
||
1009 | 1068 | dol_print_error($db); |
1010 | 1069 | } |
1011 | 1070 | |
1012 | - if (!$error) $db->commit(); |
|
1013 | - else $db->rollback(); |
|
1071 | + if (!$error) { |
|
1072 | + $db->commit(); |
|
1073 | + } else { |
|
1074 | + $db->rollback(); |
|
1075 | + } |
|
1014 | 1076 | } |
1015 | 1077 | } |
1016 | 1078 | } |
@@ -1096,12 +1158,17 @@ discard block |
||
1096 | 1158 | } |
1097 | 1159 | } |
1098 | 1160 | |
1099 | - if (!$error) $db->commit(); |
|
1100 | - else $db->rollback(); |
|
1161 | + if (!$error) { |
|
1162 | + $db->commit(); |
|
1163 | + } else { |
|
1164 | + $db->rollback(); |
|
1165 | + } |
|
1101 | 1166 | |
1102 | 1167 | print'</td></tr>'; |
1103 | 1168 | |
1104 | - if ($error) break; |
|
1169 | + if ($error) { |
|
1170 | + break; |
|
1171 | + } |
|
1105 | 1172 | |
1106 | 1173 | $i++; |
1107 | 1174 | } |
@@ -1150,12 +1217,16 @@ discard block |
||
1150 | 1217 | { |
1151 | 1218 | $name = strtolower($reg[1]); |
1152 | 1219 | |
1153 | - if ($name) // An entry for key $key and module $name was found in database. |
|
1220 | + if ($name) { |
|
1221 | + // An entry for key $key and module $name was found in database. |
|
1154 | 1222 | { |
1155 | 1223 | $reloffile = ''; |
1224 | + } |
|
1156 | 1225 | $result = 'found'; |
1157 | 1226 | |
1158 | - if ($key == 'hooks') $reloffile = $name.'/class/actions_'.$name.'.class.php'; |
|
1227 | + if ($key == 'hooks') { |
|
1228 | + $reloffile = $name.'/class/actions_'.$name.'.class.php'; |
|
1229 | + } |
|
1159 | 1230 | if ($key == 'js') |
1160 | 1231 | { |
1161 | 1232 | $value = $obj->value; |
@@ -1167,7 +1238,10 @@ discard block |
||
1167 | 1238 | { |
1168 | 1239 | $value = $obj->value; |
1169 | 1240 | $valuearray = json_decode($value); |
1170 | - if ($value && count($valuearray) == 0) $valuearray[0] = $value; // If value was not a json array but a string |
|
1241 | + if ($value && count($valuearray) == 0) { |
|
1242 | + $valuearray[0] = $value; |
|
1243 | + } |
|
1244 | + // If value was not a json array but a string |
|
1171 | 1245 | $reloffile = preg_replace('/^\//', '', $valuearray[0]); |
1172 | 1246 | } |
1173 | 1247 | |
@@ -1201,7 +1275,9 @@ discard block |
||
1201 | 1275 | { |
1202 | 1276 | $error++; |
1203 | 1277 | dol_print_error($db); |
1204 | - } else print ' - <span class="warning">Cleaned</span>'; |
|
1278 | + } else { |
|
1279 | + print ' - <span class="warning">Cleaned</span>'; |
|
1280 | + } |
|
1205 | 1281 | } else { |
1206 | 1282 | print ' - <span class="warning">Canceled (test mode)</span>'; |
1207 | 1283 | } |
@@ -1210,13 +1286,18 @@ discard block |
||
1210 | 1286 | } |
1211 | 1287 | } |
1212 | 1288 | |
1213 | - if (!$error) $db->commit(); |
|
1214 | - else $db->rollback(); |
|
1289 | + if (!$error) { |
|
1290 | + $db->commit(); |
|
1291 | + } else { |
|
1292 | + $db->rollback(); |
|
1293 | + } |
|
1215 | 1294 | } |
1216 | 1295 | |
1217 | 1296 | print'</td></tr>'; |
1218 | 1297 | |
1219 | - if ($error) break; |
|
1298 | + if ($error) { |
|
1299 | + break; |
|
1300 | + } |
|
1220 | 1301 | |
1221 | 1302 | $i++; |
1222 | 1303 | } |
@@ -1300,7 +1381,9 @@ discard block |
||
1300 | 1381 | foreach ($listoftables as $table) |
1301 | 1382 | { |
1302 | 1383 | // do not convert llx_const if mysql encrypt/decrypt is used |
1303 | - if ($conf->db->dolibarr_main_db_encryption != 0 && preg_match('/\_const$/', $table)) continue; |
|
1384 | + if ($conf->db->dolibarr_main_db_encryption != 0 && preg_match('/\_const$/', $table)) { |
|
1385 | + continue; |
|
1386 | + } |
|
1304 | 1387 | |
1305 | 1388 | print '<tr><td colspan="2">'; |
1306 | 1389 | print $table; |
@@ -1310,7 +1393,9 @@ discard block |
||
1310 | 1393 | { |
1311 | 1394 | $resql = $db->query($sql); |
1312 | 1395 | print ' - Done ('.($resql ? 'OK' : 'KO').')'; |
1313 | - } else print ' - Disabled'; |
|
1396 | + } else { |
|
1397 | + print ' - Disabled'; |
|
1398 | + } |
|
1314 | 1399 | print '</td></tr>'; |
1315 | 1400 | } |
1316 | 1401 | |
@@ -1385,9 +1470,13 @@ discard block |
||
1385 | 1470 | $n_processed_rows++; |
1386 | 1471 | continue; |
1387 | 1472 | } |
1388 | - if ($db->num_rows($resql_line) == 0) continue; |
|
1473 | + if ($db->num_rows($resql_line) == 0) { |
|
1474 | + continue; |
|
1475 | + } |
|
1389 | 1476 | while ($obj_line = $db->fetch_object($resql_line)) { |
1390 | - if (!$remaining_qty) break; |
|
1477 | + if (!$remaining_qty) { |
|
1478 | + break; |
|
1479 | + } |
|
1391 | 1480 | if (!$obj_line->rowid) { |
1392 | 1481 | continue; |
1393 | 1482 | } |
@@ -1486,7 +1575,11 @@ discard block |
||
1486 | 1575 | dolibarr_install_syslog("--- repair: end"); |
1487 | 1576 | pFooter(1, $setuplang); |
1488 | 1577 | |
1489 | -if ($db->connected) $db->close(); |
|
1578 | +if ($db->connected) { |
|
1579 | + $db->close(); |
|
1580 | +} |
|
1490 | 1581 | |
1491 | 1582 | // Return code if ran from command line |
1492 | -if (!$ok && isset($argv[1])) exit(1); |
|
1583 | +if (!$ok && isset($argv[1])) { |
|
1584 | + exit(1); |
|
1585 | +} |
@@ -104,8 +104,9 @@ discard block |
||
104 | 104 | if ($action == 'setlistsorttodo') { |
105 | 105 | $setlistsorttodo = GETPOST('value', 'int'); |
106 | 106 | $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity); |
107 | - if (!$res > 0) |
|
108 | - $error++; |
|
107 | + if (!$res > 0) { |
|
108 | + $error++; |
|
109 | + } |
|
109 | 110 | |
110 | 111 | if (!$error) { |
111 | 112 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
@@ -117,8 +118,9 @@ discard block |
||
117 | 118 | if ($action == 'setlistsortdone') { |
118 | 119 | $setlistsortdone = GETPOST('value', 'int'); |
119 | 120 | $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity); |
120 | - if (!$res > 0) |
|
121 | - $error++; |
|
121 | + if (!$res > 0) { |
|
122 | + $error++; |
|
123 | + } |
|
122 | 124 | if (!$error) { |
123 | 125 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
124 | 126 | } else { |
@@ -129,8 +131,9 @@ discard block |
||
129 | 131 | if ($action == 'setmanagezero') { |
130 | 132 | $setmanagezero = GETPOST('value', 'int'); |
131 | 133 | $res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity); |
132 | - if (!$res > 0) |
|
133 | - $error++; |
|
134 | + if (!$res > 0) { |
|
135 | + $error++; |
|
136 | + } |
|
134 | 137 | if (!$error) { |
135 | 138 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
136 | 139 | } else { |
@@ -141,8 +144,9 @@ discard block |
||
141 | 144 | if ($action == 'setdisabledirectinput') { |
142 | 145 | $setdisabledirectinput = GETPOST('value', 'int'); |
143 | 146 | $res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity); |
144 | - if (!$res > 0) |
|
145 | - $error++; |
|
147 | + if (!$res > 0) { |
|
148 | + $error++; |
|
149 | + } |
|
146 | 150 | if (!$error) { |
147 | 151 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
148 | 152 | } else { |
@@ -153,8 +157,9 @@ discard block |
||
153 | 157 | if ($action == 'setenabledraftexport') { |
154 | 158 | $setenabledraftexport = GETPOST('value', 'int'); |
155 | 159 | $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity); |
156 | - if (!$res > 0) |
|
157 | - $error++; |
|
160 | + if (!$res > 0) { |
|
161 | + $error++; |
|
162 | + } |
|
158 | 163 | if (!$error) { |
159 | 164 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
160 | 165 | } else { |
@@ -165,8 +170,9 @@ discard block |
||
165 | 170 | if ($action == 'setenablesubsidiarylist') { |
166 | 171 | $setenablesubsidiarylist = GETPOST('value', 'int'); |
167 | 172 | $res = dolibarr_set_const($db, "ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist, 'yesno', 0, '', $conf->entity); |
168 | - if (!$res > 0) |
|
169 | - $error++; |
|
173 | + if (!$res > 0) { |
|
174 | + $error++; |
|
175 | + } |
|
170 | 176 | if (!$error) { |
171 | 177 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
172 | 178 | } else { |
@@ -177,8 +183,9 @@ discard block |
||
177 | 183 | if ($action == 'setdisablebindingonsales') { |
178 | 184 | $setdisablebindingonsales = GETPOST('value', 'int'); |
179 | 185 | $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales, 'yesno', 0, '', $conf->entity); |
180 | - if (!$res > 0) |
|
181 | - $error++; |
|
186 | + if (!$res > 0) { |
|
187 | + $error++; |
|
188 | + } |
|
182 | 189 | if (!$error) { |
183 | 190 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
184 | 191 | } else { |
@@ -189,8 +196,9 @@ discard block |
||
189 | 196 | if ($action == 'setdisablebindingonpurchases') { |
190 | 197 | $setdisablebindingonpurchases = GETPOST('value', 'int'); |
191 | 198 | $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases, 'yesno', 0, '', $conf->entity); |
192 | - if (!$res > 0) |
|
193 | - $error++; |
|
199 | + if (!$res > 0) { |
|
200 | + $error++; |
|
201 | + } |
|
194 | 202 | if (!$error) { |
195 | 203 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
196 | 204 | } else { |
@@ -201,8 +209,9 @@ discard block |
||
201 | 209 | if ($action == 'setdisablebindingonexpensereports') { |
202 | 210 | $setdisablebindingonexpensereports = GETPOST('value', 'int'); |
203 | 211 | $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports, 'yesno', 0, '', $conf->entity); |
204 | - if (!$res > 0) |
|
205 | - $error++; |
|
212 | + if (!$res > 0) { |
|
213 | + $error++; |
|
214 | + } |
|
206 | 215 | if (!$error) { |
207 | 216 | setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); |
208 | 217 | } else { |
@@ -323,7 +332,9 @@ discard block |
||
323 | 332 | { |
324 | 333 | print '<tr class="oddeven value">'; |
325 | 334 | |
326 | - if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) continue; |
|
335 | + if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) { |
|
336 | + continue; |
|
337 | + } |
|
327 | 338 | |
328 | 339 | // Param |
329 | 340 | $label = $langs->trans($key); |
@@ -140,16 +140,36 @@ discard block |
||
140 | 140 | |
141 | 141 | // Clean parameters |
142 | 142 | |
143 | - if (isset($this->fk_commande)) $this->fk_commande = trim($this->fk_commande); |
|
144 | - if (isset($this->fk_product)) $this->fk_product = trim($this->fk_product); |
|
145 | - if (isset($this->fk_commandefourndet)) $this->fk_commandefourndet = trim($this->fk_commandefourndet); |
|
146 | - if (isset($this->qty)) $this->qty = trim($this->qty); |
|
147 | - if (isset($this->fk_entrepot)) $this->fk_entrepot = trim($this->fk_entrepot); |
|
148 | - if (isset($this->fk_user)) $this->fk_user = trim($this->fk_user); |
|
149 | - if (isset($this->comment)) $this->comment = trim($this->comment); |
|
150 | - if (isset($this->status)) $this->status = trim($this->status); |
|
151 | - if (isset($this->batch)) $this->batch = trim($this->batch); |
|
152 | - if (empty($this->datec)) $this->datec = dol_now(); |
|
143 | + if (isset($this->fk_commande)) { |
|
144 | + $this->fk_commande = trim($this->fk_commande); |
|
145 | + } |
|
146 | + if (isset($this->fk_product)) { |
|
147 | + $this->fk_product = trim($this->fk_product); |
|
148 | + } |
|
149 | + if (isset($this->fk_commandefourndet)) { |
|
150 | + $this->fk_commandefourndet = trim($this->fk_commandefourndet); |
|
151 | + } |
|
152 | + if (isset($this->qty)) { |
|
153 | + $this->qty = trim($this->qty); |
|
154 | + } |
|
155 | + if (isset($this->fk_entrepot)) { |
|
156 | + $this->fk_entrepot = trim($this->fk_entrepot); |
|
157 | + } |
|
158 | + if (isset($this->fk_user)) { |
|
159 | + $this->fk_user = trim($this->fk_user); |
|
160 | + } |
|
161 | + if (isset($this->comment)) { |
|
162 | + $this->comment = trim($this->comment); |
|
163 | + } |
|
164 | + if (isset($this->status)) { |
|
165 | + $this->status = trim($this->status); |
|
166 | + } |
|
167 | + if (isset($this->batch)) { |
|
168 | + $this->batch = trim($this->batch); |
|
169 | + } |
|
170 | + if (empty($this->datec)) { |
|
171 | + $this->datec = dol_now(); |
|
172 | + } |
|
153 | 173 | |
154 | 174 | |
155 | 175 | // Check parameters |
@@ -214,7 +234,9 @@ discard block |
||
214 | 234 | if (!$error) |
215 | 235 | { |
216 | 236 | $result = $this->insertExtraFields(); |
217 | - if ($result < 0) $error++; |
|
237 | + if ($result < 0) { |
|
238 | + $error++; |
|
239 | + } |
|
218 | 240 | } |
219 | 241 | |
220 | 242 | // Commit or rollback |
@@ -264,8 +286,11 @@ discard block |
||
264 | 286 | |
265 | 287 | |
266 | 288 | $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; |
267 | - if ($ref) $sql .= " WHERE t.ref = '".$ref."'"; |
|
268 | - else $sql .= " WHERE t.rowid = ".$id; |
|
289 | + if ($ref) { |
|
290 | + $sql .= " WHERE t.ref = '".$ref."'"; |
|
291 | + } else { |
|
292 | + $sql .= " WHERE t.rowid = ".$id; |
|
293 | + } |
|
269 | 294 | |
270 | 295 | dol_syslog(get_class($this)."::fetch"); |
271 | 296 | $resql = $this->db->query($sql); |
@@ -318,15 +343,33 @@ discard block |
||
318 | 343 | |
319 | 344 | // Clean parameters |
320 | 345 | |
321 | - if (isset($this->fk_commande)) $this->fk_commande = trim($this->fk_commande); |
|
322 | - if (isset($this->fk_product)) $this->fk_product = trim($this->fk_product); |
|
323 | - if (isset($this->fk_commandefourndet)) $this->fk_commandefourndet = trim($this->fk_commandefourndet); |
|
324 | - if (isset($this->qty)) $this->qty = trim($this->qty); |
|
325 | - if (isset($this->fk_entrepot)) $this->fk_entrepot = trim($this->fk_entrepot); |
|
326 | - if (isset($this->fk_user)) $this->fk_user = trim($this->fk_user); |
|
327 | - if (isset($this->comment)) $this->comment = trim($this->comment); |
|
328 | - if (isset($this->status)) $this->status = trim($this->status); |
|
329 | - if (isset($this->batch)) $this->batch = trim($this->batch); |
|
346 | + if (isset($this->fk_commande)) { |
|
347 | + $this->fk_commande = trim($this->fk_commande); |
|
348 | + } |
|
349 | + if (isset($this->fk_product)) { |
|
350 | + $this->fk_product = trim($this->fk_product); |
|
351 | + } |
|
352 | + if (isset($this->fk_commandefourndet)) { |
|
353 | + $this->fk_commandefourndet = trim($this->fk_commandefourndet); |
|
354 | + } |
|
355 | + if (isset($this->qty)) { |
|
356 | + $this->qty = trim($this->qty); |
|
357 | + } |
|
358 | + if (isset($this->fk_entrepot)) { |
|
359 | + $this->fk_entrepot = trim($this->fk_entrepot); |
|
360 | + } |
|
361 | + if (isset($this->fk_user)) { |
|
362 | + $this->fk_user = trim($this->fk_user); |
|
363 | + } |
|
364 | + if (isset($this->comment)) { |
|
365 | + $this->comment = trim($this->comment); |
|
366 | + } |
|
367 | + if (isset($this->status)) { |
|
368 | + $this->status = trim($this->status); |
|
369 | + } |
|
370 | + if (isset($this->batch)) { |
|
371 | + $this->batch = trim($this->batch); |
|
372 | + } |
|
330 | 373 | |
331 | 374 | |
332 | 375 | |
@@ -363,7 +406,9 @@ discard block |
||
363 | 406 | { |
364 | 407 | if (!$error) |
365 | 408 | { |
366 | - if (empty($this->id) && !empty($this->rowid))$this->id = $this->rowid; |
|
409 | + if (empty($this->id) && !empty($this->rowid)) { |
|
410 | + $this->id = $this->rowid; |
|
411 | + } |
|
367 | 412 | $result = $this->insertExtraFields(); |
368 | 413 | if ($result < 0) |
369 | 414 | { |
@@ -375,7 +420,9 @@ discard block |
||
375 | 420 | { |
376 | 421 | // Uncomment this and change MYOBJECT to your own tag if you |
377 | 422 | $result = $this->call_trigger('LINERECEPTION_UPDATE', $user); |
378 | - if ($result < 0) $error++; |
|
423 | + if ($result < 0) { |
|
424 | + $error++; |
|
425 | + } |
|
379 | 426 | //// End call triggers |
380 | 427 | } |
381 | 428 | } |
@@ -552,19 +599,31 @@ discard block |
||
552 | 599 | return $langs->trans($this->statuts[$status]); |
553 | 600 | } elseif ($mode == 3) |
554 | 601 | { |
555 | - if ($status == 0) return img_picto($langs->trans($this->statuts[$status]), 'statut0'); |
|
556 | - elseif ($status == 1) return img_picto($langs->trans($this->statuts[$status]), 'statut4'); |
|
557 | - elseif ($status == 2) return img_picto($langs->trans($this->statuts[$status]), 'statut8'); |
|
602 | + if ($status == 0) { |
|
603 | + return img_picto($langs->trans($this->statuts[$status]), 'statut0'); |
|
604 | + } elseif ($status == 1) { |
|
605 | + return img_picto($langs->trans($this->statuts[$status]), 'statut4'); |
|
606 | + } elseif ($status == 2) { |
|
607 | + return img_picto($langs->trans($this->statuts[$status]), 'statut8'); |
|
608 | + } |
|
558 | 609 | } elseif ($mode == 4) |
559 | 610 | { |
560 | - if ($status == 0) return img_picto($langs->trans($this->statuts[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); |
|
561 | - elseif ($status == 1) return img_picto($langs->trans($this->statuts[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); |
|
562 | - elseif ($status == 2) return img_picto($langs->trans($this->statuts[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); |
|
611 | + if ($status == 0) { |
|
612 | + return img_picto($langs->trans($this->statuts[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); |
|
613 | + } elseif ($status == 1) { |
|
614 | + return img_picto($langs->trans($this->statuts[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); |
|
615 | + } elseif ($status == 2) { |
|
616 | + return img_picto($langs->trans($this->statuts[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); |
|
617 | + } |
|
563 | 618 | } elseif ($mode == 5) |
564 | 619 | { |
565 | - if ($status == 0) return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$status]).' </span>'.img_picto($langs->trans($this->statuts[$status]), 'statut0'); |
|
566 | - elseif ($status == 1) return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$status]).' </span>'.img_picto($langs->trans($this->statuts[$status]), 'statut4'); |
|
567 | - elseif ($status == 2) return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$status]).' </span>'.img_picto($langs->trans($this->statuts[$status]), 'statut8'); |
|
620 | + if ($status == 0) { |
|
621 | + return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$status]).' </span>'.img_picto($langs->trans($this->statuts[$status]), 'statut0'); |
|
622 | + } elseif ($status == 1) { |
|
623 | + return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$status]).' </span>'.img_picto($langs->trans($this->statuts[$status]), 'statut4'); |
|
624 | + } elseif ($status == 2) { |
|
625 | + return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$status]).' </span>'.img_picto($langs->trans($this->statuts[$status]), 'statut8'); |
|
626 | + } |
|
568 | 627 | } |
569 | 628 | } |
570 | 629 |
@@ -32,7 +32,9 @@ discard block |
||
32 | 32 | |
33 | 33 | |
34 | 34 | // Security check |
35 | -if (!$user->rights->opensurvey->read) accessforbidden(); |
|
35 | +if (!$user->rights->opensurvey->read) { |
|
36 | + accessforbidden(); |
|
37 | +} |
|
36 | 38 | |
37 | 39 | // Initialisation des variables |
38 | 40 | $action = GETPOST('action', 'aZ09'); |
@@ -63,17 +65,23 @@ discard block |
||
63 | 65 | |
64 | 66 | $parameters = array('id' => $numsondage); |
65 | 67 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
66 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
68 | +if ($reshook < 0) { |
|
69 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
70 | +} |
|
67 | 71 | |
68 | 72 | if (empty($reshook)) |
69 | 73 | { |
70 | - if ($cancel) $action = ''; |
|
74 | + if ($cancel) { |
|
75 | + $action = ''; |
|
76 | + } |
|
71 | 77 | |
72 | 78 | // Delete |
73 | 79 | if ($action == 'delete_confirm') |
74 | 80 | { |
75 | 81 | // Security check |
76 | - if (!$user->rights->opensurvey->write) accessforbidden(); |
|
82 | + if (!$user->rights->opensurvey->write) { |
|
83 | + accessforbidden(); |
|
84 | + } |
|
77 | 85 | |
78 | 86 | $result = $object->delete($user, '', $numsondage); |
79 | 87 | |
@@ -99,7 +107,9 @@ discard block |
||
99 | 107 | if ($action == 'update') |
100 | 108 | { |
101 | 109 | // Security check |
102 | - if (!$user->rights->opensurvey->write) accessforbidden(); |
|
110 | + if (!$user->rights->opensurvey->write) { |
|
111 | + accessforbidden(); |
|
112 | + } |
|
103 | 113 | |
104 | 114 | $error = 0; |
105 | 115 | |
@@ -164,14 +174,18 @@ discard block |
||
164 | 174 | if ($idcomment) |
165 | 175 | { |
166 | 176 | // Security check |
167 | - if (!$user->rights->opensurvey->write) accessforbidden(); |
|
177 | + if (!$user->rights->opensurvey->write) { |
|
178 | + accessforbidden(); |
|
179 | + } |
|
168 | 180 | |
169 | 181 | $resql = $object->deleteComment($idcomment); |
170 | 182 | } |
171 | 183 | |
172 | 184 | if ($action == 'edit') { |
173 | 185 | // Security check |
174 | - if (!$user->rights->opensurvey->write) accessforbidden(); |
|
186 | + if (!$user->rights->opensurvey->write) { |
|
187 | + accessforbidden(); |
|
188 | + } |
|
175 | 189 | } |
176 | 190 | } |
177 | 191 | |
@@ -240,7 +254,9 @@ discard block |
||
240 | 254 | if ($action == 'edit') |
241 | 255 | { |
242 | 256 | print '<input type="text" name="nouveautitre" style="width: 95%" value="'.dol_escape_htmltag(dol_htmlentities($object->title)).'">'; |
243 | -} else print dol_htmlentities($object->title); |
|
257 | +} else { |
|
258 | + print dol_htmlentities($object->title); |
|
259 | +} |
|
244 | 260 | print '</td></tr>'; |
245 | 261 | |
246 | 262 | // Description |
@@ -261,7 +277,9 @@ discard block |
||
261 | 277 | if ($action == 'edit') |
262 | 278 | { |
263 | 279 | print '<input type="text" name="nouvelleadresse" class="minwith200" value="'.$object->mail_admin.'">'; |
264 | - } else print dol_print_email($object->mail_admin, 0, 0, 1); |
|
280 | + } else { |
|
281 | + print dol_print_email($object->mail_admin, 0, 0, 1); |
|
282 | + } |
|
265 | 283 | print '</td></tr>'; |
266 | 284 | } |
267 | 285 | |
@@ -287,7 +305,9 @@ discard block |
||
287 | 305 | if ($action == 'edit') |
288 | 306 | { |
289 | 307 | print '<input type="checkbox" name="cancomment" '.($object->allow_comments ? 'checked="checked"' : '').'">'; |
290 | -} else print yn($object->allow_comments); |
|
308 | +} else { |
|
309 | + print yn($object->allow_comments); |
|
310 | +} |
|
291 | 311 | print '</td></tr>'; |
292 | 312 | |
293 | 313 | // Users can see others vote |
@@ -295,16 +315,21 @@ discard block |
||
295 | 315 | if ($action == 'edit') |
296 | 316 | { |
297 | 317 | print '<input type="checkbox" name="canseeothersvote" '.($object->allow_spy ? 'checked="checked"' : '').'">'; |
298 | -} else print yn($object->allow_spy); |
|
318 | +} else { |
|
319 | + print yn($object->allow_spy); |
|
320 | +} |
|
299 | 321 | print '</td></tr>'; |
300 | 322 | |
301 | 323 | // Expire date |
302 | 324 | print '<tr><td>'.$langs->trans('ExpireDate').'</td><td colspan="2">'; |
303 | -if ($action == 'edit') print $form->selectDate($expiredate ? $expiredate : $object->date_fin, 'expire', 0, 0, 0, '', 1, 0); |
|
304 | -else { |
|
325 | +if ($action == 'edit') { |
|
326 | + print $form->selectDate($expiredate ? $expiredate : $object->date_fin, 'expire', 0, 0, 0, '', 1, 0); |
|
327 | +} else { |
|
305 | 328 | print dol_print_date($object->date_fin, 'day'); |
306 | - if ($object->date_fin && $object->date_fin < dol_now() && $object->status == Opensurveysondage::STATUS_VALIDATED) print img_warning($langs->trans("Expired")); |
|
307 | -} |
|
329 | + if ($object->date_fin && $object->date_fin < dol_now() && $object->status == Opensurveysondage::STATUS_VALIDATED) { |
|
330 | + print img_warning($langs->trans("Expired")); |
|
331 | + } |
|
332 | + } |
|
308 | 333 | print '</td></tr>'; |
309 | 334 | |
310 | 335 | // Author |
@@ -327,7 +352,9 @@ discard block |
||
327 | 352 | |
328 | 353 | $url = $urlwithroot.'/public/opensurvey/studs.php?sondage='.$object->id_sondage; |
329 | 354 | print '<input type="text" style="width: 60%" '.($action == 'edit' ? 'disabled' : '').' id="opensurveyurl" name="opensurveyurl" value="'.$url.'">'; |
330 | -if ($action != 'edit') print ajax_autoselect("opensurveyurl", $url); |
|
355 | +if ($action != 'edit') { |
|
356 | + print ajax_autoselect("opensurveyurl", $url); |
|
357 | +} |
|
331 | 358 | |
332 | 359 | print '</td></tr>'; |
333 | 360 |