dolibarr/htdocs/inventory/list.php
2017-04-05 12:25:00 +02:00

104 lines
3.6 KiB
PHP

<?php
/* Copyright (C) 2016 ATM Consulting <support@atm-consulting.fr>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/inventory/inventory.php
* \ingroup product
* \brief File of class to manage inventory
*/
require_once '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/listview.class.php';
require_once DOL_DOCUMENT_ROOT.'/inventory/class/inventory.class.php';
require_once DOL_DOCUMENT_ROOT.'/inventory/lib/inventory.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$langs->load("stock");
$langs->load("inventory");
if (empty($user->rights->inventory->read)) accessforbidden();
llxHeader('',$langs->trans('inventoryListTitle'),'','');
echo '<form name="formListInvetory" action="'.$_SERVER['PHP_SELF'].'" method="post" >';
$inventory = new Inventory($db);
$list = new ListView($db, 'listInventory');
$THide = array('label','title');
echo $list->render(Inventory::getSQL('All'), array(
'limit' => array(
'nbLine' => GETPOST('limit')
),
'allow-field-select' => true,
'link'=>array(
'fk_warehouse'=>'<a href="'.DOL_URL_ROOT.'/product/stock/card.php?id=@val@">'.img_picto('','object_stock.png','',0).' @label@</a>'
),
'translate'=>array(),
'hide'=>$THide,
'type'=>array(
'datec'=>'date',
'tms'=>'datetime',
'date_inventory'=>'date'
),
'list'=>array(
'title'=>$langs->trans('inventoryListTitle'),
'messageNothing'=>$langs->trans('inventoryListEmpty'),
'image' => 'inventory.png@inventory'
),
'title'=>array(
'rowid'=>$langs->trans('Title'),
'date_inventory'=>$langs->trans('InventoryDate'),
'datec'=>$langs->trans('DateCreation'),
'fk_warehouse'=>$langs->trans('Warehouse'),
'tms'=>$langs->trans('DateUpdate'),
'status'=>$langs->trans('Status')
),
'eval'=>array(
'status' => '(@val@ ? img_picto("'.$langs->trans("inventoryValidate").'", "statut4") : img_picto("'.$langs->trans("inventoryDraft").'", "statut3"))',
'rowid'=>'Inventory::getLink(@val@)'
),
'position' => array(
'text-align' => array('status' => 'right')
),
'search'=>array(
'rowid' => array('search_type' => true, 'table' => array('i'), 'field' => array('title')),
'date_inventory'=>array('search_type' => 'calendars', 'table' => array('i'), 'field' => array('date_inventory')),
'status'=>array('search_type' => array(1=>$langs->trans("inventoryValidate"), 0=>$langs->trans("inventoryDraft")))
)
));
/*if (!empty($user->rights->inventory->create))
{
print '<div class="tabsAction">';
print '<a class="butAction" href="inventory.php?action=create">'.$langs->trans('inventoryCreate').'</a>';
print '</div>';
}*/
echo '</form>';
llxFooter('');
$db->close();