47 $langs->load(
'stocks');
52 $this->rights_class =
'stocktransfer';
55 $this->family =
"products";
57 $this->module_position =
'90';
61 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
63 $this->
description = $langs->trans(
"ModuleStockTransferDesc");
65 $this->descriptionlong =
"Advanced management of stock transfer orders with generation of stock transfer sheets";
67 $this->version =
'experimental';
72 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
76 $this->picto =
'stock';
78 $this->module_parts = array(
112 'moduleforexternal' => 0,
113 'contactelement' => 1
117 $this->dirs = array(
"/stocktransfer/temp");
119 $this->config_page_url = array(
"stocktransfer.php");
122 $this->hidden =
false;
124 $this->depends = array(
'modStock',
'modProduct');
125 $this->requiredby = array();
126 $this->conflictwith = array();
127 $this->langfiles = array(
"stocktransfer@stocktransfer");
128 $this->phpmin = array(7, 0);
129 $this->warnings_activation = array();
130 $this->warnings_activation_ext = array();
139 $this->
const = array();
141 if (!isset($conf->stocktransfer) || !isset($conf->stocktransfer->enabled)) {
142 $conf->stocktransfer =
new stdClass();
143 $conf->stocktransfer->enabled = 0;
147 $this->tabs = array();
175 $this->dictionaries = array();
202 $this->boxes = array(
213 $this->cronjobs = array(
235 $this->rights = array();
239 $this->rights[$r][0] = $this->numero + $r;
240 $this->rights[$r][1] = $langs->trans(
'StockTransferRightRead');
241 $this->rights[$r][4] =
'stocktransfer';
242 $this->rights[$r][5] =
'read';
244 $this->rights[$r][0] = $this->numero + $r;
245 $this->rights[$r][1] = $langs->trans(
'StockTransferRightCreateUpdate');
246 $this->rights[$r][4] =
'stocktransfer';
247 $this->rights[$r][5] =
'write';
249 $this->rights[$r][0] = $this->numero + $r;
250 $this->rights[$r][1] = $langs->trans(
'StockTransferRightDelete');
251 $this->rights[$r][4] =
'stocktransfer';
252 $this->rights[$r][5] =
'delete';
257 $langs->load(
'stocktransfer@stocktransfer');
258 $this->menu = array();
425 public function init($options =
'')
427 global $conf, $langs;
429 $result = $this->
_load_tables(
'/install/mysql/tables/',
'stocktransfer');
435 $this->
remove($options);
440 $resql = $this->db->query(
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"c_type_contact WHERE code = 'STDEST' AND element = 'stocktransfer' AND source = 'internal'");
441 $res = $this->db->fetch_object($resql);
444 $this->db->query(
"INSERT INTO ".MAIN_DB_PREFIX.
"c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES(".((
int) $nextid).
", 'stocktransfer', 'internal', 'STRESP', 'Responsible for stock transfers', 1, NULL, 0)");
447 $resql = $this->db->query(
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"c_type_contact WHERE code = 'STFROM' AND element = 'stocktransfer' AND source = 'external'");
448 $res = $this->db->fetch_object($resql);
451 $this->db->query(
"INSERT INTO ".MAIN_DB_PREFIX.
"c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES(".((
int) $nextid).
", 'stocktransfer', 'external', 'STFROM', 'Contact sending the stock transfer', 1, NULL, 0)");
454 $resql = $this->db->query(
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"c_type_contact WHERE code = 'STDEST' AND element = 'stocktransfer' AND source = 'external'");
455 $res = $this->db->fetch_object($resql);
458 $this->db->query(
"INSERT INTO ".MAIN_DB_PREFIX.
"c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES(".((
int) $nextid).
", 'stocktransfer', 'external', 'STDEST', 'Contact receiving the stock transfer', 1, NULL, 0)");
461 return $this->
_init($sql, $options);