dolibarr  7.0.0-beta
modProductBatch.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
5  * Copyright (C) 2013-2014 Cedric GROSS <c.gross@kreiz-it.fr>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
28 include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
29 
30 
35 {
41  function __construct($db)
42  {
43  global $langs,$conf;
44 
45  $this->db = $db;
46  $this->numero = 39000;
47 
48  $this->family = "products";
49  $this->module_position = 45;
50 
51  $this->name = preg_replace('/^mod/i','',get_class($this));
52  $this->description = "Batch number, eat-by and sell-by date management module";
53 
54  $this->rights_class = 'productbatch';
55  // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
56  $this->version = 'dolibarr';
57  // Key used in llx_const table to save module status enabled/disabled (where dluo is value of property name of module in uppercase)
58  $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
59  $this->special = 0;
60 
61  $this->picto='stock';
62 
63  $this->module_parts = array();
64 
65  // Data directories to create when module is enabled.
66  $this->dirs = array();
67 
68  // Config pages. Put here list of php page, stored into productdluo/admin directory, to use to setup module.
69  $this->config_page_url = array("product_lot_extrafields.php@product");
70 
71  // Dependencies
72  $this->depends = array("modProduct","modStock","modExpedition","modFournisseur"); // List of modules id that must be enabled if this module is enabled. modExpedition is required to manage batch exit (by manual stock decrease on shipment), modSupplier to manage batch entry (after supplier order).
73  $this->requiredby = array(); // List of modules id to disable if this one is disabled
74  $this->phpmin = array(5,0); // Minimum version of PHP required by module
75  $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module
76  $this->langfiles = array("productbatch");
77 
78  // Constants
79  $this->const = array();
80 
81  $this->tabs = array();
82 
83  // Dictionaries
84  if (! isset($conf->productbatch->enabled))
85  {
86  $conf->productbatch=new stdClass();
87  $conf->productbatch->enabled=0;
88  }
89  $this->dictionaries=array();
90 
91  // Boxes
92  $this->boxes = array(); // List of boxes
93 
94  // Permissions
95  $this->rights = array(); // Permission array used by this module
96  $r=0;
97 
98 
99  // Menus
100  //-------
101  $this->menu = 1; // This module add menu entries. They are coded into menu manager.
102 
103 
104  // Exports
105  $r=0;
106 
107  }
108 
117  function init($options='')
118  {
119  global $db,$conf;
120 
121  $sql = array();
122 
123  if (! empty($conf->cashdesk->enabled)) {
124  if (empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
125  include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
126  $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity);
127  }
128  }
129 
130  return $this->_init($sql, $options);
131  }
132 }
133 
Class DolibarrModules.
</td >< tdclass="liste_titre"align="right"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow img yes disabled img no img no< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="'.$i.'"'.$disabled.'></td >< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"></td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
Definition: replenish.php:554
__construct($db)
Constructor.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Definition: admin.lib.php:485
init($options='')
Function called when module is enabled.
Description and activation class for module productdluo.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:104
_init($array_sql, $options='')
Enables a module.