50 $this->rights_class =
'eventorganization';
52 $this->family =
"projects";
54 $this->module_position =
'15';
56 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
58 $this->
description =
"EventOrganizationDescription";
59 $this->descriptionlong =
"EventOrganizationDescriptionLong";
61 $this->version =
'dolibarr';
65 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
67 $this->picto =
'conferenceorbooth';
70 $this->module_parts = array(
106 'moduleforexternal' => 0,
111 $this->dirs = array(
"/eventorganization/temp");
114 $this->config_page_url = array(
"eventorganization.php");
118 $this->hidden =
false;
120 $this->depends = array(
'modProjet',
'modCategorie');
121 $this->requiredby = array();
122 $this->conflictwith = array();
125 $this->langfiles = array(
"eventorganization");
128 $this->phpmin = array(7, 0);
129 $this->need_dolibarr_version = array(13, -3);
132 $this->warnings_activation = array();
133 $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();
211 $this->rights[$r][0] = $this->numero + $r;
212 $this->rights[$r][1] =
'Read objects of EventOrganization';
213 $this->rights[$r][4] =
'read';
215 $this->rights[$r][0] = $this->numero + $r;
216 $this->rights[$r][1] =
'Create/Update objects of EventOrganization';
217 $this->rights[$r][4] =
'write';
219 $this->rights[$r][0] = $this->numero + $r;
220 $this->rights[$r][1] =
'Delete objects of EventOrganization';
221 $this->rights[$r][4] =
'delete';
226 $this->menu = array();
232 $this->menu[$r++] = array(
233 'fk_menu' =>
'fk_mainmenu=project',
235 'titre' =>
'EventOrganizationMenuLeft',
236 'prefix' =>
img_picto(
'',
'eventorganization',
'class="paddingright pictofixedwidth"'),
237 'mainmenu' =>
'project',
238 'leftmenu' =>
'eventorganization',
240 'langs' =>
'eventorganization',
241 'position' => 1000 + $r,
242 'enabled' =>
'isModEnabled("eventorganization")',
243 'perms' =>
'$user->hasRight("eventorganization", "read")',
247 $this->menu[$r++] = array(
248 'fk_menu' =>
'fk_mainmenu=project,fk_leftmenu=eventorganization',
251 'url' =>
'/projet/card.php?leftmenu=projects&action=create&usage_organize_event=1&usage_opportunity=0',
252 'langs' =>
'eventorganization@eventorganization',
253 'position' => 1000 + $r,
254 'enabled' =>
'isModEnabled("eventorganization")',
255 'perms' =>
'$user->hasRight("eventorganization", "write")',
259 $this->menu[$r++] = array(
260 'fk_menu' =>
'fk_mainmenu=project,fk_leftmenu=eventorganization',
263 'url' =>
'/projet/list.php?search_usage_event_organization=1&search_status=99&mainmenu=project&contextpage=organizedevents',
264 'langs' =>
'eventorganization@eventorganization',
265 'position' => 1000 + $r,
266 'enabled' =>
'isModEnabled("eventorganization")',
267 'perms' =>
'$user->hasRight("eventorganization", "write")',
271 $this->menu[$r++] = array(
272 'fk_menu' =>
'fk_mainmenu=project',
274 'titre' =>
'ConferenceOrBooth',
275 'prefix' =>
img_picto(
'',
'conferenceorbooth',
'class="paddingright pictofixedwidth"'),
276 'mainmenu' =>
'project',
277 'leftmenu' =>
'eventorganizationconforbooth',
279 'langs' =>
'eventorganization',
280 'position' => 1000 + $r,
281 'enabled' =>
'isModEnabled("eventorganization")',
282 'perms' =>
'$user->hasRight("eventorganization", "read")',
286 $this->menu[$r++] = array(
287 'fk_menu' =>
'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth',
290 'url' =>
'/eventorganization/conferenceorbooth_card.php?leftmenu=projects&action=create',
291 'langs' =>
'eventorganization',
292 'position' => 1000 + $r,
293 'enabled' =>
'isModEnabled("eventorganization")',
294 'perms' =>
'$user->hasRight("eventorganization", "write")',
298 $this->menu[$r++] = array(
299 'fk_menu' =>
'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth',
302 'url' =>
'/eventorganization/conferenceorbooth_list.php?mainmenu=project',
303 'langs' =>
'eventorganization',
304 'position' => 1000 + $r,
305 'enabled' =>
'isModEnabled("eventorganization")',
306 'perms' =>
'$user->hasRight("eventorganization", "read")',
316 $langs->load(
"eventorganization");
317 $this->export_code[$r] = $this->rights_class.
'_'.$r;
318 $this->export_label[$r] =
'ListOfAttendeesOfEvent';
319 $this->export_icon[$r] = $this->picto;
321 $keyforclass =
'ConferenceOrBoothAttendee';
322 $keyforclassfile =
'/eventorganization/class/conferenceorboothattendee.class.php';
323 $keyforelement =
'conferenceorboothattendee';
324 include DOL_DOCUMENT_ROOT.
'/core/commonfieldsinexport.inc.php';
325 $this->export_entities_array[$r][
't.fk_invoice'] =
'invoice';
326 unset($this->export_fields_array[$r][
't.fk_project']);
327 unset($this->export_fields_array[$r][
't.fk_soc']);
328 $this->export_fields_array[$r][
't.fk_invoice'] =
'InvoiceId';
329 $this->export_fields_array[$r][
't.fk_project'] =
'ProjectId';
330 $this->export_fields_array[$r][
'p.ref'] =
'ProjectRef';
331 $this->export_fields_array[$r][
't.fk_soc'] =
'IdThirdParty';
332 $this->export_entities_array[$r][
't.fk_project'] =
'project';
333 $this->export_entities_array[$r][
'p.ref'] =
'project';
334 $this->export_entities_array[$r][
't.fk_soc'] =
'company';
335 $this->export_TypeFields_array[$r][
't.fk_project'] =
'Numeric';
336 $this->export_TypeFields_array[$r][
't.fk_invoice'] =
'Numeric';
337 $this->export_TypeFields_array[$r][
'p.ref'] =
'Text';
338 $this->export_TypeFields_array[$r][
't.fk_soc'] =
'Numeric';
341 $keyforselect =
'conferenceorboothattendee';
342 $keyforaliasextra =
'extra';
343 $keyforelement =
'conferenceorboothattendee';
344 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
349 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
350 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'eventorganization_conferenceorboothattendee as t, '.MAIN_DB_PREFIX.
'projet as p';
351 $this->export_sql_end[$r] .=
' WHERE t.fk_project = p.rowid';
352 $this->export_sql_end[$r] .=
' AND p.entity IN ('.getEntity(
'conferenceorboothattendee').
')';
357 $langs->load(
"eventorganization");
358 $this->export_code[$r] = $this->rights_class.
'_'.$r;
359 $this->export_label[$r] =
'ListOfConfOrBoothOfEvent';
360 $this->export_icon[$r] =
'conferenceorbooth';
362 $keyforclass =
'ConferenceOrBooth';
363 $keyforclassfile =
'/eventorganization/class/conferenceorbooth.class.php';
364 $keyforelement =
'conferenceorbooth';
365 include DOL_DOCUMENT_ROOT.
'/core/commonfieldsinexport.inc.php';
366 unset($this->export_fields_array[$r][
't.fk_action']);
367 unset($this->export_fields_array[$r][
't.fk_project']);
368 unset($this->export_fields_array[$r][
't.fk_soc']);
369 $this->export_fields_array[$r][
't.fk_action'] =
'ConferenceOrBoothFormatID';
370 $this->export_fields_array[$r][
'ca.code'] =
'ConferenceOrBoothFormatCode';
371 $this->export_fields_array[$r][
'ca.libelle'] =
'ConferenceOrBoothFormatLabel';
372 $this->export_fields_array[$r][
't.fk_project'] =
'ProjectId';
373 $this->export_fields_array[$r][
'p.ref'] =
'ProjectRef';
374 $this->export_fields_array[$r][
't.fk_soc'] =
'IdThirdParty';
375 $this->export_fields_array[$r][
's.nom'] =
'ThirdPartyName';
376 $this->export_entities_array[$r][
'ca.code'] =
'conferenceorbooth';
377 $this->export_entities_array[$r][
'ca.libelle'] =
'conferenceorbooth';
378 $this->export_entities_array[$r][
't.fk_project'] =
'project';
379 $this->export_entities_array[$r][
'p.ref'] =
'project';
380 $this->export_entities_array[$r][
't.fk_soc'] =
'company';
381 $this->export_entities_array[$r][
's.nom'] =
'company';
382 $this->export_TypeFields_array[$r][
'ca.code'] =
'Text';
383 $this->export_TypeFields_array[$r][
'ca.libelle'] =
'Text';
384 $this->export_TypeFields_array[$r][
't.fk_project'] =
'Numeric';
385 $this->export_TypeFields_array[$r][
'p.ref'] =
'Text';
386 $this->export_TypeFields_array[$r][
't.fk_soc'] =
'Numeric';
387 $this->export_TypeFields_array[$r][
's.nom'] =
'Text';
390 $keyforselect =
'conferenceorbooth';
391 $keyforaliasextra =
'extra';
392 $keyforelement =
'conferenceorbooth';
393 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
398 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
399 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'actioncomm as t';
400 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s ON t.fk_soc = s.rowid,';
401 $this->export_sql_end[$r] .=
' '.MAIN_DB_PREFIX.
'projet as p,';
402 $this->export_sql_end[$r] .=
' '.MAIN_DB_PREFIX.
'c_actioncomm as ca';
403 $this->export_sql_end[$r] .=
' WHERE t.fk_project = p.rowid';
404 $this->export_sql_end[$r] .=
' AND ca.id = t.fk_action';
405 $this->export_sql_end[$r] .=
" AND t.code LIKE 'AC_EO_%'";
406 $this->export_sql_end[$r] .=
' AND p.usage_organize_event = 1';
407 $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);