dolibarr 23.0.3
modEventOrganization.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2021 Florian Henry <florian.henry@scopen.fr>
3 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
4 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
28include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
29require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
30
37{
43 public function __construct($db)
44 {
45 global $conf, $langs;
46
47 $this->db = $db;
48
49 $this->numero = 2450;
50
51 $this->rights_class = 'eventorganization';
52
53 $this->family = "projects";
54
55 $this->module_position = '15';
56
57 $this->name = preg_replace('/^mod/i', '', get_class($this));
58
59 $this->description = "EventOrganizationDescription";
60 $this->descriptionlong = "EventOrganizationDescriptionLong";
61
62 $this->version = 'dolibarr';
63
64
65 // Key used in llx_const table to save module status enabled/disabled (where EVENTORGANIZATION is value of property name of module in uppercase)
66 $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
67
68 $this->picto = 'conferenceorbooth';
69
70 // Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
71 $this->module_parts = array(
72 // Set this to 1 if module has its own trigger directory (core/triggers)
73 'triggers' => 1,
74 // Set this to 1 if module has its own login method file (core/login)
75 'login' => 0,
76 // Set this to 1 if module has its own substitution function file (core/substitutions)
77 'substitutions' => 0,
78 // Set this to 1 if module has its own menus handler directory (core/menus)
79 'menus' => 0,
80 // Set this to 1 if module overwrite template dir (core/tpl)
81 'tpl' => 0,
82 // Set this to 1 if module has its own barcode directory (core/modules/barcode)
83 'barcode' => 0,
84 // Set this to 1 if module has its own models directory (core/modules/xxx)
85 'models' => 1,
86 // Set this to 1 if module has its own printing directory (core/modules/printing)
87 'printing' => 0,
88 // Set this to 1 if module has its own theme directory (theme)
89 'theme' => 0,
90 // Set this to relative path of css file if module has its own css file
91 'css' => array(
92 // '/eventorganization/css/eventorganization.css.php',
93 ),
94 // Set this to relative path of js file if module must load a js on all pages
95 'js' => array(
96 // '/eventorganization/js/eventorganization.js.php',
97 ),
98 // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context to 'all'
99 'hooks' => array(
100 // 'data' => array(
101 // 'hookcontext1',
102 // 'hookcontext2',
103 // ),
104 // 'entity' => '0',
105 ),
106 // Set this to 1 if features of module are opened to external users
107 'moduleforexternal' => 0,
108 );
109
110 // Data directories to create when module is enabled.
111 // Example: this->dirs = array("/eventorganization/temp","/eventorganization/subdir");
112 $this->dirs = array("/eventorganization/temp");
113
114 // Config pages. Put here list of php page, stored into eventorganization/admin directory, to use to setup module.
115 $this->config_page_url = array("eventorganization.php");
116
117 // Dependencies
118 // A condition to hide module
119 $this->hidden = false;
120 // List of module class names as string that must be enabled if this module is enabled. Example: array('always'=>array('modModuleToEnable1','modModuleToEnable2'), 'FR'=>array('modModuleToEnableFR'...))
121 $this->depends = array('modProjet', 'modCategorie', 'modAgenda');
122 $this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
123 $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
124
125 // The language file dedicated to your module
126 $this->langfiles = array("eventorganization");
127
128 // Prerequisites
129 $this->phpmin = array(7, 0); // Minimum version of PHP required by module
130 $this->need_dolibarr_version = array(13, -3); // Minimum version of Dolibarr required by module
131
132 // Messages at activation
133 $this->warnings_activation = array();
134 $this->warnings_activation_ext = array();
135 //$this->automatic_activation = array('FR'=>'EventOrganizationWasAutomaticallyActivatedBecauseOfYourCountryChoice');
136
137 // Constants
138 // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
139 // Example: $this->const=array(1 => array('EVENTORGANIZATION_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1),
140 // 2 => array('EVENTORGANIZATION_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
141 // );
142 $this->const = array(1 => array('EVENTORGANIZATION_TASK_LABEL', 'chaine', '', '', 0));
143
144
145
146 // Some keys to add into the overwriting translation tables
147 /*$this->overwrite_translation = array(
148 'en_US:ParentCompany'=>'Parent company or reseller',
149 'fr_FR:ParentCompany'=>'Maison mère ou revendeur'
150 )*/
151
152 if (!isset($conf->eventorganization) || !isset($conf->eventorganization->enabled)) {
153 $conf->eventorganization = new stdClass();
154 $conf->eventorganization->enabled = 0;
155 }
156
157 // Array to add new pages in new tabs
158 $this->tabs = array();
159 // Example:
160 // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@eventorganization:$user->rights->eventorganization->read:/eventorganization/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1
161 // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@eventorganization:$user->rights->othermodule->read:/eventorganization/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
162 // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
163 //
164 // Where objecttype can be
165 // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
166 // 'contact' to add a tab in contact view
167 // 'contract' to add a tab in contract view
168 // 'group' to add a tab in group view
169 // 'intervention' to add a tab in intervention view
170 // 'invoice' to add a tab in customer invoice view
171 // 'invoice_supplier' to add a tab in supplier invoice view
172 // 'member' to add a tab in foundation member view
173 // 'opensurveypoll' to add a tab in opensurvey poll view
174 // 'order' to add a tab in sales order view
175 // 'order_supplier' to add a tab in supplier order view
176 // 'payment' to add a tab in payment view
177 // 'payment_supplier' to add a tab in supplier payment view
178 // 'product' to add a tab in product view
179 // 'propal' to add a tab in propal view
180 // 'project' to add a tab in project view
181 // 'stock' to add a tab in stock view
182 // 'thirdparty' to add a tab in third party view
183 // 'user' to add a tab in user view
184
185 // Dictionaries
186 $this->dictionaries = array();
187
188 // Boxes/Widgets
189 // Add here list of php file(s) stored in eventorganization/core/boxes that contains a class to show a widget.
190 $this->boxes = array(
191 // 0 => array(
192 // 'file' => 'eventorganizationwidget1.php@eventorganization',
193 // 'note' => 'Widget provided by EventOrganization',
194 // 'enabledbydefaulton' => 'Home',
195 // ),
196 // ...
197 );
198
199 // Cronjobs (List of cron jobs entries to add when module is enabled)
200 // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
201 $this->cronjobs = array(
202 );
203
204
205 // Permissions provided by this module
206 $this->rights = array();
207 $r = 1;
208
209 // Add here entries to declare new permissions
210 /* BEGIN MODULEBUILDER PERMISSIONS */
211 /*
212 $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
213 $this->rights[$r][1] = 'Read objects of EventOrganization'; // Permission label
214 $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1)
215 $r++;
216 $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
217 $this->rights[$r][1] = 'Create/Update objects of EventOrganization'; // Permission label
218 $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1)
219 $r++;
220 $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
221 $this->rights[$r][1] = 'Delete objects of EventOrganization'; // Permission label
222 $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1)
223 $r++;
224 */
225 /* END MODULEBUILDER PERMISSIONS */
226
227 // Main menu entries to add
228 $this->menu = array();
229 $r = 0;
230 // Add here entries to declare new menus
231 /* BEGIN MODULEBUILDER TOPMENU */
232 /* END MODULEBUILDER TOPMENU */
233 /* BEGIN MODULEBUILDER LEFTMENU CONFERENCEORBOOTH*/
234 $this->menu[$r++] = array(
235 'fk_menu' => 'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
236 'type' => 'left', // This is a Left menu entry
237 'titre' => 'EventOrganizationMenuLeft',
238 'prefix' => img_picto('', 'eventorganization', 'class="paddingright pictofixedwidth"'),
239 'mainmenu' => 'project',
240 'leftmenu' => 'eventorganization',
241 'url' => '',
242 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
243 'position' => 1000 + $r,
244 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
245 'perms' => '$user->hasRight("project", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
246 'target' => '',
247 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
248 );
249 $this->menu[$r++] = array(
250 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
251 'type' => 'left', // This is a Left menu entry
252 'titre' => 'New',
253 'url' => '/projet/card.php?leftmenu=projects&action=create&usage_organize_event=1&usage_opportunity=0',
254 'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
255 'position' => 1000 + $r,
256 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
257 'perms' => '$user->hasRight("project", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
258 'target' => '',
259 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
260 );
261 $this->menu[$r++] = array(
262 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
263 'type' => 'left', // This is a Left menu entry
264 'titre' => 'List',
265 'url' => '/projet/list.php?search_usage_event_organization=1&search_status=99&mainmenu=project&contextpage=organizedevents',
266 'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
267 'position' => 1000 + $r,
268 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
269 'perms' => '$user->hasRight("project", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
270 'target' => '',
271 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
272 );
273 $this->menu[$r++] = array(
274 'fk_menu' => 'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
275 'type' => 'left', // This is a Left menu entry
276 'titre' => 'ConferenceOrBooth',
277 'prefix' => img_picto('', 'conferenceorbooth', 'class="paddingright pictofixedwidth"'),
278 'mainmenu' => 'project',
279 'leftmenu' => 'eventorganizationconforbooth',
280 'url' => '',
281 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
282 'position' => 1000 + $r,
283 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
284 'perms' => '$user->hasRight("project", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
285 'target' => '',
286 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
287 );
288 $this->menu[$r++] = array(
289 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
290 'type' => 'left', // This is a Left menu entry
291 'titre' => 'New',
292 'url' => '/eventorganization/conferenceorbooth_card.php?leftmenu=projects&action=create',
293 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
294 'position' => 1000 + $r,
295 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
296 'perms' => '$user->hasRight("project", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
297 'target' => '',
298 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
299 );
300 $this->menu[$r++] = array(
301 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
302 'type' => 'left', // This is a Left menu entry
303 'titre' => 'List',
304 'url' => '/eventorganization/conferenceorbooth_list.php?mainmenu=project',
305 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
306 'position' => 1000 + $r,
307 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
308 'perms' => '$user->hasRight("project", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
309 'target' => '',
310 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
311 );
312 /* END MODULEBUILDER LEFTMENU CONFERENCEORBOOTH */
313
314 // Exports profiles provided by this module
315 $r = 1;
316
317 /* BEGIN MODULEBUILDER EXPORT CONFERENCEORBOOTHATTENDEES */
318 $langs->load("eventorganization");
319 $this->export_code[$r] = $this->rights_class.'_'.$r;
320 $this->export_label[$r] = 'ListOfAttendeesOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found)
321 $this->export_icon[$r] = $this->picto;
322 // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array
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']); // Remove field so we can add it at end just after
329 unset($this->export_fields_array[$r]['t.fk_soc']); // Remove field so we can add it at end just after
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';
341 //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text';
342 //unset($this->export_fields_array[$r]['t.fieldtoremove']);
343 $keyforselect = 'eventorganization_conferenceorboothattendee'; // The value in column elementtype of llx_extrafields table
344 $keyforaliasextra = 'extra';
345 $keyforelement = 'conferenceorboothattendee'; // The value of key for icon and class
346 include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
347 //$this->export_dependencies_array[$r] = array('aaaline'=>array('tl.rowid','tl.ref')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
348 //$this->export_special_array[$r] = array('t.field'=>'...');
349 //$this->export_examplevalues_array[$r] = array('t.field'=>'Example');
350 //$this->export_help_array[$r] = array('t.field'=>'FieldDescHelp');
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';
355 $r++;
356 /* END MODULEBUILDER EXPORT CONFERENCEORBOOTHATTENDEES */
357
358 /* BEGIN MODULEBUILDER EXPORT CONFERENCEORBOOTH */
359 $langs->load("eventorganization");
360 $this->export_code[$r] = $this->rights_class.'_'.$r;
361 $this->export_label[$r] = 'ListOfConfOrBoothOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found)
362 $this->export_icon[$r] = 'conferenceorbooth';
363 // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array
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']); // Remove field so we can add it at end just after
369 unset($this->export_fields_array[$r]['t.fk_project']); // Remove field so we can add it at end just after
370 unset($this->export_fields_array[$r]['t.fk_soc']); // Remove field so we can add it at end just after
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';
390 //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text';
391 //unset($this->export_fields_array[$r]['t.fieldtoremove']);
392 $keyforselect = 'actioncomm'; // The value in column elementtype of llx_extrafields table
393 $keyforaliasextra = 'extra';
394 $keyforelement = 'conferenceorbooth';
395 include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
396 //$this->export_dependencies_array[$r] = array('aaaline'=>array('tl.rowid','tl.ref')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
397 //$this->export_special_array[$r] = array('t.field'=>'...');
398 //$this->export_examplevalues_array[$r] = array('t.field'=>'Example');
399 //$this->export_help_array[$r] = array('t.field'=>'FieldDescHelp');
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_%'";
407 $r++;
408 /* END MODULEBUILDER EXPORT CONFERENCEORBOOTH */
409
410
411 // Imports profiles provided by this module
412 $r = 1;
413 /* BEGIN MODULEBUILDER IMPORT CONFERENCEORBOOTH */
414 /* END MODULEBUILDER IMPORT CONFERENCEORBOOTH */
415 }
416
425 public function init($options = '')
426 {
427 global $conf, $langs, $user;
428
429 /*$result = run_sql(DOL_DOCUMENT_ROOT.'/install/mysql/data/llx_c_email_templates.sql', 1, '', 1);
430 if ($result <= 0) {
431 return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
432 }
433 TODO Instead use the array merge of the sql found into llx_c_email_templates for this module
434 */
435
436 // Permissions
437 $this->remove($options);
438
439 $sql = array();
440
441 // Document templates
442 $moduledir = 'eventorganization';
443 $myTmpObjects = array();
444 $myTmpObjects['ConferenceOrBooth'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0);
445
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';
451
452 if (file_exists($src) && !file_exists($dest)) {
453 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
454 dol_mkdir($dirodt);
455 $result = dol_copy($src, $dest, '0', 0);
456 if ($result < 0) {
457 $langs->load("errors");
458 $this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest);
459 return 0;
460 }
461 }
462
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).")"
468 ));
469 }
470 }
471
472 $init = $this->_init($sql, $options);
473
474
475 // Insert some vars
476 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
477 $formmail = new FormMail($this->db);
478
479 include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
480 if (!is_object($user)) {
481 $user = new User($this->db); // To avoid error during migration
482 }
483
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);
487 }
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);
491 }
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);
495 }
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);
499 }
500
501 return $init;
502 }
503
512 public function remove($options = '')
513 {
514 $sql = array();
515 return $this->_remove($sql, $options);
516 }
517}
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Class DolibarrModules.
_init($array_sql, $options='')
Enables a module.
_remove($array_sql, $options='')
Disable function.
Class permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new Form...
Class to manage Dolibarr users.
Description and activation class for module EventOrganization This module is base on this specificati...
init($options='')
Function called when module is enabled.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_copy($srcfile, $destfile, $newmask='0', $overwriteifexists=1, $testvirus=0, $indexdatabase=0)
Copy a file to another file.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:128