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();
140 $this->
const = array();
148 if (!isset(
$conf->workstation) || !isset(
$conf->workstation->enabled)) {
150 $conf->workstation->enabled = 0;
154 $this->tabs = array();
182 $this->dictionaries = array();
186 $this->boxes = array(
197 $this->cronjobs = array(
219 $this->rights = array();
223 $this->rights[$r][0] = $this->numero + $r;
224 $this->rights[$r][1] =
'Read objects of Workstation';
225 $this->rights[$r][4] =
'workstation';
226 $this->rights[$r][5] =
'read';
228 $this->rights[$r][0] = $this->numero + $r;
229 $this->rights[$r][1] =
'Create/Update objects of Workstation';
230 $this->rights[$r][4] =
'workstation';
231 $this->rights[$r][5] =
'write';
233 $this->rights[$r][0] = $this->numero + $r;
234 $this->rights[$r][1] =
'Delete objects of Workstation';
235 $this->rights[$r][4] =
'workstation';
236 $this->rights[$r][5] =
'delete';
241 $this->menu = array();
244 $this->menu[$r++] = array(
246 'fk_menu' =>
'fk_mainmenu=mrp',
249 'titre' =>
'Workstations',
250 'prefix' =>
img_picto(
'', $this->picto,
'class="paddingright pictofixedwidth"'),
252 'leftmenu' =>
'workstation_workstation',
256 'position' => 1100 + $r,
258 'enabled' =>
'isModEnabled("workstation")',
260 'perms' =>
'$user->hasRight("workstation", "workstation", "read")',
265 $this->menu[$r++] = array(
267 'fk_menu' =>
'fk_mainmenu=mrp,fk_leftmenu=workstation_workstation',
270 'titre' =>
'NewWorkstation',
272 'leftmenu' =>
'workstation_workstation_left_create',
273 'url' =>
'/workstation/workstation_card.php?action=create',
276 'position' => 1100 + $r,
278 'enabled' =>
'isModEnabled("workstation")',
280 'perms' =>
'$user->hasRight("workstation", "workstation", "write")',
285 $this->menu[$r++] = array(
287 'fk_menu' =>
'fk_mainmenu=mrp,fk_leftmenu=workstation_workstation',
292 'leftmenu' =>
'workstation_workstation_left_list',
293 'url' =>
'/workstation/workstation_list.php',
296 'position' => 1101 + $r,
298 'enabled' =>
'isModEnabled("workstation")',
300 'perms' =>
'$user->hasRight("workstation", "workstation", "read")',
367 public function init($options =
'')
369 global
$conf, $langs;
371 $result = $this->
_load_tables(
'/install/mysql/',
'workstation');
386 $this->
remove($options);
391 $moduledir =
'workstation';
392 $myTmpObjects = array();
393 $myTmpObjects[
'Workstation'] = array(
'includerefgeneration' => 0,
'includedocgeneration' => 0);
395 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
396 if ($myTmpObjectArray[
'includerefgeneration']) {
397 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/workstation/template_workstations.odt';
398 $dirodt = DOL_DATA_ROOT.
'/doctemplates/workstation';
399 $dest = $dirodt.
'/template_workstations.odt';
401 if (file_exists($src) && !file_exists($dest)) {
402 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
404 $result =
dol_copy($src, $dest,
'0', 0);
406 $langs->load(
"errors");
407 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
412 $sql = array_merge($sql, array(
413 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".$this->db->escape(strtolower($myTmpObjectKey)).
"' AND entity = ".((
int)
$conf->entity),
414 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".$this->db->escape(strtolower($myTmpObjectKey)).
"',".((
int)
$conf->entity).
")",
415 "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),
416 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".$this->db->escape(strtolower($myTmpObjectKey)).
"', ".((
int)
$conf->entity).
")"
421 return $this->
_init($sql, $options);
432 public function remove($options =
'')
435 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, $allowothertags=array())
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.