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();
142 $this->
const = array(1 => array(
'EVENTORGANIZATION_TASK_LABEL',
'chaine',
'',
'', 0));
152 if (!isset($conf->eventorganization) || !isset($conf->eventorganization->enabled)) {
153 $conf->eventorganization =
new stdClass();
154 $conf->eventorganization->enabled = 0;
158 $this->tabs = array();
186 $this->dictionaries = array();
190 $this->boxes = array(
201 $this->cronjobs = array(
206 $this->rights = array();
228 $this->menu = array();
234 $this->menu[$r++] = array(
235 'fk_menu' =>
'fk_mainmenu=project',
237 'titre' =>
'EventOrganizationMenuLeft',
238 'prefix' =>
img_picto(
'',
'eventorganization',
'class="paddingright pictofixedwidth"'),
239 'mainmenu' =>
'project',
240 'leftmenu' =>
'eventorganization',
242 'langs' =>
'eventorganization',
243 'position' => 1000 + $r,
244 'enabled' =>
'isModEnabled("eventorganization")',
245 'perms' =>
'$user->hasRight("project", "read")',
249 $this->menu[$r++] = array(
250 'fk_menu' =>
'fk_mainmenu=project,fk_leftmenu=eventorganization',
253 'url' =>
'/projet/card.php?leftmenu=projects&action=create&usage_organize_event=1&usage_opportunity=0',
254 'langs' =>
'eventorganization@eventorganization',
255 'position' => 1000 + $r,
256 'enabled' =>
'isModEnabled("eventorganization")',
257 'perms' =>
'$user->hasRight("project", "write")',
261 $this->menu[$r++] = array(
262 'fk_menu' =>
'fk_mainmenu=project,fk_leftmenu=eventorganization',
265 'url' =>
'/projet/list.php?search_usage_event_organization=1&search_status=99&mainmenu=project&contextpage=organizedevents',
266 'langs' =>
'eventorganization@eventorganization',
267 'position' => 1000 + $r,
268 'enabled' =>
'isModEnabled("eventorganization")',
269 'perms' =>
'$user->hasRight("project", "write")',
273 $this->menu[$r++] = array(
274 'fk_menu' =>
'fk_mainmenu=project',
276 'titre' =>
'ConferenceOrBooth',
277 'prefix' =>
img_picto(
'',
'conferenceorbooth',
'class="paddingright pictofixedwidth"'),
278 'mainmenu' =>
'project',
279 'leftmenu' =>
'eventorganizationconforbooth',
281 'langs' =>
'eventorganization',
282 'position' => 1000 + $r,
283 'enabled' =>
'isModEnabled("eventorganization")',
284 'perms' =>
'$user->hasRight("project", "read")',
288 $this->menu[$r++] = array(
289 'fk_menu' =>
'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth',
292 'url' =>
'/eventorganization/conferenceorbooth_card.php?leftmenu=projects&action=create',
293 'langs' =>
'eventorganization',
294 'position' => 1000 + $r,
295 'enabled' =>
'isModEnabled("eventorganization")',
296 'perms' =>
'$user->hasRight("project", "write")',
300 $this->menu[$r++] = array(
301 'fk_menu' =>
'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth',
304 'url' =>
'/eventorganization/conferenceorbooth_list.php?mainmenu=project',
305 'langs' =>
'eventorganization',
306 'position' => 1000 + $r,
307 'enabled' =>
'isModEnabled("eventorganization")',
308 'perms' =>
'$user->hasRight("project", "read")',
318 $langs->load(
"eventorganization");
319 $this->export_code[$r] = $this->rights_class.
'_'.$r;
320 $this->export_label[$r] =
'ListOfAttendeesOfEvent';
321 $this->export_icon[$r] = $this->picto;
323 $keyforclass =
'ConferenceOrBoothAttendee';
324 $keyforclassfile =
'/eventorganization/class/conferenceorboothattendee.class.php';
325 $keyforelement =
'conferenceorboothattendee';
326 include DOL_DOCUMENT_ROOT.
'/core/commonfieldsinexport.inc.php';
327 $this->export_entities_array[$r][
't.fk_invoice'] =
'invoice';
328 unset($this->export_fields_array[$r][
't.fk_project']);
329 unset($this->export_fields_array[$r][
't.fk_soc']);
330 $this->export_fields_array[$r][
't.fk_invoice'] =
'InvoiceId';
331 $this->export_fields_array[$r][
't.fk_project'] =
'ProjectId';
332 $this->export_fields_array[$r][
'p.ref'] =
'ProjectRef';
333 $this->export_fields_array[$r][
't.fk_soc'] =
'IdThirdParty';
334 $this->export_entities_array[$r][
't.fk_project'] =
'project';
335 $this->export_entities_array[$r][
'p.ref'] =
'project';
336 $this->export_entities_array[$r][
't.fk_soc'] =
'company';
337 $this->export_TypeFields_array[$r][
't.fk_project'] =
'Numeric';
338 $this->export_TypeFields_array[$r][
't.fk_invoice'] =
'Numeric';
339 $this->export_TypeFields_array[$r][
'p.ref'] =
'Text';
340 $this->export_TypeFields_array[$r][
't.fk_soc'] =
'Numeric';
343 $keyforselect =
'eventorganization_conferenceorboothattendee';
344 $keyforaliasextra =
'extra';
345 $keyforelement =
'conferenceorboothattendee';
346 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
351 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
352 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'eventorganization_conferenceorboothattendee as t';
353 $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').
')';
354 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'eventorganization_conferenceorboothattendee_extrafields as extra on t.rowid = extra.fk_object';
359 $langs->load(
"eventorganization");
360 $this->export_code[$r] = $this->rights_class.
'_'.$r;
361 $this->export_label[$r] =
'ListOfConfOrBoothOfEvent';
362 $this->export_icon[$r] =
'conferenceorbooth';
364 $keyforclass =
'ConferenceOrBooth';
365 $keyforclassfile =
'/eventorganization/class/conferenceorbooth.class.php';
366 $keyforelement =
'conferenceorbooth';
367 include DOL_DOCUMENT_ROOT.
'/core/commonfieldsinexport.inc.php';
368 unset($this->export_fields_array[$r][
't.fk_action']);
369 unset($this->export_fields_array[$r][
't.fk_project']);
370 unset($this->export_fields_array[$r][
't.fk_soc']);
371 $this->export_fields_array[$r][
't.fk_action'] =
'ConferenceOrBoothFormatID';
372 $this->export_fields_array[$r][
'ca.code'] =
'ConferenceOrBoothFormatCode';
373 $this->export_fields_array[$r][
'ca.libelle'] =
'ConferenceOrBoothFormatLabel';
374 $this->export_fields_array[$r][
't.fk_project'] =
'ProjectId';
375 $this->export_fields_array[$r][
'p.ref'] =
'ProjectRef';
376 $this->export_fields_array[$r][
't.fk_soc'] =
'IdThirdParty';
377 $this->export_fields_array[$r][
's.nom'] =
'ThirdPartyName';
378 $this->export_entities_array[$r][
'ca.code'] =
'conferenceorbooth';
379 $this->export_entities_array[$r][
'ca.libelle'] =
'conferenceorbooth';
380 $this->export_entities_array[$r][
't.fk_project'] =
'project';
381 $this->export_entities_array[$r][
'p.ref'] =
'project';
382 $this->export_entities_array[$r][
't.fk_soc'] =
'company';
383 $this->export_entities_array[$r][
's.nom'] =
'company';
384 $this->export_TypeFields_array[$r][
'ca.code'] =
'Text';
385 $this->export_TypeFields_array[$r][
'ca.libelle'] =
'Text';
386 $this->export_TypeFields_array[$r][
't.fk_project'] =
'Numeric';
387 $this->export_TypeFields_array[$r][
'p.ref'] =
'Text';
388 $this->export_TypeFields_array[$r][
't.fk_soc'] =
'Numeric';
389 $this->export_TypeFields_array[$r][
's.nom'] =
'Text';
392 $keyforselect =
'actioncomm';
393 $keyforaliasextra =
'extra';
394 $keyforelement =
'conferenceorbooth';
395 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
400 $this->export_sql_start[$r] =
"SELECT DISTINCT ";
401 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'actioncomm as t';
402 $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').
')';
403 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'c_actioncomm as ca ON ca.id = t.fk_action';
404 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s ON t.fk_soc = s.rowid';
405 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'actioncomm_extrafields as extra on t.id = extra.fk_object';
406 $this->export_sql_end[$r] .=
" WHERE t.code LIKE 'AC_EO_%'";
425 public function init($options =
'')
427 global $conf, $langs, $user;
437 $this->
remove($options);
442 $moduledir =
'eventorganization';
443 $myTmpObjects = array();
444 $myTmpObjects[
'ConferenceOrBooth'] = array(
'includerefgeneration' => 0,
'includedocgeneration' => 0);
446 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
447 if ($myTmpObjectArray[
'includerefgeneration']) {
448 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/eventorganization/template_conferenceorbooths.odt';
449 $dirodt = DOL_DATA_ROOT.
'/doctemplates/eventorganization';
450 $dest = $dirodt.
'/template_conferenceorbooths.odt';
452 if (file_exists($src) && !file_exists($dest)) {
453 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
455 $result =
dol_copy($src, $dest,
'0', 0);
457 $langs->load(
"errors");
458 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
463 $sql = array_merge($sql, array(
464 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".$this->db->escape(strtolower($myTmpObjectKey)).
"' AND entity = ".((
int) $conf->entity),
465 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".$this->db->escape(strtolower($myTmpObjectKey)).
"',".((
int) $conf->entity).
")",
466 "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),
467 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".$this->db->escape(strtolower($myTmpObjectKey)).
"', ".((
int) $conf->entity).
")"
472 $init = $this->
_init($sql, $options);
476 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
477 $formmail =
new FormMail($this->db);
479 include_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
480 if (!is_object($user)) {
481 $user =
new User($this->db);
484 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailAskConf)');
485 if ($template->id > 0) {
486 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF', $template->id,
'chaine', 0,
'', $conf->entity);
488 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailAskBooth)');
489 if ($template->id > 0) {
490 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH', $template->id,
'chaine', 0,
'', $conf->entity);
492 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailBoothPayment)');
493 if ($template->id > 0) {
494 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH', $template->id,
'chaine', 0,
'', $conf->entity);
496 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailRegistrationPayment)');
497 if ($template->id > 0) {
498 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT', $template->id,
'chaine', 0,
'', $conf->entity);