@@ -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 |
@@ -37,7 +37,9 @@ discard block |
||
37 | 37 | |
38 | 38 | // Load translation files required by the page |
39 | 39 | $langs->loadLangs(array("stocks", "other", "productbatch", "companies")); |
40 | - if (isModEnabled('incoterm')) $langs->load('incoterm'); |
|
40 | + if (isModEnabled('incoterm')) { |
|
41 | + $langs->load('incoterm'); |
|
42 | + } |
|
41 | 43 | |
42 | 44 | // Get parameters |
43 | 45 | $id = GETPOST('id', 'int'); |
@@ -72,10 +74,14 @@ discard block |
||
72 | 74 | $search_all = trim(GETPOST("search_all", 'alpha')); |
73 | 75 | $search = array(); |
74 | 76 | foreach ($object->fields as $key => $val) { |
75 | - if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
76 | -} |
|
77 | + if (GETPOST('search_'.$key, 'alpha')) { |
|
78 | + $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
79 | + } |
|
80 | + } |
|
77 | 81 | |
78 | -if (empty($action) && empty($id) && empty($ref)) $action = 'view'; |
|
82 | +if (empty($action) && empty($id) && empty($ref)) { |
|
83 | + $action = 'view'; |
|
84 | +} |
|
79 | 85 | |
80 | 86 | // Load object |
81 | 87 | include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
@@ -94,7 +100,9 @@ discard block |
||
94 | 100 | //$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0); |
95 | 101 | //$result = restrictedArea($user, 'stocktransfer', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); |
96 | 102 | |
97 | -if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden(); |
|
103 | +if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) { |
|
104 | + accessforbidden(); |
|
105 | +} |
|
98 | 106 | |
99 | 107 | |
100 | 108 | /* |
@@ -107,7 +115,9 @@ discard block |
||
107 | 115 | |
108 | 116 | $parameters = array(); |
109 | 117 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
110 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
118 | +if ($reshook < 0) { |
|
119 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
120 | +} |
|
111 | 121 | |
112 | 122 | if (empty($reshook)) { |
113 | 123 | $error = 0; |
@@ -116,8 +126,11 @@ discard block |
||
116 | 126 | |
117 | 127 | if (empty($backtopage) || ($cancel && empty($id))) { |
118 | 128 | if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { |
119 | - if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; |
|
120 | - else $backtopage = dol_buildpath('/product/stock/stocktransfer/stocktransfer_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); |
|
129 | + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { |
|
130 | + $backtopage = $backurlforlist; |
|
131 | + } else { |
|
132 | + $backtopage = dol_buildpath('/product/stock/stocktransfer/stocktransfer_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); |
|
133 | + } |
|
121 | 134 | } |
122 | 135 | } |
123 | 136 | $triggermodname = 'STOCKTRANSFER_STOCKTRANSFER_MODIFY'; // Name of trigger action code to execute when we modify record |
@@ -184,7 +197,9 @@ discard block |
||
184 | 197 | if (empty($error)) { |
185 | 198 | $line = new StockTransferLine($db); |
186 | 199 | $records = $line->fetchAll('', '', 0, 0, array('customsql'=>' fk_stocktransfer = '.((int) $id).' AND fk_product = '.((int) $fk_product).' AND fk_warehouse_source = '.((int) $fk_warehouse_source).' AND fk_warehouse_destination = '.((int) $fk_warehouse_destination).' AND ('.(empty($batch) ? 'batch = "" or batch IS NULL' : "batch = '".$db->escape($batch)."'" ).')')); |
187 | - if (!empty($records[key($records)])) $line = $records[key($records)]; |
|
200 | + if (!empty($records[key($records)])) { |
|
201 | + $line = $records[key($records)]; |
|
202 | + } |
|
188 | 203 | $line->fk_stocktransfer = $id; |
189 | 204 | $line->qty += $qty; |
190 | 205 | $line->fk_warehouse_source = $fk_warehouse_source; |
@@ -193,8 +208,9 @@ discard block |
||
193 | 208 | $line->batch = $batch; |
194 | 209 | |
195 | 210 | $line->pmp = $prod->pmp; |
196 | - if ($line->id > 0) $line->update($user); |
|
197 | - else { |
|
211 | + if ($line->id > 0) { |
|
212 | + $line->update($user); |
|
213 | + } else { |
|
198 | 214 | $line->rang = count($object->lines) + 1; |
199 | 215 | $line->create($user); |
200 | 216 | } |
@@ -257,10 +273,15 @@ discard block |
||
257 | 273 | $db->begin(); |
258 | 274 | foreach ($lines as $line) { |
259 | 275 | $res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_source); |
260 | - if ($res <= 0) $error++; |
|
276 | + if ($res <= 0) { |
|
277 | + $error++; |
|
278 | + } |
|
279 | + } |
|
280 | + if (empty($error)) { |
|
281 | + $db->commit(); |
|
282 | + } else { |
|
283 | + $db->rollback(); |
|
261 | 284 | } |
262 | - if (empty($error)) $db->commit(); |
|
263 | - else $db->rollback(); |
|
264 | 285 | } |
265 | 286 | if (empty($error)) { |
266 | 287 | $object->setStatut($object::STATUS_TRANSFERED, $id); |
@@ -278,10 +299,15 @@ discard block |
||
278 | 299 | $db->begin(); |
279 | 300 | foreach ($lines as $line) { |
280 | 301 | $res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_source, 0); |
281 | - if ($res <= 0) $error++; |
|
302 | + if ($res <= 0) { |
|
303 | + $error++; |
|
304 | + } |
|
305 | + } |
|
306 | + if (empty($error)) { |
|
307 | + $db->commit(); |
|
308 | + } else { |
|
309 | + $db->rollback(); |
|
282 | 310 | } |
283 | - if (empty($error)) $db->commit(); |
|
284 | - else $db->rollback(); |
|
285 | 311 | } |
286 | 312 | if (empty($error)) { |
287 | 313 | $object->setStatut($object::STATUS_VALIDATED, $id); |
@@ -299,10 +325,15 @@ discard block |
||
299 | 325 | $db->begin(); |
300 | 326 | foreach ($lines as $line) { |
301 | 327 | $res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_destination, 0); |
302 | - if ($res <= 0) $error++; |
|
328 | + if ($res <= 0) { |
|
329 | + $error++; |
|
330 | + } |
|
331 | + } |
|
332 | + if (empty($error)) { |
|
333 | + $db->commit(); |
|
334 | + } else { |
|
335 | + $db->rollback(); |
|
303 | 336 | } |
304 | - if (empty($error)) $db->commit(); |
|
305 | - else $db->rollback(); |
|
306 | 337 | } |
307 | 338 | if (empty($error)) { |
308 | 339 | $object->setStatut($object::STATUS_CLOSED, $id); |
@@ -320,10 +351,15 @@ discard block |
||
320 | 351 | $db->begin(); |
321 | 352 | foreach ($lines as $line) { |
322 | 353 | $res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_destination); |
323 | - if ($res <= 0) $error++; |
|
354 | + if ($res <= 0) { |
|
355 | + $error++; |
|
356 | + } |
|
357 | + } |
|
358 | + if (empty($error)) { |
|
359 | + $db->commit(); |
|
360 | + } else { |
|
361 | + $db->rollback(); |
|
324 | 362 | } |
325 | - if (empty($error)) $db->commit(); |
|
326 | - else $db->rollback(); |
|
327 | 363 | } |
328 | 364 | if (empty($error)) { |
329 | 365 | $object->setStatut($object::STATUS_TRANSFERED, $id); |
@@ -368,7 +404,9 @@ discard block |
||
368 | 404 | // Affichage alerte date prévue de départ si transfert concerné |
369 | 405 | $date_prevue_depart = $object->date_prevue_depart; |
370 | 406 | $date_prevue_depart_plus_delai = $date_prevue_depart; |
371 | -if ($object->lead_time_for_warning > 0) $date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day'); |
|
407 | +if ($object->lead_time_for_warning > 0) { |
|
408 | + $date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day'); |
|
409 | +} |
|
372 | 410 | if (!empty($date_prevue_depart) && $date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) { |
373 | 411 | print "$('.valuefield.fieldname_date_prevue_depart').append('"; |
374 | 412 | print img_warning($langs->trans('Alert').' - '.$langs->trans('Late')); |
@@ -386,8 +424,12 @@ discard block |
||
386 | 424 | print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
387 | 425 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
388 | 426 | print '<input type="hidden" name="action" value="add">'; |
389 | - if ($backtopage) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
390 | - if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
427 | + if ($backtopage) { |
|
428 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
429 | + } |
|
430 | + if ($backtopageforcancel) { |
|
431 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
432 | + } |
|
391 | 433 | |
392 | 434 | print dol_get_fiche_head(array(), ''); |
393 | 435 | |
@@ -443,8 +485,12 @@ discard block |
||
443 | 485 | print '<input type="hidden" name="token" value="' . newToken() . '">'; |
444 | 486 | print '<input type="hidden" name="action" value="update">'; |
445 | 487 | print '<input type="hidden" name="id" value="' . $object->id . '">'; |
446 | - if ($backtopage) print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
447 | - if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
488 | + if ($backtopage) { |
|
489 | + print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
490 | + } |
|
491 | + if ($backtopageforcancel) { |
|
492 | + print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
493 | + } |
|
448 | 494 | |
449 | 495 | print dol_get_fiche_head(); |
450 | 496 | |
@@ -545,8 +591,11 @@ discard block |
||
545 | 591 | // Call Hook formConfirm |
546 | 592 | $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); |
547 | 593 | $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
548 | - if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; |
|
549 | - elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; |
|
594 | + if (empty($reshook)) { |
|
595 | + $formconfirm .= $hookmanager->resPrint; |
|
596 | + } elseif ($reshook > 0) { |
|
597 | + $formconfirm = $hookmanager->resPrint; |
|
598 | + } |
|
550 | 599 | |
551 | 600 | // Print form confirm |
552 | 601 | print $formconfirm; |
@@ -616,8 +665,11 @@ discard block |
||
616 | 665 | print '<table width="100%" class="nobordernopadding"><tr><td>'; |
617 | 666 | print $langs->trans('IncotermLabel'); |
618 | 667 | print '<td><td class="right">'; |
619 | - if ($permissiontoadd && $action != 'editincoterm') print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>'; |
|
620 | - else print ' '; |
|
668 | + if ($permissiontoadd && $action != 'editincoterm') { |
|
669 | + print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>'; |
|
670 | + } else { |
|
671 | + print ' '; |
|
672 | + } |
|
621 | 673 | print '</td></tr></table>'; |
622 | 674 | print '</td>'; |
623 | 675 | print '<td>'; |
@@ -706,7 +758,9 @@ discard block |
||
706 | 758 | <input type="hidden" name="mode" value=""> |
707 | 759 | <input type="hidden" name="id" value="' . $object->id.'"> |
708 | 760 | '; |
709 | - if ($lineid > 0) print '<input type="hidden" name="lineid" value="'.$lineid.'" />'; |
|
761 | + if ($lineid > 0) { |
|
762 | + print '<input type="hidden" name="lineid" value="'.$lineid.'" />'; |
|
763 | + } |
|
710 | 764 | print '<table id="tablelines" class="liste centpercent">'; |
711 | 765 | //print '<div class="tagtable centpercent">'; |
712 | 766 | |
@@ -753,32 +807,47 @@ discard block |
||
753 | 807 | |
754 | 808 | print '<tr id="row-'.$line->id.'" class="drag drop oddeven" '.$domData.'>'; |
755 | 809 | print '<td class="titlefield">'; |
756 | - if ($action === 'editline' && $line->id == $lineid) $form->select_produits($line->fk_product, 'fk_product', $filtertype, $limit, 0, -1, 2, '', 0, array(), 0, 0, 0, 'minwidth200imp maxwidth300', 1); |
|
757 | - else print $productstatic->getNomUrl(1).' - '.$productstatic->label; |
|
810 | + if ($action === 'editline' && $line->id == $lineid) { |
|
811 | + $form->select_produits($line->fk_product, 'fk_product', $filtertype, $limit, 0, -1, 2, '', 0, array(), 0, 0, 0, 'minwidth200imp maxwidth300', 1); |
|
812 | + } else { |
|
813 | + print $productstatic->getNomUrl(1).' - '.$productstatic->label; |
|
814 | + } |
|
758 | 815 | print '</td>'; |
759 | 816 | if (isModEnabled('productbatch')) { |
760 | 817 | print '<td>'; |
761 | - if ($action === 'editline' && $line->id == $lineid) print '<input type="text" value="'.$line->batch.'" name="batch" class="flat maxwidth50"/>'; |
|
762 | - else { |
|
818 | + if ($action === 'editline' && $line->id == $lineid) { |
|
819 | + print '<input type="text" value="'.$line->batch.'" name="batch" class="flat maxwidth50"/>'; |
|
820 | + } else { |
|
763 | 821 | $productlot = new Productlot($db); |
764 | 822 | if ($productlot->fetch(0, $line->fk_product, $line->batch) > 0) { |
765 | 823 | print $productlot->getNomUrl(1); |
766 | - } elseif (!empty($line->batch)) print $line->batch.' '.img_warning($langs->trans('BatchNotFound')); |
|
824 | + } elseif (!empty($line->batch)) { |
|
825 | + print $line->batch.' '.img_warning($langs->trans('BatchNotFound')); |
|
826 | + } |
|
767 | 827 | } |
768 | 828 | print '</td>'; |
769 | 829 | } |
770 | 830 | |
771 | 831 | print '<td>'; |
772 | 832 | |
773 | - if ($action === 'editline' && $line->id == $lineid) print $formproduct->selectWarehouses($line->fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource); |
|
774 | - else print $warehousestatics->getNomUrl(1); |
|
833 | + if ($action === 'editline' && $line->id == $lineid) { |
|
834 | + print $formproduct->selectWarehouses($line->fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource); |
|
835 | + } else { |
|
836 | + print $warehousestatics->getNomUrl(1); |
|
837 | + } |
|
775 | 838 | print '</td>'; |
776 | 839 | print '<td>'; |
777 | - if ($action === 'editline' && $line->id == $lineid) print $formproduct->selectWarehouses($line->fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseDestination); |
|
778 | - else print $warehousestatict->getNomUrl(1); |
|
840 | + if ($action === 'editline' && $line->id == $lineid) { |
|
841 | + print $formproduct->selectWarehouses($line->fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseDestination); |
|
842 | + } else { |
|
843 | + print $warehousestatict->getNomUrl(1); |
|
844 | + } |
|
779 | 845 | print '</td>'; |
780 | - if ($action === 'editline' && $line->id == $lineid) print '<td class="center"><input type="text" class="flat maxwidth50" name="qty" value="'.$line->qty.'"></td>'; |
|
781 | - else print '<td class="center">'.$line->qty.'</td>'; |
|
846 | + if ($action === 'editline' && $line->id == $lineid) { |
|
847 | + print '<td class="center"><input type="text" class="flat maxwidth50" name="qty" value="'.$line->qty.'"></td>'; |
|
848 | + } else { |
|
849 | + print '<td class="center">'.$line->qty.'</td>'; |
|
850 | + } |
|
782 | 851 | |
783 | 852 | if ($conf->global->PRODUCT_USE_UNITS) { |
784 | 853 | print '<td class="linecoluseunit nowrap left">'; |
@@ -840,7 +909,9 @@ discard block |
||
840 | 909 | // Product |
841 | 910 | print '<td class="titlefield">'; |
842 | 911 | $filtertype = 0; |
843 | - if (!empty($conf->global->STOCK_SUPPORTS_SERVICES)) $filtertype = ''; |
|
912 | + if (!empty($conf->global->STOCK_SUPPORTS_SERVICES)) { |
|
913 | + $filtertype = ''; |
|
914 | + } |
|
844 | 915 | if ($conf->global->PRODUIT_LIMIT_SIZE <= 0) { |
845 | 916 | $limit = ''; |
846 | 917 | } else { |
@@ -864,7 +935,9 @@ discard block |
||
864 | 935 | $source_ent = new Entrepot($db); |
865 | 936 | $source_ent->fetch($object->fk_warehouse_source); |
866 | 937 | foreach ($formproduct->cache_warehouses as $TDataCacheWarehouse) { |
867 | - if (strpos($TDataCacheWarehouse['full_label'], $source_ent->label) === false) $TExcludedWarehouseSource[] = $TDataCacheWarehouse['id']; |
|
938 | + if (strpos($TDataCacheWarehouse['full_label'], $source_ent->label) === false) { |
|
939 | + $TExcludedWarehouseSource[] = $TDataCacheWarehouse['id']; |
|
940 | + } |
|
868 | 941 | } |
869 | 942 | } |
870 | 943 | |
@@ -874,7 +947,9 @@ discard block |
||
874 | 947 | $dest_ent = new Entrepot($db); |
875 | 948 | $dest_ent->fetch($object->fk_warehouse_destination); |
876 | 949 | foreach ($formproduct->cache_warehouses as $TDataCacheWarehouse) { |
877 | - if (strpos($TDataCacheWarehouse['full_label'], $dest_ent->label) === false) $TExcludedWarehouseDestination[] = $TDataCacheWarehouse['id']; |
|
950 | + if (strpos($TDataCacheWarehouse['full_label'], $dest_ent->label) === false) { |
|
951 | + $TExcludedWarehouseDestination[] = $TDataCacheWarehouse['id']; |
|
952 | + } |
|
878 | 953 | } |
879 | 954 | } |
880 | 955 | |
@@ -919,7 +994,9 @@ discard block |
||
919 | 994 | print '<div class="tabsAction">'."\n"; |
920 | 995 | $parameters = array(); |
921 | 996 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
922 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
997 | + if ($reshook < 0) { |
|
998 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
999 | + } |
|
923 | 1000 | |
924 | 1001 | if (empty($reshook)) { |
925 | 1002 | // Send |
@@ -1043,7 +1120,9 @@ discard block |
||
1043 | 1120 | } |
1044 | 1121 | |
1045 | 1122 | //Select mail models is same action as presend |
1046 | - if (GETPOST('modelselected')) $action = 'presend'; |
|
1123 | + if (GETPOST('modelselected')) { |
|
1124 | + $action = 'presend'; |
|
1125 | + } |
|
1047 | 1126 | |
1048 | 1127 | // Presend form |
1049 | 1128 | $modelmail = 'stocktransfer'; |
@@ -41,15 +41,19 @@ |
||
41 | 41 | $id = GETPOST("id", 'int'); |
42 | 42 | $action = GETPOST('action', 'aZ09'); |
43 | 43 | $confirm = GETPOST('confirm'); |
44 | -if ($user->socid) $socid = $user->socid; |
|
44 | +if ($user->socid) { |
|
45 | + $socid = $user->socid; |
|
46 | +} |
|
45 | 47 | |
46 | 48 | $salary = new Salary($db); |
47 | 49 | |
48 | 50 | $object = new PaymentSalary($db); |
49 | 51 | if ($id > 0) { |
50 | 52 | $result = $object->fetch($id); |
51 | - if (!$result) dol_print_error($db, 'Failed to get payment id '.$id); |
|
52 | -} |
|
53 | + if (!$result) { |
|
54 | + dol_print_error($db, 'Failed to get payment id '.$id); |
|
55 | + } |
|
56 | + } |
|
53 | 57 | restrictedArea($user, 'salaries', $object->fk_salary, 'salary', ''); // $object is payment of salary |
54 | 58 | |
55 | 59 |
@@ -2008,7 +2008,9 @@ discard block |
||
2008 | 2008 | $modeinput = 'hours'; |
2009 | 2009 | for ($idw = 0; $idw < 7; $idw++) { |
2010 | 2010 | $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); |
2011 | - if (!isset($totalforeachday[$tmpday])) $totalforeachday[$tmpday] = 0; |
|
2011 | + if (!isset($totalforeachday[$tmpday])) { |
|
2012 | + $totalforeachday[$tmpday] = 0; |
|
2013 | + } |
|
2012 | 2014 | $cssonholiday = ''; |
2013 | 2015 | if (!$isavailable[$tmpday]['morning'] && !$isavailable[$tmpday]['afternoon']) { |
2014 | 2016 | $cssonholiday .= 'onholidayallday '; |
@@ -2307,7 +2309,9 @@ discard block |
||
2307 | 2309 | $month = $firstdaytoshowarray['mon']; |
2308 | 2310 | foreach ($TWeek as $weekIndex => $weekNb) { |
2309 | 2311 | $weekWorkLoad = !empty($projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id]) ? $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id] : 0 ; |
2310 | - if (!isset($totalforeachweek[$weekNb])) $totalforeachweek[$weekNb] = 0; |
|
2312 | + if (!isset($totalforeachweek[$weekNb])) { |
|
2313 | + $totalforeachweek[$weekNb] = 0; |
|
2314 | + } |
|
2311 | 2315 | $totalforeachweek[$weekNb] += $weekWorkLoad; |
2312 | 2316 | |
2313 | 2317 | $alreadyspent = ''; |
@@ -609,7 +609,9 @@ |
||
609 | 609 | { |
610 | 610 | $Tab = $this->getForUser($fk_user); |
611 | 611 | |
612 | - if (empty($Tab)) return ''; |
|
612 | + if (empty($Tab)) { |
|
613 | + return ''; |
|
614 | + } |
|
613 | 615 | |
614 | 616 | $lastpos = array_shift($Tab); |
615 | 617 |
@@ -51,8 +51,12 @@ discard block |
||
51 | 51 | $permissiontoread = $user->rights->hrm->evaluation->read || $user->rights->hrm->compare_advance->read; |
52 | 52 | $permissiontoadd = 0; |
53 | 53 | |
54 | -if (empty($conf->hrm->enabled)) accessforbidden(); |
|
55 | -if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden(); |
|
54 | +if (empty($conf->hrm->enabled)) { |
|
55 | + accessforbidden(); |
|
56 | +} |
|
57 | +if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) { |
|
58 | + accessforbidden(); |
|
59 | +} |
|
56 | 60 | |
57 | 61 | |
58 | 62 | /* |
@@ -113,7 +117,9 @@ discard block |
||
113 | 117 | |
114 | 118 | $fk_usergroup2 = 0; |
115 | 119 | $fk_job = (int) GETPOST('fk_job'); |
116 | -if ($fk_job <= 0) $fk_usergroup2 = GETPOST('fk_usergroup2'); |
|
120 | +if ($fk_job <= 0) { |
|
121 | + $fk_usergroup2 = GETPOST('fk_usergroup2'); |
|
122 | +} |
|
117 | 123 | |
118 | 124 | $fk_usergroup1 = GETPOST('fk_usergroup1'); |
119 | 125 | |
@@ -290,11 +296,17 @@ discard block |
||
290 | 296 | foreach ($TMergedSkills as $id => &$sk) { |
291 | 297 | $class = 'diffnote'; |
292 | 298 | |
293 | - if (empty($sk->rate2)) $class .= ' toohappy'; |
|
294 | - elseif (empty($sk->rate1)) $class .= ' toosad'; |
|
295 | - elseif ($sk->rate1 == $sk->rate2) $class .= ' happy'; |
|
296 | - elseif ($sk->rate2 < $sk->rate1) $class .= ' veryhappy'; |
|
297 | - elseif ($sk->rate2 > $sk->rate1) $class .= ' sad'; |
|
299 | + if (empty($sk->rate2)) { |
|
300 | + $class .= ' toohappy'; |
|
301 | + } elseif (empty($sk->rate1)) { |
|
302 | + $class .= ' toosad'; |
|
303 | + } elseif ($sk->rate1 == $sk->rate2) { |
|
304 | + $class .= ' happy'; |
|
305 | + } elseif ($sk->rate2 < $sk->rate1) { |
|
306 | + $class .= ' veryhappy'; |
|
307 | + } elseif ($sk->rate2 > $sk->rate1) { |
|
308 | + $class .= ' sad'; |
|
309 | + } |
|
298 | 310 | |
299 | 311 | $out .= '<li fk_skill="' . $id . '" class="' . $class . '" style="text-align:center;"> |
300 | 312 | <span class="' . $class . '"> </span> |
@@ -329,8 +341,11 @@ discard block |
||
329 | 341 | $how_many = ($field === 'rate1') ? $sk->how_many_max1 : $sk->how_many_max2; |
330 | 342 | } |
331 | 343 | |
332 | - if ($field === 'rate2' && $fk_job > 0) $trad = $langs->trans('RequiredRank'); |
|
333 | - else $trad = $langs->trans('HighestRank'); |
|
344 | + if ($field === 'rate2' && $fk_job > 0) { |
|
345 | + $trad = $langs->trans('RequiredRank'); |
|
346 | + } else { |
|
347 | + $trad = $langs->trans('HighestRank'); |
|
348 | + } |
|
334 | 349 | |
335 | 350 | $out .= '<li fk_skill="' . $id . '" style="text-align:center;"> |
336 | 351 | <p><span class="' . $class . ' classfortooltip" title="' . $trad . '">' . $note . '</span>' . ($how_many > 0 ? '<span class="bubble classfortooltip" title="' . $langs->trans('HowManyUserWithThisMaxNote') . '">' . $how_many . '</span>' : '') . '</p> |
@@ -378,7 +393,9 @@ discard block |
||
378 | 393 | $Tab = array(); |
379 | 394 | |
380 | 395 | foreach ($TSkill1 as &$sk) { |
381 | - if (empty($Tab[$sk->fk_skill])) $Tab[$sk->fk_skill] = new stdClass; |
|
396 | + if (empty($Tab[$sk->fk_skill])) { |
|
397 | + $Tab[$sk->fk_skill] = new stdClass; |
|
398 | + } |
|
382 | 399 | |
383 | 400 | $Tab[$sk->fk_skill]->rate1 = $sk->rankorder; |
384 | 401 | $Tab[$sk->fk_skill]->how_many_max1 = $sk->how_many_max; |
@@ -387,7 +404,9 @@ discard block |
||
387 | 404 | } |
388 | 405 | |
389 | 406 | foreach ($TSkill2 as &$sk) { |
390 | - if (empty($Tab[$sk->fk_skill])) $Tab[$sk->fk_skill] = new stdClass; |
|
407 | + if (empty($Tab[$sk->fk_skill])) { |
|
408 | + $Tab[$sk->fk_skill] = new stdClass; |
|
409 | + } |
|
391 | 410 | $Tab[$sk->fk_skill]->rate2 = $sk->rankorder; |
392 | 411 | $Tab[$sk->fk_skill]->label = $sk->label; |
393 | 412 | $Tab[$sk->fk_skill]->description = $sk->description; |
@@ -436,12 +455,16 @@ discard block |
||
436 | 455 | $user->fetch($obj->rowid); |
437 | 456 | |
438 | 457 | $name = $user->getFullName($langs); |
439 | - if (empty($name)) $name = $user->login; |
|
458 | + if (empty($name)) { |
|
459 | + $name = $user->login; |
|
460 | + } |
|
440 | 461 | |
441 | 462 | if (in_array($user->id, $TExcludedId)) { |
442 | 463 | $class .= ' disabled'; |
443 | 464 | } else { |
444 | - if (!in_array($user->id, $TUser)) $TUser[] = $user->id; |
|
465 | + if (!in_array($user->id, $TUser)) { |
|
466 | + $TUser[] = $user->id; |
|
467 | + } |
|
445 | 468 | } |
446 | 469 | |
447 | 470 | $desc = ''; |
@@ -458,7 +481,9 @@ discard block |
||
458 | 481 | $desc .= $langs->trans('NoEval'); |
459 | 482 | } |
460 | 483 | |
461 | - if (!empty($user->array_options['options_DDA'])) $desc .= '<br>' . $langs->trans('Anciennete') . ' : ' . dol_print_date(strtotime($user->array_options['options_DDA'])); |
|
484 | + if (!empty($user->array_options['options_DDA'])) { |
|
485 | + $desc .= '<br>' . $langs->trans('Anciennete') . ' : ' . dol_print_date(strtotime($user->array_options['options_DDA'])); |
|
486 | + } |
|
462 | 487 | |
463 | 488 | $out .= '<li fk_user="' . $user->id . '" class="' . $class . '"> |
464 | 489 | ' . $form->showphoto('userphoto', $user, 0, 0, 0, 'photoref', 'small', 1, 0, 1) . ' |
@@ -486,7 +511,9 @@ discard block |
||
486 | 511 | global $db; |
487 | 512 | |
488 | 513 | //I go back to the user with the highest score in a given group for all the skills assessed in that group |
489 | - if (empty($TUser)) return array(); |
|
514 | + if (empty($TUser)) { |
|
515 | + return array(); |
|
516 | + } |
|
490 | 517 | |
491 | 518 | $sql = 'SELECT sk.rowid, sk.label, sk.description, sk.skill_type, sr.fk_object, sr.objecttype, sr.fk_skill, '; |
492 | 519 | $sql.= ' MAX(sr.rankorder) as rankorder'; |
@@ -541,7 +568,9 @@ discard block |
||
541 | 568 | { |
542 | 569 | global $db; |
543 | 570 | |
544 | - if (empty($fk_job)) return array(); |
|
571 | + if (empty($fk_job)) { |
|
572 | + return array(); |
|
573 | + } |
|
545 | 574 | |
546 | 575 | $sql = 'SELECT sk.rowid, sk.label, sk.description, sk.skill_type, sr.fk_object, sr.objecttype, sr.fk_skill,'; |
547 | 576 | $sql.= " MAX(sr.rankorder) as rankorder"; |
@@ -31,8 +31,9 @@ discard block |
||
31 | 31 | $langs->loadLangs(array("admin", "products", "productbatch")); |
32 | 32 | |
33 | 33 | // Security check |
34 | -if (!$user->admin || (empty($conf->productbatch->enabled))) |
|
34 | +if (!$user->admin || (empty($conf->productbatch->enabled))) { |
|
35 | 35 | accessforbidden(); |
36 | +} |
|
36 | 37 | |
37 | 38 | $action = GETPOST('action', 'alpha'); |
38 | 39 | $value = GETPOST('value', 'alpha'); |
@@ -52,7 +53,9 @@ discard block |
||
52 | 53 | |
53 | 54 | if ($maskconstbatch && preg_match('/_MASK$/', $maskconstbatch)) { |
54 | 55 | $res = dolibarr_set_const($db, $maskconstbatch, $maskbatch, 'chaine', 0, '', $conf->entity); |
55 | - if ($res <= 0) $error++; |
|
56 | + if ($res <= 0) { |
|
57 | + $error++; |
|
58 | + } |
|
56 | 59 | } |
57 | 60 | |
58 | 61 | if (!$error) { |
@@ -66,7 +69,9 @@ discard block |
||
66 | 69 | |
67 | 70 | if ($maskconstbatch && preg_match('/_MASK$/', $maskconstbatch)) { |
68 | 71 | $res = dolibarr_set_const($db, $maskconstbatch, $maskbatch, 'chaine', 0, '', $conf->entity); |
69 | - if ($res <= 0) $error++; |
|
72 | + if ($res <= 0) { |
|
73 | + $error++; |
|
74 | + } |
|
70 | 75 | } |
71 | 76 | |
72 | 77 | if (!$error) { |
@@ -147,8 +152,12 @@ discard block |
||
147 | 152 | $module = new $file($db); |
148 | 153 | |
149 | 154 | // Show modules according to features level |
150 | - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; |
|
151 | - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; |
|
155 | + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { |
|
156 | + continue; |
|
157 | + } |
|
158 | + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { |
|
159 | + continue; |
|
160 | + } |
|
152 | 161 | |
153 | 162 | if ($module->isEnabled()) { |
154 | 163 | print '<tr class="oddeven"><td>'.$module->name."</td><td>\n"; |
@@ -158,9 +167,13 @@ discard block |
||
158 | 167 | // Show example of numbering model |
159 | 168 | print '<td class="nowrap">'; |
160 | 169 | $tmp = $module->getExample(); |
161 | - if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>'; |
|
162 | - elseif ($tmp == 'NotConfigured') print $langs->trans($tmp); |
|
163 | - else print $tmp; |
|
170 | + if (preg_match('/^Error/', $tmp)) { |
|
171 | + print '<div class="error">'.$langs->trans($tmp).'</div>'; |
|
172 | + } elseif ($tmp == 'NotConfigured') { |
|
173 | + print $langs->trans($tmp); |
|
174 | + } else { |
|
175 | + print $tmp; |
|
176 | + } |
|
164 | 177 | print '</td>'."\n"; |
165 | 178 | |
166 | 179 | print '<td class="center">'; |
@@ -183,8 +196,9 @@ discard block |
||
183 | 196 | if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval |
184 | 197 | $htmltooltip .= ''.$langs->trans("NextValue").': '; |
185 | 198 | if ($nextval) { |
186 | - if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') |
|
187 | - $nextval = $langs->trans($nextval); |
|
199 | + if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') { |
|
200 | + $nextval = $langs->trans($nextval); |
|
201 | + } |
|
188 | 202 | $htmltooltip .= $nextval.'<br>'; |
189 | 203 | } else { |
190 | 204 | $htmltooltip .= $langs->trans($module->error).'<br>'; |
@@ -239,8 +253,12 @@ discard block |
||
239 | 253 | $module = new $file($db); |
240 | 254 | |
241 | 255 | // Show modules according to features level |
242 | - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; |
|
243 | - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; |
|
256 | + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { |
|
257 | + continue; |
|
258 | + } |
|
259 | + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { |
|
260 | + continue; |
|
261 | + } |
|
244 | 262 | |
245 | 263 | if ($module->isEnabled()) { |
246 | 264 | print '<tr class="oddeven"><td>'.$module->name."</td><td>\n"; |
@@ -250,9 +268,13 @@ discard block |
||
250 | 268 | // Show example of numbering model |
251 | 269 | print '<td class="nowrap">'; |
252 | 270 | $tmp = $module->getExample(); |
253 | - if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>'; |
|
254 | - elseif ($tmp == 'NotConfigured') print $langs->trans($tmp); |
|
255 | - else print $tmp; |
|
271 | + if (preg_match('/^Error/', $tmp)) { |
|
272 | + print '<div class="error">'.$langs->trans($tmp).'</div>'; |
|
273 | + } elseif ($tmp == 'NotConfigured') { |
|
274 | + print $langs->trans($tmp); |
|
275 | + } else { |
|
276 | + print $tmp; |
|
277 | + } |
|
256 | 278 | print '</td>'."\n"; |
257 | 279 | |
258 | 280 | print '<td class="center">'; |
@@ -275,8 +297,9 @@ discard block |
||
275 | 297 | if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval |
276 | 298 | $htmltooltip .= ''.$langs->trans("NextValue").': '; |
277 | 299 | if ($nextval) { |
278 | - if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') |
|
279 | - $nextval = $langs->trans($nextval); |
|
300 | + if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') { |
|
301 | + $nextval = $langs->trans($nextval); |
|
302 | + } |
|
280 | 303 | $htmltooltip .= $nextval.'<br>'; |
281 | 304 | } else { |
282 | 305 | $htmltooltip .= $langs->trans($module->error).'<br>'; |
@@ -727,7 +727,9 @@ |
||
727 | 727 | print $bankstatic->getNomUrl(1); |
728 | 728 | } |
729 | 729 | print '</td>'; |
730 | - if (!$i) $totalarray['nbfield']++; |
|
730 | + if (!$i) { |
|
731 | + $totalarray['nbfield']++; |
|
732 | + } |
|
731 | 733 | } |
732 | 734 | |
733 | 735 | // Amount |
@@ -535,7 +535,9 @@ discard block |
||
535 | 535 | // Type |
536 | 536 | if (!empty($arrayfields['t.fk_typepayment']['checked'])) { |
537 | 537 | print '<td>'; |
538 | - if (!empty($obj->payment_code)) print $langs->trans("PaymentTypeShort".$obj->payment_code); |
|
538 | + if (!empty($obj->payment_code)) { |
|
539 | + print $langs->trans("PaymentTypeShort".$obj->payment_code); |
|
540 | + } |
|
539 | 541 | print '</td>'; |
540 | 542 | if (!$i) { |
541 | 543 | $totalarray['nbfield']++; |
@@ -562,7 +564,9 @@ discard block |
||
562 | 564 | print $bankstatic->getNomUrl(1); |
563 | 565 | } |
564 | 566 | print '</td>'; |
565 | - if (!$i) $totalarray['nbfield']++; |
|
567 | + if (!$i) { |
|
568 | + $totalarray['nbfield']++; |
|
569 | + } |
|
566 | 570 | } |
567 | 571 | |
568 | 572 | // Amount |