FIX: Replenish: SQL error when no warehouse has been created + Warning when there are no warehouses
This commit is contained in:
parent
2436f0967b
commit
44eedb8c6e
@ -256,3 +256,4 @@ AutofillWithExpected=Fill real quantity with expected quantity
|
|||||||
ShowAllBatchByDefault=By default, show batch details on product "stock" tab
|
ShowAllBatchByDefault=By default, show batch details on product "stock" tab
|
||||||
CollapseBatchDetailHelp=You can set batch detail default display in stocks module configuration
|
CollapseBatchDetailHelp=You can set batch detail default display in stocks module configuration
|
||||||
FieldCannotBeNegative=Field "%s" cannot be negative
|
FieldCannotBeNegative=Field "%s" cannot be negative
|
||||||
|
ErrorAtLeastOneWarehouseNeededForReplenish= Attention: You need to create at least one warehouse to use the replenish feature.
|
||||||
|
|||||||
@ -358,12 +358,14 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
|
|||||||
$sql .= $hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
|
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product AND s.fk_entrepot IN ('.$db->sanitize($listofqualifiedwarehousesid).')';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product';
|
||||||
|
$list_warehouse = empty($listofqualifiedwarehousesid) ? '0' :$db->sanitize($listofqualifiedwarehousesid);
|
||||||
|
$sql .= ' AND s.fk_entrepot IN ('.$list_warehouse .')';
|
||||||
|
|
||||||
//$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')';
|
//$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')';
|
||||||
if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) {
|
if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) {
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_warehouse_properties AS pse ON (p.rowid = pse.fk_product AND pse.fk_entrepot = '.((int) $fk_entrepot).')';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_warehouse_properties AS pse ON (p.rowid = pse.fk_product AND pse.fk_entrepot = '.((int) $fk_entrepot).')';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListJoin', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListJoin', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
@ -577,6 +579,11 @@ print load_fiche_titre($langs->trans('Replenishment'), '', 'stock');
|
|||||||
print dol_get_fiche_head($head, 'replenish', '', -1, '');
|
print dol_get_fiche_head($head, 'replenish', '', -1, '');
|
||||||
|
|
||||||
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDesc").'</span>'."\n";
|
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDesc").'</span>'."\n";
|
||||||
|
|
||||||
|
|
||||||
|
$link = '<a title=' .$langs->trans("MenuNewWarehouse"). ' href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans("MenuNewWarehouse").'</a>';
|
||||||
|
print info_admin($langs->trans("ErrorAtLeastOneWarehouseNeededForReplenish") .' '. $link, 0, 0, 'info', 'clearboth');
|
||||||
|
|
||||||
if (empty($fk_warhouse) && !empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) {
|
if (empty($fk_warhouse) && !empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) {
|
||||||
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDescPerWarehouse").'</span>'."\n";
|
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDescPerWarehouse").'</span>'."\n";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user