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');
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);