51 $this->rights_class =
'eventorganization';
53 $this->family =
"projects";
55 $this->module_position =
'15';
57 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
59 $this->
description =
"EventOrganizationDescription";
60 $this->descriptionlong =
"EventOrganizationDescriptionLong";
62 $this->version =
'dolibarr';
66 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
68 $this->picto =
'conferenceorbooth';
71 $this->module_parts = array(
107 'moduleforexternal' => 0,
112 $this->dirs = array(
"/eventorganization/temp");
115 $this->config_page_url = array(
"eventorganization.php");
119 $this->hidden =
false;
121 $this->depends = array(
'modProjet',
'modCategorie',
'modAgenda');
122 $this->requiredby = array();
123 $this->conflictwith = array();
126 $this->langfiles = array(
"eventorganization");
129 $this->phpmin = array(7, 0);
130 $this->need_dolibarr_version = array(13, -3);
133 $this->warnings_activation = array();
134 $this->warnings_activation_ext = array();
138 include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
139 $this->
const = array(
141 'EVENTORGANIZATION_TASK_LABEL',
148 "EVENTORGANIZATION_SECUREKEY",
163 if (!isset(
$conf->eventorganization) || !isset(
$conf->eventorganization->enabled)) {
165 $conf->eventorganization->enabled = 0;
169 $this->tabs = array();
197 $this->dictionaries = array();
201 $this->boxes = array(
212 $this->cronjobs = array(
217 $this->rights = array();
239 $this->menu = array();
245 $this->menu[$r++] = array(
246 'fk_menu' =>
'fk_mainmenu=project',
248 'titre' =>
'EventOrganizationMenuLeft',
249 'prefix' =>
img_picto(
'',
'eventorganization',
'class="paddingright pictofixedwidth"'),
250 'mainmenu' =>
'project',
251 'leftmenu' =>
'eventorganization',
252 'url' =>
'/projet/list.php?search_usage_event_organization=1&search_status=99&mainmenu=project&contextpage=organizedevents',
253 'langs' =>
'eventorganization',
254 'position' => 1000 + $r,
255 'enabled' =>
'isModEnabled("eventorganization")',
256 'perms' =>
'$user->hasRight("project", "read")',
260 $this->menu[$r++] = array(
261 'fk_menu' =>
'fk_mainmenu=project,fk_leftmenu=eventorganization',
264 'url' =>
'/projet/card.php?leftmenu=projects&action=create&usage_organize_event=1&usage_opportunity=0',
265 'langs' =>
'eventorganization@eventorganization',
266 'position' => 1000 + $r,
267 'enabled' =>
'isModEnabled("eventorganization")',
268 'perms' =>
'$user->hasRight("project", "write")',
272 $this->menu[$r++] = array(
273 'fk_menu' =>
'fk_mainmenu=project,fk_leftmenu=eventorganization',
276 'url' =>
'/projet/list.php?search_usage_event_organization=1&search_status=99&mainmenu=project&contextpage=organizedevents',
277 'langs' =>
'eventorganization@eventorganization',
278 'position' => 1000 + $r,
279 'enabled' =>
'isModEnabled("eventorganization")',
280 'perms' =>
'$user->hasRight("project", "write")',
284 $this->menu[$r++] = array(
285 'fk_menu' =>
'fk_mainmenu=project',
287 'titre' =>
'EventOrganizationConfOrBoothes',
288 'prefix' =>
img_picto(
'',
'conferenceorbooth',
'class="paddingright pictofixedwidth"'),
289 'mainmenu' =>
'project',
290 'leftmenu' =>
'eventorganizationconforbooth',
291 'url' =>
'/eventorganization/conferenceorbooth_list.php?mainmenu=project',
292 'langs' =>
'eventorganization',
293 'position' => 1000 + $r,
294 'enabled' =>
'isModEnabled("eventorganization")',
295 'perms' =>
'$user->hasRight("project", "read")',
299 $this->menu[$r++] = array(
300 'fk_menu' =>
'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth',
303 'url' =>
'/eventorganization/conferenceorbooth_card.php?leftmenu=projects&action=create',
304 'langs' =>
'eventorganization',
305 'position' => 1000 + $r,
306 'enabled' =>
'isModEnabled("eventorganization")',
307 'perms' =>
'$user->hasRight("project", "write")',
311 $this->menu[$r++] = array(
312 'fk_menu' =>
'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth',
315 'url' =>
'/eventorganization/conferenceorbooth_list.php?mainmenu=project',
316 'langs' =>
'eventorganization',
317 'position' => 1000 + $r,
318 'enabled' =>
'isModEnabled("eventorganization")',
319 'perms' =>
'$user->hasRight("project", "read")',
323 $this->menu[$r++] = array(
324 'fk_menu' =>
'fk_mainmenu=project',
326 'titre' =>
'ConferenceOrBoothAttendeesShort',
327 'prefix' =>
img_picto(
'',
'contact',
'class="paddingright pictofixedwidth"'),
328 'mainmenu' =>
'project',
329 'leftmenu' =>
'eventorganizationconforattendee',
330 'url' =>
'/eventorganization/conferenceorboothattendee_list.php?withproject=0&mainmenu=project',
331 'langs' =>
'eventorganization',
332 'position' => 1000 + $r,
333 'enabled' =>
'isModEnabled("eventorganization")',
334 'perms' =>
'$user->hasRight("project", "read")',
338 $this->menu[$r++] = array(
339 'fk_menu' =>
'fk_mainmenu=project,fk_leftmenu=eventorganizationconforattendee',
342 'url' =>
'/eventorganization/conferenceorboothattendee_list.php?withproject=0&mainmenu=project',
343 'langs' =>
'eventorganization',
344 'position' => 1000 + $r,
345 'enabled' =>
'isModEnabled("eventorganization")',
346 'perms' =>
'$user->hasRight("project", "read")',
356 $langs->load(
"eventorganization");
357 $this->export_code[$r] = $this->rights_class.
'_'.$r;
358 $this->export_label[$r] =
'ListOfAttendeesOfEvent';
359 $this->export_icon[$r] = $this->picto;
361 $keyforclass =
'ConferenceOrBoothAttendee';
362 $keyforclassfile =
'/eventorganization/class/conferenceorboothattendee.class.php';
363 $keyforelement =
'conferenceorboothattendee';
364 include DOL_DOCUMENT_ROOT.
'/core/commonfieldsinexport.inc.php';
365 $this->export_entities_array[$r][
't.fk_invoice'] =
'invoice';
366 unset($this->export_fields_array[$r][
't.fk_project']);
367 unset($this->export_fields_array[$r][
't.fk_soc']);
368 $this->export_fields_array[$r][
't.fk_invoice'] =
'InvoiceId';
369 $this->export_fields_array[$r][
't.fk_project'] =
'ProjectId';
370 $this->export_fields_array[$r][
'p.ref'] =
'ProjectRef';
371 $this->export_fields_array[$r][
't.fk_soc'] =
'IdThirdParty';
372 $this->export_entities_array[$r][
't.fk_project'] =
'project';
373 $this->export_entities_array[$r][
'p.ref'] =
'project';
374 $this->export_entities_array[$r][
't.fk_soc'] =
'company';
375 $this->export_TypeFields_array[$r][
't.fk_project'] =
'Numeric';
376 $this->export_TypeFields_array[$r][
't.fk_invoice'] =
'Numeric';
377 $this->export_TypeFields_array[$r][
'p.ref'] =
'Text';
378 $this->export_TypeFields_array[$r][
't.fk_soc'] =
'Numeric';
381 $keyforselect =
'eventorganization_conferenceorboothattendee';
382 $keyforaliasextra =
'extra';
383 $keyforelement =
'conferenceorboothattendee';
384 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
389 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
390 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'eventorganization_conferenceorboothattendee as t';
391 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'projet as p ON t.fk_project = p.rowid AND p.entity IN ('.
getEntity(
'conferenceorboothattendee').
')';
392 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'eventorganization_conferenceorboothattendee_extrafields as extra on t.rowid = extra.fk_object';
397 $langs->load(
"eventorganization");
398 $this->export_code[$r] = $this->rights_class.
'_'.$r;
399 $this->export_label[$r] =
'ListOfConfOrBoothOfEvent';
400 $this->export_icon[$r] =
'conferenceorbooth';
402 $keyforclass =
'ConferenceOrBooth';
403 $keyforclassfile =
'/eventorganization/class/conferenceorbooth.class.php';
404 $keyforelement =
'conferenceorbooth';
405 include DOL_DOCUMENT_ROOT.
'/core/commonfieldsinexport.inc.php';
406 unset($this->export_fields_array[$r][
't.fk_action']);
407 unset($this->export_fields_array[$r][
't.fk_project']);
408 unset($this->export_fields_array[$r][
't.fk_soc']);
409 $this->export_fields_array[$r][
't.fk_action'] =
'ConferenceOrBoothFormatID';
410 $this->export_fields_array[$r][
'ca.code'] =
'ConferenceOrBoothFormatCode';
411 $this->export_fields_array[$r][
'ca.libelle'] =
'ConferenceOrBoothFormatLabel';
412 $this->export_fields_array[$r][
't.fk_project'] =
'ProjectId';
413 $this->export_fields_array[$r][
'p.ref'] =
'ProjectRef';
414 $this->export_fields_array[$r][
't.fk_soc'] =
'IdThirdParty';
415 $this->export_fields_array[$r][
's.nom'] =
'ThirdPartyName';
416 $this->export_entities_array[$r][
'ca.code'] =
'conferenceorbooth';
417 $this->export_entities_array[$r][
'ca.libelle'] =
'conferenceorbooth';
418 $this->export_entities_array[$r][
't.fk_project'] =
'project';
419 $this->export_entities_array[$r][
'p.ref'] =
'project';
420 $this->export_entities_array[$r][
't.fk_soc'] =
'company';
421 $this->export_entities_array[$r][
's.nom'] =
'company';
422 $this->export_TypeFields_array[$r][
'ca.code'] =
'Text';
423 $this->export_TypeFields_array[$r][
'ca.libelle'] =
'Text';
424 $this->export_TypeFields_array[$r][
't.fk_project'] =
'Numeric';
425 $this->export_TypeFields_array[$r][
'p.ref'] =
'Text';
426 $this->export_TypeFields_array[$r][
't.fk_soc'] =
'Numeric';
427 $this->export_TypeFields_array[$r][
's.nom'] =
'Text';
430 $keyforselect =
'actioncomm';
431 $keyforaliasextra =
'extra';
432 $keyforelement =
'conferenceorbooth';
433 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
438 $this->export_sql_start[$r] =
"SELECT DISTINCT ";
439 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'actioncomm as t';
440 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'projet as p ON t.fk_project = p.rowid AND p.usage_organize_event = 1 AND p.entity IN ('.
getEntity(
'conferenceorboothattendee').
')';
441 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'c_actioncomm as ca ON ca.id = t.fk_action';
442 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s ON t.fk_soc = s.rowid';
443 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'actioncomm_extrafields as extra on t.id = extra.fk_object';
444 $this->export_sql_end[$r] .=
" WHERE t.code LIKE 'AC_EO_%'";
463 public function init($options =
'')
465 global
$conf, $langs, $user;
475 $this->
remove($options);
480 $moduledir =
'eventorganization';
481 $myTmpObjects = array();
482 $myTmpObjects[
'ConferenceOrBooth'] = array(
'includerefgeneration' => 0,
'includedocgeneration' => 0);
484 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
485 if ($myTmpObjectArray[
'includerefgeneration']) {
486 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/eventorganization/template_conferenceorbooths.odt';
487 $dirodt = DOL_DATA_ROOT.
'/doctemplates/eventorganization';
488 $dest = $dirodt.
'/template_conferenceorbooths.odt';
490 if (file_exists($src) && !file_exists($dest)) {
491 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
493 $result =
dol_copy($src, $dest,
'0', 0);
495 $langs->load(
"errors");
496 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
501 $sql = array_merge($sql, array(
502 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".$this->db->escape(strtolower($myTmpObjectKey)).
"' AND entity = ".((
int)
$conf->entity),
503 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".$this->db->escape(strtolower($myTmpObjectKey)).
"',".((
int)
$conf->entity).
")",
504 "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),
505 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".$this->db->escape(strtolower($myTmpObjectKey)).
"', ".((
int)
$conf->entity).
")"
510 $init = $this->
_init($sql, $options);
514 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
515 $formmail =
new FormMail($this->db);
517 include_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
518 if (!is_object($user)) {
519 $user =
new User($this->db);
522 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailAskConf)');
523 if ($template->id > 0) {
524 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF', $template->id,
'chaine', 0,
'',
$conf->entity);
526 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailAskBooth)');
527 if ($template->id > 0) {
528 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH', $template->id,
'chaine', 0,
'',
$conf->entity);
530 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailBoothPayment)');
531 if ($template->id > 0) {
532 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH', $template->id,
'chaine', 0,
'',
$conf->entity);
534 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailRegistrationPayment)');
535 if ($template->id > 0) {
536 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT', $template->id,
'chaine', 0,
'',
$conf->entity);