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 * 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(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
134 $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
135 //$this->automatic_activation = array('FR'=>'EventOrganizationWasAutomaticallyActivatedBecauseOfYourCountryChoice');
136 //$this->always_enabled = true; // If true, can't be disabled
137
138 // Constants
139 // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
140 // Example: $this->const=array(1 => array('EVENTORGANIZATION_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1),
141 // 2 => array('EVENTORGANIZATION_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
142 // );
143 $this->const = array(1 => array('EVENTORGANIZATION_TASK_LABEL', 'chaine', '', '', 0));
144
145
146
147 // Some keys to add into the overwriting translation tables
148 /*$this->overwrite_translation = array(
149 'en_US:ParentCompany'=>'Parent company or reseller',
150 'fr_FR:ParentCompany'=>'Maison mère ou revendeur'
151 )*/
152
153 if (!isset($conf->eventorganization) || !isset($conf->eventorganization->enabled)) {
154 $conf->eventorganization = new stdClass();
155 $conf->eventorganization->enabled = 0;
156 }
157
158 // Array to add new pages in new tabs
159 $this->tabs = array();
160 // Example:
161 // $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
162 // $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.
163 // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
164 //
165 // Where objecttype can be
166 // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
167 // 'contact' to add a tab in contact view
168 // 'contract' to add a tab in contract view
169 // 'group' to add a tab in group view
170 // 'intervention' to add a tab in intervention view
171 // 'invoice' to add a tab in customer invoice view
172 // 'invoice_supplier' to add a tab in supplier invoice view
173 // 'member' to add a tab in foundation member view
174 // 'opensurveypoll' to add a tab in opensurvey poll view
175 // 'order' to add a tab in sales order view
176 // 'order_supplier' to add a tab in supplier order view
177 // 'payment' to add a tab in payment view
178 // 'payment_supplier' to add a tab in supplier payment view
179 // 'product' to add a tab in product view
180 // 'propal' to add a tab in propal view
181 // 'project' to add a tab in project view
182 // 'stock' to add a tab in stock view
183 // 'thirdparty' to add a tab in third party view
184 // 'user' to add a tab in user view
185
186 // Dictionaries
187 $this->dictionaries = array();
188
189 // Boxes/Widgets
190 // Add here list of php file(s) stored in eventorganization/core/boxes that contains a class to show a widget.
191 $this->boxes = array(
192 // 0 => array(
193 // 'file' => 'eventorganizationwidget1.php@eventorganization',
194 // 'note' => 'Widget provided by EventOrganization',
195 // 'enabledbydefaulton' => 'Home',
196 // ),
197 // ...
198 );
199
200 // Cronjobs (List of cron jobs entries to add when module is enabled)
201 // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
202 $this->cronjobs = array(
203 );
204
205
206 // Permissions provided by this module
207 $this->rights = array();
208 $r = 1;
209
210 // Add here entries to declare new permissions
211 /* BEGIN MODULEBUILDER PERMISSIONS */
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 /* END MODULEBUILDER PERMISSIONS */
225
226 // Main menu entries to add
227 $this->menu = array();
228 $r = 0;
229 // Add here entries to declare new menus
230 /* BEGIN MODULEBUILDER TOPMENU */
231 /* END MODULEBUILDER TOPMENU */
232 /* BEGIN MODULEBUILDER LEFTMENU CONFERENCEORBOOTH*/
233 $this->menu[$r++] = array(
234 '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
235 'type' => 'left', // This is a Left menu entry
236 'titre' => 'EventOrganizationMenuLeft',
237 'prefix' => img_picto('', 'eventorganization', 'class="paddingright pictofixedwidth"'),
238 'mainmenu' => 'project',
239 'leftmenu' => 'eventorganization',
240 'url' => '',
241 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
242 'position' => 1000 + $r,
243 '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.
244 'perms' => '$user->hasRight("eventorganization", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
245 'target' => '',
246 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
247 );
248 $this->menu[$r++] = array(
249 '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
250 'type' => 'left', // This is a Left menu entry
251 'titre' => 'New',
252 'url' => '/projet/card.php?leftmenu=projects&action=create&usage_organize_event=1&usage_opportunity=0',
253 'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
254 'position' => 1000 + $r,
255 '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.
256 'perms' => '$user->hasRight("eventorganization", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
257 'target' => '',
258 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
259 );
260 $this->menu[$r++] = array(
261 '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
262 'type' => 'left', // This is a Left menu entry
263 'titre' => 'List',
264 'url' => '/projet/list.php?search_usage_event_organization=1&search_status=99&mainmenu=project&contextpage=organizedevents',
265 'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
266 'position' => 1000 + $r,
267 '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.
268 'perms' => '$user->hasRight("eventorganization", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
269 'target' => '',
270 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
271 );
272 $this->menu[$r++] = array(
273 '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
274 'type' => 'left', // This is a Left menu entry
275 'titre' => 'ConferenceOrBooth',
276 'prefix' => img_picto('', 'conferenceorbooth', 'class="paddingright pictofixedwidth"'),
277 'mainmenu' => 'project',
278 'leftmenu' => 'eventorganizationconforbooth',
279 'url' => '',
280 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
281 'position' => 1000 + $r,
282 '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.
283 'perms' => '$user->hasRight("eventorganization", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
284 'target' => '',
285 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
286 );
287 $this->menu[$r++] = array(
288 '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
289 'type' => 'left', // This is a Left menu entry
290 'titre' => 'New',
291 'url' => '/eventorganization/conferenceorbooth_card.php?leftmenu=projects&action=create',
292 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
293 'position' => 1000 + $r,
294 '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.
295 'perms' => '$user->hasRight("eventorganization", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
296 'target' => '',
297 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
298 );
299 $this->menu[$r++] = array(
300 '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
301 'type' => 'left', // This is a Left menu entry
302 'titre' => 'List',
303 'url' => '/eventorganization/conferenceorbooth_list.php?mainmenu=project',
304 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
305 'position' => 1000 + $r,
306 '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.
307 'perms' => '$user->hasRight("eventorganization", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
308 'target' => '',
309 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
310 );
311 /* END MODULEBUILDER LEFTMENU CONFERENCEORBOOTH */
312
313 // Exports profiles provided by this module
314 $r = 1;
315
316 /* BEGIN MODULEBUILDER EXPORT CONFERENCEORBOOTHATTENDEES */
317 $langs->load("eventorganization");
318 $this->export_code[$r] = $this->rights_class.'_'.$r;
319 $this->export_label[$r] = 'ListOfAttendeesOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found)
320 $this->export_icon[$r] = $this->picto;
321 // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array
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']); // Remove field so we can add it at end just after
328 unset($this->export_fields_array[$r]['t.fk_soc']); // Remove field so we can add it at end just after
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';
340 //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text';
341 //unset($this->export_fields_array[$r]['t.fieldtoremove']);
342 $keyforselect = 'conferenceorboothattendee';
343 $keyforaliasextra = 'extra';
344 $keyforelement = 'conferenceorboothattendee';
345 include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
346 //$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)
347 //$this->export_special_array[$r] = array('t.field'=>'...');
348 //$this->export_examplevalues_array[$r] = array('t.field'=>'Example');
349 //$this->export_help_array[$r] = array('t.field'=>'FieldDescHelp');
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').')';
354 $r++;
355 /* END MODULEBUILDER EXPORT CONFERENCEORBOOTHATTENDEES */
356
357 /* BEGIN MODULEBUILDER EXPORT CONFERENCEORBOOTH */
358 $langs->load("eventorganization");
359 $this->export_code[$r] = $this->rights_class.'_'.$r;
360 $this->export_label[$r] = 'ListOfConfOrBoothOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found)
361 $this->export_icon[$r] = 'conferenceorbooth';
362 // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array
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']); // Remove field so we can add it at end just after
368 unset($this->export_fields_array[$r]['t.fk_project']); // Remove field so we can add it at end just after
369 unset($this->export_fields_array[$r]['t.fk_soc']); // Remove field so we can add it at end just after
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';
389 //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text';
390 //unset($this->export_fields_array[$r]['t.fieldtoremove']);
391 $keyforselect = 'conferenceorbooth';
392 $keyforaliasextra = 'extra';
393 $keyforelement = 'conferenceorbooth';
394 include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
395 //$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)
396 //$this->export_special_array[$r] = array('t.field'=>'...');
397 //$this->export_examplevalues_array[$r] = array('t.field'=>'Example');
398 //$this->export_help_array[$r] = array('t.field'=>'FieldDescHelp');
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').')';
409 $r++;
410 /* END MODULEBUILDER EXPORT CONFERENCEORBOOTH */
411
412
413 // Imports profiles provided by this module
414 $r = 1;
415 /* BEGIN MODULEBUILDER IMPORT CONFERENCEORBOOTH */
416 /* END MODULEBUILDER IMPORT CONFERENCEORBOOTH */
417 }
418
427 public function init($options = '')
428 {
429 global $conf, $langs, $user;
430
431 /*$result = run_sql(DOL_DOCUMENT_ROOT.'/install/mysql/data/llx_c_email_templates.sql', 1, '', 1);
432 if ($result <= 0) {
433 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')
434 }
435 TODO Instead use the array merge of the sql found into llx_c_email_templates for this module
436 */
437
438 // Permissions
439 $this->remove($options);
440
441 $sql = array();
442
443 // Document templates
444 $moduledir = 'eventorganization';
445 $myTmpObjects = array();
446 $myTmpObjects['ConferenceOrBooth'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0);
447
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';
453
454 if (file_exists($src) && !file_exists($dest)) {
455 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
456 dol_mkdir($dirodt);
457 $result = dol_copy($src, $dest, '0', 0);
458 if ($result < 0) {
459 $langs->load("errors");
460 $this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest);
461 return 0;
462 }
463 }
464
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).")"
470 ));
471 }
472 }
473
474 $init = $this->_init($sql, $options);
475
476
477 // Insert some vars
478 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
479 $formmail = new FormMail($this->db);
480
481 include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
482 if (!is_object($user)) {
483 $user = new User($this->db); // To avoid error during migration
484 }
485
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);
489 }
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);
493 }
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);
497 }
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);
501 }
502
503 return $init;
504 }
505
514 public function remove($options = '')
515 {
516 $sql = array();
517 return $this->_remove($sql, $options);
518 }
519}
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:140