25 require
'../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/eventorganization.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
35 $langs->loadLangs(array(
"admin",
"eventorganization",
"categories"));
38 $action =
GETPOST(
'action',
'aZ09');
39 $cancel =
GETPOST(
'cancel',
'aZ09');
40 $backtopage =
GETPOST(
'backtopage',
'alpha');
42 $value =
GETPOST(
'value',
'alpha');
43 $label =
GETPOST(
'label',
'alpha');
44 $modulepart =
GETPOST(
'modulepart',
'aZ09');
46 $scandir =
GETPOST(
'scan_dir',
'alpha');
49 $arrayofparameters = array(
50 'EVENTORGANIZATION_TASK_LABEL'=>array(
'type'=>
'textarea',
'enabled'=>1),
51 'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF'=>array(
'type'=>
'category:'.Categorie::TYPE_CUSTOMER,
'enabled'=>1),
52 'EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH'=>array(
'type'=>
'category:'.Categorie::TYPE_CUSTOMER,
'enabled'=>1),
53 'EVENTORGANIZATION_FILTERATTENDEES_CAT'=>array(
'type'=>
'category:'.Categorie::TYPE_CUSTOMER,
'enabled'=>1),
54 'EVENTORGANIZATION_FILTERATTENDEES_TYPE'=>array(
'type'=>
'thirdparty_type:',
'enabled'=>1),
55 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF'=>array(
'type'=>
'emailtemplate:conferenceorbooth',
'enabled'=>1),
56 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH'=>array(
'type'=>
'emailtemplate:conferenceorbooth',
'enabled'=>1),
57 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'=>array(
'type'=>
'emailtemplate:conferenceorbooth',
'enabled'=>1),
58 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'=>array(
'type'=>
'emailtemplate:conferenceorbooth',
'enabled'=>1),
61 'SERVICE_BOOTH_LOCATION'=>array(
'type'=>
'product',
'enabled'=>1),
62 'SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION'=>array(
'type'=>
'product',
'enabled'=>1),
63 'EVENTORGANIZATION_SECUREKEY'=>array(
'type'=>
'securekey',
'enabled'=>1),
69 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
72 if (empty($user->admin)) {
86 if ((
float) DOL_VERSION >= 6) {
87 include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
90 if ($action ==
'updateMask') {
91 $maskconstorder =
GETPOST(
'maskconstorder',
'aZ09');
92 $maskorder =
GETPOST(
'maskorder',
'alpha');
94 if ($maskconstorder && preg_match(
'/_MASK$/', $maskconstorder)) {
95 $res =
dolibarr_set_const($db, $maskconstorder, $maskorder,
'chaine', 0,
'', $conf->entity);
106 } elseif ($action ==
'specimen') {
107 $modele =
GETPOST(
'module',
'alpha');
108 $tmpobjectkey =
GETPOST(
'object');
110 $tmpobject =
new $tmpobjectkey($db);
111 $tmpobject->initAsSpecimen();
114 $file =
''; $classname =
''; $filefound = 0;
115 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
116 foreach ($dirmodels as $reldir) {
117 $file =
dol_buildpath($reldir.
"core/modules/eventorganization/doc/pdf_".$modele.
"_".strtolower($tmpobjectkey).
".modules.php", 0);
118 if (file_exists($file)) {
120 $classname =
"pdf_".$modele;
128 $module =
new $classname($db);
130 if ($module->write_file($tmpobject, $langs) > 0) {
131 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=".strtolower($tmpobjectkey).
"&file=SPECIMEN.pdf");
139 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
141 } elseif ($action ==
'setmod') {
143 $tmpobjectkey =
GETPOST(
'object');
144 if (!empty($tmpobjectkey)) {
145 $constforval =
'EVENTORGANIZATION_'.strtoupper($tmpobjectkey).
"_ADDON";
148 } elseif ($action ==
'set') {
151 } elseif ($action ==
'del') {
154 $tmpobjectkey =
GETPOST(
'object');
155 if (!empty($tmpobjectkey)) {
156 $constforval =
'EVENTORGANIZATION_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
157 if ($conf->global->$constforval ==
"$value") {
195 $page_name =
"EventOrganizationSetup";
197 llxHeader(
'', $langs->trans($page_name));
200 $linkback =
'<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1').
'">'.$langs->trans(
"BackToModuleList").
'</a>';
202 print
load_fiche_titre($langs->trans($page_name), $linkback,
'title_setup');
206 print
dol_get_fiche_head($head,
'settings', $langs->trans($page_name), -1,
'eventorganization');
209 echo
'<span class="opacitymedium">'.$langs->trans(
"EventOrganizationSetupPage").
'</span><br><br>';
212 if ($action ==
'edit') {
213 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
214 print
'<input type="hidden" name="token" value="'.newToken().
'">';
215 print
'<input type="hidden" name="action" value="update">';
217 print
'<table class="noborder centpercent">';
218 print
'<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"Value").
'</td></tr>';
220 foreach ($arrayofparameters as $constname => $val) {
221 if ($val[
'enabled']==1) {
223 print
'<tr class="oddeven"><td><!-- '.$constname.
' -->';
224 $tooltiphelp = (($langs->trans($constname .
'Tooltip') != $constname .
'Tooltip') ? $langs->trans($constname .
'Tooltip') :
'');
225 $tooltiphelp .= (($langs->trans($constname .
'Tooltip2') && $langs->trans($constname .
'Tooltip2') != $constname .
'Tooltip2') ?
'<br><br>'.
"\n".$langs->trans($constname .
'Tooltip2') :
'');
226 print
'<span id="helplink'.$constname.
'" class="spanforparamtooltip">'.
$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1,
'info',
'', 0, 3,
'tootips'.$constname).
'</span>';
229 if ($val[
'type'] ==
'textarea') {
230 print
'<textarea class="flat" name="'.$constname.
'" id="'.$constname.
'" cols="50" rows="5" wrap="soft">' .
"\n";
232 print
"</textarea>\n";
233 } elseif ($val[
'type']==
'html') {
234 require_once DOL_DOCUMENT_ROOT .
'/core/class/doleditor.class.php';
235 $doleditor =
new DolEditor($constname,
getDolGlobalString($constname),
'', 160,
'dolibarr_notes',
'',
false,
false, $conf->fckeditor->enabled, ROWS_5,
'90%');
236 $doleditor->Create();
237 } elseif ($val[
'type'] ==
'yesno') {
239 } elseif (preg_match(
'/emailtemplate:/', $val[
'type'])) {
240 include_once DOL_DOCUMENT_ROOT .
'/core/class/html.formmail.class.php';
243 $tmp = explode(
':', $val[
'type']);
244 $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user,
null, 1);
246 $arrayofmessagename = array();
247 if (is_array($formmail->lines_model)) {
248 foreach ($formmail->lines_model as $modelmail) {
251 if (!empty($arrayofmessagename[$modelmail->label])) {
252 $moreonlabel =
' <span class="opacitymedium">(' . $langs->trans(
"SeveralLangugeVariatFound") .
')</span>';
255 $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace(
'/\(|\)/',
'', $modelmail->label)) . $moreonlabel;
258 print
$form->selectarray($constname, $arrayofmessagename,
getDolGlobalString($constname),
'None', 0, 0,
'', 0, 0, 0,
'',
'', 1);
259 } elseif (preg_match(
'/category:/', $val[
'type'])) {
260 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
261 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
264 $tmp = explode(
':', $val[
'type']);
265 print
img_picto(
'',
'category',
'class="pictofixedwidth"');
266 print $formother->select_categories($tmp[1],
getDolGlobalString($constname), $constname, 0, $langs->trans(
'CustomersProspectsCategoriesShort'));
267 } elseif (preg_match(
'/thirdparty_type/', $val[
'type'])) {
268 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
270 print $formcompany->selectProspectCustomerType(
getDolGlobalString($constname), $constname,
'customerorprospect',
'form',
'', 1);
271 } elseif ($val[
'type'] ==
'securekey') {
272 print
'<input type="text" class="flat" id="'.$constname.
'" name="'.$constname.
'" value="'.(
GETPOST($constname,
'alpha') ?
GETPOST($constname,
'alpha') :
getDolGlobalString($constname)).
'" size="40">';
273 if (!empty($conf->use_javascript_ajax)) {
274 print
' '.img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_token'.$constname.
'" class="linkobject"');
278 include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
280 } elseif ($val[
'type'] ==
'product') {
282 $selected = (empty($conf->global->$constname) ?
'' : $conf->global->$constname);
283 $form->select_produits($selected, $constname,
'', 0);
286 print
'<input name="' . $constname .
'" class="flat ' . (empty($val[
'css']) ?
'minwidth200' : $val[
'css']) .
'" value="' .
getDolGlobalString($constname) .
'">';
293 print
$form->buttonsSaveCancel();
298 if (!empty($arrayofparameters)) {
299 print
'<table class="noborder centpercent">';
300 print
'<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"Value").
'</td></tr>';
302 foreach ($arrayofparameters as $constname => $val) {
303 if ($val[
'enabled']==1) {
305 print
'<tr class="oddeven">';
306 print
'<td><!-- '.$constname.
' -->';
307 $tooltiphelp = (($langs->trans($constname .
'Tooltip') != $constname .
'Tooltip') ? $langs->trans($constname .
'Tooltip') :
'');
308 $tooltiphelp .= (($langs->trans($constname .
'Tooltip2') && $langs->trans($constname .
'Tooltip2') != $constname .
'Tooltip2') ?
'<br><br>'.
"\n".$langs->trans($constname .
'Tooltip2') :
'');
309 print
$form->textwithpicto($langs->trans($constname), $tooltiphelp);
312 if ($val[
'type'] ==
'textarea') {
314 } elseif ($val[
'type']==
'html') {
316 } elseif ($val[
'type'] ==
'yesno') {
318 } elseif (preg_match(
'/emailtemplate:/', $val[
'type'])) {
320 include_once DOL_DOCUMENT_ROOT .
'/core/class/html.formmail.class.php';
323 $tmp = explode(
':', $val[
'type']);
325 if ($labelemailtemplate && $labelemailtemplate !=
'-1') {
326 $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs,
getDolGlobalString($constname));
327 if (is_numeric($template) && $template < 0) {
330 if ($template->label !=
'default') {
331 print $langs->trans($template->label);
336 } elseif (preg_match(
'/category:/', $val[
'type'])) {
343 $ways = $c->print_all_ways(
' >> ',
'none', 0, 1);
345 foreach ($ways as $way) {
346 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ?
' style="background: #' . $c->color .
';"' :
' style="background: #bbb"') .
'>' . $way .
'</li>';
348 print
'<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
350 } elseif (preg_match(
'/thirdparty_type/', $val[
'type'])) {
352 print $langs->trans(
"Prospect");
354 print $langs->trans(
"ProspectCustomer");
356 print $langs->trans(
"Customer");
358 print $langs->trans(
"NorProspectNorCustomer");
360 } elseif ($val[
'type'] ==
'product') {
363 if ($idproduct > 0) {
364 $resprod = $product->fetch($idproduct);
366 print $product->getNomUrl(1);
367 } elseif ($resprod < 0) {
382 print
'<div class="tabsAction">';
383 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'">'.$langs->trans(
"Modify").
'</a>';
386 print
'<br>'.$langs->trans(
"NothingToSetup");