diff --git a/htdocs/bom/ajax/ajax.php b/htdocs/bom/ajax/ajax.php
index ef99ab214d1..2ad12cc60a3 100644
--- a/htdocs/bom/ajax/ajax.php
+++ b/htdocs/bom/ajax/ajax.php
@@ -66,11 +66,10 @@ $idproduct = GETPOST('idproduct', 'int');
top_httphead();
if ($action == 'getDurationUnitByProduct') {
-
$product = new Product($db);
$res = $product->fetch($idproduct);
- if($res > 0){
+ if ($res > 0) {
$return = $product->duration_unit;
}
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index d4dd367e95e..1abc33f9bce 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -167,7 +167,7 @@ if (empty($reshook)) {
$qty_frozen = price2num(GETPOST('qty_frozen', 'alpha'), 'MS');
$disable_stock_change = GETPOST('disable_stock_change', 'int');
$efficiency = price2num(GETPOST('efficiency', 'alpha'));
- $duration_unit = GETPOST('duration_unit','alphanohtml');
+ $duration_unit = GETPOST('duration_unit', 'alphanohtml');
if ($qty == '') {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++;
@@ -227,7 +227,7 @@ if (empty($reshook)) {
$qty_frozen = price2num(GETPOST('qty_frozen', 'alpha'), 'MS');
$disable_stock_change = GETPOST('disable_stock_change', 'int');
$efficiency = price2num(GETPOST('efficiency', 'alpha'));
- $duration_unit = GETPOST('duration_unit','alphanohtml');
+ $duration_unit = GETPOST('duration_unit', 'alphanohtml');
if ($qty == '') {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
@@ -549,13 +549,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
*/
if (!empty($object->table_element_line)) {
-
//Products
$res = $object->fetchLinesbytypeproduct(0);
$object->calculateCosts();
- if($res > 0) {
-
+ if ($res > 0) {
print load_fiche_titre($langs->trans('BOMProductsList'), '', 'product');
print '
\n";
mrpCollapseBomManagement();
-
}
//Services
@@ -609,7 +606,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$res = $object->fetchLinesbytypeproduct(1);
$object->calculateCosts();
- if($res > 0) {
+ if ($res > 0) {
print load_fiche_titre($langs->trans('BOMServicesList'), '', 'service');
diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index 16c780a5751..c0eb5e802ea 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -1098,7 +1098,7 @@ class BOM extends CommonObject
$tmpproduct->pmp = 0;
$result = $tmpproduct->fetch($line->fk_product, '', '', '', 0, 1, 1); // We discard selling price and language loading
- if($tmpproduct->type == $tmpproduct::TYPE_PRODUCT) {
+ if ($tmpproduct->type == $tmpproduct::TYPE_PRODUCT) {
if (empty($line->fk_bom_child)) {
if ($result < 0) {
$this->error = $tmpproduct->error;
@@ -1127,16 +1127,15 @@ class BOM extends CommonObject
}
}
} else {
-
//Convert qty to hour
$qty = convertDurationtoHour($line->qty, $line->duration_unit);
- if($conf->workstation->enabled){
- if($tmpproduct->fk_default_workstation) {
+ if ($conf->workstation->enabled) {
+ if ($tmpproduct->fk_default_workstation) {
$workstation = new Workstation($this->db);
$res = $workstation->fetch($tmpproduct->fk_default_workstation);
- if($res > 0) $line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT');
+ if ($res > 0) $line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT');
else {
$this->error = $workstation->error;
return -3;
diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php
index 55b14a0f650..ff257d6ab72 100644
--- a/htdocs/bom/tpl/objectline_create.tpl.php
+++ b/htdocs/bom/tpl/objectline_create.tpl.php
@@ -44,7 +44,7 @@ if (empty($forceall)) {
$forceall = 0;
}
-if(empty($filtertype)) $filtertype = 0;
+if (empty($filtertype)) $filtertype = 0;
if (!empty($object->element) && $object->element == 'contrat' && empty($conf->global->STOCK_SUPPORT_SERVICES)) {
$filtertype = -1;
}
@@ -72,7 +72,7 @@ if ($nolinesbefore) {
print '';
print ''.$langs->trans('Qty').' ';
- if($filtertype != 1) {
+ if ($filtertype != 1) {
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
print '';
print '';
@@ -82,10 +82,9 @@ if ($nolinesbefore) {
print ' ' . $form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")) . ' ';
print '' . $form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')) . ' ';
print '' . $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')) . ' ';
- }
- else {
+ } else {
print '' . $form->textwithpicto($langs->trans('Unit'), '').' ';
- if($conf->workstation->enabled) print '' . $form->textwithpicto($langs->trans('Workstation'), '') . ' ';
+ if ($conf->workstation->enabled) print '' . $form->textwithpicto($langs->trans('Workstation'), '') . ' ';
print '' . $form->textwithpicto($langs->trans('TotalCost'), '') . ' ';
}
@@ -106,10 +105,9 @@ print '';
// Predefined product/service
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
- if($filtertype == 1){
+ if ($filtertype == 1) {
print $langs->trans("Service");
- }
- elseif (!empty($conf->global->BOM_SUB_BOM)) {
+ } elseif (!empty($conf->global->BOM_SUB_BOM)) {
print $langs->trans("Product");
}
echo '';
@@ -118,8 +116,7 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) {
// hide products in closed warehouse, but show products for internal transfer
$form->select_produits(GETPOST('idprod', 'int'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array'));
- }
- else {
+ } else {
$form->select_produits(GETPOST('idprod', 'int'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array'));
}
@@ -137,7 +134,7 @@ $coldisplay++;
print ' ';
print ' ';
-if($filtertype != 1) {
+if ($filtertype != 1) {
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$coldisplay++;
print '';
@@ -213,11 +210,11 @@ jQuery(document).ready(function() {
});
//change unit selected if we change service selected
-
+
$('#idprodservice').change(function(){
var idproduct = $(this).val();
$.ajax({
- url : ""
+ url : ""
,type: 'POST'
,data: {
'action': 'getDurationUnitByProduct'
diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php
index b669c936412..b803277f359 100644
--- a/htdocs/bom/tpl/objectline_edit.tpl.php
+++ b/htdocs/bom/tpl/objectline_edit.tpl.php
@@ -47,7 +47,7 @@ if (empty($forceall)) {
$forceall = 0;
}
-if(empty($filtertype)) $filtertype = 0;
+if (empty($filtertype)) $filtertype = 0;
$formproduct = new FormProduct($object->db);
@@ -115,7 +115,7 @@ if (($line->info_bits & 2) != 2) {
}
print ' ';
-if($filtertype != 1) {
+if ($filtertype != 1) {
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$coldisplay++;
print '';
@@ -151,7 +151,6 @@ if($filtertype != 1) {
$coldisplay++;
print ' ';
print ' ';
-
}
$coldisplay += $colspan;
diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php
index 9ed44d8f503..f93fb59fe0d 100644
--- a/htdocs/bom/tpl/objectline_title.tpl.php
+++ b/htdocs/bom/tpl/objectline_title.tpl.php
@@ -40,7 +40,7 @@ if (empty($object) || !is_object($object)) {
}
global $filtertype;
-if(empty($filtertype)) $filtertype = 0;
+if (empty($filtertype)) $filtertype = 0;
print "\n";
@@ -66,28 +66,26 @@ print '';
// Qty
print ''.$form->textwithpicto($langs->trans('Qty'), ($filtertype != 1) ? $langs->trans("QtyRequiredIfNoLoss") : '').' ';
-if($filtertype != 1) {
+if ($filtertype != 1) {
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
print '' . $langs->trans('Unit') . ' ';
}
-// Qty frozen
+ // Qty frozen
print '' . $form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")) . ' ';
-// Disable stock change
+ // Disable stock change
print '' . $form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')) . ' ';
-// Efficiency
+ // Efficiency
print '' . $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')) . ' ';
// Cost
print ''.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).' ';
-
} else {
-
print '' . $form->textwithpicto($langs->trans('Unit'), '').' ';
- if($conf->workstation->enabled) print '' . $form->textwithpicto($langs->trans('DefaultWorkstation'), '') . ' ';
+ if ($conf->workstation->enabled) print '' . $form->textwithpicto($langs->trans('DefaultWorkstation'), '') . ' ';
// Cost
print ''.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCostService")).' ';
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index cef6b520264..2c9758f2176 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -43,7 +43,7 @@ if (empty($object) || !is_object($object)) {
}
global $filtertype;
-if(empty($filtertype)) $filtertype = 0;
+if (empty($filtertype)) $filtertype = 0;
global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax, $langs;
@@ -105,7 +105,7 @@ $coldisplay++;
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
print '';
-if($filtertype != 1) {
+if ($filtertype != 1) {
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
print '';
$label = $tmpproduct->getLabelOfUnit('long');
@@ -137,7 +137,7 @@ if($filtertype != 1) {
} elseif ($tmpproduct->duration_value > 0) {
$dur = array("s"=>$langs->trans("Second"), "i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year"));
}
- if(!empty($line->duration_unit)){
+ if (!empty($line->duration_unit)) {
print (isset($dur[$line->duration_unit]) ? " ".$langs->trans($dur[$line->duration_unit])." " : '');
} else {
print (!empty($tmpproduct->duration_unit) && isset($dur[$tmpproduct->duration_unit]) ? " " . $langs->trans($dur[$tmpproduct->duration_unit]) . " " : '');
@@ -145,13 +145,13 @@ if($filtertype != 1) {
print ' ';
//Poste de travail
- if($conf->workstation->enabled) {
+ if ($conf->workstation->enabled) {
$workstation = new Workstation($object->db);
$res = $workstation->fetch($tmpproduct->fk_default_workstation);
print '';
$coldisplay++;
- if($res > 0) echo $workstation->getNomUrl();
+ if ($res > 0) echo $workstation->getNomUrl();
print ' ';
}
}
diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php
index 98a17e062ee..3e52099a41b 100644
--- a/htdocs/core/lib/date.lib.php
+++ b/htdocs/core/lib/date.lib.php
@@ -328,13 +328,13 @@ function convertDurationtoHour($duration_value, $duration_unit)
{
$result = 0;
- if($duration_unit == 's') $result = $duration_value / 3600;
- if($duration_unit == 'i') $result = $duration_value / 60;
- if($duration_unit == 'h') $result = $duration_value;
- if($duration_unit == 'd') $result = $duration_value * 24;
- if($duration_unit == 'w') $result = $duration_value * 24 * 7;
- if($duration_unit == 'm') $result = $duration_value * 730.484;
- if($duration_unit == 'y') $result = $duration_value * 365 * 24;
+ if ($duration_unit == 's') $result = $duration_value / 3600;
+ if ($duration_unit == 'i') $result = $duration_value / 60;
+ if ($duration_unit == 'h') $result = $duration_value;
+ if ($duration_unit == 'd') $result = $duration_value * 24;
+ if ($duration_unit == 'w') $result = $duration_value * 24 * 7;
+ if ($duration_unit == 'm') $result = $duration_value * 730.484;
+ if ($duration_unit == 'y') $result = $duration_value * 365 * 24;
return $result;
}
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 23fdd431696..b8796391e81 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -1468,7 +1468,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
}
- if($type == 1 && $conf->workstation->enabled){
+ if ($type == 1 && $conf->workstation->enabled) {
// Default workstation
print ''.$langs->trans("DefaultWorkstation").' ';
print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"');
@@ -2016,7 +2016,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
*/
}
- if($object->isService() && $conf->workstation->enabled) {
+ if ($object->isService() && $conf->workstation->enabled) {
// Default workstation
print ' '.$langs->trans("DefaultWorkstation").' ';
print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"');
@@ -2505,7 +2505,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ' ';
}
- if($object->isService() && $conf->workstation->enabled) {
+ if ($object->isService() && $conf->workstation->enabled) {
$workstation = new Workstation($db);
$res = $workstation->fetch($object->fk_default_workstation);
diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php
index d6017877375..0ac039b55ec 100644
--- a/htdocs/product/class/html.formproduct.class.php
+++ b/htdocs/product/class/html.formproduct.class.php
@@ -434,7 +434,6 @@ class FormProduct
$out .= ''.($empty_label ? $empty_label : ' ').' ';
}
foreach ($this->cache_workstations as $id => $arraytypes) {
-
$label = $arraytypes['label'];
$out .= '