@@ -687,8 +687,9 @@ discard block |
||
687 | 687 | $newlang = ''; |
688 | 688 | if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { |
689 | 689 | $newlang = $object->thirdparty->default_lang; |
690 | - if (GETPOST('lang_id', 'aZ09')) |
|
691 | - $newlang = GETPOST('lang_id', 'aZ09'); |
|
690 | + if (GETPOST('lang_id', 'aZ09')) { |
|
691 | + $newlang = GETPOST('lang_id', 'aZ09'); |
|
692 | + } |
|
692 | 693 | } |
693 | 694 | if (!empty($newlang)) { |
694 | 695 | $outputlangs = new Translate("", $conf); |
@@ -2427,9 +2428,12 @@ discard block |
||
2427 | 2428 | |
2428 | 2429 | $parameters = array(); |
2429 | 2430 | $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
2430 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2431 | - if (empty($reshook)) |
|
2432 | - $object->formAddObjectLine(1, $societe, $mysoc); |
|
2431 | + if ($reshook < 0) { |
|
2432 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2433 | + } |
|
2434 | + if (empty($reshook)) { |
|
2435 | + $object->formAddObjectLine(1, $societe, $mysoc); |
|
2436 | + } |
|
2433 | 2437 | } |
2434 | 2438 | } |
2435 | 2439 | print '</table>'; |
@@ -68,8 +68,12 @@ discard block |
||
68 | 68 | $offset = $limit * $page; |
69 | 69 | $pageprev = $page - 1; |
70 | 70 | $pagenext = $page + 1; |
71 | -if (!$sortfield) $sortfield = "cr.date_sync"; |
|
72 | -if (!$sortorder) $sortorder = "DESC"; |
|
71 | +if (!$sortfield) { |
|
72 | + $sortfield = "cr.date_sync"; |
|
73 | +} |
|
74 | +if (!$sortorder) { |
|
75 | + $sortorder = "DESC"; |
|
76 | +} |
|
73 | 77 | |
74 | 78 | |
75 | 79 | // Initialize technical objects |
@@ -217,7 +221,9 @@ discard block |
||
217 | 221 | |
218 | 222 | $parameters = array(); |
219 | 223 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
220 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
224 | +if ($reshook < 0) { |
|
225 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
226 | +} |
|
221 | 227 | if (empty($reshook)) { |
222 | 228 | // Selection of new fields |
223 | 229 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
@@ -303,14 +309,20 @@ discard block |
||
303 | 309 | $sql .= $hookmanager->resPrint; |
304 | 310 | $sql .= ' FROM '.MAIN_DB_PREFIX.'multicurrency_rate as cr '; |
305 | 311 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."multicurrency AS m ON cr.fk_multicurrency = m.rowid"; |
306 | -if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); |
|
312 | +if ($sall) { |
|
313 | + $sql .= natural_search(array_keys($fieldstosearchall), $sall); |
|
314 | +} |
|
307 | 315 | if ($search_date_sync && $search_date_sync_end ) { |
308 | 316 | $sql .= " AND (cr.date_sync BETWEEN '".$db->idate($search_date_sync)."' AND '".$db->idate($search_date_sync_end)."')"; |
309 | 317 | } elseif ($search_date_sync && !$search_date_sync_end) { |
310 | 318 | $sql .= natural_search('cr.date_sync', $db->idate($search_date_sync)); |
311 | 319 | } |
312 | -if ($search_rate) $sql .= natural_search('cr.rate', $search_rate); |
|
313 | -if ($search_code) $sql .= natural_search('m.code', $search_code); |
|
320 | +if ($search_rate) { |
|
321 | + $sql .= natural_search('cr.rate', $search_rate); |
|
322 | +} |
|
323 | +if ($search_code) { |
|
324 | + $sql .= natural_search('m.code', $search_code); |
|
325 | +} |
|
314 | 326 | $sql .= " WHERE m.code <> '".$db->escape($conf->currency)."'"; |
315 | 327 | |
316 | 328 | // Add where from hooks |
@@ -360,10 +372,18 @@ discard block |
||
360 | 372 | $param .= "&sall=".urlencode($sall); |
361 | 373 | } |
362 | 374 | |
363 | - if ($search_date_sync) $param = "&search_date_sync=".$search_date_sync; |
|
364 | - if ($search_date_sync_end) $param="&search_date_sync_end=".$search_date_sync_end; |
|
365 | - if ($search_rate) $param = "&search_rate=".urlencode($search_rate); |
|
366 | - if ($search_code != '') $param.="&search_code=".urlencode($search_code); |
|
375 | + if ($search_date_sync) { |
|
376 | + $param = "&search_date_sync=".$search_date_sync; |
|
377 | + } |
|
378 | + if ($search_date_sync_end) { |
|
379 | + $param="&search_date_sync_end=".$search_date_sync_end; |
|
380 | + } |
|
381 | + if ($search_rate) { |
|
382 | + $param = "&search_rate=".urlencode($search_rate); |
|
383 | + } |
|
384 | + if ($search_code != '') { |
|
385 | + $param.="&search_code=".urlencode($search_code); |
|
386 | + } |
|
367 | 387 | |
368 | 388 | // Add $param from extra fields |
369 | 389 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
@@ -506,7 +526,9 @@ discard block |
||
506 | 526 | print '<td class="tdoverflowmax200">'; |
507 | 527 | print $obj->date_sync; |
508 | 528 | print "</td>\n"; |
509 | - if (!$i) $totalarray['nbfield']++; |
|
529 | + if (!$i) { |
|
530 | + $totalarray['nbfield']++; |
|
531 | + } |
|
510 | 532 | } |
511 | 533 | |
512 | 534 | // code |
@@ -516,7 +538,9 @@ discard block |
||
516 | 538 | print ' - <span class="opacitymedium">'.$obj->name.'</span>'; |
517 | 539 | print "</td>\n"; |
518 | 540 | |
519 | - if (! $i) $totalarray['nbfield']++; |
|
541 | + if (! $i) { |
|
542 | + $totalarray['nbfield']++; |
|
543 | + } |
|
520 | 544 | } |
521 | 545 | |
522 | 546 | // rate |
@@ -524,7 +548,9 @@ discard block |
||
524 | 548 | print '<td class="tdoverflowmax200">'; |
525 | 549 | print $obj->rate; |
526 | 550 | print "</td>\n"; |
527 | - if (! $i) $totalarray['nbfield']++; |
|
551 | + if (! $i) { |
|
552 | + $totalarray['nbfield']++; |
|
553 | + } |
|
528 | 554 | } |
529 | 555 | |
530 | 556 |
@@ -23,7 +23,9 @@ |
||
23 | 23 | * \brief Main page for ECM section area |
24 | 24 | */ |
25 | 25 | |
26 | -if (! defined('DISABLE_JS_GRAHP')) define('DISABLE_JS_GRAPH', 1); |
|
26 | +if (! defined('DISABLE_JS_GRAHP')) { |
|
27 | + define('DISABLE_JS_GRAPH', 1); |
|
28 | +} |
|
27 | 29 | |
28 | 30 | // Load Dolibarr environment |
29 | 31 | require '../main.inc.php'; |
@@ -258,7 +258,9 @@ |
||
258 | 258 | if (empty($senderissupplier)) { |
259 | 259 | $statustoshow = 1; |
260 | 260 | $statuswarehouse = 'warehouseopen,warehouseinternal'; |
261 | - if (!empty($conf->global->ENTREPOT_WAREHOUSEINTERNAL_NOT_SELL)) $statuswarehouse = 'warehouseopen'; |
|
261 | + if (!empty($conf->global->ENTREPOT_WAREHOUSEINTERNAL_NOT_SELL)) { |
|
262 | + $statuswarehouse = 'warehouseopen'; |
|
263 | + } |
|
262 | 264 | if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) { |
263 | 265 | // hide products in closed warehouse, but show products for internal transfer |
264 | 266 | $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, $statuswarehouse, GETPOST('combinations', 'array')); |
@@ -1538,7 +1538,9 @@ discard block |
||
1538 | 1538 | // Fields from hook |
1539 | 1539 | $parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon); |
1540 | 1540 | $reshook = $hookmanager->executeHooks('showActionsDoneListSelect', $parameters); // Note that $action and $object may have been modified by hook |
1541 | - if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint; |
|
1541 | + if (!empty($hookmanager->resPrint)) { |
|
1542 | + $sql.= $hookmanager->resPrint; |
|
1543 | + } |
|
1542 | 1544 | |
1543 | 1545 | $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; |
1544 | 1546 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action"; |
@@ -1554,7 +1556,9 @@ discard block |
||
1554 | 1556 | // Fields from hook |
1555 | 1557 | $parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon); |
1556 | 1558 | $reshook = $hookmanager->executeHooks('showActionsDoneListFrom', $parameters); // Note that $action and $object may have been modified by hook |
1557 | - if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint; |
|
1559 | + if (!empty($hookmanager->resPrint)) { |
|
1560 | + $sql.= $hookmanager->resPrint; |
|
1561 | + } |
|
1558 | 1562 | |
1559 | 1563 | if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur'))) { |
1560 | 1564 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; |
@@ -1659,7 +1663,9 @@ discard block |
||
1659 | 1663 | // Fields from hook |
1660 | 1664 | $parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon, 'module' => $module); |
1661 | 1665 | $reshook = $hookmanager->executeHooks('showActionsDoneListWhere', $parameters); // Note that $action and $object may have been modified by hook |
1662 | - if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint; |
|
1666 | + if (!empty($hookmanager->resPrint)) { |
|
1667 | + $sql.= $hookmanager->resPrint; |
|
1668 | + } |
|
1663 | 1669 | |
1664 | 1670 | if (is_array($actioncode)) { |
1665 | 1671 | foreach ($actioncode as $code) { |
@@ -331,13 +331,27 @@ discard block |
||
331 | 331 | { |
332 | 332 | $result = 0; |
333 | 333 | |
334 | - if ($duration_unit == 's') $result = $duration_value / 3600; |
|
335 | - if ($duration_unit == 'i') $result = $duration_value / 60; |
|
336 | - if ($duration_unit == 'h') $result = $duration_value; |
|
337 | - if ($duration_unit == 'd') $result = $duration_value * 24; |
|
338 | - if ($duration_unit == 'w') $result = $duration_value * 24 * 7; |
|
339 | - if ($duration_unit == 'm') $result = $duration_value * 730.484; |
|
340 | - if ($duration_unit == 'y') $result = $duration_value * 365 * 24; |
|
334 | + if ($duration_unit == 's') { |
|
335 | + $result = $duration_value / 3600; |
|
336 | + } |
|
337 | + if ($duration_unit == 'i') { |
|
338 | + $result = $duration_value / 60; |
|
339 | + } |
|
340 | + if ($duration_unit == 'h') { |
|
341 | + $result = $duration_value; |
|
342 | + } |
|
343 | + if ($duration_unit == 'd') { |
|
344 | + $result = $duration_value * 24; |
|
345 | + } |
|
346 | + if ($duration_unit == 'w') { |
|
347 | + $result = $duration_value * 24 * 7; |
|
348 | + } |
|
349 | + if ($duration_unit == 'm') { |
|
350 | + $result = $duration_value * 730.484; |
|
351 | + } |
|
352 | + if ($duration_unit == 'y') { |
|
353 | + $result = $duration_value * 365 * 24; |
|
354 | + } |
|
341 | 355 | |
342 | 356 | return $result; |
343 | 357 | } |
@@ -929,7 +943,9 @@ discard block |
||
929 | 943 | $date_1sunsept = strtotime('next thursday', strtotime('next sunday', mktime(0, 0, 0, 9, 1, $annee))); |
930 | 944 | $jour_1sunsept = date("d", $date_1sunsept); |
931 | 945 | $mois_1sunsept = date("m", $date_1sunsept); |
932 | - if ($jour_1sunsept == $jour && $mois_1sunsept == $mois) $ferie=true; |
|
946 | + if ($jour_1sunsept == $jour && $mois_1sunsept == $mois) { |
|
947 | + $ferie=true; |
|
948 | + } |
|
933 | 949 | // Geneva fast in Switzerland |
934 | 950 | } |
935 | 951 | } |
@@ -426,7 +426,10 @@ discard block |
||
426 | 426 | global $conf, $langs; |
427 | 427 | |
428 | 428 | $result = $this->_load_tables('/install/mysql/tables/', 'stocktransfer'); |
429 | - if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') |
|
429 | + if ($result < 0) { |
|
430 | + return -1; |
|
431 | + } |
|
432 | + // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') |
|
430 | 433 | |
431 | 434 | // Permissions |
432 | 435 | $this->remove($options); |
@@ -437,17 +440,23 @@ discard block |
||
437 | 440 | $resql = $this->db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STDEST" AND element = "StockTransfer" AND source = "internal"'); |
438 | 441 | $res = $this->db->fetch_object($resql); |
439 | 442 | $nextid=$this->getNextId(); |
440 | - if (empty($res)) $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "internal", "STRESP", "Responsable du transfert de stocks", 1, NULL, 0)'); |
|
443 | + if (empty($res)) { |
|
444 | + $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "internal", "STRESP", "Responsable du transfert de stocks", 1, NULL, 0)'); |
|
445 | + } |
|
441 | 446 | |
442 | 447 | $resql = $this->db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STFROM" AND element = "StockTransfer" AND source = "external"'); |
443 | 448 | $res = $this->db->fetch_object($resql); |
444 | 449 | $nextid=$this->getNextId(); |
445 | - if (empty($res)) $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "external", "STFROM", "Contact expéditeur transfert de stocks", 1, NULL, 0)'); |
|
450 | + if (empty($res)) { |
|
451 | + $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "external", "STFROM", "Contact expéditeur transfert de stocks", 1, NULL, 0)'); |
|
452 | + } |
|
446 | 453 | |
447 | 454 | $resql = $this->db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STDEST" AND element = "StockTransfer" AND source = "external"'); |
448 | 455 | $res = $this->db->fetch_object($resql); |
449 | 456 | $nextid=$this->getNextId(); |
450 | - if (empty($res)) $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "external", "STDEST", "Contact destinataire transfert de stocks", 1, NULL, 0)'); |
|
457 | + if (empty($res)) { |
|
458 | + $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "external", "STDEST", "Contact destinataire transfert de stocks", 1, NULL, 0)'); |
|
459 | + } |
|
451 | 460 | |
452 | 461 | return $this->_init($sql, $options); |
453 | 462 | } |
@@ -427,8 +427,12 @@ discard block |
||
427 | 427 | while ($pagenb < $pageposafternote) { |
428 | 428 | $pdf->AddPage(); |
429 | 429 | $pagenb++; |
430 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
431 | - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
430 | + if (!empty($tplidx)) { |
|
431 | + $pdf->useTemplate($tplidx); |
|
432 | + } |
|
433 | + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { |
|
434 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
435 | + } |
|
432 | 436 | // $this->_pagefoot($pdf,$object,$outputlangs,1); |
433 | 437 | $pdf->setTopMargin($tab_top_newpage); |
434 | 438 | // The only function to edit the bottom margin of current page to set it. |
@@ -481,8 +485,12 @@ discard block |
||
481 | 485 | |
482 | 486 | // apply note frame to last page |
483 | 487 | $pdf->setPage($pageposafternote); |
484 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
485 | - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
488 | + if (!empty($tplidx)) { |
|
489 | + $pdf->useTemplate($tplidx); |
|
490 | + } |
|
491 | + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { |
|
492 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
493 | + } |
|
486 | 494 | $height_note = $posyafter - $tab_top_newpage; |
487 | 495 | $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1); |
488 | 496 | } else // No pagebreak |
@@ -499,8 +507,12 @@ discard block |
||
499 | 507 | $pagenb++; |
500 | 508 | $pageposafternote++; |
501 | 509 | $pdf->setPage($pageposafternote); |
502 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
503 | - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
510 | + if (!empty($tplidx)) { |
|
511 | + $pdf->useTemplate($tplidx); |
|
512 | + } |
|
513 | + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { |
|
514 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
515 | + } |
|
504 | 516 | |
505 | 517 | $posyafter = $tab_top_newpage; |
506 | 518 | } |
@@ -788,7 +788,9 @@ discard block |
||
788 | 788 | if ($action == 'confirm_generateinter') { |
789 | 789 | $langs->load('interventions'); |
790 | 790 | |
791 | - if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); |
|
791 | + if (!empty($projectstatic->socid)) { |
|
792 | + $projectstatic->fetch_thirdparty(); |
|
793 | + } |
|
792 | 794 | |
793 | 795 | if (!($projectstatic->thirdparty->id > 0)) { |
794 | 796 | setEventMessages($langs->trans("ThirdPartyRequiredToGenerateIntervention"), null, 'errors'); |
@@ -1561,7 +1563,9 @@ discard block |
||
1561 | 1563 | if (empty($search_user)) { |
1562 | 1564 | $search_user = $user->id; |
1563 | 1565 | } |
1564 | - if ($search_user > 0) $sql .= " AND t.fk_user = ".((int) $search_user); |
|
1566 | + if ($search_user > 0) { |
|
1567 | + $sql .= " AND t.fk_user = ".((int) $search_user); |
|
1568 | + } |
|
1565 | 1569 | } |
1566 | 1570 | |
1567 | 1571 | if ($search_note) { |