commit
cdd2815d45
@ -6,6 +6,7 @@
|
|||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2014 Christophe Battarel <contact@altairis.fr>
|
* Copyright (C) 2014 Christophe Battarel <contact@altairis.fr>
|
||||||
|
* Copyright (C) 2014 Cédric Gross <c.gross@kreiz-it.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -65,7 +66,7 @@ class modProduct extends DolibarrModules
|
|||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
$this->depends = array();
|
$this->depends = array();
|
||||||
$this->requiredby = array("modStock","modBarcode");
|
$this->requiredby = array("modStock","modBarcode","modProductBatch");
|
||||||
|
|
||||||
// Config pages
|
// Config pages
|
||||||
$this->config_page_url = array("product.php@product");
|
$this->config_page_url = array("product.php@product");
|
||||||
|
|||||||
137
htdocs/core/modules/modProductBatch.class.php
Normal file
137
htdocs/core/modules/modProductBatch.class.php
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2013-2014 Cedric GROSS <c.gross@kreiz-it.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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \defgroup productbatch Module batch number management
|
||||||
|
* \brief Management module for batch number, eat-by and sell-by date for product
|
||||||
|
* \file htdocs/core/modules/modProductBatch.class.php
|
||||||
|
* \ingroup productbatch
|
||||||
|
* \brief Description and activation file for module productbatch
|
||||||
|
*/
|
||||||
|
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description and activation class for module productdluo
|
||||||
|
*/
|
||||||
|
class modProductBatch extends DolibarrModules
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor. Define names, constants, directories, boxes, permissions
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
*/
|
||||||
|
function __construct($db)
|
||||||
|
{
|
||||||
|
global $langs,$conf;
|
||||||
|
|
||||||
|
$this->db = $db;
|
||||||
|
$this->numero = 150010;
|
||||||
|
|
||||||
|
$this->family = "products";
|
||||||
|
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||||
|
$this->description = "Batch number, eat-by and sell-by date management module";
|
||||||
|
|
||||||
|
$this->rights_class = 'stock';
|
||||||
|
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||||
|
$this->version = 'experimental';
|
||||||
|
// Key used in llx_const table to save module status enabled/disabled (where dluo is value of property name of module in uppercase)
|
||||||
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||||
|
$this->special = 0;
|
||||||
|
|
||||||
|
$this->picto='stock';
|
||||||
|
|
||||||
|
$this->module_parts = array();
|
||||||
|
|
||||||
|
// Data directories to create when module is enabled.
|
||||||
|
$this->dirs = array();
|
||||||
|
|
||||||
|
// Config pages. Put here list of php page, stored into productdluo/admin directory, to use to setup module.
|
||||||
|
$this->config_page_url = array();
|
||||||
|
|
||||||
|
// Dependencies
|
||||||
|
$this->depends = array("modProduct","modStock"); // List of modules id that must be enabled if this module is enabled
|
||||||
|
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
||||||
|
$this->phpmin = array(5,0); // Minimum version of PHP required by module
|
||||||
|
$this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module
|
||||||
|
$this->langfiles = array("productbatch");
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
$this->const = array();
|
||||||
|
|
||||||
|
$this->tabs = array();
|
||||||
|
|
||||||
|
// Dictionnaries
|
||||||
|
if (! isset($conf->productbatch->enabled))
|
||||||
|
{
|
||||||
|
$conf->productbatch=new stdClass();
|
||||||
|
$conf->productbatch->enabled=0;
|
||||||
|
}
|
||||||
|
$this->dictionnaries=array();
|
||||||
|
|
||||||
|
// Boxes
|
||||||
|
$this->boxes = array(); // List of boxes
|
||||||
|
|
||||||
|
// Permissions
|
||||||
|
$this->rights = array(); // Permission array used by this module
|
||||||
|
$r=0;
|
||||||
|
|
||||||
|
// Main menu entries
|
||||||
|
$this->menu = array(); // List of menus to add
|
||||||
|
$r=0;
|
||||||
|
|
||||||
|
// Exports
|
||||||
|
$r=0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function called when module is enabled.
|
||||||
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
|
* It also creates data directories
|
||||||
|
*
|
||||||
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
|
* @return int 1 if OK, 0 if KO
|
||||||
|
*/
|
||||||
|
function init($options='')
|
||||||
|
{
|
||||||
|
$sql = array();
|
||||||
|
|
||||||
|
return $this->_init($sql, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function called when module is disabled.
|
||||||
|
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||||
|
* Data directories are not deleted
|
||||||
|
*
|
||||||
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
|
* @return int 1 if OK, 0 if KO
|
||||||
|
*/
|
||||||
|
function remove($options='')
|
||||||
|
{
|
||||||
|
$sql = array();
|
||||||
|
|
||||||
|
return $this->_remove($sql, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@ -66,7 +66,7 @@ class modStock extends DolibarrModules
|
|||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
$this->depends = array("modProduct");
|
$this->depends = array("modProduct");
|
||||||
$this->requiredby = array();
|
$this->requiredby = array("modProductBatch");
|
||||||
$this->langfiles = array("stocks");
|
$this->langfiles = array("stocks");
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
|
|||||||
@ -50,6 +50,7 @@ create table llx_product
|
|||||||
fk_user_author integer,
|
fk_user_author integer,
|
||||||
tosell tinyint DEFAULT 1,
|
tosell tinyint DEFAULT 1,
|
||||||
tobuy tinyint DEFAULT 1,
|
tobuy tinyint DEFAULT 1,
|
||||||
|
tobatch tinyint DEFAULT 0 NOT NULL,
|
||||||
fk_product_type integer DEFAULT 0, -- Type 0 for regular product, 1 for service, 9 for other (used by external module)
|
fk_product_type integer DEFAULT 0, -- Type 0 for regular product, 1 for service, 9 for other (used by external module)
|
||||||
duration varchar(6),
|
duration varchar(6),
|
||||||
seuil_stock_alerte integer DEFAULT 0,
|
seuil_stock_alerte integer DEFAULT 0,
|
||||||
|
|||||||
@ -518,6 +518,8 @@ Module59000Name=Margins
|
|||||||
Module59000Desc=Module to manage margins
|
Module59000Desc=Module to manage margins
|
||||||
Module60000Name=Commissions
|
Module60000Name=Commissions
|
||||||
Module60000Desc=Module to manage commissions
|
Module60000Desc=Module to manage commissions
|
||||||
|
Module150010Name=Batch number, eat-by date and sell-by date
|
||||||
|
Module150010Desc=batch number, eat-by date and sell-by date management for product
|
||||||
Permission11=Read customer invoices
|
Permission11=Read customer invoices
|
||||||
Permission12=Create/modify customer invoices
|
Permission12=Create/modify customer invoices
|
||||||
Permission13=Unvalidate customer invoices
|
Permission13=Unvalidate customer invoices
|
||||||
|
|||||||
7
htdocs/langs/en_US/productbatch.lang
Normal file
7
htdocs/langs/en_US/productbatch.lang
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# ProductBATCH language file - en_US - ProductBATCH
|
||||||
|
CHARSET= UTF-8
|
||||||
|
ProductStatusOnBatch= Managed
|
||||||
|
ProductStatusNotOnBatch= Not Managed
|
||||||
|
ProductStatusOnBatchShort= Managed
|
||||||
|
ProductStatusNotOnBatchShort= Not Managed
|
||||||
|
Batch=Batch
|
||||||
@ -510,6 +510,8 @@ Module59000Name=Marges
|
|||||||
Module59000Desc=Module pour gérer les marges
|
Module59000Desc=Module pour gérer les marges
|
||||||
Module60000Name=Commissions
|
Module60000Name=Commissions
|
||||||
Module60000Desc=Module pour gérer les commissions
|
Module60000Desc=Module pour gérer les commissions
|
||||||
|
Module150010Name=Numéro de lot, DLC, DLUO
|
||||||
|
Module150010Desc=Gestion des numéros de lot, DLC et DLUO pour les produits stockés
|
||||||
Permission11=Consulter les factures clients
|
Permission11=Consulter les factures clients
|
||||||
Permission12=Créer/modifier les factures clients
|
Permission12=Créer/modifier les factures clients
|
||||||
Permission13=Dé-valider les factures clients
|
Permission13=Dé-valider les factures clients
|
||||||
|
|||||||
7
htdocs/langs/fr_FR/productbatch.lang
Normal file
7
htdocs/langs/fr_FR/productbatch.lang
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# ProductBATCH language file - fr_FR - ProductBATCH
|
||||||
|
CHARSET= UTF-8
|
||||||
|
ProductStatusOnBatch= Gérer
|
||||||
|
ProductStatusNotOnBatch= Non gérer
|
||||||
|
ProductStatusOnBatchShort= Gérer
|
||||||
|
ProductStatusNotOnBatchShort= Non gérer
|
||||||
|
Batch=Lot
|
||||||
@ -5,7 +5,7 @@
|
|||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2007-2011 Jean Heimburger <jean@tiaris.info>
|
* Copyright (C) 2007-2011 Jean Heimburger <jean@tiaris.info>
|
||||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
|
* Copyright (C) 2013-2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||||
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||||
*
|
*
|
||||||
@ -96,6 +96,8 @@ class Product extends CommonObject
|
|||||||
var $status_buy;
|
var $status_buy;
|
||||||
// Statut indique si le produit est un produit fini '1' ou une matiere premiere '0'
|
// Statut indique si le produit est un produit fini '1' ou une matiere premiere '0'
|
||||||
var $finished;
|
var $finished;
|
||||||
|
// We must manage batch number, sell-by date and so on : '1':yes '0':no
|
||||||
|
var $status_batch;
|
||||||
|
|
||||||
var $customcode; // Customs code
|
var $customcode; // Customs code
|
||||||
var $country_id; // Country origin id
|
var $country_id; // Country origin id
|
||||||
@ -169,6 +171,7 @@ class Product extends CommonObject
|
|||||||
$this->seuil_stock_alerte = 0;
|
$this->seuil_stock_alerte = 0;
|
||||||
$this->desiredstock = 0;
|
$this->desiredstock = 0;
|
||||||
$this->canvas = '';
|
$this->canvas = '';
|
||||||
|
$this->status_batch=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -337,6 +340,7 @@ class Product extends CommonObject
|
|||||||
$sql.= ", accountancy_code_sell";
|
$sql.= ", accountancy_code_sell";
|
||||||
$sql.= ", canvas";
|
$sql.= ", canvas";
|
||||||
$sql.= ", finished";
|
$sql.= ", finished";
|
||||||
|
$sql.= ", tobatch";
|
||||||
$sql.= ") VALUES (";
|
$sql.= ") VALUES (";
|
||||||
$sql.= "'".$this->db->idate($now)."'";
|
$sql.= "'".$this->db->idate($now)."'";
|
||||||
$sql.= ", ".$conf->entity;
|
$sql.= ", ".$conf->entity;
|
||||||
@ -356,6 +360,7 @@ class Product extends CommonObject
|
|||||||
$sql.= ", '".$this->accountancy_code_sell."'";
|
$sql.= ", '".$this->accountancy_code_sell."'";
|
||||||
$sql.= ", '".$this->canvas."'";
|
$sql.= ", '".$this->canvas."'";
|
||||||
$sql.= ", ".((! isset($this->finished) || $this->finished < 0 || $this->finished == '') ? 'null' : $this->finished);
|
$sql.= ", ".((! isset($this->finished) || $this->finished < 0 || $this->finished == '') ? 'null' : $this->finished);
|
||||||
|
$sql.= ", ".((empty($this->status_batch) || $this->status_batch < 0)? '0':$this->status_batch);
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::Create sql=".$sql);
|
dol_syslog(get_class($this)."::Create sql=".$sql);
|
||||||
@ -592,6 +597,7 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
$sql.= ", tosell = " . $this->status;
|
$sql.= ", tosell = " . $this->status;
|
||||||
$sql.= ", tobuy = " . $this->status_buy;
|
$sql.= ", tobuy = " . $this->status_buy;
|
||||||
|
$sql.= ", tobatch = " . ((empty($this->status_batch) || $this->status_batch < 0) ? '0' : $this->status_batch);
|
||||||
$sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : $this->finished);
|
$sql.= ", finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : $this->finished);
|
||||||
$sql.= ", weight = " . ($this->weight!='' ? "'".$this->weight."'" : 'null');
|
$sql.= ", weight = " . ($this->weight!='' ? "'".$this->weight."'" : 'null');
|
||||||
$sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->weight_units."'": 'null');
|
$sql.= ", weight_units = " . ($this->weight_units!='' ? "'".$this->weight_units."'": 'null');
|
||||||
@ -1275,7 +1281,7 @@ class Product extends CommonObject
|
|||||||
$sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas,";
|
$sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas,";
|
||||||
$sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,";
|
$sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,";
|
||||||
$sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,";
|
$sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,";
|
||||||
$sql.= " datec, tms, import_key, entity, desiredstock";
|
$sql.= " datec, tms, import_key, entity, desiredstock, tobatch";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||||
if ($id) $sql.= " WHERE rowid = ".$this->db->escape($id);
|
if ($id) $sql.= " WHERE rowid = ".$this->db->escape($id);
|
||||||
else
|
else
|
||||||
@ -1303,6 +1309,7 @@ class Product extends CommonObject
|
|||||||
$this->type = $obj->fk_product_type;
|
$this->type = $obj->fk_product_type;
|
||||||
$this->status = $obj->tosell;
|
$this->status = $obj->tosell;
|
||||||
$this->status_buy = $obj->tobuy;
|
$this->status_buy = $obj->tobuy;
|
||||||
|
$this->status_batch = $obj->tobatch;
|
||||||
|
|
||||||
$this->customcode = $obj->customcode;
|
$this->customcode = $obj->customcode;
|
||||||
$this->country_id = $obj->fk_country;
|
$this->country_id = $obj->fk_country;
|
||||||
@ -2631,15 +2638,23 @@ class Product extends CommonObject
|
|||||||
* Return label of status of object
|
* Return label of status of object
|
||||||
*
|
*
|
||||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||||
* @param int $type 0=Shell, 1=Buy
|
* @param int $type 0=Sell, 1=Buy, 2=Batch Number management
|
||||||
* @return string Label of status
|
* @return string Label of status
|
||||||
*/
|
*/
|
||||||
function getLibStatut($mode=0, $type=0)
|
function getLibStatut($mode=0, $type=0)
|
||||||
{
|
{
|
||||||
if($type==0)
|
switch ($type)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
return $this->LibStatut($this->status,$mode,$type);
|
return $this->LibStatut($this->status,$mode,$type);
|
||||||
else
|
case 1:
|
||||||
return $this->LibStatut($this->status_buy,$mode,$type);
|
return $this->LibStatut($this->status_buy,$mode,$type);
|
||||||
|
case 2:
|
||||||
|
return $this->LibStatut($this->status_batch,$mode,$type);
|
||||||
|
default:
|
||||||
|
//Simulate previous behavior but should return an error string
|
||||||
|
return $this->LibStatut($this->status_buy,$mode,$type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2647,14 +2662,42 @@ class Product extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $status Statut
|
* @param int $status Statut
|
||||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||||
* @param int $type 0=Status "to sell", 1=Status "to buy"
|
* @param int $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
|
||||||
* @return string Label of status
|
* @return string Label of status
|
||||||
*/
|
*/
|
||||||
function LibStatut($status,$mode=0,$type=0)
|
function LibStatut($status,$mode=0,$type=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load('products');
|
$langs->load('products');
|
||||||
|
if ($conf->productbatch->enabled) $langs->load("productbatch");
|
||||||
|
|
||||||
|
if ($type == 2)
|
||||||
|
{
|
||||||
|
switch ($mode)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return ($status == 0 ? $langs->trans('ProductStatusNotOnBatch') : $langs->trans('ProductStatusOnBatch'));
|
||||||
|
case 1:
|
||||||
|
return ($status == 0 ? $langs->trans('ProductStatusNotOnBatchShort') : $langs->trans('ProductStatusOnBatchShort'));
|
||||||
|
case 2:
|
||||||
|
return $this->LibStatut($status,3,2).' '.$this->LibStatut($status,1,2);
|
||||||
|
case 3:
|
||||||
|
if ($status == 0 )
|
||||||
|
{
|
||||||
|
return img_picto($langs->trans('ProductStatusNotOnBatch'),'statut5');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return img_picto($langs->trans('ProductStatusOnBatch'),'statut4');
|
||||||
|
}
|
||||||
|
case 4:
|
||||||
|
return $this->LibStatut($status,3,2).' '.$this->LibStatut($status,0,2);
|
||||||
|
case 5:
|
||||||
|
return $this->LibStatut($status,1,2).' '.$this->LibStatut($status,3,2);
|
||||||
|
default:
|
||||||
|
return $langs->trans('Unknown');
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($mode == 0)
|
if ($mode == 0)
|
||||||
{
|
{
|
||||||
if ($status == 0) return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort'));
|
if ($status == 0) return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort'));
|
||||||
@ -3261,10 +3304,21 @@ class Product extends CommonObject
|
|||||||
$this->country_id=1;
|
$this->country_id=1;
|
||||||
$this->tosell=1;
|
$this->tosell=1;
|
||||||
$this->tobuy=1;
|
$this->tobuy=1;
|
||||||
|
$this->tobatch=0;
|
||||||
$this->type=0;
|
$this->type=0;
|
||||||
$this->note='This is a comment (private)';
|
$this->note='This is a comment (private)';
|
||||||
|
|
||||||
$this->barcode=-1; // Create barcode automatically
|
$this->barcode=-1; // Create barcode automatically
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return if object has a sell-by date or eat-by date
|
||||||
|
*
|
||||||
|
* @return boolean True if it's has
|
||||||
|
*/
|
||||||
|
function hasbatch()
|
||||||
|
{
|
||||||
|
return ($this->status_batch == 1 ? true : false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||||
|
* Copyright (C) 2014 Cédric Gross <c.gross@kreiz-it.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -45,6 +46,7 @@ $langs->load("products");
|
|||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
if (! empty($conf->stock->enabled)) $langs->load("stocks");
|
if (! empty($conf->stock->enabled)) $langs->load("stocks");
|
||||||
if (! empty($conf->facture->enabled)) $langs->load("bills");
|
if (! empty($conf->facture->enabled)) $langs->load("bills");
|
||||||
|
if ($conf->productbatch->enabled) $langs->load("productbatch");
|
||||||
|
|
||||||
$mesg=''; $error=0; $errors=array(); $_error=0;
|
$mesg=''; $error=0; $errors=array(); $_error=0;
|
||||||
|
|
||||||
@ -197,6 +199,7 @@ if (empty($reshook))
|
|||||||
$object->type = $type;
|
$object->type = $type;
|
||||||
$object->status = GETPOST('statut');
|
$object->status = GETPOST('statut');
|
||||||
$object->status_buy = GETPOST('statut_buy');
|
$object->status_buy = GETPOST('statut_buy');
|
||||||
|
$object->status_batch = GETPOST('status_batch');
|
||||||
|
|
||||||
$object->barcode_type = GETPOST('fk_barcode_type');
|
$object->barcode_type = GETPOST('fk_barcode_type');
|
||||||
$object->barcode = GETPOST('barcode');
|
$object->barcode = GETPOST('barcode');
|
||||||
@ -280,6 +283,7 @@ if (empty($reshook))
|
|||||||
$object->country_id = GETPOST('country_id');
|
$object->country_id = GETPOST('country_id');
|
||||||
$object->status = GETPOST('statut');
|
$object->status = GETPOST('statut');
|
||||||
$object->status_buy = GETPOST('statut_buy');
|
$object->status_buy = GETPOST('statut_buy');
|
||||||
|
$object->status_batch = GETPOST('status_batch');
|
||||||
$object->seuil_stock_alerte = GETPOST('seuil_stock_alerte');
|
$object->seuil_stock_alerte = GETPOST('seuil_stock_alerte');
|
||||||
$object->desiredstock = GETPOST('desiredstock');
|
$object->desiredstock = GETPOST('desiredstock');
|
||||||
$object->duration_value = GETPOST('duration_value');
|
$object->duration_value = GETPOST('duration_value');
|
||||||
@ -763,9 +767,18 @@ else
|
|||||||
// To buy
|
// To buy
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td colspan="3">';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td colspan="3">';
|
||||||
$statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
|
$statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
|
||||||
print $form->selectarray('statut_buy',$statutarray,GETPOST('statut_buy"'));
|
print $form->selectarray('statut_buy',$statutarray,GETPOST('statut_buy'));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// batch number management
|
||||||
|
if ($conf->productbatch->enabled) {
|
||||||
|
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Batch").')</td><td colspan="3">';
|
||||||
|
$statutarray=array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"));
|
||||||
|
print $form->selectarray('status_batch',$statutarray,GETPOST('status_batch'));
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$showbarcode=(! empty($conf->barcode->enabled) && $user->rights->barcode->lire);
|
$showbarcode=(! empty($conf->barcode->enabled) && $user->rights->barcode->lire);
|
||||||
|
|
||||||
if ($showbarcode)
|
if ($showbarcode)
|
||||||
@ -1009,6 +1022,14 @@ else
|
|||||||
print '</select>';
|
print '</select>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Batch number managment
|
||||||
|
if ($conf->productbatch->enabled) {
|
||||||
|
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Lot").')</td><td colspan="2">';
|
||||||
|
$statutarray=array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"));
|
||||||
|
print $form->selectarray('status_batch',$statutarray,$object->status_batch);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Barcode
|
// Barcode
|
||||||
$showbarcode=(! empty($conf->barcode->enabled) && $user->rights->barcode->lire);
|
$showbarcode=(! empty($conf->barcode->enabled) && $user->rights->barcode->lire);
|
||||||
|
|
||||||
@ -1291,6 +1312,13 @@ else
|
|||||||
print $object->getLibStatut(2,1);
|
print $object->getLibStatut(2,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Batch number management (to batch)
|
||||||
|
if ($conf->productbatch->enabled) {
|
||||||
|
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Lot").')</td><td colspan="2">';
|
||||||
|
print $object->getLibStatut(2,2);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">'.(dol_textishtml($object->description)?$object->description:dol_nl2br($object->description,1,true)).'</td></tr>';
|
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">'.(dol_textishtml($object->description)?$object->description:dol_nl2br($object->description,1,true)).'</td></tr>';
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user