30 if (!defined(
'NOSCANPOSTFORINJECTION')) {
31 define(
'NOSCANPOSTFORINJECTION',
'1');
35 require
'../main.inc.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/lib/modulebuilder.lib.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/class/utils.class.php';
44 $langs->loadLangs(array(
"admin",
"modulebuilder",
"other",
"cron",
"errors"));
47 $action =
GETPOST(
'action',
'aZ09');
48 $confirm =
GETPOST(
'confirm',
'alpha');
49 $cancel =
GETPOST(
'cancel',
'alpha');
51 $sortfield =
GETPOST(
'sortfield',
'alpha');
52 $sortorder =
GETPOST(
'sortorder',
'alpha');
54 $module =
GETPOST(
'module',
'alpha');
56 $tabobj =
GETPOST(
'tabobj',
'alpha');
57 $tabdic =
GETPOST(
'tabdic',
'alpha');
58 $propertykey =
GETPOST(
'propertykey',
'alpha');
60 $module =
'initmodule';
66 $tabobj =
'newobjectifnoobj';
69 $tabdic =
'newdicifnodic';
71 $file =
GETPOST(
'file',
'alpha');
76 $editorname=
GETPOST(
'editorname',
'alpha');
77 $editorurl=
GETPOST(
'editorurl',
'alpha');
78 $version=
GETPOST(
'version',
'alpha');
79 $family=
GETPOST(
'family',
'alpha');
80 $picto=
GETPOST(
'idpicto',
'alpha');
81 $idmodule=
GETPOST(
'idmodule',
'alpha');
87 if (!$user->hasRight(
"modulebuilder",
"run")) {
93 $tmp = explode(
',', $dolibarr_main_document_root_alt);
98 $tmpdir = explode(
'@', $module);
99 if (!empty($tmpdir[1])) {
100 $module = $tmpdir[0];
101 $dirread = $tmpdir[1];
104 if (
GETPOST(
'dirins',
'alpha')) {
105 $dirread = $dirins =
GETPOST(
'dirins',
'alpha');
109 $FILEFLAG =
'modulebuilder.txt';
113 if (empty($newmask) && !empty($conf->global->MAIN_UMASK)) {
114 $newmask = $conf->global->MAIN_UMASK;
116 if (empty($newmask)) {
127 $dirsrootforscan = array($dirread);
130 if ($dirread != DOL_DOCUMENT_ROOT && ($conf->global->MAIN_FEATURES_LEVEL >= 2 || !empty($conf->global->MODULEBUILDER_ADD_DOCUMENT_ROOT))) {
131 $dirsrootforscan[] = DOL_DOCUMENT_ROOT;
135 $textforlistofdirs =
'<!-- Directory scanned -->'.
"\n";
136 $listofmodules = array();
138 foreach ($dirsrootforscan as $dirread) {
139 $moduletype =
'external';
140 if ($dirread == DOL_DOCUMENT_ROOT) {
141 $moduletype =
'internal';
145 if (is_array($dirsincustom) && count($dirsincustom) > 0) {
146 foreach ($dirsincustom as $dircustomcursor) {
147 $fullname = $dircustomcursor[
'fullname'];
150 $dirtoscanrel = basename($fullname).
'/core/modules/';
152 $descriptorfiles =
dol_dir_list(dirname($fullname).
'/'.$dirtoscanrel,
'files', 0,
'mod.*\.class\.php$');
153 if (empty($descriptorfiles)) {
154 $dirtoscanrel =
'core/modules/';
155 $descriptorfiles =
dol_dir_list($fullname.
'/../'.$dirtoscanrel,
'files', 0,
'mod'.strtoupper(basename($fullname)).
'\.class\.php$');
157 $modulenamewithcase =
'';
158 $moduledescriptorrelpath =
'';
159 $moduledescriptorfullpath =
'';
161 foreach ($descriptorfiles as $descriptorcursor) {
162 $modulenamewithcase = preg_replace(
'/^mod/',
'', $descriptorcursor[
'name']);
163 $modulenamewithcase = preg_replace(
'/\.class\.php$/',
'', $modulenamewithcase);
164 $moduledescriptorrelpath = $dirtoscanrel.$descriptorcursor[
'name'];
165 $moduledescriptorfullpath = $descriptorcursor[
'fullname'];
168 if ($modulenamewithcase) {
169 $listofmodules[$dircustomcursor[
'name']] = array(
170 'modulenamewithcase'=>$modulenamewithcase,
171 'moduledescriptorrelpath'=> $moduledescriptorrelpath,
172 'moduledescriptorfullpath'=>$moduledescriptorfullpath,
173 'moduledescriptorrootpath'=>$dirread,
174 'moduletype'=>$moduletype
182 if ($forceddirread && empty($listofmodules)) {
183 $listofmodules[strtolower($module)] = array(
184 'modulenamewithcase'=>$module,
185 'moduledescriptorrelpath'=>
'notyetimplemented',
186 'moduledescriptorfullpath'=>
'notyetimplemented',
187 'moduledescriptorrootpath'=>
'notyetimplemented',
192 $newdircustom = $dirins;
193 if (empty($newdircustom)) {
199 $textforlistofdirs .= $langs->trans(
"DirScanned").
' : ';
201 $textforlistofdirs .=
', ';
203 $textforlistofdirs .=
'<strong class="wordbreakimp">'.$dirread.
'</strong>';
204 if ($dirread == DOL_DOCUMENT_ROOT) {
206 $textforlistofdirs .=
$form->textwithpicto(
'', $langs->trans(
"ConstantIsOn",
"MAIN_FEATURES_LEVEL"));
209 $textforlistofdirs .=
$form->textwithpicto(
'', $langs->trans(
"ConstantIsOn",
"MODULEBUILDER_ADD_DOCUMENT_ROOT"));
220 if ($dirins && $action ==
'initmodule' && $modulename) {
221 $modulename = ucfirst($modulename);
223 if (preg_match(
'/[^a-z0-9_]/i', $modulename)) {
225 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
229 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
230 $destdir = $dirins.
'/'.strtolower($modulename);
232 $arrayreplacement = array(
233 'mymodule'=>strtolower($modulename),
234 'MyModule'=>$modulename
237 $result =
dolCopyDir($srcdir, $destdir, 0, 0, $arrayreplacement);
242 $langs->load(
"errors");
243 setEventMessages($langs->trans(
"ErrorFailToCopyDir", $srcdir, $destdir),
null,
'errors');
246 setEventMessages($langs->trans(
"AllFilesDidAlreadyExist", $srcdir, $destdir),
null,
'warnings');
251 $tryToCopyFromSetupClass =
true;
252 $backportDest = $destdir .
'/backport/v16/core/class';
253 $backportFileSrc = DOL_DOCUMENT_ROOT.
'/core/class/html.formsetup.class.php';
254 $backportFileDest = $backportDest.
'/html.formsetup.class.php';
259 $langs->load(
"errors");
260 setEventMessages($langs->trans(
"ErrorFailToCreateDir", $backportDest),
null,
'errors');
261 $tryToCopyFromSetupClass =
false;
264 if ($tryToCopyFromSetupClass) {
265 $result =
dol_copy($backportFileSrc, $backportFileDest);
269 $langs->load(
"errors");
270 setEventMessages($langs->trans(
"ErrorFailToCopyFile", $backportFileSrc, $backportFileDest),
null,
'errors');
272 setEventMessages($langs->trans(
"FileDidAlreadyExist", $backportFileDest),
null,
'warnings');
277 if (!empty($conf->global->MODULEBUILDER_USE_ABOUT)) {
296 dol_delete_file($destdir.
'/class/actions_'.strtolower($modulename).
'.class.php');
297 dol_delete_file($destdir.
'/class/api_'.strtolower($modulename).
'.class.php');
305 dol_delete_file($destdir.
'/test/phpunit/'.$modulename.
'FunctionnalTest.php');
314 dol_delete_file($destdir.
'/lib/'.strtolower($modulename).
'_myobject.lib.php');
316 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject.sql');
317 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject_extrafields.sql');
318 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject.key.sql');
319 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject_extrafields.key.sql');
333 $listofphpfilestoedit =
dol_dir_list($destdir,
'files', 1,
'\.(php|MD|js|sql|txt|xml|lang)$',
'',
'fullname', SORT_ASC, 0, 1);
334 foreach ($listofphpfilestoedit as $phpfileval) {
336 $arrayreplacement = array(
337 'mymodule'=>strtolower($modulename),
338 'MyModule'=>$modulename,
339 'MYMODULE'=>strtoupper($modulename),
340 'My module'=>$modulename,
341 'my module'=>$modulename,
342 'Mon module'=>$modulename,
343 'mon module'=>$modulename,
344 'htdocs/modulebuilder/template'=>strtolower($modulename),
345 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
''),
346 'Editor name'=>$editorname,
347 'https://www.example.com'=>$editorurl,
348 '$this->version = \'1.0\''=>
'$this->version = \''.$version.
'\'',
349 '$this->picto = \'generic\';'=>(empty($picto)) ?
'$this->picto = \'generic\'' :
'$this->picto = \''.$picto.
'\';
',
350 "modulefamily" =>$family,
354 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME)) {
355 $arrayreplacement['Editor
name'] = $conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME;
357 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_URL)) {
358 $arrayreplacement['https:
360 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_AUTHOR)) {
361 $arrayreplacement[
'---Put here your own copyright and developer email---'] =
dol_print_date($now,
'%Y').
' '.$conf->global->MODULEBUILDER_SPECIFIC_AUTHOR;
363 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_VERSION)) {
364 $arrayreplacement[
'1.0'] = $conf->global->MODULEBUILDER_SPECIFIC_VERSION;
366 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_FAMILY)) {
367 $arrayreplacement[
'modulefamily'] = $conf->global->MODULEBUILDER_SPECIFIC_FAMILY;
373 setEventMessages($langs->trans(
"ErrorFailToMakeReplacementInto", $phpfileval[
'fullname']),
null,
'errors');
377 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_README)) {
378 setEventMessages($langs->trans(
"ContentOfREADMECustomized"),
null,
'warnings');
380 file_put_contents($destdir.
'/README.md', $conf->global->MODULEBUILDER_SPECIFIC_README);
386 $module = $modulename;
388 clearstatcache(
true);
389 if (function_exists(
'opcache_invalidate')) {
393 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?module='.$modulename);
400 if ($dirins && in_array($action, array(
'initapi',
'initphpunit',
'initpagecontact',
'initpagedocument',
'initpagenote',
'initpageagenda')) && !empty($module)) {
401 $modulename = ucfirst($module);
402 $objectname = $tabobj;
403 $varnametoupdate =
'';
405 if ($action ==
'initapi') {
406 dol_mkdir($dirins.
'/'.strtolower($module).
'/class');
407 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
408 $srcfile = $srcdir.
'/class/api_mymodule.class.php';
409 $destfile = $dirins.
'/'.strtolower($module).
'/class/api_'.strtolower($module).
'.class.php';
410 } elseif ($action ==
'initphpunit') {
411 dol_mkdir($dirins.
'/'.strtolower($module).
'/test/phpunit');
412 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
413 $srcfile = $srcdir.
'/test/phpunit/MyObjectTest.php';
414 $destfile = $dirins.
'/'.strtolower($module).
'/test/phpunit/'.strtolower($objectname).
'Test.php';
415 } elseif ($action ==
'initpagecontact') {
416 dol_mkdir($dirins.
'/'.strtolower($module));
417 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
418 $srcfile = $srcdir.
'/myobject_contact.php';
419 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_contact.php';
420 $varnametoupdate =
'showtabofpagecontact';
421 } elseif ($action ==
'initpagedocument') {
422 dol_mkdir($dirins.
'/'.strtolower($module));
423 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
424 $srcfile = $srcdir.
'/myobject_document.php';
425 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_document.php';
426 $varnametoupdate =
'showtabofpagedocument';
427 } elseif ($action ==
'initpagenote') {
428 dol_mkdir($dirins.
'/'.strtolower($module));
429 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
430 $srcfile = $srcdir.
'/myobject_note.php';
431 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_note.php';
432 $varnametoupdate =
'showtabofpagenote';
433 } elseif ($action ==
'initpageagenda') {
434 dol_mkdir($dirins.
'/'.strtolower($module));
435 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
436 $srcfile = $srcdir.
'/myobject_agenda.php';
437 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_agenda.php';
438 $varnametoupdate =
'showtabofpageagenda';
443 $result =
dol_copy($srcfile, $destfile, 0, 0);
447 $arrayreplacement = array(
448 'mymodule'=>strtolower($modulename),
449 'MyModule'=>$modulename,
450 'MYMODULE'=>strtoupper($modulename),
451 'My module'=>$modulename,
452 'my module'=>$modulename,
453 'Mon module'=>$modulename,
454 'mon module'=>$modulename,
455 'htdocs/modulebuilder/template'=>strtolower($modulename),
456 'myobject'=>strtolower($objectname),
457 'MyObject'=>$objectname,
458 'MYOBJECT'=>strtoupper($objectname),
459 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
464 if ($varnametoupdate) {
466 $srcfile = $dirins.
'/'.strtolower($module).
'/lib/'.strtolower($module).
'_'.strtolower($objectname).
'.lib.php';
467 $arrayreplacement = array(
'/\$'.$varnametoupdate.
' = 0;/' =>
'$'.$varnametoupdate.
' = 1;');
471 $langs->load(
"errors");
472 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
478 if ($dirins && $action ==
'initsqlextrafields' && !empty($module)) {
479 $modulename = ucfirst($module);
480 $objectname = $tabobj;
482 dol_mkdir($dirins.
'/'.strtolower($module).
'/sql');
483 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
484 $srcfile1 = $srcdir.
'/sql/llx_mymodule_myobject_extrafields.sql';
485 $destfile1 = $dirins.
'/'.strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.sql';
488 $result1 =
dol_copy($srcfile1, $destfile1, 0, 0);
489 $srcfile2 = $srcdir.
'/sql/llx_mymodule_myobject_extrafields.key.sql';
490 $destfile2 = $dirins.
'/'.strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.key.sql';
493 $result2 =
dol_copy($srcfile2, $destfile2, 0, 0);
495 if ($result1 > 0 && $result2 > 0) {
496 $modulename = ucfirst($module);
499 $arrayreplacement = array(
500 'mymodule'=>strtolower($modulename),
501 'MyModule'=>$modulename,
502 'MYMODULE'=>strtoupper($modulename),
503 'My module'=>$modulename,
504 'my module'=>$modulename,
505 'Mon module'=>$modulename,
506 'mon module'=>$modulename,
507 'htdocs/modulebuilder/template'=>strtolower($modulename),
508 'My Object'=>$objectname,
509 'MyObject'=>$objectname,
510 'my object'=>strtolower($objectname),
511 'myobject'=>strtolower($objectname),
512 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
518 $langs->load(
"errors");
520 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile1),
null,
'errors');
523 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile2),
null,
'errors');
528 $srcfile = $dirins.
'/'.strtolower($module).
'/class/'.strtolower($objectname).
'.class.php';
529 $arrayreplacement = array(
'/\$isextrafieldmanaged = 0;/' =>
'$isextrafieldmanaged = 1;');
535 if ($dirins && $action ==
'inithook' && !empty($module)) {
536 dol_mkdir($dirins.
'/'.strtolower($module).
'/class');
537 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
538 $srcfile = $srcdir.
'/class/actions_mymodule.class.php';
539 $destfile = $dirins.
'/'.strtolower($module).
'/class/actions_'.strtolower($module).
'.class.php';
542 $result =
dol_copy($srcfile, $destfile, 0, 0);
545 $modulename = ucfirst($module);
548 $arrayreplacement = array(
549 'mymodule'=>strtolower($modulename),
550 'MyModule'=>$modulename,
551 'MYMODULE'=>strtoupper($modulename),
552 'My module'=>$modulename,
553 'my module'=>$modulename,
554 'Mon module'=>$modulename,
555 'mon module'=>$modulename,
556 'htdocs/modulebuilder/template'=>strtolower($modulename),
557 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
562 $langs->load(
"errors");
563 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
569 if ($dirins && $action ==
'inittrigger' && !empty($module)) {
570 dol_mkdir($dirins.
'/'.strtolower($module).
'/core/triggers');
571 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
572 $srcfile = $srcdir.
'/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php';
573 $destfile = $dirins.
'/'.strtolower($module).
'/core/triggers/interface_99_mod'.$module.
'_'.$module.
'Triggers.class.php';
576 $result =
dol_copy($srcfile, $destfile, 0, 0);
579 $modulename = ucfirst($module);
582 $arrayreplacement = array(
583 'mymodule'=>strtolower($modulename),
584 'MyModule'=>$modulename,
585 'MYMODULE'=>strtoupper($modulename),
586 'My module'=>$modulename,
587 'my module'=>$modulename,
588 'Mon module'=>$modulename,
589 'mon module'=>$modulename,
590 'htdocs/modulebuilder/template'=>strtolower($modulename),
591 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
596 $langs->load(
"errors");
597 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
603 if ($dirins && $action ==
'initwidget' && !empty($module)) {
604 dol_mkdir($dirins.
'/'.strtolower($module).
'/core/boxes');
605 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
606 $srcfile = $srcdir.
'/core/boxes/mymodulewidget1.php';
607 $destfile = $dirins.
'/'.strtolower($module).
'/core/boxes/'.strtolower($module).
'widget1.php';
610 $result =
dol_copy($srcfile, $destfile, 0, 0);
613 $modulename = ucfirst($module);
616 $arrayreplacement = array(
617 'mymodule'=>strtolower($modulename),
618 'MyModule'=>$modulename,
619 'MYMODULE'=>strtoupper($modulename),
620 'My module'=>$modulename,
621 'my module'=>$modulename,
622 'Mon module'=>$modulename,
623 'mon module'=>$modulename,
624 'htdocs/modulebuilder/template'=>strtolower($modulename),
625 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
630 $langs->load(
"errors");
631 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
637 if ($dirins && $action ==
'initcss' && !empty($module)) {
638 dol_mkdir($dirins.
'/'.strtolower($module).
'/css');
639 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
640 $srcfile = $srcdir.
'/css/mymodule.css.php';
641 $destfile = $dirins.
'/'.strtolower($module).
'/css/'.strtolower($module).
'.css.php';
644 $result =
dol_copy($srcfile, $destfile, 0, 0);
647 $modulename = ucfirst($module);
650 $arrayreplacement = array(
651 'mymodule'=>strtolower($modulename),
652 'MyModule'=>$modulename,
653 'MYMODULE'=>strtoupper($modulename),
654 'My module'=>$modulename,
655 'my module'=>$modulename,
656 'Mon module'=>$modulename,
657 'mon module'=>$modulename,
658 'htdocs/modulebuilder/template'=>strtolower($modulename),
659 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
''),
665 $srcfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
666 $arrayreplacement = array(
'/\/\/\s*\''.preg_quote(
'/'.strtolower($module).
'/css/'.strtolower($module).
'.css.php',
'/').
'\'/
' => '\
'/'.strtolower($module).
'/css/'.strtolower($module).
'.css.php\'');
669 $langs->load(
"errors");
670 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
676 if ($dirins && $action ==
'initjs' && !empty($module)) {
677 dol_mkdir($dirins.
'/'.strtolower($module).
'/js');
678 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
679 $srcfile = $srcdir.
'/js/mymodule.js.php';
680 $destfile = $dirins.
'/'.strtolower($module).
'/js/'.strtolower($module).
'.js.php';
683 $result =
dol_copy($srcfile, $destfile, 0, 0);
686 $modulename = ucfirst($module);
689 $arrayreplacement = array(
690 'mymodule'=>strtolower($modulename),
691 'MyModule'=>$modulename,
692 'MYMODULE'=>strtoupper($modulename),
693 'My module'=>$modulename,
694 'my module'=>$modulename,
695 'Mon module'=>$modulename,
696 'mon module'=>$modulename,
697 'htdocs/modulebuilder/template'=>strtolower($modulename),
698 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
704 $srcfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
705 $arrayreplacement = array(
'/\/\/\s*\''.preg_quote(
'/'.strtolower($module).
'/js/'.strtolower($module).
'.js.php',
'/').
'\'/
' => '\
'/'.strtolower($module).
'/js/'.strtolower($module).
'.js.php\'');
708 $langs->load(
"errors");
709 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
715 if ($dirins && $action ==
'initcli' && !empty($module)) {
716 dol_mkdir($dirins.
'/'.strtolower($module).
'/scripts');
717 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
718 $srcfile = $srcdir.
'/scripts/mymodule.php';
719 $destfile = $dirins.
'/'.strtolower($module).
'/scripts/'.strtolower($module).
'.php';
722 $result =
dol_copy($srcfile, $destfile, 0, 0);
725 $modulename = ucfirst($module);
728 $arrayreplacement = array(
729 'mymodule'=>strtolower($modulename),
730 'MyModule'=>$modulename,
731 'MYMODULE'=>strtoupper($modulename),
732 'My module'=>$modulename,
733 'my module'=>$modulename,
734 'Mon module'=>$modulename,
735 'mon module'=>$modulename,
736 'htdocs/modulebuilder/template'=>strtolower($modulename),
737 '__MYCOMPANY_NAME__'=>$mysoc->name,
738 '__KEYWORDS__'=>$modulename,
739 '__USER_FULLNAME__'=>$user->getFullName($langs),
740 '__USER_EMAIL__'=>$user->email,
742 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'dayrfc').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
747 $langs->load(
"errors");
748 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
754 if ($dirins && $action ==
'initdoc' && !empty($module)) {
755 dol_mkdir($dirins.
'/'.strtolower($module).
'/doc');
756 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
757 $srcfile = $srcdir.
'/doc/Documentation.asciidoc';
758 $destfile = $dirins.
'/'.strtolower($module).
'/doc/Documentation.asciidoc';
761 $result =
dol_copy($srcfile, $destfile, 0, 0);
764 $modulename = ucfirst($module);
765 $modulelowercase = strtolower($module);
768 $arrayreplacement = array(
769 'mymodule'=>strtolower($modulename),
770 'MyModule'=>$modulename,
771 'MYMODULE'=>strtoupper($modulename),
772 'My module'=>$modulename,
773 'my module'=>$modulename,
774 'Mon module'=>$modulename,
775 'mon module'=>$modulename,
776 'htdocs/modulebuilder/template'=>strtolower($modulename),
777 '__MYCOMPANY_NAME__'=>$mysoc->name,
778 '__KEYWORDS__'=>$modulename,
779 '__USER_FULLNAME__'=>$user->getFullName($langs),
780 '__USER_EMAIL__'=>$user->email,
782 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'dayrfc').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
788 $FILENAMEDOC = $modulelowercase.
'.html';
789 $FILENAMEDOCPDF = $modulelowercase.
'.pdf';
790 $outputfiledoc =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOC;
791 $outputfiledocurl =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOC;
792 $outputfiledocpdf =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOCPDF;
793 $outputfiledocurlpdf =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOCPDF;
798 $langs->load(
"errors");
799 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
805 if ($dirins && $action ==
'addlanguage' && !empty($module)) {
806 $newlangcode =
GETPOST(
'newlangcode',
'aZ09');
809 $modulelowercase = strtolower($module);
814 if ($diroflang == $dolibarr_main_document_root.
'/'.$modulelowercase) {
816 $diroflang = $dolibarr_main_document_root;
818 $srcfile = $diroflang.
'/langs/en_US/'.$modulelowercase.
'.lang';
819 $destfile = $diroflang.
'/langs/'.$newlangcode.
'/'.$modulelowercase.
'.lang';
821 $result =
dol_copy($srcfile, $destfile, 0, 0);
823 setEventMessages($langs->trans(
"ErrorFailToCopyFile", $srcfile, $destfile),
null,
'errors');
826 $srcfile = $diroflang.
'/langs/en_US';
827 $destfile = $diroflang.
'/langs/'.$newlangcode;
829 $result =
dolCopyDir($srcfile, $destfile, 0, 0);
832 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Language")),
null,
'errors');
838 if ($dirins && $action ==
'confirm_removefile' && !empty($module)) {
839 $objectname = $tabobj;
842 if ($relativefilename) {
843 $dirnametodelete = dirname($relativefilename);
844 $filetodelete = $dirins.
'/'.$relativefilename;
845 $dirtodelete = $dirins.
'/'.$dirnametodelete;
849 setEventMessages($langs->trans(
"ErrorFailToDeleteFile", basename($filetodelete)),
null,
'errors');
852 if (preg_match(
'/\.sql$/', $relativefilename)) {
853 if (preg_match(
'/\.key\.sql$/', $relativefilename)) {
854 $relativefilename = preg_replace(
'/\.key\.sql$/',
'.sql', $relativefilename);
855 $filetodelete = $dirins.
'/'.$relativefilename;
857 } elseif (preg_match(
'/\.sql$/', $relativefilename)) {
858 $relativefilename = preg_replace(
'/\.sql$/',
'.key.sql', $relativefilename);
859 $filetodelete = $dirins.
'/'.$relativefilename;
869 if (in_array($tab, array(
'css',
'js'))) {
870 $srcfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
871 $arrayreplacement = array(
'/^\s*\''.preg_quote(
'/'.$relativefilename,
'/').
'\',*/m
'=>'
875 if (preg_match(
'/_extrafields/', $relativefilename)) {
877 $srcfile = $dirins.
'/'.strtolower($module).
'/class/'.strtolower($objectname).
'.class.php';
878 $arrayreplacement = array(
'/\$isextrafieldmanaged = 1;/' =>
'$isextrafieldmanaged = 0;');
883 $varnametoupdate =
'';
885 if (preg_match(
'/_([a-z]+)\.php$/', $relativefilename, $reg)) {
886 $varnametoupdate =
'showtabofpage'.$reg[1];
888 if ($varnametoupdate) {
889 $srcfile = $dirins.
'/'.strtolower($module).
'/lib/'.strtolower($module).
'_'.strtolower($objectname).
'.lib.php';
890 $arrayreplacement = array(
'/\$'.$varnametoupdate.
' = 1;/' =>
'$'.$varnametoupdate.
' = 0;');
898 if ($dirins && $action ==
'initobject' && $module && $objectname) {
899 $objectname = ucfirst($objectname);
901 $dirins = $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
902 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
904 if (preg_match(
'/[^a-z0-9_]/i', $objectname)) {
906 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
907 $tabobj =
'newobject';
909 if (class_exists($objectname)) {
912 setEventMessages($langs->trans(
"AnObjectWithThisClassNameAlreadyExists"),
null,
'errors');
913 $tabobj =
'newobject';
916 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
917 $destdir = $dirins.
'/'.strtolower($module);
928 $dirlist =
dol_dir_list($destdir.
'/class',
'files', 0,
'\.txt$');
929 $alreadyfound =
false;
930 foreach ($dirlist as $key => $val) {
931 $filefound = preg_replace(
'/\.txt$/',
'', $val[
'name']);
932 if (strtolower($objectname) == strtolower($filefound) && $objectname != $filefound) {
933 $alreadyfound =
true;
935 setEventMessages($langs->trans(
"AnObjectAlreadyExistWithThisNameAndDiffCase"),
null,
'errors');
942 $stringforproperties =
'';
943 $tablename =
GETPOST(
'initfromtablename',
'alpha');
945 $_results = $db->DDLDescTable($tablename);
946 if (empty($_results)) {
948 $langs->load(
"errors");
949 setEventMessages($langs->trans(
"ErrorTableNotFound", $tablename),
null,
'errors');
998 $stringforproperties =
'// BEGIN MODULEBUILDER PROPERTIES'.
"\n";
999 $stringforproperties .=
'public $fields=array('.
"\n";
1001 while ($obj = $db->fetch_object($_results)) {
1003 $fieldname = $obj->Field;
1006 if ($type ==
'int(11)') {
1009 if ($type ==
'float') {
1012 if (strstr($type,
'tinyint')) {
1015 if ($obj->Field ==
'fk_soc') {
1016 $type =
'integer:Societe:societe/class/societe.class.php';
1018 if (preg_match(
'/^fk_proj/', $obj->Field)) {
1019 $type =
'integer:Project:projet/class/project.class.php:1:fk_statut=1';
1021 if (preg_match(
'/^fk_prod/', $obj->Field)) {
1022 $type =
'integer:Product:product/class/product.class.php:1';
1024 if ($obj->Field ==
'fk_warehouse') {
1025 $type =
'integer:Entrepot:product/stock/class/entrepot.class.php';
1027 if (preg_match(
'/^(fk_user|fk_commercial)/', $obj->Field)) {
1028 $type =
'integer:User:user/class/user.class.php';
1032 $notnull = ($obj->Null ==
'YES' ? 0 : 1);
1033 if ($fieldname ==
'fk_user_modif') {
1037 $label = preg_replace(
'/_/',
'', ucfirst($fieldname));
1038 if ($fieldname ==
'rowid') {
1039 $label =
'TechnicalID';
1041 if ($fieldname ==
'import_key') {
1042 $label =
'ImportId';
1044 if ($fieldname ==
'fk_soc') {
1045 $label =
'ThirdParty';
1047 if ($fieldname ==
'tms') {
1048 $label =
'DateModification';
1050 if ($fieldname ==
'datec') {
1051 $label =
'DateCreation';
1053 if ($fieldname ==
'date_valid') {
1054 $label =
'DateValidation';
1056 if ($fieldname ==
'datev') {
1057 $label =
'DateValidation';
1059 if ($fieldname ==
'note_private') {
1060 $label =
'NotePublic';
1062 if ($fieldname ==
'note_public') {
1063 $label =
'NotePrivate';
1065 if ($fieldname ==
'fk_user_creat') {
1066 $label =
'UserAuthor';
1068 if ($fieldname ==
'fk_user_modif') {
1069 $label =
'UserModif';
1071 if ($fieldname ==
'fk_user_valid') {
1072 $label =
'UserValidation';
1076 if ($fieldname ==
'entity') {
1079 if ($fieldname ==
'import_key') {
1082 if ($fieldname ==
'fk_user_creat') {
1085 if ($fieldname ==
'fk_user_modif') {
1088 if (in_array($fieldname, array(
'ref_ext',
'model_pdf',
'note_public',
'note_private'))) {
1095 if ($fieldname ==
'entity') {
1100 if (in_array($fieldname, array(
'status',
'statut',
'fk_status',
'fk_statut'))) {
1103 if ($fieldname ==
'import_key') {
1107 if ($fieldname ==
'label') {
1108 $alwayseditable = 1;
1112 if ($fieldname ==
'entity') {
1119 if (preg_match(
'/^fk_/', $fieldname)) {
1120 $css =
'maxwidth500 widthcentpercentminusxx';
1122 if ($fieldname ==
'label') {
1123 $css =
'minwidth300';
1124 $cssview =
'wordbreak';
1126 if (in_array($fieldname, array(
'note_public',
'note_private'))) {
1127 $cssview =
'wordbreak';
1129 if (in_array($fieldname, array(
'ref',
'label')) || preg_match(
'/integer:/', $type)) {
1130 $csslist =
'tdoverflowmax150';
1134 $picto = $obj->Picto;
1135 if ($obj->Field ==
'fk_soc') {
1138 if (preg_match(
'/^fk_proj/', $obj->Field)) {
1143 $stringforproperties .=
"'".$obj->Field.
"'=>array('type'=>'".$type.
"', 'label'=>'".$label.
"',";
1144 if ($default !=
'') {
1145 $stringforproperties .=
" 'default'=>".$default.
",";
1147 $stringforproperties .=
" 'enabled'=>".$enabled.
",";
1148 $stringforproperties .=
" 'visible'=>".$visible;
1150 $stringforproperties .=
", 'notnull'=>".$notnull;
1152 if ($alwayseditable) {
1153 $stringforproperties .=
", 'alwayseditable'=>1";
1155 if ($fieldname ==
'ref' || $fieldname ==
'code') {
1156 $stringforproperties .=
", 'showoncombobox'=>1";
1158 $stringforproperties .=
", 'position'=>".$position;
1160 $stringforproperties .=
", 'index'=>".$index;
1163 $stringforproperties .=
", 'picto'=>'".$picto.
"'";
1166 $stringforproperties .=
", 'css'=>'".$css.
"'";
1169 $stringforproperties .=
", 'cssview'=>'".$cssview.
"'";
1172 $stringforproperties .=
", 'csslist'=>'".$csslist.
"'";
1174 $stringforproperties .=
"),\n";
1177 $stringforproperties .=
');'.
"\n";
1178 $stringforproperties .=
'// END MODULEBUILDER PROPERTIES'.
"\n";
1184 $filetogenerate = array(
1185 'myobject_card.php'=>strtolower($objectname).
'_card.php',
1186 'myobject_note.php'=>strtolower($objectname).
'_note.php',
1187 'myobject_contact.php'=>strtolower($objectname).
'_contact.php',
1188 'myobject_document.php'=>strtolower($objectname).
'_document.php',
1189 'myobject_agenda.php'=>strtolower($objectname).
'_agenda.php',
1190 'myobject_list.php'=>strtolower($objectname).
'_list.php',
1191 'admin/myobject_extrafields.php'=>
'admin/'.strtolower($objectname).
'_extrafields.php',
1192 'lib/mymodule_myobject.lib.php'=>
'lib/'.strtolower($module).
'_'.strtolower($objectname).
'.lib.php',
1194 'sql/llx_mymodule_myobject.sql'=>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'.sql',
1195 'sql/llx_mymodule_myobject.key.sql'=>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'.key.sql',
1196 'sql/llx_mymodule_myobject_extrafields.sql'=>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.sql',
1197 'sql/llx_mymodule_myobject_extrafields.key.sql'=>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.key.sql',
1199 'class/myobject.class.php'=>
'class/'.strtolower($objectname).
'.class.php',
1203 if (
GETPOST(
'includerefgeneration',
'aZ09')) {
1204 dol_mkdir($destdir.
'/core/modules/'.strtolower($module));
1206 $filetogenerate += array(
1207 'core/modules/mymodule/mod_myobject_advanced.php'=>
'core/modules/'.strtolower($module).
'/mod_'.strtolower($objectname).
'_advanced.php',
1208 'core/modules/mymodule/mod_myobject_standard.php'=>
'core/modules/'.strtolower($module).
'/mod_'.strtolower($objectname).
'_standard.php',
1209 'core/modules/mymodule/modules_myobject.php'=>
'core/modules/'.strtolower($module).
'/modules_'.strtolower($objectname).
'.php',
1212 if (
GETPOST(
'includedocgeneration',
'aZ09')) {
1213 dol_mkdir($destdir.
'/core/modules/'.strtolower($module));
1214 dol_mkdir($destdir.
'/core/modules/'.strtolower($module).
'/doc');
1216 $filetogenerate += array(
1217 'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php'=>
'core/modules/'.strtolower($module).
'/doc/doc_generic_'.strtolower($objectname).
'_odt.modules.php',
1218 'core/modules/mymodule/doc/pdf_standard_myobject.modules.php'=>
'core/modules/'.strtolower($module).
'/doc/pdf_standard_'.strtolower($objectname).
'.modules.php'
1224 foreach ($filetogenerate as $srcfile => $destfile) {
1225 $result =
dol_copy($srcdir.
'/'.$srcfile, $destdir.
'/'.$destfile, $newmask, 0);
1229 $langs->load(
"errors");
1230 setEventMessages($langs->trans(
"ErrorFailToCopyFile", $srcdir.
'/'.$srcfile, $destdir.
'/'.$destfile),
null,
'errors');
1233 setEventMessages($langs->trans(
"FileAlreadyExists", $destfile),
null,
'warnings');
1240 if (!$error && $stringforproperties) {
1242 $arrayreplacement = array(
1243 '/\/\/ BEGIN MODULEBUILDER PROPERTIES.*\/\/ END MODULEBUILDER PROPERTIES/ims' => $stringforproperties
1246 dolReplaceInFile($destdir.
'/class/'.strtolower($objectname).
'.class.php', $arrayreplacement,
'', 0, 0, 1);
1250 if (
GETPOST(
'includerefgeneration',
'aZ09')) {
1252 $arrayreplacement = array(
1253 '/\'visible\'=>1,\s*\'noteditable\'=>0,\s*\'default\'=>\'\'/' =>
"'visible'=>4, 'noteditable'=>1, 'default'=>'(PROV)'"
1257 dolReplaceInFile($destdir.
'/class/'.strtolower($objectname).
'.class.php', $arrayreplacement,
'', 0, 0, 1);
1259 $arrayreplacement = array(
1260 '/\'models\' => 0,/' =>
'\'models\
' => 1,'
1262 dolReplaceInFile($destdir.
'/core/modules/mod'.$module.
'.class.php', $arrayreplacement,
'', 0, 0, 1);
1266 if (
GETPOST(
'includedocgeneration',
'aZ09')) {
1268 $arrayreplacement = array(
1269 '/\$includedocgeneration = 0;/' =>
'$includedocgeneration = 1;'
1271 dolReplaceInFile($destdir.
'/class/'.strtolower($objectname).
'.class.php', $arrayreplacement,
'', 0, 0, 1);
1272 dolReplaceInFile($destdir.
'/'.strtolower($objectname).
'_card.php', $arrayreplacement,
'', 0, 0, 1);
1274 $arrayreplacement = array(
1275 '/\'models\' => 0,/' =>
'\'models\
' => 1,'
1278 dolReplaceInFile($destdir.
'/core/modules/mod'.$module.
'.class.php', $arrayreplacement,
'', 0, 0, 1);
1285 $listofobject =
dol_dir_list($destdir.
'/class',
'files', 0,
'\.class\.php$');
1287 $firstobjectname =
'';
1288 foreach ($listofobject as $fileobj) {
1289 if (preg_match(
'/^api_/', $fileobj[
'name'])) {
1292 if (preg_match(
'/^actions_/', $fileobj[
'name'])) {
1296 $tmpcontent = file_get_contents($fileobj[
'fullname']);
1298 if (preg_match(
'/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) {
1299 $objectnameloop = $reg[1];
1300 if (empty($firstobjectname)) {
1301 $firstobjectname = $objectnameloop;
1307 \$this->menu[\$r++]=array(
1308 // '' 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
1309 'fk_menu'=>'fk_mainmenu=mymodule',
1310 // This is a Left menu entry
1312 'titre'=>'List MyObject',
1313 'mainmenu'=>'mymodule',
1314 'leftmenu'=>'mymodule_myobject',
1315 'url'=>'/mymodule/myobject_list.php',
1316 // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
1317 'langs'=>'mymodule@mymodule',
1318 'position'=>1100+\$r,
1319 // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected.
1320 'enabled'=>'\$conf->mymodule->enabled',
1321 // Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
1324 // 0=Menu for internal users, 1=external users, 2=both
1327 \$this->menu[\$r++]=array(
1328 // '' 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
1329 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=mymodule_myobject',
1330 // This is a Left menu entry
1332 'titre'=>'New MyObject',
1333 'mainmenu'=>'mymodule',
1334 'leftmenu'=>'mymodule_myobject',
1335 'url'=>'/mymodule/myobject_card.php?action=create',
1336 // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
1337 'langs'=>'mymodule@mymodule',
1338 'position'=>1100+\$r,
1339 // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected.
1340 'enabled'=>'\$conf->mymodule->enabled',
1341 // Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
1344 // 0=Menu for internal users, 1=external users, 2=both
1347 $stringtoadd = preg_replace(
'/MyObject/', $objectnameloop, $stringtoadd);
1348 $stringtoadd = preg_replace(
'/mymodule/', strtolower($module), $stringtoadd);
1349 $stringtoadd = preg_replace(
'/myobject/', strtolower($objectnameloop), $stringtoadd);
1351 $moduledescriptorfile = $destdir.
'/core/modules/mod'.$module.
'.class.php';
1356 dolReplaceInFile($moduledescriptorfile, array(
'END MODULEBUILDER LEFTMENU MYOBJECT */' =>
'*/'.
"\n".$stringtoadd.
"\n\t\t/* END MODULEBUILDER LEFTMENU MYOBJECT */"));
1359 $filetogenerate[] =
'core/modules/mod'.$module.
'.class.php';
1365 foreach ($filetogenerate as $destfile) {
1366 $phpfileval[
'fullname'] = $destdir.
'/'.$destfile;
1369 $arrayreplacement = array(
1370 'mymodule'=>strtolower($module),
1371 'MyModule'=>$module,
1372 'MYMODULE'=>strtoupper($module),
1373 'My module'=>$module,
1374 'my module'=>$module,
1375 'mon module'=>$module,
1376 'Mon module'=>$module,
1377 'htdocs/modulebuilder/template/'=>strtolower($modulename),
1378 'myobject'=>strtolower($objectname),
1379 'MyObject'=>$objectname,
1380 'MYOBJECT'=>strtoupper($objectname),
1381 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
1384 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME)) {
1385 $arrayreplacement[
'Editor name'] = $conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME;
1387 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_URL)) {
1388 $arrayreplacement[
'https://www.example.com'] = $conf->global->MODULEBUILDER_SPECIFIC_EDITOR_URL;
1390 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_AUTHOR)) {
1391 $arrayreplacement[
'---Put here your own copyright and developer email---'] =
dol_print_date($now,
'%Y').
' '.$conf->global->MODULEBUILDER_SPECIFIC_AUTHOR;
1393 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_VERSION)) {
1394 $arrayreplacement[
'1.0'] = $conf->global->MODULEBUILDER_SPECIFIC_VERSION;
1396 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_FAMILY)) {
1397 $arrayreplacement[
'other'] = $conf->global->MODULEBUILDER_SPECIFIC_FAMILY;
1403 setEventMessages($langs->trans(
"ErrorFailToMakeReplacementInto", $phpfileval[
'fullname']),
null,
'errors');
1412 if (is_numeric($object) && $object <= 0) {
1413 $pathoffiletoeditsrc = $destdir.
'/class/'.strtolower($objectname).
'.class.php';
1414 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $pathoffiletoeditsrc),
null,
'errors');
1420 $result =
rebuildObjectSql($destdir, $module, $objectname, $newmask,
'', $object);
1429 setEventMessages($langs->trans(
'FilesForObjectInitialized', $objectname),
null);
1430 $tabobj = $objectname;
1432 $tabobj =
'newobject';
1437 if ($dirins && $action ==
'initdic' && $module && $dicname) {
1439 $newdicname = $dicname;
1440 if (!preg_match(
'/^c_/', $newdicname)) {
1441 $newdicname =
'c_'.$dicname;
1451 if ($dirins && ($action ==
'droptable' || $action ==
'droptableextrafields') && !empty($module) && !empty($tabobj)) {
1452 $objectname = $tabobj;
1454 $arrayoftables = array();
1455 if ($action ==
'droptable') {
1456 $arrayoftables[] = MAIN_DB_PREFIX.strtolower($module).
'_'.strtolower($tabobj);
1458 if ($action ==
'droptableextrafields') {
1459 $arrayoftables[] = MAIN_DB_PREFIX.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields';
1462 foreach ($arrayoftables as $tabletodrop) {
1464 $sql =
"SELECT COUNT(*) as nb FROM ".$tabletodrop;
1465 $resql = $db->query($sql);
1467 $obj = $db->fetch_object(
$resql);
1472 if ($db->lasterrno() ==
'DB_ERROR_NOSUCHTABLE') {
1473 setEventMessages($langs->trans(
"TableDoesNotExists", $tabletodrop),
null,
'warnings');
1479 $resql = $db->DDLDropTable($tabletodrop);
1481 setEventMessages($langs->trans(
"TableDropped", $tabletodrop),
null,
'mesgs');
1482 } elseif ($nb > 0) {
1483 setEventMessages($langs->trans(
"TableNotEmptyDropCanceled", $tabletodrop),
null,
'warnings');
1488 if ($dirins && $action ==
'addproperty' && empty($cancel) && !empty($module) && !empty($tabobj)) {
1491 $objectname = $tabobj;
1493 $dirins = $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
1494 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
1496 $srcdir = $dirread.
'/'.strtolower($module);
1497 $destdir = $dirins.
'/'.strtolower($module);
1501 if (!
GETPOST(
'regenerateclasssql') && !
GETPOST(
'regeneratemissing')) {
1502 if (!
GETPOST(
'propname',
'aZ09')) {
1504 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Name")),
null,
'errors');
1506 if (!
GETPOST(
'proplabel',
'alpha')) {
1508 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
1510 if (!
GETPOST(
'proptype',
'alpha')) {
1512 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Type")),
null,
'errors');
1515 if (!$error && !
GETPOST(
'regenerateclasssql')&& !
GETPOST(
'regeneratemissing')) {
1516 $addfieldentry = array(
1517 'name'=>
GETPOST(
'propname',
'aZ09'),
1518 'label'=>
GETPOST(
'proplabel',
'alpha'),
1519 'type'=>
GETPOST(
'proptype',
'alpha'),
1520 'arrayofkeyval'=>
GETPOST(
'proparrayofkeyval',
'restricthtml'),
1521 'visible'=>
GETPOST(
'propvisible',
'int'),
1522 'enabled'=>
GETPOST(
'propenabled',
'int'),
1523 'position'=>
GETPOST(
'propposition',
'int'),
1524 'notnull'=>
GETPOST(
'propnotnull',
'int'),
1525 'index'=>
GETPOST(
'propindex',
'int'),
1526 'searchall'=>
GETPOST(
'propsearchall',
'int'),
1527 'isameasure'=>
GETPOST(
'propisameasure',
'int'),
1528 'comment'=>
GETPOST(
'propcomment',
'alpha'),
1529 'help'=>
GETPOST(
'prophelp',
'alpha'),
1530 'css'=>
GETPOST(
'propcss',
'alpha'),
1531 'cssview'=>
GETPOST(
'propcssview',
'alpha'),
1532 'csslist'=>
GETPOST(
'propcsslist',
'alpha'),
1533 'default'=>
GETPOST(
'propdefault',
'restricthtml'),
1534 'noteditable'=>intval(
GETPOST(
'propnoteditable',
'int')),
1535 'alwayseditable'=>intval(
GETPOST(
'propalwayseditable',
'int')),
1536 'validate' =>
GETPOST(
'propvalidate',
'int')
1540 if (!empty($addfieldentry[
'arrayofkeyval']) && !is_array($addfieldentry[
'arrayofkeyval'])) {
1541 $addfieldentry[
'arrayofkeyval'] = json_decode($addfieldentry[
'arrayofkeyval'],
true);
1545 $addfieldentry = array();
1554 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
1558 $object =
rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry, $moduletype);
1560 if (is_numeric($object) && $object <= 0) {
1561 $pathoffiletoeditsrc = $destdir.
'/class/'.strtolower($objectname).
'.class.php';
1562 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $pathoffiletoeditsrc),
null,
'errors');
1569 $result =
rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object, $moduletype);
1572 setEventMessages($langs->trans(
'ErrorFailToCreateFile',
'.sql'),
null,
'errors');
1578 clearstatcache(
true);
1580 setEventMessages($langs->trans(
'FilesForObjectUpdated', $objectname),
null);
1585 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj='.$objectname.
'&nocache='.time());
1591 if ($dirins && $action ==
'confirm_deleteproperty' && $propertykey) {
1592 $objectname = $tabobj;
1594 $dirins = $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
1595 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
1597 $srcdir = $dirread.
'/'.strtolower($module);
1598 $destdir = $dirins.
'/'.strtolower($module);
1603 $object =
rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, array(), $propertykey);
1605 if (is_numeric($object) && $object <= 0) {
1606 $pathoffiletoeditsrc = $destdir.
'/class/'.strtolower($objectname).
'.class.php';
1607 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $pathoffiletoeditsrc),
null,
'errors');
1614 $result =
rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object);
1617 setEventMessages($langs->trans(
'ErrorFailToCreateFile',
'.sql'),
null,
'errors');
1623 setEventMessages($langs->trans(
'FilesForObjectUpdated', $objectname),
null);
1625 clearstatcache(
true);
1628 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj='.$objectname);
1634 if ($dirins && $action ==
'confirm_deletemodule') {
1635 if (preg_match(
'/[^a-z0-9_]/i', $module)) {
1637 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
1641 $modulelowercase = strtolower($module);
1644 $dir = $dirins.
'/'.$modulelowercase;
1646 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
1656 $class =
'mod'.$module;
1658 if (class_exists($class)) {
1660 $moduleobj =
new $class($db);
1667 $langs->load(
"errors");
1668 dol_print_error($db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
1672 $moduleobj->remove();
1679 clearstatcache(
true);
1680 if (function_exists(
'opcache_invalidate')) {
1684 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?module=deletemodule');
1692 $module =
'deletemodule';
1695 if ($dirins && $action ==
'confirm_deleteobject' && $objectname) {
1696 if (preg_match(
'/[^a-z0-9_]/i', $objectname)) {
1698 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
1702 $modulelowercase = strtolower($module);
1703 $objectlowercase = strtolower($objectname);
1706 $dir = $dirins.
'/'.$modulelowercase;
1709 $filetodelete = array(
1710 'myobject_card.php'=>strtolower($objectname).
'_card.php',
1711 'myobject_note.php'=>strtolower($objectname).
'_note.php',
1712 'myobject_contact.php'=>strtolower($objectname).
'_contact.php',
1713 'myobject_document.php'=>strtolower($objectname).
'_document.php',
1714 'myobject_agenda.php'=>strtolower($objectname).
'_agenda.php',
1715 'myobject_list.php'=>strtolower($objectname).
'_list.php',
1716 'admin/myobject_extrafields.php'=>
'admin/'.strtolower($objectname).
'_extrafields.php',
1717 'lib/mymodule_myobject.lib.php'=>
'lib/'.strtolower($module).
'_'.strtolower($objectname).
'.lib.php',
1718 'test/phpunit/MyObjectTest.php'=>
'test/phpunit/'.strtolower($objectname).
'Test.php',
1719 'sql/llx_mymodule_myobject.sql'=>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'.sql',
1720 'sql/llx_mymodule_myobject_extrafields.sql'=>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.sql',
1721 'sql/llx_mymodule_myobject.key.sql'=>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'.key.sql',
1722 'sql/llx_mymodule_myobject_extrafields.key.sql'=>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.key.sql',
1723 'scripts/myobject.php'=>
'scripts/'.strtolower($objectname).
'.php',
1724 'class/myobject.class.php'=>
'class/'.strtolower($objectname).
'.class.php',
1725 'class/api_myobject.class.php'=>
'class/api_'.strtolower($module).
'.class.php',
1726 'core/modules/mymodule/mod_myobject_advanced.php'=>
'core/modules/'.strtolower($module).
'/mod_'.strtolower($objectname).
'_advanced.php',
1727 'core/modules/mymodule/mod_myobject_standard.php'=>
'core/modules/'.strtolower($module).
'/mod_'.strtolower($objectname).
'_standard.php',
1728 'core/modules/mymodule/modules_myobject.php'=>
'core/modules/'.strtolower($module).
'/modules_'.strtolower($objectname).
'.php',
1729 'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php'=>
'core/modules/'.strtolower($module).
'/doc/doc_generic_'.strtolower($objectname).
'_odt.modules.php',
1730 'core/modules/mymodule/doc/pdf_standard_myobject.modules.php'=>
'core/modules/'.strtolower($module).
'/doc/pdf_standard_'.strtolower($objectname).
'.modules.php'
1734 foreach ($filetodelete as $tmpfiletodelete) {
1736 $resulttmp =
dol_delete_file($dir.
'/'.$tmpfiletodelete.
'.back', 0, 0, 1);
1742 if ($resultko == 0) {
1745 setEventMessages($langs->trans(
"ErrorSomeFilesCouldNotBeDeleted"),
null,
'warnings');
1750 $tabobj =
'deleteobject';
1753 if ($dirins && $action ==
'generatedoc') {
1754 $modulelowercase = strtolower($module);
1759 $FILENAMEDOC = strtolower($module).
'.html';
1761 $util =
new Utils($db);
1762 $result = $util->generateDoc($module);
1765 setEventMessages($langs->trans(
"DocFileGeneratedInto", $dirofmodule),
null);
1771 if ($dirins && $action ==
'generatepackage') {
1772 $modulelowercase = strtolower($module);
1774 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
1784 $class =
'mod'.$module;
1786 if (class_exists($class)) {
1788 $moduleobj =
new $class($db);
1795 $langs->load(
"errors");
1796 dol_print_error($db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
1800 $arrayversion = explode(
'.', $moduleobj->version, 3);
1801 if (count($arrayversion)) {
1802 $FILENAMEZIP =
"module_".$modulelowercase.
'-'.$arrayversion[0].(empty($arrayversion[1]) ?
'.0' :
'.'.$arrayversion[1]).(empty($arrayversion[2]) ?
'' :
'.'.$arrayversion[2]).
'.zip';
1805 $outputfilezip = $dirofmodule.
'/'.$FILENAMEZIP;
1811 $result = dol_compress_dir($dir, $outputfilezip,
'zip',
'/\/bin\/|\.git|\.old|\.back|\.ssh/', $modulelowercase);
1817 setEventMessages($langs->trans(
"ZipFileGeneratedInto", $outputfilezip),
null);
1820 $langs->load(
"errors");
1821 setEventMessages($langs->trans(
"ErrorFailToGenerateFile", $outputfilezip),
null,
'errors');
1825 $langs->load(
"errors");
1826 setEventMessages($langs->trans(
"ErrorCheckVersionIsDefined"),
null,
'errors');
1832 if ($action ==
'savefile' && empty($cancel)) {
1833 $relofcustom = basename($dirins);
1837 if (!preg_match(
'/^'.$relofcustom.
'/', $file)) {
1838 $file = $relofcustom.
'/'.$file;
1846 dol_copy($pathoffile, $pathoffilebackup, 0, 1);
1849 $check =
'restricthtml';
1851 if ($srclang ==
'md') {
1852 $check =
'restricthtml';
1854 if ($srclang ==
'lang') {
1855 $check =
'restricthtml';
1857 if ($srclang ==
'php') {
1861 $content =
GETPOST(
'editfilecontent', $check);
1866 $result = file_put_contents($pathoffile, $content);
1868 @chmod($pathoffile, octdec($newmask));
1883 if ($action ==
'set' && $user->admin) {
1886 $param .=
'&module='.urlencode($module);
1889 $param .=
'&tab='.urlencode($tab);
1892 $param .=
'&tabobj='.urlencode($tabobj);
1895 $value =
GETPOST(
'value',
'alpha');
1897 if (!empty($resarray[
'errors'])) {
1901 if ($resarray[
'nbperms'] > 0) {
1902 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
1903 $resqltmp = $db->query($tmpsql);
1905 $obj = $db->fetch_object($resqltmp);
1907 if ($obj && $obj->nb > 1) {
1908 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
1916 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?".$param);
1921 if ($action ==
'reset' && $user->admin) {
1924 $param .=
'&module='.urlencode($module);
1927 $param .=
'&tab='.urlencode($tab);
1930 $param .=
'&tabobj='.urlencode($tabobj);
1933 $value =
GETPOST(
'value',
'alpha');
1938 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?".$param);
1959 '/includes/ace/src/ace.js',
1960 '/includes/ace/src/ext-statusbar.js',
1961 '/includes/ace/src/ext-language_tools.js',
1966 llxHeader(
'', $langs->trans(
"ModuleBuilder"),
$help_url,
'', 0, 0, $morejs, $morecss,
'',
'classforhorizontalscrolloftabs');
1969 $text = $langs->trans(
"ModuleBuilder");
1973 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ModuleBuilderDesc",
'https://wiki.dolibarr.org/index.php/Module_development#Create_your_module').
'</span>';
1974 print
'<br class="hideonsmartphone">';
1983 $message =
info_admin($langs->trans(
"ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.
'/custom', DOL_DOCUMENT_ROOT));
1988 $langs->load(
"errors");
1989 $message =
info_admin($langs->trans(
"ErrorFailedToWriteInDir", $dirins));
1993 $message =
info_admin($langs->trans(
"NotExistsDirect", $dirins).$langs->trans(
"InfDirAlt").$langs->trans(
"InfDirExample"));
2002 $infomodulesfound =
'<div style="padding: 12px 9px 12px">'.$form->textwithpicto(
'', $langs->trans(
"ModuleBuilderDesc3", count($listofmodules)).
'<br><br>'.$langs->trans(
"ModuleBuilderDesc4", $FILEFLAG).
'<br>'.$textforlistofdirs).
'</div>';
2006 $dolibarrdataroot = preg_replace(
'/([\\/]+)$/i',
'', DOL_DATA_ROOT);
2007 $allowonlineinstall =
true;
2008 if (
dol_is_file($dolibarrdataroot.
'/installmodules.lock')) {
2009 $allowonlineinstall =
false;
2011 if (empty($allowonlineinstall)) {
2014 $message =
info_admin($langs->trans(
'InstallModuleFromWebHasBeenDisabledContactUs'));
2017 $message =
info_admin($langs->trans(
"InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.
'/installmodules.lock'), 0, 0, 1,
'warning');
2032 if (!empty($module) && $module !=
'initmodule' && $module !=
'deletemodule') {
2033 $modulelowercase = strtolower($module);
2034 $loadclasserrormessage =
'';
2038 $fullpathdirtodescriptor = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2043 $class =
'mod'.$module;
2044 }
catch (Throwable $e) {
2045 $loadclasserrormessage = $e->getMessage().
"<br>\n";
2046 $loadclasserrormessage .=
'File: '.$e->getFile().
"<br>\n";
2047 $loadclasserrormessage .=
'Line: '.$e->getLine().
"<br>\n";
2049 $loadclasserrormessage = $e->getMessage().
"<br>\n";
2050 $loadclasserrormessage .=
'File: '.$e->getFile().
"<br>\n";
2051 $loadclasserrormessage .=
'Line: '.$e->getLine().
"<br>\n";
2054 if (class_exists($class)) {
2056 $moduleobj =
new $class($db);
2059 print $e->getMessage();
2062 if (empty($forceddirread)) {
2065 $langs->load(
"errors");
2066 print
'<!-- ErrorFailedToLoadModuleDescriptorForXXX -->';
2067 print
img_warning(
'').
' '.$langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module).
'<br>';
2068 print $loadclasserrormessage;
2079 $head[$h][0] = $_SERVER[
"PHP_SELF"].
'?module=initmodule';
2080 $head[$h][1] =
'<span class="valignmiddle text-plus-circle">'.$langs->trans(
"NewModule").
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
2081 $head[$h][2] =
'initmodule';
2084 $linktoenabledisable =
'';
2086 if (is_array($listofmodules) && count($listofmodules) > 0) {
2088 $modulelowercase = strtolower($module);
2089 $const_name =
'MAIN_MODULE_'.strtoupper($module);
2093 $param .=
'&tab='.urlencode($tab);
2096 $param .=
'&module='.urlencode($module);
2099 $param .=
'&tabobj='.urlencode($tabobj);
2102 $urltomodulesetup =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?search_keyword='.urlencode($module).
'">'.$langs->trans(
'Home').
'-'.$langs->trans(
"Setup").
'-'.$langs->trans(
"Modules").
'</a>';
2106 $linktoenabledisable .=
'<a class="reposition asetresetmodule valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$moduleobj->numero.
'&action=reset&token='.
newToken().
'&value=mod'.$module.$param.
'">';
2107 $linktoenabledisable .=
img_picto($langs->trans(
"Activated"),
'switch_on',
'',
false, 0, 0,
'',
'', 1);
2108 $linktoenabledisable .=
'</a>';
2110 $linktoenabledisable .=
$form->textwithpicto(
'', $langs->trans(
"Warning").
' : '.$langs->trans(
"ModuleIsLive"), -1,
'warning');
2112 $objMod = $moduleobj;
2113 $backtourlparam =
'';
2114 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'module='.$module;
2116 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'tab='.$tab;
2118 $backtourl = $_SERVER[
"PHP_SELF"].$backtourlparam;
2121 if (is_array($objMod->config_page_url)) {
2123 foreach ($objMod->config_page_url as $page) {
2126 $linktoenabledisable .=
' <a href="'.$urlpage.
'" title="'.$langs->trans($page).
'">'.
img_picto(ucfirst($page),
"setup").
'</a>';
2129 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
2130 $urltouse =
dol_buildpath(
'/'.$regs[2].
'/admin/'.$regs[1], 1);
2131 $linktoenabledisable .=
' <a href="'.$urltouse.(preg_match(
'/\?/', $urltouse) ?
'&' :
'?').
'save_lastsearch_values=1&backtopage='.urlencode($backtourl).
'" title="'.$langs->trans(
"Setup").
'">'.
img_picto($langs->trans(
"Setup"),
"setup",
'style="padding-right: 8px"').
'</a>';
2135 $urltouse = DOL_URL_ROOT.
'/admin/'.$urlpage;
2136 $linktoenabledisable .=
' <a href="'.$urltouse.(preg_match(
'/\?/', $urltouse) ?
'&' :
'?').
'save_lastsearch_values=1&backtopage='.urlencode($backtourl).
'" title="'.$langs->trans(
"Setup").
'">'.
img_picto($langs->trans(
"Setup"),
"setup",
'style="padding-right: 8px"').
'</a>';
2140 } elseif (preg_match(
'/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) {
2141 $linktoenabledisable .=
' <a href="'.dol_buildpath(
'/'.$regs[2].
'/admin/'.$regs[1], 1).
'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).
'" title="'.$langs->trans(
"Setup").
'">'.
img_picto($langs->trans(
"Setup"),
"setup",
'style="padding-right: 8px"').
'</a>';
2144 if (!empty($moduleobj)) {
2145 $linktoenabledisable .=
'<a class="reposition asetresetmodule valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$moduleobj->numero.
'&action=set&token='.
newToken().
'&value=mod'.$module.$param.
'">';
2146 $linktoenabledisable .=
img_picto($langs->trans(
"ModuleIsNotActive", $urltomodulesetup),
'switch_off',
'style="padding-right: 8px"',
false, 0, 0,
'',
'classfortooltip', 1);
2147 $linktoenabledisable .=
"</a>\n";
2152 foreach ($listofmodules as $tmpmodule => $tmpmodulearray) {
2153 $head[$h][0] = $_SERVER[
"PHP_SELF"].
'?module='.$tmpmodulearray[
'modulenamewithcase'].($forceddirread ?
'@'.$dirread :
'');
2154 $head[$h][1] = $tmpmodulearray[
'modulenamewithcase'];
2155 $head[$h][2] = $tmpmodulearray[
'modulenamewithcase'];
2157 if ($tmpmodulearray[
'modulenamewithcase'] == $module) {
2158 $head[$h][4] =
'<span class="inline-block">'.$linktoenabledisable.
'</span>';
2165 $head[$h][0] = $_SERVER[
"PHP_SELF"].
'?module=deletemodule';
2166 $head[$h][1] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"DangerZone");
2167 $head[$h][2] =
'deletemodule';
2173 if ($module ==
'initmodule') {
2175 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
2176 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2177 print
'<input type="hidden" name="action" value="initmodule">';
2178 print
'<input type="hidden" name="module" value="initmodule">';
2183 print
'<div class="tagtable">';
2185 print
'<div class="tagtr"><div class="tagtd">';
2186 print
'<span class="opacitymedium">'.$langs->trans(
"IdModule").
'</span>';
2187 print
'</div><div class="tagtd">';
2188 print
'<input type="text" name="idmodule" class="width75" value="500000" placeholder="'.dol_escape_htmltag($langs->trans(
"IdModule")).
'">';
2189 print
'<span class="opacitymedium">';
2191 print
dolButtonToOpenUrlInDialogPopup(
'popup_modules_id', $langs->transnoentitiesnoconv(
"SeeIDsInUse"), $langs->transnoentitiesnoconv(
"SeeIDsInUse"),
'/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info',
'',
'');
2193 print
'<a href="https://wiki.dolibarr.org/index.php/List_of_modules_id" target="_blank" rel="noopener noreferrer external">'.$langs->trans(
"SeeReservedIDsRangeHere").
'</a>';
2196 print
'</div></div>';
2198 print
'<div class="tagtr"><div class="tagtd">';
2199 print
'<span class="opacitymedium">'.$langs->trans(
"ModuleName").
'</span>';
2200 print
'</div><div class="tagtd">';
2201 print
'<input type="text" name="modulename" value="'.dol_escape_htmltag($modulename).
'" autofocus>';
2202 print
' '.$form->textwithpicto(
'', $langs->trans(
"EnterNameOfModuleDesc"));
2203 print
'</div></div>';
2205 print
'<div class="tagtr"><div class="tagtd">';
2206 print
'<span class="opacitymedium">'.$langs->trans(
"Description").
'</span>';
2207 print
'</div><div class="tagtd">';
2208 print
'<input type="text" name="description" value="" class="minwidth500"><br>';
2209 print
'</div></div>';
2211 print
'<div class="tagtr"><div class="tagtd">';
2212 print
'<span class="opacitymedium">'.$langs->trans(
"Version").
'</span>';
2213 print
'</div><div class="tagtd">';
2214 print
'<input type="text" name="version" class="width75" value="'.(GETPOSTISSET(
'version') ?
GETPOST(
'version') :
getDolGlobalString(
'MODULEBUILDER_SPECIFIC_VERSION',
'1.0')).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"Version")).
'">';
2215 print
'</div></div>';
2217 print
'<div class="tagtr"><div class="tagtd">';
2218 print
'<span class="opacitymedium">'.$langs->trans(
"Family").
'</span>';
2219 print
'</div><div class="tagtd">';
2220 print
'<select name="family" id="family" class="minwidth400">';
2221 $arrayoffamilies = array(
2222 'hr' =>
"ModuleFamilyHr",
2223 'crm' =>
"ModuleFamilyCrm",
2224 'srm' =>
"ModuleFamilySrm",
2225 'financial' =>
'ModuleFamilyFinancial',
2226 'products' =>
'ModuleFamilyProducts',
2227 'projects' =>
'ModuleFamilyProjects',
2228 'ecm' =>
'ModuleFamilyECM',
2229 'technic' =>
'ModuleFamilyTechnic',
2230 'portal' =>
'ModuleFamilyPortal',
2231 'interface' =>
'ModuleFamilyInterface',
2232 'base' =>
'ModuleFamilyBase',
2233 'other' =>
'ModuleFamilyOther'
2235 foreach ($arrayoffamilies as $key => $value) {
2236 print
'<option value="hr"'.($key ==
getDolGlobalString(
'MODULEBUILDER_SPECIFIC_FAMILY',
'other') ?
' selected="selected"' :
'').
' data-html="'.
dol_escape_htmltag($langs->trans($value).
' <span class="opacitymedium">- '.$key.
'</span>').
'">'.$langs->trans($value).
'</option>';
2240 print
'</div></div>';
2242 print
'<div class="tagtr"><div class="tagtd">';
2243 print
'<span class="opacitymedium">'.$langs->trans(
"Picto").
'</span>';
2244 print
'</div><div class="tagtd">';
2245 print
'<input type="text" name="idpicto" value="'.(GETPOSTISSET(
'idpicto') ?
GETPOST(
'idpicto') :
getDolGlobalString(
'MODULEBUILDER_DEFAULTPICTO',
'fa-generic')).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"Picto")).
'">';
2246 print
$form->textwithpicto(
'', $langs->trans(
"Example").
': fa-generic, fa-globe, ... any font awesome code.<br>Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]');
2247 print
'</div></div>';
2249 print
'<div class="tagtr"><div class="tagtd">';
2250 print
'<span class="opacitymedium">'.$langs->trans(
"EditorName").
'</span>';
2251 print
'</div><div class="tagtd">';
2252 print
'<input type="text" name="editorname" value="'.(GETPOSTISSET(
'editorname') ?
GETPOST(
'editorname') :
getDolGlobalString(
'MODULEBUILDER_SPECIFIC_EDITOR_NAME', $mysoc->
name)).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"EditorName")).
'"><br>';
2253 print
'</div></div>';
2255 print
'<div class="tagtr"><div class="tagtd">';
2256 print
'<span class="opacitymedium">'.$langs->trans(
"EditorUrl").
'</span>';
2257 print
'</div><div class="tagtd">';
2258 print
'<input type="text" name="editorurl" value="'.(GETPOSTISSET(
'editorurl') ?
GETPOST(
'editorurl') :
getDolGlobalString(
'MODULEBUILDER_SPECIFIC_EDITOR_URL', $mysoc->url)).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"EditorUrl")).
'"><br>';
2259 print
'</div></div>';
2261 print
'<br><input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans(
"Create")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
2263 } elseif ($module ==
'deletemodule') {
2264 print
'<!-- Form to init a module -->'.
"\n";
2265 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="delete">';
2266 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2267 print
'<input type="hidden" name="action" value="confirm_deletemodule">';
2268 print
'<input type="hidden" name="module" value="deletemodule">';
2270 print $langs->trans(
"EnterNameOfModuleToDeleteDesc").
'<br><br>';
2272 print
'<input type="text" name="module" placeholder="'.dol_escape_htmltag($langs->trans(
"ModuleKey")).
'" value="">';
2273 print
'<input type="submit" class="button smallpaddingimp" value="'.$langs->trans(
"Delete").
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
2275 } elseif (!empty($module)) {
2278 $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
2283 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=description&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2284 $head2[$h][1] = $langs->trans(
"Description");
2285 $head2[$h][2] =
'description';
2288 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2289 $head2[$h][1] = $langs->trans(
"Objects");
2290 $head2[$h][2] =
'objects';
2293 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=languages&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2294 $head2[$h][1] = $langs->trans(
"Languages");
2295 $head2[$h][2] =
'languages';
2298 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2299 $head2[$h][1] = $langs->trans(
"Dictionaries");
2300 $head2[$h][2] =
'dictionaries';
2303 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=permissions&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2304 $head2[$h][1] = $langs->trans(
"Permissions");
2305 $head2[$h][2] =
'permissions';
2308 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=tabs&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2309 $head2[$h][1] = $langs->trans(
"Tabs");
2310 $head2[$h][2] =
'tabs';
2313 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=menus&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2314 $head2[$h][1] = $langs->trans(
"Menus");
2315 $head2[$h][2] =
'menus';
2318 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=hooks&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2319 $head2[$h][1] = $langs->trans(
"Hooks");
2320 $head2[$h][2] =
'hooks';
2323 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=triggers&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2324 $head2[$h][1] = $langs->trans(
"Triggers");
2325 $head2[$h][2] =
'triggers';
2328 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=widgets&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2329 $head2[$h][1] = $langs->trans(
"Widgets");
2330 $head2[$h][2] =
'widgets';
2333 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=exportimport&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2334 $head2[$h][1] = $langs->trans(
"Export").
'-'.$langs->trans(
"Import");
2335 $head2[$h][2] =
'exportimport';
2338 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=css&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2339 $head2[$h][1] = $langs->trans(
"CSS");
2340 $head2[$h][2] =
'css';
2343 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=js&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2344 $head2[$h][1] = $langs->trans(
"JS");
2345 $head2[$h][2] =
'js';
2348 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=cli&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2349 $head2[$h][1] = $langs->trans(
"CLI");
2350 $head2[$h][2] =
'cli';
2353 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=cron&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2354 $head2[$h][1] = $langs->trans(
"CronList");
2355 $head2[$h][2] =
'cron';
2358 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=specifications&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2359 $head2[$h][1] = $langs->trans(
"Documentation");
2360 $head2[$h][2] =
'specifications';
2363 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=buildpackage&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2364 $head2[$h][1] = $langs->trans(
"BuildPackage");
2365 $head2[$h][2] =
'buildpackage';
2368 $MAXTABFOROBJECT = 15;
2370 print
'<!-- Section for a given module -->';
2374 if ($tab ==
'description') {
2375 print
'<!-- tab=description -->'.
"\n";
2376 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2377 $pathtofilereadme = $modulelowercase.
'/README.md';
2378 $pathtochangelog = $modulelowercase.
'/ChangeLog.md';
2380 if ($action !=
'editfile' || empty($file)) {
2381 print
dol_get_fiche_head($head2, $tab,
'', -1,
'', 0,
'',
'', $MAXTABFOROBJECT,
'formodulesuffix');
2383 print
'<span class="opacitymedium">'.$langs->trans(
"ModuleBuilderDesc".$tab).
'</span>';
2384 $infoonmodulepath =
'';
2385 if (realpath($dirread.
'/'.$modulelowercase) != $dirread.
'/'.$modulelowercase) {
2386 $infoonmodulepath =
'<span class="opacitymedium">'.$langs->trans(
"RealPathOfModule").
' :</span> <strong class="wordbreak">'.realpath($dirread.
'/'.$modulelowercase).
'</strong><br>';
2387 print
' '.$infoonmodulepath;
2394 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
2395 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2398 print
'<tr><td><span class="fa fa-file-o"></span> '.$langs->trans(
"ReadmeFile").
' : <strong class="wordbreak">'.$pathtofilereadme.
'</strong>';
2399 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=markdown&file='.urlencode($pathtofilereadme).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2402 print
'<tr><td><span class="fa fa-file-o"></span> '.$langs->trans(
"ChangeLog").
' : <strong class="wordbreak">'.$pathtochangelog.
'</strong>';
2403 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=markdown&file='.urlencode($pathtochangelog).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2409 print
load_fiche_titre(
$form->textwithpicto($langs->trans(
"DescriptorFile"), $langs->transnoentitiesnoconv(
"File").
' '.$pathtofile),
'',
'');
2411 if (!empty($moduleobj)) {
2412 print
'<div class="underbanner clearboth"></div>';
2413 print
'<div class="fichecenter">';
2415 print
'<table class="border centpercent">';
2416 print
'<tr class="liste_titre"><td class="titlefield">';
2417 print $langs->trans(
"Parameter");
2419 print $langs->trans(
"Value");
2423 print $langs->trans(
"IdModule");
2425 print $moduleobj->numero;
2426 print
'<span class="opacitymedium">';
2427 print
' (<a href="'.DOL_URL_ROOT.
'/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info" target="_blank" rel="noopener noreferrer">'.$langs->trans(
"SeeIDsInUse").
'</a>';
2428 print
' - <a href="https://wiki.dolibarr.org/index.php/List_of_modules_id" target="_blank" rel="noopener noreferrer external">'.$langs->trans(
"SeeReservedIDsRangeHere").
'</a>)';
2433 print $langs->trans(
"ModuleName");
2435 print $moduleobj->getName();
2439 print $langs->trans(
"Description");
2441 print $moduleobj->getDesc();
2445 print $langs->trans(
"Version");
2447 print $moduleobj->getVersion();
2451 print $langs->trans(
"Family");
2454 print $moduleobj->family;
2458 print $langs->trans(
"Picto");
2460 print $moduleobj->picto;
2461 print
' '.img_picto(
'', $moduleobj->picto,
'class="valignmiddle pictomodule paddingrightonly"');
2465 print $langs->trans(
"EditorName");
2467 print $moduleobj->editor_name;
2471 print $langs->trans(
"EditorUrl");
2473 if (!empty($moduleobj->editor_url)) {
2474 print
'<a href="'.$moduleobj->editor_url.
'" target="_blank" rel="noopener">'.$moduleobj->editor_url.
' '.
img_picto(
'',
'globe').
'</a>';
2480 print $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module).
'<br>';
2483 if (!empty($moduleobj)) {
2487 print
load_fiche_titre(
$form->textwithpicto($langs->trans(
"ReadmeFile"), $langs->transnoentitiesnoconv(
"File").
' '.$pathtofilereadme),
'',
'');
2489 print
'<!-- readme file -->';
2490 if (
dol_is_file($dirread.
'/'.$pathtofilereadme)) {
2491 print
'<div class="underbanner clearboth"></div><div class="fichecenter">'.$moduleobj->getDescLong().
'</div>';
2493 print
'<span class="opacitymedium">'.$langs->trans(
"ErrorFileNotFound", $pathtofilereadme).
'</span>';
2499 print
load_fiche_titre(
$form->textwithpicto($langs->trans(
"ChangeLog"), $langs->transnoentitiesnoconv(
"File").
' '.$pathtochangelog),
'',
'');
2501 print
'<!-- changelog file -->';
2503 print
'<div class="underbanner clearboth"></div><div class="fichecenter">'.$moduleobj->getChangeLog().
'</div>';
2505 print
'<span class="opacitymedium">'.$langs->trans(
"ErrorFileNotFound", $pathtochangelog).
'</span>';
2513 if ($fullpathoffile) {
2514 $content = file_get_contents($fullpathoffile);
2518 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
2519 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2520 print
'<input type="hidden" name="action" value="savefile">';
2521 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
2522 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
2523 print
'<input type="hidden" name="module" value="'.$module.
'">';
2527 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%',
'');
2528 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
2533 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
2535 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
2541 print
dol_get_fiche_head($head2, $tab,
'', -1,
'', 0,
'',
'', $MAXTABFOROBJECT,
'formodulesuffix');
2544 if ($tab ==
'languages') {
2545 print
'<!-- tab=languages -->'.
"\n";
2546 if ($action !=
'editfile' || empty($file)) {
2547 print
'<span class="opacitymedium">'.$langs->trans(
"LanguageDefDesc").
'</span><br>';
2551 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
2552 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2553 print
'<input type="hidden" name="action" value="addlanguage">';
2554 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
2555 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
2556 print
'<input type="hidden" name="module" value="'.$module.
'">';
2557 print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,
'newlangcode', 0, 0, 1, 0, 0,
'minwidth300', 1);
2558 print
'<input type="submit" name="addlanguage" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans(
"AddLanguageFile")).
'"><br>';
2564 $modulelowercase = strtolower($module);
2568 $diroflang .=
'/langs';
2569 $langfiles =
dol_dir_list($diroflang,
'files', 1,
'\.lang$');
2571 if (!preg_match(
'/custom/', $dirread)) {
2573 $diroflang = $dirread;
2574 $diroflang .=
'/langs';
2575 $langfiles =
dol_dir_list($diroflang,
'files', 1, $modulelowercase.
'\.lang$');
2578 print
'<table class="none">';
2579 foreach ($langfiles as $langfile) {
2580 $pathtofile = $modulelowercase.
'/langs/'.$langfile[
'relativename'];
2581 if (!preg_match(
'/custom/', $dirread)) {
2582 $pathtofile =
'langs/'.$langfile[
'relativename'];
2584 print
'<tr><td><span class="fa fa-file-o"></span> '.$langs->trans(
"LanguageFile").
' '.basename(dirname($pathtofile)).
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
2585 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=ini&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2586 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2597 $content = file_get_contents($fullpathoffile);
2600 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
2601 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2602 print
'<input type="hidden" name="action" value="savefile">';
2603 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
2604 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
2605 print
'<input type="hidden" name="module" value="'.$module.
'">';
2607 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
2608 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'text'));
2611 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
2613 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
2620 if ($tab ==
'objects') {
2621 print
'<!-- tab=objects -->'.
"\n";
2626 $dir = $dirread.
'/'.$modulelowercase.
'/class';
2628 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj=newobject';
2629 $head3[$h][1] =
'<span class="valignmiddle text-plus-circle">'.$langs->trans(
"NewObjectInModulebuilder").
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
2630 $head3[$h][2] =
'newobject';
2634 $listofobject =
dol_dir_list($dir,
'files', 0,
'\.class\.php$');
2636 $firstobjectname =
'';
2637 foreach ($listofobject as $fileobj) {
2638 if (preg_match(
'/^api_/', $fileobj[
'name'])) {
2641 if (preg_match(
'/^actions_/', $fileobj[
'name'])) {
2645 $tmpcontent = file_get_contents($fileobj[
'fullname']);
2646 if (preg_match(
'/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) {
2648 $objectname = $reg[1];
2649 if (empty($firstobjectname)) {
2650 $firstobjectname = $objectname;
2653 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj='.$objectname;
2654 $head3[$h][1] = $objectname;
2655 $head3[$h][2] = $objectname;
2661 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj=deleteobject';
2662 $head3[$h][1] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"DangerZone");
2663 $head3[$h][2] =
'deleteobject';
2668 if ($tabobj ==
'newobjectifnoobj') {
2669 if ($firstobjectname) {
2670 $tabobj = $firstobjectname;
2672 $tabobj =
'newobject';
2678 if ($tabobj ==
'newobject') {
2680 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
2681 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2682 print
'<input type="hidden" name="action" value="initobject">';
2683 print
'<input type="hidden" name="tab" value="objects">';
2684 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
2686 print
'<span class="opacitymedium">'.$langs->trans(
"EnterNameOfObjectDesc").
'</span><br><br>';
2688 print
'<div class="tagtable">';
2690 print
'<div class="tagtr"><div class="tagtd">';
2691 print
'<span class="opacitymedium">'.$langs->trans(
"ObjectKey").
'</span> ';
2692 print
'</div><div class="tagtd">';
2693 print
'<input type="text" name="objectname" maxlength="64" value="'.dol_escape_htmltag(
GETPOST(
'objectname',
'alpha') ?
GETPOST(
'objectname',
'alpha') : $modulename).
'" autofocus><br>';
2694 print
'</div></div>';
2696 print
'<div class="tagtr"><div class="tagtd">';
2697 print
'<span class="opacitymedium">'.$langs->trans(
"Picto").
'</span> ';
2698 print
'</div><div class="tagtd">';
2699 print
'<input type="text" name="idpicto" value="fa-generic" placeholder="'.dol_escape_htmltag($langs->trans(
"Picto")).
'">';
2700 print
$form->textwithpicto(
'', $langs->trans(
"Example").
': fa-generic, fa-globe, ... any font awesome code.<br>Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]');
2701 print
'</div></div>';
2703 print
'<div class="tagtr"><div class="tagtd">';
2704 print
'<span class="opacitymedium">'.$langs->trans(
"DefinePropertiesFromExistingTable").
'</span> ';
2705 print
'</div><div class="tagtd">';
2706 print
'<input type="text" name="initfromtablename" value="'.GETPOST(
'initfromtablename').
'" placeholder="'.$langs->trans(
"TableName").
'">';
2707 print
$form->textwithpicto(
'', $langs->trans(
"DefinePropertiesFromExistingTableDesc").
'<br>'.$langs->trans(
"DefinePropertiesFromExistingTableDesc2"));
2708 print
'</div></div>';
2713 print
'<input type="checkbox" name="includerefgeneration" id="includerefgeneration" value="includerefgeneration"> <label class="margintoponly" for="includerefgeneration">'.$form->textwithpicto($langs->trans(
"IncludeRefGeneration"), $langs->trans(
"IncludeRefGenerationHelp")).
'</label><br>';
2714 print
'<input type="checkbox" name="includedocgeneration" id="includedocgeneration" value="includedocgeneration"> <label for="includedocgeneration">'.$form->textwithpicto($langs->trans(
"IncludeDocGeneration"), $langs->trans(
"IncludeDocGenerationHelp")).
'</label><br>';
2716 print
'<input type="submit" class="button small" name="create" value="'.dol_escape_htmltag($langs->trans(
"GenerateCode")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
2732 } elseif ($tabobj ==
'deleteobject') {
2734 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
2735 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2736 print
'<input type="hidden" name="action" value="confirm_deleteobject">';
2737 print
'<input type="hidden" name="tab" value="objects">';
2738 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
2740 print $langs->trans(
"EnterNameOfObjectToDeleteDesc").
'<br><br>';
2742 print
'<input type="text" name="objectname" value="'.dol_escape_htmltag($modulename).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"ObjectKey")).
'">';
2743 print
'<input type="submit" class="button smallpaddingimp" name="delete" value="'.dol_escape_htmltag($langs->trans(
"Delete")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
2747 if ($action ==
'deleteproperty') {
2749 $_SERVER[
"PHP_SELF"].
'?propertykey='.urlencode(
GETPOST(
'propertykey',
'alpha')).
'&objectname='.urlencode($objectname).
'&tab='.urlencode($tab).
'&module='.urlencode($module).
'&tabobj='.urlencode($tabobj),
2750 $langs->trans(
'Delete'),
2751 $langs->trans(
'ConfirmDeleteProperty',
GETPOST(
'propertykey',
'alpha')),
2752 'confirm_deleteproperty',
2762 if ($action !=
'editfile' || empty($file)) {
2766 $pathtoclass = strtolower($module).
'/class/'.strtolower($tabobj).
'.class.php';
2767 $pathtoapi = strtolower($module).
'/class/api_'.strtolower($module).
'.class.php';
2768 $pathtoagenda = strtolower($module).
'/'.strtolower($tabobj).
'_agenda.php';
2769 $pathtocard = strtolower($module).
'/'.strtolower($tabobj).
'_card.php';
2770 $pathtodocument = strtolower($module).
'/'.strtolower($tabobj).
'_document.php';
2771 $pathtolist = strtolower($module).
'/'.strtolower($tabobj).
'_list.php';
2772 $pathtonote = strtolower($module).
'/'.strtolower($tabobj).
'_note.php';
2773 $pathtocontact = strtolower($module).
'/'.strtolower($tabobj).
'_contact.php';
2774 $pathtophpunit = strtolower($module).
'/test/phpunit/'.strtolower($tabobj).
'Test.php';
2777 clearstatcache(
true);
2778 if (function_exists(
'opcache_invalidate')) {
2779 opcache_invalidate($dirread.
'/'.$pathtoclass,
true);
2782 if (empty($forceddirread) && empty($dirread)) {
2784 $stringofinclude =
"dol_include_once(".$pathtoclass.
")";
2786 $result = @include_once $dirread.
'/'.$pathtoclass;
2787 $stringofinclude =
"@include_once ".$dirread.
'/'.$pathtoclass;
2789 if (class_exists($tabobj)) {
2791 $tmpobject = @
new $tabobj($db);
2793 dol_syslog(
'Failed to load Constructor of class: '.$e->getMessage(), LOG_WARNING);
2796 print
'<span class="warning">'.$langs->trans(
'Failed to find the class '.$tabobj.
' despite the '.$stringofinclude).
'</span><br><br>';
2800 $pathtosql = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'-'.strtolower($module).
'.sql';
2803 $pathtosql = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'.sql';
2806 $pathtosql =
'install/mysql/tables/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'-'.strtolower($module).
'.sql';
2809 $pathtosql =
'install/mysql/tables/llx_'.strtolower($module).
'-'.strtolower($module).
'.sql';
2812 $pathtosql =
'install/mysql/tables/llx_'.strtolower($module).
'.sql';
2813 $pathtosqlextra =
'install/mysql/tables/llx_'.strtolower($module).
'_extrafields.sql';
2816 $pathtosqlextra =
'install/mysql/tables/llx_'.strtolower($module).
'_extrafields-'.strtolower($module).
'.sql';
2819 $pathtosqlextra =
'install/mysql/tables/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields-'.strtolower($module).
'.sql';
2822 $pathtosqlextra = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields.sql';
2825 $pathtosqlextra = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields-'.strtolower($module).
'.sql';
2827 $pathtosqlroot = preg_replace(
'/\/llx_.*$/',
'', $pathtosql);
2829 $pathtosqlkey = preg_replace(
'/\.sql$/',
'.key.sql', $pathtosql);
2830 $pathtosqlextrakey = preg_replace(
'/\.sql$/',
'.key.sql', $pathtosqlextra);
2832 $pathtolib = strtolower($module).
'/lib/'.strtolower($module).
'.lib.php';
2833 $pathtoobjlib = strtolower($module).
'/lib/'.strtolower($module).
'_'.strtolower($tabobj).
'.lib.php';
2834 $pathtopicto = strtolower($module).
'/img/object_'.strtolower($tabobj).
'.png';
2838 $realpathtoclass = $dirread.
'/'.$pathtoclass;
2839 $realpathtoapi = $dirread.
'/'.$pathtoapi;
2840 $realpathtoagenda = $dirread.
'/'.$pathtoagenda;
2841 $realpathtocard = $dirread.
'/'.$pathtocard;
2842 $realpathtodocument = $dirread.
'/'.$pathtodocument;
2843 $realpathtolist = $dirread.
'/'.$pathtolist;
2844 $realpathtonote = $dirread.
'/'.$pathtonote;
2845 $realpathtocontact = $dirread.
'/'.$pathtocontact;
2846 $realpathtophpunit = $dirread.
'/'.$pathtophpunit;
2847 $realpathtosql = $dirread.
'/'.$pathtosql;
2848 $realpathtosqlextra = $dirread.
'/'.$pathtosqlextra;
2849 $realpathtosqlkey = $dirread.
'/'.$pathtosqlkey;
2850 $realpathtosqlextrakey = $dirread.
'/'.$pathtosqlextrakey;
2851 $realpathtolib = $dirread.
'/'.$pathtolib;
2852 $realpathtoobjlib = $dirread.
'/'.$pathtoobjlib;
2853 $realpathtopicto = $dirread.
'/'.$pathtopicto;
2855 if (empty($realpathtoapi)) {
2856 $pathtoapi = strtolower($module).
'/class/api_'.strtolower($module).
's.class.php';
2857 $realpathtoapi = $dirread.
'/'.$pathtoapi;
2864 print
'<!-- section for object -->';
2865 print
'<div class="fichehalfleft smallxxx">';
2867 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"ClassFile").
' : <strong>'.(
dol_is_file($realpathtoclass) ?
'' :
'<strike>').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtoclass).(
dol_is_file($realpathtoclass) ?
'' :
'</strike>').
'</strong>';
2868 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtoclass).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2872 print
'<span class="fa fa-file-image-o"></span> '.$langs->trans(
"Image").
' : <strong>'.(
dol_is_file($realpathtopicto) ?
'' :
'<strike>').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtopicto).(
dol_is_file($realpathtopicto) ?
'' :
'</strike>').
'</strong>';
2875 } elseif (!empty($tmpobject)) {
2876 print
'<span class="fa fa-file-image-o"></span> '.$langs->trans(
"Image").
' : '.
img_picto(
'', $tmpobject->picto,
'class="pictofixedwidth"');
2882 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"ApiClassFile").
' : <strong class="wordbreak">'.(
dol_is_file($realpathtoapi) ?
'' :
'<strike><span class="opacitymedium">').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtoapi).(
dol_is_file($realpathtoapi)?
'':
'</span></strike>').
'</strong>';
2884 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtoapi).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2886 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtoapi).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2888 if (empty($conf->global->$const_name)) {
2889 print
'<a href="#" class="classfortooltip" target="apiexplorer" title="'.$langs->trans(
"ModuleMustBeEnabled", $module).
'"><strike>'.$langs->trans(
"ApiExplorer").
'</strike></a>';
2891 print
'<a href="'.DOL_URL_ROOT.
'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans(
"ApiExplorer").
'</a>';
2894 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initapi&token='.
newToken().
'&format=php&file='.urlencode($pathtoapi).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
2898 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"TestClassFile").
' : <strong class="wordbreak">'.(
dol_is_file($realpathtophpunit) ?
'' :
'<strike><span class="opacitymedium">').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtophpunit).(
dol_is_file($realpathtophpunit)?
'':
'</span></strike>').
'</strong>';
2900 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtophpunit).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2902 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtophpunit).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2904 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initphpunit&token='.
newToken().
'&format=php&file='.urlencode($pathtophpunit).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
2910 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"PageForLib").
' : <strong class="wordbreak">'.(
dol_is_file($realpathtolib) ?
'' :
'<strike>').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtolib).(
dol_is_file($realpathtolib) ?
'' :
'</strike>').
'</strong>';
2911 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtolib).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2913 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"PageForObjLib").
' : <strong class="wordbreak">'.(
dol_is_file($realpathtoobjlib) ?
'' :
'<strike>').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtoobjlib).(
dol_is_file($realpathtoobjlib) ?
'' :
'</strike>').
'</strong>';
2914 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtoobjlib).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2918 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"SqlFile").
' : <strong class="wordbreak">'.(
dol_is_file($realpathtosql) ?
'' :
'<strike>').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtosql).(
dol_is_file($realpathtosql) ?
'' :
'</strike>').
'</strong>';
2919 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=sql&file='.urlencode($pathtosql).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2920 print
' <a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=droptable&token='.
newToken().
'">'.$langs->trans(
"DropTableIfEmpty").
'</a>';
2923 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"SqlFileKey").
' : <strong class="wordbreak">'.(
dol_is_file($realpathtosqlkey) ?
'' :
'<strike>').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtosqlkey).(
dol_is_file($realpathtosqlkey) ?
'' :
'</strike>').
'</strong>';
2924 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=sql&file='.urlencode($pathtosqlkey).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2927 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"SqlFileExtraFields").
' : <strong class="wordbreak">'.(
dol_is_file($realpathtosqlextra) ?
'' :
'<strike><span class="opacitymedium">').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtosqlextra).(
dol_is_file($realpathtosqlextra) &&
dol_is_file($realpathtosqlextrakey) ?
'' :
'</span></strike>').
'</strong>';
2929 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&file='.urlencode($pathtosqlextra).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2931 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtosqlextra).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2933 print
'<a class="reposition editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=droptableextrafields&token='.
newToken().
'">'.$langs->trans(
"DropTableIfEmpty").
'</a>';
2935 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initsqlextrafields&token='.
newToken().
'&format=sql&file='.urlencode($pathtosqlextra).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
2939 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"SqlFileKeyExtraFields").
' : <strong class="wordbreak">'.(
dol_is_file($realpathtosqlextrakey) ?
'' :
'<strike><span class="opacitymedium">').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtosqlextrakey).(
dol_is_file($realpathtosqlextra) &&
dol_is_file($realpathtosqlextrakey) ?
'' :
'</span></strike>').
'</strong>';
2941 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=sql&file='.urlencode($pathtosqlextrakey).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2943 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtosqlextrakey).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2945 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initsqlextrafields&token='.
newToken().
'&format=sql&file='.urlencode($pathtosqlextra).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
2950 print
'<div class="fichehalfleft smallxxxx">';
2951 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"PageForList").
' : <strong class="wordbreak"><a href="'.$urloflist.
'" target="_test">'.(
dol_is_file($realpathtolist) ?
'' :
'<strike><span class="opacitymedium">').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtolist).(
dol_is_file($realpathtolist) ?
'' :
'</span></strike>').
'</a></strong>';
2952 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtolist).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2954 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"PageForCreateEditView").
' : <strong class="wordbreak"><a href="'.$urlofcard.
'?action=create" target="_test">'.(
dol_is_file($realpathtocard) ?
'' :
'<strike>').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtocard).(
dol_is_file($realpathtocard) ?
'' :
'</strike>').
'?action=create</a></strong>';
2955 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtocard).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2958 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"PageForContactTab").
' : <strong class="wordbreak">'.(
dol_is_file($realpathtocontact) ?
'' :
'<strike><span class="opacitymedium">').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtocontact).(
dol_is_file($realpathtocontact) ?
'' :
'</span></strike>').
'</strong>';
2959 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtocontact).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2962 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtocontact).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2964 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initpagecontact&token='.
newToken().
'&format=php&file='.urlencode($pathtocontact).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
2968 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"PageForDocumentTab").
' : <strong class="wordbreak">'.(
dol_is_file($realpathtodocument) ?
'' :
'<strike><span class="opacitymedium">').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtodocument).(
dol_is_file($realpathtodocument) ?
'' :
'</span></strike>').
'</strong>';
2969 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtodocument).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2972 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtodocument).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2974 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initpagedocument&token='.
newToken().
'&format=php&file='.urlencode($pathtocontact).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
2978 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"PageForNoteTab").
' : <strong class="wordbreak">'.(
dol_is_file($realpathtonote) ?
'' :
'<strike><span class="opacitymedium">').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtonote).(
dol_is_file($realpathtonote) ?
'' :
'</span></strike>').
'</strong>';
2979 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtonote).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2982 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtonote).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2984 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initpagenote&token='.
newToken().
'&format=php&file='.urlencode($pathtocontact).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
2988 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"PageForAgendaTab").
' : <strong class="wordbreak">'.(
dol_is_file($realpathtoagenda) ?
'' :
'<strike><span class="opacitymedium">').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtoagenda).(
dol_is_file($realpathtoagenda) ?
'' :
'</span></strike>').
'</strong>';
2989 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&format=php&token='.
newToken().
'&file='.urlencode($pathtoagenda).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2992 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtoagenda).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2994 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initpageagenda&token='.
newToken().
'&format=php&file='.urlencode($pathtocontact).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
3001 print
'<br><br><br>';
3003 if (!empty($tmpobject)) {
3004 $reflector =
new ReflectionClass($tabobj);
3005 $reflectorproperties = $reflector->getProperties();
3006 $reflectorpropdefault = $reflector->getDefaultProperties();
3010 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3011 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3012 print
'<input type="hidden" name="action" value="addproperty">';
3013 print
'<input type="hidden" name="tab" value="objects">';
3014 print
'<input type="hidden" name="page_y" value="">';
3015 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module.($forceddirread ?
'@'.$dirread :
'')).
'">';
3016 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
3018 print
'<input class="button smallpaddingimp" type="submit" name="regenerateclasssql" value="'.$langs->trans(
"RegenerateClassAndSql").
'">';
3023 print
'<!-- Table with properties of object -->'.
"\n";
3024 print
'<div class="div-table-responsive">';
3025 print
'<table class="noborder small">';
3026 print
'<tr class="liste_titre">';
3027 print
'<th class="none">';
3029 $htmltext = $langs->trans(
"PropertyDesc").
'<br><br><a class="" href="https://wiki.dolibarr.org/index.php/Language_and_development_rules#Table_and_fields_structures" target="_blank" rel="noopener noreferrer external">'.$langs->trans(
"SeeExamples").
'</a>';
3030 print
$form->textwithpicto($langs->trans(
"Code"), $htmltext, 1,
'help',
'extracss', 0, 3,
'propertyhelp');
3034 print
$form->textwithpicto($langs->trans(
"Label"), $langs->trans(
"YouCanUseTranslationKey"));
3036 print
'<th>'.$form->textwithpicto($langs->trans(
"Type"), $langs->trans(
"TypeOfFieldsHelpIntro").
'<br><br>'.$langs->trans(
"TypeOfFieldsHelp"), 1,
'help',
'extracss', 0, 3,
'typehelp').
'</th>';
3037 print
'<th>'.$form->textwithpicto($langs->trans(
"ArrayOfKeyValues"), $langs->trans(
"ArrayOfKeyValuesDesc")).
'</th>';
3038 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"NotNull"), $langs->trans(
"NotNullDesc")).
'</th>';
3039 print
'<th class="center">'.$langs->trans(
"DefaultValue").
'</th>';
3040 print
'<th class="center">'.$langs->trans(
"DatabaseIndex").
'</th>';
3041 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"ForeignKey"), $langs->trans(
"ForeignKeyDesc"), 1,
'help',
'extracss', 0, 3,
'foreignkeyhelp').
'</th>';
3042 print
'<th class="right">'.$langs->trans(
"Position").
'</th>';
3043 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"Enabled"), $langs->trans(
"EnabledDesc"), 1,
'help',
'extracss', 0, 3,
'enabledhelp').
'</th>';
3044 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"Visibility"), $langs->trans(
"VisibleDesc").
'<br><br>'.$langs->trans(
"ItCanBeAnExpression"), 1,
'help',
'extracss', 0, 3,
'visiblehelp').
'</th>';
3045 print
'<th class="center">'.$langs->trans(
"NotEditable").
'</th>';
3046 print
'<th class="center">'.$langs->trans(
"AlwaysEditable").
'</th>';
3047 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"SearchAll"), $langs->trans(
"SearchAllDesc")).
'</th>';
3048 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"IsAMeasure"), $langs->trans(
"IsAMeasureDesc")).
'</th>';
3049 print
'<th class="center">'.$langs->trans(
"CSSClass").
'</th>';
3050 print
'<th class="center">'.$langs->trans(
"CSSViewClass").
'</th>';
3051 print
'<th class="center">'.$langs->trans(
"CSSListClass").
'</th>';
3052 print
'<th>'.$langs->trans(
"KeyForTooltip").
'</th>';
3053 print
'<th class="center">'.$langs->trans(
"ShowOnCombobox").
'</th>';
3055 print
'<th>'.$form->textwithpicto($langs->trans(
"Validate"), $langs->trans(
"ValidateModBuilderDesc")).
'</th>';
3056 print
'<th>'.$langs->trans(
"Comment").
'</th>';
3057 print
'<th class="none"></th>';
3063 $properties =
dol_sort_array($reflectorpropdefault[
'fields'],
'position');
3065 if (!empty($properties)) {
3068 print
'<td class="none"><input type="text" class="maxwidth75" name="propname" value="'.dol_escape_htmltag(
GETPOST(
'propname',
'alpha')).
'"></td>';
3069 print
'<td><input type="text" class="maxwidth75" name="proplabel" value="'.dol_escape_htmltag(
GETPOST(
'proplabel',
'alpha')).
'"></td>';
3070 print
'<td><input type="text" class="maxwidth75" name="proptype" value="'.dol_escape_htmltag(
GETPOST(
'proptype',
'alpha')).
'"></td>';
3071 print
'<td><input type="text" class="maxwidth75" name="proparrayofkeyval" value="'.dol_escape_htmltag(
GETPOST(
'proparrayofkeyval',
'restricthtml')).
'"></td>';
3072 print
'<td class="center"><input type="text" class="center maxwidth50" name="propnotnull" value="'.dol_escape_htmltag(
GETPOST(
'propnotnull',
'alpha')).
'"></td>';
3073 print
'<td><input type="text" class="center maxwidth50" name="propdefault" value="'.dol_escape_htmltag(
GETPOST(
'propdefault',
'alpha')).
'"></td>';
3074 print
'<td class="center"><input type="text" class="center maxwidth50" name="propindex" value="'.dol_escape_htmltag(
GETPOST(
'propindex',
'alpha')).
'"></td>';
3075 print
'<td class="center"><input type="text" class="maxwidth100" name="propforeignkey" value="'.dol_escape_htmltag(
GETPOST(
'propforeignkey',
'alpha')).
'"></td>';
3076 print
'<td class="right"><input type="text" class="right" size="2" name="propposition" value="'.dol_escape_htmltag(
GETPOST(
'propposition',
'alpha')).
'"></td>';
3077 print
'<td class="center"><input type="text" class="center maxwidth50" name="propenabled" value="'.dol_escape_htmltag(
GETPOST(
'propenabled',
'alpha')).
'"></td>';
3078 print
'<td class="center"><input type="text" class="center maxwidth50" name="propvisible" value="'.dol_escape_htmltag(
GETPOST(
'propvisible',
'alpha')).
'"></td>';
3079 print
'<td class="center"><input type="text" class="center maxwidth50" name="propnoteditable" value="'.dol_escape_htmltag(
GETPOST(
'propnoteditable',
'alpha')).
'"></td>';
3080 print
'<td class="center"><input type="text" class="center maxwidth50" name="propalwayseditable" value="'.dol_escape_htmltag(
GETPOST(
'propalwayseditable',
'alpha')).
'"></td>';
3081 print
'<td class="center"><input type="text" class="center maxwidth50" name="propsearchall" value="'.dol_escape_htmltag(
GETPOST(
'propsearchall',
'alpha')).
'"></td>';
3082 print
'<td class="center"><input type="text" class="center maxwidth50" name="propisameasure" value="'.dol_escape_htmltag(
GETPOST(
'propisameasure',
'alpha')).
'"></td>';
3083 print
'<td class="center"><input type="text" class="maxwidth50" name="propcss" value="'.dol_escape_htmltag(
GETPOST(
'propcss',
'alpha')).
'"></td>';
3084 print
'<td class="center"><input type="text" class="maxwidth50" name="propcssview" value="'.dol_escape_htmltag(
GETPOST(
'propcssview',
'alpha')).
'"></td>';
3085 print
'<td class="center"><input type="text" class="maxwidth50" name="propcsslist" value="'.dol_escape_htmltag(
GETPOST(
'propcsslist',
'alpha')).
'"></td>';
3086 print
'<td><input type="text" size="2" name="prophelp" value="'.dol_escape_htmltag(
GETPOST(
'prophelp',
'alpha')).
'"></td>';
3087 print
'<td class="center"><input type="text" class="center maxwidth50" name="propshowoncombobox" value="'.dol_escape_htmltag(
GETPOST(
'propshowoncombobox',
'alpha')).
'"></td>';
3089 print
'<td><input type="number" step="1" min="0" max="1" class="text maxwidth100" name="propvalidate" value="'.dol_escape_htmltag(
GETPOST(
'propvalidate',
'alpha')).
'"></td>';
3090 print
'<td><input class="text maxwidth100" name="propcomment" value="'.dol_escape_htmltag(
GETPOST(
'propcomment',
'alpha')).
'"></td>';
3091 print
'<td class="center tdstickyright tdstickyghostwhite">';
3092 print
'<input type="submit" class="button" name="add" value="'.$langs->trans(
"Add").
'">';
3096 foreach ($properties as $propkey => $propval) {
3111 $propname = $propkey;
3112 $proplabel = $propval[
'label'];
3113 $proptype = $propval[
'type'];
3114 $proparrayofkeyval = !empty($propval[
'arrayofkeyval'])?$propval[
'arrayofkeyval']:
'';
3115 $propnotnull = !empty($propval[
'notnull']) ? $propval[
'notnull'] :
'0';
3116 $propdefault = !empty($propval[
'default'])?$propval[
'default']:
'';
3117 $propindex = !empty($propval[
'index'])?$propval[
'index']:
'';
3118 $propforeignkey = !empty($propval[
'foreignkey'])?$propval[
'foreignkey']:
'';
3119 $propposition = $propval[
'position'];
3120 $propenabled = $propval[
'enabled'];
3121 $propvisible = $propval[
'visible'];
3122 $propnoteditable = !empty($propval[
'noteditable'])?$propval[
'noteditable']:0;
3123 $propalwayseditable = !empty($propval[
'alwayseditable'])?$propval[
'alwayseditable']:0;
3124 $propsearchall = !empty($propval[
'searchall'])?$propval[
'searchall']:0;
3125 $propisameasure = !empty($propval[
'isameasure'])?$propval[
'isameasure']:0;
3126 $propcss = !empty($propval[
'css'])?$propval[
'css']:
'';
3127 $propcssview = !empty($propval[
'cssview'])?$propval[
'cssview']:
'';
3128 $propcsslist = !empty($propval[
'csslist'])?$propval[
'csslist']:
'';
3129 $prophelp = !empty($propval[
'help'])?$propval[
'help']:
'';
3130 $propshowoncombobox = !empty($propval[
'showoncombobox'])?$propval[
'showoncombobox']:0;
3132 $propvalidate = !empty($propval[
'validate'])?$propval[
'validate']:0;
3133 $propcomment = !empty($propval[
'comment'])?$propval[
'comment']:
'';
3135 print
'<tr class="oddeven">';
3137 print
'<td class="tdsticky tdstickygray">';
3143 if ($action ==
'editproperty' && $propname == $propertykey) {
3144 print
'<td class="tdoverflowmax200">';
3145 print
'<input type="hidden" name="propname" value="'.dol_escape_htmltag($propname).
'">';
3146 print
'<input type="hidden" name="proplabel" value="'.dol_escape_htmltag($proplabel).
'">';
3147 print
'<input name="proptype" value="'.dol_escape_htmltag($proptype).
'"></input>';
3149 print
'<td class="tdoverflowmax200">';
3150 print
'<input name="proparrayofkeyval" value="';
3151 if (isset($proparrayofkeyval)) {
3152 if (is_array($proparrayofkeyval) || $proparrayofkeyval !=
'') {
3160 print
'<input class="center width50" name="propnotnull" value="'.dol_escape_htmltag($propnotnull).
'">';
3163 print
'<input class="maxwidth50" name="propdefault" value="'.dol_escape_htmltag($propdefault).
'">';
3165 print
'<td class="center">';
3166 print
'<input class="center maxwidth50" name="propindex" value="'.dol_escape_htmltag($propindex).
'">';
3169 print
'<input class="center maxwidth100" name="propforeignkey" value="'.dol_escape_htmltag($propforeignkey).
'">';
3172 print
'<input class="right width50" name="propposition" value="'.dol_escape_htmltag($propposition).
'">';
3175 print
'<input class="center" name="propenabled" size="2" value="'.dol_escape_htmltag($propenabled).
'">';
3178 print
'<input class="center" name="propvisible" size="2" value="'.dol_escape_htmltag($propvisible).
'">';
3181 print
'<input class="center" name="propnoteditable" size="2" value="'.dol_escape_htmltag($propnoteditable).
'">';
3184 print
'<input class="center" name="propalwayseditable" size="2" value="'.dol_escape_htmltag($propalwayseditable).
'">';
3187 print
'<input class="center" name="propsearchall" size="2" value="'.dol_escape_htmltag($propsearchall).
'">';
3190 print
'<input class="center" name="propisameasure" size="2" value="'.dol_escape_htmltag($propisameasure).
'">';
3193 print
'<input class="center maxwidth50" name="propcss" value="'.dol_escape_htmltag($propcss).
'">';
3196 print
'<input class="center maxwidth50" name="propcssview" value="'.dol_escape_htmltag($propcssview).
'">';
3199 print
'<input class="center maxwidth50" name="propcsslist" value="'.dol_escape_htmltag($propcsslist).
'">';
3202 print
'<input class="maxwidth100" name="prophelp" value="'.dol_escape_htmltag($prophelp).
'">';
3205 print
'<input class="center maxwidth50" name="propshowoncombobox" value="'.dol_escape_htmltag($propshowoncombobox).
'">';
3208 print
'<input type="number" step="1" min="0" max="1" class="text maxwidth100" name="propvalidate" value="'.dol_escape_htmltag($propvalidate).
'">';
3211 print
'<input class="maxwidth100" name="propcomment" value="'.dol_escape_htmltag($propcomment).
'">';
3213 print
'<td class="center tdstickyright tdstickyghostwhite">';
3214 print
'<input class="reposition button smallpaddingimp" type="submit" name="edit" value="'.$langs->trans(
"Save").
'">';
3215 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
3218 print
'<td class="tdoverflowmax200">';
3219 print
'<span title="'.dol_escape_htmltag($proptype).
'">'.
dol_escape_htmltag($proptype).
'</span>';
3221 print
'<td class="tdoverflowmax200">';
3222 if ($proparrayofkeyval) {
3223 print
'<span title="'.dol_escape_htmltag(json_encode($proparrayofkeyval, JSON_UNESCAPED_UNICODE)).
'">';
3228 print
'<td class="center">';
3234 print
'<td class="center">';
3235 print $propindex ?
'1' :
'';
3237 print
'<td class="center">';
3240 print
'<td class="right">';
3243 print
'<td class="center tdoverflowmax100" title="'.($propnoteditable ?
dol_escape_htmltag($propnoteditable) :
'').
'">';
3247 print
'<td class="center tdoverflowmax100" title="'.($propvisible ?
dol_escape_htmltag($propvisible) :
'0').
'">';
3251 print
'<td class="center tdoverflowmax100" title="'.($propnoteditable ?
dol_escape_htmltag($propnoteditable) :
'').
'">';
3254 print
'<td class="center">';
3257 print
'<td class="center">';
3258 print $propsearchall ?
'1' :
'';
3260 print
'<td class="center">';
3263 print
'<td class="center tdoverflowmax100" title="'.($propcss ?
dol_escape_htmltag($propcss) :
'').
'">';
3266 print
'<td class="center tdoverflowmax100" title="'.($propcssview ?
dol_escape_htmltag($propcssview) :
'').
'">';
3269 print
'<td class="center tdoverflowmax100" title="'.($propcsslist ?
dol_escape_htmltag($propcsslist) :
'').
'">';
3273 print
'<td class="tdoverflowmax150" title="'.($prophelp ?
dol_escape_htmltag($prophelp) :
'').
'">';
3276 print
'<td class="center">';
3282 print
'<td class="center">';
3285 print
'<td class="tdoverflowmax200">';
3286 print
'<span title="'.dol_escape_htmltag($propcomment).
'">';
3290 print
'<td class="center tdstickyright tdstickyghostwhite">';
3291 if ($propname !=
'rowid') {
3292 print
'<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?action=editproperty&token='.
newToken().
'&propertykey='.urlencode($propname).
'&tab='.urlencode($tab).
'&module='.urlencode($module).
'&tabobj='.urlencode($tabobj).
'">'.
img_edit().
'</a>';
3293 print
'<a class="marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?action=deleteproperty&token='.
newToken().
'&propertykey='.urlencode($propname).
'&tab='.urlencode($tab).
'&module='.urlencode($module).
'&tabobj='.urlencode($tabobj).
'">'.
img_delete().
'</a>';
3300 if ($tab ==
'specifications') {
3301 if ($action !=
'editfile' || empty($file)) {
3302 print
'<span class="opacitymedium">'.$langs->trans(
"SpecDefDesc").
'</span><br>';
3307 foreach ($specs as $spec) {
3308 $pathtofile = $modulelowercase.
'/doc/'.$spec[
'relativename'];
3309 $format =
'asciidoc';
3310 if (preg_match(
'/\.md$/i', $spec[
'name'])) {
3311 $format =
'markdown';
3313 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"SpecificationFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3314 print
' <a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3324 $content = file_get_contents($fullpathoffile);
3327 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3328 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3329 print
'<input type="hidden" name="action" value="savefile">';
3330 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3331 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3332 print
'<input type="hidden" name="module" value="'.$module.
'">';
3334 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3335 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3338 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3340 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3346 print
'<tr><td><span class="warning">'.$langs->trans(
'Property $field not found into the class. The class was probably not generated by modulebuilder.').
'</warning></td></tr>';
3353 print
'<span class="warning">'.$langs->trans(
'Failed to init the object with the new '.$tabobj.
'($db)').
'</warning>';
3356 print $e->getMessage();
3359 if (empty($forceddirread)) {
3362 $fullpathoffile = $dirread.
'/'.$file;
3365 $content = file_get_contents($fullpathoffile);
3368 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3369 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3370 print
'<input type="hidden" name="action" value="savefile">';
3371 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3372 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3373 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
3374 print
'<input type="hidden" name="module" value="'.$module.($forceddirread ?
'@'.$dirread :
'').
'">';
3376 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3377 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3380 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3382 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3392 if ($tab ==
'dictionaries') {
3393 print
'<!-- tab=dictionaries -->'.
"\n";
3394 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3396 $dicts = $moduleobj->dictionaries;
3398 if ($action !=
'editfile' || empty($file)) {
3399 print
'<span class="opacitymedium">';
3400 $htmlhelp = $langs->trans(
"DictionariesDefDescTooltip",
'{s1}');
3401 $htmlhelp = str_replace(
'{s1}',
'<a target="adminbis" class="nofocusvisible" href="'.DOL_URL_ROOT.
'/admin/dict.php">'.$langs->trans(
'Setup').
' - '.$langs->trans(
'Dictionaries').
'</a>', $htmlhelp);
3402 print
$form->textwithpicto($langs->trans(
"DictionariesDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
3406 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3407 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3409 if (is_array($dicts) && !empty($dicts)) {
3410 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"LanguageFile").
' :</span> ';
3411 print
'<strong class="wordbreak">'.$dicts[
'langs'].
'</strong>';
3415 print
'<!-- tab=objects -->'.
"\n";
3422 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabdic=newdictionary';
3423 $head3[$h][1] =
'<span class="valignmiddle text-plus-circle">'.$langs->trans(
"NewDictionary").
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
3424 $head3[$h][2] =
'newdictionary';
3431 if (!empty($dicts[
'tabname'])) {
3432 foreach ($dicts[
'tabname'] as $key => $dic) {
3434 $diclabel = $dicts[
'tablib'][$key];
3436 if (empty($firstdicname)) {
3437 $firstdicname = $dicname;
3440 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabdic='.$dicname;
3441 $head3[$h][1] = $diclabel;
3442 $head3[$h][2] = $dicname;
3448 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabdic=deletedictionary';
3449 $head3[$h][1] = $langs->trans(
"DangerZone");
3450 $head3[$h][2] =
'deletedictionary';
3455 if ($tabdic ==
'newdicifnodic') {
3456 if ($firstdicname) {
3457 $tabdic = $firstdicname;
3459 $tabdic =
'newdictionary';
3463 print
load_fiche_titre($langs->trans(
"ListOfDictionariesEntries"),
'',
'');
3465 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3466 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3467 print
'<input type="hidden" name="action" value="addproperty">';
3468 print
'<input type="hidden" name="tab" value="dictionaries">';
3469 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
3470 print
'<input type="hidden" name="tabdic" value="'.dol_escape_htmltag($tabdic).
'">';
3472 print
'<div class="div-table-responsive">';
3473 print
'<table class="noborder">';
3475 print
'<tr class="liste_titre">';
3476 print_liste_field_titre(
"#", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'thsticky thstickygrey ');
3488 if (!empty($dicts) && is_array($dicts) && !empty($dicts[
'tabname']) && is_array($dicts[
'tabname'])) {
3490 $maxi = count($dicts[
'tabname']);
3491 while ($i < $maxi) {
3492 print
'<tr class="oddeven">';
3494 print
'<td class="tdsticky tdstickygray">';
3499 print $dicts[
'tabname'][$i];
3503 print $dicts[
'tablib'][$i];
3507 print $dicts[
'tabsql'][$i];
3511 print $dicts[
'tabsqlsort'][$i];
3515 print $dicts[
'tabfield'][$i];
3519 print $dicts[
'tabfieldvalue'][$i];
3523 print $dicts[
'tabfieldinsert'][$i];
3526 print
'<td class="right">';
3527 print $dicts[
'tabrowid'][$i];
3530 print
'<td class="right">';
3531 print $dicts[
'tabcond'][$i];
3538 print
'<tr><td colspan="10"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
3548 if ($tabdic ==
'newdictionary') {
3550 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3551 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3552 print
'<input type="hidden" name="action" value="initdic">';
3553 print
'<input type="hidden" name="tab" value="dictionaries">';
3554 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
3556 print
'<span class="opacitymedium">'.$langs->trans(
"EnterNameOfDictionaryDesc").
'</span><br><br>';
3558 print
'<input type="text" name="dicname" maxlength="64" value="'.dol_escape_htmltag(
GETPOST(
'dicname',
'alpha') ?
GETPOST(
'dicname',
'alpha') : $modulename).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"DicKey")).
'" autofocus><br>';
3561 print
'<input type="submit" class="button smallpaddingimp" name="create" value="'.dol_escape_htmltag($langs->trans(
"GenerateCode")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
3575 } elseif ($tabdic ==
'deletedictionary') {
3577 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3578 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3579 print
'<input type="hidden" name="action" value="confirm_deleteobject">';
3580 print
'<input type="hidden" name="tab" value="dictionaries">';
3581 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
3583 print $langs->trans(
"EnterNameOfObjectToDeleteDesc").
'<br><br>';
3585 print
'<input type="text" name="objectname" value="'.dol_escape_htmltag($modulename).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"ObjectKey")).
'">';
3586 print
'<input type="submit" class="button smallpaddingimp" name="delete" value="'.dol_escape_htmltag($langs->trans(
"Delete")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
3589 print $langs->trans(
"FeatureNotYetAvailable");
3596 $content = file_get_contents($fullpathoffile);
3599 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3600 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3601 print
'<input type="hidden" name="action" value="savefile">';
3602 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3603 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3604 print
'<input type="hidden" name="module" value="'.$module.
'">';
3606 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3607 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3610 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3612 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3619 if ($tab ==
'menus') {
3620 print
'<!-- tab=menus -->'.
"\n";
3621 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3623 $menus = $moduleobj->menu;
3625 if ($action !=
'editfile' || empty($file)) {
3626 print
'<span class="opacitymedium">';
3627 $htmlhelp = $langs->trans(
"MenusDefDescTooltip",
'{s1}');
3628 $htmlhelp = str_replace(
'{s1}',
'<a target="adminbis" class="nofocusvisible" href="'.DOL_URL_ROOT.
'/admin/menus/index.php">'.$langs->trans(
'Setup').
' - '.$langs->trans(
'Menus').
'</a>', $htmlhelp);
3629 print
$form->textwithpicto($langs->trans(
"MenusDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
3633 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3634 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3640 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3641 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3642 print
'<input type="hidden" name="action" value="addproperty">';
3643 print
'<input type="hidden" name="tab" value="objects">';
3644 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
3645 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
3647 print
'<div class="div-table-responsive">';
3648 print
'<table class="noborder small">';
3650 print
'<tr class="liste_titre">';
3653 print_liste_field_titre(
"LinkToParentMenu", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder);
3657 print_liste_field_titre(
"URL", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'', $langs->transnoentitiesnoconv(
'DetailUrl'));
3659 print_liste_field_titre(
"Position", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'right ');
3660 print_liste_field_titre(
"Enabled", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'center ', $langs->trans(
'DetailEnabled'));
3661 print_liste_field_titre(
"Rights", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'', $langs->trans(
'DetailRight'));
3662 print_liste_field_titre(
"Target", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'', $langs->trans(
'DetailTarget'));
3663 print_liste_field_titre(
"MenuForUsers", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'right ', $langs->trans(
'DetailUser'));
3666 if (count($menus)) {
3668 foreach ($menus as $menu) {
3671 print
'<tr class="oddeven">';
3673 print
'<td class="tdsticky tdstickygray">';
3697 print
'<td class="tdoverflowmax300" title="'.dol_escape_htmltag($menu[
'url']).
'">';
3705 print
'<td class="right">';
3709 print
'<td class="center tdoverflowmax200" title="'.dol_escape_htmltag($menu[
'enabled']).
'">';
3713 print
'<td class="center tdoverflowmax200" title="'.dol_escape_htmltag($menu[
'perms']).
'">';
3721 print
'<td class="right">';
3722 if ($menu[
'user'] == 2) {
3723 print $langs->trans(
"AllMenus");
3724 } elseif ($menu[
'user'] == 0) {
3725 print $langs->trans(
'Internal');
3726 } elseif ($menu[
'user'] == 1) {
3727 print $langs->trans(
'External');
3729 print $menu[
'user'];
3736 print
'<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
3746 $content = file_get_contents($fullpathoffile);
3749 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3750 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3751 print
'<input type="hidden" name="action" value="savefile">';
3752 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3753 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3754 print
'<input type="hidden" name="module" value="'.$module.
'">';
3756 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3757 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3760 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3762 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3769 if ($tab ==
'permissions') {
3770 print
'<!-- tab=permissions -->'.
"\n";
3771 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3773 $perms = $moduleobj->rights;
3775 if ($action !=
'editfile' || empty($file)) {
3776 print
'<span class="opacitymedium">';
3777 $htmlhelp = $langs->trans(
"PermissionsDefDescTooltip",
'{s1}');
3778 $htmlhelp = str_replace(
'{s1}',
'<a target="adminbis" class="nofocusvisible" href="'.DOL_URL_ROOT.
'/admin/perms.php">'.$langs->trans(
'DefaultRights').
'</a>', $htmlhelp);
3779 print
$form->textwithpicto($langs->trans(
"PermissionsDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
3783 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3784 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3790 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3791 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3792 print
'<input type="hidden" name="action" value="addproperty">';
3793 print
'<input type="hidden" name="tab" value="objects">';
3794 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
3795 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
3797 print
'<div class="div-table-responsive">';
3798 print
'<table class="noborder">';
3800 print
'<tr class="liste_titre">';
3807 if (count($perms)) {
3808 foreach ($perms as $perm) {
3809 print
'<tr class="oddeven">';
3816 print $langs->trans($perm[1]);
3830 print
'<tr><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
3840 $content = file_get_contents($fullpathoffile);
3843 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3844 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3845 print
'<input type="hidden" name="action" value="savefile">';
3846 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3847 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3848 print
'<input type="hidden" name="module" value="'.$module.
'">';
3850 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3851 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3854 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3856 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3863 if ($tab ==
'hooks') {
3864 print
'<!-- tab=hooks -->'.
"\n";
3865 if ($action !=
'editfile' || empty($file)) {
3866 print
'<span class="opacitymedium">'.$langs->trans(
"HooksDefDesc").
'</span><br>';
3871 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3873 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3875 print
'<a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3879 $pathtohook = strtolower($module).
'/class/actions_'.strtolower($module).
'.class.php';
3880 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"HooksFile").
' : ';
3882 print
'<strong class="wordbreak">'.$pathtohook.
'</strong>';
3884 print
'<td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a> ';
3885 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
3887 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
3888 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=inithook&format=php&file='.urlencode($pathtohook).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</td>';
3895 $content = file_get_contents($fullpathoffile);
3898 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3899 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3900 print
'<input type="hidden" name="action" value="savefile">';
3901 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3902 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3903 print
'<input type="hidden" name="module" value="'.$module.
'">';
3905 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3906 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3909 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3911 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3918 if ($tab ==
'triggers') {
3919 print
'<!-- tab=triggers -->'.
"\n";
3920 require_once DOL_DOCUMENT_ROOT.
'/core/class/interfaces.class.php';
3923 $triggers = $interfaces->getTriggersList(array(
'/'.strtolower($module).
'/core/triggers'));
3925 if ($action !=
'editfile' || empty($file)) {
3926 print
'<span class="opacitymedium">'.$langs->trans(
"TriggerDefDesc").
'</span><br>';
3931 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3933 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3935 print
'<a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3938 if (!empty($triggers)) {
3939 foreach ($triggers as $trigger) {
3940 $pathtofile = $trigger[
'relpath'];
3943 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"TriggersFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3944 print
'</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a></td>';
3945 print
'<td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
3950 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"TriggersFile");
3951 print
' : <span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
3952 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=inittrigger&format=php">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a></td>';
3961 $content = file_get_contents($fullpathoffile);
3964 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3965 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3966 print
'<input type="hidden" name="action" value="savefile">';
3967 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3968 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3969 print
'<input type="hidden" name="module" value="'.$module.
'">';
3971 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3972 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3975 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3977 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3984 if ($tab ==
'css') {
3985 print
'<!-- tab=css -->'.
"\n";
3986 if ($action !=
'editfile' || empty($file)) {
3987 print
'<span class="opacitymedium">'.$langs->trans(
"CSSDesc").
'</span><br>';
3993 $pathtohook = strtolower($module).
'/css/'.strtolower($module).
'.css.php';
3994 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"CSSFile").
' : ';
3996 print
'<strong class="wordbreak">'.$pathtohook.
'</strong>';
3997 print
'</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a></td>';
3998 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
4000 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
4001 print
'</td><td><a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initcss&format=php&file='.urlencode($pathtohook).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a></td>';
4007 $content = file_get_contents($fullpathoffile);
4010 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4011 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4012 print
'<input type="hidden" name="action" value="savefile">';
4013 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4014 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4015 print
'<input type="hidden" name="module" value="'.$module.
'">';
4017 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
4018 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
4021 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
4023 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4031 print
'<!-- tab=js -->'.
"\n";
4032 if ($action !=
'editfile' || empty($file)) {
4033 print
'<span class="opacitymedium">'.$langs->trans(
"JSDesc").
'</span><br>';
4039 $pathtohook = strtolower($module).
'/js/'.strtolower($module).
'.js.php';
4040 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"JSFile").
' : ';
4042 print
'<strong class="wordbreak">'.$pathtohook.
'</strong>';
4043 print
'</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a></td>';
4044 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
4046 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
4047 print
'</td><td><a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initjs&token='.
newToken().
'&format=php&file='.urlencode($pathtohook).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a></td>';
4053 $content = file_get_contents($fullpathoffile);
4056 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4057 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4058 print
'<input type="hidden" name="action" value="savefile">';
4059 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4060 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4061 print
'<input type="hidden" name="module" value="'.$module.
'">';
4063 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
4064 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
4067 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
4069 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4076 if ($tab ==
'widgets') {
4077 print
'<!-- tab=widgets -->'.
"\n";
4078 require_once DOL_DOCUMENT_ROOT.
'/core/boxes/modules_boxes.php';
4082 if ($action !=
'editfile' || empty($file)) {
4083 print
'<span class="opacitymedium">'.$langs->trans(
"WidgetDesc").
'</span><br>';
4087 if (!empty($widgets)) {
4088 foreach ($widgets as $widget) {
4089 $pathtofile = $widget[
'relpath'];
4091 print
'<tr><td><span class="fa fa-file-o"></span> '.$langs->trans(
"WidgetFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
4092 print
'</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4093 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
4097 print
'<tr><td><span class="fa fa-file-o"></span> '.$langs->trans(
"WidgetFile").
' : <span class="opacitymedium">'.$langs->trans(
"NoWidget").
'</span>';
4098 print
'</td><td><a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initwidget&token='.
newToken().
'&format=php">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
4105 $content = file_get_contents($fullpathoffile);
4108 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4109 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4110 print
'<input type="hidden" name="action" value="savefile">';
4111 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4112 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4113 print
'<input type="hidden" name="module" value="'.$module.
'">';
4115 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
4116 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
4119 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
4121 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4128 if ($tab ==
'exportimport') {
4129 print
'<!-- tab=exportimport -->'.
"\n";
4130 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
4132 $exportlist = $moduleobj->export_label;
4133 $importlist = $moduleobj->import_label;
4135 if ($action !=
'editfile' || empty($file)) {
4136 print
'<span class="opacitymedium">'.$langs->transnoentities(
'ImportExportProfiles').
'</span><br>';
4139 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
4140 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4145 $content = file_get_contents($fullpathoffile);
4148 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4149 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4150 print
'<input type="hidden" name="action" value="savefile">';
4151 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4152 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4153 print
'<input type="hidden" name="module" value="'.$module.
'">';
4155 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
4156 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
4159 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
4161 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4168 if ($tab ==
'cli') {
4169 print
'<!-- tab=cli -->'.
"\n";
4170 $clifiles = array();
4173 $dircli = array(
'/'.strtolower($module).
'/scripts');
4175 foreach ($dircli as $reldir) {
4180 if (!is_dir($newdir)) {
4184 $handle = opendir($newdir);
4185 if (is_resource($handle)) {
4186 while (($tmpfile = readdir($handle)) !==
false) {
4187 if (is_readable($newdir.
'/'.$file) && preg_match(
'/^(.+)\.php/', $tmpfile, $reg)) {
4188 if (preg_match(
'/\.back$/', $tmpfile)) {
4192 $clifiles[$i][
'relpath'] = preg_replace(
'/^\//',
'', $reldir).
'/'.$tmpfile;
4201 if ($action !=
'editfile' || empty($file)) {
4202 print
'<span class="opacitymedium">'.$langs->trans(
"CLIDesc").
'</span><br>';
4206 if (!empty($clifiles)) {
4207 foreach ($clifiles as $clifile) {
4208 $pathtofile = $clifile[
'relpath'];
4210 print
'<tr><td><span class="fa fa-file-o"></span> '.$langs->trans(
"CLIFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
4211 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a></td>';
4212 print
'<td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
4216 print
'<tr><td><span class="fa fa-file-o"></span> '.$langs->trans(
"CLIFile").
' : <span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated");
'</span>';
4217 print
'</td><td><a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initcli&token='.
newToken().
'&format=php">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
4224 $content = file_get_contents($fullpathoffile);
4227 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4228 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4229 print
'<input type="hidden" name="action" value="savefile">';
4230 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4231 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4232 print
'<input type="hidden" name="module" value="'.$module.
'">';
4234 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
4235 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
4238 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
4240 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4247 if ($tab ==
'cron') {
4248 print
'<!-- tab=cron -->'.
"\n";
4249 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
4251 $cronjobs = $moduleobj->cronjobs;
4253 if ($action !=
'editfile' || empty($file)) {
4254 print
'<span class="opacitymedium">'.str_replace(
'{s1}',
'<a target="adminbis" class="nofocusvisible" href="'.DOL_URL_ROOT.
'/cron/list.php">'.$langs->transnoentities(
'CronList').
'</a>', $langs->trans(
"CronJobDefDesc",
'{s1}')).
'</span><br>';
4257 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
4258 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4264 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4265 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4266 print
'<input type="hidden" name="action" value="addproperty">';
4267 print
'<input type="hidden" name="tab" value="objects">';
4268 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4269 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
4271 print
'<div class="div-table-responsive">';
4272 print
'<table class="noborder">';
4274 print
'<tr class="liste_titre">';
4282 if (count($cronjobs)) {
4283 foreach ($cronjobs as $cron) {
4284 print
'<tr class="oddeven">';
4287 print $cron[
'label'];
4291 if ($cron[
'jobtype'] ==
'method') {
4292 $text = $langs->trans(
"CronClass");
4293 $texttoshow = $langs->trans(
'CronModule').
': '.$module.
'<br>';
4294 $texttoshow .= $langs->trans(
'CronClass').
': '.$cron[
'class'].
'<br>';
4295 $texttoshow .= $langs->trans(
'CronObject').
': '.$cron[
'objectname'].
'<br>';
4296 $texttoshow .= $langs->trans(
'CronMethod').
': '.$cron[
'method'];
4297 $texttoshow .=
'<br>'.$langs->trans(
'CronArgs').
': '.$cron[
'parameters'];
4298 $texttoshow .=
'<br>'.$langs->trans(
'Comment').
': '.$langs->trans($cron[
'comment']);
4299 } elseif ($cron[
'jobtype'] ==
'command') {
4300 $text = $langs->trans(
'CronCommand');
4301 $texttoshow = $langs->trans(
'CronCommand').
': '.
dol_trunc($cron[
'command']);
4302 $texttoshow .=
'<br>'.$langs->trans(
'CronArgs').
': '.$cron[
'parameters'];
4303 $texttoshow .=
'<br>'.$langs->trans(
'Comment').
': '.$langs->trans($cron[
'comment']);
4305 print
$form->textwithpicto($text, $texttoshow, 1);
4309 if ($cron[
'unitfrequency'] ==
"60") {
4310 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Minutes');
4312 if ($cron[
'unitfrequency'] ==
"3600") {
4313 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Hours');
4315 if ($cron[
'unitfrequency'] ==
"86400") {
4316 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Days');
4318 if ($cron[
'unitfrequency'] ==
"604800") {
4319 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Weeks');
4324 print $cron[
'status'];
4328 if (!empty($cron[
'comment'])) {
4329 print $cron[
'comment'];
4336 print
'<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
4346 $content = file_get_contents($fullpathoffile);
4349 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4350 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4351 print
'<input type="hidden" name="action" value="savefile">';
4352 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4353 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4354 print
'<input type="hidden" name="module" value="'.$module.
'">';
4356 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
4357 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
4360 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
4362 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4369 if ($tab ==
'specifications') {
4370 print
'<!-- tab=specifications -->'.
"\n";
4373 if ($action !=
'editfile' || empty($file)) {
4374 print
'<span class="opacitymedium">'.$langs->trans(
"SpecDefDesc").
'</span><br>';
4378 if (is_array($specs) && !empty($specs)) {
4379 foreach ($specs as $spec) {
4380 $pathtofile = $modulelowercase.
'/doc/'.$spec[
'relativename'];
4381 $format =
'asciidoc';
4382 if (preg_match(
'/\.md$/i', $spec[
'name'])) {
4383 $format =
'markdown';
4386 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"SpecificationFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
4387 print
'</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a></td>';
4388 print
'<td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
4393 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"SpecificationFile").
' : <span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
4394 print
'</td><td><a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initdoc&token='.
newToken().
'&format=php">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a></td>';
4405 $content = file_get_contents($fullpathoffile);
4408 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4409 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4410 print
'<input type="hidden" name="action" value="savefile">';
4411 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4412 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4413 print
'<input type="hidden" name="module" value="'.$module.
'">';
4415 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
4416 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
4419 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
4421 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4427 print
'<br><br><br>';
4429 $FILENAMEDOC = $modulelowercase.
'.html';
4430 $FILENAMEDOCPDF = $modulelowercase.
'.pdf';
4431 $outputfiledoc =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOC;
4432 $outputfiledocurl =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOC;
4433 $outputfiledocrel = $modulelowercase.
'/doc/'.$FILENAMEDOC;
4434 $outputfiledocpdf =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOCPDF;
4435 $outputfiledocurlpdf =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOCPDF;
4436 $outputfiledocrelpdf = $modulelowercase.
'/doc/'.$FILENAMEDOCPDF;
4439 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"PathToModuleDocumentation",
"HTML").
' : ';
4441 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
4444 print
'<a href="'.$outputfiledocurl.
'" target="_blank" rel="noopener noreferrer">';
4445 print $outputfiledoc;
4448 print
' <span class="opacitymedium">('.$langs->trans(
"GeneratedOn").
' '.
dol_print_date(
dol_filemtime($outputfiledoc),
'dayhour').
')</span>';
4449 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($outputfiledocrel).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
4451 print
'</strong><br>';
4454 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"PathToModuleDocumentation",
"PDF").
' : ';
4456 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
4459 print
'<a href="'.$outputfiledocurlpdf.
'" target="_blank" rel="noopener noreferrer">';
4460 print $outputfiledocpdf;
4463 print
' <span class="opacitymedium">('.$langs->trans(
"GeneratedOn").
' '.
dol_print_date(
dol_filemtime($outputfiledocpdf),
'dayhour').
')</span>';
4464 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($outputfiledocrelpdf).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
4466 print
'</strong><br>';
4470 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="generatedoc">';
4471 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4472 print
'<input type="hidden" name="action" value="generatedoc">';
4473 print
'<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).
'">';
4474 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4475 print
'<input type="submit" class="button" name="generatedoc" value="'.$langs->trans(
"BuildDocumentation").
'"';
4476 if (!is_array($specs) || empty($specs)) {
4477 print
' disabled="disabled"';
4483 if ($tab ==
'buildpackage') {
4484 print
'<!-- tab=buildpackage -->'.
"\n";
4485 print
'<span class="opacitymedium">'.$langs->trans(
"BuildPackageDesc").
'</span>';
4488 if (!class_exists(
'ZipArchive') && !defined(
'ODTPHP_PATHTOPCLZIP')) {
4489 print
img_warning().
' '.$langs->trans(
"ErrNoZipEngine");
4493 $modulelowercase = strtolower($module);
4499 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
4501 $class =
'mod'.$module;
4503 if (class_exists($class)) {
4505 $moduleobj =
new $class($db);
4512 $langs->load(
"errors");
4513 dol_print_error($db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
4517 $arrayversion = explode(
'.', $moduleobj->version, 3);
4518 if (count($arrayversion)) {
4519 $FILENAMEZIP =
"module_".$modulelowercase.
'-'.$arrayversion[0].(empty($arrayversion[1]) ?
'.0' :
'.'.$arrayversion[1]).(empty($arrayversion[2]) ?
'' :
".".$arrayversion[2]).
".zip";
4520 $outputfilezip =
dol_buildpath($modulelowercase, 0).
'/bin/'.$FILENAMEZIP;
4525 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"PathToModulePackage").
' : ';
4527 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
4529 $relativepath = $modulelowercase.
'/bin/'.$FILENAMEZIP;
4530 print
'<strong><a href="'.DOL_URL_ROOT.
'/document.php?modulepart=packages&file='.urlencode($relativepath).
'">'.$outputfilezip.
'</a></strong>';
4531 print
' <span class="opacitymedium">('.$langs->trans(
"GeneratedOn").
' '.
dol_print_date(
dol_filemtime($outputfilezip),
'dayhour').
')</span>';
4532 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($relativepath).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
4540 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="generatepackage">';
4541 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4542 print
'<input type="hidden" name="action" value="generatepackage">';
4543 print
'<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).
'">';
4544 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4545 print
'<input type="submit" class="button" name="generatepackage" value="'.$langs->trans(
"BuildPackage").
'">';
4549 if ($tab ==
'tabs') {
4550 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
4552 $tabs = $moduleobj->tabs;
4554 if ($action !=
'editfile' || empty($file)) {
4555 print
'<span class="opacitymedium">';
4556 $htmlhelp = $langs->trans(
"TabsDefDescTooltip",
'{s1}');
4557 $htmlhelp = str_replace(
'{s1}',
'<a target="adminbis" class="nofocusvisible" href="'.DOL_URL_ROOT.
'/admin/menus/index.php">'.$langs->trans(
'Setup').
' - '.$langs->trans(
'Tabs').
'</a>', $htmlhelp);
4558 print
$form->textwithpicto($langs->trans(
"TabsDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
4562 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong>'.$pathtofile.
'</strong>';
4563 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4569 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4570 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4571 print
'<input type="hidden" name="action" value="addproperty">';
4572 print
'<input type="hidden" name="tab" value="objects">';
4573 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4574 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
4576 print
'<div class="div-table-responsive">';
4577 print
'<table class="noborder small">';
4579 print
'<tr class="liste_titre">';
4589 foreach ($tabs as $tab) {
4590 $parts = explode(
':', $tab[
'data']);
4592 $objectType = $parts[0];
4593 $tabName = $parts[1];
4594 $tabTitle = isset($parts[2]) ? $parts[2] :
'';
4595 $langFile = isset($parts[3]) ? $parts[3] :
'';
4596 $condition = isset($parts[4]) ? $parts[4] :
'';
4597 $path = isset($parts[5]) ? $parts[5] :
'';
4601 if ($tabName[0] ===
'-') {
4603 $condition = isset($parts[2]) ? $parts[2] :
'';
4606 print
'<tr class="oddeven">';
4613 if ($tabName[0] ===
"+") {
4614 print
'<span class="badge badge-status4 badge-status">' .
dol_escape_htmltag($tabName) .
'</span>';
4616 print
'<span class="badge badge-status8 badge-status">' .
dol_escape_htmltag($tabName) .
'</span>';
4639 print
'<tr><td class="opacitymedium" colspan="5">'.$langs->trans(
"None").
'</td></tr>';
4649 $content = file_get_contents($fullpathoffile);
4652 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4653 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4654 print
'<input type="hidden" name="action" value="savefile">';
4655 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4656 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4657 print
'<input type="hidden" name="module" value="'.$module.
'">';
4659 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
4660 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
4663 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
4665 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4672 if ($tab !=
'description') {
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.
unActivateModule($value, $requiredby=1)
Disable a module.
activateModule($value, $withdeps=1)
Enable a module.
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
Class to manage a WYSIWYG editor.
Class to manage triggers.
static getWidgetsList($forcedirwidget=null)
Return list of widget.
Class to manage utility methods.
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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_filemtime($pathoffile)
Return time of a file.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
Copy a file to another file.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_delete_dir($dir, $nophperrors=0)
Remove a directory (not recursive, so content must be empty).
dol_is_file($pathoffile)
Return if path is a file.
dolReplaceInFile($srcfile, $arrayreplacement, $destfile='', $newmask=0, $indexdatabase=0, $arrayreplacementisregex=0)
Make replacement of strings into a file.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayreplacement=null, $excludesubdir=0, $excludefileext=null)
Copy a dir to another dir.
dol_is_dir($folder)
Test if filename is a directory.
dol_is_dir_empty($dir)
Return if path is empty.
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.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
dol_mimetype($file, $default='application/octet-stream', $mode=0)
Return MIME type of a file from its name with extension.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='button bordertransp', $backtopagejsfields='')
Return HTML code to output a button to open a dialog popup box.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
dol_now($mode='auto')
Return date for now.
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)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
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_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_sanitizePathName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a path name.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
$formconfirm
if ($action == 'delbookkeepingyear') {
rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='', $object=null, $moduletype='external')
Save data into a memory area shared by all users, all sessions on server.
rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='', $addfieldentry=array(), $delfieldentry='')
Regenerate files .class.php.
if(!defined('NOTOKENRENEWAL')) if(!defined('NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined('NOIPCHECK')) if(!defined('NOBROWSERNOTIF')) llxHeader()
Header empty.
$conf db name
Only used if Module[ID]Name translation string is not found.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.