From 38da331a8bff996a94f1a938f494eff6e9edaef0 Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Thu, 3 Sep 2020 10:41:42 +0200 Subject: [PATCH] Show number and clickable on warehouse area --- htdocs/product/stock/index.php | 117 ++++++++++++++++++--------------- 1 file changed, 64 insertions(+), 53 deletions(-) diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index fc43d5e8ce3..f144fe38a75 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -1,8 +1,9 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2019 Nicolas ZABOURI +/* Copyright (C) 2003-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2019 Nicolas ZABOURI + * Copyright (C) 2020 Tobias Sekan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,9 +20,9 @@ */ /** - * \file htdocs/product/stock/index.php - * \ingroup stock - * \brief Home page of stock area + * \file htdocs/product/stock/index.php + * \ingroup stock + * \brief Home page of stock area */ require '../../main.inc.php'; @@ -60,22 +61,22 @@ print '
'; if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo { - print '
'; - print ''; - print '
'; - print ''; - print ""; - print ''; - print ''; - print "
'.$langs->trans("Search").'
'; - print $langs->trans("Warehouse").':

"; + print '
'; + print ''; + print '
'; + print ''; + print ""; + print ''; + print ''; + print "
'.$langs->trans("Search").'
'; + print $langs->trans("Warehouse").':

"; } $max = 15; $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 (0,1)"; +$sql .= " WHERE e.statut in (".Entrepot::STATUS_CLOSED.",".Entrepot::STATUS_OPEN_ALL.")"; $sql .= " AND e.entity IN (".getEntity('stock').")"; $sql .= $db->order('e.statut', 'DESC'); $sql .= $db->plimit($max + 1, 0); @@ -84,45 +85,55 @@ $result = $db->query($sql); if ($result) { - $num = $db->num_rows($result); + $num = $db->num_rows($result); - $i = 0; + print '
'; + print ''; + print ''; + print ''; + print ''; - print '
'; - print '
'; + print $langs->trans("Warehouses").' '; + print ''; + // TODO: "search_status" on "/product/stock/list.php" currently only accept a single integer value + //print ''; + print ''.$num.''; + print ''; + print '
'; - print ''; + $i = 0; + if ($num) + { + while ($i < min($max, $num)) + { + $objp = $db->fetch_object($result); - 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; - $warehouse->id = $objp->rowid; - $warehouse->statut = $objp->status; - $warehouse->label = $objp->label; - $warehouse->lieu = $objp->lieu; + print ''; + print ''."\n"; + print ''; + print "\n"; + $i++; + } + $db->free($result); + } else { + print ''; + } + if ($num > $max) { + print ''; + } - print ''; - print ''."\n"; - print ''; - print "\n"; - $i++; - } - $db->free($result); - } - if ($num > $max) { - print ''; - } - - print "
'.$langs->trans("Warehouses").'
'; + print $warehouse->getNomUrl(1); + print ''; + print $warehouse->getLibStatut(5); + print '
'.$langs->trans("None").'
'.$langs->trans("More").'...
'; - print $warehouse->getNomUrl(1); - print ''; - print $warehouse->getLibStatut(5); - print '
'.$langs->trans("More").'...
"; - print '
'; + print ""; + print '
'; } else { - dol_print_error($db); + dol_print_error($db); } @@ -141,7 +152,7 @@ $sql .= ", ".MAIN_DB_PREFIX."product as p"; $sql .= " WHERE m.fk_product = p.rowid"; $sql .= " AND m.fk_entrepot = e.rowid"; $sql .= " AND e.entity IN (".getEntity('stock').")"; -if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql .= " AND p.fk_product_type = 0"; +if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql .= " AND p.fk_product_type = ".Product::TYPE_PRODUCT; $sql .= $db->order("datem", "DESC"); $sql .= $db->plimit($max, 0); @@ -151,7 +162,7 @@ if ($resql) { $num = $db->num_rows($resql); - print '
'; + print '
'; print ''; print ""; print ''; @@ -206,7 +217,7 @@ if ($resql) $db->free($resql); print "
'.$langs->trans("LastMovements", min($num, $max)).'
"; - print '
'; + print '
'; } else { dol_print_error($db); }