Merge index page of warehouse with product index page
This commit is contained in:
parent
aad893663d
commit
45d46f25ef
6 changed files with 86 additions and 11 deletions
|
|
@ -137,7 +137,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
|||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("propal")', __HANDLER__, 'left', 2903__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/stats/card.php?mainmenu=products&id=all&leftmenu=stats&type=1', 'Statistics', 1, 'main', '$user->hasRight("service","lire")', '', 2, 5, __ENTITY__);
|
||||
|
||||
-- Product - Stocks
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("stock")', __HANDLER__, 'left', 3100__+MAX_llx_menu__, 'products', 'stock', 3__+MAX_llx_menu__, '/product/stock/index.php?mainmenu=products&leftmenu=stock', 'Stock', 0, 'stocks', '$user->rights->stock->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("stock")', __HANDLER__, 'left', 3100__+MAX_llx_menu__, 'products', 'stock', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&leftmenu=stock', 'Stock', 0, 'stocks', '$user->rights->stock->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("stock")', __HANDLER__, 'left', 3101__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/card.php?mainmenu=products&action=create', 'MenuNewWarehouse', 1, 'stocks', '$user->rights->stock->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("stock")', __HANDLER__, 'left', 3102__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/list.php?mainmenu=products', 'List', 1, 'stocks', '$user->rights->stock->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("stock")', __HANDLER__, 'left', 3104__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/movement_list.php?mainmenu=products', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3, __ENTITY__);
|
||||
|
|
|
|||
|
|
@ -2121,7 +2121,7 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
|
|||
// Warehouse
|
||||
if (isModEnabled('stock')) {
|
||||
$langs->load("stocks");
|
||||
$newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->hasRight('stock', 'lire'), '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="paddingright pictofixedwidth"'));
|
||||
$newmenu->add("/product/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->hasRight('stock', 'lire'), '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="paddingright pictofixedwidth"'));
|
||||
$newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->hasRight('stock', 'creer'));
|
||||
$newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->hasRight('stock', 'lire'));
|
||||
$newmenu->add("/product/stock/movement_list.php", $langs->trans("Movements"), 1, $user->hasRight('stock', 'mouvement', 'lire'));
|
||||
|
|
|
|||
|
|
@ -334,3 +334,4 @@ InternalWarehouse=Internal warehouse
|
|||
ExternalWarehouse=External warehouse
|
||||
QtyCurrentlyKnownInStock=The quantity the system think you have in stock. As long as the inventory is not closed, this is a realtime value and it may change if you continue to make stock movement during the inventory (not recommended).
|
||||
QtyInStockWhenInventoryWasValidated=The quantity the system think you had in stock when the inventory was validated (before the stock correction)
|
||||
LatestModifiedWarehouses=Latest %s modified warehouses
|
||||
|
|
|
|||
|
|
@ -85,6 +85,9 @@ $max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT');
|
|||
* View
|
||||
*/
|
||||
|
||||
$producttmp = new Product($db);
|
||||
$warehouse = new Entrepot($db);
|
||||
|
||||
$transAreaType = $langs->trans("ProductsAndServicesArea");
|
||||
|
||||
$helpurl = '';
|
||||
|
|
@ -444,12 +447,75 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr
|
|||
}
|
||||
}
|
||||
|
||||
$latestwarehouse = '';
|
||||
if (isModEnabled('stock')) {
|
||||
$sql = "SELECT e.rowid, e.ref as label, e.lieu, e.statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e";
|
||||
$sql .= " WHERE e.statut in (".Entrepot::STATUS_CLOSED.",".Entrepot::STATUS_OPEN_ALL.")";
|
||||
$sql .= " AND e.entity IN (".getEntity('stock').")";
|
||||
$sql .= $db->order('e.tms', 'DESC');
|
||||
$sql .= $db->plimit($max + 1, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$latestwarehouse .= '<div class="div-table-responsive-no-min">';
|
||||
$latestwarehouse .= '<table class="noborder centpercent">';
|
||||
$latestwarehouse .= '<tr class="liste_titre">';
|
||||
$latestwarehouse .= '<th>';
|
||||
$latestwarehouse .= $langs->trans("LatestModifiedWarehouses", $max);
|
||||
//$latestwarehouse .= '<a href="'.DOL_URL_ROOT.'/product/stock/list.php">';
|
||||
// TODO: "search_status" on "/product/stock/list.php" currently only accept a single integer value
|
||||
//print '<a href="'.DOL_URL_ROOT.'/product/stock/list.php?search_status='.Entrepot::STATUS_CLOSED.','.Entrepot::STATUS_OPEN_ALL.'">';
|
||||
//$latestwarehouse .= '<span class="badge">'.$num.'</span>';
|
||||
$latestwarehouse .= '</th><th class="right">';
|
||||
$latestwarehouse .= '<a href="'.DOL_URL_ROOT.'/product/stock/list.php?sortfield=p.tms&sortorder=DESC">';
|
||||
$latestwarehouse .= img_picto($langs->trans("FullList"), 'stock');
|
||||
$latestwarehouse .= '</a>';
|
||||
$latestwarehouse .= '</th>';
|
||||
$latestwarehouse .= '</tr>';
|
||||
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < min($max, $num)) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$warehouse->id = $objp->rowid;
|
||||
$warehouse->statut = $objp->status;
|
||||
$warehouse->label = $objp->label;
|
||||
$warehouse->lieu = $objp->lieu;
|
||||
|
||||
$latestwarehouse .= '<tr class="oddeven">';
|
||||
$latestwarehouse .= '<td>';
|
||||
$latestwarehouse .= $warehouse->getNomUrl(1);
|
||||
$latestwarehouse .= '</td>'."\n";
|
||||
$latestwarehouse .= '<td class="right">';
|
||||
$latestwarehouse .= $warehouse->getLibStatut(5);
|
||||
$latestwarehouse .= '</td>';
|
||||
$latestwarehouse .= "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
} else {
|
||||
$latestwarehouse .= '<tr><td>'.$langs->trans("None").'</td><td></td></tr>';
|
||||
}
|
||||
/*if ($num > $max) {
|
||||
$latestwarehouse .= '<tr><td><span class="opacitymedium">'.$langs->trans("More").'...</span></td><td></td></tr>';
|
||||
}*/
|
||||
|
||||
$latestwarehouse .= "</table>";
|
||||
$latestwarehouse .= '</div>';
|
||||
$latestwarehouse .= '<br>';
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$latestmovement = '';
|
||||
if (isModEnabled('product')) {
|
||||
$producttmp = new Product($db);
|
||||
$warehouse = new Entrepot($db);
|
||||
|
||||
// Latest movements
|
||||
$sql = "SELECT p.rowid, p.label as produit, p.tobatch, p.tosell, p.tobuy,";
|
||||
$sql .= " e.ref as warehouse_ref, e.rowid as warehouse_id, e.ref as warehouse_label, e.lieu, e.statut as warehouse_status,";
|
||||
|
|
@ -527,10 +593,16 @@ if (isModEnabled('product')) {
|
|||
$latestmovement .= $warehouse->getNomUrl(1);
|
||||
$latestmovement .= "</td>\n";
|
||||
$latestmovement .= '<td class="right">';
|
||||
if ($objp->qty < 0) {
|
||||
$latestmovement .= '<span class="stockmovementexit">';
|
||||
}
|
||||
if ($objp->qty > 0) {
|
||||
$latestmovement .= '<span class="stockmovemententry">';
|
||||
$latestmovement .= '+';
|
||||
}
|
||||
$latestmovement .= $objp->qty.'</td>';
|
||||
$latestmovement .= $objp->qty;
|
||||
$latestmovement .= '</span>';
|
||||
$latestmovement .= '</td>';
|
||||
$latestmovement .= "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
|
@ -538,6 +610,7 @@ if (isModEnabled('product')) {
|
|||
|
||||
$latestmovement .= "</table>";
|
||||
$latestmovement .= '</div>';
|
||||
$latestmovement .= '<br>';
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
|
@ -575,6 +648,7 @@ $boxlist .= "</div>\n";
|
|||
|
||||
$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
|
||||
$boxlist .= $lastmodified;
|
||||
$boxlist .= $latestwarehouse;
|
||||
$boxlist .= $latestmovement;
|
||||
$boxlist .= $resultboxes['boxlistb'];
|
||||
$boxlist .= '</div>'."\n";
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ if ($action == 'createmovements' && $user->hasRight('stock', 'mouvement', 'creer
|
|||
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("StockMovementRecorded"), null, 'mesgs');
|
||||
header("Location: ".DOL_URL_ROOT.'/product/stock/index.php'); // Redirect to avoid pb when using back
|
||||
header("Location: ".DOL_URL_ROOT.'/product/stock/list.php'); // Redirect to avoid pb when using back
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hier
|
|||
$id = GETPOSTINT('id');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$msid = GETPOSTINT('msid');
|
||||
$idproduct = GETPOSTINT('idproduct');
|
||||
$product_id = GETPOSTINT("product_id");
|
||||
$idproduct = GETPOST('idproduct', 'intcomma');
|
||||
$product_id = GETPOST("product_id", 'intcomma');
|
||||
$show_files = GETPOSTINT('show_files');
|
||||
|
||||
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
|
|
@ -86,8 +86,8 @@ $search_inventorycode = trim(GETPOST("search_inventorycode"));
|
|||
$search_user = trim(GETPOST("search_user"));
|
||||
$search_batch = trim(GETPOST("search_batch"));
|
||||
$search_qty = trim(GETPOST("search_qty"));
|
||||
$search_type_mouvement = GETPOSTINT('search_type_mouvement');
|
||||
$search_fk_project = GETPOSTINT("search_fk_project");
|
||||
$search_type_mouvement = GETPOST('search_type_mouvement');
|
||||
$search_fk_project = GETPOST("search_fk_project");
|
||||
|
||||
$type = GETPOSTINT("type");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue