30include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
52 $this->rights_class =
'workstation';
55 $this->family =
"products";
57 $this->module_position =
'90';
61 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
65 $this->descriptionlong =
"WorkstationsDescription";
67 $this->version =
'dolibarr';
72 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
76 $this->picto =
'workstation';
78 $this->module_parts = array(
114 'moduleforexternal' => 0,
118 $this->dirs = array(
"/workstation/temp");
120 $this->config_page_url = array(
"workstation.php");
123 $this->hidden =
false;
125 $this->depends = array(
'modMrp');
126 $this->requiredby = array();
127 $this->conflictwith = array();
128 $this->langfiles = array(
"mrp");
129 $this->phpmin = array(7, 0);
130 $this->need_dolibarr_version = array(11, -3);
131 $this->warnings_activation = array();
132 $this->warnings_activation_ext = array();
141 $this->
const = array();
149 if (!isset($conf->workstation) || !isset($conf->workstation->enabled)) {
150 $conf->workstation =
new stdClass();
151 $conf->workstation->enabled = 0;
155 $this->tabs = array();
183 $this->dictionaries = array();
187 $this->boxes = array(
198 $this->cronjobs = array(
220 $this->rights = array();
224 $this->rights[$r][0] = $this->numero + $r;
225 $this->rights[$r][1] =
'Read objects of Workstation';
226 $this->rights[$r][4] =
'workstation';
227 $this->rights[$r][5] =
'read';
229 $this->rights[$r][0] = $this->numero + $r;
230 $this->rights[$r][1] =
'Create/Update objects of Workstation';
231 $this->rights[$r][4] =
'workstation';
232 $this->rights[$r][5] =
'write';
234 $this->rights[$r][0] = $this->numero + $r;
235 $this->rights[$r][1] =
'Delete objects of Workstation';
236 $this->rights[$r][4] =
'workstation';
237 $this->rights[$r][5] =
'delete';
242 $this->menu = array();
245 $this->menu[$r++] = array(
247 'fk_menu' =>
'fk_mainmenu=mrp',
250 'titre' =>
'Workstations',
251 'prefix' =>
img_picto(
'', $this->picto,
'class="paddingright pictofixedwidth"'),
253 'leftmenu' =>
'workstation_workstation',
257 'position' => 1100 + $r,
259 'enabled' =>
'isModEnabled("workstation")',
261 'perms' =>
'$user->hasRight("workstation", "workstation", "read")',
266 $this->menu[$r++] = array(
268 'fk_menu' =>
'fk_mainmenu=mrp,fk_leftmenu=workstation_workstation',
271 'titre' =>
'NewWorkstation',
273 'leftmenu' =>
'workstation_workstation_left_create',
274 'url' =>
'/workstation/workstation_card.php?action=create',
277 'position' => 1100 + $r,
279 'enabled' =>
'isModEnabled("workstation")',
281 'perms' =>
'$user->hasRight("workstation", "workstation", "write")',
286 $this->menu[$r++] = array(
288 'fk_menu' =>
'fk_mainmenu=mrp,fk_leftmenu=workstation_workstation',
293 'leftmenu' =>
'workstation_workstation_left_list',
294 'url' =>
'/workstation/workstation_list.php',
297 'position' => 1101 + $r,
299 'enabled' =>
'isModEnabled("workstation")',
301 'perms' =>
'$user->hasRight("workstation", "workstation", "read")',
368 public function init($options =
'')
370 global $conf, $langs;
372 $result = $this->
_load_tables(
'/install/mysql/',
'workstation');
387 $this->
remove($options);
392 $moduledir =
'workstation';
393 $myTmpObjects = array();
394 $myTmpObjects[
'Workstation'] = array(
'includerefgeneration' => 0,
'includedocgeneration' => 0);
396 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
397 if ($myTmpObjectArray[
'includerefgeneration']) {
398 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/workstation/template_workstations.odt';
399 $dirodt = DOL_DATA_ROOT.
'/doctemplates/workstation';
400 $dest = $dirodt.
'/template_workstations.odt';
402 if (file_exists($src) && !file_exists($dest)) {
403 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
405 $result =
dol_copy($src, $dest,
'0', 0);
407 $langs->load(
"errors");
408 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
413 $sql = array_merge($sql, array(
414 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".$this->db->escape(strtolower($myTmpObjectKey)).
"' AND entity = ".((
int) $conf->entity),
415 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".$this->db->escape(strtolower($myTmpObjectKey)).
"',".((
int) $conf->entity).
")",
416 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey).
"_odt' AND type = '".$this->db->escape(strtolower($myTmpObjectKey)).
"' AND entity = ".((
int) $conf->entity),
417 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".$this->db->escape(strtolower($myTmpObjectKey)).
"', ".((
int) $conf->entity).
")"
422 return $this->
_init($sql, $options);
433 public function remove($options =
'')
436 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 Workstation.
__construct($db)
Constructor.
init($options='')
Function called when module is enabled.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_copy($srcfile, $destfile, $newmask='0', $overwriteifexists=1, $testvirus=0, $indexdatabase=0)
Copy a file to another file.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
$conf db name
Only used if Module[ID]Name translation string is not found.