@@ -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 | /* |
@@ -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 | /* |
@@ -46,8 +46,12 @@ |
||
| 46 | 46 | //if ($user->socid > 0) $socid = $user->socid; |
| 47 | 47 | //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
| 48 | 48 | //restrictedArea($user, $object->element, $object->id, '', '', 'fk_soc', 'rowid', 0); |
| 49 | -if (!isModEnabled('hrm')) accessforbidden(); |
|
| 50 | -if (empty($permissiontoread)) accessforbidden(); |
|
| 49 | +if (!isModEnabled('hrm')) { |
|
| 50 | + accessforbidden(); |
|
| 51 | +} |
|
| 52 | +if (empty($permissiontoread)) { |
|
| 53 | + accessforbidden(); |
|
| 54 | +} |
|
| 51 | 55 | |
| 52 | 56 | |
| 53 | 57 | /* |
@@ -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 | |
@@ -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 | |