46 $langs->load(
'stocks');
51 $this->rights_class =
'stocktransfer';
54 $this->family =
"products";
56 $this->module_position =
'90';
60 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
62 $this->
description = $langs->trans(
"ModuleStockTransferDesc");
64 $this->descriptionlong =
"Advanced management of stock transfer orders with generation of stock transfer sheets";
66 $this->version =
'experimental';
71 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
75 $this->picto =
'stock';
77 $this->module_parts = array(
111 'moduleforexternal' => 0,
116 $this->dirs = array(
"/stocktransfer/temp");
118 $this->config_page_url = array(
"stocktransfer.php");
121 $this->hidden =
false;
123 $this->depends = array(
'modStock',
'modProduct');
124 $this->requiredby = array();
125 $this->conflictwith = array();
126 $this->langfiles = array(
"stocktransfer@stocktransfer");
127 $this->phpmin = array(7, 0);
128 $this->warnings_activation = array();
129 $this->warnings_activation_ext = array();
138 $this->
const = array();
140 if (!isset($conf->stocktransfer) || !isset($conf->stocktransfer->enabled)) {
141 $conf->stocktransfer =
new stdClass();
142 $conf->stocktransfer->enabled = 0;
146 $this->tabs = array();
174 $this->dictionaries = array();
201 $this->boxes = array(
212 $this->cronjobs = array(
234 $this->rights = 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');
257 $this->menu = array();
424 public function init($options =
'')
426 global $conf, $langs;
428 $result = $this->
_load_tables(
'/install/mysql/tables/',
'stocktransfer');
429 if ($result < 0)
return -1;
432 $this->
remove($options);
437 $resql = $this->db->query(
'SELECT rowid FROM '.MAIN_DB_PREFIX.
'c_type_contact WHERE code = "STDEST" AND element = "StockTransfer" AND source = "internal"');
438 $res = $this->db->fetch_object($resql);
440 if (empty($res)) $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", "Responsable du transfert de stocks", 1, NULL, 0)');
442 $resql = $this->db->query(
'SELECT rowid FROM '.MAIN_DB_PREFIX.
'c_type_contact WHERE code = "STFROM" AND element = "StockTransfer" AND source = "external"');
443 $res = $this->db->fetch_object($resql);
445 if (empty($res)) $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 expéditeur transfert de stocks", 1, NULL, 0)');
447 $resql = $this->db->query(
'SELECT rowid FROM '.MAIN_DB_PREFIX.
'c_type_contact WHERE code = "STDEST" AND element = "StockTransfer" AND source = "external"');
448 $res = $this->db->fetch_object($resql);
450 if (empty($res)) $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 destinataire transfert de stocks", 1, NULL, 0)');
452 return $this->
_init($sql, $options);