@@ -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 | } |
@@ -331,7 +331,10 @@ |
||
331 | 331 | |
332 | 332 | <script type="text/javascript"> |
333 | 333 | <?php |
334 | - if ($facid) print 'window.print();'; //Avoid print when is specimen |
|
334 | + if ($facid) { |
|
335 | + print 'window.print();'; |
|
336 | + } |
|
337 | + //Avoid print when is specimen |
|
335 | 338 | ?> |
336 | 339 | </script> |
337 | 340 |
@@ -231,7 +231,9 @@ discard block |
||
231 | 231 | $arrayOfValidPaymentModes[] = $obj; |
232 | 232 | } |
233 | 233 | if (!isModEnabled('banque')) { |
234 | - if ($paycode == 'CASH' || $paycode == 'CB') $arrayOfValidPaymentModes[] = $obj; |
|
234 | + if ($paycode == 'CASH' || $paycode == 'CB') { |
|
235 | + $arrayOfValidPaymentModes[] = $obj; |
|
236 | + } |
|
235 | 237 | } |
236 | 238 | } |
237 | 239 | } |
@@ -338,7 +340,9 @@ discard block |
||
338 | 340 | const bodyContent = JSON.stringify({ amount : amount, invoiceid : invoiceid }); |
339 | 341 | <?php |
340 | 342 | $urlpaymentintent = DOL_URL_ROOT.'/stripe/ajax/ajax.php?action=createPaymentIntent&token='.newToken().'&servicestatus='.$servicestatus; |
341 | - if (!empty($stripeacc)) $urlpaymentintent .= '&stripeacc='.$stripeacc; |
|
343 | + if (!empty($stripeacc)) { |
|
344 | + $urlpaymentintent .= '&stripeacc='.$stripeacc; |
|
345 | + } |
|
342 | 346 | ?> |
343 | 347 | return fetch('<?php echo $urlpaymentintent; ?>', { |
344 | 348 | method: "POST", |
@@ -668,7 +672,9 @@ discard block |
||
668 | 672 | |
669 | 673 | $parameters = array(); |
670 | 674 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $invoice, $action); // Note that $action and $object may have been modified by hook |
671 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
675 | +if ($reshook < 0) { |
|
676 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
677 | +} |
|
672 | 678 | |
673 | 679 | $class = ($i == 3) ? "calcbutton3" : "calcbutton2"; |
674 | 680 | foreach ($action_buttons as $button) { |
@@ -83,10 +83,18 @@ |
||
83 | 83 | //if ($user->socid > 0) accessforbidden(); |
84 | 84 | //if ($user->socid > 0) $socid = $user->socid; |
85 | 85 | //$result = restrictedArea($user, 'partnership', $object->id); |
86 | -if (empty($conf->partnership->enabled)) accessforbidden(); |
|
87 | -if (empty($permissiontoread)) accessforbidden(); |
|
88 | -if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden(); |
|
89 | -if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden(); |
|
86 | +if (empty($conf->partnership->enabled)) { |
|
87 | + accessforbidden(); |
|
88 | +} |
|
89 | +if (empty($permissiontoread)) { |
|
90 | + accessforbidden(); |
|
91 | +} |
|
92 | +if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') { |
|
93 | + accessforbidden(); |
|
94 | +} |
|
95 | +if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') { |
|
96 | + accessforbidden(); |
|
97 | +} |
|
90 | 98 | |
91 | 99 | |
92 | 100 |
@@ -66,10 +66,18 @@ |
||
66 | 66 | //if ($user->socid > 0) accessforbidden(); |
67 | 67 | //if ($user->socid > 0) $socid = $user->socid; |
68 | 68 | //$result = restrictedArea($user, 'partnership', $object->id); |
69 | -if (empty($conf->partnership->enabled)) accessforbidden(); |
|
70 | -if (empty($permissiontoread)) accessforbidden(); |
|
71 | -if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden(); |
|
72 | -if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden(); |
|
69 | +if (empty($conf->partnership->enabled)) { |
|
70 | + accessforbidden(); |
|
71 | +} |
|
72 | +if (empty($permissiontoread)) { |
|
73 | + accessforbidden(); |
|
74 | +} |
|
75 | +if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') { |
|
76 | + accessforbidden(); |
|
77 | +} |
|
78 | +if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') { |
|
79 | + accessforbidden(); |
|
80 | +} |
|
73 | 81 | |
74 | 82 | |
75 | 83 | /* |
@@ -97,7 +97,9 @@ |
||
97 | 97 | if (!isModEnabled("hrm")) { |
98 | 98 | accessforbidden(); |
99 | 99 | } |
100 | -if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden(); |
|
100 | +if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) { |
|
101 | + accessforbidden(); |
|
102 | +} |
|
101 | 103 | |
102 | 104 | |
103 | 105 | /* |
@@ -78,9 +78,15 @@ discard block |
||
78 | 78 | $permissiontoadd = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php |
79 | 79 | |
80 | 80 | // Security check (enable the most restrictive one) |
81 | -if ($user->socid > 0) accessforbidden(); |
|
82 | -if (empty($conf->hrm->enabled)) accessforbidden(); |
|
83 | -if (!$permissiontoread) accessforbidden(); |
|
81 | +if ($user->socid > 0) { |
|
82 | + accessforbidden(); |
|
83 | +} |
|
84 | +if (empty($conf->hrm->enabled)) { |
|
85 | + accessforbidden(); |
|
86 | +} |
|
87 | +if (!$permissiontoread) { |
|
88 | + accessforbidden(); |
|
89 | +} |
|
84 | 90 | |
85 | 91 | |
86 | 92 | /* |
@@ -123,10 +129,14 @@ discard block |
||
123 | 129 | $skillAdded->fk_object = $id; |
124 | 130 | $skillAdded->objecttype = $objecttype; |
125 | 131 | $ret = $skillAdded->create($user); |
126 | - if ($ret < 0) setEventMessages($skillAdded->error, null, 'errors'); |
|
132 | + if ($ret < 0) { |
|
133 | + setEventMessages($skillAdded->error, null, 'errors'); |
|
134 | + } |
|
127 | 135 | //else unset($TSkillsToAdd); |
128 | 136 | } |
129 | - if ($ret > 0) setEventMessages($langs->trans("SaveAddSkill"), null); |
|
137 | + if ($ret > 0) { |
|
138 | + setEventMessages($langs->trans("SaveAddSkill"), null); |
|
139 | + } |
|
130 | 140 | } |
131 | 141 | } elseif ($action == 'saveSkill') { |
132 | 142 | if (!empty($TNote)) { |
@@ -383,9 +393,13 @@ discard block |
||
383 | 393 | } |
384 | 394 | |
385 | 395 | print '</table>'; |
386 | - if ($objecttype != 'user' && $permissiontoadd) print '<td><input class="button pull-right" type="submit" value="' . $langs->trans('SaveRank') . '"></td>'; |
|
396 | + if ($objecttype != 'user' && $permissiontoadd) { |
|
397 | + print '<td><input class="button pull-right" type="submit" value="' . $langs->trans('SaveRank') . '"></td>'; |
|
398 | + } |
|
387 | 399 | print '</div>'; |
388 | - if ($objecttype != 'user' && $permissiontoadd) print '</form>'; |
|
400 | + if ($objecttype != 'user' && $permissiontoadd) { |
|
401 | + print '</form>'; |
|
402 | + } |
|
389 | 403 | |
390 | 404 | |
391 | 405 | // liste des compétences liées |