29 include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
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 =
"StockTransfer description (Long)";
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);
463 $sql =
"SELECT max(rowid) newid from ".MAIN_DB_PREFIX.
"c_type_contact";
464 $result = $this->
db->query($sql);
466 $obj = $this->
db->fetch_object($result);
467 $newid = ($obj->newid + 1);
483 public function remove($options =
'')
486 return $this->
_remove($sql, $options);
_init($array_sql, $options='')
Enables a module.
_remove($array_sql, $options='')
Disable function.
_load_tables($reldir, $onlywithsuffix='')
Create tables and keys required by module:
Description and activation class for module StockTransfer.
__construct($db)
Constructor.
getNextId()
Returns next available id to insert new roles in llx_c_type_contact.
init($options='')
Function called when module is enabled.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.