Merge remote-tracking branch 'doligithub/develop' into develop
This commit is contained in:
commit
2d08e6064e
@ -483,13 +483,15 @@ if ($virtualdiffersfromphysical)
|
||||
print '</tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("UseVirtualStockByDefault").'</td>';
|
||||
print '<td>';
|
||||
print $form->textwithpicto($langs->trans("UseRealStockByDefault"), $langs->trans("ReplenishmentCalculation"));
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('STOCK_USE_VIRTUAL_STOCK');
|
||||
print ajax_constantonoff('STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("STOCK_USE_VIRTUAL_STOCK", $arrval, $conf->global->STOCK_USE_VIRTUAL_STOCK);
|
||||
print $form->selectarray("STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT", $arrval, $conf->global->STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT);
|
||||
}
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
@ -92,8 +92,10 @@ class BOM extends CommonObject
|
||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
|
||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
|
||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'autofocusoncreate'=>1),
|
||||
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
|
||||
//'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassembly')),
|
||||
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')),
|
||||
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
|
||||
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
|
||||
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
|
||||
//'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLossForProductProduced'),
|
||||
'duration' => array('type'=>'duration', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
|
||||
@ -113,6 +115,7 @@ class BOM extends CommonObject
|
||||
public $rowid;
|
||||
public $ref;
|
||||
public $label;
|
||||
public $bomtype;
|
||||
public $description;
|
||||
public $note_public;
|
||||
public $note_private;
|
||||
|
||||
@ -34,7 +34,7 @@ StockMovementForId=Movement ID %d
|
||||
ListMouvementStockProject=List of stock movements associated to project
|
||||
StocksArea=Warehouses area
|
||||
AllWarehouses=All warehouses
|
||||
IncludeEmptyDesiredStock=Include also undefined desired stock
|
||||
IncludeEmptyDesiredStock=Include also negative stock with undefined desired stock
|
||||
IncludeAlsoDraftOrders=Include also draft orders
|
||||
Location=Location
|
||||
LocationSummary=Short name location
|
||||
@ -122,8 +122,9 @@ DesiredStockDesc=This stock amount will be the value used to fill the stock by r
|
||||
StockToBuy=To order
|
||||
Replenishment=Replenishment
|
||||
ReplenishmentOrders=Replenishment orders
|
||||
VirtualDiffersFromPhysical=According to increase/decrease stock options, physical stock and virtual stock (physical + current orders) may differ
|
||||
UseVirtualStockByDefault=Use virtual stock by default, instead of physical stock, for replenishment feature
|
||||
VirtualDiffersFromPhysical=According to increase/decrease stock options, physical stock and virtual stock (physical stock + open orders) may differ
|
||||
UseRealStockByDefault=Use real stock, instead of virtual stock, for replenishment feature
|
||||
ReplenishmentCalculation=Amount to order will be (desired quantity - real stock) instead of (desired quantity - virtual stock)
|
||||
UseVirtualStock=Use virtual stock
|
||||
UsePhysicalStock=Use physical stock
|
||||
CurentSelectionMode=Current selection mode
|
||||
|
||||
@ -80,7 +80,6 @@ if (!$sortorder) {
|
||||
$sortorder = 'ASC';
|
||||
}
|
||||
|
||||
// Define virtualdiffersfromphysical
|
||||
$virtualdiffersfromphysical = 0;
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|
||||
|| !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
|
||||
@ -92,7 +91,11 @@ if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|
||||
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
|
||||
}
|
||||
|
||||
$usevirtualstock = !empty($conf->global->STOCK_USE_VIRTUAL_STOCK);
|
||||
if ($virtualdiffersfromphysical) {
|
||||
$usevirtualstock = empty($conf->global->STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT) ? 1 : 0;
|
||||
} else {
|
||||
$usevirtualstock = 0;
|
||||
}
|
||||
if ($mode == 'physical') $usevirtualstock = 0;
|
||||
if ($mode == 'virtual') $usevirtualstock = 1;
|
||||
|
||||
@ -349,7 +352,9 @@ if (dol_strlen($type)) {
|
||||
if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
|
||||
if ($search_label) $sql .= natural_search('p.label', $search_label);
|
||||
$sql .= ' AND p.tobuy = 1';
|
||||
if (!empty($canvas)) $sql .= ' AND p.canvas = "'.$db->escape($canvas).'"';
|
||||
if (empty($conf->global->VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT)) { // Add test to exclude products that has variants
|
||||
$sql .= ' AND p.rowid NOT IN (SELECT pac.fk_product_parent FROM '.MAIN_DB_PREFIX.'product_attribute_combination as pac WHERE pac.entity IN ('.getEntity('product').'))';
|
||||
}
|
||||
$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price';
|
||||
$sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms';
|
||||
$sql .= ', p.duration, p.tobuy';
|
||||
@ -526,22 +531,23 @@ print load_fiche_titre($langs->trans('Replenishment'), '', 'stock');
|
||||
|
||||
print dol_get_fiche_head($head, 'replenish', '', -1, '');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDesc").'</span><br>'."\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDesc").'</span>'."\n";
|
||||
if (empty($fk_warhouse) && !empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDescPerWarehouse").'</span>'."<br>\n";
|
||||
}
|
||||
print '<br>';
|
||||
if ($usevirtualstock == 1)
|
||||
{
|
||||
print $langs->trans("CurentSelectionMode").': ';
|
||||
print $langs->trans("CurentlyUsingVirtualStock");
|
||||
print ' (<a href="'.$_SERVER["PHP_SELF"].'?mode=physical&fk_supplier='.$fk_supplier.'&fk_entrepot='.$fk_entrepot.'">'.$langs->trans("UsePhysicalStock").'</a>)';
|
||||
print '<span class="a-mesure">'.$langs->trans("UseVirtualStock").'</span>';
|
||||
print ' <a class="a-mesure-disabled" href="'.$_SERVER["PHP_SELF"].'?mode=physical'.($fk_supplier > 0 ? '&fk_supplier='.$fk_supplier : '').($fk_entrepot > 0 ? '&fk_entrepot='.$fk_entrepot : '').'">'.$langs->trans("UsePhysicalStock").'</a>';
|
||||
print '<br>';
|
||||
}
|
||||
if ($usevirtualstock == 0)
|
||||
{
|
||||
print $langs->trans("CurentSelectionMode").': ';
|
||||
print $langs->trans("CurentlyUsingPhysicalStock");
|
||||
print ' (<a href="'.$_SERVER["PHP_SELF"].'?mode=virtual&fk_supplier='.$fk_supplier.'&fk_entrepot='.$fk_entrepot.'">'.$langs->trans("UseVirtualStock").'</a>)';
|
||||
print '<a class="a-mesure-disabled" href="'.$_SERVER["PHP_SELF"].'?mode=virtual'.($fk_supplier > 0 ? '&fk_supplier='.$fk_supplier : '').($fk_entrepot > 0 ? '&fk_entrepot='.$fk_entrepot : '').'">'.$langs->trans("UseVirtualStock").'</a>';
|
||||
print ' <span class="a-mesure">'.$langs->trans("UsePhysicalStock").'</span>';
|
||||
print '<br>';
|
||||
}
|
||||
print '<br>'."\n";
|
||||
@ -591,54 +597,33 @@ print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
|
||||
|
||||
if ($search_ref || $search_label || $sall || $salert || $draftorder || GETPOST('search', 'alpha')) {
|
||||
$filters = '&search_ref='.$search_ref.'&search_label='.$search_label;
|
||||
$filters .= '&sall='.$sall;
|
||||
$filters .= '&salert='.$salert;
|
||||
$filters .= '&draftorder='.$draftorder;
|
||||
$filters .= '&mode='.$mode;
|
||||
$filters .= '&fk_supplier='.$fk_supplier;
|
||||
$filters .= '&fk_entrepot='.$fk_entrepot;
|
||||
print_barre_liste(
|
||||
$texte,
|
||||
$page,
|
||||
'replenish.php',
|
||||
$filters,
|
||||
$sortfield,
|
||||
$sortorder,
|
||||
'',
|
||||
$num
|
||||
);
|
||||
$filters = '&search_ref='.urlencode($search_ref).'&search_label='.urlencode($search_label);
|
||||
$filters .= '&sall='.urlencode($sall);
|
||||
$filters .= '&salert='.urlencode($salert);
|
||||
$filters .= '&draftorder='.urlencode($draftorder);
|
||||
$filters .= '&mode='.urlencode($mode);
|
||||
if ($fk_supplier > 0) $filters .= '&fk_supplier='.urlencode($fk_supplier);
|
||||
if ($fk_entrepot > 0) $filters .= '&fk_entrepot='.urlencode($fk_entrepot);
|
||||
} else {
|
||||
$filters = '&search_ref='.$search_ref.'&search_label='.$search_label;
|
||||
$filters .= '&fourn_id='.$fourn_id;
|
||||
$filters .= (isset($type) ? '&type='.$type : '');
|
||||
$filters .= '&='.$salert;
|
||||
$filters .= '&draftorder='.$draftorder;
|
||||
$filters .= '&mode='.$mode;
|
||||
$filters .= '&fk_supplier='.$fk_supplier;
|
||||
$filters .= '&fk_entrepot='.$fk_entrepot;
|
||||
print_barre_liste(
|
||||
$texte,
|
||||
$page,
|
||||
'replenish.php',
|
||||
$filters,
|
||||
$sortfield,
|
||||
$sortorder,
|
||||
'',
|
||||
$num
|
||||
);
|
||||
$filters = '&search_ref='.urlencode($search_ref).'&search_label='.urlencode($search_label);
|
||||
$filters .= '&fourn_id='.urlencode($fourn_id);
|
||||
$filters .= (isset($type) ? '&type='.urlencode($type) : '');
|
||||
$filters .= '&='.urlencode($salert);
|
||||
$filters .= '&draftorder='.urlencode($draftorder);
|
||||
$filters .= '&mode='.urlencode($mode);
|
||||
if ($fk_supplier > 0) $filters .= '&fk_supplier='.urlencode($fk_supplier);
|
||||
if ($fk_entrepot > 0) $filters .= '&fk_entrepot='.urlencode($fk_entrepot);
|
||||
}
|
||||
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$filters .= '&limit='.urlencode($limit);
|
||||
}
|
||||
|
||||
$param = (isset($type) ? '&type='.$type : '');
|
||||
$param .= '&fourn_id='.$fourn_id.'&search_label='.$search_label.'&includeproductswithoutdesiredqty='.$includeproductswithoutdesiredqty.'&salert='.$salert.'&draftorder='.$draftorder;
|
||||
$param .= '&search_ref='.$search_ref;
|
||||
$param .= '&mode='.$mode;
|
||||
$param .= '&fk_supplier='.$fk_supplier;
|
||||
$param .= '&fk_entrepot='.$fk_entrepot;
|
||||
$param = (isset($type) ? '&type='.urlencode($type) : '');
|
||||
$param .= '&fourn_id='.urlencode($fourn_id).'&search_label='.urlencode($search_label).'&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty).'&salert='.urlencode($salert).'&draftorder='.urlencode($draftorder);
|
||||
$param .= '&search_ref='.urlencode($search_ref);
|
||||
$param .= '&mode='.urlencode($mode);
|
||||
$param .= '&fk_supplier='.urlencode($fk_supplier);
|
||||
$param .= '&fk_entrepot='.urlencode($fk_entrepot);
|
||||
|
||||
$stocklabel = $langs->trans('Stock');
|
||||
$stocklabelbis = $langs->trans('Stock');
|
||||
@ -651,6 +636,8 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entre
|
||||
}
|
||||
$texte = $langs->trans('Replenishment');
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
|
||||
if (!empty($conf->global->REPLENISH_ALLOW_VARIABLESIZELIST)) {
|
||||
@ -664,7 +651,7 @@ if (!empty($conf->global->REPLENISH_ALLOW_VARIABLESIZELIST)) {
|
||||
'',
|
||||
$num,
|
||||
$nbtotalofrecords,
|
||||
'object_stock.png',
|
||||
'',
|
||||
0,
|
||||
'',
|
||||
'',
|
||||
@ -681,7 +668,7 @@ if (!empty($conf->global->REPLENISH_ALLOW_VARIABLESIZELIST)) {
|
||||
'',
|
||||
$num,
|
||||
$nbtotalofrecords,
|
||||
'object_stock.png'
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
@ -830,67 +817,64 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
||||
$picto = img_picto($langs->trans("NoPendingReceptionOnSupplierOrder"), 'help');
|
||||
}
|
||||
|
||||
$variants = $prod->hasVariants();
|
||||
if (!$variants || !empty($conf->global->VARIANT_ALLOW_STOCK_MOVEMENT_ON_VARIANT_PARENT)) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Select field
|
||||
print '<td><input type="checkbox" class="check" name="choose'.$i.'"></td>';
|
||||
// Select field
|
||||
print '<td><input type="checkbox" class="check" name="choose'.$i.'"></td>';
|
||||
|
||||
print '<td class="nowrap">'.$prod->getNomUrl(1, 'stock').'</td>';
|
||||
print '<td class="nowrap">'.$prod->getNomUrl(1, 'stock').'</td>';
|
||||
|
||||
print '<td>'.$objp->label;
|
||||
print '<input type="hidden" name="desc'.$i.'" value="'.dol_escape_htmltag($objp->description).'">'; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST
|
||||
print '</td>';
|
||||
print '<td>'.$objp->label;
|
||||
print '<input type="hidden" name="desc'.$i.'" value="'.dol_escape_htmltag($objp->description).'">'; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST
|
||||
print '</td>';
|
||||
|
||||
if (!empty($conf->service->enabled) && $type == 1)
|
||||
{
|
||||
$regs = array();
|
||||
if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) {
|
||||
$duration = $regs[1].' '.$langs->trans('DurationYear');
|
||||
} elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) {
|
||||
$duration = $regs[1].' '.$langs->trans('DurationMonth');
|
||||
} elseif (preg_match('/([0-9]+)d/i', $objp->duration, $regs)) {
|
||||
$duration = $regs[1].' '.$langs->trans('DurationDay');
|
||||
} else {
|
||||
$duration = $objp->duration;
|
||||
}
|
||||
print '<td class="center">'.$duration.'</td>';
|
||||
if (!empty($conf->service->enabled) && $type == 1)
|
||||
{
|
||||
$regs = array();
|
||||
if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) {
|
||||
$duration = $regs[1].' '.$langs->trans('DurationYear');
|
||||
} elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) {
|
||||
$duration = $regs[1].' '.$langs->trans('DurationMonth');
|
||||
} elseif (preg_match('/([0-9]+)d/i', $objp->duration, $regs)) {
|
||||
$duration = $regs[1].' '.$langs->trans('DurationDay');
|
||||
} else {
|
||||
$duration = $objp->duration;
|
||||
}
|
||||
|
||||
// Desired stock
|
||||
print '<td class="right">'.($fk_entrepot > 0 ? $desiredstockwarehouse : $desiredstock).'</td>';
|
||||
|
||||
// Limit stock for alert
|
||||
print '<td class="right">'.($fk_entrepot > 0 ? $alertstockwarehouse : $alertstock).'</td>';
|
||||
|
||||
// Current stock (all warehouses)
|
||||
print '<td class="right">'.$warning.$stock.'</td>';
|
||||
|
||||
// Current stock (warehouse selected only)
|
||||
if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0)
|
||||
{
|
||||
print '<td class="right">'.$warningwarehouse.$stockwarehouse.'</td>';
|
||||
}
|
||||
|
||||
// Already ordered
|
||||
print '<td class="right"><a href="replenishorders.php?search_product='.$prod->id.'">'.$ordered.'</a> '.$picto.'</td>';
|
||||
|
||||
// To order
|
||||
print '<td class="right"><input type="text" size="4" name="tobuy'.$i.'" value="'.($fk_entrepot > 0 ? $stocktobuywarehouse : $stocktobuy).'"></td>';
|
||||
|
||||
// Supplier
|
||||
print '<td class="right">';
|
||||
print $form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier);
|
||||
print '</td>';
|
||||
|
||||
// Fields from hook
|
||||
$parameters = array('objp'=>$objp);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</tr>';
|
||||
print '<td class="center">'.$duration.'</td>';
|
||||
}
|
||||
|
||||
// Desired stock
|
||||
print '<td class="right">'.($fk_entrepot > 0 ? $desiredstockwarehouse : $desiredstock).'</td>';
|
||||
|
||||
// Limit stock for alert
|
||||
print '<td class="right">'.($fk_entrepot > 0 ? $alertstockwarehouse : $alertstock).'</td>';
|
||||
|
||||
// Current stock (all warehouses)
|
||||
print '<td class="right">'.$warning.$stock.'</td>';
|
||||
|
||||
// Current stock (warehouse selected only)
|
||||
if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0)
|
||||
{
|
||||
print '<td class="right">'.$warningwarehouse.$stockwarehouse.'</td>';
|
||||
}
|
||||
|
||||
// Already ordered
|
||||
print '<td class="right"><a href="replenishorders.php?search_product='.$prod->id.'">'.$ordered.'</a> '.$picto.'</td>';
|
||||
|
||||
// To order
|
||||
print '<td class="right"><input type="text" size="4" name="tobuy'.$i.'" value="'.($fk_entrepot > 0 ? $stocktobuywarehouse : $stocktobuy).'"></td>';
|
||||
|
||||
// Supplier
|
||||
print '<td class="right">';
|
||||
print $form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier);
|
||||
print '</td>';
|
||||
|
||||
// Fields from hook
|
||||
$parameters = array('objp'=>$objp);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user