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();
143 $this->
const = array(1 => array(
'EVENTORGANIZATION_TASK_LABEL',
'chaine',
'',
'', 0));
153 if (!isset($conf->eventorganization) || !isset($conf->eventorganization->enabled)) {
154 $conf->eventorganization =
new stdClass();
155 $conf->eventorganization->enabled = 0;
159 $this->tabs = array();
187 $this->dictionaries = array();
191 $this->boxes = array(
202 $this->cronjobs = array(
207 $this->rights = array();
212 $this->rights[$r][0] = $this->numero + $r;
213 $this->rights[$r][1] =
'Read objects of EventOrganization';
214 $this->rights[$r][4] =
'read';
216 $this->rights[$r][0] = $this->numero + $r;
217 $this->rights[$r][1] =
'Create/Update objects of EventOrganization';
218 $this->rights[$r][4] =
'write';
220 $this->rights[$r][0] = $this->numero + $r;
221 $this->rights[$r][1] =
'Delete objects of EventOrganization';
222 $this->rights[$r][4] =
'delete';
227 $this->menu = array();
233 $this->menu[$r++] = array(
234 'fk_menu' =>
'fk_mainmenu=project',
236 'titre' =>
'EventOrganizationMenuLeft',
237 'prefix' =>
img_picto(
'',
'eventorganization',
'class="paddingright pictofixedwidth"'),
238 'mainmenu' =>
'project',
239 'leftmenu' =>
'eventorganization',
241 'langs' =>
'eventorganization',
242 'position' => 1000 + $r,
243 'enabled' =>
'isModEnabled("eventorganization")',
244 'perms' =>
'$user->hasRight("eventorganization", "read")',
248 $this->menu[$r++] = array(
249 'fk_menu' =>
'fk_mainmenu=project,fk_leftmenu=eventorganization',
252 'url' =>
'/projet/card.php?leftmenu=projects&action=create&usage_organize_event=1&usage_opportunity=0',
253 'langs' =>
'eventorganization@eventorganization',
254 'position' => 1000 + $r,
255 'enabled' =>
'isModEnabled("eventorganization")',
256 'perms' =>
'$user->hasRight("eventorganization", "write")',
260 $this->menu[$r++] = array(
261 'fk_menu' =>
'fk_mainmenu=project,fk_leftmenu=eventorganization',
264 'url' =>
'/projet/list.php?search_usage_event_organization=1&search_status=99&mainmenu=project&contextpage=organizedevents',
265 'langs' =>
'eventorganization@eventorganization',
266 'position' => 1000 + $r,
267 'enabled' =>
'isModEnabled("eventorganization")',
268 'perms' =>
'$user->hasRight("eventorganization", "write")',
272 $this->menu[$r++] = array(
273 'fk_menu' =>
'fk_mainmenu=project',
275 'titre' =>
'ConferenceOrBooth',
276 'prefix' =>
img_picto(
'',
'conferenceorbooth',
'class="paddingright pictofixedwidth"'),
277 'mainmenu' =>
'project',
278 'leftmenu' =>
'eventorganizationconforbooth',
280 'langs' =>
'eventorganization',
281 'position' => 1000 + $r,
282 'enabled' =>
'isModEnabled("eventorganization")',
283 'perms' =>
'$user->hasRight("eventorganization", "read")',
287 $this->menu[$r++] = array(
288 'fk_menu' =>
'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth',
291 'url' =>
'/eventorganization/conferenceorbooth_card.php?leftmenu=projects&action=create',
292 'langs' =>
'eventorganization',
293 'position' => 1000 + $r,
294 'enabled' =>
'isModEnabled("eventorganization")',
295 'perms' =>
'$user->hasRight("eventorganization", "write")',
299 $this->menu[$r++] = array(
300 'fk_menu' =>
'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth',
303 'url' =>
'/eventorganization/conferenceorbooth_list.php?mainmenu=project',
304 'langs' =>
'eventorganization',
305 'position' => 1000 + $r,
306 'enabled' =>
'isModEnabled("eventorganization")',
307 'perms' =>
'$user->hasRight("eventorganization", "read")',
317 $langs->load(
"eventorganization");
318 $this->export_code[$r] = $this->rights_class.
'_'.$r;
319 $this->export_label[$r] =
'ListOfAttendeesOfEvent';
320 $this->export_icon[$r] = $this->picto;
322 $keyforclass =
'ConferenceOrBoothAttendee';
323 $keyforclassfile =
'/eventorganization/class/conferenceorboothattendee.class.php';
324 $keyforelement =
'conferenceorboothattendee';
325 include DOL_DOCUMENT_ROOT.
'/core/commonfieldsinexport.inc.php';
326 $this->export_entities_array[$r][
't.fk_invoice'] =
'invoice';
327 unset($this->export_fields_array[$r][
't.fk_project']);
328 unset($this->export_fields_array[$r][
't.fk_soc']);
329 $this->export_fields_array[$r][
't.fk_invoice'] =
'InvoiceId';
330 $this->export_fields_array[$r][
't.fk_project'] =
'ProjectId';
331 $this->export_fields_array[$r][
'p.ref'] =
'ProjectRef';
332 $this->export_fields_array[$r][
't.fk_soc'] =
'IdThirdParty';
333 $this->export_entities_array[$r][
't.fk_project'] =
'project';
334 $this->export_entities_array[$r][
'p.ref'] =
'project';
335 $this->export_entities_array[$r][
't.fk_soc'] =
'company';
336 $this->export_TypeFields_array[$r][
't.fk_project'] =
'Numeric';
337 $this->export_TypeFields_array[$r][
't.fk_invoice'] =
'Numeric';
338 $this->export_TypeFields_array[$r][
'p.ref'] =
'Text';
339 $this->export_TypeFields_array[$r][
't.fk_soc'] =
'Numeric';
342 $keyforselect =
'conferenceorboothattendee';
343 $keyforaliasextra =
'extra';
344 $keyforelement =
'conferenceorboothattendee';
345 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
350 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
351 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'eventorganization_conferenceorboothattendee as t, '.MAIN_DB_PREFIX.
'projet as p';
352 $this->export_sql_end[$r] .=
' WHERE t.fk_project = p.rowid';
353 $this->export_sql_end[$r] .=
' AND p.entity IN ('.getEntity(
'conferenceorboothattendee').
')';
358 $langs->load(
"eventorganization");
359 $this->export_code[$r] = $this->rights_class.
'_'.$r;
360 $this->export_label[$r] =
'ListOfConfOrBoothOfEvent';
361 $this->export_icon[$r] =
'conferenceorbooth';
363 $keyforclass =
'ConferenceOrBooth';
364 $keyforclassfile =
'/eventorganization/class/conferenceorbooth.class.php';
365 $keyforelement =
'conferenceorbooth';
366 include DOL_DOCUMENT_ROOT.
'/core/commonfieldsinexport.inc.php';
367 unset($this->export_fields_array[$r][
't.fk_action']);
368 unset($this->export_fields_array[$r][
't.fk_project']);
369 unset($this->export_fields_array[$r][
't.fk_soc']);
370 $this->export_fields_array[$r][
't.fk_action'] =
'ConferenceOrBoothFormatID';
371 $this->export_fields_array[$r][
'ca.code'] =
'ConferenceOrBoothFormatCode';
372 $this->export_fields_array[$r][
'ca.libelle'] =
'ConferenceOrBoothFormatLabel';
373 $this->export_fields_array[$r][
't.fk_project'] =
'ProjectId';
374 $this->export_fields_array[$r][
'p.ref'] =
'ProjectRef';
375 $this->export_fields_array[$r][
't.fk_soc'] =
'IdThirdParty';
376 $this->export_fields_array[$r][
's.nom'] =
'ThirdPartyName';
377 $this->export_entities_array[$r][
'ca.code'] =
'conferenceorbooth';
378 $this->export_entities_array[$r][
'ca.libelle'] =
'conferenceorbooth';
379 $this->export_entities_array[$r][
't.fk_project'] =
'project';
380 $this->export_entities_array[$r][
'p.ref'] =
'project';
381 $this->export_entities_array[$r][
't.fk_soc'] =
'company';
382 $this->export_entities_array[$r][
's.nom'] =
'company';
383 $this->export_TypeFields_array[$r][
'ca.code'] =
'Text';
384 $this->export_TypeFields_array[$r][
'ca.libelle'] =
'Text';
385 $this->export_TypeFields_array[$r][
't.fk_project'] =
'Numeric';
386 $this->export_TypeFields_array[$r][
'p.ref'] =
'Text';
387 $this->export_TypeFields_array[$r][
't.fk_soc'] =
'Numeric';
388 $this->export_TypeFields_array[$r][
's.nom'] =
'Text';
391 $keyforselect =
'conferenceorbooth';
392 $keyforaliasextra =
'extra';
393 $keyforelement =
'conferenceorbooth';
394 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
399 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
400 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'actioncomm as t';
401 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s ON t.fk_soc = s.rowid,';
402 $this->export_sql_end[$r] .=
' '.MAIN_DB_PREFIX.
'projet as p,';
403 $this->export_sql_end[$r] .=
' '.MAIN_DB_PREFIX.
'c_actioncomm as ca';
404 $this->export_sql_end[$r] .=
' WHERE t.fk_project = p.rowid';
405 $this->export_sql_end[$r] .=
' AND ca.id = t.fk_action';
406 $this->export_sql_end[$r] .=
" AND t.code LIKE 'AC_EO_%'";
407 $this->export_sql_end[$r] .=
' AND p.usage_organize_event = 1';
408 $this->export_sql_end[$r] .=
' AND p.entity IN ('.getEntity(
'conferenceorboothattendee').
')';
427 public function init($options =
'')
429 global $conf, $langs, $user;
439 $this->
remove($options);
444 $moduledir =
'eventorganization';
445 $myTmpObjects = array();
446 $myTmpObjects[
'ConferenceOrBooth'] = array(
'includerefgeneration' => 0,
'includedocgeneration' => 0);
448 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
449 if ($myTmpObjectArray[
'includerefgeneration']) {
450 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/eventorganization/template_conferenceorbooths.odt';
451 $dirodt = DOL_DATA_ROOT.
'/doctemplates/eventorganization';
452 $dest = $dirodt.
'/template_conferenceorbooths.odt';
454 if (file_exists($src) && !file_exists($dest)) {
455 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
457 $result =
dol_copy($src, $dest,
'0', 0);
459 $langs->load(
"errors");
460 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
465 $sql = array_merge($sql, array(
466 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".$this->db->escape(strtolower($myTmpObjectKey)).
"' AND entity = ".((
int) $conf->entity),
467 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".$this->db->escape(strtolower($myTmpObjectKey)).
"',".((
int) $conf->entity).
")",
468 "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),
469 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".$this->db->escape(strtolower($myTmpObjectKey)).
"', ".((
int) $conf->entity).
")"
474 $init = $this->
_init($sql, $options);
478 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
479 $formmail =
new FormMail($this->db);
481 include_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
482 if (!is_object($user)) {
483 $user =
new User($this->db);
486 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailAskConf)');
487 if ($template->id > 0) {
488 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF', $template->id,
'chaine', 0,
'', $conf->entity);
490 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailAskBooth)');
491 if ($template->id > 0) {
492 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH', $template->id,
'chaine', 0,
'', $conf->entity);
494 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailBoothPayment)');
495 if ($template->id > 0) {
496 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH', $template->id,
'chaine', 0,
'', $conf->entity);
498 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailRegistrationPayment)');
499 if ($template->id > 0) {
500 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT', $template->id,
'chaine', 0,
'', $conf->entity);