29 include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
52 $this->rights_class =
'bookcal';
56 $this->family =
"projects";
59 $this->module_position =
'50';
64 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
69 $this->descriptionlong =
"BookCalDescription";
72 $this->version =
'experimental';
75 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
81 $this->picto =
'bookcal';
84 $this->module_parts = array(
120 'moduleforexternal' => 0,
125 $this->dirs = array(
"/bookcal/temp");
128 $this->config_page_url = array(
"setup.php@bookcal");
132 $this->hidden =
false;
134 $this->depends = array();
135 $this->requiredby = array();
136 $this->conflictwith = array();
139 $this->langfiles = array(
"agenda");
142 $this->phpmin = array(7, 0);
145 $this->warnings_activation = array();
146 $this->warnings_activation_ext = array();
155 $this->
const = array();
163 if (!isset($conf->bookcal) || !isset($conf->bookcal->enabled)) {
165 $conf->bookcal->enabled = 0;
169 $this->tabs = array();
197 $this->dictionaries = array();
226 $this->boxes = array(
237 $this->cronjobs = array(
259 $this->rights = array();
263 $this->rights[$r][0] = $this->numero . sprintf(
'%02d', (0 * 10) + 1);
264 $this->rights[$r][1] =
'Read objects of BookCal';
265 $this->rights[$r][4] =
'availabilities';
266 $this->rights[$r][5] =
'read';
268 $this->rights[$r][0] = $this->numero . sprintf(
'%02d', (0 * 10) + 2);
269 $this->rights[$r][1] =
'Create/Update objects of BookCal';
270 $this->rights[$r][4] =
'availabilities';
271 $this->rights[$r][5] =
'write';
273 $this->rights[$r][0] = $this->numero . sprintf(
'%02d', (0 * 10) + 3);
274 $this->rights[$r][1] =
'Delete objects of BookCal';
275 $this->rights[$r][4] =
'availabilities';
276 $this->rights[$r][5] =
'delete';
278 $this->rights[$r][0] = $this->numero . sprintf(
'%02d', (1 * 10) + 1);
279 $this->rights[$r][1] =
'Read Calendar object of BookCal';
280 $this->rights[$r][4] =
'calendar';
281 $this->rights[$r][5] =
'read';
283 $this->rights[$r][0] = $this->numero . sprintf(
'%02d', (1 * 10) + 2);
284 $this->rights[$r][1] =
'Create/Update Calendar object of BookCal';
285 $this->rights[$r][4] =
'calendar';
286 $this->rights[$r][5] =
'write';
288 $this->rights[$r][0] = $this->numero . sprintf(
'%02d', (1 * 10) + 3);
289 $this->rights[$r][1] =
'Delete Calendar object of BookCal';
290 $this->rights[$r][4] =
'calendar';
291 $this->rights[$r][5] =
'delete';
297 $this->menu = array();
319 $this->menu[$r++] = array(
320 'fk_menu' =>
'fk_mainmenu=agenda',
322 'titre' =>
'MenuBookcalIndex',
323 'prefix' =>
img_picto(
'', $this->picto,
'class="paddingright pictofixedwidth em92"'),
324 'mainmenu' =>
'agenda',
325 'leftmenu' =>
'bookcal',
326 'url' =>
'/bookcal/bookcalindex.php',
327 'langs' =>
'bookcal',
328 'position' => 1100 + $r,
330 'perms' =>
'$user->rights->bookcal->calendar->read',
334 $this->menu[$r++] = array(
336 'fk_menu' =>
'fk_mainmenu=agenda,fk_leftmenu=bookcal',
339 'titre' =>
'Calendar',
340 'mainmenu' =>
'agenda',
341 'leftmenu' =>
'bookcal_calendar_list',
342 'url' =>
'/bookcal/calendar_list.php',
344 'langs' =>
'bookcal',
345 'position' => 1100 + $r,
347 'enabled' =>
'$conf->bookcal->enabled',
349 'perms' =>
'$user->rights->bookcal->calendar->read',
354 $this->menu[$r++] = array(
356 'fk_menu' =>
'fk_mainmenu=agenda,fk_leftmenu=bookcal_calendar_list',
359 'titre' =>
'NewCalendar',
360 'mainmenu' =>
'agenda',
361 'leftmenu' =>
'bookcal_new',
362 'url' =>
'/bookcal/calendar_card.php?action=create',
364 'langs' =>
'bookcal',
365 'position' => 1100 + $r,
367 'enabled' =>
'$conf->bookcal->enabled',
369 'perms' =>
'$user->rights->bookcal->calendar->read',
422 $this->menu[$r++] = array(
424 'fk_menu' =>
'fk_mainmenu=agenda,fk_leftmenu=bookcal',
427 'titre' =>
'Availabilities',
428 'mainmenu' =>
'agenda',
429 'leftmenu' =>
'bookcal_availabilities',
430 'url' =>
'/bookcal/availabilities_list.php',
432 'langs' =>
'bookcal',
433 'position' => 1200 + $r,
435 'enabled' =>
'$conf->bookcal->enabled',
437 'perms' =>
'$user->rights->bookcal->availabilities->read',
442 $this->menu[$r++] = array(
444 'fk_menu' =>
'fk_mainmenu=agenda,fk_leftmenu=bookcal_availabilities',
447 'titre' =>
'NewAvailabilities',
448 'mainmenu' =>
'agenda',
449 'leftmenu' =>
'bookcal_availabilities',
450 'url' =>
'/bookcal/availabilities_card.php?action=create',
452 'langs' =>
'bookcal',
453 'position' => 1200 + $r,
455 'enabled' =>
'$conf->bookcal->enabled',
457 'perms' =>
'$user->rights->bookcal->availabilities->read',
540 public function init($options =
'')
542 global $conf, $langs;
544 $result = $this->
_load_tables(
'/install/mysql/',
'bookcal');
559 $this->
remove($options);
565 $myTmpObjects = array();
566 $myTmpObjects[
'Availabilities'] = array(
'includerefgeneration' => 0,
'includedocgeneration' => 0);
568 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
569 if ($myTmpObjectKey ==
'Availabilities') {
572 if ($myTmpObjectArray[
'includerefgeneration']) {
573 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/'.$moduledir.
'/template_availabilitiess.odt';
574 $dirodt = DOL_DATA_ROOT.
'/doctemplates/'.$moduledir;
575 $dest = $dirodt.
'/template_availabilitiess.odt';
577 if (file_exists($src) && !file_exists($dest)) {
578 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
580 $result =
dol_copy($src, $dest, 0, 0);
582 $langs->load(
"errors");
583 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
589 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".$this->db->escape(strtolower($myTmpObjectKey)).
"' AND type = '".$this->db->escape(strtolower($myTmpObjectKey)).
"' AND entity = ".((
int) $conf->entity),
590 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".$this->db->escape(strtolower($myTmpObjectKey)).
"', '".$this->db->escape(strtolower($myTmpObjectKey)).
"', ".((
int) $conf->entity).
")",
591 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'generic_".$this->db->escape(strtolower($myTmpObjectKey)).
"_odt' AND type = '".$this->db->escape(strtolower($myTmpObjectKey)).
"' AND entity = ".((
int) $conf->entity),
592 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".$this->db->escape(strtolower($myTmpObjectKey)).
"_odt', '".$this->db->escape(strtolower($myTmpObjectKey)).
"', ".((
int) $conf->entity).
")"
608 public function remove($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 BookCal.
__construct($db)
Constructor.
init($options='')
Function called when module is enabled.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
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.
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_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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.