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