30 include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
47 $langs->load(
'stocks');
52 $this->rights_class =
'stocktransfer';
55 $this->family =
"other";
57 $this->module_position =
'90';
61 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
63 $this->
description = $langs->trans(
"ModuleStockTransferDesc");
65 $this->descriptionlong =
"StockTransfer description (Long)";
66 $this->editor_name =
'Editor name';
67 $this->editor_url =
'https://www.example.com';
69 $this->version =
'development';
74 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
78 $this->picto =
'stock';
80 $this->module_parts = array(
114 'moduleforexternal' => 0,
119 $this->dirs = array(
"/stocktransfer/temp");
121 $this->config_page_url = array(
"stocktransfer.php");
124 $this->hidden =
false;
126 $this->depends = array(
'modStock',
'modProduct');
127 $this->requiredby = array();
128 $this->conflictwith = array();
129 $this->langfiles = array(
"stocktransfer@stocktransfer");
130 $this->phpmin = array(5, 5);
131 $this->need_dolibarr_version = array(11, -3);
132 $this->warnings_activation = array();
133 $this->warnings_activation_ext = array();
142 $this->
const = array();
150 if (!isset($conf->stocktransfer) || !isset($conf->stocktransfer->enabled)) {
151 $conf->stocktransfer =
new stdClass();
152 $conf->stocktransfer->enabled = 0;
156 $this->tabs = array();
184 $this->dictionaries = array();
211 $this->boxes = array(
222 $this->cronjobs = array(
244 $this->rights = array();
248 $this->rights[$r][0] = $this->numero + $r;
249 $this->rights[$r][1] = $langs->trans(
'StockTransferRightRead');
250 $this->rights[$r][4] =
'stocktransfer';
251 $this->rights[$r][5] =
'read';
253 $this->rights[$r][0] = $this->numero + $r;
254 $this->rights[$r][1] = $langs->trans(
'StockTransferRightCreateUpdate');
255 $this->rights[$r][4] =
'stocktransfer';
256 $this->rights[$r][5] =
'write';
258 $this->rights[$r][0] = $this->numero + $r;
259 $this->rights[$r][1] = $langs->trans(
'StockTransferRightDelete');
260 $this->rights[$r][4] =
'stocktransfer';
261 $this->rights[$r][5] =
'delete';
266 $langs->load(
'stocktransfer@stocktransfer');
267 $this->menu = array();
434 public function init($options =
'')
436 global $conf, $langs;
438 $result = $this->
_load_tables(
'/install/mysql/tables/',
'stocktransfer');
439 if ($result < 0)
return -1;
451 $this->
remove($options);
456 $resql = $this->
db->query(
'SELECT rowid FROM '.MAIN_DB_PREFIX.
'c_type_contact WHERE code = "STDEST" AND element = "StockTransfer" AND source = "internal"');
457 $res = $this->
db->fetch_object(
$resql);
459 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)');
461 $resql = $this->
db->query(
'SELECT rowid FROM '.MAIN_DB_PREFIX.
'c_type_contact WHERE code = "STFROM" AND element = "StockTransfer" AND source = "external"');
462 $res = $this->
db->fetch_object(
$resql);
464 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)');
466 $resql = $this->
db->query(
'SELECT rowid FROM '.MAIN_DB_PREFIX.
'c_type_contact WHERE code = "STDEST" AND element = "StockTransfer" AND source = "external"');
467 $res = $this->
db->fetch_object(
$resql);
469 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)');
471 return $this->
_init($sql, $options);
482 $sql =
"SELECT max(rowid) newid from ".MAIN_DB_PREFIX.
"c_type_contact";
483 $result = $this->
db->query($sql);
485 $obj = $this->
db->fetch_object($result);
486 $newid = ($obj->newid + 1);
502 public function remove($options =
'')
505 return $this->
_remove($sql, $options);
getNextId()
Returns next available id to insert new roles in llx_c_type_contact.
init($options= '')
Function called when module is enabled.
$conf db
API class for accounts.
Description and activation class for module StockTransfer.
$conf db name
Only used if Module[ID]Name translation string is not found.
_load_tables($reldir, $onlywithsuffix= '')
Create tables and keys required by module:
_remove($array_sql, $options= '')
Disable function.
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->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->rights->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.
_init($array_sql, $options= '')
Enables a module.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
__construct($db)
Constructor.