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';
321 $keyforclassfile=
'/eventorganization/class/conferenceorboothattendee.class.php';
322 $keyforelement=
'conferenceorboothattendee';
323 include DOL_DOCUMENT_ROOT.
'/core/commonfieldsinexport.inc.php';
324 $this->export_entities_array[$r][
't.fk_invoice'] =
'invoice';
325 unset($this->export_fields_array[$r][
't.fk_project']);
326 unset($this->export_fields_array[$r][
't.fk_soc']);
327 $this->export_fields_array[$r][
't.fk_invoice'] =
'InvoiceId';
328 $this->export_fields_array[$r][
't.fk_project'] =
'ProjectId';
329 $this->export_fields_array[$r][
'p.ref'] =
'ProjectRef';
330 $this->export_fields_array[$r][
't.fk_soc'] =
'IdThirdParty';
331 $this->export_entities_array[$r][
't.fk_project'] =
'project';
332 $this->export_entities_array[$r][
'p.ref'] =
'project';
333 $this->export_entities_array[$r][
't.fk_soc'] =
'company';
334 $this->export_TypeFields_array[$r][
't.fk_project'] =
'Numeric';
335 $this->export_TypeFields_array[$r][
't.fk_invoice'] =
'Numeric';
336 $this->export_TypeFields_array[$r][
'p.ref'] =
'Text';
337 $this->export_TypeFields_array[$r][
't.fk_soc'] =
'Numeric';
340 $keyforselect=
'conferenceorboothattendee';
341 $keyforaliasextra=
'extra';
342 $keyforelement=
'conferenceorboothattendee';
343 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
348 $this->export_sql_start[$r]=
'SELECT DISTINCT ';
349 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'eventorganization_conferenceorboothattendee as t, '.MAIN_DB_PREFIX.
'projet as p';
350 $this->export_sql_end[$r] .=
' WHERE t.fk_project = p.rowid';
351 $this->export_sql_end[$r] .=
' AND p.entity IN ('.getEntity(
'conferenceorboothattendee').
')';
430 public function init($options =
'')
432 global $conf, $langs, $user;
442 $this->
remove($options);
447 $moduledir =
'eventorganization';
448 $myTmpObjects = array();
449 $myTmpObjects[
'ConferenceOrBooth'] = array(
'includerefgeneration'=>0,
'includedocgeneration'=>0);
451 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
452 if ($myTmpObjectKey ==
'ConferenceOrBooth') {
455 if ($myTmpObjectArray[
'includerefgeneration']) {
456 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/eventorganization/template_conferenceorbooths.odt';
457 $dirodt = DOL_DATA_ROOT.
'/doctemplates/eventorganization';
458 $dest = $dirodt.
'/template_conferenceorbooths.odt';
460 if (file_exists($src) && !file_exists($dest)) {
461 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
463 $result =
dol_copy($src, $dest, 0, 0);
465 $langs->load(
"errors");
466 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
471 $sql = array_merge($sql, array(
472 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".$this->db->escape(strtolower($myTmpObjectKey)).
"' AND entity = ".((
int) $conf->entity),
473 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".$this->db->escape(strtolower($myTmpObjectKey)).
"',".((
int) $conf->entity).
")",
474 "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),
475 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".$this->db->escape(strtolower($myTmpObjectKey)).
"', ".((
int) $conf->entity).
")"
480 $init = $this->
_init($sql, $options);
484 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
485 $formmail =
new FormMail($this->db);
487 include_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
488 if (!is_object($user)) {
489 $user =
new User($this->db);
492 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailAskConf)');
493 if ($template->id > 0) {
494 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF', $template->id,
'chaine', 0,
'', $conf->entity);
496 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailAskBooth)');
497 if ($template->id > 0) {
498 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH', $template->id,
'chaine', 0,
'', $conf->entity);
500 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailBoothPayment)');
501 if ($template->id > 0) {
502 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH', $template->id,
'chaine', 0,
'', $conf->entity);
504 $template = $formmail->getEMailTemplate($this->db,
'conferenceorbooth', $user, $langs, 0, 1,
'(EventOrganizationEmailRegistrationPayment)');
505 if ($template->id > 0) {
506 dolibarr_set_const($this->db,
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT', $template->id,
'chaine', 0,
'', $conf->entity);