29include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
51 $this->rights_class =
'workstation';
54 $this->family =
"products";
56 $this->module_position =
'90';
60 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
64 $this->descriptionlong =
"WorkstationsDescription";
66 $this->version =
'dolibarr';
71 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
75 $this->picto =
'workstation';
77 $this->module_parts = array(
113 'moduleforexternal' => 0,
117 $this->dirs = array(
"/workstation/temp");
119 $this->config_page_url = array(
"workstation.php");
122 $this->hidden =
false;
124 $this->depends = array(
'modMrp');
125 $this->requiredby = array();
126 $this->conflictwith = array();
127 $this->langfiles = array(
"mrp");
128 $this->phpmin = array(7, 0);
129 $this->need_dolibarr_version = array(11, -3);
130 $this->warnings_activation = array();
131 $this->warnings_activation_ext = array();
140 $this->
const = array();
148 if (!isset($conf->workstation) || !isset($conf->workstation->enabled)) {
149 $conf->workstation =
new stdClass();
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',
258 'enabled'=>
'$conf->workstation->enabled',
260 'perms'=>
'$user->rights->workstation->workstation->read',
265 $this->menu[$r++]=array(
267 'fk_menu'=>
'fk_mainmenu=mrp,fk_leftmenu=workstation_workstation',
270 'titre'=>
'WorkstationCreate',
272 'leftmenu'=>
'workstation_workstation_left_create',
273 'url'=>
'/workstation/workstation_card.php?action=create',
278 'enabled'=>
'$conf->workstation->enabled',
280 'perms'=>
'$user->rights->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',
298 'enabled'=>
'$conf->workstation->enabled',
300 'perms'=>
'$user->rights->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 ($myTmpObjectKey ==
'Workstation') {
399 if ($myTmpObjectArray[
'includerefgeneration']) {
400 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/workstation/template_workstations.odt';
401 $dirodt = DOL_DATA_ROOT.
'/doctemplates/workstation';
402 $dest = $dirodt.
'/template_workstations.odt';
404 if (file_exists($src) && !file_exists($dest)) {
405 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
407 $result =
dol_copy($src, $dest, 0, 0);
409 $langs->load(
"errors");
410 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
415 $sql = array_merge($sql, array(
416 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".$this->db->escape(strtolower($myTmpObjectKey)).
"' AND entity = ".((
int) $conf->entity),
417 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".$this->db->escape(strtolower($myTmpObjectKey)).
"',".((
int) $conf->entity).
")",
418 "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),
419 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".$this->db->escape(strtolower($myTmpObjectKey)).
"', ".((
int) $conf->entity).
")"
424 return $this->
_init($sql, $options);
435 public function remove($options =
'')
438 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=false, $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.