dolibarr  16.0.5
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@inodbox.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 <https://www.gnu.org/licenses/>.
19  */
20 
28 include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
29 
30 
35 {
41  public 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 
60  $this->picto = 'lot';
61 
62  $this->module_parts = array();
63 
64  // Data directories to create when module is enabled.
65  $this->dirs = array();
66 
67  // Config pages. Put here list of php page, stored into productdluo/admin directory, to use to setup module.
68  $this->config_page_url = array("product_lot.php@product");
69 
70  // Dependencies
71  $this->hidden = false; // A condition to hide module
72  $this->depends = array("modProduct", "modStock", "modExpedition", "modFournisseur"); // List of module class names as string that must be enabled if this module is enabled
73  $this->requiredby = array(); // List of module ids to disable if this one is disabled
74  $this->conflictwith = array(); // List of module class names as string this module is in conflict with
75  $this->phpmin = array(5, 6); // Minimum version of PHP required by module
76  $this->need_dolibarr_version = array(3, 0); // Minimum version of Dolibarr required by module
77  $this->langfiles = array("productbatch");
78 
79  // Constants
80  // Constants
81  $this->const = array();
82  $r = 0;
83 
84  $this->const[$r][0] = "PRODUCTBATCH_LOT_ADDON";
85  $this->const[$r][1] = "chaine";
86  $this->const[$r][2] = "mod_lot_free";
87  $this->const[$r][3] = 'Module to control lot number';
88  $this->const[$r][4] = 0;
89  $r++;
90 
91  $this->const[$r][0] = "PRODUCTBATCH_SN_ADDON";
92  $this->const[$r][1] = "chaine";
93  $this->const[$r][2] = "mod_sn_free";
94  $this->const[$r][3] = 'Module to control serial number';
95  $this->const[$r][4] = 0;
96  $r++;
97 
98  $this->tabs = array();
99 
100  // Dictionaries
101  if (!isset($conf->productbatch->enabled)) {
102  $conf->productbatch = new stdClass();
103  $conf->productbatch->enabled = 0;
104  }
105  $this->dictionaries = array();
106 
107  // Boxes
108  $this->boxes = array(); // List of boxes
109 
110  // Permissions
111  $this->rights = array(); // Permission array used by this module
112  $r = 0;
113 
114 
115  // Menus
116  //-------
117  $this->menu = 1; // This module add menu entries. They are coded into menu manager.
118 
119 
120  // Exports
121  $r = 0;
122  }
123 
132  public function init($options = '')
133  {
134  global $db, $conf;
135 
136  $sql = array();
137 
138  if (!empty($conf->cashdesk->enabled)) {
139  if (empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
140  include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
141  $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", 1, 'chaine', 0, '', $conf->entity);
142  }
143  }
144 
145  return $this->_init($sql, $options);
146  }
147 }
db
$conf db
API class for accounts.
Definition: inc.php:41
description
print *****$script_file(".$version.") pid cd cd cd description as description
Definition: email_expire_services_to_customers.php:83
modProductBatch\init
init($options='')
Function called when module is enabled.
Definition: modProductBatch.class.php:132
name
$conf db name
Definition: repair.php:122
modProductBatch\__construct
__construct($db)
Constructor.
Definition: modProductBatch.class.php:41
modProductBatch
Description and activation class for module productdluo.
Definition: modProductBatch.class.php:34
DolibarrModules\_init
_init($array_sql, $options='')
Enables a module.
Definition: DolibarrModules.class.php:383
dolibarr_set_const
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:627
DolibarrModules
Class DolibarrModules.
Definition: DolibarrModules.class.php:37