@@ -2406,7 +2406,9 @@ discard block |
||
2406 | 2406 | if ($errorforthisaction) { |
2407 | 2407 | $errorforactions++; |
2408 | 2408 | } else { |
2409 | - if (!empty($contact_static->email) && $contact_static->email != $from) $from = $contact_static->email; |
|
2409 | + if (!empty($contact_static->email) && $contact_static->email != $from) { |
|
2410 | + $from = $contact_static->email; |
|
2411 | + } |
|
2410 | 2412 | |
2411 | 2413 | $result = $contactstatic->fetch(0, null, '', $from); |
2412 | 2414 | if ($result < 0) { |
@@ -3390,7 +3392,9 @@ discard block |
||
3390 | 3392 | $attachments[$filename] = $data; // this is a problem if two files have same name |
3391 | 3393 | |
3392 | 3394 | if (strlen($destdir)) { |
3393 | - if (substr($destdir, -1) != '/') $destdir .= '/'; |
|
3395 | + if (substr($destdir, -1) != '/') { |
|
3396 | + $destdir .= '/'; |
|
3397 | + } |
|
3394 | 3398 | |
3395 | 3399 | // Get file name (with extension) |
3396 | 3400 | $file_name_complete = $params['filename']; |
@@ -115,9 +115,12 @@ discard block |
||
115 | 115 | } |
116 | 116 | } |
117 | 117 | } |
118 | - if ($action == 'treeview') $object->getNetNeedsTree($TChildBom, 1); |
|
119 | - else $object->getNetNeeds($TChildBom, 1); |
|
120 | -} |
|
118 | + if ($action == 'treeview') { |
|
119 | + $object->getNetNeedsTree($TChildBom, 1); |
|
120 | + } else { |
|
121 | + $object->getNetNeeds($TChildBom, 1); |
|
122 | + } |
|
123 | + } |
|
121 | 124 | |
122 | 125 | |
123 | 126 | /* |
@@ -214,7 +217,9 @@ discard block |
||
214 | 217 | print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a> '; |
215 | 218 | } |
216 | 219 | print '</td>'; |
217 | - if ($action == 'treeview') print '<td class="left">'.$langs->trans('ProducedBy').'</td>'; |
|
220 | + if ($action == 'treeview') { |
|
221 | + print '<td class="left">'.$langs->trans('ProducedBy').'</td>'; |
|
222 | + } |
|
218 | 223 | print '<td class="linecolqty right">'.$langs->trans('Quantity').'</td>'; |
219 | 224 | print '<td class="linecolstock right">'.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).'</td>'; |
220 | 225 | print '<td class="linecoltheoricalstock right">'.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).'</td>'; |
@@ -229,15 +234,23 @@ discard block |
||
229 | 234 | if (!empty($TProduct['bom'])) { |
230 | 235 | $prod = new Product($db); |
231 | 236 | $prod->fetch($TProduct['bom']->fk_product); |
232 | - if ($TProduct['parentid'] != $object->id) print '<tr class="sub_bom_lines oddeven" parentid="'.$TProduct['parentid'].'">'; |
|
233 | - else print '<tr class="oddeven">'; |
|
234 | - if ($action == 'treeview') print '<td class="linecoldescription">'.str_repeat($repeatChar, $TProduct['level']).$prod->getNomUrl(1); |
|
235 | - else print '<td class="linecoldescription">'.str_repeat($repeatChar, $TProduct['level']).$TProduct['bom']->getNomUrl(1); |
|
237 | + if ($TProduct['parentid'] != $object->id) { |
|
238 | + print '<tr class="sub_bom_lines oddeven" parentid="'.$TProduct['parentid'].'">'; |
|
239 | + } else { |
|
240 | + print '<tr class="oddeven">'; |
|
241 | + } |
|
242 | + if ($action == 'treeview') { |
|
243 | + print '<td class="linecoldescription">'.str_repeat($repeatChar, $TProduct['level']).$prod->getNomUrl(1); |
|
244 | + } else { |
|
245 | + print '<td class="linecoldescription">'.str_repeat($repeatChar, $TProduct['level']).$TProduct['bom']->getNomUrl(1); |
|
246 | + } |
|
236 | 247 | print ' <a class="collapse_bom" id="collapse-'.$fk_bom.'" href="#">'; |
237 | 248 | print img_picto('', 'folder-open'); |
238 | 249 | print '</a>'; |
239 | 250 | print '</td>'; |
240 | - if ($action == 'treeview') print '<td class="left">'.$TProduct['bom']->getNomUrl(1).'</td>'; |
|
251 | + if ($action == 'treeview') { |
|
252 | + print '<td class="left">'.$TProduct['bom']->getNomUrl(1).'</td>'; |
|
253 | + } |
|
241 | 254 | print '<td class="linecolqty right">'.$TProduct['qty'].'</td>'; |
242 | 255 | print '<td class="linecolstock right"></td>'; |
243 | 256 | print '<td class="linecoltheoricalstock right"></td>'; |
@@ -248,11 +261,18 @@ discard block |
||
248 | 261 | $prod = new Product($db); |
249 | 262 | $prod->fetch($fk_product); |
250 | 263 | $prod->load_virtual_stock(); |
251 | - if (empty($prod->stock_reel)) $prod->stock_reel = 0; |
|
252 | - if ($fk_bom != $object->id) print '<tr class="sub_bom_lines oddeven" parentid="'.$fk_bom.'">'; |
|
253 | - else print '<tr class="oddeven">'; |
|
264 | + if (empty($prod->stock_reel)) { |
|
265 | + $prod->stock_reel = 0; |
|
266 | + } |
|
267 | + if ($fk_bom != $object->id) { |
|
268 | + print '<tr class="sub_bom_lines oddeven" parentid="'.$fk_bom.'">'; |
|
269 | + } else { |
|
270 | + print '<tr class="oddeven">'; |
|
271 | + } |
|
254 | 272 | print '<td class="linecoldescription">'.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).'</td>'; |
255 | - if ($action == 'treeview') print '<td></td>'; |
|
273 | + if ($action == 'treeview') { |
|
274 | + print '<td></td>'; |
|
275 | + } |
|
256 | 276 | print '<td class="linecolqty right">'.$TInfos['qty'].'</td>'; |
257 | 277 | print '<td class="linecolstock right">'.price2num($prod->stock_reel, 'MS').'</td>'; |
258 | 278 | print '<td class="linecoltheoricalstock right">'.$prod->stock_theorique.'</td>'; |
@@ -265,7 +285,9 @@ discard block |
||
265 | 285 | $prod = new Product($db); |
266 | 286 | $prod->fetch($fk_product); |
267 | 287 | $prod->load_virtual_stock(); |
268 | - if (empty($prod->stock_reel)) $prod->stock_reel = 0; |
|
288 | + if (empty($prod->stock_reel)) { |
|
289 | + $prod->stock_reel = 0; |
|
290 | + } |
|
269 | 291 | print '<tr class="oddeven">'; |
270 | 292 | print '<td class="linecoldescription">'.$prod->getNomUrl(1).'</td>'; |
271 | 293 | print '<td class="linecolqty right">'.$qty.'</td>'; |
@@ -1460,8 +1460,9 @@ discard block |
||
1460 | 1460 | $workstation = new Workstation($this->db); |
1461 | 1461 | $res = $workstation->fetch($tmpproduct->fk_default_workstation); |
1462 | 1462 | |
1463 | - if ($res > 0) $line->total_cost = price2num($qtyhourforline * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT'); |
|
1464 | - else { |
|
1463 | + if ($res > 0) { |
|
1464 | + $line->total_cost = price2num($qtyhourforline * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT'); |
|
1465 | + } else { |
|
1465 | 1466 | $this->error = $workstation->error; |
1466 | 1467 | return -3; |
1467 | 1468 | } |
@@ -1525,7 +1526,9 @@ discard block |
||
1525 | 1526 | if (!empty($this->lines)) { |
1526 | 1527 | foreach ($this->lines as $line) { |
1527 | 1528 | if (!empty($line->childBom)) { |
1528 | - foreach ($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty); |
|
1529 | + foreach ($line->childBom as $childBom) { |
|
1530 | + $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty); |
|
1531 | + } |
|
1529 | 1532 | } else { |
1530 | 1533 | if (empty($TNetNeeds[$line->fk_product])) { |
1531 | 1534 | $TNetNeeds[$line->fk_product] = 0; |
@@ -1580,7 +1583,9 @@ discard block |
||
1580 | 1583 | return; |
1581 | 1584 | } |
1582 | 1585 | |
1583 | - if (empty($bom_id)) $bom_id=$this->id; |
|
1586 | + if (empty($bom_id)) { |
|
1587 | + $bom_id=$this->id; |
|
1588 | + } |
|
1584 | 1589 | |
1585 | 1590 | $sql = 'SELECT l.fk_bom, b.label |
1586 | 1591 | FROM '.MAIN_DB_PREFIX.'bom_bomline l |
@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | global $filtertype; |
48 | -if (empty($filtertype)) $filtertype = 0; |
|
48 | +if (empty($filtertype)) { |
|
49 | + $filtertype = 0; |
|
50 | +} |
|
49 | 51 | |
50 | 52 | |
51 | 53 | global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax, $langs; |
@@ -67,8 +69,11 @@ discard block |
||
67 | 69 | } |
68 | 70 | |
69 | 71 | // add html5 elements |
70 | -if ($filtertype == 1) $domData = ' data-element="'.$line->element.'service"'; |
|
71 | -else $domData = ' data-element="'.$line->element.'"'; |
|
72 | +if ($filtertype == 1) { |
|
73 | + $domData = ' data-element="'.$line->element.'service"'; |
|
74 | +} else { |
|
75 | + $domData = ' data-element="'.$line->element.'"'; |
|
76 | +} |
|
72 | 77 | |
73 | 78 | $domData .= ' data-id="'.$line->id.'"'; |
74 | 79 | $domData .= ' data-qty="'.$line->qty.'"'; |
@@ -169,7 +174,9 @@ discard block |
||
169 | 174 | |
170 | 175 | print '<td class="linecolworkstation nowrap right">'; |
171 | 176 | $coldisplay++; |
172 | - if ($res > 0) echo $workstation->getNomUrl(); |
|
177 | + if ($res > 0) { |
|
178 | + echo $workstation->getNomUrl(); |
|
179 | + } |
|
173 | 180 | print '</td>'; |
174 | 181 | } |
175 | 182 | } |
@@ -280,7 +287,9 @@ discard block |
||
280 | 287 | print '<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.'">'.price($sub_bom_line->qty, 0, '', 0, 0).'</td>'; |
281 | 288 | if (!empty($conf->global->PRODUCT_USE_UNITS)) { |
282 | 289 | print '<td class="linecoluseunit nowrap left">'; |
283 | - if ($label !== '') print $langs->trans($label); |
|
290 | + if ($label !== '') { |
|
291 | + print $langs->trans($label); |
|
292 | + } |
|
284 | 293 | print '</td>'; |
285 | 294 | } |
286 | 295 | print '<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.'">'.$langs->trans('Yes').'</td>'; |
@@ -288,7 +297,9 @@ discard block |
||
288 | 297 | print '<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.'">'.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).'</td>'; |
289 | 298 | if (!empty($conf->global->PRODUCT_USE_UNITS)) { |
290 | 299 | print '<td class="linecoluseunit nowrap left">'; |
291 | - if ($label !== '') print $langs->trans($label); |
|
300 | + if ($label !== '') { |
|
301 | + print $langs->trans($label); |
|
302 | + } |
|
292 | 303 | print '</td>'; |
293 | 304 | } |
294 | 305 | |
@@ -316,7 +327,9 @@ discard block |
||
316 | 327 | $qty = convertDurationtoHour($sub_bom_line->qty, $unit); |
317 | 328 | $workstation = new Workstation($this->db); |
318 | 329 | $res = $workstation->fetch($sub_bom_product->fk_default_workstation); |
319 | - if ($res > 0) $sub_bom_line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT'); |
|
330 | + if ($res > 0) { |
|
331 | + $sub_bom_line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT'); |
|
332 | + } |
|
320 | 333 | |
321 | 334 | print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price(price2num($sub_bom_line->total_cost, 'MT')).'</span></td>'; |
322 | 335 | $this->total_cost += $line->total_cost; |
@@ -176,7 +176,9 @@ discard block |
||
176 | 176 | if (!empty($idprod) && isModEnabled('workstation')) { |
177 | 177 | $product = new Product($db); |
178 | 178 | $res = $product->fetch($idprod); |
179 | - if ($res > 0 && $product->type == Product::TYPE_SERVICE) $fk_default_workstation = $product->fk_default_workstation; |
|
179 | + if ($res > 0 && $product->type == Product::TYPE_SERVICE) { |
|
180 | + $fk_default_workstation = $product->fk_default_workstation; |
|
181 | + } |
|
180 | 182 | } |
181 | 183 | |
182 | 184 | if ($qty == '') { |
@@ -609,9 +611,12 @@ discard block |
||
609 | 611 | |
610 | 612 | $parameters = array(); |
611 | 613 | $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
612 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
613 | - if (empty($reshook)) |
|
614 | - $object->formAddObjectLine(1, $mysoc, null, '/bom/tpl'); |
|
614 | + if ($reshook < 0) { |
|
615 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
616 | + } |
|
617 | + if (empty($reshook)) { |
|
618 | + $object->formAddObjectLine(1, $mysoc, null, '/bom/tpl'); |
|
619 | + } |
|
615 | 620 | } |
616 | 621 | } |
617 | 622 | |
@@ -656,9 +661,12 @@ discard block |
||
656 | 661 | // Add services form |
657 | 662 | $parameters = array(); |
658 | 663 | $reshook = $hookmanager->executeHooks('formAddObjectServiceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
659 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
660 | - if (empty($reshook)) |
|
661 | - $object->formAddObjectLine(1, $mysoc, null, '/bom/tpl'); |
|
664 | + if ($reshook < 0) { |
|
665 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
666 | + } |
|
667 | + if (empty($reshook)) { |
|
668 | + $object->formAddObjectLine(1, $mysoc, null, '/bom/tpl'); |
|
669 | + } |
|
662 | 670 | } |
663 | 671 | } |
664 | 672 | } |
@@ -50,7 +50,9 @@ discard block |
||
50 | 50 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_stock as ps on ps.rowid = pb.fk_product_stock"; |
51 | 51 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entrepot as e on e.rowid = ps.fk_entrepot AND e.entity IN (" . getEntity('stock') . ")"; |
52 | 52 | $sql .= " WHERE ps.fk_product = " .((int) $fk_product); |
53 | - if ($warehouse_id > 0) $sql .= " AND fk_entrepot = '" . ((int) $warehouse_id) . "'"; |
|
53 | + if ($warehouse_id > 0) { |
|
54 | + $sql .= " AND fk_entrepot = '" . ((int) $warehouse_id) . "'"; |
|
55 | + } |
|
54 | 56 | $sql .= " ORDER BY e.ref, pb.batch"; |
55 | 57 | |
56 | 58 | $resql = $db->query($sql); |
@@ -74,7 +76,9 @@ discard block |
||
74 | 76 | $sql .= " JOIN " . MAIN_DB_PREFIX . "product_stock as ps on ps.rowid = pb.fk_product_stock"; |
75 | 77 | $sql .= " JOIN " . MAIN_DB_PREFIX . "entrepot as e on e.rowid = ps.fk_entrepot AND e.entity IN (" . getEntity('stock') . ")"; |
76 | 78 | $sql .= " WHERE ps.fk_product = " .((int) $fk_product); |
77 | - if ($batch) $sql.= " AND pb.batch = '" . $db->escape($batch) . "'"; |
|
79 | + if ($batch) { |
|
80 | + $sql.= " AND pb.batch = '" . $db->escape($batch) . "'"; |
|
81 | + } |
|
78 | 82 | $sql .= " ORDER BY e.ref, pb.batch"; |
79 | 83 | |
80 | 84 | $resql = $db->query($sql); |
@@ -1516,7 +1516,10 @@ |
||
1516 | 1516 | print '</td>'; |
1517 | 1517 | |
1518 | 1518 | print '<td align="right" class="splitall">'; |
1519 | - if (($action == 'consumeorproduce' || $action == 'consumeandproduceall') && $tmpproduct->status_batch == 2) print img_picto($langs->trans('SplitAllQuantity'), 'split.png', 'class="splitbutton splitallbutton field-error-icon" onClick="addDispatchLine('.$line->id.', \'batch\', \'alltoproduce\')"'); // |
|
1519 | + if (($action == 'consumeorproduce' || $action == 'consumeandproduceall') && $tmpproduct->status_batch == 2) { |
|
1520 | + print img_picto($langs->trans('SplitAllQuantity'), 'split.png', 'class="splitbutton splitallbutton field-error-icon" onClick="addDispatchLine('.$line->id.', \'batch\', \'alltoproduce\')"'); |
|
1521 | + } |
|
1522 | + // |
|
1520 | 1523 | print '</td>'; |
1521 | 1524 | } else { |
1522 | 1525 | print '<td></td>'; |
@@ -46,8 +46,12 @@ |
||
46 | 46 | // 'ZAPIERFORDOLIBARR_MYPARAM2'=>array('css'=>'minwidth500', 'enabled'=>1) |
47 | 47 | ); |
48 | 48 | |
49 | -if (!isModEnabled('zapier')) accessforbidden(); |
|
50 | -if (empty($user->admin)) accessforbidden(); |
|
49 | +if (!isModEnabled('zapier')) { |
|
50 | + accessforbidden(); |
|
51 | +} |
|
52 | +if (empty($user->admin)) { |
|
53 | + accessforbidden(); |
|
54 | +} |
|
51 | 55 | |
52 | 56 | |
53 | 57 | /* |
@@ -42,8 +42,12 @@ |
||
42 | 42 | accessforbidden(); |
43 | 43 | } |
44 | 44 | |
45 | -if (!isModEnabled('zapier')) accessforbidden(); |
|
46 | -if (empty($user->admin)) accessforbidden(); |
|
45 | +if (!isModEnabled('zapier')) { |
|
46 | + accessforbidden(); |
|
47 | +} |
|
48 | +if (empty($user->admin)) { |
|
49 | + accessforbidden(); |
|
50 | +} |
|
47 | 51 | |
48 | 52 | |
49 | 53 | // Parameters |