forked from Wavyzz/dolibarr
Fixing style errors.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '') . '" method="POST">
|
||||
@@ -601,7 +599,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print "</form>\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');
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 '</td>';
|
||||
print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
|
||||
|
||||
if($filtertype != 1) {
|
||||
if ($filtertype != 1) {
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print '<td class="linecoluseunit left">';
|
||||
print '<span id="title_units">';
|
||||
@@ -82,10 +82,9 @@ if ($nolinesbefore) {
|
||||
print '<td class="linecolqtyfrozen right">' . $form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")) . '</td>';
|
||||
print '<td class="linecoldisablestockchange right">' . $form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')) . '</td>';
|
||||
print '<td class="linecollost right">' . $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')) . '</td>';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
print '<td class="linecolunit right">' . $form->textwithpicto($langs->trans('Unit'), '').'</td>';
|
||||
if($conf->workstation->enabled) print '<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans('Workstation'), '') . '</td>';
|
||||
if ($conf->workstation->enabled) print '<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans('Workstation'), '') . '</td>';
|
||||
print '<td class="linecoltotalcost right">' . $form->textwithpicto($langs->trans('TotalCost'), '') . '</td>';
|
||||
}
|
||||
|
||||
@@ -106,10 +105,9 @@ print '<td class="bordertop nobottom linecoldescription minwidth500imp">';
|
||||
|
||||
// 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 '<span class="prod_entry_mode_predef">';
|
||||
@@ -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 '<td class="bordertop nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="'.(GETPOSTISSET("qty") ? GETPOST("qty", 'alpha', 2) : 1).'">';
|
||||
print '</td>';
|
||||
|
||||
if($filtertype != 1) {
|
||||
if ($filtertype != 1) {
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom linecoluseunit left">';
|
||||
@@ -213,11 +210,11 @@ jQuery(document).ready(function() {
|
||||
});
|
||||
|
||||
//change unit selected if we change service selected
|
||||
<?php if($filtertype == 1) { ?>
|
||||
<?php if ($filtertype == 1) { ?>
|
||||
$('#idprodservice').change(function(){
|
||||
var idproduct = $(this).val();
|
||||
$.ajax({
|
||||
url : "<?php echo dol_buildpath('/bom/ajax/ajax.php',1); ?>"
|
||||
url : "<?php echo dol_buildpath('/bom/ajax/ajax.php', 1); ?>"
|
||||
,type: 'POST'
|
||||
,data: {
|
||||
'action': 'getDurationUnitByProduct'
|
||||
|
||||
@@ -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 '</td>';
|
||||
|
||||
if($filtertype != 1) {
|
||||
if ($filtertype != 1) {
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom linecoluseunit left">';
|
||||
@@ -151,7 +151,6 @@ if($filtertype != 1) {
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom nowrap linecolcostprice right">';
|
||||
print '</td>';
|
||||
|
||||
}
|
||||
|
||||
$coldisplay += $colspan;
|
||||
|
||||
@@ -40,7 +40,7 @@ if (empty($object) || !is_object($object)) {
|
||||
}
|
||||
|
||||
global $filtertype;
|
||||
if(empty($filtertype)) $filtertype = 0;
|
||||
if (empty($filtertype)) $filtertype = 0;
|
||||
|
||||
print "<!-- BEGIN PHP TEMPLATE objectline_title.tpl.php -->\n";
|
||||
|
||||
@@ -66,28 +66,26 @@ print '</td>';
|
||||
// Qty
|
||||
print '<td class="linecolqty right">'.$form->textwithpicto($langs->trans('Qty'), ($filtertype != 1) ? $langs->trans("QtyRequiredIfNoLoss") : '').'</td>';
|
||||
|
||||
if($filtertype != 1) {
|
||||
if ($filtertype != 1) {
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print '<td class="linecoluseunit left">' . $langs->trans('Unit') . '</td>';
|
||||
}
|
||||
|
||||
// Qty frozen
|
||||
// Qty frozen
|
||||
print '<td class="linecolqtyfrozen right">' . $form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")) . '</td>';
|
||||
|
||||
// Disable stock change
|
||||
// Disable stock change
|
||||
print '<td class="linecoldisablestockchange right">' . $form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')) . '</td>';
|
||||
|
||||
// Efficiency
|
||||
// Efficiency
|
||||
print '<td class="linecolefficiency right">' . $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')) . '</td>';
|
||||
|
||||
// Cost
|
||||
print '<td class="linecolcost right">'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td>';
|
||||
|
||||
} else {
|
||||
|
||||
print '<td class="linecolunit right">' . $form->textwithpicto($langs->trans('Unit'), '').'</td>';
|
||||
|
||||
if($conf->workstation->enabled) print '<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans('DefaultWorkstation'), '') . '</td>';
|
||||
if ($conf->workstation->enabled) print '<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans('DefaultWorkstation'), '') . '</td>';
|
||||
|
||||
// Cost
|
||||
print '<td class="linecolcost right">'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCostService")).'</td>';
|
||||
|
||||
@@ -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 '</td>';
|
||||
|
||||
if($filtertype != 1) {
|
||||
if ($filtertype != 1) {
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print '<td class="linecoluseunit nowrap left">';
|
||||
$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 '</td>';
|
||||
|
||||
//Poste de travail
|
||||
if($conf->workstation->enabled) {
|
||||
if ($conf->workstation->enabled) {
|
||||
$workstation = new Workstation($object->db);
|
||||
$res = $workstation->fetch($tmpproduct->fk_default_workstation);
|
||||
|
||||
print '<td class="linecolunit nowrap right">';
|
||||
$coldisplay++;
|
||||
if($res > 0) echo $workstation->getNomUrl();
|
||||
if ($res > 0) echo $workstation->getNomUrl();
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 '<tr><td>'.$langs->trans("DefaultWorkstation").'</td><td>';
|
||||
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 '<tr><td>'.$langs->trans("DefaultWorkstation").'</td><td>';
|
||||
print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"');
|
||||
@@ -2505,7 +2505,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if($object->isService() && $conf->workstation->enabled) {
|
||||
if ($object->isService() && $conf->workstation->enabled) {
|
||||
$workstation = new Workstation($db);
|
||||
$res = $workstation->fetch($object->fk_default_workstation);
|
||||
|
||||
|
||||
@@ -434,7 +434,6 @@ class FormProduct
|
||||
$out .= '<option value="-1">'.($empty_label ? $empty_label : ' ').'</option>';
|
||||
}
|
||||
foreach ($this->cache_workstations as $id => $arraytypes) {
|
||||
|
||||
$label = $arraytypes['label'];
|
||||
|
||||
$out .= '<option value="'.$id.'"';
|
||||
|
||||
Reference in New Issue
Block a user