dolibarr 21.0.0-alpha
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 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
27include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
28require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
29
36{
42 public function __construct($db)
43 {
44 global $conf, $langs;
45
46 $this->db = $db;
47
48 $this->numero = 2450;
49
50 $this->rights_class = 'eventorganization';
51
52 $this->family = "projects";
53
54 $this->module_position = '15';
55
56 $this->name = preg_replace('/^mod/i', '', get_class($this));
57
58 $this->description = "EventOrganizationDescription";
59 $this->descriptionlong = "EventOrganizationDescriptionLong";
60
61 $this->version = 'dolibarr';
62
63
64 // Key used in llx_const table to save module status enabled/disabled (where EVENTORGANIZATION is value of property name of module in uppercase)
65 $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
66
67 $this->picto = 'conferenceorbooth';
68
69 // Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
70 $this->module_parts = array(
71 // Set this to 1 if module has its own trigger directory (core/triggers)
72 'triggers' => 1,
73 // Set this to 1 if module has its own login method file (core/login)
74 'login' => 0,
75 // Set this to 1 if module has its own substitution function file (core/substitutions)
76 'substitutions' => 0,
77 // Set this to 1 if module has its own menus handler directory (core/menus)
78 'menus' => 0,
79 // Set this to 1 if module overwrite template dir (core/tpl)
80 'tpl' => 0,
81 // Set this to 1 if module has its own barcode directory (core/modules/barcode)
82 'barcode' => 0,
83 // Set this to 1 if module has its own models directory (core/modules/xxx)
84 'models' => 1,
85 // Set this to 1 if module has its own printing directory (core/modules/printing)
86 'printing' => 0,
87 // Set this to 1 if module has its own theme directory (theme)
88 'theme' => 0,
89 // Set this to relative path of css file if module has its own css file
90 'css' => array(
91 // '/eventorganization/css/eventorganization.css.php',
92 ),
93 // Set this to relative path of js file if module must load a js on all pages
94 'js' => array(
95 // '/eventorganization/js/eventorganization.js.php',
96 ),
97 // 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'
98 'hooks' => array(
99 // 'data' => array(
100 // 'hookcontext1',
101 // 'hookcontext2',
102 // ),
103 // 'entity' => '0',
104 ),
105 // Set this to 1 if features of module are opened to external users
106 'moduleforexternal' => 0,
107 );
108
109 // Data directories to create when module is enabled.
110 // Example: this->dirs = array("/eventorganization/temp","/eventorganization/subdir");
111 $this->dirs = array("/eventorganization/temp");
112
113 // Config pages. Put here list of php page, stored into eventorganization/admin directory, to use to setup module.
114 $this->config_page_url = array("eventorganization.php");
115
116 // Dependencies
117 // A condition to hide module
118 $this->hidden = false;
119 // 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'...))
120 $this->depends = array('modProjet', 'modCategorie', 'modAgenda');
121 $this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
122 $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
123
124 // The language file dedicated to your module
125 $this->langfiles = array("eventorganization");
126
127 // Prerequisites
128 $this->phpmin = array(7, 0); // Minimum version of PHP required by module
129 $this->need_dolibarr_version = array(13, -3); // Minimum version of Dolibarr required by module
130
131 // Messages at activation
132 $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
133 $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
134 //$this->automatic_activation = array('FR'=>'EventOrganizationWasAutomaticallyActivatedBecauseOfYourCountryChoice');
135 //$this->always_enabled = true; // If true, can't be disabled
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 $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
212 $this->rights[$r][1] = 'Read objects of EventOrganization'; // Permission label
213 $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1)
214 $r++;
215 $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
216 $this->rights[$r][1] = 'Create/Update objects of EventOrganization'; // Permission label
217 $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1)
218 $r++;
219 $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
220 $this->rights[$r][1] = 'Delete objects of EventOrganization'; // Permission label
221 $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->eventorganization->level1)
222 $r++;
223 /* END MODULEBUILDER PERMISSIONS */
224
225 // Main menu entries to add
226 $this->menu = array();
227 $r = 0;
228 // Add here entries to declare new menus
229 /* BEGIN MODULEBUILDER TOPMENU */
230 /* END MODULEBUILDER TOPMENU */
231 /* BEGIN MODULEBUILDER LEFTMENU CONFERENCEORBOOTH*/
232 $this->menu[$r++] = array(
233 '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
234 'type' => 'left', // This is a Left menu entry
235 'titre' => 'EventOrganizationMenuLeft',
236 'prefix' => img_picto('', 'eventorganization', 'class="paddingright pictofixedwidth"'),
237 'mainmenu' => 'project',
238 'leftmenu' => 'eventorganization',
239 'url' => '',
240 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
241 'position' => 1000 + $r,
242 '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.
243 'perms' => '$user->hasRight("eventorganization", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
244 'target' => '',
245 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
246 );
247 $this->menu[$r++] = array(
248 '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
249 'type' => 'left', // This is a Left menu entry
250 'titre' => 'New',
251 'url' => '/projet/card.php?leftmenu=projects&action=create&usage_organize_event=1&usage_opportunity=0',
252 'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
253 'position' => 1000 + $r,
254 '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.
255 'perms' => '$user->hasRight("eventorganization", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
256 'target' => '',
257 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
258 );
259 $this->menu[$r++] = array(
260 '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
261 'type' => 'left', // This is a Left menu entry
262 'titre' => 'List',
263 'url' => '/projet/list.php?search_usage_event_organization=1&search_status=99&mainmenu=project&contextpage=organizedevents',
264 'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
265 'position' => 1000 + $r,
266 '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.
267 'perms' => '$user->hasRight("eventorganization", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
268 'target' => '',
269 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
270 );
271 $this->menu[$r++] = array(
272 '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
273 'type' => 'left', // This is a Left menu entry
274 'titre' => 'ConferenceOrBooth',
275 'prefix' => img_picto('', 'conferenceorbooth', 'class="paddingright pictofixedwidth"'),
276 'mainmenu' => 'project',
277 'leftmenu' => 'eventorganizationconforbooth',
278 'url' => '',
279 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
280 'position' => 1000 + $r,
281 '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.
282 'perms' => '$user->hasRight("eventorganization", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
283 'target' => '',
284 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
285 );
286 $this->menu[$r++] = array(
287 '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
288 'type' => 'left', // This is a Left menu entry
289 'titre' => 'New',
290 'url' => '/eventorganization/conferenceorbooth_card.php?leftmenu=projects&action=create',
291 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
292 'position' => 1000 + $r,
293 '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.
294 'perms' => '$user->hasRight("eventorganization", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
295 'target' => '',
296 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
297 );
298 $this->menu[$r++] = array(
299 '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
300 'type' => 'left', // This is a Left menu entry
301 'titre' => 'List',
302 'url' => '/eventorganization/conferenceorbooth_list.php?mainmenu=project',
303 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
304 'position' => 1000 + $r,
305 '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.
306 'perms' => '$user->hasRight("eventorganization", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
307 'target' => '',
308 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
309 );
310 /* END MODULEBUILDER LEFTMENU CONFERENCEORBOOTH */
311
312 // Exports profiles provided by this module
313 $r = 1;
314
315 /* BEGIN MODULEBUILDER EXPORT CONFERENCEORBOOTHATTENDEES */
316 $langs->load("eventorganization");
317 $this->export_code[$r] = $this->rights_class.'_'.$r;
318 $this->export_label[$r] = 'ListOfAttendeesOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found)
319 $this->export_icon[$r] = $this->picto;
320 // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array
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']); // Remove field so we can add it at end just after
327 unset($this->export_fields_array[$r]['t.fk_soc']); // Remove field so we can add it at end just after
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';
339 //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text';
340 //unset($this->export_fields_array[$r]['t.fieldtoremove']);
341 $keyforselect = 'conferenceorboothattendee';
342 $keyforaliasextra = 'extra';
343 $keyforelement = 'conferenceorboothattendee';
344 include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
345 //$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)
346 //$this->export_special_array[$r] = array('t.field'=>'...');
347 //$this->export_examplevalues_array[$r] = array('t.field'=>'Example');
348 //$this->export_help_array[$r] = array('t.field'=>'FieldDescHelp');
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').')';
353 $r++;
354 /* END MODULEBUILDER EXPORT CONFERENCEORBOOTHATTENDEES */
355
356 /* BEGIN MODULEBUILDER EXPORT CONFERENCEORBOOTH */
357 $langs->load("eventorganization");
358 $this->export_code[$r] = $this->rights_class.'_'.$r;
359 $this->export_label[$r] = 'ListOfConfOrBoothOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found)
360 $this->export_icon[$r] = 'conferenceorbooth';
361 // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array
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']); // Remove field so we can add it at end just after
367 unset($this->export_fields_array[$r]['t.fk_project']); // Remove field so we can add it at end just after
368 unset($this->export_fields_array[$r]['t.fk_soc']); // Remove field so we can add it at end just after
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';
388 //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text';
389 //unset($this->export_fields_array[$r]['t.fieldtoremove']);
390 $keyforselect = 'conferenceorbooth';
391 $keyforaliasextra = 'extra';
392 $keyforelement = 'conferenceorbooth';
393 include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
394 //$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)
395 //$this->export_special_array[$r] = array('t.field'=>'...');
396 //$this->export_examplevalues_array[$r] = array('t.field'=>'Example');
397 //$this->export_help_array[$r] = array('t.field'=>'FieldDescHelp');
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').')';
408 $r++;
409 /* END MODULEBUILDER EXPORT CONFERENCEORBOOTH */
410
411
412 // Imports profiles provided by this module
413 $r = 1;
414 /* BEGIN MODULEBUILDER IMPORT CONFERENCEORBOOTH */
415 /* END MODULEBUILDER IMPORT CONFERENCEORBOOTH */
416 }
417
426 public function init($options = '')
427 {
428 global $conf, $langs, $user;
429
430 /*$result = run_sql(DOL_DOCUMENT_ROOT.'/install/mysql/data/llx_c_email_templates.sql', 1, '', 1);
431 if ($result <= 0) {
432 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')
433 }
434 TODO Instead use the array merge of the sql found into llx_c_email_templates for this module
435 */
436
437 // Permissions
438 $this->remove($options);
439
440 $sql = array();
441
442 // Document templates
443 $moduledir = 'eventorganization';
444 $myTmpObjects = array();
445 $myTmpObjects['ConferenceOrBooth'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0);
446
447 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
448 if ($myTmpObjectKey == 'ConferenceOrBooth') {
449 continue;
450 }
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';
455
456 if (file_exists($src) && !file_exists($dest)) {
457 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
458 dol_mkdir($dirodt);
459 $result = dol_copy($src, $dest, 0, 0);
460 if ($result < 0) {
461 $langs->load("errors");
462 $this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest);
463 return 0;
464 }
465 }
466
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).")"
472 ));
473 }
474 }
475
476 $init = $this->_init($sql, $options);
477
478
479 // Insert some vars
480 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
481 $formmail = new FormMail($this->db);
482
483 include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
484 if (!is_object($user)) {
485 $user = new User($this->db); // To avoid error during migration
486 }
487
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);
491 }
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);
495 }
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);
499 }
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);
503 }
504
505 return $init;
506 }
507
516 public function remove($options = '')
517 {
518 $sql = array();
519 return $this->_remove($sql, $options);
520 }
521}
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)
Show picto whatever it's its name (generic function)
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:142