dolibarr  17.0.4
setup.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) ---Put here your own copyright and developer email---
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 
25 // Load Dolibarr environment
26 $res = 0;
27 // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
28 if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
29  $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
30 }
31 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
32 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
33 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
34  $i--; $j--;
35 }
36 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
37  $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
38 }
39 if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
40  $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
41 }
42 // Try main.inc.php using relative path
43 if (!$res && file_exists("../../main.inc.php")) {
44  $res = @include "../../main.inc.php";
45 }
46 if (!$res && file_exists("../../../main.inc.php")) {
47  $res = @include "../../../main.inc.php";
48 }
49 if (!$res) {
50  die("Include of main fails");
51 }
52 
53 global $langs, $user;
54 
55 // Libraries
56 require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
57 require_once '../lib/mymodule.lib.php';
58 //require_once "../class/myclass.class.php";
59 
60 // Translations
61 $langs->loadLangs(array("admin", "mymodule@mymodule"));
62 
63 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
64 $hookmanager->initHooks(array('mymodulesetup', 'globalsetup'));
65 
66 // Access control
67 if (!$user->admin) {
69 }
70 
71 // Parameters
72 $action = GETPOST('action', 'aZ09');
73 $backtopage = GETPOST('backtopage', 'alpha');
74 $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
75 
76 $value = GETPOST('value', 'alpha');
77 $label = GETPOST('label', 'alpha');
78 $scandir = GETPOST('scan_dir', 'alpha');
79 $type = 'myobject';
80 
81 
82 $error = 0;
83 $setupnotempty = 0;
84 
85 // Set this to 1 to use the factory to manage constants. Warning, the generated module will be compatible with version v15+ only
86 $useFormSetup = 1;
87 
88 if (!class_exists('FormSetup')) {
89  // For retrocompatibility Dolibarr < 16.0
90  if (floatval(DOL_VERSION) < 16.0 && !class_exists('FormSetup')) {
91  require_once __DIR__.'/../backport/v16/core/class/html.formsetup.class.php';
92  } else {
93  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
94  }
95 }
96 
97 $formSetup = new FormSetup($db);
98 
99 
100 // HTTP HOST
101 $item = $formSetup->newItem('NO_PARAM_JUST_TEXT');
102 $item->fieldOverride = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'];
103 $item->cssClass = 'minwidth500';
104 
105 // Setup conf MYMODULE_MYPARAM1 as a simple string input
106 $item = $formSetup->newItem('MYMODULE_MYPARAM1');
107 $item->defaultFieldValue = 'default value';
108 
109 // Setup conf MYMODULE_MYPARAM2 as a simple textarea input but we replace the text of field title
110 $item = $formSetup->newItem('MYMODULE_MYPARAM2');
111 $item->nameText = $item->getNameText().' more html text ';
112 
113 // Setup conf MYMODULE_MYPARAM3
114 $item = $formSetup->newItem('MYMODULE_MYPARAM3');
115 $item->setAsThirdpartyType();
116 
117 // Setup conf MYMODULE_MYPARAM4 : exemple of quick define write style
118 $formSetup->newItem('MYMODULE_MYPARAM4')->setAsYesNo();
119 
120 // Setup conf MYMODULE_MYPARAM5
121 $formSetup->newItem('MYMODULE_MYPARAM5')->setAsEmailTemplate('thirdparty');
122 
123 // Setup conf MYMODULE_MYPARAM6
124 $formSetup->newItem('MYMODULE_MYPARAM6')->setAsSecureKey()->enabled = 0; // disabled
125 
126 // Setup conf MYMODULE_MYPARAM7
127 $formSetup->newItem('MYMODULE_MYPARAM7')->setAsProduct();
128 
129 $formSetup->newItem('Title')->setAsTitle();
130 
131 // Setup conf MYMODULE_MYPARAM8
132 $item = $formSetup->newItem('MYMODULE_MYPARAM8');
133 $TField = array(
134  'test01' => $langs->trans('test01'),
135  'test02' => $langs->trans('test02'),
136  'test03' => $langs->trans('test03'),
137  'test04' => $langs->trans('test04'),
138  'test05' => $langs->trans('test05'),
139  'test06' => $langs->trans('test06'),
140 );
141 $item->setAsMultiSelect($TField);
142 $item->helpText = $langs->transnoentities('MYMODULE_MYPARAM8');
143 
144 
145 // Setup conf MYMODULE_MYPARAM9
146 $formSetup->newItem('MYMODULE_MYPARAM9')->setAsSelect($TField);
147 
148 
149 // Setup conf MYMODULE_MYPARAM10
150 $item = $formSetup->newItem('MYMODULE_MYPARAM10');
151 $item->setAsColor();
152 $item->defaultFieldValue = '#FF0000';
153 $item->nameText = $item->getNameText().' more html text ';
154 $item->fieldInputOverride = '';
155 $item->helpText = $langs->transnoentities('AnHelpMessage');
156 //$item->fieldValue = '';
157 //$item->fieldAttr = array() ; // fields attribute only for compatible fields like input text
158 //$item->fieldOverride = false; // set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too
159 //$item->fieldInputOverride = false; // set this var to override field input
160 //$item->fieldOutputOverride = false; // set this var to override field output
161 
162 
163 $setupnotempty =+ count($formSetup->items);
164 
165 
166 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
167 
168 
169 /*
170  * Actions
171  */
172 
173 // For retrocompatibility Dolibarr < 15.0
174 if ( versioncompare(explode('.', DOL_VERSION), array(15)) < 0 && $action == 'update' && !empty($user->admin)) {
175  $formSetup->saveConfFromPost();
176 }
177 
178 include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
179 
180 if ($action == 'updateMask') {
181  $maskconst = GETPOST('maskconst', 'aZ09');
182  $maskvalue = GETPOST('maskvalue', 'alpha');
183 
184  if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
185  $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
186  if (!($res > 0)) {
187  $error++;
188  }
189  }
190 
191  if (!$error) {
192  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
193  } else {
194  setEventMessages($langs->trans("Error"), null, 'errors');
195  }
196 } elseif ($action == 'specimen') {
197  $modele = GETPOST('module', 'alpha');
198  $tmpobjectkey = GETPOST('object');
199 
200  $tmpobject = new $tmpobjectkey($db);
201  $tmpobject->initAsSpecimen();
202 
203  // Search template files
204  $file = ''; $classname = ''; $filefound = 0;
205  $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
206  foreach ($dirmodels as $reldir) {
207  $file = dol_buildpath($reldir."core/modules/mymodule/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
208  if (file_exists($file)) {
209  $filefound = 1;
210  $classname = "pdf_".$modele."_".strtolower($tmpobjectkey);
211  break;
212  }
213  }
214 
215  if ($filefound) {
216  require_once $file;
217 
218  $module = new $classname($db);
219 
220  if ($module->write_file($tmpobject, $langs) > 0) {
221  header("Location: ".DOL_URL_ROOT."/document.php?modulepart=mymodule-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
222  return;
223  } else {
224  setEventMessages($module->error, null, 'errors');
225  dol_syslog($module->error, LOG_ERR);
226  }
227  } else {
228  setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
229  dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
230  }
231 } elseif ($action == 'setmod') {
232  // TODO Check if numbering module chosen can be activated by calling method canBeActivated
233  $tmpobjectkey = GETPOST('object');
234  if (!empty($tmpobjectkey)) {
235  $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey)."_ADDON";
236  dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
237  }
238 } elseif ($action == 'set') {
239  // Activate a model
240  $ret = addDocumentModel($value, $type, $label, $scandir);
241 } elseif ($action == 'del') {
242  $ret = delDocumentModel($value, $type);
243  if ($ret > 0) {
244  $tmpobjectkey = GETPOST('object');
245  if (!empty($tmpobjectkey)) {
246  $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
247  if (getDolGlobalString($constforval) == "$value") {
248  dolibarr_del_const($db, $constforval, $conf->entity);
249  }
250  }
251  }
252 } elseif ($action == 'setdoc') {
253  // Set or unset default model
254  $tmpobjectkey = GETPOST('object');
255  if (!empty($tmpobjectkey)) {
256  $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
257  if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
258  // The constant that was read before the new set
259  // We therefore requires a variable to have a coherent view
260  $conf->global->{$constforval} = $value;
261  }
262 
263  // We disable/enable the document template (into llx_document_model table)
264  $ret = delDocumentModel($value, $type);
265  if ($ret > 0) {
266  $ret = addDocumentModel($value, $type, $label, $scandir);
267  }
268  }
269 } elseif ($action == 'unsetdoc') {
270  $tmpobjectkey = GETPOST('object');
271  if (!empty($tmpobjectkey)) {
272  $constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
273  dolibarr_del_const($db, $constforval, $conf->entity);
274  }
275 }
276 
277 
278 
279 /*
280  * View
281  */
282 
283 $form = new Form($db);
284 
285 $help_url = '';
286 $page_name = "MyModuleSetup";
287 
288 llxHeader('', $langs->trans($page_name), $help_url);
289 
290 // Subheader
291 $linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
292 
293 print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
294 
295 // Configuration header
296 $head = mymoduleAdminPrepareHead();
297 print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "mymodule@mymodule");
298 
299 // Setup page goes here
300 echo '<span class="opacitymedium">'.$langs->trans("MyModuleSetupPage").'</span><br><br>';
301 
302 
303 if ($action == 'edit') {
304  print $formSetup->generateOutput(true);
305  print '<br>';
306 } elseif (!empty($formSetup->items)) {
307  print $formSetup->generateOutput();
308  print '<div class="tabsAction">';
309  print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
310  print '</div>';
311 } else {
312  print '<br>'.$langs->trans("NothingToSetup");
313 }
314 
315 
316 $moduledir = 'mymodule';
317 $myTmpObjects = array();
318 // TODO Scan list of objects
319 $myTmpObjects['myobject'] = array('label'=>'MyObject', 'includerefgeneration'=>0, 'includedocgeneration'=>0);
320 
321 
322 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
323  if ($myTmpObjectKey != $type) {
324  continue;
325  }
326  if ($myTmpObjectArray['includerefgeneration']) {
327  /*
328  * Orders Numbering model
329  */
330  $setupnotempty++;
331 
332  print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectArray['label']), '', '');
333 
334  print '<table class="noborder centpercent">';
335  print '<tr class="liste_titre">';
336  print '<td>'.$langs->trans("Name").'</td>';
337  print '<td>'.$langs->trans("Description").'</td>';
338  print '<td class="nowrap">'.$langs->trans("Example").'</td>';
339  print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
340  print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
341  print '</tr>'."\n";
342 
343  clearstatcache();
344 
345  foreach ($dirmodels as $reldir) {
346  $dir = dol_buildpath($reldir."core/modules/".$moduledir);
347 
348  if (is_dir($dir)) {
349  $handle = opendir($dir);
350  if (is_resource($handle)) {
351  while (($file = readdir($handle)) !== false) {
352  if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') {
353  $file = substr($file, 0, dol_strlen($file) - 4);
354 
355  require_once $dir.'/'.$file.'.php';
356 
357  $module = new $file($db);
358 
359  // Show modules according to features level
360  if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
361  continue;
362  }
363  if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
364  continue;
365  }
366 
367  if ($module->isEnabled()) {
368  dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
369 
370  print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
371  print $module->info();
372  print '</td>';
373 
374  // Show example of numbering model
375  print '<td class="nowrap">';
376  $tmp = $module->getExample();
377  if (preg_match('/^Error/', $tmp)) {
378  $langs->load("errors");
379  print '<div class="error">'.$langs->trans($tmp).'</div>';
380  } elseif ($tmp == 'NotConfigured') {
381  print $langs->trans($tmp);
382  } else {
383  print $tmp;
384  }
385  print '</td>'."\n";
386 
387  print '<td class="center">';
388  $constforvar = 'MYMODULE_'.strtoupper($myTmpObjectKey).'_ADDON';
389  if (getDolGlobalString($constforvar) == $file) {
390  print img_picto($langs->trans("Activated"), 'switch_on');
391  } else {
392  print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
393  print img_picto($langs->trans("Disabled"), 'switch_off');
394  print '</a>';
395  }
396  print '</td>';
397 
398  $mytmpinstance = new $myTmpObjectKey($db);
399  $mytmpinstance->initAsSpecimen();
400 
401  // Info
402  $htmltooltip = '';
403  $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
404 
405  $nextval = $module->getNextValue($mytmpinstance);
406  if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
407  $htmltooltip .= ''.$langs->trans("NextValue").': ';
408  if ($nextval) {
409  if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
410  $nextval = $langs->trans($nextval);
411  }
412  $htmltooltip .= $nextval.'<br>';
413  } else {
414  $htmltooltip .= $langs->trans($module->error).'<br>';
415  }
416  }
417 
418  print '<td class="center">';
419  print $form->textwithpicto('', $htmltooltip, 1, 0);
420  print '</td>';
421 
422  print "</tr>\n";
423  }
424  }
425  }
426  closedir($handle);
427  }
428  }
429  }
430  print "</table><br>\n";
431  }
432 
433  if ($myTmpObjectArray['includedocgeneration']) {
434  /*
435  * Document templates generators
436  */
437  $setupnotempty++;
438  $type = strtolower($myTmpObjectKey);
439 
440  print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
441 
442  // Load array def with activated templates
443  $def = array();
444  $sql = "SELECT nom";
445  $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
446  $sql .= " WHERE type = '".$db->escape($type)."'";
447  $sql .= " AND entity = ".$conf->entity;
448  $resql = $db->query($sql);
449  if ($resql) {
450  $i = 0;
451  $num_rows = $db->num_rows($resql);
452  while ($i < $num_rows) {
453  $array = $db->fetch_array($resql);
454  array_push($def, $array[0]);
455  $i++;
456  }
457  } else {
458  dol_print_error($db);
459  }
460 
461  print "<table class=\"noborder\" width=\"100%\">\n";
462  print "<tr class=\"liste_titre\">\n";
463  print '<td>'.$langs->trans("Name").'</td>';
464  print '<td>'.$langs->trans("Description").'</td>';
465  print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
466  print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
467  print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
468  print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
469  print "</tr>\n";
470 
471  clearstatcache();
472 
473  foreach ($dirmodels as $reldir) {
474  foreach (array('', '/doc') as $valdir) {
475  $realpath = $reldir."core/modules/".$moduledir.$valdir;
476  $dir = dol_buildpath($realpath);
477 
478  if (is_dir($dir)) {
479  $handle = opendir($dir);
480  if (is_resource($handle)) {
481  while (($file = readdir($handle)) !== false) {
482  $filelist[] = $file;
483  }
484  closedir($handle);
485  arsort($filelist);
486 
487  foreach ($filelist as $file) {
488  if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
489  if (file_exists($dir.'/'.$file)) {
490  $name = substr($file, 4, dol_strlen($file) - 16);
491  $classname = substr($file, 0, dol_strlen($file) - 12);
492 
493  require_once $dir.'/'.$file;
494  $module = new $classname($db);
495 
496  $modulequalified = 1;
497  if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
498  $modulequalified = 0;
499  }
500  if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
501  $modulequalified = 0;
502  }
503 
504  if ($modulequalified) {
505  print '<tr class="oddeven"><td width="100">';
506  print (empty($module->name) ? $name : $module->name);
507  print "</td><td>\n";
508  if (method_exists($module, 'info')) {
509  print $module->info($langs);
510  } else {
511  print $module->description;
512  }
513  print '</td>';
514 
515  // Active
516  if (in_array($name, $def)) {
517  print '<td class="center">'."\n";
518  print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
519  print img_picto($langs->trans("Enabled"), 'switch_on');
520  print '</a>';
521  print '</td>';
522  } else {
523  print '<td class="center">'."\n";
524  print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
525  print "</td>";
526  }
527 
528  // Default
529  print '<td class="center">';
530  $constforvar = 'MYMODULE_'.strtoupper($myTmpObjectKey).'_ADDON_PDF';
531  if (getDolGlobalString($constforvar) == $name) {
532  //print img_picto($langs->trans("Default"), 'on');
533  // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
534  print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&amp;type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
535  } else {
536  print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
537  }
538  print '</td>';
539 
540  // Info
541  $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
542  $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
543  if ($module->type == 'pdf') {
544  $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
545  }
546  $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
547 
548  $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
549  $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
550  $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
551 
552  print '<td class="center">';
553  print $form->textwithpicto('', $htmltooltip, 1, 0);
554  print '</td>';
555 
556  // Preview
557  print '<td class="center">';
558  if ($module->type == 'pdf') {
559  $newname = preg_replace('/_'.preg_quote(strtolower($myTmpObjectKey), '/').'/', '', $name);
560  print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.urlencode($newname).'&object='.urlencode($myTmpObjectKey).'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
561  } else {
562  print img_object($langs->trans("PreviewNotAvailable"), 'generic');
563  }
564  print '</td>';
565 
566  print "</tr>\n";
567  }
568  }
569  }
570  }
571  }
572  }
573  }
574  }
575 
576  print '</table>';
577  }
578 }
579 
580 if (empty($setupnotempty)) {
581  print '<br>'.$langs->trans("NothingToSetup");
582 }
583 
584 // Page end
585 print dol_get_fiche_end();
586 
587 llxFooter();
588 $db->close();
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:118
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
Definition: admin.lib.php:1888
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).
Definition: admin.lib.php:632
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
Definition: admin.lib.php:556
delDocumentModel($name, $type)
Delete document model used by doc generator.
Definition: admin.lib.php:1919
versioncompare($versionarray1, $versionarray2)
Compare 2 versions (stored into 2 arrays).
Definition: admin.lib.php:66
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to manage generation of HTML components Only common components must be here.
This class help you create setup render.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
mymoduleAdminPrepareHead()
Prepare admin pages header.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.