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 =
'dolibarr';
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 = [];
126 $this->conflictwith = [];
127 $this->langfiles = array(
"stocktransfer@stocktransfer");
128 $this->phpmin = array(7, 0);
129 $this->warnings_activation = [];
130 $this->warnings_activation_ext = [];
140 if (!isset(
$conf->stocktransfer) || !isset(
$conf->stocktransfer->enabled)) {
142 $conf->stocktransfer->enabled = 0;
174 $this->dictionaries = [];
201 $this->boxes = array(
212 $this->cronjobs = array(
238 $this->rights[$r][0] = $this->numero + $r;
239 $this->rights[$r][1] = $langs->trans(
'StockTransferRightRead');
240 $this->rights[$r][4] =
'stocktransfer';
241 $this->rights[$r][5] =
'read';
243 $this->rights[$r][0] = $this->numero + $r;
244 $this->rights[$r][1] = $langs->trans(
'StockTransferRightCreateUpdate');
245 $this->rights[$r][4] =
'stocktransfer';
246 $this->rights[$r][5] =
'write';
248 $this->rights[$r][0] = $this->numero + $r;
249 $this->rights[$r][1] = $langs->trans(
'StockTransferRightDelete');
250 $this->rights[$r][4] =
'stocktransfer';
251 $this->rights[$r][5] =
'delete';
256 $langs->load(
'stocktransfer@stocktransfer');
424 public function init($options =
'')
426 global
$conf, $langs;
428 $result = $this->
_load_tables(
'/install/mysql/',
'stocktransfer');
434 $this->
remove($options);
439 $resql = $this->db->query(
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"c_type_contact WHERE code = 'STDEST' AND element = 'stocktransfer' AND source = 'internal'");
440 $res = $this->db->fetch_object($resql);
443 $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)");
446 $resql = $this->db->query(
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"c_type_contact WHERE code = 'STFROM' AND element = 'stocktransfer' AND source = 'external'");
447 $res = $this->db->fetch_object($resql);
450 $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)");
453 $resql = $this->db->query(
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"c_type_contact WHERE code = 'STDEST' AND element = 'stocktransfer' AND source = 'external'");
454 $res = $this->db->fetch_object($resql);
457 $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)");
460 return $this->
_init($sql, $options);