49 $this->rights_class =
'eventorganization';
51 $this->family =
"projects";
53 $this->module_position =
'15';
55 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
57 $this->
description =
"EventOrganizationDescription";
58 $this->descriptionlong =
"EventOrganizationDescriptionLong";
60 $this->version =
'dolibarr';
64 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
66 $this->picto =
'conferenceorbooth';
69 $this->module_parts = array(
105 'moduleforexternal' => 0,
110 $this->dirs = array(
"/eventorganization/temp");
113 $this->config_page_url = array(
"eventorganization.php");
117 $this->hidden =
false;
119 $this->depends = array(
'modProjet',
'modCategorie');
120 $this->requiredby = array();
121 $this->conflictwith = array();
124 $this->langfiles = array(
"eventorganization");
127 $this->phpmin = array(7, 0);
128 $this->need_dolibarr_version = array(13, -3);
131 $this->warnings_activation = array();
132 $this->warnings_activation_ext = array();
141 $this->
const = array(1 => array(
'EVENTORGANIZATION_TASK_LABEL',
'chaine',
'',
'', 0));
151 if (!isset($conf->eventorganization) || !isset($conf->eventorganization->enabled)) {
152 $conf->eventorganization =
new stdClass();
153 $conf->eventorganization->enabled = 0;
157 $this->tabs = array();
185 $this->dictionaries = array();
189 $this->boxes = array(
200 $this->cronjobs = array(
205 $this->rights = array();
210 $this->rights[$r][0] = $this->numero + $r;
211 $this->rights[$r][1] =
'Read objects of EventOrganization';
212 $this->rights[$r][4] =
'read';
214 $this->rights[$r][0] = $this->numero + $r;
215 $this->rights[$r][1] =
'Create/Update objects of EventOrganization';
216 $this->rights[$r][4] =
'write';
218 $this->rights[$r][0] = $this->numero + $r;
219 $this->rights[$r][1] =
'Delete objects of EventOrganization';
220 $this->rights[$r][4] =
'delete';
225 $this->menu = array();
231 $this->menu[$r++]=array(
232 'fk_menu'=>
'fk_mainmenu=project',
234 'titre'=>
'EventOrganizationMenuLeft',
235 'prefix' =>
img_picto(
'',
'eventorganization',
'class="paddingright pictofixedwidth"'),
236 'mainmenu'=>
'project',
237 'leftmenu'=>
'eventorganization',
239 'langs'=>
'eventorganization',
241 'enabled'=>
'$conf->eventorganization->enabled',
242 'perms'=>
'$user->rights->eventorganization->read',
246 $this->menu[$r++]=array(
247 'fk_menu'=>
'fk_mainmenu=project,fk_leftmenu=eventorganization',
250 'url'=>
'/projet/list.php?search_usage_event_organization=1&search_status=99&mainmenu=project&contextpage=organizedevents',
251 'langs'=>
'eventorganization@eventorganization',
253 'enabled'=>
'$conf->eventorganization->enabled',
254 'perms'=>
'$user->rights->eventorganization->read',
258 $this->menu[$r++]=array(
259 'fk_menu'=>
'fk_mainmenu=project,fk_leftmenu=eventorganization',
262 'url'=>
'/projet/card.php?leftmenu=projects&action=create&usage_organize_event=1&usage_opportunity=0',
263 'langs'=>
'eventorganization@eventorganization',
265 'enabled'=>
'$conf->eventorganization->enabled',
266 'perms'=>
'$user->rights->eventorganization->write',
270 $this->menu[$r++]=array(
271 'fk_menu'=>
'fk_mainmenu=project',
273 'titre'=>
'ConferenceOrBooth',
274 'prefix' =>
img_picto(
'',
'conferenceorbooth',
'class="paddingright pictofixedwidth"'),
275 'mainmenu'=>
'project',
276 'leftmenu'=>
'eventorganizationconforbooth',
278 'langs'=>
'eventorganization',
280 'enabled'=>
'$conf->eventorganization->enabled',
281 'perms'=>
'$user->rights->eventorganization->read',
285 $this->menu[$r++]=array(
286 'fk_menu'=>
'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth',
289 'url'=>
'/eventorganization/conferenceorbooth_list.php?mainmenu=project',
290 'langs'=>
'eventorganization',
292 'enabled'=>
'$conf->eventorganization->enabled',
293 'perms'=>
'$user->rights->eventorganization->read',
297 $this->menu[$r++]=array(
298 'fk_menu'=>
'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth',
301 'url'=>
'/eventorganization/conferenceorbooth_card.php?leftmenu=projects&action=create',
302 'langs'=>
'eventorganization',
304 'enabled'=>
'$conf->eventorganization->enabled',
305 'perms'=>
'$user->rights->eventorganization->write',
315 $langs->load(
"eventorganization");
316 $this->export_code[$r]=$this->rights_class.
'_'.$r;
317 $this->export_label[$r]=
'ListOfAttendeesOfEvent';
318 $this->export_icon[$r]=$this->picto;
320 $keyforclass =
'ConferenceOrBoothAttendee'; $keyforclassfile=
'/eventorganization/class/conferenceorboothattendee.class.php'; $keyforelement=
'conferenceorboothattendee';
321 include DOL_DOCUMENT_ROOT.
'/core/commonfieldsinexport.inc.php';
322 $this->export_entities_array[$r][
't.fk_invoice'] =
'invoice';
323 unset($this->export_fields_array[$r][
't.fk_project']);
324 unset($this->export_fields_array[$r][
't.fk_soc']);
325 $this->export_fields_array[$r][
't.fk_invoice'] =
'InvoiceId';
326 $this->export_fields_array[$r][
't.fk_project'] =
'ProjectId';
327 $this->export_fields_array[$r][
'p.ref'] =
'ProjectRef';
328 $this->export_fields_array[$r][
't.fk_soc'] =
'IdThirdParty';
329 $this->export_entities_array[$r][
't.fk_project'] =
'project';
330 $this->export_entities_array[$r][
'p.ref'] =
'project';
331 $this->export_entities_array[$r][
't.fk_soc'] =
'company';
332 $this->export_TypeFields_array[$r][
't.fk_project'] =
'Numeric';
333 $this->export_TypeFields_array[$r][
't.fk_invoice'] =
'Numeric';
334 $this->export_TypeFields_array[$r][
'p.ref'] =
'Text';
335 $this->export_TypeFields_array[$r][
't.fk_soc'] =
'Numeric';
338 $keyforselect=
'conferenceorboothattendee'; $keyforaliasextra=
'extra'; $keyforelement=
'conferenceorboothattendee';
339 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
344 $this->export_sql_start[$r]=
'SELECT DISTINCT ';
345 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'eventorganization_conferenceorboothattendee as t, '.MAIN_DB_PREFIX.
'projet as p';
346 $this->export_sql_end[$r] .=
' WHERE t.fk_project = p.rowid';
347 $this->export_sql_end[$r] .=
' AND p.entity IN ('.getEntity(
'conferenceorboothattendee').
')';
426 public function init($options =
'')
428 global $conf, $langs, $user;
438 $this->
remove($options);
443 $moduledir =
'eventorganization';
444 $myTmpObjects = array();
445 $myTmpObjects[
'ConferenceOrBooth'] = array(
'includerefgeneration'=>0,
'includedocgeneration'=>0);
447 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
448 if ($myTmpObjectKey ==
'ConferenceOrBooth') {
451 if ($myTmpObjectArray[
'includerefgeneration']) {
452 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/eventorganization/template_conferenceorbooths.odt';
453 $dirodt = DOL_DATA_ROOT.
'/doctemplates/eventorganization';
454 $dest = $dirodt.
'/template_conferenceorbooths.odt';
456 if (file_exists($src) && !file_exists($dest)) {
457 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
459 $result =
dol_copy($src, $dest, 0, 0);
461 $langs->load(
"errors");
462 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
467 $sql = array_merge($sql, array(
468 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".$this->db->escape(strtolower($myTmpObjectKey)).
"' AND entity = ".((
int) $conf->entity),
469 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".$this->db->escape(strtolower($myTmpObjectKey)).
"',".((
int) $conf->entity).
")",
470 "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),
471 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".$this->db->escape(strtolower($myTmpObjectKey)).
"', ".((
int) $conf->entity).
")"
476 $init = $this->
_init($sql, $options);
480 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
481 $formmail =
new FormMail($this->db);
483 include_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
484 if (!is_object($user)) {
485 $user =
new User($this->db);
488 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailAskConf)');
489 if ($template->id > 0) {
490 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF', $template->id,
'chaine', 0,
'', $conf->entity);
492 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailAskBooth)');
493 if ($template->id > 0) {
494 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH', $template->id,
'chaine', 0,
'', $conf->entity);
496 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailBoothPayment)');
497 if ($template->id > 0) {
498 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH', $template->id,
'chaine', 0,
'', $conf->entity);
500 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailRegistrationPayment)');
501 if ($template->id > 0) {
502 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT', $template->id,
'chaine', 0,
'', $conf->entity);