@@ -40,7 +40,10 @@ |
||
| 40 | 40 | //if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler |
| 41 | 41 | //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET |
| 42 | 42 | //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification |
| 43 | -if (!defined('NOSESSION')) define('NOSESSION', '1'); // On CLI mode, no need to use web sessions |
|
| 43 | +if (!defined('NOSESSION')) { |
|
| 44 | + define('NOSESSION', '1'); |
|
| 45 | +} |
|
| 46 | +// On CLI mode, no need to use web sessions |
|
| 44 | 47 | |
| 45 | 48 | |
| 46 | 49 | $sapi_type = php_sapi_name(); |
@@ -149,7 +149,9 @@ |
||
| 149 | 149 | if (!isModEnabled("mymodule")) { |
| 150 | 150 | accessforbidden(); |
| 151 | 151 | } |
| 152 | -if (!$permissiontoread) accessforbidden(); |
|
| 152 | +if (!$permissiontoread) { |
|
| 153 | + accessforbidden(); |
|
| 154 | +} |
|
| 153 | 155 | |
| 154 | 156 | |
| 155 | 157 | /* |
@@ -192,7 +192,9 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | // Security check (enable the most restrictive one) |
| 195 | -if ($user->socid > 0) accessforbidden(); |
|
| 195 | +if ($user->socid > 0) { |
|
| 196 | + accessforbidden(); |
|
| 197 | +} |
|
| 196 | 198 | //if ($user->socid > 0) accessforbidden(); |
| 197 | 199 | //$socid = 0; if ($user->socid > 0) $socid = $user->socid; |
| 198 | 200 | //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
@@ -200,7 +202,9 @@ discard block |
||
| 200 | 202 | if (!isModEnabled("mymodule")) { |
| 201 | 203 | accessforbidden('Module mymodule not enabled'); |
| 202 | 204 | } |
| 203 | -if (!$permissiontoread) accessforbidden(); |
|
| 205 | +if (!$permissiontoread) { |
|
| 206 | + accessforbidden(); |
|
| 207 | +} |
|
| 204 | 208 | |
| 205 | 209 | |
| 206 | 210 | /* |
@@ -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 | } |