29 include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
50 $this->rights_class =
'workstation';
53 $this->family =
"products";
55 $this->module_position =
'90';
59 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
63 $this->descriptionlong =
"WorkstationsDescription";
65 $this->version =
'experimental';
70 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
74 $this->picto =
'workstation';
76 $this->module_parts = array(
112 'moduleforexternal' => 0,
116 $this->dirs = array(
"/workstation/temp");
118 $this->config_page_url = array(
"workstation.php");
121 $this->hidden =
false;
123 $this->depends = array();
124 $this->requiredby = array();
125 $this->conflictwith = array();
126 $this->langfiles = array(
"mrp");
127 $this->phpmin = array(7, 0);
128 $this->need_dolibarr_version = array(11, -3);
129 $this->warnings_activation = array();
130 $this->warnings_activation_ext = array();
139 $this->
const = array();
147 if (!isset($conf->workstation) || !isset($conf->workstation->enabled)) {
148 $conf->workstation =
new stdClass();
149 $conf->workstation->enabled = 0;
153 $this->tabs = array();
181 $this->dictionaries = array();
185 $this->boxes = array(
196 $this->cronjobs = array(
218 $this->rights = array();
222 $this->rights[$r][0] = $this->numero + $r;
223 $this->rights[$r][1] =
'Read objects of Workstation';
224 $this->rights[$r][4] =
'workstation';
225 $this->rights[$r][5] =
'read';
227 $this->rights[$r][0] = $this->numero + $r;
228 $this->rights[$r][1] =
'Create/Update objects of Workstation';
229 $this->rights[$r][4] =
'workstation';
230 $this->rights[$r][5] =
'write';
232 $this->rights[$r][0] = $this->numero + $r;
233 $this->rights[$r][1] =
'Delete objects of Workstation';
234 $this->rights[$r][4] =
'workstation';
235 $this->rights[$r][5] =
'delete';
240 $this->menu = array();
243 $this->menu[$r++]=array(
245 'fk_menu'=>
'fk_mainmenu=mrp',
248 'titre'=>
'Workstations',
249 'prefix' =>
img_picto(
'', $this->picto,
'class="paddingright pictofixedwidth"'),
251 'leftmenu'=>
'workstation_workstation',
257 'enabled'=>
'$conf->workstation->enabled',
259 'perms'=>
'$user->rights->workstation->workstation->read',
264 $this->menu[$r++]=array(
266 'fk_menu'=>
'fk_mainmenu=mrp,fk_leftmenu=workstation_workstation',
269 'titre'=>
'WorkstationCreate',
271 'leftmenu'=>
'workstation_workstation_left_create',
272 'url'=>
'/workstation/workstation_card.php?action=create',
277 'enabled'=>
'$conf->workstation->enabled',
279 'perms'=>
'$user->rights->workstation->workstation->write',
284 $this->menu[$r++]=array(
286 'fk_menu'=>
'fk_mainmenu=mrp,fk_leftmenu=workstation_workstation',
291 'leftmenu'=>
'workstation_workstation_left_list',
292 'url'=>
'/workstation/workstation_list.php',
297 'enabled'=>
'$conf->workstation->enabled',
299 'perms'=>
'$user->rights->workstation->workstation->read',
366 public function init($options =
'')
368 global $conf, $langs;
370 $result = $this->
_load_tables(
'/install/mysql/',
'workstation');
385 $this->
remove($options);
390 $moduledir =
'workstation';
391 $myTmpObjects = array();
392 $myTmpObjects[
'Workstation'] = array(
'includerefgeneration'=>0,
'includedocgeneration'=>0);
394 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
395 if ($myTmpObjectKey ==
'Workstation') {
398 if ($myTmpObjectArray[
'includerefgeneration']) {
399 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/workstation/template_workstations.odt';
400 $dirodt = DOL_DATA_ROOT.
'/doctemplates/workstation';
401 $dest = $dirodt.
'/template_workstations.odt';
403 if (file_exists($src) && !file_exists($dest)) {
404 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
406 $result =
dol_copy($src, $dest, 0, 0);
408 $langs->load(
"errors");
409 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
414 $sql = array_merge($sql, array(
415 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".$this->
db->escape(strtolower($myTmpObjectKey)).
"' AND entity = ".((
int) $conf->entity),
416 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".$this->
db->escape(strtolower($myTmpObjectKey)).
"',".((
int) $conf->entity).
")",
417 "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),
418 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".$this->
db->escape(strtolower($myTmpObjectKey)).
"', ".((
int) $conf->entity).
")"
423 return $this->
_init($sql, $options);
434 public function remove($options =
'')
437 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(".$version.") pid 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)
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.
$conf db
API class for accounts.