30 if (!defined(
'NOSCANPOSTFORINJECTION')) {
31 define(
'NOSCANPOSTFORINJECTION',
'1');
34 require
'../main.inc.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/modulebuilder.lib.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/class/utils.class.php';
43 $langs->loadLangs(array(
"admin",
"modulebuilder",
"other",
"cron",
"errors"));
45 $action =
GETPOST(
'action',
'aZ09');
46 $confirm =
GETPOST(
'confirm',
'alpha');
47 $cancel =
GETPOST(
'cancel',
'alpha');
49 $sortfield=
GETPOST(
'sortfield',
'alpha');
50 $sortorder=
GETPOST(
'sortorder',
'alpha');
52 $module =
GETPOST(
'module',
'alpha');
54 $tabobj =
GETPOST(
'tabobj',
'alpha');
55 $tabdic =
GETPOST(
'tabdic',
'alpha');
56 $propertykey =
GETPOST(
'propertykey',
'alpha');
58 $module =
'initmodule';
64 $tabobj =
'newobjectifnoobj';
67 $tabdic =
'newdicifnodic';
69 $file =
GETPOST(
'file',
'alpha');
79 if (!$user->admin && empty($conf->global->MODULEBUILDER_FOREVERYONE)) {
85 $tmp = explode(
',', $dolibarr_main_document_root_alt);
90 $tmpdir = explode(
'@', $module);
91 if (!empty($tmpdir[1])) {
93 $dirread = $tmpdir[1];
96 if (
GETPOST(
'dirins',
'alpha')) {
97 $dirread = $dirins =
GETPOST(
'dirins',
'alpha');
101 $FILEFLAG =
'modulebuilder.txt';
105 if (empty($newmask) && !empty($conf->global->MAIN_UMASK)) {
106 $newmask = $conf->global->MAIN_UMASK;
108 if (empty($newmask)) {
119 $dirsrootforscan = array($dirread);
121 if ($dirread != DOL_DOCUMENT_ROOT && ($conf->global->MAIN_FEATURES_LEVEL >= 2 || !empty($conf->global->MODULEBUILDER_ADD_DOCUMENT_ROOT))) {
122 $dirsrootforscan[] = DOL_DOCUMENT_ROOT;
126 $textforlistofdirs =
'<!-- Directory scanned -->'.
"\n";
127 $listofmodules = array();
129 foreach ($dirsrootforscan as $dirread) {
130 $moduletype =
'external';
131 if ($dirread == DOL_DOCUMENT_ROOT) {
132 $moduletype =
'internal';
136 if (is_array($dirsincustom) && count($dirsincustom) > 0) {
137 foreach ($dirsincustom as $dircustomcursor) {
138 $fullname = $dircustomcursor[
'fullname'];
141 $dirtoscanrel = basename($fullname).
'/core/modules/';
143 $descriptorfiles =
dol_dir_list(dirname($fullname).
'/'.$dirtoscanrel,
'files', 0,
'mod.*\.class\.php$');
144 if (empty($descriptorfiles)) {
145 $dirtoscanrel =
'core/modules/';
146 $descriptorfiles =
dol_dir_list($fullname.
'/../'.$dirtoscanrel,
'files', 0,
'mod'.strtoupper(basename($fullname)).
'\.class\.php$');
148 $modulenamewithcase =
'';
149 $moduledescriptorrelpath =
'';
150 $moduledescriptorfullpath =
'';
152 foreach ($descriptorfiles as $descriptorcursor) {
153 $modulenamewithcase = preg_replace(
'/^mod/',
'', $descriptorcursor[
'name']);
154 $modulenamewithcase = preg_replace(
'/\.class\.php$/',
'', $modulenamewithcase);
155 $moduledescriptorrelpath = $dirtoscanrel.$descriptorcursor[
'name'];
156 $moduledescriptorfullpath = $descriptorcursor[
'fullname'];
159 if ($modulenamewithcase) {
160 $listofmodules[$dircustomcursor[
'name']] = array(
161 'modulenamewithcase'=>$modulenamewithcase,
162 'moduledescriptorrelpath'=> $moduledescriptorrelpath,
163 'moduledescriptorfullpath'=>$moduledescriptorfullpath,
164 'moduledescriptorrootpath'=>$dirread,
165 'moduletype'=>$moduletype
173 if ($forceddirread && empty($listofmodules)) {
174 $listofmodules[strtolower($module)] = array(
175 'modulenamewithcase'=>$module,
176 'moduledescriptorrelpath'=>
'notyetimplemented',
177 'moduledescriptorfullpath'=>
'notyetimplemented',
178 'moduledescriptorrootpath'=>
'notyetimplemented',
183 $newdircustom = $dirins;
184 if (empty($newdircustom)) {
190 $textforlistofdirs .= $langs->trans(
"DirScanned").
' : ';
192 $textforlistofdirs .=
', ';
194 $textforlistofdirs .=
'<strong class="wordbreakimp">'.$dirread.
'</strong>';
195 if ($dirread == DOL_DOCUMENT_ROOT) {
196 if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
197 $textforlistofdirs .=
$form->textwithpicto(
'', $langs->trans(
"ConstantIsOn",
"MAIN_FEATURES_LEVEL"));
199 if (!empty($conf->global->MODULEBUILDER_ADD_DOCUMENT_ROOT)) {
200 $textforlistofdirs .=
$form->textwithpicto(
'', $langs->trans(
"ConstantIsOn",
"MODULEBUILDER_ADD_DOCUMENT_ROOT"));
211 if ($dirins && $action ==
'initmodule' && $modulename) {
212 $modulename = ucfirst($modulename);
214 if (preg_match(
'/[^a-z0-9_]/i', $modulename)) {
216 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
220 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
221 $destdir = $dirins.
'/'.strtolower($modulename);
223 $arrayreplacement = array(
224 'mymodule'=>strtolower($modulename),
225 'MyModule'=>$modulename
228 $result =
dolCopyDir($srcdir, $destdir, 0, 0, $arrayreplacement);
233 $langs->load(
"errors");
234 setEventMessages($langs->trans(
"ErrorFailToCopyDir", $srcdir, $destdir),
null,
'errors');
237 setEventMessages($langs->trans(
"AllFilesDidAlreadyExist", $srcdir, $destdir),
null,
'warnings');
242 $tryToCopyFromSetupClass =
true;
243 $backportDest = $destdir .
'/backport/v16/core/class';
244 $backportFileSrc = DOL_DOCUMENT_ROOT.
'/core/class/html.formsetup.class.php';
245 $backportFileDest = $backportDest.
'/html.formsetup.class.php';
250 $langs->load(
"errors");
251 setEventMessages($langs->trans(
"ErrorFailToCreateDir", $backportDest),
null,
'errors');
252 $tryToCopyFromSetupClass =
false;
255 if ($tryToCopyFromSetupClass) {
256 $result =
dol_copy($backportFileSrc, $backportFileDest);
260 $langs->load(
"errors");
261 setEventMessages($langs->trans(
"ErrorFailToCopyFile", $backportFileSrc, $backportFileDest),
null,
'errors');
263 setEventMessages($langs->trans(
"FileDidAlreadyExist", $backportFileDest),
null,
'warnings');
268 if (!empty($conf->global->MODULEBUILDER_USE_ABOUT)) {
287 dol_delete_file($destdir.
'/class/actions_'.strtolower($modulename).
'.class.php');
288 dol_delete_file($destdir.
'/class/api_'.strtolower($modulename).
'.class.php');
296 dol_delete_file($destdir.
'/test/phpunit/'.$modulename.
'FunctionnalTest.php');
305 dol_delete_file($destdir.
'/lib/'.strtolower($modulename).
'_myobject.lib.php');
307 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject.sql');
308 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject_extrafields.sql');
309 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject.key.sql');
310 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject_extrafields.key.sql');
325 $listofphpfilestoedit =
dol_dir_list($destdir,
'files', 1,
'\.(php|MD|js|sql|txt|xml|lang)$',
'',
'fullname', SORT_ASC, 0, 1);
326 foreach ($listofphpfilestoedit as $phpfileval) {
328 $arrayreplacement = array(
329 'mymodule'=>strtolower($modulename),
330 'MyModule'=>$modulename,
331 'MYMODULE'=>strtoupper($modulename),
332 'My module'=>$modulename,
333 'my module'=>$modulename,
334 'Mon module'=>$modulename,
335 'mon module'=>$modulename,
336 'htdocs/modulebuilder/template'=>strtolower($modulename),
337 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
340 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME)) {
341 $arrayreplacement[
'Editor name'] = $conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME;
343 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_URL)) {
344 $arrayreplacement[
'https://www.example.com'] = $conf->global->MODULEBUILDER_SPECIFIC_EDITOR_URL;
346 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_AUTHOR)) {
347 $arrayreplacement[
'---Put here your own copyright and developer email---'] =
dol_print_date($now,
'%Y').
' '.$conf->global->MODULEBUILDER_SPECIFIC_AUTHOR;
349 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_VERSION)) {
350 $arrayreplacement[
'1.0'] = $conf->global->MODULEBUILDER_SPECIFIC_VERSION;
352 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_FAMILY)) {
353 $arrayreplacement[
'other'] = $conf->global->MODULEBUILDER_SPECIFIC_FAMILY;
359 setEventMessages($langs->trans(
"ErrorFailToMakeReplacementInto", $phpfileval[
'fullname']),
null,
'errors');
363 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_README)) {
364 setEventMessages($langs->trans(
"ContentOfREADMECustomized"),
null,
'warnings');
366 file_put_contents($destdir.
'/README.md', $conf->global->MODULEBUILDER_SPECIFIC_README);
372 $module = $modulename;
375 clearstatcache(
true);
376 if (function_exists(
'opcache_invalidate')) {
380 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?module='.$modulename);
387 if ($dirins && in_array($action, array(
'initapi',
'initphpunit',
'initpagecontact',
'initpagedocument',
'initpagenote',
'initpageagenda')) && !empty($module)) {
388 $modulename = ucfirst($module);
389 $objectname = $tabobj;
390 $varnametoupdate =
'';
392 if ($action ==
'initapi') {
393 dol_mkdir($dirins.
'/'.strtolower($module).
'/class');
394 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
395 $srcfile = $srcdir.
'/class/api_mymodule.class.php';
396 $destfile = $dirins.
'/'.strtolower($module).
'/class/api_'.strtolower($module).
'.class.php';
397 } elseif ($action ==
'initphpunit') {
398 dol_mkdir($dirins.
'/'.strtolower($module).
'/test/phpunit');
399 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
400 $srcfile = $srcdir.
'/test/phpunit/MyObjectTest.php';
401 $destfile = $dirins.
'/'.strtolower($module).
'/test/phpunit/'.strtolower($objectname).
'Test.php';
402 } elseif ($action ==
'initpagecontact') {
403 dol_mkdir($dirins.
'/'.strtolower($module));
404 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
405 $srcfile = $srcdir.
'/myobject_contact.php';
406 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_contact.php';
407 $varnametoupdate =
'showtabofpagecontact';
408 } elseif ($action ==
'initpagedocument') {
409 dol_mkdir($dirins.
'/'.strtolower($module));
410 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
411 $srcfile = $srcdir.
'/myobject_document.php';
412 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_document.php';
413 $varnametoupdate =
'showtabofpagedocument';
414 } elseif ($action ==
'initpagenote') {
415 dol_mkdir($dirins.
'/'.strtolower($module));
416 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
417 $srcfile = $srcdir.
'/myobject_note.php';
418 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_note.php';
419 $varnametoupdate =
'showtabofpagenote';
420 } elseif ($action ==
'initpageagenda') {
421 dol_mkdir($dirins.
'/'.strtolower($module));
422 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
423 $srcfile = $srcdir.
'/myobject_agenda.php';
424 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_agenda.php';
425 $varnametoupdate =
'showtabofpageagenda';
430 $result =
dol_copy($srcfile, $destfile, 0, 0);
434 $arrayreplacement = array(
435 'mymodule'=>strtolower($modulename),
436 'MyModule'=>$modulename,
437 'MYMODULE'=>strtoupper($modulename),
438 'My module'=>$modulename,
439 'my module'=>$modulename,
440 'Mon module'=>$modulename,
441 'mon module'=>$modulename,
442 'htdocs/modulebuilder/template'=>strtolower($modulename),
443 'myobject'=>strtolower($objectname),
444 'MyObject'=>$objectname,
445 'MYOBJECT'=>strtoupper($objectname),
446 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
451 if ($varnametoupdate) {
453 $srcfile = $dirins.
'/'.strtolower($module).
'/lib/'.strtolower($module).
'_'.strtolower($objectname).
'.lib.php';
454 $arrayreplacement = array(
'/\$'.$varnametoupdate.
' = 0;/' =>
'$'.$varnametoupdate.
' = 1;');
458 $langs->load(
"errors");
459 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
465 if ($dirins && $action ==
'initsqlextrafields' && !empty($module)) {
466 $modulename = ucfirst($module);
467 $objectname = $tabobj;
469 dol_mkdir($dirins.
'/'.strtolower($module).
'/sql');
470 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
471 $srcfile1 = $srcdir.
'/sql/llx_mymodule_myobject_extrafields.sql';
472 $destfile1 = $dirins.
'/'.strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.sql';
475 $result1 =
dol_copy($srcfile1, $destfile1, 0, 0);
476 $srcfile2 = $srcdir.
'/sql/llx_mymodule_myobject_extrafields.key.sql';
477 $destfile2 = $dirins.
'/'.strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.key.sql';
480 $result2 =
dol_copy($srcfile2, $destfile2, 0, 0);
482 if ($result1 > 0 && $result2 > 0) {
483 $modulename = ucfirst($module);
486 $arrayreplacement = array(
487 'mymodule'=>strtolower($modulename),
488 'MyModule'=>$modulename,
489 'MYMODULE'=>strtoupper($modulename),
490 'My module'=>$modulename,
491 'my module'=>$modulename,
492 'Mon module'=>$modulename,
493 'mon module'=>$modulename,
494 'htdocs/modulebuilder/template'=>strtolower($modulename),
495 'My Object'=>$objectname,
496 'MyObject'=>$objectname,
497 'my object'=>strtolower($objectname),
498 'myobject'=>strtolower($objectname),
499 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
505 $langs->load(
"errors");
507 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile1),
null,
'errors');
510 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile2),
null,
'errors');
515 $srcfile = $dirins.
'/'.strtolower($module).
'/class/'.strtolower($objectname).
'.class.php';
516 $arrayreplacement = array(
'/\$isextrafieldmanaged = 0;/' =>
'$isextrafieldmanaged = 1;');
522 if ($dirins && $action ==
'inithook' && !empty($module)) {
523 dol_mkdir($dirins.
'/'.strtolower($module).
'/class');
524 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
525 $srcfile = $srcdir.
'/class/actions_mymodule.class.php';
526 $destfile = $dirins.
'/'.strtolower($module).
'/class/actions_'.strtolower($module).
'.class.php';
529 $result =
dol_copy($srcfile, $destfile, 0, 0);
532 $modulename = ucfirst($module);
535 $arrayreplacement = array(
536 'mymodule'=>strtolower($modulename),
537 'MyModule'=>$modulename,
538 'MYMODULE'=>strtoupper($modulename),
539 'My module'=>$modulename,
540 'my module'=>$modulename,
541 'Mon module'=>$modulename,
542 'mon module'=>$modulename,
543 'htdocs/modulebuilder/template'=>strtolower($modulename),
544 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
549 $langs->load(
"errors");
550 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
556 if ($dirins && $action ==
'inittrigger' && !empty($module)) {
557 dol_mkdir($dirins.
'/'.strtolower($module).
'/core/triggers');
558 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
559 $srcfile = $srcdir.
'/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php';
560 $destfile = $dirins.
'/'.strtolower($module).
'/core/triggers/interface_99_mod'.$module.
'_'.$module.
'Triggers.class.php';
563 $result =
dol_copy($srcfile, $destfile, 0, 0);
566 $modulename = ucfirst($module);
569 $arrayreplacement = array(
570 'mymodule'=>strtolower($modulename),
571 'MyModule'=>$modulename,
572 'MYMODULE'=>strtoupper($modulename),
573 'My module'=>$modulename,
574 'my module'=>$modulename,
575 'Mon module'=>$modulename,
576 'mon module'=>$modulename,
577 'htdocs/modulebuilder/template'=>strtolower($modulename),
578 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
583 $langs->load(
"errors");
584 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
590 if ($dirins && $action ==
'initwidget' && !empty($module)) {
591 dol_mkdir($dirins.
'/'.strtolower($module).
'/core/boxes');
592 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
593 $srcfile = $srcdir.
'/core/boxes/mymodulewidget1.php';
594 $destfile = $dirins.
'/'.strtolower($module).
'/core/boxes/'.strtolower($module).
'widget1.php';
597 $result =
dol_copy($srcfile, $destfile, 0, 0);
600 $modulename = ucfirst($module);
603 $arrayreplacement = array(
604 'mymodule'=>strtolower($modulename),
605 'MyModule'=>$modulename,
606 'MYMODULE'=>strtoupper($modulename),
607 'My module'=>$modulename,
608 'my module'=>$modulename,
609 'Mon module'=>$modulename,
610 'mon module'=>$modulename,
611 'htdocs/modulebuilder/template'=>strtolower($modulename),
612 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
617 $langs->load(
"errors");
618 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
624 if ($dirins && $action ==
'initcss' && !empty($module)) {
625 dol_mkdir($dirins.
'/'.strtolower($module).
'/css');
626 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
627 $srcfile = $srcdir.
'/css/mymodule.css.php';
628 $destfile = $dirins.
'/'.strtolower($module).
'/css/'.strtolower($module).
'.css.php';
631 $result =
dol_copy($srcfile, $destfile, 0, 0);
634 $modulename = ucfirst($module);
637 $arrayreplacement = array(
638 'mymodule'=>strtolower($modulename),
639 'MyModule'=>$modulename,
640 'MYMODULE'=>strtoupper($modulename),
641 'My module'=>$modulename,
642 'my module'=>$modulename,
643 'Mon module'=>$modulename,
644 'mon module'=>$modulename,
645 'htdocs/modulebuilder/template'=>strtolower($modulename),
646 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
''),
652 $srcfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
653 $arrayreplacement = array(
'/\/\/\s*\''.preg_quote(
'/'.strtolower($module).
'/css/'.strtolower($module).
'.css.php',
'/').
'\'/
' => '\
'/'.strtolower($module).
'/css/'.strtolower($module).
'.css.php\'');
656 $langs->load(
"errors");
657 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
663 if ($dirins && $action ==
'initjs' && !empty($module)) {
664 dol_mkdir($dirins.
'/'.strtolower($module).
'/js');
665 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
666 $srcfile = $srcdir.
'/js/mymodule.js.php';
667 $destfile = $dirins.
'/'.strtolower($module).
'/js/'.strtolower($module).
'.js.php';
670 $result =
dol_copy($srcfile, $destfile, 0, 0);
673 $modulename = ucfirst($module);
676 $arrayreplacement = array(
677 'mymodule'=>strtolower($modulename),
678 'MyModule'=>$modulename,
679 'MYMODULE'=>strtoupper($modulename),
680 'My module'=>$modulename,
681 'my module'=>$modulename,
682 'Mon module'=>$modulename,
683 'mon module'=>$modulename,
684 'htdocs/modulebuilder/template'=>strtolower($modulename),
685 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
691 $srcfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
692 $arrayreplacement = array(
'/\/\/\s*\''.preg_quote(
'/'.strtolower($module).
'/js/'.strtolower($module).
'.js.php',
'/').
'\'/
' => '\
'/'.strtolower($module).
'/js/'.strtolower($module).
'.js.php\'');
695 $langs->load(
"errors");
696 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
702 if ($dirins && $action ==
'initcli' && !empty($module)) {
703 dol_mkdir($dirins.
'/'.strtolower($module).
'/scripts');
704 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
705 $srcfile = $srcdir.
'/scripts/mymodule.php';
706 $destfile = $dirins.
'/'.strtolower($module).
'/scripts/'.strtolower($module).
'.php';
709 $result =
dol_copy($srcfile, $destfile, 0, 0);
712 $modulename = ucfirst($module);
715 $arrayreplacement = array(
716 'mymodule'=>strtolower($modulename),
717 'MyModule'=>$modulename,
718 'MYMODULE'=>strtoupper($modulename),
719 'My module'=>$modulename,
720 'my module'=>$modulename,
721 'Mon module'=>$modulename,
722 'mon module'=>$modulename,
723 'htdocs/modulebuilder/template'=>strtolower($modulename),
724 '__MYCOMPANY_NAME__'=>$mysoc->name,
725 '__KEYWORDS__'=>$modulename,
726 '__USER_FULLNAME__'=>$user->getFullName($langs),
727 '__USER_EMAIL__'=>$user->email,
729 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'dayrfc').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
734 $langs->load(
"errors");
735 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
741 if ($dirins && $action ==
'initdoc' && !empty($module)) {
742 dol_mkdir($dirins.
'/'.strtolower($module).
'/doc');
743 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
744 $srcfile = $srcdir.
'/doc/Documentation.asciidoc';
745 $destfile = $dirins.
'/'.strtolower($module).
'/doc/Documentation.asciidoc';
748 $result =
dol_copy($srcfile, $destfile, 0, 0);
751 $modulename = ucfirst($module);
752 $modulelowercase = strtolower($module);
755 $arrayreplacement = array(
756 'mymodule'=>strtolower($modulename),
757 'MyModule'=>$modulename,
758 'MYMODULE'=>strtoupper($modulename),
759 'My module'=>$modulename,
760 'my module'=>$modulename,
761 'Mon module'=>$modulename,
762 'mon module'=>$modulename,
763 'htdocs/modulebuilder/template'=>strtolower($modulename),
764 '__MYCOMPANY_NAME__'=>$mysoc->name,
765 '__KEYWORDS__'=>$modulename,
766 '__USER_FULLNAME__'=>$user->getFullName($langs),
767 '__USER_EMAIL__'=>$user->email,
769 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'dayrfc').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
775 $FILENAMEDOC = $modulelowercase.
'.html';
776 $FILENAMEDOCPDF = $modulelowercase.
'.pdf';
777 $outputfiledoc =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOC;
778 $outputfiledocurl =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOC;
779 $outputfiledocpdf =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOCPDF;
780 $outputfiledocurlpdf =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOCPDF;
785 $langs->load(
"errors");
786 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
792 if ($dirins && $action ==
'addlanguage' && !empty($module)) {
793 $newlangcode =
GETPOST(
'newlangcode',
'aZ09');
796 $modulelowercase = strtolower($module);
801 if ($diroflang == $dolibarr_main_document_root.
'/'.$modulelowercase) {
803 $diroflang = $dolibarr_main_document_root;
805 $srcfile = $diroflang.
'/langs/en_US/'.$modulelowercase.
'.lang';
806 $destfile = $diroflang.
'/langs/'.$newlangcode.
'/'.$modulelowercase.
'.lang';
808 $result =
dol_copy($srcfile, $destfile, 0, 0);
810 setEventMessages($langs->trans(
"ErrorFailToCopyFile", $srcfile, $destfile),
null,
'errors');
813 $srcfile = $diroflang.
'/langs/en_US';
814 $destfile = $diroflang.
'/langs/'.$newlangcode;
816 $result =
dolCopyDir($srcfile, $destfile, 0, 0);
819 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Language")),
null,
'errors');
825 if ($dirins && $action ==
'confirm_removefile' && !empty($module)) {
826 $objectname = $tabobj;
829 if ($relativefilename) {
830 $dirnametodelete = dirname($relativefilename);
831 $filetodelete = $dirins.
'/'.$relativefilename;
832 $dirtodelete = $dirins.
'/'.$dirnametodelete;
836 setEventMessages($langs->trans(
"ErrorFailToDeleteFile", basename($filetodelete)),
null,
'errors');
839 if (preg_match(
'/\.sql$/', $relativefilename)) {
840 if (preg_match(
'/\.key\.sql$/', $relativefilename)) {
841 $relativefilename = preg_replace(
'/\.key\.sql$/',
'.sql', $relativefilename);
842 $filetodelete = $dirins.
'/'.$relativefilename;
844 } elseif (preg_match(
'/\.sql$/', $relativefilename)) {
845 $relativefilename = preg_replace(
'/\.sql$/',
'.key.sql', $relativefilename);
846 $filetodelete = $dirins.
'/'.$relativefilename;
856 if (in_array($tab, array(
'css',
'js'))) {
857 $srcfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
858 $arrayreplacement = array(
'/^\s*\''.preg_quote(
'/'.$relativefilename,
'/').
'\',*/m
'=>'
862 if (preg_match(
'/_extrafields/', $relativefilename)) {
864 $srcfile = $dirins.
'/'.strtolower($module).
'/class/'.strtolower($objectname).
'.class.php';
865 $arrayreplacement = array(
'/\$isextrafieldmanaged = 1;/' =>
'$isextrafieldmanaged = 0;');
870 $varnametoupdate =
'';
872 if (preg_match(
'/_([a-z]+)\.php$/', $relativefilename, $reg)) {
873 $varnametoupdate =
'showtabofpage'.$reg[1];
875 if ($varnametoupdate) {
876 $srcfile = $dirins.
'/'.strtolower($module).
'/lib/'.strtolower($module).
'_'.strtolower($objectname).
'.lib.php';
877 $arrayreplacement = array(
'/\$'.$varnametoupdate.
' = 1;/' =>
'$'.$varnametoupdate.
' = 0;');
886 if ($dirins && $action ==
'initobject' && $module &&
GETPOST(
'createtablearray',
'alpha')) {
887 $tablename =
GETPOST(
'initfromtablename',
'alpha');
888 $_results = $db->DDLDescTable($tablename);
889 if (empty($_results)) {
890 setEventMessages($langs->trans(
"ErrorTableNotFound", $tablename),
null,
'errors');
938 $string =
'public $fields=array('.
"\n";
941 while ($obj = $db->fetch_object($_results)) {
943 $fieldname = $obj->Field;
946 if ($type ==
'int(11)') {
949 if ($type ==
'float') {
952 if (strstr($type,
'tinyint')) {
955 if ($obj->Field ==
'fk_soc') {
956 $type =
'integer:Societe:societe/class/societe.class.php';
958 if (preg_match(
'/^fk_proj/', $obj->Field)) {
959 $type =
'integer:Project:projet/class/project.class.php:1:fk_statut=1';
961 if (preg_match(
'/^fk_prod/', $obj->Field)) {
962 $type =
'integer:Product:product/class/product.class.php:1';
964 if ($obj->Field ==
'fk_warehouse') {
965 $type =
'integer:Entrepot:product/stock/class/entrepot.class.php';
967 if (preg_match(
'/^(fk_user|fk_commercial)/', $obj->Field)) {
968 $type =
'integer:User:user/class/user.class.php';
972 $notnull = ($obj->Null ==
'YES' ? 0 : 1);
973 if ($fieldname ==
'fk_user_modif') {
977 $label = preg_replace(
'/_/',
'', ucfirst($fieldname));
978 if ($fieldname ==
'rowid') {
979 $label =
'TechnicalID';
981 if ($fieldname ==
'import_key') {
984 if ($fieldname ==
'fk_soc') {
985 $label =
'ThirdParty';
987 if ($fieldname ==
'tms') {
988 $label =
'DateModification';
990 if ($fieldname ==
'datec') {
991 $label =
'DateCreation';
993 if ($fieldname ==
'date_valid') {
994 $label =
'DateValidation';
996 if ($fieldname ==
'datev') {
997 $label =
'DateValidation';
999 if ($fieldname ==
'note_private') {
1000 $label =
'NotePublic';
1002 if ($fieldname ==
'note_public') {
1003 $label =
'NotePrivate';
1005 if ($fieldname ==
'fk_user_creat') {
1006 $label =
'UserAuthor';
1008 if ($fieldname ==
'fk_user_modif') {
1009 $label =
'UserModif';
1011 if ($fieldname ==
'fk_user_valid') {
1012 $label =
'UserValidation';
1016 if ($fieldname ==
'entity') {
1019 if ($fieldname ==
'import_key') {
1022 if ($fieldname ==
'fk_user_creat') {
1025 if ($fieldname ==
'fk_user_modif') {
1028 if (in_array($fieldname, array(
'ref_ext',
'model_pdf',
'note_public',
'note_private'))) {
1035 if ($fieldname ==
'entity') {
1040 if (in_array($fieldname, array(
'status',
'statut',
'fk_status',
'fk_statut'))) {
1043 if ($fieldname ==
'import_key') {
1048 if ($fieldname ==
'entity') {
1055 if (preg_match(
'/^fk_/', $fieldname)) {
1056 $css =
'maxwidth500 widthcentpercentminusxx';
1058 if ($fieldname ==
'label') {
1059 $css =
'minwidth300';
1060 $cssview =
'wordbreak';
1062 if (in_array($fieldname, array(
'note_public',
'note_private'))) {
1063 $cssview =
'wordbreak';
1067 $picto = $obj->Picto;
1068 if ($obj->Field ==
'fk_soc') {
1071 if (preg_match(
'/^fk_proj/', $obj->Field)) {
1076 $string .=
"'".$obj->Field.
"'=>array('type'=>'".$type.
"', 'label'=>'".$label.
"',";
1077 if ($default !=
'') {
1078 $string .=
" 'default'=>".$default.
",";
1080 $string .=
" 'enabled'=>".$enabled.
",";
1081 $string .=
" 'visible'=>".$visible;
1083 $string .=
", 'notnull'=>".$notnull;
1085 if ($fieldname ==
'ref' || $fieldname ==
'code') {
1086 $string .=
", 'showoncombobox'=>1";
1088 $string .=
", 'position'=>".$position;
1090 $string .=
", 'index'=>".$index;
1093 $string .=
", 'picto'=>'".$picto.
"'";
1096 $string .=
", 'css'=>".$css;
1099 $string .=
", 'cssview'=>".$cssview;
1102 $string .=
", 'csslist'=>".$csslist;
1108 $string .=
');'.
"\n";
1115 if ($dirins && $action ==
'initobject' && $module && $objectname) {
1116 $objectname = ucfirst($objectname);
1118 $dirins = $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
1119 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
1121 if (preg_match(
'/[^a-z0-9_]/i', $objectname)) {
1123 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
1124 $tabobj =
'newobject';
1126 if (class_exists($objectname)) {
1129 setEventMessages($langs->trans(
"AnObjectWithThisClassNameAlreadyExists"),
null,
'errors');
1130 $tabobj =
'newobject';
1133 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
1134 $destdir = $dirins.
'/'.strtolower($module);
1145 $dirlist =
dol_dir_list($destdir.
'/class',
'files', 0,
'\.txt$');
1146 $alreadyfound =
false;
1147 foreach ($dirlist as $key => $val) {
1148 $filefound = preg_replace(
'/\.txt$/',
'', $val[
'name']);
1149 if (strtolower($objectname) == strtolower($filefound) && $objectname != $filefound) {
1150 $alreadyfound =
true;
1152 setEventMessages($langs->trans(
"AnObjectAlreadyExistWithThisNameAndDiffCase"),
null,
'errors');
1160 $filetogenerate = array(
1161 'myobject_card.php'=>strtolower($objectname).
'_card.php',
1162 'myobject_note.php'=>strtolower($objectname).
'_note.php',
1163 'myobject_contact.php'=>strtolower($objectname).
'_contact.php',
1164 'myobject_document.php'=>strtolower($objectname).
'_document.php',
1165 'myobject_agenda.php'=>strtolower($objectname).
'_agenda.php',
1166 'myobject_list.php'=>strtolower($objectname).
'_list.php',
1167 'admin/myobject_extrafields.php'=>
'admin/'.strtolower($objectname).
'_extrafields.php',
1168 'lib/mymodule_myobject.lib.php'=>
'lib/'.strtolower($module).
'_'.strtolower($objectname).
'.lib.php',
1170 'sql/llx_mymodule_myobject.sql'=>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'.sql',
1171 'sql/llx_mymodule_myobject.key.sql'=>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'.key.sql',
1172 'sql/llx_mymodule_myobject_extrafields.sql'=>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.sql',
1173 'sql/llx_mymodule_myobject_extrafields.key.sql'=>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.key.sql',
1175 'img/object_myobject.png'=>
'img/object_'.strtolower($objectname).
'.png',
1176 'class/myobject.class.php'=>
'class/'.strtolower($objectname).
'.class.php',
1180 if (
GETPOST(
'includerefgeneration',
'aZ09')) {
1181 dol_mkdir($destdir.
'/core/modules/'.strtolower($module));
1183 $filetogenerate += array(
1184 'core/modules/mymodule/mod_myobject_advanced.php'=>
'core/modules/'.strtolower($module).
'/mod_'.strtolower($objectname).
'_advanced.php',
1185 'core/modules/mymodule/mod_myobject_standard.php'=>
'core/modules/'.strtolower($module).
'/mod_'.strtolower($objectname).
'_standard.php',
1186 'core/modules/mymodule/modules_myobject.php'=>
'core/modules/'.strtolower($module).
'/modules_'.strtolower($objectname).
'.php',
1189 if (
GETPOST(
'includedocgeneration',
'aZ09')) {
1190 dol_mkdir($destdir.
'/core/modules/'.strtolower($module));
1191 dol_mkdir($destdir.
'/core/modules/'.strtolower($module).
'/doc');
1193 $filetogenerate += array(
1194 'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php'=>
'core/modules/'.strtolower($module).
'/doc/doc_generic_'.strtolower($objectname).
'_odt.modules.php',
1195 'core/modules/mymodule/doc/pdf_standard_myobject.modules.php'=>
'core/modules/'.strtolower($module).
'/doc/pdf_standard_'.strtolower($objectname).
'.modules.php'
1199 foreach ($filetogenerate as $srcfile => $destfile) {
1200 $result =
dol_copy($srcdir.
'/'.$srcfile, $destdir.
'/'.$destfile, $newmask, 0);
1204 $langs->load(
"errors");
1205 setEventMessages($langs->trans(
"ErrorFailToCopyFile", $srcdir.
'/'.$srcfile, $destdir.
'/'.$destfile),
null,
'errors');
1208 setEventMessages($langs->trans(
"FileAlreadyExists", $destfile),
null,
'warnings');
1214 if (
GETPOST(
'includerefgeneration',
'aZ09')) {
1216 $arrayreplacement = array(
1217 '/\'visible\'=>1,\s*\'noteditable\'=>0,\s*\'default\'=>\'\'/' =>
"'visible'=>4, 'noteditable'=>1, 'default'=>'(PROV)'"
1221 dolReplaceInFile($destdir.
'/class/'.strtolower($objectname).
'.class.php', $arrayreplacement,
'', 0, 0, 1);
1223 $arrayreplacement = array(
1224 '/\'models\' => 0,/' =>
'\'models\
' => 1,'
1226 dolReplaceInFile($destdir.
'/core/modules/mod'.$module.
'.class.php', $arrayreplacement,
'', 0, 0, 1);
1230 if (
GETPOST(
'includedocgeneration',
'aZ09')) {
1232 $arrayreplacement = array(
1233 '/\$includedocgeneration = 0;/' =>
'$includedocgeneration = 1;'
1235 dolReplaceInFile($destdir.
'/class/'.strtolower($objectname).
'.class.php', $arrayreplacement,
'', 0, 0, 1);
1236 dolReplaceInFile($destdir.
'/'.strtolower($objectname).
'_card.php', $arrayreplacement,
'', 0, 0, 1);
1238 $arrayreplacement = array(
1239 '/\'models\' => 0,/' =>
'\'models\
' => 1,'
1242 dolReplaceInFile($destdir.
'/core/modules/mod'.$module.
'.class.php', $arrayreplacement,
'', 0, 0, 1);
1249 $listofobject =
dol_dir_list($destdir.
'/class',
'files', 0,
'\.class\.php$');
1251 $firstobjectname =
'';
1252 foreach ($listofobject as $fileobj) {
1253 if (preg_match(
'/^api_/', $fileobj[
'name'])) {
1256 if (preg_match(
'/^actions_/', $fileobj[
'name'])) {
1260 $tmpcontent = file_get_contents($fileobj[
'fullname']);
1262 if (preg_match(
'/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) {
1263 $objectnameloop = $reg[1];
1264 if (empty($firstobjectname)) {
1265 $firstobjectname = $objectnameloop;
1271 \$this->menu[\$r++]=array(
1272 // '' 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
1273 'fk_menu'=>'fk_mainmenu=mymodule',
1274 // This is a Left menu entry
1276 'titre'=>'List MyObject',
1277 'mainmenu'=>'mymodule',
1278 'leftmenu'=>'mymodule_myobject',
1279 'url'=>'/mymodule/myobject_list.php',
1280 // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
1281 'langs'=>'mymodule@mymodule',
1282 'position'=>1100+\$r,
1283 // 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.
1284 'enabled'=>'\$conf->mymodule->enabled',
1285 // Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
1288 // 0=Menu for internal users, 1=external users, 2=both
1291 \$this->menu[\$r++]=array(
1292 // '' 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
1293 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=mymodule_myobject',
1294 // This is a Left menu entry
1296 'titre'=>'New MyObject',
1297 'mainmenu'=>'mymodule',
1298 'leftmenu'=>'mymodule_myobject',
1299 'url'=>'/mymodule/myobject_card.php?action=create',
1300 // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
1301 'langs'=>'mymodule@mymodule',
1302 'position'=>1100+\$r,
1303 // 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.
1304 'enabled'=>'\$conf->mymodule->enabled',
1305 // Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
1308 // 0=Menu for internal users, 1=external users, 2=both
1311 $stringtoadd = preg_replace(
'/MyObject/', $objectnameloop, $stringtoadd);
1312 $stringtoadd = preg_replace(
'/mymodule/', strtolower($module), $stringtoadd);
1313 $stringtoadd = preg_replace(
'/myobject/', strtolower($objectnameloop), $stringtoadd);
1315 $moduledescriptorfile = $destdir.
'/core/modules/mod'.$module.
'.class.php';
1320 dolReplaceInFile($moduledescriptorfile, array(
'END MODULEBUILDER LEFTMENU MYOBJECT */' =>
'*/'.
"\n".$stringtoadd.
"\n\t\t/* END MODULEBUILDER LEFTMENU MYOBJECT */"));
1323 $filetogenerate[] =
'core/modules/mod'.$module.
'.class.php';
1329 foreach ($filetogenerate as $destfile) {
1330 $phpfileval[
'fullname'] = $destdir.
'/'.$destfile;
1333 $arrayreplacement = array(
1334 'mymodule'=>strtolower($module),
1335 'MyModule'=>$module,
1336 'MYMODULE'=>strtoupper($module),
1337 'My module'=>$module,
1338 'my module'=>$module,
1339 'mon module'=>$module,
1340 'Mon module'=>$module,
1341 'htdocs/modulebuilder/template/'=>strtolower($modulename),
1342 'myobject'=>strtolower($objectname),
1343 'MyObject'=>$objectname,
1344 'MYOBJECT'=>strtoupper($objectname),
1345 '---Put here your own copyright and developer email---'=>
dol_print_date($now,
'%Y').
' '.$user->getFullName($langs).($user->email ?
' <'.$user->email.
'>' :
'')
1348 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME)) {
1349 $arrayreplacement[
'Editor name'] = $conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME;
1351 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_URL)) {
1352 $arrayreplacement[
'https://www.example.com'] = $conf->global->MODULEBUILDER_SPECIFIC_EDITOR_URL;
1354 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_AUTHOR)) {
1355 $arrayreplacement[
'---Put here your own copyright and developer email---'] =
dol_print_date($now,
'%Y').
' '.$conf->global->MODULEBUILDER_SPECIFIC_AUTHOR;
1357 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_VERSION)) {
1358 $arrayreplacement[
'1.0'] = $conf->global->MODULEBUILDER_SPECIFIC_VERSION;
1360 if (!empty($conf->global->MODULEBUILDER_SPECIFIC_FAMILY)) {
1361 $arrayreplacement[
'other'] = $conf->global->MODULEBUILDER_SPECIFIC_FAMILY;
1367 setEventMessages($langs->trans(
"ErrorFailToMakeReplacementInto", $phpfileval[
'fullname']),
null,
'errors');
1375 if (is_numeric($object) && $object < 0) {
1381 $result =
rebuildObjectSql($destdir, $module, $objectname, $newmask,
'', $object);
1388 setEventMessages($langs->trans(
'FilesForObjectInitialized', $objectname),
null);
1389 $tabobj = $objectname;
1394 if ($dirins && $action ==
'initdic' && $module && $dicname) {
1396 $newdicname = $dicname;
1397 if (!preg_match(
'/^c_/', $newdicname)) {
1398 $newdicname =
'c_'.$dicname;
1408 if ($dirins && ($action ==
'droptable' || $action ==
'droptableextrafields') && !empty($module) && !empty($tabobj)) {
1409 $objectname = $tabobj;
1411 $arrayoftables = array();
1412 if ($action ==
'droptable') {
1413 $arrayoftables[] = MAIN_DB_PREFIX.strtolower($module).
'_'.strtolower($tabobj);
1415 if ($action ==
'droptableextrafields') {
1416 $arrayoftables[] = MAIN_DB_PREFIX.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields';
1419 foreach ($arrayoftables as $tabletodrop) {
1421 $sql =
"SELECT COUNT(*) as nb FROM ".$tabletodrop;
1422 $resql = $db->query($sql);
1424 $obj = $db->fetch_object(
$resql);
1429 if ($db->lasterrno() ==
'DB_ERROR_NOSUCHTABLE') {
1430 setEventMessages($langs->trans(
"TableDoesNotExists", $tabletodrop),
null,
'warnings');
1436 $resql = $db->DDLDropTable($tabletodrop);
1438 setEventMessages($langs->trans(
"TableDropped", $tabletodrop),
null,
'mesgs');
1439 } elseif ($nb > 0) {
1440 setEventMessages($langs->trans(
"TableNotEmptyDropCanceled", $tabletodrop),
null,
'warnings');
1445 if ($dirins && $action ==
'addproperty' && empty($cancel) && !empty($module) && !empty($tabobj)) {
1448 $objectname = $tabobj;
1450 $dirins = $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
1451 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
1453 $srcdir = $dirread.
'/'.strtolower($module);
1454 $destdir = $dirins.
'/'.strtolower($module);
1458 if (!
GETPOST(
'regenerateclasssql') && !
GETPOST(
'regeneratemissing')) {
1459 if (!
GETPOST(
'propname',
'aZ09')) {
1461 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Name")),
null,
'errors');
1463 if (!
GETPOST(
'proplabel',
'alpha')) {
1465 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
1467 if (!
GETPOST(
'proptype',
'alpha')) {
1469 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Type")),
null,
'errors');
1472 if (!$error && !
GETPOST(
'regenerateclasssql')&& !
GETPOST(
'regeneratemissing')) {
1473 $addfieldentry = array(
1474 'name'=>
GETPOST(
'propname',
'aZ09'),
1475 'label'=>
GETPOST(
'proplabel',
'alpha'),
1476 'type'=>
GETPOST(
'proptype',
'alpha'),
1477 'arrayofkeyval'=>
GETPOST(
'proparrayofkeyval',
'restricthtml'),
1478 'visible'=>
GETPOST(
'propvisible',
'int'),
1479 'enabled'=>
GETPOST(
'propenabled',
'int'),
1480 'position'=>
GETPOST(
'propposition',
'int'),
1481 'notnull'=>
GETPOST(
'propnotnull',
'int'),
1482 'index'=>
GETPOST(
'propindex',
'int'),
1483 'searchall'=>
GETPOST(
'propsearchall',
'int'),
1484 'isameasure'=>
GETPOST(
'propisameasure',
'int'),
1485 'comment'=>
GETPOST(
'propcomment',
'alpha'),
1486 'help'=>
GETPOST(
'prophelp',
'alpha'),
1487 'css'=>
GETPOST(
'propcss',
'alpha'),
1488 'cssview'=>
GETPOST(
'propcssview',
'alpha'),
1489 'csslist'=>
GETPOST(
'propcsslist',
'alpha'),
1490 'default'=>
GETPOST(
'propdefault',
'restricthtml'),
1491 'noteditable'=>intval(
GETPOST(
'propnoteditable',
'int')),
1492 'validate' =>
GETPOST(
'propvalidate',
'int')
1496 if (!empty($addfieldentry[
'arrayofkeyval']) && !is_array($addfieldentry[
'arrayofkeyval'])) {
1497 $addfieldentry[
'arrayofkeyval'] = json_decode($addfieldentry[
'arrayofkeyval'],
true);
1501 $addfieldentry = array();
1510 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
1514 $object =
rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry, $moduletype);
1516 if (is_numeric($object) && $object <= 0) {
1523 $result =
rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object, $moduletype);
1531 clearstatcache(
true);
1533 setEventMessages($langs->trans(
'FilesForObjectUpdated', $objectname),
null);
1538 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj='.$objectname.
'&nocache='.time());
1544 if ($dirins && $action ==
'confirm_deleteproperty' && $propertykey) {
1545 $objectname = $tabobj;
1547 $dirins = $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
1548 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
1550 $srcdir = $dirread.
'/'.strtolower($module);
1551 $destdir = $dirins.
'/'.strtolower($module);
1556 $object =
rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, array(), $propertykey);
1557 if (is_numeric($object) && $object <= 0) {
1564 $result =
rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object);
1571 setEventMessages($langs->trans(
'FilesForObjectUpdated', $objectname),
null);
1573 clearstatcache(
true);
1576 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj='.$objectname);
1582 if ($dirins && $action ==
'confirm_deletemodule') {
1583 if (preg_match(
'/[^a-z0-9_]/i', $module)) {
1585 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
1589 $modulelowercase = strtolower($module);
1592 $dir = $dirins.
'/'.$modulelowercase;
1599 clearstatcache(
true);
1600 if (function_exists(
'opcache_invalidate')) {
1604 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?module=deletemodule');
1612 $module =
'deletemodule';
1615 if ($dirins && $action ==
'confirm_deleteobject' && $objectname) {
1616 if (preg_match(
'/[^a-z0-9_]/i', $objectname)) {
1618 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
1622 $modulelowercase = strtolower($module);
1623 $objectlowercase = strtolower($objectname);
1626 $dir = $dirins.
'/'.$modulelowercase;
1629 $filetodelete = array(
1630 'myobject_card.php'=>strtolower($objectname).
'_card.php',
1631 'myobject_note.php'=>strtolower($objectname).
'_note.php',
1632 'myobject_contact.php'=>strtolower($objectname).
'_contact.php',
1633 'myobject_document.php'=>strtolower($objectname).
'_document.php',
1634 'myobject_agenda.php'=>strtolower($objectname).
'_agenda.php',
1635 'myobject_list.php'=>strtolower($objectname).
'_list.php',
1636 'admin/myobject_extrafields.php'=>
'admin/'.strtolower($objectname).
'_extrafields.php',
1637 'lib/mymodule_myobject.lib.php'=>
'lib/'.strtolower($module).
'_'.strtolower($objectname).
'.lib.php',
1638 'test/phpunit/MyObjectTest.php'=>
'test/phpunit/'.strtolower($objectname).
'Test.php',
1639 'sql/llx_mymodule_myobject.sql'=>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'.sql',
1640 'sql/llx_mymodule_myobject_extrafields.sql'=>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.sql',
1641 'sql/llx_mymodule_myobject.key.sql'=>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'.key.sql',
1642 'sql/llx_mymodule_myobject_extrafields.key.sql'=>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.key.sql',
1643 'scripts/myobject.php'=>
'scripts/'.strtolower($objectname).
'.php',
1644 'img/object_myobject.png'=>
'img/object_'.strtolower($objectname).
'.png',
1645 'class/myobject.class.php'=>
'class/'.strtolower($objectname).
'.class.php',
1646 'class/api_myobject.class.php'=>
'class/api_'.strtolower($module).
'.class.php',
1647 'core/modules/mymodule/mod_myobject_advanced.php'=>
'core/modules/'.strtolower($module).
'/mod_'.strtolower($objectname).
'_advanced.php',
1648 'core/modules/mymodule/mod_myobject_standard.php'=>
'core/modules/'.strtolower($module).
'/mod_'.strtolower($objectname).
'_standard.php',
1649 'core/modules/mymodule/modules_myobject.php'=>
'core/modules/'.strtolower($module).
'/modules_'.strtolower($objectname).
'.php',
1650 'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php'=>
'core/modules/'.strtolower($module).
'/doc/doc_generic_'.strtolower($objectname).
'_odt.modules.php',
1651 'core/modules/mymodule/doc/pdf_standard_myobject.modules.php'=>
'core/modules/'.strtolower($module).
'/doc/pdf_standard_'.strtolower($objectname).
'.modules.php'
1655 foreach ($filetodelete as $filetodelete) {
1657 $resulttmp =
dol_delete_file($dir.
'/'.$filetodelete.
'.back', 0, 0, 1);
1663 if ($resultko == 0) {
1666 setEventMessages($langs->trans(
"ErrorSomeFilesCouldNotBeDeleted"),
null,
'warnings');
1671 $tabobj =
'deleteobject';
1674 if ($dirins && $action ==
'generatedoc') {
1675 $modulelowercase = strtolower($module);
1680 $FILENAMEDOC = strtolower($module).
'.html';
1682 $util =
new Utils($db);
1683 $result = $util->generateDoc($module);
1686 setEventMessages($langs->trans(
"DocFileGeneratedInto", $dirofmodule),
null);
1692 if ($dirins && $action ==
'generatepackage') {
1693 $modulelowercase = strtolower($module);
1695 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
1705 $class =
'mod'.$module;
1707 if (class_exists($class)) {
1709 $moduleobj =
new $class($db);
1716 $langs->load(
"errors");
1717 dol_print_error($db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
1721 $arrayversion = explode(
'.', $moduleobj->version, 3);
1722 if (count($arrayversion)) {
1723 $FILENAMEZIP =
"module_".$modulelowercase.
'-'.$arrayversion[0].(empty($arrayversion[1]) ?
'.0' :
'.'.$arrayversion[1]).($arrayversion[2] ?
'.'.$arrayversion[2] :
'').
'.zip';
1726 $outputfilezip = $dirofmodule.
'/'.$FILENAMEZIP;
1732 $result = dol_compress_dir($dir, $outputfilezip,
'zip',
'/\/bin\//', $modulelowercase);
1738 setEventMessages($langs->trans(
"ZipFileGeneratedInto", $outputfilezip),
null);
1741 $langs->load(
"errors");
1742 setEventMessages($langs->trans(
"ErrorFailToGenerateFile", $outputfilezip),
null,
'errors');
1746 $langs->load(
"errors");
1747 setEventMessages($langs->trans(
"ErrorCheckVersionIsDefined"),
null,
'errors');
1753 if ($action ==
'savefile' && empty($cancel)) {
1754 $relofcustom = basename($dirins);
1758 if (!preg_match(
'/^'.$relofcustom.
'/', $file)) {
1759 $file = $relofcustom.
'/'.$file;
1767 dol_copy($pathoffile, $pathoffilebackup, 0, 1);
1770 $check =
'restricthtml';
1772 if ($srclang ==
'md') {
1773 $check =
'restricthtml';
1775 if ($srclang ==
'lang') {
1776 $check =
'restricthtml';
1778 if ($srclang ==
'php') {
1782 $content =
GETPOST(
'editfilecontent', $check);
1787 $result = file_put_contents($pathoffile, $content);
1789 @chmod($pathoffile, octdec($newmask));
1804 if ($action ==
'set' && $user->admin) {
1807 $param .=
'&module='.urlencode($module);
1810 $param .=
'&tab='.urlencode($tab);
1813 $param .=
'&tabobj='.urlencode($tabobj);
1816 $value =
GETPOST(
'value',
'alpha');
1818 if (!empty($resarray[
'errors'])) {
1822 if ($resarray[
'nbperms'] > 0) {
1823 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
1824 $resqltmp = $db->query($tmpsql);
1826 $obj = $db->fetch_object($resqltmp);
1828 if ($obj && $obj->nb > 1) {
1829 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
1837 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?".$param);
1842 if ($action ==
'reset' && $user->admin) {
1845 $param .=
'&module='.urlencode($module);
1848 $param .=
'&tab='.urlencode($tab);
1851 $param .=
'&tabobj='.urlencode($tabobj);
1854 $value =
GETPOST(
'value',
'alpha');
1859 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?".$param);
1880 '/includes/ace/src/ace.js',
1881 '/includes/ace/src/ext-statusbar.js',
1882 '/includes/ace/src/ext-language_tools.js',
1887 llxHeader(
'', $langs->trans(
"ModuleBuilder"),
$help_url,
'', 0, 0, $morejs, $morecss,
'',
'classforhorizontalscrolloftabs');
1890 $text = $langs->trans(
"ModuleBuilder");
1894 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ModuleBuilderDesc",
'https://wiki.dolibarr.org/index.php/Module_development#Create_your_module').
'</span>';
1895 print
'<br class="hideonsmartphone">';
1904 $message =
info_admin($langs->trans(
"ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.
'/custom', DOL_DOCUMENT_ROOT));
1909 $langs->load(
"errors");
1910 $message =
info_admin($langs->trans(
"ErrorFailedToWriteInDir", $dirins));
1914 $message =
info_admin($langs->trans(
"NotExistsDirect", $dirins).$langs->trans(
"InfDirAlt").$langs->trans(
"InfDirExample"));
1923 $infomodulesfound =
'<div style="padding: 12px 9px 12px">'.$form->textwithpicto(
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ModuleBuilderDesc3", count($listofmodules)).
'</span>', $langs->trans(
"ModuleBuilderDesc4", $FILEFLAG).
'<br>'.$textforlistofdirs).
'</div>';
1931 if (!empty($module) && $module !=
'initmodule' && $module !=
'deletemodule') {
1932 $modulelowercase = strtolower($module);
1933 $loadclasserrormessage =
'';
1937 $fullpathdirtodescriptor = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
1942 $class =
'mod'.$module;
1943 }
catch (Throwable $e) {
1944 $loadclasserrormessage = $e->getMessage().
"<br>\n";
1945 $loadclasserrormessage .=
'File: '.$e->getFile().
"<br>\n";
1946 $loadclasserrormessage .=
'Line: '.$e->getLine().
"<br>\n";
1948 $loadclasserrormessage = $e->getMessage().
"<br>\n";
1949 $loadclasserrormessage .=
'File: '.$e->getFile().
"<br>\n";
1950 $loadclasserrormessage .=
'Line: '.$e->getLine().
"<br>\n";
1953 if (class_exists($class)) {
1955 $moduleobj =
new $class($db);
1958 print $e->getMessage();
1961 if (empty($forceddirread)) {
1964 $langs->load(
"errors");
1965 print
'<!-- ErrorFailedToLoadModuleDescriptorForXXX -->';
1966 print
img_warning(
'').
' '.$langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module).
'<br>';
1967 print $loadclasserrormessage;
1978 $head[$h][0] = $_SERVER[
"PHP_SELF"].
'?module=initmodule';
1979 $head[$h][1] =
'<span class="valignmiddle text-plus-circle">'.$langs->trans(
"NewModule").
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
1980 $head[$h][2] =
'initmodule';
1983 $linktoenabledisable =
'';
1985 if (is_array($listofmodules) && count($listofmodules) > 0) {
1987 $modulelowercase = strtolower($module);
1988 $const_name =
'MAIN_MODULE_'.strtoupper($module);
1992 $param .=
'&tab='.urlencode($tab);
1995 $param .=
'&module='.urlencode($module);
1998 $param .=
'&tabobj='.urlencode($tabobj);
2001 $urltomodulesetup =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?search_keyword='.urlencode($module).
'">'.$langs->trans(
'Home').
'-'.$langs->trans(
"Setup").
'-'.$langs->trans(
"Modules").
'</a>';
2002 if (!empty($conf->global->$const_name)) {
2003 $linktoenabledisable .=
'<a class="reposition asetresetmodule valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$moduleobj->numero.
'&action=reset&value=mod'.$module.$param.
'">';
2004 $linktoenabledisable .=
img_picto($langs->trans(
"Activated"),
'switch_on',
'',
false, 0, 0,
'',
'', 1);
2005 $linktoenabledisable .=
'</a>';
2007 $linktoenabledisable .=
$form->textwithpicto(
'', $langs->trans(
"Warning").
' : '.$langs->trans(
"ModuleIsLive"), -1,
'warning');
2009 $objMod = $moduleobj;
2010 $backtourlparam =
'';
2011 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'module='.$module;
2013 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'tab='.$tab;
2015 $backtourl = $_SERVER[
"PHP_SELF"].$backtourlparam;
2018 if (is_array($objMod->config_page_url)) {
2020 foreach ($objMod->config_page_url as $page) {
2023 $linktoenabledisable .=
' <a href="'.$urlpage.
'" title="'.$langs->trans($page).
'">'.
img_picto(ucfirst($page),
"setup").
'</a>';
2026 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
2027 $urltouse =
dol_buildpath(
'/'.$regs[2].
'/admin/'.$regs[1], 1);
2028 $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>';
2032 $urltouse = DOL_URL_ROOT.
'/admin/'.$urlpage;
2033 $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>';
2037 } elseif (preg_match(
'/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) {
2038 $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>';
2041 if (!empty($moduleobj)) {
2042 $linktoenabledisable .=
'<a class="reposition asetresetmodule valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$moduleobj->numero.
'&action=set&token='.
newToken().
'&value=mod'.$module.$param.
'">';
2043 $linktoenabledisable .=
img_picto($langs->trans(
"ModuleIsNotActive", $urltomodulesetup),
'switch_off',
'style="padding-right: 8px"',
false, 0, 0,
'',
'classfortooltip', 1);
2044 $linktoenabledisable .=
"</a>\n";
2049 foreach ($listofmodules as $tmpmodule => $tmpmodulearray) {
2050 $head[$h][0] = $_SERVER[
"PHP_SELF"].
'?module='.$tmpmodulearray[
'modulenamewithcase'].($forceddirread ?
'@'.$dirread :
'');
2051 $head[$h][1] = $tmpmodulearray[
'modulenamewithcase'];
2052 $head[$h][2] = $tmpmodulearray[
'modulenamewithcase'];
2054 if ($tmpmodulearray[
'modulenamewithcase'] == $module) {
2055 $head[$h][4] =
'<span class="inline-block">'.$linktoenabledisable.
'</span>';
2062 $head[$h][0] = $_SERVER[
"PHP_SELF"].
'?module=deletemodule';
2063 $head[$h][1] = $langs->trans(
"DangerZone");
2064 $head[$h][2] =
'deletemodule';
2070 if ($module ==
'initmodule') {
2072 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
2073 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2074 print
'<input type="hidden" name="action" value="initmodule">';
2075 print
'<input type="hidden" name="module" value="initmodule">';
2078 print $langs->trans(
"EnterNameOfModuleDesc").
'<br>';
2081 print
'<input type="text" name="modulename" value="'.dol_escape_htmltag($modulename).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"ModuleKey")).
'"><br>';
2083 print
'<br><input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans(
"Create")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
2085 } elseif ($module ==
'deletemodule') {
2086 print
'<!-- Form to init a module -->'.
"\n";
2087 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="delete">';
2088 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2089 print
'<input type="hidden" name="action" value="confirm_deletemodule">';
2090 print
'<input type="hidden" name="module" value="deletemodule">';
2092 print $langs->trans(
"EnterNameOfModuleToDeleteDesc").
'<br><br>';
2094 print
'<input type="text" name="module" placeholder="'.dol_escape_htmltag($langs->trans(
"ModuleKey")).
'" value="">';
2095 print
'<input type="submit" class="button smallpaddingimp" value="'.$langs->trans(
"Delete").
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
2097 } elseif (!empty($module)) {
2100 $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
2105 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=description&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2106 $head2[$h][1] = $langs->trans(
"Description");
2107 $head2[$h][2] =
'description';
2110 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2111 $head2[$h][1] = $langs->trans(
"Objects");
2112 $head2[$h][2] =
'objects';
2115 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=languages&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2116 $head2[$h][1] = $langs->trans(
"Languages");
2117 $head2[$h][2] =
'languages';
2120 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2121 $head2[$h][1] = $langs->trans(
"Dictionaries");
2122 $head2[$h][2] =
'dictionaries';
2125 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=permissions&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2126 $head2[$h][1] = $langs->trans(
"Permissions");
2127 $head2[$h][2] =
'permissions';
2130 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=tabs&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2131 $head2[$h][1] = $langs->trans(
"Tabs");
2132 $head2[$h][2] =
'tabs';
2135 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=menus&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2136 $head2[$h][1] = $langs->trans(
"Menus");
2137 $head2[$h][2] =
'menus';
2140 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=hooks&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2141 $head2[$h][1] = $langs->trans(
"Hooks");
2142 $head2[$h][2] =
'hooks';
2145 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=triggers&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2146 $head2[$h][1] = $langs->trans(
"Triggers");
2147 $head2[$h][2] =
'triggers';
2150 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=widgets&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2151 $head2[$h][1] = $langs->trans(
"Widgets");
2152 $head2[$h][2] =
'widgets';
2155 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=exportimport&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2156 $head2[$h][1] = $langs->trans(
"Export").
'-'.$langs->trans(
"Import");
2157 $head2[$h][2] =
'exportimport';
2160 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=css&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2161 $head2[$h][1] = $langs->trans(
"CSS");
2162 $head2[$h][2] =
'css';
2165 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=js&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2166 $head2[$h][1] = $langs->trans(
"JS");
2167 $head2[$h][2] =
'js';
2170 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=cli&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2171 $head2[$h][1] = $langs->trans(
"CLI");
2172 $head2[$h][2] =
'cli';
2175 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=cron&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2176 $head2[$h][1] = $langs->trans(
"CronList");
2177 $head2[$h][2] =
'cron';
2180 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=specifications&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2181 $head2[$h][1] = $langs->trans(
"Documentation");
2182 $head2[$h][2] =
'specifications';
2185 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=buildpackage&module='.$module.($forceddirread ?
'@'.$dirread :
'');
2186 $head2[$h][1] = $langs->trans(
"BuildPackage");
2187 $head2[$h][2] =
'buildpackage';
2190 print
'<!-- Section for a given module -->';
2194 if ($tab ==
'description') {
2195 print
'<!-- tab=description -->'.
"\n";
2196 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2197 $pathtofilereadme = $modulelowercase.
'/README.md';
2198 $pathtochangelog = $modulelowercase.
'/ChangeLog.md';
2200 if ($action !=
'editfile' || empty($file)) {
2203 print
'<span class="opacitymedium">'.$langs->trans(
"ModuleBuilderDesc".$tab).
'</span>';
2204 $infoonmodulepath =
'';
2205 if (realpath($dirread.
'/'.$modulelowercase) != $dirread.
'/'.$modulelowercase) {
2206 $infoonmodulepath =
'<span class="opacitymedium">'.$langs->trans(
"RealPathOfModule").
' :</span> <strong class="wordbreak">'.realpath($dirread.
'/'.$modulelowercase).
'</strong><br>';
2207 print
' '.$infoonmodulepath;
2214 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
2215 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2218 print
'<tr><td><span class="fa fa-file-o"></span> '.$langs->trans(
"ReadmeFile").
' : <strong class="wordbreak">'.$pathtofilereadme.
'</strong>';
2219 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=markdown&file='.urlencode($pathtofilereadme).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2222 print
'<tr><td><span class="fa fa-file-o"></span> '.$langs->trans(
"ChangeLog").
' : <strong class="wordbreak">'.$pathtochangelog.
'</strong>';
2223 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=markdown&file='.urlencode($pathtochangelog).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2231 if (!empty($moduleobj)) {
2232 print
'<div class="underbanner clearboth"></div>';
2233 print
'<div class="fichecenter">';
2235 print
'<table class="border centpercent">';
2236 print
'<tr class="liste_titre"><td class="titlefield">';
2237 print $langs->trans(
"Parameter");
2239 print $langs->trans(
"Value");
2243 print $langs->trans(
"Numero");
2245 print $moduleobj->numero;
2246 print
' (<a href="'.DOL_URL_ROOT.
'/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info" target="_blank" rel="noopener noreferrer">'.$langs->trans(
"SeeIDsInUse").
'</a>';
2247 print
' - <a href="https://wiki.dolibarr.org/index.php/List_of_modules_id" target="_blank" rel="noopener noreferrer external">'.$langs->trans(
"SeeReservedIDsRangeHere").
'</a>)';
2251 print $langs->trans(
"Name");
2253 print $moduleobj->getName();
2257 print $langs->trans(
"Version");
2259 print $moduleobj->getVersion();
2263 print $langs->trans(
"Family");
2266 print $moduleobj->family;
2270 print $langs->trans(
"EditorName");
2272 print $moduleobj->editor_name;
2276 print $langs->trans(
"EditorUrl");
2278 if (!empty($moduleobj->editor_url)) {
2279 print
'<a href="'.$moduleobj->editor_url.
'" class="_blank" rel="noopener">'.$moduleobj->editor_url.
' '.
img_picto(
'',
'globe').
'</a>';
2284 print $langs->trans(
"Picto");
2286 print $moduleobj->picto;
2287 print
' '.img_picto(
'', $moduleobj->picto,
'class="valignmiddle pictomodule paddingrightonly"');
2291 print $langs->trans(
"Description");
2293 print $moduleobj->getDesc();
2298 print $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module).
'<br>';
2301 if (!empty($moduleobj)) {
2307 print
'<!-- readme file -->';
2308 if (
dol_is_file($dirread.
'/'.$pathtofilereadme)) {
2309 print
'<div class="underbanner clearboth"></div><div class="fichecenter">'.$moduleobj->getDescLong().
'</div>';
2311 print
'<span class="opacitymedium">'.$langs->trans(
"ErrorFileNotFound", $pathtofilereadme).
'</span>';
2319 print
'<!-- changelog file -->';
2321 print
'<div class="underbanner clearboth"></div><div class="fichecenter">'.$moduleobj->getChangeLog().
'</div>';
2323 print
'<span class="opacitymedium">'.$langs->trans(
"ErrorFileNotFound", $pathtochangelog).
'</span>';
2331 if ($fullpathoffile) {
2332 $content = file_get_contents($fullpathoffile);
2336 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
2337 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2338 print
'<input type="hidden" name="action" value="savefile">';
2339 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
2340 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
2341 print
'<input type="hidden" name="module" value="'.$module.
'">';
2345 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%',
'');
2346 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
2351 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
2353 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
2362 if ($tab ==
'languages') {
2363 print
'<!-- tab=languages -->'.
"\n";
2364 if ($action !=
'editfile' || empty($file)) {
2365 print
'<span class="opacitymedium">'.$langs->trans(
"LanguageDefDesc").
'</span><br>';
2369 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
2370 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2371 print
'<input type="hidden" name="action" value="addlanguage">';
2372 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
2373 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
2374 print
'<input type="hidden" name="module" value="'.$module.
'">';
2375 print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,
'newlangcode', 0, 0, 1, 0, 0,
'minwidth300', 1);
2376 print
'<input type="submit" name="addlanguage" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans(
"AddLanguageFile")).
'"><br>';
2382 $modulelowercase = strtolower($module);
2386 $diroflang .=
'/langs';
2387 $langfiles =
dol_dir_list($diroflang,
'files', 1,
'\.lang$');
2389 if (!preg_match(
'/custom/', $dirread)) {
2391 $diroflang = $dirread;
2392 $diroflang .=
'/langs';
2393 $langfiles =
dol_dir_list($diroflang,
'files', 1, $modulelowercase.
'\.lang$');
2396 print
'<table class="none">';
2397 foreach ($langfiles as $langfile) {
2398 $pathtofile = $modulelowercase.
'/langs/'.$langfile[
'relativename'];
2399 if (!preg_match(
'/custom/', $dirread)) {
2400 $pathtofile =
'langs/'.$langfile[
'relativename'];
2402 print
'<tr><td><span class="fa fa-file-o"></span> '.$langs->trans(
"LanguageFile").
' '.basename(dirname($pathtofile)).
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
2403 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=ini&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2404 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2415 $content = file_get_contents($fullpathoffile);
2418 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
2419 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2420 print
'<input type="hidden" name="action" value="savefile">';
2421 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
2422 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
2423 print
'<input type="hidden" name="module" value="'.$module.
'">';
2425 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
2426 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'text'));
2429 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
2431 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
2438 if ($tab ==
'objects') {
2439 print
'<!-- tab=objects -->'.
"\n";
2444 $dir = $dirread.
'/'.$modulelowercase.
'/class';
2446 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj=newobject';
2447 $head3[$h][1] =
'<span class="valignmiddle text-plus-circle">'.$langs->trans(
"NewObjectInModulebuilder").
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
2448 $head3[$h][2] =
'newobject';
2452 $listofobject =
dol_dir_list($dir,
'files', 0,
'\.class\.php$');
2454 $firstobjectname =
'';
2455 foreach ($listofobject as $fileobj) {
2456 if (preg_match(
'/^api_/', $fileobj[
'name'])) {
2459 if (preg_match(
'/^actions_/', $fileobj[
'name'])) {
2463 $tmpcontent = file_get_contents($fileobj[
'fullname']);
2464 if (preg_match(
'/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) {
2466 $objectname = $reg[1];
2467 if (empty($firstobjectname)) {
2468 $firstobjectname = $objectname;
2471 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj='.$objectname;
2472 $head3[$h][1] = $objectname;
2473 $head3[$h][2] = $objectname;
2479 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj=deleteobject';
2480 $head3[$h][1] = $langs->trans(
"DangerZone");
2481 $head3[$h][2] =
'deleteobject';
2486 if ($tabobj ==
'newobjectifnoobj') {
2487 if ($firstobjectname) {
2488 $tabobj = $firstobjectname;
2490 $tabobj =
'newobject';
2496 if ($tabobj ==
'newobject') {
2498 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
2499 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2500 print
'<input type="hidden" name="action" value="initobject">';
2501 print
'<input type="hidden" name="tab" value="objects">';
2502 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
2504 print
'<span class="opacitymedium">'.$langs->trans(
"EnterNameOfObjectDesc").
'</span><br><br>';
2506 print
'<input type="text" name="objectname" maxlength="64" value="'.dol_escape_htmltag(
GETPOST(
'objectname',
'alpha') ?
GETPOST(
'objectname',
'alpha') : $modulename).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"ObjectKey")).
'" autofocus><br>';
2507 print
'<input type="checkbox" name="includerefgeneration" id="includerefgeneration" value="includerefgeneration"> <label for="includerefgeneration">'.$form->textwithpicto($langs->trans(
"IncludeRefGeneration"), $langs->trans(
"IncludeRefGenerationHelp")).
'</label><br>';
2508 print
'<input type="checkbox" name="includedocgeneration" id="includedocgeneration" value="includedocgeneration"> <label for="includedocgeneration">'.$form->textwithpicto($langs->trans(
"IncludeDocGeneration"), $langs->trans(
"IncludeDocGenerationHelp")).
'</label><br>';
2509 print
'<input type="submit" class="button smallpaddingimp" name="create" value="'.dol_escape_htmltag($langs->trans(
"Generate")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
2513 print
'<span class="opacitymedium">'.$langs->trans(
"or").
'</span>';
2517 print $langs->trans(
"InitStructureFromExistingTable");
2518 print
'<input type="text" name="initfromtablename" value="" placeholder="'.$langs->trans(
"TableName").
'">';
2519 print
'<input type="submit" class="button smallpaddingimp" name="createtablearray" value="'.dol_escape_htmltag($langs->trans(
"Generate")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
2523 } elseif ($tabobj ==
'deleteobject') {
2525 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
2526 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2527 print
'<input type="hidden" name="action" value="confirm_deleteobject">';
2528 print
'<input type="hidden" name="tab" value="objects">';
2529 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
2531 print $langs->trans(
"EnterNameOfObjectToDeleteDesc").
'<br><br>';
2533 print
'<input type="text" name="objectname" value="'.dol_escape_htmltag($modulename).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"ObjectKey")).
'">';
2534 print
'<input type="submit" class="button smallpaddingimp" name="delete" value="'.dol_escape_htmltag($langs->trans(
"Delete")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
2538 if ($action ==
'deleteproperty') {
2540 $_SERVER[
"PHP_SELF"].
'?propertykey='.urlencode(
GETPOST(
'propertykey',
'alpha')).
'&objectname='.urlencode($objectname).
'&tab='.urlencode($tab).
'&module='.urlencode($module).
'&tabobj='.urlencode($tabobj),
2541 $langs->trans(
'Delete'),
2542 $langs->trans(
'ConfirmDeleteProperty',
GETPOST(
'propertykey',
'alpha')),
2543 'confirm_deleteproperty',
2553 if ($action !=
'editfile' || empty($file)) {
2557 $pathtoclass = strtolower($module).
'/class/'.strtolower($tabobj).
'.class.php';
2558 $pathtoapi = strtolower($module).
'/class/api_'.strtolower($module).
'.class.php';
2559 $pathtoagenda = strtolower($module).
'/'.strtolower($tabobj).
'_agenda.php';
2560 $pathtocard = strtolower($module).
'/'.strtolower($tabobj).
'_card.php';
2561 $pathtodocument = strtolower($module).
'/'.strtolower($tabobj).
'_document.php';
2562 $pathtolist = strtolower($module).
'/'.strtolower($tabobj).
'_list.php';
2563 $pathtonote = strtolower($module).
'/'.strtolower($tabobj).
'_note.php';
2564 $pathtocontact = strtolower($module).
'/'.strtolower($tabobj).
'_contact.php';
2565 $pathtophpunit = strtolower($module).
'/test/phpunit/'.strtolower($tabobj).
'Test.php';
2568 clearstatcache(
true);
2569 if (function_exists(
'opcache_invalidate')) {
2570 opcache_invalidate($dirread.
'/'.$pathtoclass,
true);
2573 if (empty($forceddirread) && empty($dirread)) {
2575 $stringofinclude =
"dol_include_once(".$pathtoclass.
")";
2577 $result = @include_once $dirread.
'/'.$pathtoclass;
2578 $stringofinclude =
"@include_once ".$dirread.
'/'.$pathtoclass;
2580 if (class_exists($tabobj)) {
2582 $tmpobjet = @
new $tabobj($db);
2584 dol_syslog(
'Failed to load Constructor of class: '.$e->getMessage(), LOG_WARNING);
2587 print
'<span class="warning">'.$langs->trans(
'Failed to find the class '.$tabobj.
' despite the '.$stringofinclude).
'</span><br><br>';
2591 $pathtosql = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'-'.strtolower($module).
'.sql';
2594 $pathtosql = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'.sql';
2597 $pathtosql =
'install/mysql/tables/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'-'.strtolower($module).
'.sql';
2600 $pathtosql =
'install/mysql/tables/llx_'.strtolower($module).
'-'.strtolower($module).
'.sql';
2603 $pathtosql =
'install/mysql/tables/llx_'.strtolower($module).
'.sql';
2604 $pathtosqlextra =
'install/mysql/tables/llx_'.strtolower($module).
'_extrafields.sql';
2607 $pathtosqlextra =
'install/mysql/tables/llx_'.strtolower($module).
'_extrafields-'.strtolower($module).
'.sql';
2610 $pathtosqlextra =
'install/mysql/tables/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields-'.strtolower($module).
'.sql';
2613 $pathtosqlextra = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields.sql';
2616 $pathtosqlextra = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields-'.strtolower($module).
'.sql';
2618 $pathtosqlroot = preg_replace(
'/\/llx_.*$/',
'', $pathtosql);
2620 $pathtosqlkey = preg_replace(
'/\.sql$/',
'.key.sql', $pathtosql);
2621 $pathtosqlextrakey = preg_replace(
'/\.sql$/',
'.key.sql', $pathtosqlextra);
2623 $pathtolib = strtolower($module).
'/lib/'.strtolower($module).
'.lib.php';
2624 $pathtoobjlib = strtolower($module).
'/lib/'.strtolower($module).
'_'.strtolower($tabobj).
'.lib.php';
2625 $pathtopicto = strtolower($module).
'/img/object_'.strtolower($tabobj).
'.png';
2629 $realpathtoclass = $dirread.
'/'.$pathtoclass;
2630 $realpathtoapi = $dirread.
'/'.$pathtoapi;
2631 $realpathtoagenda = $dirread.
'/'.$pathtoagenda;
2632 $realpathtocard = $dirread.
'/'.$pathtocard;
2633 $realpathtodocument = $dirread.
'/'.$pathtodocument;
2634 $realpathtolist = $dirread.
'/'.$pathtolist;
2635 $realpathtonote = $dirread.
'/'.$pathtonote;
2636 $realpathtocontact = $dirread.
'/'.$pathtocontact;
2637 $realpathtophpunit = $dirread.
'/'.$pathtophpunit;
2638 $realpathtosql = $dirread.
'/'.$pathtosql;
2639 $realpathtosqlextra = $dirread.
'/'.$pathtosqlextra;
2640 $realpathtosqlkey = $dirread.
'/'.$pathtosqlkey;
2641 $realpathtosqlextrakey = $dirread.
'/'.$pathtosqlextrakey;
2642 $realpathtolib = $dirread.
'/'.$pathtolib;
2643 $realpathtoobjlib = $dirread.
'/'.$pathtoobjlib;
2644 $realpathtopicto = $dirread.
'/'.$pathtopicto;
2646 if (empty($realpathtoapi)) {
2647 $pathtoapi = strtolower($module).
'/class/api_'.strtolower($module).
's.class.php';
2648 $realpathtoapi = $dirread.
'/'.$pathtoapi;
2658 print
'<div class="fichehalfleft smallxxx">';
2660 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>';
2661 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtoclass).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2664 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>';
2666 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtoapi).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2668 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtoapi).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2670 if (empty($conf->global->$const_name)) {
2671 print
'<a href="#" class="classfortooltip" target="apiexplorer" title="'.$langs->trans(
"ModuleMustBeEnabled", $module).
'"><strike>'.$langs->trans(
"GoToApiExplorer").
'</strike></a>';
2673 print
'<a href="'.DOL_URL_ROOT.
'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans(
"GoToApiExplorer").
'</a>';
2676 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initapi&token='.
newToken().
'&format=php&file='.urlencode($pathtoapi).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
2680 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>';
2682 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtophpunit).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2684 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtophpunit).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2686 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initphpunit&token='.
newToken().
'&format=php&file='.urlencode($pathtophpunit).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
2692 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>';
2693 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtolib).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2695 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>';
2696 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtoobjlib).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2698 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>';
2703 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>';
2704 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=sql&file='.urlencode($pathtosql).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2705 print
' <a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=droptable&token='.
newToken().
'">'.$langs->trans(
"DropTableIfEmpty").
'</a>';
2708 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>';
2709 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=sql&file='.urlencode($pathtosqlkey).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2712 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>';
2714 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&file='.urlencode($pathtosqlextra).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2716 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtosqlextra).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2718 print
'<a class="reposition editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=droptableextrafields&token='.
newToken().
'">'.$langs->trans(
"DropTableIfEmpty").
'</a>';
2720 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initsqlextrafields&token='.
newToken().
'&format=sql&file='.urlencode($pathtosqlextra).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
2724 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>';
2726 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=sql&file='.urlencode($pathtosqlextrakey).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2728 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtosqlextrakey).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2730 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initsqlextrafields&token='.
newToken().
'&format=sql&file='.urlencode($pathtosqlextra).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
2735 print
'<div class="fichehalfleft smallxxxx">';
2736 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>';
2737 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtolist).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2739 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>';
2740 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtocard).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2743 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>';
2744 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtocontact).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2747 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtocontact).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2749 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initpagecontact&token='.
newToken().
'&format=php&file='.urlencode($pathtocontact).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
2753 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>';
2754 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtodocument).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2757 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtodocument).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2759 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initpagedocument&token='.
newToken().
'&format=php&file='.urlencode($pathtocontact).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
2763 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>';
2764 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtonote).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2767 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtonote).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2769 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initpagenote&token='.
newToken().
'&format=php&file='.urlencode($pathtocontact).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
2773 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>';
2774 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&format=php&token='.
newToken().
'&file='.urlencode($pathtoagenda).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
2777 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtoagenda).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
2779 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initpageagenda&token='.
newToken().
'&format=php&file='.urlencode($pathtocontact).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
2786 print
'<br><br><br>';
2788 if (!empty($tmpobjet)) {
2789 $reflector =
new ReflectionClass($tabobj);
2790 $reflectorproperties = $reflector->getProperties();
2791 $reflectorpropdefault = $reflector->getDefaultProperties();
2795 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
2796 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2797 print
'<input type="hidden" name="action" value="addproperty">';
2798 print
'<input type="hidden" name="tab" value="objects">';
2799 print
'<input type="hidden" name="page_y" value="">';
2800 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module.($forceddirread ?
'@'.$dirread :
'')).
'">';
2801 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
2803 print
'<input class="button smallpaddingimp" type="submit" name="regenerateclasssql" value="'.$langs->trans(
"RegenerateClassAndSql").
'">';
2808 print
'<!-- Table with properties of object -->'.
"\n";
2809 print
'<div class="div-table-responsive">';
2810 print
'<table class="noborder small">';
2811 print
'<tr class="liste_titre">';
2812 print
'<th class="none">'.$langs->trans(
"Property");
2813 print
' (<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>)';
2816 print
$form->textwithpicto($langs->trans(
"Label"), $langs->trans(
"YouCanUseTranslationKey"));
2818 print
'<th>'.$form->textwithpicto($langs->trans(
"Type"), $langs->trans(
"TypeOfFieldsHelp")).
'</th>';
2819 print
'<th>'.$form->textwithpicto($langs->trans(
"ArrayOfKeyValues"), $langs->trans(
"ArrayOfKeyValuesDesc")).
'</th>';
2820 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"NotNull"), $langs->trans(
"NotNullDesc")).
'</th>';
2821 print
'<th class="center">'.$langs->trans(
"DefaultValue").
'</th>';
2822 print
'<th class="center">'.$langs->trans(
"DatabaseIndex").
'</th>';
2823 print
'<th class="center">'.$langs->trans(
"ForeignKey").
'</th>';
2824 print
'<th class="right">'.$langs->trans(
"Position").
'</th>';
2825 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"Enabled"), $langs->trans(
"EnabledDesc")).
'</th>';
2826 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"Visible"), $langs->trans(
"VisibleDesc")).
'</th>';
2827 print
'<th class="center">'.$langs->trans(
"NotEditable").
'</th>';
2828 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"SearchAll"), $langs->trans(
"SearchAllDesc")).
'</th>';
2829 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"IsAMeasure"), $langs->trans(
"IsAMeasureDesc")).
'</th>';
2830 print
'<th class="center">'.$langs->trans(
"CSSClass").
'</th>';
2831 print
'<th class="center">'.$langs->trans(
"CSSViewClass").
'</th>';
2832 print
'<th class="center">'.$langs->trans(
"CSSListClass").
'</th>';
2833 print
'<th>'.$langs->trans(
"KeyForTooltip").
'</th>';
2834 print
'<th class="center">'.$langs->trans(
"ShowOnCombobox").
'</th>';
2836 print
'<th>'.$form->textwithpicto($langs->trans(
"Validate"), $langs->trans(
"ValidateModBuilderDesc")).
'</th>';
2837 print
'<th>'.$langs->trans(
"Comment").
'</th>';
2838 print
'<th class="none"></th>';
2844 $properties =
dol_sort_array($reflectorpropdefault[
'fields'],
'position');
2846 if (!empty($properties)) {
2849 print
'<td class="none"><input type="text" class="maxwidth75" name="propname" value="'.dol_escape_htmltag(
GETPOST(
'propname',
'alpha')).
'"></td>';
2850 print
'<td><input type="text" class="maxwidth75" name="proplabel" value="'.dol_escape_htmltag(
GETPOST(
'proplabel',
'alpha')).
'"></td>';
2851 print
'<td><input type="text" class="maxwidth75" name="proptype" value="'.dol_escape_htmltag(
GETPOST(
'proptype',
'alpha')).
'"></td>';
2852 print
'<td><input type="text" class="maxwidth75" name="proparrayofkeyval" value="'.dol_escape_htmltag(
GETPOST(
'proparrayofkeyval',
'restricthtml')).
'"></td>';
2853 print
'<td class="center"><input type="text" class="center maxwidth50" name="propnotnull" value="'.dol_escape_htmltag(
GETPOST(
'propnotnull',
'alpha')).
'"></td>';
2854 print
'<td><input type="text" class="center maxwidth50" name="propdefault" value="'.dol_escape_htmltag(
GETPOST(
'propdefault',
'alpha')).
'"></td>';
2855 print
'<td class="center"><input type="text" class="center maxwidth50" name="propindex" value="'.dol_escape_htmltag(
GETPOST(
'propindex',
'alpha')).
'"></td>';
2856 print
'<td class="center"><input type="text" class="maxwidth100" name="propforeignkey" value="'.dol_escape_htmltag(
GETPOST(
'propforeignkey',
'alpha')).
'"></td>';
2857 print
'<td class="right"><input type="text" class="right" size="2" name="propposition" value="'.dol_escape_htmltag(
GETPOST(
'propposition',
'alpha')).
'"></td>';
2858 print
'<td class="center"><input type="text" class="center maxwidth50" name="propenabled" value="'.dol_escape_htmltag(
GETPOST(
'propenabled',
'alpha')).
'"></td>';
2859 print
'<td class="center"><input type="text" class="center maxwidth50" name="propvisible" value="'.dol_escape_htmltag(
GETPOST(
'propvisible',
'alpha')).
'"></td>';
2860 print
'<td class="center"><input type="text" class="center maxwidth50" name="propnoteditable" value="'.dol_escape_htmltag(
GETPOST(
'propnoteditable',
'alpha')).
'"></td>';
2861 print
'<td class="center"><input type="text" class="center maxwidth50" name="propsearchall" value="'.dol_escape_htmltag(
GETPOST(
'propsearchall',
'alpha')).
'"></td>';
2862 print
'<td class="center"><input type="text" class="center maxwidth50" name="propisameasure" value="'.dol_escape_htmltag(
GETPOST(
'propisameasure',
'alpha')).
'"></td>';
2863 print
'<td class="center"><input type="text" class="maxwidth50" name="propcss" value="'.dol_escape_htmltag(
GETPOST(
'propcss',
'alpha')).
'"></td>';
2864 print
'<td class="center"><input type="text" class="maxwidth50" name="propcssview" value="'.dol_escape_htmltag(
GETPOST(
'propcssview',
'alpha')).
'"></td>';
2865 print
'<td class="center"><input type="text" class="maxwidth50" name="propcsslist" value="'.dol_escape_htmltag(
GETPOST(
'propcsslist',
'alpha')).
'"></td>';
2866 print
'<td><input type="text" size="2" name="prophelp" value="'.dol_escape_htmltag(
GETPOST(
'prophelp',
'alpha')).
'"></td>';
2867 print
'<td class="center"><input type="text" class="center maxwidth50" name="propshowoncombobox" value="'.dol_escape_htmltag(
GETPOST(
'propshowoncombobox',
'alpha')).
'"></td>';
2869 print
'<td><input type="number" step="1" min="0" max="1" class="text maxwidth100" name="propvalidate" value="'.dol_escape_htmltag(
GETPOST(
'propvalidate',
'alpha')).
'"></td>';
2870 print
'<td><input class="text maxwidth100" name="propcomment" value="'.dol_escape_htmltag(
GETPOST(
'propcomment',
'alpha')).
'"></td>';
2871 print
'<td class="center tdstickyright tdstickyghostwhite">';
2872 print
'<input type="submit" class="button" name="add" value="'.$langs->trans(
"Add").
'">';
2876 foreach ($properties as $propkey => $propval) {
2891 $propname = $propkey;
2892 $proplabel = $propval[
'label'];
2893 $proptype = $propval[
'type'];
2894 $proparrayofkeyval = !empty($propval[
'arrayofkeyval'])?$propval[
'arrayofkeyval']:
'';
2895 $propnotnull = $propval[
'notnull'];
2896 $propdefault = !empty($propval[
'default'])?$propval[
'default']:
'';
2897 $propindex = !empty($propval[
'index'])?$propval[
'index']:
'';
2898 $propforeignkey = !empty($propval[
'foreignkey'])?$propval[
'foreignkey']:
'';
2899 $propposition = $propval[
'position'];
2900 $propenabled = $propval[
'enabled'];
2901 $propvisible = $propval[
'visible'];
2902 $propnoteditable = !empty($propval[
'noteditable'])?$propval[
'noteditable']:0;
2903 $propsearchall = !empty($propval[
'searchall'])?$propval[
'searchall']:0;
2904 $propisameasure = !empty($propval[
'isameasure'])?$propval[
'isameasure']:0;
2905 $propcss = !empty($propval[
'css'])?$propval[
'css']:
'';
2906 $propcssview = !empty($propval[
'cssview'])?$propval[
'cssview']:
'';
2907 $propcsslist = !empty($propval[
'csslist'])?$propval[
'csslist']:
'';
2908 $prophelp = !empty($propval[
'help'])?$propval[
'help']:
'';
2909 $propshowoncombobox = !empty($propval[
'showoncombobox'])?$propval[
'showoncombobox']:0;
2911 $propvalidate = !empty($propval[
'validate'])?$propval[
'validate']:0;
2912 $propcomment = !empty($propval[
'comment'])?$propval[
'comment']:
'';
2914 print
'<tr class="oddeven">';
2916 print
'<td class="tdsticky tdstickygray">';
2922 if ($action ==
'editproperty' && $propname == $propertykey) {
2923 print
'<td class="tdoverflowmax200">';
2924 print
'<input type="hidden" name="propname" value="'.dol_escape_htmltag($propname).
'">';
2925 print
'<input type="hidden" name="proplabel" value="'.dol_escape_htmltag($proplabel).
'">';
2926 print
'<input name="proptype" value="'.dol_escape_htmltag($proptype).
'"></input>';
2928 print
'<td class="tdoverflowmax200">';
2929 print
'<input name="proparrayofkeyval" value="';
2930 if (isset($proparrayofkeyval)) {
2937 print
'<input class="center width50" name="propnotnull" value="'.dol_escape_htmltag($propnotnull).
'">';
2940 print
'<input class="maxwidth50" name="propdefault" value="'.dol_escape_htmltag($propdefault).
'">';
2942 print
'<td class="center">';
2943 print
'<input class="center maxwidth50" name="propindex" value="'.dol_escape_htmltag($propindex).
'">';
2946 print
'<input class="center" name="propforeignkey" value="'.dol_escape_htmltag($propforeignkey).
'">';
2949 print
'<input class="right width50" name="propposition" value="'.dol_escape_htmltag($propposition).
'">';
2952 print
'<input class="center" name="propenabled" size="2" value="'.dol_escape_htmltag($propenabled).
'">';
2955 print
'<input class="center" name="propvisible" size="2" value="'.dol_escape_htmltag($propvisible).
'">';
2958 print
'<input class="center" name="propnoteditable" size="2" value="'.dol_escape_htmltag($propnoteditable).
'">';
2961 print
'<input class="center" name="propsearchall" size="2" value="'.dol_escape_htmltag($propsearchall).
'">';
2964 print
'<input class="center" name="propisameasure" size="2" value="'.dol_escape_htmltag($propisameasure).
'">';
2967 print
'<input class="center maxwidth50" name="propcss" value="'.dol_escape_htmltag($propcss).
'">';
2970 print
'<input class="center maxwidth50" name="propcssview" value="'.dol_escape_htmltag($propcssview).
'">';
2973 print
'<input class="center maxwidth50" name="propcsslist" value="'.dol_escape_htmltag($propcsslist).
'">';
2976 print
'<input class="maxwidth100" name="prophelp" value="'.dol_escape_htmltag($prophelp).
'">';
2979 print
'<input class="center maxwidth50" name="propshowoncombobox" value="'.dol_escape_htmltag($propshowoncombobox).
'">';
2982 print
'<input type="number" step="1" min="0" max="1" class="text maxwidth100" name="propvalidate" value="'.dol_escape_htmltag($propvalidate).
'">';
2985 print
'<input class="maxwidth100" name="propcomment" value="'.dol_escape_htmltag($propcomment).
'">';
2987 print
'<td class="center tdstickyright tdstickyghostwhite">';
2988 print
'<input class="reposition button smallpaddingimp" type="submit" name="edit" value="'.$langs->trans(
"Save").
'">';
2989 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
2992 print
'<td class="tdoverflowmax200">';
2993 print
'<span title="'.dol_escape_htmltag($proptype).
'">'.
dol_escape_htmltag($proptype).
'</span>';
2995 print
'<td class="tdoverflowmax200">';
2996 if ($proparrayofkeyval) {
2997 print
'<span title="'.dol_escape_htmltag(json_encode($proparrayofkeyval, JSON_UNESCAPED_UNICODE)).
'">';
3002 print
'<td class="center">';
3008 print
'<td class="center">';
3009 print $propindex ?
'1' :
'';
3011 print
'<td class="center">';
3014 print
'<td class="right">';
3017 print
'<td class="center">';
3020 print
'<td class="center">';
3023 print
'<td class="center">';
3026 print
'<td class="center">';
3027 print $propsearchall ?
'1' :
'';
3029 print
'<td class="center">';
3032 print
'<td class="center">';
3035 print
'<td class="center">';
3038 print
'<td class="center">';
3041 print
'<td class="tdoverflowmax200">';
3044 print
'<td class="center">';
3050 print
'<td class="center">';
3053 print
'<td class="tdoverflowmax200">';
3054 print
'<span title="'.dol_escape_htmltag($propcomment).
'">';
3058 print
'<td class="center tdstickyright tdstickyghostwhite">';
3059 if ($propname !=
'rowid') {
3060 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>';
3061 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>';
3068 if ($tab ==
'specifications') {
3069 if ($action !=
'editfile' || empty($file)) {
3070 print
'<span class="opacitymedium">'.$langs->trans(
"SpecDefDesc").
'</span><br>';
3075 foreach ($specs as $spec) {
3076 $pathtofile = $modulelowercase.
'/doc/'.$spec[
'relativename'];
3077 $format =
'asciidoc';
3078 if (preg_match(
'/\.md$/i', $spec[
'name'])) {
3079 $format =
'markdown';
3081 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"SpecificationFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3082 print
' <a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3092 $content = file_get_contents($fullpathoffile);
3095 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3096 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3097 print
'<input type="hidden" name="action" value="savefile">';
3098 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3099 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3100 print
'<input type="hidden" name="module" value="'.$module.
'">';
3102 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3103 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3106 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3108 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3114 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>';
3121 print
'<span class="warning">'.$langs->trans(
'Failed to init the object with the new '.$tabobj.
'($db)').
'</warning>';
3124 print $e->getMessage();
3127 if (empty($forceddirread)) {
3130 $fullpathoffile = $dirread.
'/'.$file;
3133 $content = file_get_contents($fullpathoffile);
3136 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3137 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3138 print
'<input type="hidden" name="action" value="savefile">';
3139 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3140 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3141 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
3142 print
'<input type="hidden" name="module" value="'.$module.($forceddirread ?
'@'.$dirread :
'').
'">';
3144 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3145 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3148 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3150 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3160 if ($tab ==
'dictionaries') {
3161 print
'<!-- tab=dictionaries -->'.
"\n";
3162 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3164 $dicts = $moduleobj->dictionaries;
3166 if ($action !=
'editfile' || empty($file)) {
3167 print
'<span class="opacitymedium">';
3168 $htmlhelp = $langs->trans(
"DictionariesDefDescTooltip",
'{s1}');
3169 $htmlhelp = str_replace(
'{s1}',
'<a target="adminbis" class="nofocusvisible" href="'.DOL_URL_ROOT.
'/admin/dict.php">'.$langs->trans(
'Setup').
' - '.$langs->trans(
'Dictionaries').
'</a>', $htmlhelp);
3170 print
$form->textwithpicto($langs->trans(
"DictionariesDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
3174 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3175 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3177 if (is_array($dicts) && !empty($dicts)) {
3178 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"LanguageFile").
' :</span> ';
3179 print
'<strong class="wordbreak">'.$dicts[
'langs'].
'</strong>';
3183 print
'<!-- tab=objects -->'.
"\n";
3190 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabdic=newdictionary';
3191 $head3[$h][1] =
'<span class="valignmiddle text-plus-circle">'.$langs->trans(
"NewDictionary").
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
3192 $head3[$h][2] =
'newdictionary';
3199 foreach ($dicts[
'tabname'] as $key => $dic) {
3201 $diclabel = $dicts[
'tablib'][$key];
3203 if (empty($firstdicname)) {
3204 $firstdicname = $dicname;
3207 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabdic='.$dicname;
3208 $head3[$h][1] = $diclabel;
3209 $head3[$h][2] = $dicname;
3214 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabdic=deletedictionary';
3215 $head3[$h][1] = $langs->trans(
"DangerZone");
3216 $head3[$h][2] =
'deletedictionary';
3221 if ($tabdic ==
'newdicifnodic') {
3222 if ($firstdicname) {
3223 $tabdic = $firstdicname;
3225 $tabdic =
'newdictionary';
3229 print
load_fiche_titre($langs->trans(
"ListOfDictionariesEntries"),
'',
'');
3231 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3232 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3233 print
'<input type="hidden" name="action" value="addproperty">';
3234 print
'<input type="hidden" name="tab" value="dictionaries">';
3235 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
3236 print
'<input type="hidden" name="tabdic" value="'.dol_escape_htmltag($tabdic).
'">';
3238 print
'<div class="div-table-responsive">';
3239 print
'<table class="noborder">';
3241 print
'<tr class="liste_titre">';
3242 print_liste_field_titre(
"#", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'thsticky thstickygrey ');
3254 if (!empty($dicts) && is_array($dicts) && !empty($dicts[
'tabname']) && is_array($dicts[
'tabname'])) {
3256 $maxi = count($dicts[
'tabname']);
3257 while ($i < $maxi) {
3258 print
'<tr class="oddeven">';
3260 print
'<td class="tdsticky tdstickygray">';
3265 print $dicts[
'tabname'][$i];
3269 print $dicts[
'tablib'][$i];
3273 print $dicts[
'tabsql'][$i];
3277 print $dicts[
'tabsqlsort'][$i];
3281 print $dicts[
'tabfield'][$i];
3285 print $dicts[
'tabfieldvalue'][$i];
3289 print $dicts[
'tabfieldinsert'][$i];
3292 print
'<td class="right">';
3293 print $dicts[
'tabrowid'][$i];
3296 print
'<td class="right">';
3297 print $dicts[
'tabcond'][$i];
3304 print
'<tr><td colspan="10"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
3314 if ($tabdic ==
'newdictionary') {
3316 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3317 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3318 print
'<input type="hidden" name="action" value="initdic">';
3319 print
'<input type="hidden" name="tab" value="dictionaries">';
3320 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
3322 print
'<span class="opacitymedium">'.$langs->trans(
"EnterNameOfDictionaryDesc").
'</span><br><br>';
3324 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>';
3327 print
'<input type="submit" class="button smallpaddingimp" name="create" value="'.dol_escape_htmltag($langs->trans(
"Generate")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
3341 } elseif ($tabdic ==
'deletedictionary') {
3343 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3344 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3345 print
'<input type="hidden" name="action" value="confirm_deleteobject">';
3346 print
'<input type="hidden" name="tab" value="dictionaries">';
3347 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
3349 print $langs->trans(
"EnterNameOfObjectToDeleteDesc").
'<br><br>';
3351 print
'<input type="text" name="objectname" value="'.dol_escape_htmltag($modulename).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"ObjectKey")).
'">';
3352 print
'<input type="submit" class="button smallpaddingimp" name="delete" value="'.dol_escape_htmltag($langs->trans(
"Delete")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
3355 print $langs->trans(
"FeatureNotYetAvailable");
3362 $content = file_get_contents($fullpathoffile);
3365 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3366 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3367 print
'<input type="hidden" name="action" value="savefile">';
3368 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3369 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3370 print
'<input type="hidden" name="module" value="'.$module.
'">';
3372 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3373 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3376 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3378 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3385 if ($tab ==
'menus') {
3386 print
'<!-- tab=menus -->'.
"\n";
3387 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3389 $menus = $moduleobj->menu;
3391 if ($action !=
'editfile' || empty($file)) {
3392 print
'<span class="opacitymedium">';
3393 $htmlhelp = $langs->trans(
"MenusDefDescTooltip",
'{s1}');
3394 $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);
3395 print
$form->textwithpicto($langs->trans(
"MenusDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
3399 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3400 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3406 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3407 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3408 print
'<input type="hidden" name="action" value="addproperty">';
3409 print
'<input type="hidden" name="tab" value="objects">';
3410 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
3411 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
3413 print
'<div class="div-table-responsive">';
3414 print
'<table class="noborder small">';
3416 print
'<tr class="liste_titre">';
3419 print_liste_field_titre(
"LinkToParentMenu", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder);
3425 print_liste_field_titre(
"Position", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'right ');
3426 print_liste_field_titre(
"Enabled", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'center ');
3429 print_liste_field_titre(
"UserType", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'right ');
3432 if (count($menus)) {
3434 foreach ($menus as $menu) {
3437 print
'<tr class="oddeven">';
3439 print
'<td class="tdsticky tdstickygray">';
3463 print
'<td class="tdoverflowmax300" title="'.dol_escape_htmltag($menu[
'url']).
'">';
3471 print
'<td class="right">';
3475 print
'<td class="center tdoverflowmax200" title="'.dol_escape_htmltag($menu[
'enabled']).
'">';
3479 print
'<td class="center tdoverflowmax200" title="'.dol_escape_htmltag($menu[
'perms']).
'">';
3487 print
'<td class="right">';
3494 print
'<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
3504 $content = file_get_contents($fullpathoffile);
3507 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3508 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3509 print
'<input type="hidden" name="action" value="savefile">';
3510 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3511 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3512 print
'<input type="hidden" name="module" value="'.$module.
'">';
3514 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3515 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3518 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3520 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3527 if ($tab ==
'permissions') {
3528 print
'<!-- tab=permissions -->'.
"\n";
3529 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3531 $perms = $moduleobj->rights;
3533 if ($action !=
'editfile' || empty($file)) {
3534 print
'<span class="opacitymedium">';
3535 $htmlhelp = $langs->trans(
"PermissionsDefDescTooltip",
'{s1}');
3536 $htmlhelp = str_replace(
'{s1}',
'<a target="adminbis" class="nofocusvisible" href="'.DOL_URL_ROOT.
'/admin/perms.php">'.$langs->trans(
'DefaultRights').
'</a>', $htmlhelp);
3537 print
$form->textwithpicto($langs->trans(
"PermissionsDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
3541 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3542 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3548 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3549 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3550 print
'<input type="hidden" name="action" value="addproperty">';
3551 print
'<input type="hidden" name="tab" value="objects">';
3552 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
3553 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
3555 print
'<div class="div-table-responsive">';
3556 print
'<table class="noborder">';
3558 print
'<tr class="liste_titre">';
3565 if (count($perms)) {
3566 foreach ($perms as $perm) {
3567 print
'<tr class="oddeven">';
3574 print $langs->trans($perm[1]);
3588 print
'<tr><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
3598 $content = file_get_contents($fullpathoffile);
3601 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3602 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3603 print
'<input type="hidden" name="action" value="savefile">';
3604 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3605 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3606 print
'<input type="hidden" name="module" value="'.$module.
'">';
3608 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3609 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3612 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3614 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3621 if ($tab ==
'hooks') {
3622 print
'<!-- tab=hooks -->'.
"\n";
3623 if ($action !=
'editfile' || empty($file)) {
3624 print
'<span class="opacitymedium">'.$langs->trans(
"HooksDefDesc").
'</span><br>';
3629 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3631 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3633 print
'<a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3637 $pathtohook = strtolower($module).
'/class/actions_'.strtolower($module).
'.class.php';
3638 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"HooksFile").
' : ';
3640 print
'<strong class="wordbreak">'.$pathtohook.
'</strong>';
3642 print
'<td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a> ';
3643 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
3645 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
3646 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=inithook&format=php&file='.urlencode($pathtohook).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</td>';
3653 $content = file_get_contents($fullpathoffile);
3656 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3657 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3658 print
'<input type="hidden" name="action" value="savefile">';
3659 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3660 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3661 print
'<input type="hidden" name="module" value="'.$module.
'">';
3663 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3664 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3667 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3669 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3676 if ($tab ==
'triggers') {
3677 print
'<!-- tab=triggers -->'.
"\n";
3678 require_once DOL_DOCUMENT_ROOT.
'/core/class/interfaces.class.php';
3681 $triggers = $interfaces->getTriggersList(array(
'/'.strtolower($module).
'/core/triggers'));
3683 if ($action !=
'editfile' || empty($file)) {
3684 print
'<span class="opacitymedium">'.$langs->trans(
"TriggerDefDesc").
'</span><br>';
3689 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3691 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3693 print
'<a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3696 if (!empty($triggers)) {
3697 foreach ($triggers as $trigger) {
3698 $pathtofile = $trigger[
'relpath'];
3701 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"TriggersFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3702 print
'</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a></td>';
3703 print
'<td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
3708 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"TriggersFile");
3709 print
' : <span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
3710 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=inittrigger&format=php">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a></td>';
3719 $content = file_get_contents($fullpathoffile);
3722 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3723 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3724 print
'<input type="hidden" name="action" value="savefile">';
3725 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3726 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3727 print
'<input type="hidden" name="module" value="'.$module.
'">';
3729 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3730 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3733 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3735 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3742 if ($tab ==
'css') {
3743 print
'<!-- tab=css -->'.
"\n";
3744 if ($action !=
'editfile' || empty($file)) {
3745 print
'<span class="opacitymedium">'.$langs->trans(
"CSSDesc").
'</span><br>';
3751 $pathtohook = strtolower($module).
'/css/'.strtolower($module).
'.css.php';
3752 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"CSSFile").
' : ';
3754 print
'<strong class="wordbreak">'.$pathtohook.
'</strong>';
3755 print
'</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a></td>';
3756 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
3758 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
3759 print
'</td><td><a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initcss&format=php&file='.urlencode($pathtohook).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a></td>';
3765 $content = file_get_contents($fullpathoffile);
3768 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3769 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3770 print
'<input type="hidden" name="action" value="savefile">';
3771 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3772 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3773 print
'<input type="hidden" name="module" value="'.$module.
'">';
3775 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3776 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3779 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3781 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3789 print
'<!-- tab=js -->'.
"\n";
3790 if ($action !=
'editfile' || empty($file)) {
3791 print
'<span class="opacitymedium">'.$langs->trans(
"JSDesc").
'</span><br>';
3797 $pathtohook = strtolower($module).
'/js/'.strtolower($module).
'.js.php';
3798 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"JSFile").
' : ';
3800 print
'<strong class="wordbreak">'.$pathtohook.
'</strong>';
3801 print
'</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a></td>';
3802 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
3804 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
3805 print
'</td><td><a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initjs&token='.
newToken().
'&format=php&file='.urlencode($pathtohook).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a></td>';
3811 $content = file_get_contents($fullpathoffile);
3814 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3815 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3816 print
'<input type="hidden" name="action" value="savefile">';
3817 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3818 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3819 print
'<input type="hidden" name="module" value="'.$module.
'">';
3821 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3822 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3825 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3827 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3834 if ($tab ==
'widgets') {
3835 print
'<!-- tab=widgets -->'.
"\n";
3836 require_once DOL_DOCUMENT_ROOT.
'/core/boxes/modules_boxes.php';
3840 if ($action !=
'editfile' || empty($file)) {
3841 print
'<span class="opacitymedium">'.$langs->trans(
"WidgetDesc").
'</span><br>';
3845 if (!empty($widgets)) {
3846 foreach ($widgets as $widget) {
3847 $pathtofile = $widget[
'relpath'];
3849 print
'<tr><td><span class="fa fa-file-o"></span> '.$langs->trans(
"WidgetFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3850 print
'</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3851 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
3855 print
'<tr><td><span class="fa fa-file-o"></span> '.$langs->trans(
"WidgetFile").
' : <span class="opacitymedium">'.$langs->trans(
"NoWidget").
'</span>';
3856 print
'</td><td><a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initwidget&token='.
newToken().
'&format=php">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
3863 $content = file_get_contents($fullpathoffile);
3866 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3867 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3868 print
'<input type="hidden" name="action" value="savefile">';
3869 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3870 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3871 print
'<input type="hidden" name="module" value="'.$module.
'">';
3873 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3874 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3877 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3879 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3886 if ($tab ==
'exportimport') {
3887 print
'<!-- tab=exportimport -->'.
"\n";
3888 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3890 $exportlist = $moduleobj->export_label;
3891 $importlist = $moduleobj->import_label;
3893 if ($action !=
'editfile' || empty($file)) {
3894 print
'<span class="opacitymedium">'.$langs->transnoentities(
'ImportExportProfiles').
'</span><br>';
3897 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3898 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3903 $content = file_get_contents($fullpathoffile);
3906 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3907 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3908 print
'<input type="hidden" name="action" value="savefile">';
3909 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3910 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3911 print
'<input type="hidden" name="module" value="'.$module.
'">';
3913 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3914 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3917 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3919 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3926 if ($tab ==
'cli') {
3927 print
'<!-- tab=cli -->'.
"\n";
3928 $clifiles = array();
3931 $dircli = array(
'/'.strtolower($module).
'/scripts');
3933 foreach ($dircli as $reldir) {
3938 if (!is_dir($newdir)) {
3942 $handle = opendir($newdir);
3943 if (is_resource($handle)) {
3944 while (($tmpfile = readdir($handle)) !==
false) {
3945 if (is_readable($newdir.
'/'.$file) && preg_match(
'/^(.+)\.php/', $tmpfile, $reg)) {
3946 if (preg_match(
'/\.back$/', $tmpfile)) {
3950 $clifiles[$i][
'relpath'] = preg_replace(
'/^\//',
'', $reldir).
'/'.$tmpfile;
3959 if ($action !=
'editfile' || empty($file)) {
3960 print
'<span class="opacitymedium">'.$langs->trans(
"CLIDesc").
'</span><br>';
3964 if (!empty($clifiles)) {
3965 foreach ($clifiles as $clifile) {
3966 $pathtofile = $clifile[
'relpath'];
3968 print
'<tr><td><span class="fa fa-file-o"></span> '.$langs->trans(
"CLIFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3969 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a></td>';
3970 print
'<td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
3974 print
'<tr><td><span class="fa fa-file-o"></span> '.$langs->trans(
"CLIFile").
' : <span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated");
'</span>';
3975 print
'</td><td><a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initcli&token='.
newToken().
'&format=php">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
3982 $content = file_get_contents($fullpathoffile);
3985 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3986 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3987 print
'<input type="hidden" name="action" value="savefile">';
3988 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3989 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3990 print
'<input type="hidden" name="module" value="'.$module.
'">';
3992 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3993 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3996 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3998 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4005 if ($tab ==
'cron') {
4006 print
'<!-- tab=cron -->'.
"\n";
4007 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
4009 $cronjobs = $moduleobj->cronjobs;
4011 if ($action !=
'editfile' || empty($file)) {
4012 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>';
4015 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
4016 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4022 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4023 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4024 print
'<input type="hidden" name="action" value="addproperty">';
4025 print
'<input type="hidden" name="tab" value="objects">';
4026 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4027 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
4029 print
'<div class="div-table-responsive">';
4030 print
'<table class="noborder">';
4032 print
'<tr class="liste_titre">';
4040 if (count($cronjobs)) {
4041 foreach ($cronjobs as $cron) {
4042 print
'<tr class="oddeven">';
4045 print $cron[
'label'];
4049 if ($cron[
'jobtype'] ==
'method') {
4050 $text = $langs->trans(
"CronClass");
4051 $texttoshow = $langs->trans(
'CronModule').
': '.$module.
'<br>';
4052 $texttoshow .= $langs->trans(
'CronClass').
': '.$cron[
'class'].
'<br>';
4053 $texttoshow .= $langs->trans(
'CronObject').
': '.$cron[
'objectname'].
'<br>';
4054 $texttoshow .= $langs->trans(
'CronMethod').
': '.$cron[
'method'];
4055 $texttoshow .=
'<br>'.$langs->trans(
'CronArgs').
': '.$cron[
'parameters'];
4056 $texttoshow .=
'<br>'.$langs->trans(
'Comment').
': '.$langs->trans($cron[
'comment']);
4057 } elseif ($cron[
'jobtype'] ==
'command') {
4058 $text = $langs->trans(
'CronCommand');
4059 $texttoshow = $langs->trans(
'CronCommand').
': '.
dol_trunc($cron[
'command']);
4060 $texttoshow .=
'<br>'.$langs->trans(
'CronArgs').
': '.$cron[
'parameters'];
4061 $texttoshow .=
'<br>'.$langs->trans(
'Comment').
': '.$langs->trans($cron[
'comment']);
4063 print
$form->textwithpicto($text, $texttoshow, 1);
4067 if ($cron[
'unitfrequency'] ==
"60") {
4068 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Minutes');
4070 if ($cron[
'unitfrequency'] ==
"3600") {
4071 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Hours');
4073 if ($cron[
'unitfrequency'] ==
"86400") {
4074 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Days');
4076 if ($cron[
'unitfrequency'] ==
"604800") {
4077 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Weeks');
4082 print $cron[
'status'];
4086 if (!empty($cron[
'comment'])) {
4087 print $cron[
'comment'];
4094 print
'<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
4104 $content = file_get_contents($fullpathoffile);
4107 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4108 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4109 print
'<input type="hidden" name="action" value="savefile">';
4110 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4111 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4112 print
'<input type="hidden" name="module" value="'.$module.
'">';
4114 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
4115 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
4118 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
4120 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4127 if ($tab ==
'specifications') {
4128 print
'<!-- tab=specifications -->'.
"\n";
4131 if ($action !=
'editfile' || empty($file)) {
4132 print
'<span class="opacitymedium">'.$langs->trans(
"SpecDefDesc").
'</span><br>';
4136 if (is_array($specs) && !empty($specs)) {
4137 foreach ($specs as $spec) {
4138 $pathtofile = $modulelowercase.
'/doc/'.$spec[
'relativename'];
4139 $format =
'asciidoc';
4140 if (preg_match(
'/\.md$/i', $spec[
'name'])) {
4141 $format =
'markdown';
4144 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"SpecificationFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
4145 print
'</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a></td>';
4146 print
'<td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
4151 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"SpecificationFile").
' : <span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
4152 print
'</td><td><a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initdoc&token='.
newToken().
'&format=php">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a></td>';
4163 $content = file_get_contents($fullpathoffile);
4166 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4167 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4168 print
'<input type="hidden" name="action" value="savefile">';
4169 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4170 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4171 print
'<input type="hidden" name="module" value="'.$module.
'">';
4173 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
4174 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
4177 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
4179 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4185 print
'<br><br><br>';
4187 $FILENAMEDOC = $modulelowercase.
'.html';
4188 $FILENAMEDOCPDF = $modulelowercase.
'.pdf';
4189 $outputfiledoc =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOC;
4190 $outputfiledocurl =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOC;
4191 $outputfiledocrel = $modulelowercase.
'/doc/'.$FILENAMEDOC;
4192 $outputfiledocpdf =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOCPDF;
4193 $outputfiledocurlpdf =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOCPDF;
4194 $outputfiledocrelpdf = $modulelowercase.
'/doc/'.$FILENAMEDOCPDF;
4197 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"PathToModuleDocumentation",
"HTML").
' : ';
4199 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
4202 print
'<a href="'.$outputfiledocurl.
'" target="_blank" rel="noopener noreferrer">';
4203 print $outputfiledoc;
4206 print
' <span class="opacitymedium">('.$langs->trans(
"GeneratedOn").
' '.
dol_print_date(
dol_filemtime($outputfiledoc),
'dayhour').
')</span>';
4207 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($outputfiledocrel).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
4209 print
'</strong><br>';
4212 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"PathToModuleDocumentation",
"PDF").
' : ';
4214 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
4217 print
'<a href="'.$outputfiledocurlpdf.
'" target="_blank" rel="noopener noreferrer">';
4218 print $outputfiledocpdf;
4221 print
' <span class="opacitymedium">('.$langs->trans(
"GeneratedOn").
' '.
dol_print_date(
dol_filemtime($outputfiledocpdf),
'dayhour').
')</span>';
4222 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($outputfiledocpdfrel).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
4224 print
'</strong><br>';
4228 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="generatedoc">';
4229 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4230 print
'<input type="hidden" name="action" value="generatedoc">';
4231 print
'<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).
'">';
4232 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4233 print
'<input type="submit" class="button" name="generatedoc" value="'.$langs->trans(
"BuildDocumentation").
'"';
4234 if (!is_array($specs) || empty($specs)) {
4235 print
' disabled="disabled"';
4241 if ($tab ==
'buildpackage') {
4242 print
'<!-- tab=buildpackage -->'.
"\n";
4243 print
'<span class="opacitymedium">'.$langs->trans(
"BuildPackageDesc").
'</span>';
4246 if (!class_exists(
'ZipArchive') && !defined(
'ODTPHP_PATHTOPCLZIP')) {
4247 print
img_warning().
' '.$langs->trans(
"ErrNoZipEngine");
4251 $modulelowercase = strtolower($module);
4257 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
4259 $class =
'mod'.$module;
4261 if (class_exists($class)) {
4263 $moduleobj =
new $class($db);
4270 $langs->load(
"errors");
4271 dol_print_error($db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
4275 $arrayversion = explode(
'.', $moduleobj->version, 3);
4276 if (count($arrayversion)) {
4277 $FILENAMEZIP =
"module_".$modulelowercase.
'-'.$arrayversion[0].(empty($arrayversion[1]) ?
'.0' :
'.'.$arrayversion[1]).($arrayversion[2] ?
".".$arrayversion[2] :
'').
".zip";
4278 $outputfilezip =
dol_buildpath($modulelowercase, 0).
'/bin/'.$FILENAMEZIP;
4283 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"PathToModulePackage").
' : ';
4285 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
4287 $relativepath = $modulelowercase.
'/bin/'.$FILENAMEZIP;
4288 print
'<strong><a href="'.DOL_URL_ROOT.
'/document.php?modulepart=packages&file='.urlencode($relativepath).
'">'.$outputfilezip.
'</a></strong>';
4289 print
' <span class="opacitymedium">('.$langs->trans(
"GeneratedOn").
' '.
dol_print_date(
dol_filemtime($outputfilezip),
'dayhour').
')</span>';
4290 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($relativepath).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
4298 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="generatepackage">';
4299 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4300 print
'<input type="hidden" name="action" value="generatepackage">';
4301 print
'<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).
'">';
4302 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4303 print
'<input type="submit" class="button" name="generatepackage" value="'.$langs->trans(
"BuildPackage").
'">';
4307 if ($tab ==
'tabs') {
4308 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
4310 $tabs = $moduleobj->tabs;
4312 if ($action !=
'editfile' || empty($file)) {
4313 print
'<span class="opacitymedium">';
4314 $htmlhelp = $langs->trans(
"TabsDefDescTooltip",
'{s1}');
4315 $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);
4316 print
$form->textwithpicto($langs->trans(
"TabsDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
4320 print
'<span class="fa fa-file-o"></span> '.$langs->trans(
"DescriptorFile").
' : <strong>'.$pathtofile.
'</strong>';
4321 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.$tab.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4327 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4328 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4329 print
'<input type="hidden" name="action" value="addproperty">';
4330 print
'<input type="hidden" name="tab" value="objects">';
4331 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4332 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
4334 print
'<div class="div-table-responsive">';
4335 print
'<table class="noborder small">';
4337 print
'<tr class="liste_titre">';
4347 foreach ($tabs as $tab) {
4348 $parts = explode(
':', $tab[
'data']);
4350 $objectType = $parts[0];
4351 $tabName = $parts[1];
4352 $tabTitle = isset($parts[2]) ? $parts[2] :
'';
4353 $langFile = isset($parts[3]) ? $parts[3] :
'';
4354 $condition = isset($parts[4]) ? $parts[4] :
'';
4355 $path = isset($parts[5]) ? $parts[5] :
'';
4359 if ($tabName[0] ===
'-') {
4361 $condition = isset($parts[2]) ? $parts[2] :
'';
4364 print
'<tr class="oddeven">';
4371 if ($tabName[0] ===
"+") {
4372 print
'<span class="badge badge-status4 badge-status">' .
dol_escape_htmltag($tabName) .
'</span>';
4374 print
'<span class="badge badge-status8 badge-status">' .
dol_escape_htmltag($tabName) .
'</span>';
4397 print
'<tr><td class="opacitymedium" colspan="5">'.$langs->trans(
"None").
'</td></tr>';
4407 $content = file_get_contents($fullpathoffile);
4410 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4411 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4412 print
'<input type="hidden" name="action" value="savefile">';
4413 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4414 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4415 print
'<input type="hidden" name="module" value="'.$module.
'">';
4417 $doleditor =
new DolEditor(
'editfilecontent', $content,
'',
'300',
'Full',
'In',
true,
false,
'ace', 0,
'99%');
4418 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
4421 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
4423 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4430 if ($tab !=
'description') {