250 $licInfo = $user->getFullName($langs);
251 $emailTabs = str_repeat(
"\t", (
int) (max(0, (31 - mb_strlen($licInfo)) / 4)));
252 $licInfo .= ($user->email ? $emailTabs.
'<'.$user->email.
'>' :
'');
261if ($dirins && $action ==
'initmodule' && $modulename && $user->hasRight(
"modulebuilder",
"run")) {
262 $modulename = ucfirst($modulename);
263 $destdir =
'/not_set/';
265 if (preg_match(
'/[^a-z0-9_]/i', $modulename)) {
267 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
271 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
272 $destdir = $dirins.
'/'.strtolower($modulename);
274 $arrayreplacement = array(
275 'mymodule' => strtolower($modulename),
276 'MyModule' => $modulename
278 $result =
dolCopyDir($srcdir, $destdir,
'0', 0, $arrayreplacement);
283 $langs->load(
"errors");
284 setEventMessages($langs->trans(
"ErrorFailToCopyDir", $srcdir, $destdir),
null,
'errors');
287 setEventMessages($langs->trans(
"AllFilesDidAlreadyExist", $srcdir, $destdir),
null,
'warnings');
293 $tryToCopyFromSetupClass =
true;
294 $backportDest = $destdir .
'/backport/v16/core/class';
295 $backportFileSrc = DOL_DOCUMENT_ROOT.
'/core/class/html.formsetup.class.php';
296 $backportFileDest = $backportDest.
'/html.formsetup.class.php';
301 $langs->load(
"errors");
302 setEventMessages($langs->trans(
"ErrorFailToCreateDir", $backportDest),
null,
'errors');
303 $tryToCopyFromSetupClass =
false;
306 if ($tryToCopyFromSetupClass) {
307 $result =
dol_copy($backportFileSrc, $backportFileDest);
311 $langs->load(
"errors");
312 setEventMessages($langs->trans(
"ErrorFailToCopyFile", $backportFileSrc, $backportFileDest),
null,
'errors');
314 setEventMessages($langs->trans(
"FileDidAlreadyExist", $backportFileDest),
null,
'warnings');
337 dol_delete_file($destdir.
'/class/actions_'.strtolower($modulename).
'.class.php');
338 dol_delete_file($destdir.
'/class/api_'.strtolower($modulename).
'.class.php');
356 dol_delete_file($destdir.
'/lib/'.strtolower($modulename).
'_myobject.lib.php');
357 dol_delete_file($destdir.
'/test/phpunit/functional/'.$modulename.
'FunctionalTest.php');
359 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject.sql');
360 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject_extrafields.sql');
361 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject.key.sql');
362 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject_extrafields.key.sql');
377 $listofphpfilestoedit =
dol_dir_list($destdir,
'files', 1,
'\.(php|MD|js|sql|txt|xml|lang)$',
'',
'fullname', SORT_ASC, 0, 1);
380 foreach ($listofphpfilestoedit as $phpfileval) {
382 $arrayreplacement = array(
383 'mymodule' => strtolower($modulename),
384 'MyModule' => $modulename,
385 'MYMODULE' => strtoupper($modulename),
386 'My module' => $modulename,
387 'my module' => $modulename,
388 'Mon module' => $modulename,
389 'mon module' => $modulename,
390 'htdocs/modulebuilder/template' => strtolower($modulename),
391 '---Put here your own copyright and developer email---' => $licInfo,
392 '---Replace with your own copyright and developer email---' => $licInfo,
393 'Editor name' => $editorname,
394 'https://www.example.com' => $editorurl,
395 '$this->version = \'1.0\'' =>
'$this->version = \''.$version.
'\'',
396 '$this->picto = \'generic\';' => (empty($picto)) ?
'$this->picto = \'generic\'' :
'$this->picto = \''.$picto.
'\';',
397 "modulefamily" => $family,
398 '500000' => $idmodule
402 $arrayreplacement[
'---Replace with your own copyright and developer email---'] =
dol_print_date($now,
'%Y').
"\t\t" .
getDolGlobalString(
'MODULEBUILDER_SPECIFIC_AUTHOR');
409 setEventMessages($langs->trans(
"ErrorFailToMakeReplacementInto", $phpfileval[
'fullname']),
null,
'errors');
414 setEventMessages($langs->trans(
"ContentOfREADMECustomized"),
null,
'warnings');
416 file_put_contents($destdir.
'/README.md', $conf->global->MODULEBUILDER_SPECIFIC_README);
427 $module = $modulename;
429 clearstatcache(
true);
430 if (function_exists(
'opcache_invalidate')) {
434 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?module='.$modulename);
439$destdir =
'/not_set/';
440$destfile =
'/not_set/';
441$srcfile =
'/not_set/';
444if ($dirins && in_array($action, array(
'initapi',
'initphpunit',
'initpagecontact',
'initpagedocument',
'initpagenote',
'initpageagenda')) && !empty($module) && $user->hasRight(
"modulebuilder",
"run")) {
445 $modulename = ucfirst($module);
446 $objectname = $tabobj;
447 $varnametoupdate =
'';
448 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
449 $destdir = $dirins.
'/'.strtolower($module);
455 if ($action ==
'initapi') {
456 if (file_exists($dirins.
'/'.strtolower($module).
'/class/api_'.strtolower($module).
'.class.php')) {
457 $result =
dol_copy(DOL_DOCUMENT_ROOT.
'/modulebuilder/template/class/api_mymodule.class.php', $dirins.
'/'.strtolower($module).
'/class/api_'.strtolower($module).
'.class.php',
'0', 1);
459 dol_mkdir($dirins.
'/'.strtolower($module).
'/class');
460 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
461 $srcfile = $srcdir.
'/class/api_mymodule.class.php';
462 $destfile = $dirins.
'/'.strtolower($module).
'/class/api_'.strtolower($module).
'.class.php';
463 } elseif ($action ==
'initphpunit') {
464 dol_mkdir($dirins.
'/'.strtolower($module).
'/test/phpunit');
465 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
466 $srcfile = $srcdir.
'/test/phpunit/MyObjectTest.php';
467 $destfile = $dirins.
'/'.strtolower($module).
'/test/phpunit/'.strtolower($objectname).
'Test.php';
468 } elseif ($action ==
'initpagecontact') {
469 dol_mkdir($dirins.
'/'.strtolower($module));
470 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
471 $srcfile = $srcdir.
'/myobject_contact.php';
472 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_contact.php';
473 $varnametoupdate =
'showtabofpagecontact';
474 } elseif ($action ==
'initpagedocument') {
475 dol_mkdir($dirins.
'/'.strtolower($module));
476 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
477 $srcfile = $srcdir.
'/myobject_document.php';
478 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_document.php';
479 $varnametoupdate =
'showtabofpagedocument';
480 } elseif ($action ==
'initpagenote') {
481 dol_mkdir($dirins.
'/'.strtolower($module));
482 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
483 $srcfile = $srcdir.
'/myobject_note.php';
484 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_note.php';
485 $varnametoupdate =
'showtabofpagenote';
486 } elseif ($action ==
'initpageagenda') {
487 dol_mkdir($dirins.
'/'.strtolower($module));
488 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
489 $srcfile = $srcdir.
'/myobject_agenda.php';
490 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_agenda.php';
491 $varnametoupdate =
'showtabofpageagenda';
494 if (!file_exists($destfile)) {
495 $result =
dol_copy($srcfile, $destfile,
'0', 0);
500 $arrayreplacement = array(
501 'mymodule' => strtolower($modulename),
502 'MyModule' => $modulename,
503 'MYMODULE' => strtoupper($modulename),
504 'My module' => $modulename,
505 'my module' => $modulename,
506 'Mon module' => $modulename,
507 'mon module' => $modulename,
508 'htdocs/modulebuilder/template' => strtolower($modulename),
509 'myobject' => strtolower($objectname),
510 'MyObject' => $objectname,
511 'MYOBJECT' => strtoupper($objectname),
513 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
516 if ($action ==
'initapi') {
517 if (count($objects) >= 1) {
525 if ($varnametoupdate) {
527 $srcfile = $dirins.
'/'.strtolower($module).
'/lib/'.strtolower($module).
'_'.strtolower($objectname).
'.lib.php';
528 $arrayreplacement = array(
'/\$'.preg_quote($varnametoupdate,
'/').
' = 0;/' =>
'$'.$varnametoupdate.
' = 1;');
533 $langs->load(
"errors");
534 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
540if ($dirins && $action ==
'initsqlextrafields' && !empty($module) && $user->hasRight(
"modulebuilder",
"run")) {
541 $modulename = ucfirst($module);
542 $objectname = $tabobj;
544 dol_mkdir($dirins.
'/'.strtolower($module).
'/sql');
545 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
546 $srcfile1 = $srcdir.
'/sql/llx_mymodule_myobject_extrafields.sql';
547 $destfile1 = $dirins.
'/'.strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.sql';
548 $result1 =
dol_copy($srcfile1, $destfile1,
'0', 0);
549 $srcfile2 = $srcdir.
'/sql/llx_mymodule_myobject_extrafields.key.sql';
550 $destfile2 = $dirins.
'/'.strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.key.sql';
551 $result2 =
dol_copy($srcfile2, $destfile2,
'0', 0);
553 if ($result1 > 0 && $result2 > 0) {
554 $modulename = ucfirst($module);
557 $arrayreplacement = array(
558 'mymodule' => strtolower($modulename),
559 'MyModule' => $modulename,
560 'MYMODULE' => strtoupper($modulename),
561 'My module' => $modulename,
562 'my module' => $modulename,
563 'Mon module' => $modulename,
564 'mon module' => $modulename,
565 'htdocs/modulebuilder/template' => strtolower($modulename),
566 'My Object' => $objectname,
567 'MyObject' => $objectname,
568 'my object' => strtolower($objectname),
569 'myobject' => strtolower($objectname),
570 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
576 $langs->load(
"errors");
578 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile1),
null,
'errors');
581 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile2),
null,
'errors');
586 $srcfile = $dirins.
'/'.strtolower($module).
'/class/'.strtolower($objectname).
'.class.php';
587 $arrayreplacement = array(
'/\$this->isextrafieldmanaged = 0;/' =>
'$this->isextrafieldmanaged = 1;');
593if ($dirins && $action ==
'inithook' && !empty($module) && $user->hasRight(
"modulebuilder",
"run")) {
594 dol_mkdir($dirins.
'/'.strtolower($module).
'/class');
595 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
596 $srcfile = $srcdir.
'/class/actions_mymodule.class.php';
597 $destfile = $dirins.
'/'.strtolower($module).
'/class/actions_'.strtolower($module).
'.class.php';
598 $result =
dol_copy($srcfile, $destfile,
'0', 0);
601 $modulename = ucfirst($module);
604 $arrayreplacement = array(
605 'mymodule' => strtolower($modulename),
606 'MyModule' => $modulename,
607 'MYMODULE' => strtoupper($modulename),
608 'My module' => $modulename,
609 'my module' => $modulename,
610 'Mon module' => $modulename,
611 'mon module' => $modulename,
612 'htdocs/modulebuilder/template' => strtolower($modulename),
613 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
619 $langs->load(
"errors");
620 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
626if ($dirins && $action ==
'inittrigger' && !empty($module) && $user->hasRight(
"modulebuilder",
"run")) {
627 dol_mkdir($dirins.
'/'.strtolower($module).
'/core/triggers');
628 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
629 $srcfile = $srcdir.
'/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php';
630 $destfile = $dirins.
'/'.strtolower($module).
'/core/triggers/interface_99_mod'.$module.
'_'.$module.
'Triggers.class.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 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
652 $langs->load(
"errors");
653 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
659if ($dirins && $action ==
'initwidget' && !empty($module) && $user->hasRight(
"modulebuilder",
"run")) {
660 dol_mkdir($dirins.
'/'.strtolower($module).
'/core/boxes');
661 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
662 $srcfile = $srcdir.
'/core/boxes/mymodulewidget1.php';
663 $destfile = $dirins.
'/'.strtolower($module).
'/core/boxes/'.strtolower($module).
'widget1.php';
664 $result =
dol_copy($srcfile, $destfile,
'0', 0);
667 $modulename = ucfirst($module);
670 $arrayreplacement = array(
671 'mymodule' => strtolower($modulename),
672 'MyModule' => $modulename,
673 'MYMODULE' => strtoupper($modulename),
674 'My module' => $modulename,
675 'my module' => $modulename,
676 'Mon module' => $modulename,
677 'mon module' => $modulename,
678 'htdocs/modulebuilder/template' => strtolower($modulename),
679 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
685 $langs->load(
"errors");
686 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
692if ($dirins && $action ==
'initemailing' && !empty($module) && $user->hasRight(
"modulebuilder",
"run")) {
693 dol_mkdir($dirins.
'/'.strtolower($module).
'/core/modules/mailings');
694 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
695 $srcfile = $srcdir.
'/core/modules/mailings/mailing_mymodule_selector1.modules.php';
696 $destfile = $dirins.
'/'.strtolower($module).
'/core/modules/mailings/mailing_'.strtolower($module).
'_selector1.modules.php';
697 $result =
dol_copy($srcfile, $destfile,
'0', 0);
700 $modulename = ucfirst($module);
703 $arrayreplacement = array(
704 'mymodule' => strtolower($modulename),
705 'MyModule' => $modulename,
706 'MYMODULE' => strtoupper($modulename),
707 'My module' => $modulename,
708 'my module' => $modulename,
709 'Mon module' => $modulename,
710 'mon module' => $modulename,
711 'htdocs/modulebuilder/template' => strtolower($modulename),
712 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
718 $langs->load(
"errors");
719 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
725if ($dirins && $action ==
'initcss' && !empty($module) && $user->hasRight(
"modulebuilder",
"run")) {
726 dol_mkdir($dirins.
'/'.strtolower($module).
'/css');
727 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
728 $srcfile = $srcdir.
'/css/mymodule.css.php';
729 $destfile = $dirins.
'/'.strtolower($module).
'/css/'.strtolower($module).
'.css.php';
730 $result =
dol_copy($srcfile, $destfile,
'0', 0);
733 $modulename = ucfirst($module);
736 $arrayreplacement = array(
737 'mymodule' => strtolower($modulename),
738 'MyModule' => $modulename,
739 'MYMODULE' => strtoupper($modulename),
740 'My module' => $modulename,
741 'my module' => $modulename,
742 'Mon module' => $modulename,
743 'mon module' => $modulename,
744 'htdocs/modulebuilder/template' => strtolower($modulename),
745 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
752 $srcfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
753 $arrayreplacement = array(
'/\/\/\s*\''.preg_quote(
'/'.strtolower($module).
'/css/'.strtolower($module).
'.css.php',
'/').
'\'/
' => '\
'/'.strtolower($module).
'/css/'.strtolower($module).
'.css.php\'');
756 $langs->load(
"errors");
757 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
763if ($dirins && $action ==
'initjs' && !empty($module) && $user->hasRight(
"modulebuilder",
"run")) {
764 dol_mkdir($dirins.
'/'.strtolower($module).
'/js');
765 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
766 $srcfile = $srcdir.
'/js/mymodule.js.php';
767 $destfile = $dirins.
'/'.strtolower($module).
'/js/'.strtolower($module).
'.js.php';
768 $result =
dol_copy($srcfile, $destfile,
'0', 0);
771 $modulename = ucfirst($module);
774 $arrayreplacement = array(
775 'mymodule' => strtolower($modulename),
776 'MyModule' => $modulename,
777 'MYMODULE' => strtoupper($modulename),
778 'My module' => $modulename,
779 'my module' => $modulename,
780 'Mon module' => $modulename,
781 'mon module' => $modulename,
782 'htdocs/modulebuilder/template' => strtolower($modulename),
783 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
790 $srcfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
791 $arrayreplacement = array(
'/\/\/\s*\''.preg_quote(
'/'.strtolower($module).
'/js/'.strtolower($module).
'.js.php',
'/').
'\'/
' => '\
'/'.strtolower($module).
'/js/'.strtolower($module).
'.js.php\'');
794 $langs->load(
"errors");
795 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
801if ($dirins && $action ==
'initcli' && !empty($module) && $user->hasRight(
"modulebuilder",
"run")) {
802 dol_mkdir($dirins.
'/'.strtolower($module).
'/scripts');
803 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
804 $srcfile = $srcdir.
'/scripts/mymodule.php';
805 $destfile = $dirins.
'/'.strtolower($module).
'/scripts/'.strtolower($module).
'.php';
806 $result =
dol_copy($srcfile, $destfile,
'0', 0);
809 $modulename = ucfirst($module);
812 $arrayreplacement = array(
813 'mymodule' => strtolower($modulename),
814 'MyModule' => $modulename,
815 'MYMODULE' => strtoupper($modulename),
816 'My module' => $modulename,
817 'my module' => $modulename,
818 'Mon module' => $modulename,
819 'mon module' => $modulename,
820 'htdocs/modulebuilder/template' => strtolower($modulename),
821 '__MYCOMPANY_NAME__' => $mysoc->name,
822 '__KEYWORDS__' => $modulename,
823 '__USER_FULLNAME__' => $user->getFullName($langs),
824 '__USER_EMAIL__' => $user->email,
826 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
832 $langs->load(
"errors");
833 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
838$moduledescriptorfile =
'/not_set/';
841if ($dirins && $action ==
'initdoc' && !empty($module) && $user->hasRight(
"modulebuilder",
"run")) {
842 dol_mkdir($dirins.
'/'.strtolower($module).
'/doc');
843 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
844 $srcfile = $srcdir.
'/doc/Documentation.asciidoc';
845 $destfile = $dirins.
'/'.strtolower($module).
'/doc/Documentation.asciidoc';
846 $result =
dol_copy($srcfile, $destfile,
'0', 0);
849 $modulename = ucfirst($module);
850 $modulelowercase = strtolower($module);
853 $arrayreplacement = array(
854 'mymodule' => strtolower($modulename),
855 'MyModule' => $modulename,
856 'MYMODULE' => strtoupper($modulename),
857 'My module' => $modulename,
858 'my module' => $modulename,
859 'Mon module' => $modulename,
860 'mon module' => $modulename,
861 'htdocs/modulebuilder/template' => strtolower($modulename),
862 '__MYCOMPANY_NAME__' => $mysoc->name,
863 '__KEYWORDS__' => $modulename,
864 '__USER_FULLNAME__' => $user->getFullName($langs),
865 '__USER_EMAIL__' => $user->email,
867 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
874 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
875 $destdir = $dirins.
'/'.strtolower($module);
877 foreach ($objects as $path => $obj) {
882 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
886 if (file_exists($dirins.
'/'.strtolower($module).
'/class/api_'.strtolower($module).
'.class.php')) {
887 $apiFile = $dirins.
'/'.strtolower($module).
'/class/api_'.strtolower($module).
'.class.php';
892 if (file_exists($dirins.
'/'.strtolower($module).
'/ChangeLog.md')) {
893 $changeLog = $dirins.
'/'.strtolower($module).
'/ChangeLog.md';
894 $string = file_get_contents($changeLog);
896 $replace = explode(
"\n", $string);
897 $strreplace = array();
898 foreach ($replace as $line) {
902 if (strpos($line,
'##') !==
false) {
903 $strreplace[$line] = str_replace(
'##',
'', $line);
905 $strreplace[$line] = $line;
908 $stringLog = implode(
"\n", $strreplace);
910 dolReplaceInFile($destfile, array(
'//include::ChangeLog.md[]' =>
'',
'__CHANGELOG__' => $stringLog));
914 $FILENAMEDOC = $modulelowercase.
'.html';
915 $FILENAMEDOCPDF = $modulelowercase.
'.pdf';
916 $outputfiledoc =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOC;
917 $outputfiledocurl =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOC;
918 $outputfiledocpdf =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOCPDF;
919 $outputfiledocurlpdf =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOCPDF;
924 $langs->load(
"errors");
925 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
931if ($dirins && $action ==
'addlanguage' && !empty($module) && $user->hasRight(
"modulebuilder",
"run")) {
932 $newlangcode =
GETPOST(
'newlangcode',
'aZ09');
935 $modulelowercase = strtolower($module);
940 if ($diroflang == $dolibarr_main_document_root.
'/'.$modulelowercase) {
942 $diroflang = $dolibarr_main_document_root;
944 $srcfile = $diroflang.
'/langs/en_US/'.$modulelowercase.
'.lang';
945 $destfile = $diroflang.
'/langs/'.$newlangcode.
'/'.$modulelowercase.
'.lang';
947 $result =
dol_copy($srcfile, $destfile,
'0', 0);
949 setEventMessages($langs->trans(
"ErrorFailToCopyFile", $srcfile, $destfile),
null,
'errors');
952 $srcdir = $diroflang.
'/langs/en_US';
953 $srcfile = $diroflang.
'/langs/en_US/'.$modulelowercase.
'.lang';
954 $destdir = $diroflang.
'/langs/'.$newlangcode;
956 $arrayofreplacement = array();
958 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template/langs/en_US';
959 $arrayofreplacement = array(
'mymodule' => $modulelowercase);
961 $result =
dolCopyDir($srcdir, $destdir,
'0', 0, $arrayofreplacement);
964 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Language")),
null,
'errors');
970if ($dirins && $action ==
'confirm_removefile' && !empty($module) && $user->hasRight(
"modulebuilder",
"run")) {
971 $objectname = $tabobj;
972 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
973 $destdir = $dirins.
'/'.strtolower($module);
978 if ($relativefilename) {
979 $dirnametodelete = dirname($relativefilename);
980 $filetodelete = $dirins.
'/'.$relativefilename;
981 $dirtodelete = $dirins.
'/'.$dirnametodelete;
986 $keyofobjecttodelete = array_search($objectname, $objects);
987 if ($keyofobjecttodelete !==
false) {
988 unset($objects[$keyofobjecttodelete]);
992 if (strpos($relativefilename,
'api') !==
false) {
993 $file_api = $destdir.
'/class/api_'.strtolower($module).
'.class.php';
997 if (count($objects) == 0) {
1009 setEventMessages($langs->trans(
"ErrorFailToDeleteFile", basename($filetodelete)),
null,
'errors');
1012 if (preg_match(
'/\.sql$/', $relativefilename)) {
1013 if (preg_match(
'/\.key\.sql$/', $relativefilename)) {
1014 $relativefilename = preg_replace(
'/\.key\.sql$/',
'.sql', $relativefilename);
1015 $filetodelete = $dirins.
'/'.$relativefilename;
1017 } elseif (preg_match(
'/\.sql$/', $relativefilename)) {
1018 $relativefilename = preg_replace(
'/\.sql$/',
'.key.sql', $relativefilename);
1019 $filetodelete = $dirins.
'/'.$relativefilename;
1029 if (in_array($tab, array(
'css',
'js'))) {
1030 $srcfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
1031 $arrayreplacement = array(
'/^\s*\''.preg_quote(
'/'.$relativefilename,
'/').
'\',*/m
' => '
1035 if (preg_match(
'/_extrafields/', $relativefilename)) {
1037 $srcfile = $dirins.
'/'.strtolower($module).
'/class/'.strtolower($objectname).
'.class.php';
1038 $arrayreplacement = array(
'/\$isextrafieldmanaged = 1;/' =>
'$isextrafieldmanaged = 0;');
1043 $varnametoupdate =
'';
1045 if (preg_match(
'/_([a-z]+)\.php$/', $relativefilename, $reg)) {
1046 $varnametoupdate =
'showtabofpage'.$reg[1];
1048 if ($varnametoupdate) {
1049 $srcfile = $dirins.
'/'.strtolower($module).
'/lib/'.strtolower($module).
'_'.strtolower($objectname).
'.lib.php';
1050 $arrayreplacement = array(
'/\$'.preg_quote($varnametoupdate,
'/').
' = 1;/' =>
'$'.preg_quote($varnametoupdate,
'/').
' = 0;');
1058if ($dirins && $action ==
'initobject' && $module && $objectname && $user->hasRight(
"modulebuilder",
"run")) {
1061 $objectname = ucfirst($objectname);
1063 $dirins = $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
1064 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
1066 if (preg_match(
'/[^a-z0-9_]/i', $objectname)) {
1068 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
1069 $tabobj =
'newobject';
1071 if (class_exists($objectname)) {
1074 setEventMessages($langs->trans(
"AnObjectWithThisClassNameAlreadyExists"),
null,
'errors');
1075 $tabobj =
'newobject';
1078 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
1079 $destdir = $dirins.
'/'.strtolower($module);
1091 $dirlist =
dol_dir_list($destdir.
'/class',
'files', 0,
'\.txt$');
1092 $alreadyfound =
false;
1093 foreach ($dirlist as $key => $val) {
1094 $filefound = preg_replace(
'/\.txt$/',
'', $val[
'name']);
1095 if (strtolower($objectname) == strtolower($filefound) && $objectname != $filefound) {
1096 $alreadyfound =
true;
1098 setEventMessages($langs->trans(
"AnObjectAlreadyExistWithThisNameAndDiffCase"),
null,
'errors');
1106 $stringforproperties =
'';
1107 $tablename =
GETPOST(
'initfromtablename',
'alpha');
1109 $_results = $db->DDLDescTable($tablename);
1110 if (empty($_results)) {
1112 $langs->load(
"errors");
1113 setEventMessages($langs->trans(
"ErrorTableNotFound", $tablename),
null,
'errors');
1162 $stringforproperties =
'// BEGIN MODULEBUILDER PROPERTIES'.
"\n";
1163 $stringforproperties .=
'public $fields = array('.
"\n";
1165 while ($obj = $db->fetch_object($_results)) {
1167 $fieldname = $obj->Field;
1170 if ($type ==
'int(11)') {
1173 if ($type ==
'float') {
1176 if (strstr($type,
'tinyint')) {
1179 if ($obj->Field ==
'fk_soc') {
1180 $type =
'integer:Societe:societe/class/societe.class.php';
1182 if (preg_match(
'/^fk_proj/', $obj->Field)) {
1183 $type =
'integer:Project:projet/class/project.class.php:1:fk_statut=1';
1185 if (preg_match(
'/^fk_prod/', $obj->Field)) {
1186 $type =
'integer:Product:product/class/product.class.php:1';
1188 if ($obj->Field ==
'fk_warehouse') {
1189 $type =
'integer:Entrepot:product/stock/class/entrepot.class.php';
1191 if (preg_match(
'/^(fk_user|fk_commercial)/', $obj->Field)) {
1192 $type =
'integer:User:user/class/user.class.php';
1196 $notnull = ($obj->Null ==
'YES' ? 0 : 1);
1197 if ($fieldname ==
'fk_user_modif') {
1201 $label = preg_replace(
'/_/',
'', ucfirst($fieldname));
1202 if ($fieldname ==
'rowid') {
1203 $label =
'TechnicalID';
1205 if ($fieldname ==
'import_key') {
1206 $label =
'ImportId';
1208 if ($fieldname ==
'fk_soc') {
1209 $label =
'ThirdParty';
1211 if ($fieldname ==
'tms') {
1212 $label =
'DateModification';
1214 if ($fieldname ==
'datec') {
1215 $label =
'DateCreation';
1217 if ($fieldname ==
'date_valid') {
1218 $label =
'DateValidation';
1220 if ($fieldname ==
'datev') {
1221 $label =
'DateValidation';
1223 if ($fieldname ==
'note_private') {
1224 $label =
'NotePublic';
1226 if ($fieldname ==
'note_public') {
1227 $label =
'NotePrivate';
1229 if ($fieldname ==
'fk_user_creat') {
1230 $label =
'UserAuthor';
1232 if ($fieldname ==
'fk_user_modif') {
1233 $label =
'UserModif';
1235 if ($fieldname ==
'fk_user_valid') {
1236 $label =
'UserValidation';
1240 if (in_array($fieldname, array(
'ref',
'label'))) {
1243 if ($fieldname ==
'entity') {
1246 if ($fieldname ==
'entity') {
1249 if ($fieldname ==
'import_key') {
1252 if ($fieldname ==
'fk_user_creat') {
1255 if ($fieldname ==
'fk_user_modif') {
1258 if (in_array($fieldname, array(
'ref_ext',
'model_pdf',
'note_public',
'note_private'))) {
1265 if ($fieldname ==
'entity') {
1270 if (in_array($fieldname, array(
'status',
'statut',
'fk_status',
'fk_statut'))) {
1273 if ($fieldname ==
'import_key') {
1277 if ($fieldname ==
'label') {
1278 $alwayseditable = 1;
1280 $alwayseditable = 0;
1284 if ($fieldname ==
'entity') {
1291 if (preg_match(
'/^fk_/', $fieldname)) {
1292 $css =
'maxwidth500 widthcentpercentminusxx';
1294 if ($fieldname ==
'label') {
1295 $css =
'minwidth300';
1296 $cssview =
'wordbreak';
1298 if (in_array($fieldname, array(
'note_public',
'note_private'))) {
1299 $cssview =
'wordbreak';
1301 if (in_array($fieldname, array(
'ref',
'label')) || preg_match(
'/integer:/', $type)) {
1302 $csslist =
'tdoverflowmax150';
1306 $picto = $obj->Picto;
1307 if ($obj->Field ==
'fk_soc') {
1310 if (preg_match(
'/^fk_proj/', $obj->Field)) {
1315 $stringforproperties .=
"'".$obj->Field.
"' => array('type' => '".$type.
"', 'label' => '".$label.
"',";
1316 if ($default !=
'') {
1317 $stringforproperties .=
" 'default' => ".$default.
",";
1319 $stringforproperties .=
" 'enabled' => ".$enabled.
",";
1320 $stringforproperties .=
" 'visible' => ".$visible;
1322 $stringforproperties .=
", 'notnull' => ".$notnull;
1324 if ($alwayseditable) {
1325 $stringforproperties .=
", 'alwayseditable' => 1";
1327 if ($fieldname ==
'ref' || $fieldname ==
'code') {
1328 $stringforproperties .=
", 'showoncombobox' => 1";
1330 $stringforproperties .=
", 'position' => ".$position;
1332 $stringforproperties .=
", 'index' => ".$index;
1335 $stringforproperties .=
", 'picto' => '".$picto.
"'";
1338 $stringforproperties .=
", 'css' => '".$css.
"'";
1341 $stringforproperties .=
", 'cssview' => '".$cssview.
"'";
1344 $stringforproperties .=
", 'csslist' => '".$csslist.
"'";
1346 $stringforproperties .=
"),\n";
1349 $stringforproperties .=
');'.
"\n";
1350 $stringforproperties .=
'// END MODULEBUILDER PROPERTIES'.
"\n";
1354 $filetogenerate = array();
1357 $filetogenerate = array(
1358 'myobject_card.php' => strtolower($objectname).
'_card.php',
1359 'myobject_note.php' => strtolower($objectname).
'_note.php',
1360 'myobject_contact.php' => strtolower($objectname).
'_contact.php',
1361 'myobject_document.php' => strtolower($objectname).
'_document.php',
1362 'myobject_agenda.php' => strtolower($objectname).
'_agenda.php',
1363 'myobject_list.php' => strtolower($objectname).
'_list.php',
1364 'admin/myobject_extrafields.php' =>
'admin/'.strtolower($objectname).
'_extrafields.php',
1365 'lib/mymodule_myobject.lib.php' =>
'lib/'.strtolower($module).
'_'.strtolower($objectname).
'.lib.php',
1367 'sql/llx_mymodule_myobject.sql' =>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'.sql',
1368 'sql/llx_mymodule_myobject.key.sql' =>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'.key.sql',
1369 'sql/llx_mymodule_myobject_extrafields.sql' =>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.sql',
1370 'sql/llx_mymodule_myobject_extrafields.key.sql' =>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.key.sql',
1372 'class/myobject.class.php' =>
'class/'.strtolower($objectname).
'.class.php',
1374 'ajax/myobject.php' =>
'ajax/'.strtolower($objectname).
'.php',
1377 if (
GETPOST(
'includerefgeneration',
'aZ09')) {
1378 dol_mkdir($destdir.
'/core/modules/'.strtolower($module));
1380 $filetogenerate += array(
1381 'core/modules/mymodule/mod_myobject_advanced.php' =>
'core/modules/'.strtolower($module).
'/mod_'.strtolower($objectname).
'_advanced.php',
1382 'core/modules/mymodule/mod_myobject_standard.php' =>
'core/modules/'.strtolower($module).
'/mod_'.strtolower($objectname).
'_standard.php',
1383 'core/modules/mymodule/modules_myobject.php' =>
'core/modules/'.strtolower($module).
'/modules_'.strtolower($objectname).
'.php',
1386 if (
GETPOST(
'includedocgeneration',
'aZ09')) {
1387 dol_mkdir($destdir.
'/core/modules/'.strtolower($module));
1388 dol_mkdir($destdir.
'/core/modules/'.strtolower($module).
'/doc');
1390 $filetogenerate += array(
1391 'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php' =>
'core/modules/'.strtolower($module).
'/doc/doc_generic_'.strtolower($objectname).
'_odt.modules.php',
1392 'core/modules/mymodule/doc/pdf_standard_myobject.modules.php' =>
'core/modules/'.strtolower($module).
'/doc/pdf_standard_'.strtolower($objectname).
'.modules.php'
1395 if (
GETPOST(
'generatepermissions',
'aZ09')) {
1396 $firstobjectname =
'myobject';
1397 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
1399 $class =
'mod'.$module;
1401 if (class_exists($class)) {
1403 $moduleobj =
new $class($db);
1404 '@phan-var-force DolibarrModules $moduleobj';
1410 if (is_object($moduleobj)) {
1411 $rights = $moduleobj->rights;
1415 $moduledescriptorfile = $destdir.
'/core/modules/mod'.$module.
'.class.php';
1417 if ($checkComment < 0) {
1418 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Permissions"),
"mod".$module.
"class.php"),
null,
'warnings');
1420 $generatePerms =
reWriteAllPermissions($moduledescriptorfile, $rights,
null,
null, $objectname, $module, -2);
1421 if ($generatePerms < 0) {
1422 setEventMessages($langs->trans(
"WarningPermissionAlreadyExist", $langs->transnoentities($objectname)),
null,
'warnings');
1428 foreach ($filetogenerate as $srcfile => $destfile) {
1429 $result =
dol_copy($srcdir.
'/'.$srcfile, $destdir.
'/'.$destfile, $newmask, 0);
1433 $langs->load(
"errors");
1434 setEventMessages($langs->trans(
"ErrorFailToCopyFile", $srcdir.
'/'.$srcfile, $destdir.
'/'.$destfile),
null,
'errors');
1437 setEventMessages($langs->trans(
"FileAlreadyExists", $destfile),
null,
'warnings');
1440 $arrayreplacement = array(
1441 '/myobject\.class\.php/' => strtolower($objectname).
'.class.php',
1442 '/myobject\.lib\.php/' => strtolower($objectname).
'.lib.php',
1445 dolReplaceInFile($destdir.
'/'.$destfile, $arrayreplacement,
'',
'0', 0, 1);
1450 if (!$error && $stringforproperties) {
1452 $arrayreplacement = array(
1453 '/\/\/ BEGIN MODULEBUILDER PROPERTIES.*\/\/ END MODULEBUILDER PROPERTIES/ims' => $stringforproperties
1456 dolReplaceInFile($destdir.
'/class/'.strtolower($objectname).
'.class.php', $arrayreplacement,
'',
'0', 0, 1);
1460 if (
GETPOST(
'includerefgeneration',
'aZ09')) {
1462 $arrayreplacement = array(
1463 '/\'visible\'s*=>s*1,\s*\'noteditable\'s*=>s*0,\s*\'default\'s*=>s*\'\'/' =>
"'visible' => 4, 'noteditable' => 1, 'default' => '(PROV)'"
1467 dolReplaceInFile($destdir.
'/class/'.strtolower($objectname).
'.class.php', $arrayreplacement,
'',
'0', 0, 1);
1469 $arrayreplacement = array(
1470 '/\'models\' => 0,/' =>
'\'models\
' => 1,'
1472 dolReplaceInFile($destdir.
'/core/modules/mod'.$module.
'.class.php', $arrayreplacement,
'',
'0', 0, 1);
1476 if (
GETPOST(
'includedocgeneration',
'aZ09')) {
1478 $arrayreplacement = array(
1479 '/\$includedocgeneration = 0;/' =>
'$includedocgeneration = 1;'
1481 dolReplaceInFile($destdir.
'/class/'.strtolower($objectname).
'.class.php', $arrayreplacement,
'',
'0', 0, 1);
1482 dolReplaceInFile($destdir.
'/'.strtolower($objectname).
'_card.php', $arrayreplacement,
'',
'0', 0, 1);
1484 $arrayreplacement = array(
1485 '/\'models\' => 0,/' =>
'\'models\
' => 1,'
1488 dolReplaceInFile($destdir.
'/core/modules/mod'.$module.
'.class.php', $arrayreplacement,
'',
'0', 0, 1);
1495 $listofobject =
dol_dir_list($destdir.
'/class',
'files', 0,
'\.class\.php$');
1497 $firstobjectname =
'';
1498 foreach ($listofobject as $fileobj) {
1499 if (preg_match(
'/^api_/', $fileobj[
'name'])) {
1502 if (preg_match(
'/^actions_/', $fileobj[
'name'])) {
1506 $tmpcontent = file_get_contents($fileobj[
'fullname']);
1508 if (preg_match(
'/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) {
1509 $objectnameloop = $reg[1];
1510 if (empty($firstobjectname)) {
1511 $firstobjectname = $objectnameloop;
1517 \$this->menu[\$r++] = array(
1518 'fk_menu' => 'fk_mainmenu=mymodule',
1520 'titre' => 'MyObject',
1521 'prefix' => img_picto('', \$this->picto, 'class=\"paddingright pictofixedwidth valignmiddle\"'),
1522 'mainmenu' => 'mymodule',
1523 'leftmenu' => 'myobject',
1524 'url' => '/mymodule/myobject_list.php',
1525 'langs' => 'mymodule@mymodule',
1526 'position' => 1000 + \$r,
1527 'enabled' => 'isModEnabled(\"mymodule\")',
1528 'perms' => '".(GETPOST(
'generatepermissions') ?
'$user->hasRight("mymodule", "myobject", "read")' :
'1').
"',
1531 'object' => 'MyObject'
1533 \$this->menu[\$r++] = array(
1534 'fk_menu' => 'fk_mainmenu=mymodule,fk_leftmenu=myobject',
1536 'titre' => 'List MyObject',
1537 'mainmenu' => 'mymodule',
1538 'leftmenu' => 'mymodule_myobject_list',
1539 'url' => '/mymodule/myobject_list.php',
1540 'langs' => 'mymodule@mymodule',
1541 'position' => 1000 + \$r,
1542 'enabled' => 'isModEnabled(\"mymodule\")',
1543 'perms' => '".(
GETPOST(
'generatepermissions') ?
'$user->hasRight("mymodule", "myobject", "read")' :
'1').
"',
1546 'object' => 'MyObject'
1548 \$this->menu[\$r++] = array(
1549 'fk_menu' => 'fk_mainmenu=mymodule,fk_leftmenu=myobject',
1551 'titre' => 'New MyObject',
1552 'mainmenu' => 'mymodule',
1553 'leftmenu' => 'mymodule_myobject_new',
1554 'url' => '/mymodule/myobject_card.php?action=create',
1555 'langs' => 'mymodule@mymodule',
1556 'position' => 1000 + \$r,
1557 'enabled' => 'isModEnabled(\"mymodule\")',
1558 'perms' => '".(
GETPOST(
'generatepermissions') ?
'$user->hasRight("mymodule", "myobject", "write")' :
'1').
"',
1561 'object' => 'MyObject'
1563 $stringtoadd = preg_replace(
'/MyObject/', $objectname, $stringtoadd);
1564 $stringtoadd = preg_replace(
'/mymodule/', strtolower($module), $stringtoadd);
1565 $stringtoadd = preg_replace(
'/myobject/', strtolower($objectname), $stringtoadd);
1567 $moduledescriptorfile = $destdir.
'/core/modules/mod'.$module.
'.class.php';
1573 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
1575 $class =
'mod'.$module;
1577 if (class_exists($class)) {
1579 $moduleobj =
new $class($db);
1580 '@phan-var-force DolibarrModules $moduleobj';
1586 if (is_object($moduleobj)) {
1587 $menus = $moduleobj->menu;
1592 foreach ($menus as $menu) {
1593 if ($menu[
'leftmenu'] == strtolower($objectname)) {
1599 if ($checkComment < 0) {
1601 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Menus"), basename($moduledescriptorfile)),
null,
'warnings');
1603 $arrayofreplacement = array(
'/* BEGIN MODULEBUILDER LEFTMENU MYOBJECT */' =>
'/* BEGIN MODULEBUILDER LEFTMENU '.strtoupper($objectname).
' */'.$stringtoadd.
"\n\t\t".
'/* END MODULEBUILDER LEFTMENU '.strtoupper($objectname).
' */'.
"\n\t\t".
'/* BEGIN MODULEBUILDER LEFTMENU MYOBJECT */');
1608 $filetogenerate[] =
'core/modules/mod'.$module.
'.class.php';
1613 foreach ($filetogenerate as $destfile) {
1614 $phpfileval[
'fullname'] = $destdir.
'/'.$destfile;
1617 $arrayreplacement = array(
1618 'mymodule' => strtolower($module),
1619 'MyModule' => $module,
1620 'MYMODULE' => strtoupper($module),
1621 'My module' => $module,
1622 'my module' => $module,
1623 'mon module' => $module,
1624 'Mon module' => $module,
1625 'htdocs/modulebuilder/template/' => strtolower($modulename),
1626 'myobject' => strtolower($objectname),
1627 'MyObject' => $objectname,
1629 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
1633 $arrayreplacement[
'---Replace with your own copyright and developer email---'] =
dol_print_date($now,
'%Y').
' ' .
getDolGlobalString(
'MODULEBUILDER_SPECIFIC_AUTHOR');
1639 setEventMessages($langs->trans(
"ErrorFailToMakeReplacementInto", $phpfileval[
'fullname']),
null,
'errors');
1648 if (is_numeric($object) && $object <= 0) {
1649 $pathoffiletoeditsrc = $destdir.
'/class/'.strtolower($objectname).
'.class.php';
1650 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $pathoffiletoeditsrc),
null,
'errors');
1654 $file = $destdir.
'/class/'.strtolower($objectname).
'.class.php';
1655 $destfile = $destdir.
'/doc/Documentation.asciidoc';
1657 if (file_exists($destfile)) {
1663 $result =
rebuildObjectSql($destdir, $module, $objectname, $newmask,
'', $object);
1672 setEventMessages($langs->trans(
'FilesForObjectInitialized', $objectname),
null);
1673 $tabobj = $objectname;
1675 $tabobj =
'newobject';
1679 if (isModEnabled(strtolower($module))) {
1685 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
1686 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=objects&module='.$module);
1692if ($dirins && $action ==
'initdic' && $module && empty($cancel) && $user->hasRight(
"modulebuilder",
"run")) {
1693 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
1694 $destdir = $dirins.
'/'.strtolower($module);
1695 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
1699 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Table")),
null,
'errors');
1703 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
1706 $newdicname = $dicname;
1707 if (!preg_match(
'/^c_/', $newdicname)) {
1708 $newdicname =
'c_'.$dicname;
1711 $class =
'mod'.$module;
1713 if (class_exists($class)) {
1715 $moduleobj =
new $class($db);
1716 '@phan-var-force DolibarrModules $moduleobj';
1723 $langs->load(
"errors");
1724 dol_print_error($db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
1727 $dictionaries = $moduleobj->dictionaries;
1729 if ($checkComment < 0) {
1730 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Dictionaries"),
"mod".$module.
"class.php"),
null,
'warnings');
1733 if (function_exists(
'opcache_invalidate')) {
1736 clearstatcache(
true);
1737 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
''));
1744if ($dirins && ($action ==
'droptable' || $action ==
'droptableextrafields') && !empty($module) && !empty($tabobj) && $user->hasRight(
"modulebuilder",
"run")) {
1745 $objectname = $tabobj;
1747 $arrayoftables = array();
1748 if ($action ==
'droptable') {
1749 $arrayoftables[] = MAIN_DB_PREFIX.strtolower($module).
'_'.strtolower($tabobj);
1751 if ($action ==
'droptableextrafields') {
1752 $arrayoftables[] = MAIN_DB_PREFIX.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields';
1755 foreach ($arrayoftables as $tabletodrop) {
1757 $sql =
"SELECT COUNT(*) as nb FROM ".$tabletodrop;
1758 $resql = $db->query($sql);
1760 $obj = $db->fetch_object($resql);
1765 if ($db->lasterrno() ==
'DB_ERROR_NOSUCHTABLE') {
1766 setEventMessages($langs->trans(
"TableDoesNotExists", $tabletodrop),
null,
'warnings');
1772 $resql = $db->DDLDropTable($tabletodrop);
1774 setEventMessages($langs->trans(
"TableDropped", $tabletodrop),
null,
'mesgs');
1775 } elseif ($nb > 0) {
1776 setEventMessages($langs->trans(
"TableNotEmptyDropCanceled", $tabletodrop),
null,
'warnings');
1781if ($dirins && $action ==
'addproperty' && empty($cancel) && !empty($module) && (!empty($tabobj) || !empty(
GETPOST(
'obj'))) && $user->hasRight(
"modulebuilder",
"run")) {
1786 $dirins = $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
1787 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
1789 $srcdir = $dirread.
'/'.strtolower($module);
1790 $destdir = $dirins.
'/'.strtolower($module);
1794 if (!in_array($objectname, array_values($objects))) {
1796 setEventMessages($langs->trans(
"ErrorObjectNotFound", $langs->transnoentities($objectname)),
null,
'errors');
1799 $addfieldentry = array();
1802 if (!
GETPOST(
'regenerateclasssql') && !
GETPOST(
'regeneratemissing')) {
1803 if (!
GETPOST(
'propname',
'aZ09')) {
1805 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Name")),
null,
'errors');
1807 if (!
GETPOST(
'proplabel',
'alpha')) {
1809 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
1811 if (!
GETPOST(
'proptype',
'alpha')) {
1813 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Type")),
null,
'errors');
1817 if (!$error && !
GETPOST(
'regenerateclasssql') && !
GETPOST(
'regeneratemissing')) {
1818 $addfieldentry = array(
1819 'name' =>
GETPOST(
'propname',
'aZ09'),
1820 'label' =>
GETPOST(
'proplabel',
'alpha'),
1821 'type' => strtolower(
GETPOST(
'proptype',
'alpha')),
1822 'arrayofkeyval' =>
GETPOST(
'proparrayofkeyval',
'alphawithlgt'),
1823 'visible' =>
GETPOST(
'propvisible',
'alphanohtml'),
1824 'enabled' =>
GETPOST(
'propenabled',
'alphanohtml'),
1828 'foreignkey' =>
GETPOST(
'propforeignkey',
'alpha'),
1830 'isameasure' =>
GETPOSTINT(
'propisameasure'),
1831 'comment' =>
GETPOST(
'propcomment',
'alpha'),
1832 'help' =>
GETPOST(
'prophelp',
'alpha'),
1833 'css' =>
GETPOST(
'propcss',
'alpha'),
1834 'cssview' =>
GETPOST(
'propcssview',
'alpha'),
1835 'csslist' =>
GETPOST(
'propcsslist',
'alpha'),
1836 'default' =>
GETPOST(
'propdefault',
'restricthtml'),
1837 'noteditable' =>
GETPOSTINT(
'propnoteditable'),
1842 if (!empty($addfieldentry[
'arrayofkeyval']) && !is_array($addfieldentry[
'arrayofkeyval'])) {
1843 $tmpdecode = json_decode($addfieldentry[
'arrayofkeyval'],
true);
1845 $addfieldentry[
'arrayofkeyval'] = $tmpdecode;
1848 $addfieldentry[
'arrayofkeyval'] = $tmparray;
1860 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
1866 if (is_numeric($object) && $object <= 0) {
1867 $pathoffiletoeditsrc = $destdir.
'/class/'.strtolower($objectname).
'.class.php';
1868 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $pathoffiletoeditsrc),
null,
'errors');
1875 $result =
rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object, $moduletype);
1878 setEventMessages($langs->trans(
'ErrorFailToCreateFile',
'.sql'),
null,
'errors');
1884 clearstatcache(
true);
1886 setEventMessages($langs->trans(
'FilesForObjectUpdated', $objectname),
null);
1891 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj='.$objectname.
'&nocache='.time());
1896if ($dirins && $action ==
'confirm_deleteproperty' && $propertykey && $user->hasRight(
"modulebuilder",
"run")) {
1897 $objectname = $tabobj;
1899 $dirins = $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
1900 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
1902 $srcdir = $dirread.
'/'.strtolower($module);
1903 $destdir = $dirins.
'/'.strtolower($module);
1910 if (is_numeric($object) && $object <= 0) {
1911 $pathoffiletoeditsrc = $destdir.
'/class/'.strtolower($objectname).
'.class.php';
1912 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $pathoffiletoeditsrc),
null,
'errors');
1919 $result =
rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object);
1922 setEventMessages($langs->trans(
'ErrorFailToCreateFile',
'.sql'),
null,
'errors');
1928 setEventMessages($langs->trans(
'FilesForObjectUpdated', $objectname),
null);
1930 clearstatcache(
true);
1933 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj='.$objectname);
1938if ($dirins && $action ==
'confirm_deletemodule' && $user->hasRight(
"modulebuilder",
"run")) {
1939 if (preg_match(
'/[^a-z0-9_]/i', $module)) {
1941 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
1945 $modulelowercase = strtolower($module);
1948 $dir = $dirins.
'/'.$modulelowercase;
1950 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
1960 $class =
'mod'.$module;
1964 if (class_exists($class)) {
1966 $moduleobj =
new $class($db);
1967 '@phan-var-force DolibarrMOdules $moduleobj';
1974 $langs->load(
"errors");
1975 setEventMessages($langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module),
null,
'warnings');
1979 $moduleobj->remove();
1987 clearstatcache(
true);
1988 if (function_exists(
'opcache_invalidate')) {
1992 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?module=deletemodule');
2000 $module =
'deletemodule';
2003if ($dirins && $action ==
'confirm_deleteobject' && $objectname && $user->hasRight(
"modulebuilder",
"run")) {
2004 if (preg_match(
'/[^a-z0-9_]/i', $objectname)) {
2006 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
2010 $modulelowercase = strtolower($module);
2011 $objectlowercase = strtolower($objectname);
2014 $dir = $dirins.
'/'.$modulelowercase;
2017 $filetodelete = array(
2018 'myobject_card.php' => strtolower($objectname).
'_card.php',
2019 'myobject_note.php' => strtolower($objectname).
'_note.php',
2020 'myobject_contact.php' => strtolower($objectname).
'_contact.php',
2021 'myobject_document.php' => strtolower($objectname).
'_document.php',
2022 'myobject_agenda.php' => strtolower($objectname).
'_agenda.php',
2023 'myobject_list.php' => strtolower($objectname).
'_list.php',
2024 'admin/myobject_extrafields.php' =>
'admin/'.strtolower($objectname).
'_extrafields.php',
2025 'lib/mymodule_myobject.lib.php' =>
'lib/'.strtolower($module).
'_'.strtolower($objectname).
'.lib.php',
2026 'test/phpunit/MyObjectTest.php' =>
'test/phpunit/'.strtolower($objectname).
'Test.php',
2027 'sql/llx_mymodule_myobject.sql' =>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'.sql',
2028 'sql/llx_mymodule_myobject_extrafields.sql' =>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.sql',
2029 'sql/llx_mymodule_myobject.key.sql' =>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'.key.sql',
2030 'sql/llx_mymodule_myobject_extrafields.key.sql' =>
'sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.key.sql',
2031 'scripts/myobject.php' =>
'scripts/'.strtolower($objectname).
'.php',
2032 'class/myobject.class.php' =>
'class/'.strtolower($objectname).
'.class.php',
2033 'class/api_myobject.class.php' =>
'class/api_'.strtolower($module).
'.class.php',
2034 'core/modules/mymodule/mod_myobject_advanced.php' =>
'core/modules/'.strtolower($module).
'/mod_'.strtolower($objectname).
'_advanced.php',
2035 'core/modules/mymodule/mod_myobject_standard.php' =>
'core/modules/'.strtolower($module).
'/mod_'.strtolower($objectname).
'_standard.php',
2036 'core/modules/mymodule/modules_myobject.php' =>
'core/modules/'.strtolower($module).
'/modules_'.strtolower($objectname).
'.php',
2037 'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php' =>
'core/modules/'.strtolower($module).
'/doc/doc_generic_'.strtolower($objectname).
'_odt.modules.php',
2038 'core/modules/mymodule/doc/pdf_standard_myobject.modules.php' =>
'core/modules/'.strtolower($module).
'/doc/pdf_standard_'.strtolower($objectname).
'.modules.php'
2043 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2045 $class =
'mod'.$module;
2047 if (class_exists($class)) {
2049 $moduleobj =
new $class($db);
2050 '@phan-var-force DolibarrMOdules $moduleobj';
2056 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2059 $menus = $moduleobj->menu;
2062 if ($rewriteMenu < 0) {
2063 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Menus"),
"mod".$module.
"class.php"),
null,
'warnings');
2065 reWriteAllMenus($moduledescriptorfile, $menus, $objectname,
null, -1);
2069 $permissions = $moduleobj->rights;
2071 if ($rewritePerms < 0) {
2072 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Permissions"),
"mod".$module.
"class.php"),
null,
'warnings');
2076 if ($rewritePerms && $rewriteMenu) {
2078 $file_doc = $dirins.
'/'.strtolower($module).
'/doc/Documentation.asciidoc';
2081 clearstatcache(
true);
2082 if (function_exists(
'opcache_invalidate')) {
2086 foreach ($filetodelete as $tmpfiletodelete) {
2088 $resulttmp =
dol_delete_file($dir.
'/'.$tmpfiletodelete.
'.back', 0, 0, 1);
2094 if ($resultko == 0) {
2097 setEventMessages($langs->trans(
"ErrorSomeFilesCouldNotBeDeleted"),
null,
'warnings');
2104 $tabobj =
'newobject';
2106 $tabobj =
'deleteobject';
2110 if (isModEnabled(strtolower($module))) {
2116 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
2117 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=objects&tabobj=deleteobject&module='.urlencode($module));
2122if (($dirins && $action ==
'confirm_deletedictionary' && $dicname) || ($dirins && $action ==
'confirm_deletedictionary' &&
GETPOST(
'dictionnarykey')) && $user->hasRight(
"modulebuilder",
"run")) {
2123 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2124 $destdir = $dirins.
'/'.strtolower($module);
2125 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2127 if (preg_match(
'/[^a-z0-9_]/i', $dicname)) {
2129 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
2132 if (!empty($dicname)) {
2133 $newdicname = $dicname;
2134 if (!preg_match(
'/^c_/', $newdicname)) {
2135 $newdicname =
'c_'.strtolower($dicname);
2142 $class =
'mod'.$module;
2144 if (class_exists($class)) {
2146 $moduleobj =
new $class($db);
2147 '@phan-var-force DolibarrModules $moduleobj';
2154 $langs->load(
"errors");
2155 dol_print_error($db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
2159 $dicts = $moduleobj->dictionaries;
2161 if ($checkComment < 0) {
2163 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Dictionaries"),
"mod".$module.
"class.php"),
null,
'warnings');
2166 if (!empty(
GETPOST(
'dictionnarykey'))) {
2167 $newdicname = $dicts[
'tabname'][
GETPOSTINT(
'dictionnarykey') - 1];
2171 $checkTable =
false;
2172 if ($newdicname !==
null) {
2173 $checkTable = $db->DDLDescTable(MAIN_DB_PREFIX.strtolower($newdicname));
2176 if (is_bool($checkTable) || $db->num_rows($checkTable) <= 0) {
2181 $keyToDelete =
null;
2182 foreach ($dicts[
'tabname'] as $key => $table) {
2184 if (strtolower($table) === $newdicname) {
2185 $keyToDelete = $key;
2190 if ($keyToDelete !==
null) {
2191 $keysToDelete = [
'tabname',
'tablib',
'tabsql',
'tabsqlsort',
'tabfield',
'tabfieldvalue',
'tabfieldinsert',
'tabrowid',
'tabcond',
'tabhelp'];
2192 foreach ($keysToDelete as $key) {
2193 unset($dicts[$key][$keyToDelete]);
2197 setEventMessages($langs->trans(
"ErrorDictionaryNotFound", ucfirst($dicname)),
null,
'errors');
2199 if (!$error && $newdicname !==
null) {
2201 $_results = $db->DDLDropTable(MAIN_DB_PREFIX.strtolower($newdicname));
2202 if ($_results < 0) {
2204 $langs->load(
"errors");
2205 setEventMessages($langs->trans(
"ErrorTableNotFound", $newdicname),
null,
'errors');
2210 setEventMessages($langs->trans(
"DictionaryDeleted", ucfirst(substr($newdicname, 2))),
null);
2212 if (function_exists(
'opcache_invalidate')) {
2215 clearstatcache(
true);
2216 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
''));
2220if ($dirins && $action ==
'updatedictionary' &&
GETPOST(
'dictionnarykey') && $user->hasRight(
"modulebuilder",
"run")) {
2221 $keydict =
GETPOSTINT(
'dictionnarykey') - 1 ;
2223 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2224 $destdir = $dirins.
'/'.strtolower($module);
2225 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2227 $class =
'mod'.$module;
2229 if (class_exists($class)) {
2231 $moduleobj =
new $class($db);
2232 '@phan-var-force DolibarrMOdules $moduleobj';
2239 $langs->load(
"errors");
2240 dol_print_error($db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
2244 $dicts = $moduleobj->dictionaries;
2245 if (!empty(
GETPOST(
'tablib')) &&
GETPOST(
'tablib') !== $dicts[
'tablib'][$keydict]) {
2246 $dicts[
'tablib'][$keydict] = ucfirst(strtolower(
GETPOST(
'tablib')));
2248 if ($checkComment < 0) {
2249 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Dictionaries"),
"mod".$module.
"class.php"),
null,
'warnings');
2252 if ($updateDict > 0) {
2255 if (function_exists(
'opcache_invalidate')) {
2258 clearstatcache(
true);
2259 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
''));
2265if ($dirins && $action ==
'generatedoc' && $user->hasRight(
"modulebuilder",
"run")) {
2266 $modulelowercase = strtolower($module);
2271 $FILENAMEDOC = strtolower($module).
'.html';
2273 $util =
new Utils($db);
2274 $result = $util->generateDoc($module);
2277 setEventMessages($langs->trans(
"DocFileGeneratedInto", $dirofmodule),
null);
2283if ($dirins && $action ==
'generatepackage' && $user->hasRight(
"modulebuilder",
"run")) {
2284 $modulelowercase = strtolower($module);
2286 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2296 $class =
'mod'.$module;
2298 if (class_exists($class)) {
2300 $moduleobj =
new $class($db);
2301 '@phan-var-force DolibarrMOdules $moduleobj';
2308 $langs->load(
"errors");
2309 dol_print_error($db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
2313 $arrayversion = explode(
'.', $moduleobj->version, 3);
2314 if (count($arrayversion)) {
2315 $FILENAMEZIP =
"module_".$modulelowercase.
'-'.$arrayversion[0].(empty($arrayversion[1]) ?
'.0' :
'.'.$arrayversion[1]).(empty($arrayversion[2]) ?
'' :
'.'.$arrayversion[2]).
'.zip';
2318 $outputfilezip = $dirofmodule.
'/'.$FILENAMEZIP;
2324 $result = dol_compress_dir($dir, $outputfilezip,
'zip',
'/\/bin\/|\.git|\.old|\.back|\.ssh/', $modulelowercase);
2330 setEventMessages($langs->trans(
"ZipFileGeneratedInto", $outputfilezip),
null);
2333 $langs->load(
"errors");
2334 setEventMessages($langs->trans(
"ErrorFailToGenerateFile", $outputfilezip),
null,
'errors');
2338 $langs->load(
"errors");
2339 setEventMessages($langs->trans(
"ErrorCheckVersionIsDefined"),
null,
'errors');
2344if ($dirins && $action ==
'addright' && !empty($module) && empty($cancel) && $user->hasRight(
"modulebuilder",
"run")) {
2348 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2350 $class =
'mod'.$module;
2352 if (class_exists($class)) {
2354 $moduleobj =
new $class($db);
2355 '@phan-var-force DolibarrModules $moduleobj';
2363 if (!
GETPOST(
'label',
'alpha')) {
2365 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
2367 if (!
GETPOST(
'permissionObj',
'alpha')) {
2369 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Rights")),
null,
'errors');
2373 $label =
GETPOST(
'label',
'alpha');
2374 $objectForPerms = strtolower(
GETPOST(
'permissionObj',
'alpha'));
2375 $crud =
GETPOST(
'crud',
'alpha');
2379 $permsForObject = array();
2380 if (is_object($moduleobj)) {
2381 $permissions = $moduleobj->rights;
2383 $permissions = array();
2385 $allObject = array();
2387 $countPerms = count($permissions);
2389 for ($i = 0; $i < $countPerms; $i++) {
2390 if ($permissions[$i][4] == $objectForPerms) {
2392 if (count($permsForObject) < 3) {
2393 $permsForObject[] = $permissions[$i];
2396 $allObject[] = $permissions[$i][4];
2400 $countPermsObj = count($permsForObject);
2401 for ($j = 0; $j < $countPermsObj; $j++) {
2402 if (in_array($crud, $permsForObject[$j])) {
2404 setEventMessages($langs->trans(
"ErrorExistingPermission", $langs->transnoentities($crud), $langs->transnoentities($objectForPerms)),
null,
'errors');
2408 $rightToAdd = array();
2410 $key = $countPerms + 1;
2412 $rightToAdd = array(
2415 4 => $objectForPerms,
2419 if (isModEnabled(strtolower($module))) {
2425 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
2428 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2432 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Permissions"),
"mod".$module.
"class.php"),
null,
'warnings');
2437 clearstatcache(
true);
2438 if (function_exists(
'opcache_invalidate')) {
2441 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=permissions&module='.$module);
2448if ($dirins &&
GETPOST(
'action') ==
'update_right' &&
GETPOST(
'modifyright') && empty($cancel) && $user->hasRight(
"modulebuilder",
"run")) {
2451 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2453 $class =
'mod'.$module;
2455 if (class_exists($class)) {
2457 $moduleobj =
new $class($db);
2458 '@phan-var-force DolibarrModules $moduleobj';
2465 if (!
GETPOST(
'label',
'alpha')) {
2467 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
2469 if (!
GETPOST(
'permissionObj',
'alpha')) {
2471 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Rights")),
null,
'errors');
2474 $label =
GETPOST(
'label',
'alpha');
2475 $objectForPerms = strtolower(
GETPOST(
'permissionObj',
'alpha'));
2476 $crud =
GETPOST(
'crud',
'alpha');
2479 if ($label ==
"Read objects of $module" && $crud !=
"read") {
2483 if ($label ==
"Create/Update objects of $module" && $crud !=
"write") {
2487 if ($label ==
"Delete objects of $module" && $crud !=
"delete") {
2492 if (is_object($moduleobj)) {
2493 $permissions = $moduleobj->rights;
2499 if (array_key_exists($key, $permissions)) {
2500 $x1 = $permissions[$key][1];
2501 $x2 = $permissions[$key][4];
2502 $x3 = $permissions[$key][5];
2510 $permsForObject = array();
2514 $allObject = array();
2516 $countPerms = count($permissions);
2517 for ($i = 0; $i < $countPerms; $i++) {
2518 if ($permissions[$i][4] == $objectForPerms) {
2520 if (count($permsForObject) < 3) {
2521 $permsForObject[] = $permissions[$i];
2524 $allObject[] = $permissions[$i][4];
2527 if ($label != $x1 && $crud != $x3) {
2528 $countPermsObj = count($permsForObject);
2529 for ($j = 0; $j < $countPermsObj; $j++) {
2530 if (in_array($label, $permsForObject[$j])) {
2532 setEventMessages($langs->trans(
"ErrorExistingPermission", $langs->transnoentities($label), $langs->transnoentities($objectForPerms)),
null,
'errors');
2538 if (isModEnabled(strtolower($module))) {
2544 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
2547 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2551 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Permissions"),
"mod".$module.
"class.php"),
null,
'warnings');
2553 $rightUpdated =
null;
2556 clearstatcache(
true);
2557 if (function_exists(
'opcache_invalidate')) {
2560 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=permissions&module='.$module);
2566if ($dirins && $action ==
'confirm_deleteright' && !empty($module) &&
GETPOSTINT(
'permskey') && $user->hasRight(
"modulebuilder",
"run")) {
2569 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2571 $class =
'mod'.$module;
2573 if (class_exists($class)) {
2575 $moduleobj =
new $class($db);
2576 '@phan-var-force DolibarrMOdules $moduleobj';
2583 $permissions = $moduleobj->rights;
2588 if (isModEnabled(strtolower($module))) {
2594 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
2595 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=permissions&module='.$module);
2600 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2603 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Permissions"),
"mod".$module.
"class.php"),
null,
'warnings');
2608 clearstatcache(
true);
2609 if (function_exists(
'opcache_invalidate')) {
2613 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=permissions&module='.$module);
2619if ($action ==
'savefile' && empty($cancel) && $user->hasRight(
"modulebuilder",
"run")) {
2620 $relofcustom = basename($dirins);
2624 if (!preg_match(
'/^'.$relofcustom.
'/', $file)) {
2625 $file = $relofcustom.
'/'.$file;
2633 dol_copy($pathoffile, $pathoffilebackup,
'0', 1);
2636 $check =
'restricthtml';
2638 if ($srclang ==
'md') {
2639 $check =
'restricthtml';
2641 if ($srclang ==
'lang') {
2642 $check =
'restricthtml';
2644 if ($srclang ==
'php') {
2648 $content =
GETPOST(
'editfilecontent', $check);
2653 $result = file_put_contents($pathoffile, $content);
2670if ($action ==
'set' && $user->admin && $user->hasRight(
"modulebuilder",
"run")) {
2673 $param .=
'&module='.urlencode($module);
2676 $param .=
'&tab='.urlencode($tab);
2679 $param .=
'&tabobj='.urlencode($tabobj);
2682 $value =
GETPOST(
'value',
'alpha');
2684 if (!empty($resarray[
'errors'])) {
2688 if ($resarray[
'nbperms'] > 0) {
2689 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
2690 $resqltmp = $db->query($tmpsql);
2692 $obj = $db->fetch_object($resqltmp);
2694 if ($obj && $obj->nb > 1) {
2695 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
2703 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?".$param);
2708if ($action ==
'reset' && $user->admin && $user->hasRight(
"modulebuilder",
"run")) {
2711 $param .=
'&module='.urlencode($module);
2714 $param .=
'&tab='.urlencode($tab);
2717 $param .=
'&tabobj='.urlencode($tabobj);
2720 $value =
GETPOST(
'value',
'alpha');
2725 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?".$param);
2730if ($dirins && $action ==
'confirm_deletemenu' &&
GETPOSTINT(
'menukey') && $user->hasRight(
"modulebuilder",
"run")) {
2732 if (isModEnabled(strtolower($module))) {
2738 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
2739 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
2743 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2745 $class =
'mod'.$module;
2747 if (class_exists($class)) {
2749 $moduleobj =
new $class($db);
2750 '@phan-var-force DolibarrMOdules $moduleobj';
2757 $dir = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
2758 $destdir = $dir.
'/'.strtolower($module);
2760 $result = array_map(
'strtolower', $objects);
2762 $menus = $moduleobj->menu;
2764 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2767 if ($checkcomment < 0) {
2768 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Menus"),
"mod".$module.
"class.php"),
null,
'warnings');
2770 if ($menus[$key][
'fk_menu'] ===
'fk_mainmenu='.strtolower($module)) {
2771 if (in_array(strtolower($menus[$key][
'leftmenu']), $result)) {
2772 reWriteAllMenus($moduledescriptorfile, $menus, $menus[$key][
'leftmenu'], $key, -1);
2780 clearstatcache(
true);
2781 if (function_exists(
'opcache_invalidate')) {
2786 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
2792if ($dirins && $action ==
'addmenu' && empty($cancel) && $user->hasRight(
"modulebuilder",
"run")) {
2794 if (isModEnabled(strtolower($module))) {
2800 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
2801 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
2807 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2809 $class =
'mod'.$module;
2811 if (class_exists($class)) {
2813 $moduleobj =
new $class($db);
2814 '@phan-var-force DolibarrMOdules $moduleobj';
2821 $menus = $moduleobj->menu;
2824 if (!
GETPOST(
'type',
'alpha')) {
2826 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Type")),
null,
'errors');
2828 if (!
GETPOST(
'titre',
'alpha')) {
2830 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Title")),
null,
'errors');
2832 if (!
GETPOST(
'user',
'alpha')) {
2834 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"DetailUser")),
null,
'errors');
2836 if (!
GETPOST(
'url',
'alpha')) {
2838 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Url")),
null,
'errors');
2840 if (!empty(
GETPOST(
'target'))) {
2841 $targets = array(
'_blank',
'_self',
'_parent',
'_top',
'');
2842 if (!in_array(
GETPOST(
'target'), $targets)) {
2844 setEventMessages($langs->trans(
"ErrorFieldValue", $langs->transnoentities(
"target")),
null,
'errors');
2851 foreach ($menus as $menu) {
2854 setEventMessages($langs->trans(
"ErrorFieldExist", $langs->transnoentities(
"url")),
null,
'errors');
2857 if (strtolower(
GETPOST(
'titre')) == strtolower($menu[
'titre'])) {
2859 setEventMessages($langs->trans(
"ErrorFieldExist", $langs->transnoentities(
"titre")),
null,
'errors');
2864 if (
GETPOST(
'type',
'alpha') ==
'left' && !empty(
GETPOST(
'lefmenu',
'alpha'))) {
2865 if (!str_contains(
GETPOST(
'leftmenu'), strtolower($module))) {
2867 setEventMessages($langs->trans(
"WarningFieldsMustContains", $langs->transnoentities(
"LeftmenuId")),
null,
'errors');
2870 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
2871 $destdir = $dirins.
'/'.strtolower($module);
2874 if (
GETPOST(
'type',
'alpha') ==
'left') {
2875 if (empty(
GETPOST(
'leftmenu')) && count($objects) > 0) {
2877 setEventMessages($langs->trans(
"ErrorCoherenceMenu", $langs->transnoentities(
"LeftmenuId"), $langs->transnoentities(
"type")),
null,
'errors');
2880 if (
GETPOST(
'type',
'alpha') ==
'top') {
2882 setEventMessages($langs->trans(
"ErrorTypeMenu", $langs->transnoentities(
"type")),
null,
'errors');
2885 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2889 'fk_menu' =>
GETPOST(
'fk_menu',
'alpha'),
2890 'type' =>
GETPOST(
'type',
'alpha'),
2891 'titre' => ucfirst(
GETPOST(
'titre',
'alpha')),
2893 'mainmenu' =>
GETPOST(
'mainmenu',
'alpha'),
2894 'leftmenu' =>
GETPOST(
'leftmenu',
'alpha'),
2895 'url' =>
GETPOST(
'url',
'alpha'),
2896 'langs' => strtolower($module).
"@".strtolower($module),
2898 'enabled' =>
GETPOST(
'enabled',
'alpha'),
2899 'perms' =>
'$user->hasRight("'.strtolower($module).
'", "'.
GETPOST(
'objects',
'alpha').
'", "'.
GETPOST(
'perms',
'alpha').
'")',
2900 'target' =>
GETPOST(
'target',
'alpha'),
2901 'user' =>
GETPOST(
'user',
'alpha'),
2904 if (
GETPOST(
'type') ==
'left') {
2905 unset($menuToAdd[
'prefix']);
2906 if (empty(
GETPOST(
'fk_menu'))) {
2907 $menuToAdd[
'fk_menu'] =
'fk_mainmenu='.GETPOST(
'mainmenu',
'alpha');
2909 $menuToAdd[
'fk_menu'] =
'fk_mainmenu='.GETPOST(
'mainmenu',
'alpha').
',fk_leftmenu='.
GETPOST(
'fk_menu');
2912 if (
GETPOST(
'enabled') ==
'1') {
2913 $menuToAdd[
'enabled'] =
'isModEnabled("'.strtolower($module).
'")';
2915 $menuToAdd[
'enabled'] =
"0";
2917 if (empty(
GETPOST(
'objects'))) {
2918 $menuToAdd[
'perms'] =
'1';
2922 if ($checkcomment < 0) {
2923 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Menus"),
"mod".$module.
"class.php"),
null,
'warnings');
2926 $result =
reWriteAllMenus($moduledescriptorfile, $menus, $menuToAdd,
null, 1);
2928 clearstatcache(
true);
2929 if (function_exists(
'opcache_invalidate')) {
2938 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
2946if ($dirins && $action ==
"update_menu" &&
GETPOSTINT(
'menukey') &&
GETPOST(
'tabobj') && $user->hasRight(
"modulebuilder",
"run")) {
2947 $objectname =
GETPOST(
'tabobj');
2948 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
2949 $destdir = $dirins.
'/'.strtolower($module);
2952 if (empty($cancel)) {
2953 if (isModEnabled(strtolower($module))) {
2959 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
2960 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
2965 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2967 $class =
'mod'.$module;
2969 if (class_exists($class)) {
2971 $moduleobj =
new $class($db);
2972 '@phan-var-force DolibarrMOdules $moduleobj';
2978 $menus = $moduleobj->menu;
2981 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2983 $menuModify = array(
2984 'fk_menu' =>
GETPOST(
'fk_menu',
'alpha'),
2985 'type' =>
GETPOST(
'type',
'alpha'),
2986 'titre' => ucfirst(
GETPOST(
'titre',
'alpha')),
2987 'mainmenu' =>
GETPOST(
'mainmenu',
'alpha'),
2988 'leftmenu' => $menus[$key][
'leftmenu'],
2989 'url' =>
GETPOST(
'url',
'alpha'),
2990 'langs' => strtolower($module).
"@".strtolower($module),
2992 'enabled' =>
GETPOST(
'enabled',
'alpha'),
2993 'perms' =>
GETPOST(
'perms',
'alpha'),
2994 'target' =>
GETPOST(
'target',
'alpha'),
2995 'user' =>
GETPOST(
'user',
'alpha'),
2997 if (!empty(
GETPOST(
'fk_menu')) &&
GETPOST(
'fk_menu') != $menus[$key][
'fk_menu']) {
2998 $menuModify[
'fk_menu'] =
'fk_mainmenu='.GETPOST(
'mainmenu').
',fk_leftmenu='.
GETPOST(
'fk_menu');
2999 } elseif (
GETPOST(
'fk_menu') == $menus[$key][
'fk_menu']) {
3000 $menuModify[
'fk_menu'] = $menus[$key][
'fk_menu'];
3002 $menuModify[
'fk_menu'] =
'fk_mainmenu='.GETPOST(
'mainmenu');
3004 if ($menuModify[
'enabled'] ===
'') {
3005 $menuModify[
'enabled'] =
'1';
3007 if ($menuModify[
'perms'] ===
'') {
3008 $menuModify[
'perms'] =
'1';
3011 if (
GETPOST(
'type',
'alpha') ==
'top') {
3013 setEventMessages($langs->trans(
"ErrorTypeMenu", $langs->transnoentities(
"type")),
null,
'errors');
3020 if ($checkComment < 0) {
3021 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Menus"),
"mod".$module.
"class.php"),
null,
'warnings');
3024 $result =
reWriteAllMenus($moduledescriptorfile, $menus, $menuModify, $key, 2);
3026 clearstatcache(
true);
3027 if (function_exists(
'opcache_invalidate')) {
3034 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?action=editmenu&token='.
newToken().
'&menukey='.urlencode((
string) ($key + 1)).
'&tab='.urlencode((
string) ($tab)).
'&module='.urlencode((
string) ($module)).
'&tabobj='.($key + 1));
3039 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
3044 $_POST[
'type'] =
'';
3045 $_POST[
'titre'] =
'';
3046 $_POST[
'fk_menu'] =
'';
3047 $_POST[
'leftmenu'] =
'';
3053if ($dirins && $action ==
"update_props_module" && !empty(
GETPOST(
'keydescription',
'alpha')) && empty($cancel) && $user->hasRight(
"modulebuilder",
"run")) {
3054 if (isModEnabled(strtolower($module))) {
3060 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
3061 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
3064 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3065 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
3066 $modulelogfile = $dirins.
'/'.strtolower($module).
'/ChangeLog.md';
3070 $class =
'mod'.$module;
3072 if (class_exists($class)) {
3074 $moduleobj =
new $class($db);
3075 '@phan-var-force DolibarrMOdules $moduleobj';
3082 $keydescription =
GETPOST(
'keydescription',
'alpha');
3083 switch ($keydescription) {
3085 $propertyToUpdate =
'description';
3092 $propertyToUpdate = $keydescription;
3095 $error =
GETPOST(
'keydescription');
3099 if (isset($propertyToUpdate) && !empty(
GETPOST(
'propsmodule'))) {
3100 $newValue =
GETPOST(
'propsmodule');
3101 $lineToReplace =
"\t\t\$this->$propertyToUpdate = ";
3102 $newLine =
"\t\t\$this->$propertyToUpdate = '$newValue';\n";
3105 if ($propertyToUpdate ===
'version') {
3106 dolReplaceInFile($modulelogfile, array(
"## ".$moduleobj->$propertyToUpdate => $newValue));
3109 $fileLines = file($moduledescriptorfile);
3110 foreach ($fileLines as &$line) {
3111 if (strpos($line, $lineToReplace) === 0) {
3117 clearstatcache(
true);
3118 if (function_exists(
'opcache_invalidate')) {
3121 setEventMessages($langs->trans(
'PropertyModuleUpdated', $propertyToUpdate),
null);
3122 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=description&module='.$module);
3132$form =
new Form($db);
3143 '/includes/ace/src/ace.js',
3144 '/includes/ace/src/ext-statusbar.js',
3145 '/includes/ace/src/ext-language_tools.js',
3150llxHeader(
'', $langs->trans(
"ModuleBuilder"), $help_url,
'', 0, 0, $morejs, $morecss,
'',
'classforhorizontalscrolloftabs');
3153$text = $langs->trans(
"ModuleBuilder");
3157print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ModuleBuilderDesc",
'https://wiki.dolibarr.org/index.php/Module_development#Create_your_module').
'</span>';
3158print
'<br class="hideonsmartphone">';
3167 $message =
info_admin($langs->trans(
"ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.
'/custom', DOL_DOCUMENT_ROOT));
3172 $langs->load(
"errors");
3173 $message =
info_admin($langs->trans(
"ErrorFailedToWriteInDir", $dirins));
3177 $message =
info_admin($langs->trans(
"NotExistsDirect", $dirins).$langs->trans(
"InfDirAlt").$langs->trans(
"InfDirExample"));
3186$infomodulesfound =
'<div style="padding: 12px 9px 12px">'.$form->textwithpicto(
'', $langs->trans(
"ModuleBuilderDesc3", count($listofmodules)).
'<br><br>'.$langs->trans(
"ModuleBuilderDesc4", $FILEFLAG).
'<br>'.$textforlistofdirs).
'</div>';
3190$dolibarrdataroot = preg_replace(
'/([\\/]+)$/i',
'', DOL_DATA_ROOT);
3191$allowonlineinstall =
true;
3192if (
dol_is_file($dolibarrdataroot.
'/installmodules.lock')) {
3193 $allowonlineinstall =
false;
3195if (empty($allowonlineinstall)) {
3198 $message =
info_admin($langs->trans(
'InstallModuleFromWebHasBeenDisabledContactUs'));
3201 $message =
info_admin($langs->trans(
"InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.
'/installmodules.lock'), 0, 0,
'1',
'warning');
3216if (!empty($module) && $module !=
'initmodule' && $module !=
'deletemodule') {
3217 $modulelowercase = strtolower($module);
3218 $loadclasserrormessage =
'';
3222 $fullpathdirtodescriptor = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3227 $class =
'mod'.$module;
3228 }
catch (Throwable $e) {
3229 $loadclasserrormessage = $e->getMessage().
"<br>\n";
3230 $loadclasserrormessage .=
'File: '.$e->getFile().
"<br>\n";
3231 $loadclasserrormessage .=
'Line: '.$e->getLine().
"<br>\n";
3235 if (class_exists($class)) {
3237 $moduleobj =
new $class($db);
3238 '@phan-var-force DolibarrMOdules $moduleobj';
3241 print $e->getMessage();
3244 if (empty($forceddirread)) {
3247 $langs->load(
"errors");
3248 print
'<!-- ErrorFailedToLoadModuleDescriptorForXXX -->';
3249 print
img_warning(
'').
' '.$langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module).
'<br>';
3250 print $loadclasserrormessage;
3261$head[$h][0] = $_SERVER[
"PHP_SELF"].
'?module=initmodule';
3262$head[$h][1] =
'<span class="valignmiddle text-plus-circle">'.$langs->trans(
"NewModule").
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
3263$head[$h][2] =
'initmodule';
3266$linktoenabledisable =
'';
3268if (is_array($listofmodules) && count($listofmodules) > 0) {
3270 $modulelowercase = strtolower($module);
3274 $param .=
'&tab='.urlencode($tab);
3277 $param .=
'&module='.urlencode($module);
3280 $param .=
'&tabobj='.urlencode($tabobj);
3283 $urltomodulesetup =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?search_keyword='.urlencode($module).
'">'.$langs->trans(
'Home').
'-'.$langs->trans(
"Setup").
'-'.$langs->trans(
"Modules").
'</a>';
3286 if (isModEnabled($modulelowercase)) {
3287 $linktoenabledisable .=
'<a class="reposition asetresetmodule valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$moduleobj->numero.
'&action=reset&token='.
newToken().
'&value=mod'.$module.$param.
'">';
3288 $linktoenabledisable .=
img_picto($langs->trans(
"Activated"),
'switch_on',
'', 0, 0, 0,
'',
'', 1);
3289 $linktoenabledisable .=
'</a>';
3291 $linktoenabledisable .= $form->textwithpicto(
'', $langs->trans(
"Warning").
' : '.$langs->trans(
"ModuleIsLive"), -1,
'warning');
3293 $objMod = $moduleobj;
3294 $backtourlparam =
'';
3295 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'module='.$module;
3297 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'tab='.$tab;
3299 $backtourl = $_SERVER[
"PHP_SELF"].$backtourlparam;
3302 if (is_array($objMod->config_page_url)) {
3304 foreach ($objMod->config_page_url as $page) {
3307 $linktoenabledisable .=
' <a href="'.$urlpage.
'" title="'.$langs->trans($page).
'">'.
img_picto(ucfirst($page),
"setup").
'</a>';
3310 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
3311 $urltouse =
dol_buildpath(
'/'.$regs[2].
'/admin/'.$regs[1], 1);
3312 $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>';
3316 $urltouse = DOL_URL_ROOT.
'/admin/'.$urlpage;
3317 $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>';
3321 } elseif (preg_match(
'/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) {
3322 $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>';
3325 if (is_object($moduleobj)) {
3326 $linktoenabledisable .=
'<a class="reposition asetresetmodule valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$moduleobj->numero.
'&action=set&token='.
newToken().
'&value=mod'.$module.$param.
'">';
3327 $linktoenabledisable .=
img_picto($langs->trans(
"ModuleIsNotActive", $urltomodulesetup),
'switch_off',
'style="padding-right: 8px"', 0, 0, 0,
'',
'classfortooltip', 1);
3328 $linktoenabledisable .=
"</a>\n";
3333 foreach ($listofmodules as $tmpmodule => $tmpmodulearray) {
3334 $head[$h][0] = $_SERVER[
"PHP_SELF"].
'?module='.$tmpmodulearray[
'modulenamewithcase'].($forceddirread ?
'@'.$dirread :
'');
3335 $head[$h][1] = $tmpmodulearray[
'modulenamewithcase'];
3336 $head[$h][2] = $tmpmodulearray[
'modulenamewithcase'];
3338 if ($tmpmodulearray[
'modulenamewithcase'] == $module) {
3339 $head[$h][4] =
'<span class="inline-block">'.$linktoenabledisable.
'</span>';
3346$head[$h][0] = $_SERVER[
"PHP_SELF"].
'?module=deletemodule';
3347$head[$h][1] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"DangerZone");
3348$head[$h][2] =
'deletemodule';
3354if ($module ==
'initmodule') {
3356 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3357 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3358 print
'<input type="hidden" name="action" value="initmodule">';
3359 print
'<input type="hidden" name="module" value="initmodule">';
3364 print
'<div class="tagtable">';
3366 print
'<div class="tagtr"><div class="tagtd paddingright">';
3367 print
'<span class="opacitymedium">'.$langs->trans(
"IdModule").
'</span>';
3368 print
'</div><div class="tagtd">';
3369 print
'<input type="text" name="idmodule" class="width75" value="500000" placeholder="'.dol_escape_htmltag($langs->trans(
"IdModule")).
'">';
3370 print
'<span class="opacitymedium">';
3372 print
dolButtonToOpenUrlInDialogPopup(
'popup_modules_id', $langs->transnoentitiesnoconv(
"SeeIDsInUse"), $langs->transnoentitiesnoconv(
"SeeIDsInUse"),
'/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info',
'',
'');
3374 print
'<a href="https://wiki.dolibarr.org/index.php/List_of_modules_id" target="_blank" rel="noopener noreferrer external">'.$langs->trans(
"SeeReservedIDsRangeHere").
'</a>';
3377 print
'</div></div>';
3379 print
'<div class="tagtr"><div class="tagtd paddingright">';
3380 print
'<span class="opacitymedium fieldrequired">'.$langs->trans(
"ModuleName").
'</span>';
3381 print
'</div><div class="tagtd">';
3382 print
'<input type="text" name="modulename" value="'.dol_escape_htmltag($modulename).
'" autofocus>';
3383 print
' '.$form->textwithpicto(
'', $langs->trans(
"EnterNameOfModuleDesc"));
3384 print
'</div></div>';
3386 print
'<div class="tagtr"><div class="tagtd paddingright">';
3387 print
'<span class="opacitymedium">'.$langs->trans(
"Description").
'</span>';
3388 print
'</div><div class="tagtd">';
3389 print
'<input type="text" name="description" value="" class="minwidth500"><br>';
3390 print
'</div></div>';
3392 print
'<div class="tagtr"><div class="tagtd paddingright">';
3393 print
'<span class="opacitymedium">'.$langs->trans(
"Version").
'</span>';
3394 print
'</div><div class="tagtd">';
3395 print
'<input type="text" name="version" class="width75" value="'.(GETPOSTISSET(
'version') ?
GETPOST(
'version') :
getDolGlobalString(
'MODULEBUILDER_SPECIFIC_VERSION',
'1.0')).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"Version")).
'">';
3396 print
'</div></div>';
3398 print
'<div class="tagtr"><div class="tagtd paddingright">';
3399 print
'<span class="opacitymedium">'.$langs->trans(
"Family").
'</span>';
3400 print
'</div><div class="tagtd">';
3401 print
'<select name="family" id="family" class="minwidth400">';
3402 $arrayoffamilies = array(
3403 'hr' =>
"ModuleFamilyHr",
3404 'crm' =>
"ModuleFamilyCrm",
3405 'srm' =>
"ModuleFamilySrm",
3406 'financial' =>
'ModuleFamilyFinancial',
3407 'products' =>
'ModuleFamilyProducts',
3408 'projects' =>
'ModuleFamilyProjects',
3409 'ecm' =>
'ModuleFamilyECM',
3410 'technic' =>
'ModuleFamilyTechnic',
3411 'portal' =>
'ModuleFamilyPortal',
3412 'interface' =>
'ModuleFamilyInterface',
3413 'base' =>
'ModuleFamilyBase',
3414 'other' =>
'ModuleFamilyOther'
3416 foreach ($arrayoffamilies as $key => $value) {
3417 print
'<option value="hr"'.($key ==
getDolGlobalString(
'MODULEBUILDER_SPECIFIC_FAMILY',
'other') ?
' selected="selected"' :
'').
' data-html="'.
dol_escape_htmltag($langs->trans($value).
' <span class="opacitymedium">- '.$key.
'</span>').
'">'.$langs->trans($value).
'</option>';
3421 print
'</div></div>';
3423 print
'<div class="tagtr"><div class="tagtd paddingright">';
3424 print
'<span class="opacitymedium">'.$langs->trans(
"Picto").
'</span>';
3425 print
'</div><div class="tagtd">';
3426 print
'<input type="text" name="idpicto" value="'.(GETPOSTISSET(
'idpicto') ?
GETPOST(
'idpicto') :
getDolGlobalString(
'MODULEBUILDER_DEFAULTPICTO',
'fa-file')).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"Picto")).
'">';
3427 print $form->textwithpicto(
'', $langs->trans(
"Example").
': fa-file, fa-globe, ... any font awesome code.<br>Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]');
3428 print
'</div></div>';
3430 print
'<div class="tagtr"><div class="tagtd paddingright">';
3431 print
'<span class="opacitymedium">'.$langs->trans(
"EditorName").
'</span>';
3432 print
'</div><div class="tagtd">';
3433 print
'<input type="text" name="editorname" value="'.(GETPOSTISSET(
'editorname') ?
GETPOST(
'editorname') :
getDolGlobalString(
'MODULEBUILDER_SPECIFIC_EDITOR_NAME', $mysoc->
name)).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"EditorName")).
'"><br>';
3434 print
'</div></div>';
3436 print
'<div class="tagtr"><div class="tagtd paddingright">';
3437 print
'<span class="opacitymedium">'.$langs->trans(
"EditorUrl").
'</span>';
3438 print
'</div><div class="tagtd">';
3439 print
'<input type="text" name="editorurl" value="'.(GETPOSTISSET(
'editorurl') ?
GETPOST(
'editorurl') :
getDolGlobalString(
'MODULEBUILDER_SPECIFIC_EDITOR_URL', $mysoc->url)).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"EditorUrl")).
'"><br>';
3440 print
'</div></div>';
3442 print
'<br><input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans(
"Create")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
3444} elseif ($module ==
'deletemodule') {
3445 print
'<!-- Form to init a module -->'.
"\n";
3446 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="delete">';
3447 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3448 print
'<input type="hidden" name="action" value="confirm_deletemodule">';
3449 print
'<input type="hidden" name="module" value="deletemodule">';
3451 print $langs->trans(
"EnterNameOfModuleToDeleteDesc").
'<br><br>';
3453 print
'<input type="text" name="module" placeholder="'.dol_escape_htmltag($langs->trans(
"ModuleKey")).
'" value="" autofocus>';
3454 print
'<input type="submit" class="button smallpaddingimp" value="'.$langs->trans(
"Delete").
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
3456} elseif (!empty($module)) {
3459 $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
3460 $destdir = $dirread.
'/'.strtolower($module);
3464 $countDictionaries = (!empty($moduleobj->dictionaries) ? count($moduleobj->dictionaries[
'tabname']) : 0);
3465 $countRights = count($moduleobj->rights);
3466 $countMenus = count($moduleobj->menu);
3478 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=description&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3479 $head2[$h][1] = $langs->trans(
"Description");
3480 $head2[$h][2] =
'description';
3483 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3484 $head2[$h][1] = ((!is_array($objects) || count($objects) <= 0) ? $langs->trans(
"Objects") : $langs->trans(
"Objects").
'<span class="marginleftonlyshort badge">'.count($objects).
"</span>");
3485 $head2[$h][2] =
'objects';
3488 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=languages&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3489 $head2[$h][1] = ($countLangs <= 0 ? $langs->trans(
"Languages") : $langs->trans(
"Languages").
'<span class="marginleftonlyshort badge">'.$countLangs.
"</span>");
3490 $head2[$h][2] =
'languages';
3493 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3494 $head2[$h][1] = ($countDictionaries == 0 ? $langs->trans(
"Dictionaries") : $langs->trans(
'Dictionaries').
'<span class="marginleftonlyshort badge">'.$countDictionaries.
"</span>");
3495 $head2[$h][2] =
'dictionaries';
3498 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=permissions&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3499 $head2[$h][1] = ($countRights <= 0 ? $langs->trans(
"Permissions") : $langs->trans(
"Permissions").
'<span class="marginleftonlyshort badge">'.$countRights.
"</span>");
3500 $head2[$h][2] =
'permissions';
3503 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=tabs&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3504 $head2[$h][1] = $langs->trans(
"Tabs");
3505 $head2[$h][2] =
'tabs';
3508 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=menus&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3509 $head2[$h][1] = ($countMenus <= 0 ? $langs->trans(
"Menus") : $langs->trans(
"Menus").
'<span class="marginleftonlyshort badge">'.$countMenus.
"</span>");
3510 $head2[$h][2] =
'menus';
3513 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=hooks&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3514 $head2[$h][1] = $langs->trans(
"Hooks");
3515 $head2[$h][2] =
'hooks';
3518 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=triggers&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3519 $head2[$h][1] = ($countTriggers <= 0 ? $langs->trans(
"Triggers") : $langs->trans(
"Triggers").
'<span class="marginleftonlyshort badge">'.$countTriggers.
"</span>");
3520 $head2[$h][2] =
'triggers';
3523 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=widgets&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3524 $head2[$h][1] = ($countWidgets <= 0 ? $langs->trans(
"Widgets") : $langs->trans(
"Widgets").
'<span class="marginleftonlyshort badge">'.$countWidgets.
"</span>");
3525 $head2[$h][2] =
'widgets';
3528 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=emailings&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3529 $head2[$h][1] = ($countEmailingSelectors <= 0 ? $langs->trans(
"EmailingSelectors") : $langs->trans(
"EmailingSelectors").
'<span class="marginleftonlyshort badge">'.$countEmailingSelectors.
"</span>");
3530 $head2[$h][2] =
'emailings';
3533 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=exportimport&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3534 $head2[$h][1] = $langs->trans(
"Export").
'-'.$langs->trans(
"Import");
3535 $head2[$h][2] =
'exportimport';
3538 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=css&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3539 $head2[$h][1] = ($countCss <= 0 ? $langs->trans(
"CSS") : $langs->trans(
"CSS").
" (".$countCss.
")");
3540 $head2[$h][2] =
'css';
3543 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=js&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3544 $head2[$h][1] = ($countJs <= 0 ? $langs->trans(
"JS") : $langs->trans(
"JS").
'<span class="marginleftonlyshort badge">'.$countJs.
"</span>");
3545 $head2[$h][2] =
'js';
3548 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=cli&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3549 $head2[$h][1] = ($countCLI <= 0 ? $langs->trans(
"CLI") : $langs->trans(
"CLI").
'<span class="marginleftonlyshort badge">'.$countCLI.
"</span>");
3550 $head2[$h][2] =
'cli';
3553 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=cron&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3554 $head2[$h][1] = $langs->trans(
"CronList");
3555 $head2[$h][2] =
'cron';
3558 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=specifications&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3559 $head2[$h][1] = ($hasDoc <= 0 ? $langs->trans(
"Documentation") : $langs->trans(
"Documentation").
'<span class="paddingleft badge">'.$hasDoc.
"</span>");
3560 $head2[$h][2] =
'specifications';
3563 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=buildpackage&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3564 $head2[$h][1] = $langs->trans(
"BuildPackage");
3565 $head2[$h][2] =
'buildpackage';
3568 $MAXTABFOROBJECT = 15;
3570 print
'<!-- Section for a given module -->';
3574 if ($tab ==
'description') {
3575 print
'<!-- tab=description -->'.
"\n";
3576 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3577 $pathtofilereadme = $modulelowercase.
'/README.md';
3578 $pathtochangelog = $modulelowercase.
'/ChangeLog.md';
3580 $realpathofmodule = realpath($dirread.
'/'.$modulelowercase);
3582 if ($action !=
'editfile' || empty($file)) {
3583 $morehtmlright =
'';
3584 if ($realpathofmodule != $dirread.
'/'.$modulelowercase) {
3585 $morehtmlright =
'<div style="padding: 12px 9px 12px">'.$form->textwithpicto(
'',
'<span class="opacitymedium">'.$langs->trans(
"RealPathOfModule").
' :</span> <strong class="wordbreak">'.$realpathofmodule.
'</strong>').
'</div>';
3588 print
dol_get_fiche_head($head2, $tab,
'', -1,
'', 0, $morehtmlright,
'', $MAXTABFOROBJECT,
'formodulesuffix');
3590 print
'<span class="opacitymedium">'.$langs->trans(
"ModuleBuilderDesc".$tab).
'</span>';
3596 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3597 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'&find=DESCRIPTION_FLAG">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3601 $listofsetuppages =
dol_dir_list($realpathofmodule.
'/admin',
'files', 0,
'\.php$');
3602 foreach ($listofsetuppages as $setuppage) {
3605 print
'<span class="fa fa-file"></span> '.$langs->trans(
"SetupFile").
' : ';
3606 print
'<strong class="wordbreak bold"><a href="'.dol_buildpath($modulelowercase.
'/admin/'.$setuppage[
'relativename'], 1).
'" target="_test">'.$modulelowercase.
'/admin/'.$setuppage[
'relativename'].
'</a></strong>';
3607 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($modulelowercase.
'/admin/'.$setuppage[
'relativename']).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3611 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"ReadmeFile").
' : <strong class="wordbreak">'.$pathtofilereadme.
'</strong>';
3612 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=markdown&file='.urlencode($pathtofilereadme).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3615 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"ChangeLog").
' : <strong class="wordbreak">'.$pathtochangelog.
'</strong>';
3616 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=markdown&file='.urlencode($pathtochangelog).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3622 print
load_fiche_titre($form->textwithpicto($langs->trans(
"DescriptorFile"), $langs->transnoentitiesnoconv(
"File").
' '.$pathtofile),
'',
'');
3624 if (is_object($moduleobj)) {
3625 print
'<div class="underbanner clearboth"></div>';
3626 print
'<div class="fichecenter">';
3627 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3628 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3629 print
'<input type="hidden" name="action" value="update_props_module">';
3630 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
3631 print
'<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).
'">';
3632 print
'<input type="hidden" name="keydescription" value="'.dol_escape_htmltag(
GETPOST(
'keydescription',
'alpha')).
'">';
3633 print
'<table class="border centpercent">';
3634 print
'<tr class="liste_titre"><td class="titlefield">';
3635 print $langs->trans(
"Parameter");
3637 print $langs->trans(
"Value");
3641 print $langs->trans(
"IdModule");
3643 print $moduleobj->numero;
3644 print
'<span class="opacitymedium">';
3646 print
dolButtonToOpenUrlInDialogPopup(
'popup_modules_id', $langs->transnoentitiesnoconv(
"SeeIDsInUse"), $langs->transnoentitiesnoconv(
"SeeIDsInUse"),
'/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info',
'',
'');
3647 print
' - <a href="https://wiki.dolibarr.org/index.php/List_of_modules_id" target="_blank" rel="noopener noreferrer external">'.$langs->trans(
"SeeReservedIDsRangeHere").
'</a>)';
3652 print $langs->trans(
"ModuleName");
3654 print $moduleobj->getName();
3658 print $langs->trans(
"Description");
3660 if ($action ==
'edit_moduledescription' &&
GETPOST(
'keydescription',
'alpha') ===
'desc') {
3661 print
'<input class="minwidth500" name="propsmodule" value="'.dol_escape_htmltag($moduleobj->description).
'">';
3662 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifydesc" value="'.$langs->trans(
"Modify").
'"/>';
3663 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
3665 print $moduleobj->description;
3666 print
'<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit_moduledescription&token='.
newToken().
'&tab='.urlencode($tab).
'&module='.urlencode($module).
'&keydescription=desc">'.
img_edit().
'</a>';
3668 $moduledescritpionautotrans = $moduleobj->getDesc();
3669 if ($moduledescritpionautotrans !=
"Module".$moduleobj->name.
"Desc") {
3671 print
' '.$form->textwithpicto(
'', $langs->trans(
"ModuleTranslatedIntoLangForKeyInto",
"Module".$moduleobj->name.
"Desc", $moduledescritpionautotrans));
3672 } elseif ($moduledescritpionautotrans !=
"Module".$moduleobj->numero.
"Desc") {
3674 print
' '.$form->textwithpicto(
'', $langs->trans(
"ModuleTranslatedIntoLangForKeyInto",
"Module".$moduleobj->numero.
"Desc", $moduledescritpionautotrans));
3680 print $langs->trans(
"Version");
3682 if ($action ==
'edit_moduledescription' &&
GETPOST(
'keydescription',
'alpha') ===
'version') {
3683 print
'<input name="propsmodule" value="'.dol_escape_htmltag($moduleobj->getVersion()).
'">';
3684 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifyversion" value="'.$langs->trans(
"Modify").
'"/>';
3685 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
3687 print $moduleobj->getVersion();
3688 print
'<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit_moduledescription&token='.
newToken().
'&tab='.urlencode($tab).
'&module='.urlencode($module).
'&keydescription=version">'.
img_edit().
'</a>';
3693 print $langs->trans(
"Family");
3696 if ($action ==
'edit_moduledescription' &&
GETPOST(
'keydescription',
'alpha') ===
'family') {
3697 print
'<select name="propsmodule" id="family" class="minwidth400">';
3698 $arrayoffamilies = array(
3699 'hr' =>
"ModuleFamilyHr",
3700 'crm' =>
"ModuleFamilyCrm",
3701 'srm' =>
"ModuleFamilySrm",
3702 'financial' =>
'ModuleFamilyFinancial',
3703 'products' =>
'ModuleFamilyProducts',
3704 'projects' =>
'ModuleFamilyProjects',
3705 'ecm' =>
'ModuleFamilyECM',
3706 'technic' =>
'ModuleFamilyTechnic',
3707 'portal' =>
'ModuleFamilyPortal',
3708 'interface' =>
'ModuleFamilyInterface',
3709 'base' =>
'ModuleFamilyBase',
3710 'other' =>
'ModuleFamilyOther'
3712 print
'<option value="'.$moduleobj->family.
'" data-html="'.
dol_escape_htmltag($langs->trans($arrayoffamilies[$moduleobj->family]).
' <span class="opacitymedium">- '.$moduleobj->family.
'</span>').
'">'.$langs->trans($arrayoffamilies[$moduleobj->family]).
'</option>';
3713 foreach ($arrayoffamilies as $key => $value) {
3714 if ($key != $moduleobj->family) {
3715 print
'<option value="'.$key.
'" data-html="'.
dol_escape_htmltag($langs->trans($value).
' <span class="opacitymedium">- '.$key.
'</span>').
'">'.$langs->trans($value).
'</option>';
3719 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifyfamily" value="'.$langs->trans(
"Modify").
'"/>';
3720 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
3722 print $moduleobj->family;
3723 print
'<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit_moduledescription&token='.
newToken().
'&tab='.urlencode($tab).
'&module='.urlencode($module).
'&keydescription=family">'.
img_edit().
'</a>';
3728 print $langs->trans(
"Picto");
3730 if ($action ==
'edit_modulepicto' &&
GETPOST(
'keydescription',
'alpha') ===
'picto') {
3731 print
'<input class="minwidth500" name="propsmodule" value="'.dol_escape_htmltag($moduleobj->picto).
'">';
3732 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifypicto" value="'.$langs->trans(
"Modify").
'"/>';
3733 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
3735 print $moduleobj->picto;
3736 print
' '.img_picto(
'', $moduleobj->picto,
'class="valignmiddle pictomodule paddingrightonly"');
3737 print
'<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit_modulepicto&token='.
newToken().
'&tab='.urlencode($tab).
'&module='.urlencode($module).
'&keydescription=picto">'.
img_edit().
'</a>';
3742 print $langs->trans(
"EditorName");
3744 if ($action ==
'edit_moduledescription' &&
GETPOST(
'keydescription',
'alpha') ===
'editor_name') {
3745 print
'<input name="propsmodule" value="'.dol_escape_htmltag($moduleobj->editor_name).
'">';
3746 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifyname" value="'.$langs->trans(
"Modify").
'"/>';
3747 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
3749 print $moduleobj->editor_name;
3750 print
'<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit_moduledescription&token='.
newToken().
'&tab='.urlencode($tab).
'&module='.urlencode($module).
'&keydescription=editor_name">'.
img_edit().
'</a>';
3755 print $langs->trans(
"EditorUrl");
3757 if ($action ==
'edit_moduledescription' &&
GETPOST(
'keydescription',
'alpha') ===
'editor_url') {
3758 print
'<input name="propsmodule" value="'.dol_escape_htmltag($moduleobj->editor_url).
'">';
3759 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifyeditorurl" value="'.$langs->trans(
"Modify").
'"/>';
3760 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
3762 if (!empty($moduleobj->editor_url)) {
3763 print
'<a href="'.$moduleobj->editor_url.
'" target="_blank" rel="noopener">'.$moduleobj->editor_url.
' '.
img_picto(
'',
'globe').
'</a>';
3765 print
'<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit_moduledescription&token='.
newToken().
'&tab='.urlencode($tab).
'&module='.urlencode($module).
'&keydescription=editor_url">'.
img_edit().
'</a>';
3772 print $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module).
'<br>';
3775 if (!empty($moduleobj)) {
3779 print
load_fiche_titre($form->textwithpicto($langs->trans(
"ReadmeFile"), $langs->transnoentitiesnoconv(
"File").
' '.$pathtofilereadme),
'',
'');
3781 print
'<!-- readme file -->';
3782 if (
dol_is_file($dirread.
'/'.$pathtofilereadme)) {
3783 print
'<div class="underbanner clearboth"></div><div class="fichecenter">'.$moduleobj->getDescLong().
'</div>';
3785 print
'<span class="opacitymedium">'.$langs->trans(
"ErrorFileNotFound", $pathtofilereadme).
'</span>';
3791 print
load_fiche_titre($form->textwithpicto($langs->trans(
"ChangeLog"), $langs->transnoentitiesnoconv(
"File").
' '.$pathtochangelog),
'',
'');
3793 print
'<!-- changelog file -->';
3795 print
'<div class="underbanner clearboth"></div><div class="fichecenter">'.$moduleobj->getChangeLog().
'</div>';
3797 print
'<span class="opacitymedium">'.$langs->trans(
"ErrorFileNotFound", $pathtochangelog).
'</span>';
3805 if ($fullpathoffile) {
3806 $content = file_get_contents($fullpathoffile);
3810 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3811 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3812 print
'<input type="hidden" name="action" value="savefile">';
3813 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3814 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3815 print
'<input type="hidden" name="module" value="'.$module.
'">';
3819 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
3820 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
3821 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
3826 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3828 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3834 print
dol_get_fiche_head($head2, $tab,
'', -1,
'', 0,
'',
'', $MAXTABFOROBJECT,
'formodulesuffix');
3837 if ($tab ==
'languages') {
3838 print
'<!-- tab=languages -->'.
"\n";
3839 if ($action !=
'editfile' || empty($file)) {
3840 print
'<span class="opacitymedium">'.$langs->trans(
"LanguageDefDesc").
'</span><br>';
3844 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3845 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3846 print
'<input type="hidden" name="action" value="addlanguage">';
3847 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3848 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3849 print
'<input type="hidden" name="module" value="'.$module.
'">';
3850 print $formadmin->select_language(
getDolGlobalString(
'MAIN_LANG_DEFAULT'),
'newlangcode', 0, array(), 1, 0, 0,
'minwidth300', 1);
3851 print
'<input type="submit" name="addlanguage" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans(
"AddLanguageFile")).
'"><br>';
3857 $modulelowercase = strtolower($module);
3861 $diroflang .=
'/langs';
3862 $langfiles =
dol_dir_list($diroflang,
'files', 1,
'\.lang$');
3864 if (!preg_match(
'/custom/', $dirread)) {
3866 $diroflang = $dirread;
3867 $diroflang .=
'/langs';
3868 $langfiles =
dol_dir_list($diroflang,
'files', 1, $modulelowercase.
'\.lang$');
3871 print
'<table class="none">';
3872 foreach ($langfiles as $langfile) {
3873 $pathtofile = $modulelowercase.
'/langs/'.$langfile[
'relativename'];
3874 if (!preg_match(
'/custom/', $dirread)) {
3875 $pathtofile =
'langs/'.$langfile[
'relativename'];
3877 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"LanguageFile").
' '.basename(dirname($pathtofile)).
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3878 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=ini&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3879 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
3890 $content = file_get_contents($fullpathoffile);
3893 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3894 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3895 print
'<input type="hidden" name="action" value="savefile">';
3896 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
3897 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
3898 print
'<input type="hidden" name="module" value="'.$module.
'">';
3900 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
3901 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'text'));
3904 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
3906 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
3913 if ($tab ==
'objects') {
3914 print
'<!-- tab=objects -->'.
"\n";
3919 $dir = $dirread.
'/'.$modulelowercase.
'/class';
3921 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj=newobject';
3922 $head3[$h][1] =
'<span class="valignmiddle text-plus-circle">'.$langs->trans(
"NewObjectInModulebuilder").
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
3923 $head3[$h][2] =
'newobject';
3927 $listofobject =
dol_dir_list($dir,
'files', 0,
'\.class\.php$');
3929 $firstobjectname =
'';
3930 foreach ($listofobject as $fileobj) {
3931 if (preg_match(
'/^api_/', $fileobj[
'name'])) {
3934 if (preg_match(
'/^actions_/', $fileobj[
'name'])) {
3938 $tmpcontent = file_get_contents($fileobj[
'fullname']);
3939 if (preg_match(
'/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) {
3941 $objectname = $reg[1];
3942 if (empty($firstobjectname)) {
3943 $firstobjectname = $objectname;
3945 $pictoname =
'generic';
3946 if (preg_match(
'/\$picto\s*=\s*["\']([^"\']+)["\']/', $tmpcontent, $reg)) {
3947 $pictoname = $reg[1];
3950 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj='.$objectname;
3951 $head3[$h][1] =
img_picto(
'', $pictoname,
'class="pictofixedwidth valignmiddle"').$objectname;
3952 $head3[$h][2] = $objectname;
3958 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj=deleteobject';
3959 $head3[$h][1] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"DangerZone");
3960 $head3[$h][2] =
'deleteobject';
3965 if ($tabobj ==
'newobjectifnoobj') {
3966 if ($firstobjectname) {
3967 $tabobj = $firstobjectname;
3969 $tabobj =
'newobject';
3973 print
dol_get_fiche_head($head3, $tabobj,
'', -1,
'', 0,
'',
'', 0,
'forobjectsuffix');
3976 if ($tabobj ==
'newobject') {
3978 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3979 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3980 print
'<input type="hidden" name="action" value="initobject">';
3981 print
'<input type="hidden" name="tab" value="objects">';
3982 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
3984 print
'<span class="opacitymedium">'.$langs->trans(
"EnterNameOfObjectDesc").
'</span><br><br>';
3986 print
'<div class="tagtable">';
3988 print
'<div class="tagtr"><div class="tagtd">';
3989 print
'<span class="opacitymedium">'.$langs->trans(
"ObjectKey").
'</span> ';
3990 print
'</div><div class="tagtd">';
3991 print
'<input type="text" name="objectname" maxlength="64" value="'.dol_escape_htmltag(GETPOSTISSET(
'objectname') ?
GETPOST(
'objectname',
'alpha') : $modulename).
'" autofocus>';
3992 print $form->textwithpicto(
'', $langs->trans(
"Example").
': MyObject, ACamelCaseName, ...');
3993 print
'</div></div>';
3995 print
'<div class="tagtr"><div class="tagtd">';
3996 print
'<span class="opacitymedium">'.$langs->trans(
"Picto").
'</span> ';
3997 print
'</div><div class="tagtd">';
3998 print
'<input type="text" name="idpicto" value="fa-file" placeholder="'.dol_escape_htmltag($langs->trans(
"Picto")).
'">';
3999 print $form->textwithpicto(
'', $langs->trans(
"Example").
': fa-file, fa-globe, ... any font awesome code.<br>Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]');
4000 print
'</div></div>';
4002 print
'<div class="tagtr"><div class="tagtd">';
4003 print
'<span class="opacitymedium">'.$langs->trans(
"DefinePropertiesFromExistingTable").
'</span> ';
4004 print
'</div><div class="tagtd">';
4005 print
'<input type="text" name="initfromtablename" value="'.GETPOST(
'initfromtablename').
'" placeholder="'.$langs->trans(
"TableName").
'">';
4006 print $form->textwithpicto(
'', $langs->trans(
"DefinePropertiesFromExistingTableDesc").
'<br>'.$langs->trans(
"DefinePropertiesFromExistingTableDesc2"));
4007 print
'</div></div>';
4012 print
'<input type="checkbox" name="includerefgeneration" id="includerefgeneration" value="includerefgeneration"> <label class="margintoponly" for="includerefgeneration">'.$form->textwithpicto($langs->trans(
"IncludeRefGeneration"), $langs->trans(
"IncludeRefGenerationHelp")).
'</label><br>';
4013 print
'<input type="checkbox" name="includedocgeneration" id="includedocgeneration" value="includedocgeneration"> <label for="includedocgeneration">'.$form->textwithpicto($langs->trans(
"IncludeDocGeneration"), $langs->trans(
"IncludeDocGenerationHelp")).
'</label><br>';
4014 print
'<input type="checkbox" name="generatepermissions" id="generatepermissions" value="generatepermissions"> <label for="generatepermissions">'.$form->textwithpicto($langs->trans(
"GeneratePermissions"), $langs->trans(
"GeneratePermissionsHelp")).
'</label><br>';
4016 print
'<input type="submit" class="button small" name="create" value="'.dol_escape_htmltag($langs->trans(
"GenerateCode")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
4032 } elseif ($tabobj ==
'createproperty') {
4033 $attributesUnique = array(
4034 'proplabel' => $form->textwithpicto($langs->trans(
"Label"), $langs->trans(
"YouCanUseTranslationKey")),
4035 'propname' => $form->textwithpicto($langs->trans(
"Code"), $langs->trans(
"PropertyDesc"), 1,
'help',
'extracss', 0, 3,
'propertyhelp'),
4036 'proptype' => $form->textwithpicto($langs->trans(
"Type"), $langs->trans(
"TypeOfFieldsHelpIntro").
'<br><br>'.$langs->trans(
"TypeOfFieldsHelp"), 1,
'help',
'extracss', 0, 3,
'typehelp'),
4037 'proparrayofkeyval' => $form->textwithpicto($langs->trans(
"ArrayOfKeyValues"), $langs->trans(
"ArrayOfKeyValuesDesc")),
4038 'propnotnull' => $form->textwithpicto($langs->trans(
"NotNull"), $langs->trans(
"NotNullDesc")),
4039 'propdefault' => $langs->trans(
"DefaultValue"),
4040 'propindex' => $langs->trans(
"DatabaseIndex"),
4041 'propforeignkey' => $form->textwithpicto($langs->trans(
"ForeignKey"), $langs->trans(
"ForeignKeyDesc"), 1,
'help',
'extracss', 0, 3,
'foreignkeyhelp'),
4042 'propposition' => $langs->trans(
"Position"),
4043 'propenabled' => $form->textwithpicto($langs->trans(
"Enabled"), $langs->trans(
"EnabledDesc"), 1,
'help',
'extracss', 0, 3,
'enabledhelp'),
4044 'propvisible' => $form->textwithpicto($langs->trans(
"Visibility"), $langs->trans(
"VisibleDesc").
'<br><br>'.$langs->trans(
"ItCanBeAnExpression"), 1,
'help',
'extracss', 0, 3,
'visiblehelp'),
4045 'propnoteditable' => $langs->trans(
"NotEditable"),
4047 'propsearchall' => $form->textwithpicto($langs->trans(
"SearchAll"), $langs->trans(
"SearchAllDesc")),
4048 'propisameasure' => $form->textwithpicto($langs->trans(
"IsAMeasure"), $langs->trans(
"IsAMeasureDesc")),
4049 'propcss' => $langs->trans(
"CSSClass"),
4050 'propcssview' => $langs->trans(
"CSSViewClass"),
4051 'propcsslist' => $langs->trans(
"CSSListClass"),
4052 'prophelp' => $langs->trans(
"KeyForTooltip"),
4053 'propshowoncombobox' => $langs->trans(
"ShowOnCombobox"),
4055 'propcomment' => $langs->trans(
"Comment"),
4057 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?tab=objects&module='.urlencode($module).
'&tabobj=createproperty&obj='.urlencode(
GETPOST(
'obj')).
'" method="POST">';
4058 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4059 print
'<input type="hidden" name="action" value="addproperty">';
4060 print
'<input type="hidden" name="tab" value="objects">';
4061 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4062 print
'<input type="hidden" name="obj" value="'.dol_escape_htmltag(
GETPOST(
'obj')).
'">';
4064 print
'<table class="border centpercent tableforfieldcreate">'.
"\n";
4066 foreach ($attributesUnique as $key => $attribute) {
4067 if ($counter % 2 === 0) {
4070 if ($key ==
'propname' || $key ==
'proplabel') {
4071 print
'<td class="titlefieldcreate fieldrequired">'.$attribute.
'</td><td class="valuefieldcreate maxwidth50"><input class="maxwidth200" id="'.$key.
'" type="text" name="'.$key.
'" value="'.
dol_escape_htmltag(
GETPOST($key,
'alpha')).
'"></td>';
4072 } elseif ($key ==
'proptype') {
4073 print
'<td class="titlefieldcreate fieldrequired">'.$attribute.
'</td><td class="valuefieldcreate maxwidth50">';
4074 print
'<input class="maxwidth200" id="'.$key.
'" list="datalist'.$key.
'" type="text" name="'.$key.
'" value="'.
dol_escape_htmltag(
GETPOST($key,
'alpha')).
'">';
4076 print
'<datalist id="datalist'.$key.
'">';
4077 print
'<option>varchar(128)</option>';
4078 print
'<option>email</option>';
4079 print
'<option>phone</option>';
4080 print
'<option>ip</option>';
4081 print
'<option>url</option>';
4082 print
'<option>password</option>';
4083 print
'<option>text</option>';
4084 print
'<option>html</option>';
4085 print
'<option>date</option>';
4086 print
'<option>datetime</option>';
4087 print
'<option>integer</option>';
4088 print
'<option>stars(5)</option>';
4089 print
'<option>double(28,4)</option>';
4090 print
'<option>real</option>';
4091 print
'<option>integer:ClassName:RelativePath/To/ClassFile.class.php[:1[:FILTER]]</option>';
4100 print
'</datalist>';
4104 } elseif ($key ==
'propvisible') {
4105 print
'<td class="titlefieldcreate">'.$attribute.
'</td><td class="valuefieldcreate"><input class="maxwidth200" type="text" name="'.$key.
'" value="'.
dol_escape_htmltag(GETPOSTISSET($key) ?
GETPOST($key,
'alpha') :
"1").
'"></td>';
4106 } elseif ($key ==
'propenabled') {
4109 print
'<td class="titlefieldcreate">'.$attribute.
'</td><td class="valuefieldcreate"><input class="maxwidth200" type="text" name="'.$key.
'" value="'.
dol_escape_htmltag(GETPOSTISSET($key) ?
GETPOST($key,
'alpha') : $default).
'"></td>';
4110 } elseif ($key ==
'proparrayofkeyval') {
4111 print
'<td class="titlefieldcreate tdproparrayofkeyval">'.$attribute.
'</td><td class="valuefieldcreate"><textarea class="maxwidth200" name="'.$key.
'">'.
dol_escape_htmltag(GETPOSTISSET($key) ?
GETPOST($key,
'alpha') :
"").
'</textarea></td>';
4113 print
'<td class="titlefieldcreate">'.$attribute.
'</td><td class="valuefieldcreate"><input class="maxwidth200" type="text" name="'.$key.
'" value="'.
dol_escape_htmltag(GETPOSTISSET($key) ?
GETPOST($key,
'alpha') :
'').
'"></td>';
4116 if ($counter % 2 === 0) {
4120 if ($counter % 2 !== 0) {
4121 while ($counter % 2 !== 0) {
4127 print
'</table><br>'.
"\n";
4128 print
'<div class="center">';
4129 print
'<input type="submit" class="button button-save" name="add" value="' .
dol_escape_htmltag($langs->trans(
'Create')) .
'">';
4130 print
'<input type="button" class="button button-cancel" name="cancel" value="' .
dol_escape_htmltag($langs->trans(
'Cancel')) .
'" onclick="goBack()">';
4136 var url = "'.$_SERVER[
"PHP_SELF"].
'?tab=objects&module='.urlencode($module).
'";
4137 window.location.href = url;
4139 $(document).ready(function() {
4140 $("#proplabel").on("keyup", function() {
4141 console.log("key up on label");
4142 s = cleanString($("#proplabel").val());
4143 $("#propname").val(s);
4146 function cleanString( stringtoclean )
4148 // allow "a-z", "A-Z", "0-9" and "_"
4149 stringtoclean = stringtoclean.replace(/[^a-z0-9_]+/ig, "");
4150 stringtoclean = stringtoclean.toLowerCase();
4151 if (!isNaN(stringtoclean)) {
4154 while ( stringtoclean.length > 1 && !isNaN( stringtoclean.charAt(0)) ){
4155 stringtoclean = stringtoclean.substr(1)
4157 if (stringtoclean.length > 28) {
4158 stringtoclean = stringtoclean.substring(0, 27);
4160 return stringtoclean;
4165 } elseif ($tabobj ==
'deleteobject') {
4167 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4168 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4169 print
'<input type="hidden" name="action" value="confirm_deleteobject">';
4170 print
'<input type="hidden" name="tab" value="objects">';
4171 print
'<input type="hidden" name="tabobj" value="deleteobject">';
4172 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4174 print $langs->trans(
"EnterNameOfObjectToDeleteDesc").
'<br><br>';
4176 print
'<input type="text" name="objectname" value="" placeholder="'.dol_escape_htmltag($langs->trans(
"ObjectKey")).
'" autofocus>';
4177 print
'<input type="submit" class="button smallpaddingimp" name="delete" value="'.dol_escape_htmltag($langs->trans(
"Delete")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
4181 if ($action ==
'deleteproperty') {
4182 $formconfirm = $form->formconfirm(
4183 $_SERVER[
"PHP_SELF"].
'?propertykey='.urlencode(
GETPOST(
'propertykey',
'alpha')).
'&objectname='.urlencode($objectname).
'&tab='.urlencode($tab).
'&module='.urlencode($module).
'&tabobj='.urlencode($tabobj),
4184 $langs->trans(
'Delete'),
4185 $langs->trans(
'ConfirmDeleteProperty',
GETPOST(
'propertykey',
'alpha')),
4186 'confirm_deleteproperty',
4195 if ($action !=
'editfile' || empty($file)) {
4199 $pathtoclass = strtolower($module).
'/class/'.strtolower($tabobj).
'.class.php';
4200 $pathtoapi = strtolower($module).
'/class/api_'.strtolower($module).
'.class.php';
4201 $pathtoagenda = strtolower($module).
'/'.strtolower($tabobj).
'_agenda.php';
4202 $pathtocard = strtolower($module).
'/'.strtolower($tabobj).
'_card.php';
4203 $pathtodocument = strtolower($module).
'/'.strtolower($tabobj).
'_document.php';
4204 $pathtolist = strtolower($module).
'/'.strtolower($tabobj).
'_list.php';
4205 $pathtonote = strtolower($module).
'/'.strtolower($tabobj).
'_note.php';
4206 $pathtocontact = strtolower($module).
'/'.strtolower($tabobj).
'_contact.php';
4207 $pathtophpunit = strtolower($module).
'/test/phpunit/'.strtolower($tabobj).
'Test.php';
4210 clearstatcache(
true);
4211 if (function_exists(
'opcache_invalidate')) {
4212 opcache_invalidate($dirread.
'/'.$pathtoclass,
true);
4215 if (empty($forceddirread) && empty($dirread)) {
4217 $stringofinclude =
"dol_include_once(".$pathtoclass.
")";
4219 $result = include_once $dirread.
'/'.$pathtoclass;
4220 $stringofinclude =
"@include_once ".$dirread.
'/'.$pathtoclass;
4223 if (class_exists($tabobj)) {
4225 $tmpobject = @
new $tabobj($db);
4227 dol_syslog(
'Failed to load Constructor of class: '.$e->getMessage(), LOG_WARNING);
4230 print
'<span class="warning">'.$langs->trans(
'Failed to find the class '.$tabobj.
' despite the '.$stringofinclude).
'</span><br><br>';
4234 $pathtosql = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'-'.strtolower($module).
'.sql';
4237 $pathtosql = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'.sql';
4240 $pathtosql =
'install/mysql/tables/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'-'.strtolower($module).
'.sql';
4243 $pathtosql =
'install/mysql/tables/llx_'.strtolower($module).
'-'.strtolower($module).
'.sql';
4246 $pathtosql =
'install/mysql/tables/llx_'.strtolower($module).
'.sql';
4247 $pathtosqlextra =
'install/mysql/tables/llx_'.strtolower($module).
'_extrafields.sql';
4250 $pathtosqlextra =
'install/mysql/tables/llx_'.strtolower($module).
'_extrafields-'.strtolower($module).
'.sql';
4253 $pathtosqlextra =
'install/mysql/tables/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields-'.strtolower($module).
'.sql';
4256 $pathtosqlextra = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields.sql';
4259 $pathtosqlextra = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields-'.strtolower($module).
'.sql';
4261 $pathtosqlroot = preg_replace(
'/\/llx_.*$/',
'', $pathtosql);
4263 $pathtosqlkey = preg_replace(
'/\.sql$/',
'.key.sql', $pathtosql);
4264 $pathtosqlextrakey = preg_replace(
'/\.sql$/',
'.key.sql', $pathtosqlextra);
4266 $pathtolib = strtolower($module).
'/lib/'.strtolower($module).
'.lib.php';
4267 $pathtoobjlib = strtolower($module).
'/lib/'.strtolower($module).
'_'.strtolower($tabobj).
'.lib.php';
4269 $tmpobject = $tmpobject ??
null;
4270 if (is_object($tmpobject) && property_exists($tmpobject,
'picto')) {
4271 $pathtopicto = $tmpobject->picto;
4272 $realpathtopicto =
'';
4274 $pathtopicto = strtolower($module).
'/img/object_'.strtolower($tabobj).
'.png';
4275 $realpathtopicto = $dirread.
'/'.$pathtopicto;
4280 $realpathtoclass = $dirread.
'/'.$pathtoclass;
4281 $realpathtoapi = $dirread.
'/'.$pathtoapi;
4282 $realpathtoagenda = $dirread.
'/'.$pathtoagenda;
4283 $realpathtocard = $dirread.
'/'.$pathtocard;
4284 $realpathtodocument = $dirread.
'/'.$pathtodocument;
4285 $realpathtolist = $dirread.
'/'.$pathtolist;
4286 $realpathtonote = $dirread.
'/'.$pathtonote;
4287 $realpathtocontact = $dirread.
'/'.$pathtocontact;
4288 $realpathtophpunit = $dirread.
'/'.$pathtophpunit;
4289 $realpathtosql = $dirread.
'/'.$pathtosql;
4290 $realpathtosqlextra = $dirread.
'/'.$pathtosqlextra;
4291 $realpathtosqlkey = $dirread.
'/'.$pathtosqlkey;
4292 $realpathtosqlextrakey = $dirread.
'/'.$pathtosqlextrakey;
4293 $realpathtolib = $dirread.
'/'.$pathtolib;
4294 $realpathtoobjlib = $dirread.
'/'.$pathtoobjlib;
4296 if (empty($realpathtoapi)) {
4297 $pathtoapi = strtolower($module).
'/class/api_'.strtolower($module).
's.class.php';
4298 $realpathtoapi = $dirread.
'/'.$pathtoapi;
4306 print
'<!-- section for object -->';
4307 print
'<div class="fichehalfleft smallxxx">';
4309 print
'<span class="fa fa-file"></span> '.$langs->trans(
"ClassFile").
' : <strong>'.(
dol_is_file($realpathtoclass) ?
'' :
'<strike>').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtoclass).(
dol_is_file($realpathtoclass) ?
'' :
'</strike>').
'</strong>';
4310 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtoclass).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4313 if ($realpathtopicto &&
dol_is_file($realpathtopicto)) {
4314 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>';
4317 } elseif (!empty($tmpobject)) {
4318 print
'<span class="fa fa-file-image-o"></span> '.$langs->trans(
"Image").
' : '.
img_picto(
'', $tmpobject->picto,
'class="pictofixedwidth valignmiddle"').$tmpobject->picto;
4324 print
'<span class="fa fa-file"></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>';
4326 $file = file_get_contents($realpathtoapi);
4327 if (preg_match(
'/var '.$tabobj.
'\s+([^\s]*)\s/ims', $file, $objs)) {
4328 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtoapi).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4330 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtoapi).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
4331 print $form->textwithpicto(
'', $langs->trans(
"InfoForApiFile"), 1,
'warning');
4334 if ($modulelowercase !==
null && !isModEnabled($modulelowercase)) {
4335 print
'<a href="#" class="classfortooltip" target="apiexplorer" title="'.$langs->trans(
"ModuleMustBeEnabled", $module).
'"><strike>'.$langs->trans(
"ApiExplorer").
'</strike></a>';
4337 print
'<a href="'.DOL_URL_ROOT.
'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans(
"ApiExplorer").
'</a>';
4340 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initapi&token='.
newToken().
'&format=php&file='.urlencode($pathtoapi).
'">'.
img_picto($langs->trans(
'AddAPIsForThisObject'),
'generate',
'class="paddingleft"').
'</a>';
4343 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initapi&token='.
newToken().
'&format=php&file='.urlencode($pathtoapi).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
4347 print
'<span class="fa fa-file"></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>';
4349 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtophpunit).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4351 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtophpunit).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
4353 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initphpunit&token='.
newToken().
'&format=php&file='.urlencode($pathtophpunit).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
4359 print
'<span class="fa fa-file"></span> '.$langs->trans(
"PageForLib").
' : <strong class="wordbreak">'.(
dol_is_file($realpathtolib) ?
'' :
'<strike>').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtolib).(
dol_is_file($realpathtolib) ?
'' :
'</strike>').
'</strong>';
4360 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtolib).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4362 print
'<span class="fa fa-file"></span> '.$langs->trans(
"PageForObjLib").
' : <strong class="wordbreak">'.(
dol_is_file($realpathtoobjlib) ?
'' :
'<strike>').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtoobjlib).(
dol_is_file($realpathtoobjlib) ?
'' :
'</strike>').
'</strong>';
4363 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtoobjlib).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4367 print
'<span class="fa fa-file"></span> '.$langs->trans(
"SqlFile").
' : <strong class="wordbreak">'.(
dol_is_file($realpathtosql) ?
'' :
'<strike>').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtosql).(
dol_is_file($realpathtosql) ?
'' :
'</strike>').
'</strong>';
4368 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=sql&file='.urlencode($pathtosql).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4369 print
' <a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=droptable&token='.
newToken().
'">'.$langs->trans(
"DropTableIfEmpty").
'</a>';
4372 print
'<span class="fa fa-file"></span> '.$langs->trans(
"SqlFileKey").
' : <strong class="wordbreak">'.(
dol_is_file($realpathtosqlkey) ?
'' :
'<strike>').preg_replace(
'/^'.strtolower($module).
'\//',
'', $pathtosqlkey).(
dol_is_file($realpathtosqlkey) ?
'' :
'</strike>').
'</strong>';
4373 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=sql&file='.urlencode($pathtosqlkey).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4376 print
'<span class="fa fa-file"></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>';
4378 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&file='.urlencode($pathtosqlextra).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4380 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtosqlextra).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
4382 print
'<a class="reposition editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=droptableextrafields&token='.
newToken().
'">'.$langs->trans(
"DropTableIfEmpty").
'</a>';
4384 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initsqlextrafields&token='.
newToken().
'&format=sql&file='.urlencode($pathtosqlextra).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
4388 print
'<span class="fa fa-file"></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>';
4390 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=sql&file='.urlencode($pathtosqlextrakey).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4392 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtosqlextrakey).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
4394 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initsqlextrafields&token='.
newToken().
'&format=sql&file='.urlencode($pathtosqlextra).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
4399 print
'<div class="fichehalfleft smallxxxx">';
4400 print
'<span class="fa fa-file"></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>';
4401 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtolist).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4403 print
'<span class="fa fa-file"></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>';
4404 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtocard).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4407 print
'<span class="fa fa-file"></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>';
4408 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtocontact).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4411 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtocontact).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
4413 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initpagecontact&token='.
newToken().
'&format=php&file='.urlencode($pathtocontact).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
4417 print
'<span class="fa fa-file"></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>';
4418 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtodocument).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4421 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtodocument).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
4423 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initpagedocument&token='.
newToken().
'&format=php&file='.urlencode($pathtocontact).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
4427 print
'<span class="fa fa-file"></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>';
4428 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtonote).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4431 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtonote).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
4433 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initpagenote&token='.
newToken().
'&format=php&file='.urlencode($pathtocontact).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
4437 print
'<span class="fa fa-file"></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>';
4438 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&format=php&token='.
newToken().
'&file='.urlencode($pathtoagenda).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4441 print
'<a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtoagenda).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
4443 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&tabobj='.$tabobj.
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initpageagenda&token='.
newToken().
'&format=php&file='.urlencode($pathtocontact).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
4450 print
'<br><br><br>';
4452 if (!empty($tmpobject)) {
4453 $reflector =
new ReflectionClass($tabobj);
4454 $reflectorproperties = $reflector->getProperties();
4455 $reflectorpropdefault = $reflector->getDefaultProperties();
4459 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4460 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4461 print
'<input type="hidden" name="action" value="addproperty">';
4462 print
'<input type="hidden" name="tab" value="objects">';
4463 print
'<input type="hidden" name="page_y" value="">';
4464 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module.($forceddirread ?
'@'.$dirread :
'')).
'">';
4465 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
4467 print
'<input class="button smallpaddingimp" type="submit" name="regenerateclasssql" value="'.$langs->trans(
"RegenerateClassAndSql").
'">';
4468 print
'<br><br class="clearboth">';
4469 print
'<br class="clearboth">';
4471 $mod = strtolower($module);
4472 $obj = strtolower($tabobj);
4473 $newproperty =
dolGetButtonTitle($langs->trans(
'NewProperty'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/modulebuilder/index.php?tab=objects&module='.urlencode($module).
'&tabobj=createproperty&obj='.urlencode($tabobj));
4474 $nbOfProperties = count($reflectorpropdefault[
'fields']);
4476 print_barre_liste($langs->trans(
"ObjectProperties"), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', 0, $nbOfProperties,
'', 0, $newproperty,
'margintoponly', 0, 0, 0, 1);
4479 print
'<!-- Table with properties of object -->'.
"\n";
4480 print
'<div class="div-table-responsive">';
4481 print
'<table class="noborder small">';
4482 print
'<tr class="liste_titre">';
4483 print
'<th class="tdsticky tdstickygray">';
4484 $htmltext = $langs->trans(
"PropertyDesc").
'<br><br><a class="" href="https://wiki.dolibarr.org/index.php/Language_and_development_rules#Table_and_fields_structures" target="_blank" rel="noopener noreferrer external">'.$langs->trans(
"SeeExamples").
'</a>';
4485 print $form->textwithpicto($langs->trans(
"Code"), $htmltext, 1,
'help',
'extracss', 0, 3,
'propertyhelp');
4488 print $form->textwithpicto($langs->trans(
"Label"), $langs->trans(
"YouCanUseTranslationKey"));
4490 print
'<th>'.$form->textwithpicto($langs->trans(
"Type"), $langs->trans(
"TypeOfFieldsHelpIntro").
'<br><br>'.$langs->trans(
"TypeOfFieldsHelp"), 1,
'help',
'extracss', 0, 3,
'typehelp').
'</th>';
4491 print
'<th>'.$form->textwithpicto($langs->trans(
"ArrayOfKeyValues"), $langs->trans(
"ArrayOfKeyValuesDesc")).
'</th>';
4492 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"NotNull"), $langs->trans(
"NotNullDesc")).
'</th>';
4493 print
'<th class="center">'.$langs->trans(
"DefaultValue").
'</th>';
4494 print
'<th class="center">'.$langs->trans(
"DatabaseIndex").
'</th>';
4495 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"ForeignKey"), $langs->trans(
"ForeignKeyDesc"), 1,
'help',
'extracss', 0, 3,
'foreignkeyhelp').
'</th>';
4496 print
'<th class="right">'.$langs->trans(
"Position").
'</th>';
4497 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"Enabled"), $langs->trans(
"EnabledDesc"), 1,
'help',
'extracss', 0, 3,
'enabledhelp').
'</th>';
4498 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"Visibility"), $langs->trans(
"VisibleDesc").
'<br><br>'.$langs->trans(
"ItCanBeAnExpression"), 1,
'help',
'extracss', 0, 3,
'visiblehelp').
'</th>';
4499 print
'<th class="center">'.$langs->trans(
"NotEditable").
'</th>';
4501 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"SearchAll"), $langs->trans(
"SearchAllDesc")).
'</th>';
4502 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"IsAMeasure"), $langs->trans(
"IsAMeasureDesc")).
'</th>';
4503 print
'<th class="center">'.$langs->trans(
"CSSClass").
'</th>';
4504 print
'<th class="center">'.$langs->trans(
"CSSViewClass").
'</th>';
4505 print
'<th class="center">'.$langs->trans(
"CSSListClass").
'</th>';
4506 print
'<th>'.$langs->trans(
"KeyForTooltip").
'</th>';
4507 print
'<th class="center">'.$langs->trans(
"ShowOnCombobox").
'</th>';
4509 print
'<th>'.$form->textwithpicto($langs->trans(
"Validate"), $langs->trans(
"ValidateModBuilderDesc")).
'</th>';
4510 print
'<th>'.$langs->trans(
"Comment").
'</th>';
4511 print
'<th class="tdstickyright tdstickyghostwhite"></th>';
4517 $properties =
dol_sort_array($reflectorpropdefault[
'fields'],
'position');
4518 if (!empty($properties)) {
4520 foreach ($properties as $propkey => $propval) {
4535 $propname = $propkey;
4536 $proplabel = $propval[
'label'];
4537 $proptype = $propval[
'type'];
4538 $proparrayofkeyval = !empty($propval[
'arrayofkeyval']) ? $propval[
'arrayofkeyval'] :
'';
4539 $propnotnull = !empty($propval[
'notnull']) ? $propval[
'notnull'] :
'0';
4540 $propdefault = !empty($propval[
'default']) ? $propval[
'default'] :
'';
4541 $propindex = !empty($propval[
'index']) ? $propval[
'index'] :
'';
4542 $propforeignkey = !empty($propval[
'foreignkey']) ? $propval[
'foreignkey'] :
'';
4543 $propposition = $propval[
'position'];
4544 $propenabled = $propval[
'enabled'];
4545 $propvisible = $propval[
'visible'];
4546 $propnoteditable = !empty($propval[
'noteditable']) ? $propval[
'noteditable'] : 0;
4548 $propsearchall = !empty($propval[
'searchall']) ? $propval[
'searchall'] : 0;
4549 $propisameasure = !empty($propval[
'isameasure']) ? $propval[
'isameasure'] : 0;
4550 $propcss = !empty($propval[
'css']) ? $propval[
'css'] :
'';
4551 $propcssview = !empty($propval[
'cssview']) ? $propval[
'cssview'] :
'';
4552 $propcsslist = !empty($propval[
'csslist']) ? $propval[
'csslist'] :
'';
4553 $prophelp = !empty($propval[
'help']) ? $propval[
'help'] :
'';
4554 $propshowoncombobox = !empty($propval[
'showoncombobox']) ? $propval[
'showoncombobox'] : 0;
4556 $propvalidate = !empty($propval[
'validate']) ? $propval[
'validate'] : 0;
4557 $propcomment = !empty($propval[
'comment']) ? $propval[
'comment'] :
'';
4559 print
'<!-- line for object property -->'.
"\n";
4560 print
'<tr class="oddeven">';
4562 print
'<td class="tdsticky tdstickygray">';
4565 if ($action ==
'editproperty' && $propname == $propertykey) {
4567 print
'<input type="hidden" name="propname" value="'.dol_escape_htmltag($propname).
'">';
4568 print
'<input name="proplabel" class="maxwidth125" value="'.dol_escape_htmltag($proplabel).
'">';
4570 print
'<td class="tdoverflowmax150">';
4571 print
'<input name="proptype" class="maxwidth125" value="'.dol_escape_htmltag($proptype).
'"></input>';
4573 print
'<td class="tdoverflowmax200">';
4574 print
'<textarea name="proparrayofkeyval">';
4575 if (isset($proparrayofkeyval)) {
4576 if (is_array($proparrayofkeyval) || $proparrayofkeyval !=
'') {
4580 print
'</textarea>';
4583 print
'<input class="center width50" name="propnotnull" value="'.dol_escape_htmltag($propnotnull).
'">';
4586 print
'<input class="maxwidth50" name="propdefault" value="'.dol_escape_htmltag($propdefault).
'">';
4588 print
'<td class="center">';
4589 print
'<input class="center maxwidth50" name="propindex" value="'.dol_escape_htmltag($propindex).
'">';
4592 print
'<input class="center maxwidth100" name="propforeignkey" value="'.dol_escape_htmltag($propforeignkey).
'">';
4595 print
'<input class="right width50" name="propposition" value="'.dol_escape_htmltag($propposition).
'">';
4598 print
'<input class="center width75" name="propenabled" value="'.dol_escape_htmltag($propenabled).
'">';
4601 print
'<input class="center width75" name="propvisible" value="'.dol_escape_htmltag($propvisible).
'">';
4604 print
'<input class="center width50" name="propnoteditable" size="2" value="'.dol_escape_htmltag($propnoteditable).
'">';
4610 print
'<input class="center width50" name="propsearchall" value="'.dol_escape_htmltag($propsearchall).
'">';
4613 print
'<input class="center width50" name="propisameasure" value="'.dol_escape_htmltag($propisameasure).
'">';
4616 print
'<input class="center maxwidth50" name="propcss" value="'.dol_escape_htmltag($propcss).
'">';
4619 print
'<input class="center maxwidth50" name="propcssview" value="'.dol_escape_htmltag($propcssview).
'">';
4622 print
'<input class="center maxwidth50" name="propcsslist" value="'.dol_escape_htmltag($propcsslist).
'">';
4625 print
'<input class="maxwidth100" name="prophelp" value="'.dol_escape_htmltag($prophelp).
'">';
4628 print
'<input class="center maxwidth50" name="propshowoncombobox" value="'.dol_escape_htmltag($propshowoncombobox).
'">';
4631 print
'<input type="number" step="1" min="0" max="1" class="text maxwidth100" name="propvalidate" value="'.dol_escape_htmltag($propvalidate).
'">';
4634 print
'<input class="maxwidth100" name="propcomment" value="'.dol_escape_htmltag($propcomment).
'">';
4636 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
4637 print
'<input class="reposition button smallpaddingimp" type="submit" name="edit" value="'.$langs->trans(
"Save").
'">';
4638 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
4641 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($proplabel).
'">';
4644 print
'<td class="tdoverflowmax200">';
4647 if (preg_match(
'/^varchar/', $proptype, $matches)) {
4648 $pictoType =
'varchar';
4649 } elseif (preg_match(
'/^integer:/', $proptype, $matches)) {
4650 $pictoType =
'link';
4651 } elseif (strpos($proptype,
'integer') === 0) {
4652 $pictoType = substr($proptype, 0, 3);
4653 } elseif (strpos($proptype,
'timestamp') === 0) {
4654 $pictoType =
'datetime';
4655 } elseif (strpos($proptype,
'real') === 0) {
4656 $pictoType =
'double';
4657 } elseif (strpos($proptype,
'stars') === 0) {
4658 $pictoType =
'stars';
4662 print
'<td class="tdoverflowmax200">';
4663 if ($proparrayofkeyval) {
4664 print
'<span title="'.dol_escape_htmltag(json_encode($proparrayofkeyval, JSON_UNESCAPED_UNICODE)).
'">';
4669 print
'<td class="center">';
4675 print
'<td class="center">';
4676 print $propindex ?
'1' :
'';
4678 print
'<td class="center">';
4681 print
'<td class="right">';
4684 print
'<td class="center tdoverflowmax100" title="'.($propnoteditable ?
dol_escape_htmltag($propnoteditable) :
'').
'">';
4688 print
'<td class="center tdoverflowmax100" title="'.($propvisible ?
dol_escape_htmltag($propvisible) :
'0').
'">';
4692 print
'<td class="center tdoverflowmax100" title="'.($propnoteditable ?
dol_escape_htmltag($propnoteditable) :
'').
'">';
4698 print
'<td class="center">';
4699 print $propsearchall ?
'1' :
'';
4701 print
'<td class="center">';
4704 print
'<td class="center tdoverflowmax100" title="'.($propcss ?
dol_escape_htmltag($propcss) :
'').
'">';
4707 print
'<td class="center tdoverflowmax100" title="'.($propcssview ?
dol_escape_htmltag($propcssview) :
'').
'">';
4710 print
'<td class="center tdoverflowmax100" title="'.($propcsslist ?
dol_escape_htmltag($propcsslist) :
'').
'">';
4714 print
'<td class="tdoverflowmax150" title="'.($prophelp ?
dol_escape_htmltag($prophelp) :
'').
'">';
4717 print
'<td class="center">';
4723 print
'<td class="center">';
4726 print
'<td class="tdoverflowmax200">';
4727 print
'<span title="'.dol_escape_htmltag($propcomment).
'">';
4731 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
4732 if ($propname !=
'rowid') {
4733 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>';
4734 print
'<a class="reposition 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>';
4741 if ($tab ==
'specifications') {
4742 if ($action !=
'editfile' || empty($file)) {
4743 print
'<span class="opacitymedium">'.$langs->trans(
"SpecDefDesc").
'</span><br>';
4748 foreach ($specs as $spec) {
4749 $pathtofile = $modulelowercase.
'/doc/'.$spec[
'relativename'];
4750 $format =
'asciidoc';
4751 if (preg_match(
'/\.md$/i', $spec[
'name'])) {
4752 $format =
'markdown';
4754 print
'<span class="fa fa-file"></span> '.$langs->trans(
"SpecificationFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
4755 print
' <a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4765 $content = file_get_contents($fullpathoffile);
4768 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4769 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4770 print
'<input type="hidden" name="action" value="savefile">';
4771 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4772 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4773 print
'<input type="hidden" name="module" value="'.$module.
'">';
4775 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
4776 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
4779 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
4781 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4787 print
'<tr><td><span class="warning">'.$langs->trans(
'Property %s not found in the class. The class was probably not generated by modulebuilder.', $field).
'</warning></td></tr>';
4794 print
'<span class="warning">'.$langs->trans(
'Failed to init the object with the new %s (%s)', $tabobj, (
string) $db).
'</warning>';
4798 print $e->getMessage();
4802 if (empty($forceddirread)) {
4805 $fullpathoffile = $dirread.
'/'.$file;
4808 $content = file_get_contents($fullpathoffile);
4811 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4812 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4813 print
'<input type="hidden" name="action" value="savefile">';
4814 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4815 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4816 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
4817 print
'<input type="hidden" name="module" value="'.$module.($forceddirread ?
'@'.$dirread :
'').
'">';
4819 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
4820 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
4823 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
4825 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4835 if ($tab ==
'dictionaries') {
4836 print
'<!-- tab=dictionaries -->'.
"\n";
4837 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
4839 $dicts = $moduleobj->dictionaries;
4841 if ($action ==
'deletedict') {
4842 $formconfirm = $form->formconfirm(
4843 $_SERVER[
"PHP_SELF"].
'?dictionnarykey='.urlencode((
string) (
GETPOSTINT(
'dictionnarykey'))).
'&tab='.urlencode((
string) ($tab)).
'&module='.urlencode((
string) ($module)),
4844 $langs->trans(
'Delete'),
4845 $langs->trans(
'Confirm Delete Dictionnary',
GETPOST(
'dictionnarykey',
'alpha')),
4846 'confirm_deletedictionary',
4854 if ($action !=
'editfile' || empty($file)) {
4855 print
'<span class="opacitymedium">';
4856 $htmlhelp = $langs->trans(
"DictionariesDefDescTooltip",
'{s1}');
4857 $htmlhelp = str_replace(
'{s1}',
'<a target="adminbis" class="nofocusvisible" href="'.DOL_URL_ROOT.
'/admin/dict.php">'.$langs->trans(
'Setup').
' - '.$langs->trans(
'Dictionaries').
'</a>', $htmlhelp);
4858 print $form->textwithpicto($langs->trans(
"DictionariesDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
4862 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
4863 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'&find=DICTIONARIES">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
4865 if (is_array($dicts) && !empty($dicts)) {
4866 print
'<span class="fa fa-file"></span> '.$langs->trans(
"LanguageFile").
' :</span> ';
4867 print
'<strong class="wordbreak">'.$dicts[
'langs'].
'</strong>';
4878 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabdic=newdictionary';
4879 $head3[$h][1] =
'<span class="valignmiddle text-plus-circle">'.$langs->trans(
"NewDictionary").
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
4880 $head3[$h][2] =
'newdictionary';
4921 $newdict =
dolGetButtonTitle($langs->trans(
'NewDictionary'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/modulebuilder/index.php?tab=dictionaries&module='.urlencode($module).
'&tabdic=newdictionary');
4922 print_barre_liste($langs->trans(
"ListOfDictionariesEntries"),
'', $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', 0,
'',
'', 0, $newdict,
'', 0, 0, 0, 1);
4924 if ($tabdic !=
'newdictionary') {
4925 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4926 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4927 print
'<input type="hidden" name="action" value="addDictionary">';
4928 print
'<input type="hidden" name="tab" value="dictionaries">';
4929 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4930 print
'<input type="hidden" name="tabdic" value="'.dol_escape_htmltag($tabdic).
'">';
4932 print
'<div class="div-table-responsive">';
4933 print
'<table class="noborder">';
4935 print
'<tr class="liste_titre">';
4936 print_liste_field_titre(
"#", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'thsticky thstickygrey ');
4949 if (!empty($dicts) && is_array($dicts) && !empty($dicts[
'tabname']) && is_array($dicts[
'tabname'])) {
4951 $maxi = count($dicts[
'tabname']);
4952 while ($i < $maxi) {
4953 if ($action ==
'editdict' && $i ==
GETPOSTINT(
'dictionnarykey') - 1) {
4954 print
'<tr class="oddeven">';
4955 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4956 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4957 print
'<input type="hidden" name="tab" value="dictionaries">';
4958 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4959 print
'<input type="hidden" name="action" value="updatedictionary">';
4960 print
'<input type="hidden" name="dictionnarykey" value="'.($i + 1).
'">';
4962 print
'<td class="tdsticky tdstickygray">';
4967 print
'<input type="text" name="tabname" value="'.$dicts[
'tabname'][$i].
'" readonly class="tdstickygray">';
4971 print
'<input type="text" name="tablib" value="'.$dicts[
'tablib'][$i].
'">';
4975 print
'<input type="text" name="tabsql" value="'.$dicts[
'tabsql'][$i].
'" readonly class="tdstickygray">';
4979 print
'<select name="tabsqlsort">';
4980 print
'<option value="'.dol_escape_htmltag($dicts[
'tabsqlsort'][$i]).
'">'.$dicts[
'tabsqlsort'][$i].
'</option>';
4984 print
'<td><select name="tabfield" >';
4985 print
'<option value="'.dol_escape_htmltag($dicts[
'tabfield'][$i]).
'">'.$dicts[
'tabfield'][$i].
'</option>';
4986 print
'</select></td>';
4988 print
'<td><select name="tabfieldvalue" >';
4989 print
'<option value="'.dol_escape_htmltag($dicts[
'tabfieldvalue'][$i]).
'">'.$dicts[
'tabfieldvalue'][$i].
'</option>';
4990 print
'</select></td>';
4992 print
'<td><select name="tabfieldinsert" >';
4993 print
'<option value="'.dol_escape_htmltag($dicts[
'tabfieldinsert'][$i]).
'">'.$dicts[
'tabfieldinsert'][$i].
'</option>';
4994 print
'</select></td>';
4997 print
'<input type="text" name="tabrowid" value="'.dol_escape_htmltag($dicts[
'tabrowid'][$i]).
'" readonly class="tdstickygray">';
5001 print
'<input type="text" name="tabcond" value="'.dol_escape_htmltag((empty($dicts[
'tabcond'][$i]) ?
'disabled' :
'enabled')).
'" readonly class="tdstickygray">';
5004 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
5005 print
'<input id ="updatedict" class="reposition button smallpaddingimp" type="submit" name="updatedict" value="'.$langs->trans(
"Modify").
'"/>';
5007 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
5013 print
'<tr class="oddeven">';
5015 print
'<td class="tdsticky tdstickygray">';
5020 print $dicts[
'tabname'][$i];
5024 print $dicts[
'tablib'][$i];
5028 print $dicts[
'tabsql'][$i];
5032 print $dicts[
'tabsqlsort'][$i];
5036 print $dicts[
'tabfield'][$i];
5040 print $dicts[
'tabfieldvalue'][$i];
5044 print $dicts[
'tabfieldinsert'][$i];
5048 print $dicts[
'tabrowid'][$i];
5052 print $dicts[
'tabcond'][$i];
5055 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
5056 print
'<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?action=editdict&token='.
newToken().
'&dictionnarykey='.urlencode((
string) ($i + 1)).
'&tab='.urlencode((
string) ($tab)).
'&module='.urlencode((
string) ($module)).
'">'.
img_edit().
'</a>';
5057 print
'<a class="marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?action=deletedict&token='.
newToken().
'&dictionnarykey='.urlencode((
string) ($i + 1)).
'&tab='.urlencode((
string) ($tab)).
'&module='.urlencode((
string) ($module)).
'">'.
img_delete().
'</a>';
5065 print
'<tr><td colspan="11"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
5074 if ($tabdic ==
'newdictionary') {
5076 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5077 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5078 print
'<input type="hidden" name="action" value="initdic">';
5079 print
'<input type="hidden" name="tab" value="dictionaries">';
5080 print
'<input type="hidden" name="tabdic" value="'.$tabdic.
'">';
5082 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5084 print
'<span class="opacitymedium">'.$langs->trans(
"EnterNameOfDictionaryDesc").
'</span><br><br>';
5087 print
'<table class="border centpercent">';
5089 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Table").
'</td><td><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></td>';
5090 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Label").
'</td><td><input type="text" name="label" value="'.
dol_escape_htmltag(
GETPOST(
'label',
'alpha')).
'"></td></tr>';
5091 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"SQL").
'</td><td><input type="text" style="width:50%;" name="sql" value="'.
dol_escape_htmltag(
GETPOST(
'sql',
'alpha')).
'"></td></tr>';
5092 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"SQLSort").
'</td><td><input type="text" name="sqlsort" value="'.
dol_escape_htmltag(
GETPOST(
'sqlsort',
'alpha')).
'" readonly></td></tr>';
5093 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"FieldsView").
'</td><td><input type="text" name="field" value="'.
dol_escape_htmltag(
GETPOST(
'field',
'alpha')).
'"></td></tr>';
5094 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"FieldsEdit").
'</td><td><input type="text" name="fieldvalue" value="'.
dol_escape_htmltag(
GETPOST(
'fieldvalue',
'alpha')).
'"></td></tr>';
5095 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"FieldsInsert").
'</td><td><input type="text" name="fieldinsert" value="'.
dol_escape_htmltag(
GETPOST(
'fieldinsert',
'alpha')).
'"></td></tr>';
5096 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Rowid").
'</td><td><input type="text" name="rowid" value="'.
dol_escape_htmltag(
GETPOST(
'rowid',
'alpha')).
'"></td></tr>';
5098 print
'</tbody></table>';
5099 print
'<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans(
"GenerateCode")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
5100 print
'<input id="cancel" type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
5104 $(document).ready(function() {
5105 $("input[name=\'dicname\']").on("blur", function() {
5106 if ($(this).val().length > 0) {
5107 $("input[name=\'label\']").val($(this).val());
5108 $("input[name=\'sql\']").val("SELECT f.rowid as rowid, f.code, f.label, f.active FROM llx_c_" + $(this).val() + " as f");
5109 $("input[name=\'sqlsort\']").val("label ASC");
5110 $("input[name=\'field\']").val("code,label");
5111 $("input[name=\'fieldvalue\']").val("code,label");
5112 $("input[name=\'fieldinsert\']").val("code,label");
5113 $("input[name=\'rowid\']").val("rowid");
5115 $("input[name=\'label\']").val("");
5116 $("input[name=\'sql\']").val("");
5117 $("input[name=\'sqlsort\']").val("");
5118 $("input[name=\'field\']").val("");
5119 $("input[name=\'fieldvalue\']").val("");
5120 $("input[name=\'fieldinsert\']").val("");
5121 $("input[name=\'rowid\']").val("");
5124 $("input[id=\'cancel\']").click(function() {
5125 window.history.back();
5142 } elseif ($tabdic ==
'deletedictionary') {
5144 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5145 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5146 print
'<input type="hidden" name="action" value="confirm_deletedictionary">';
5147 print
'<input type="hidden" name="tab" value="dictionaries">';
5148 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5150 print $langs->trans(
"EnterNameOfDictionnaryToDeleteDesc").
'<br><br>';
5152 print
'<input type="text" name="dicname" value="'.dol_escape_htmltag($modulename).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"DicKey")).
'">';
5153 print
'<input type="submit" class="button smallpaddingimp" name="delete" value="'.dol_escape_htmltag($langs->trans(
"Delete")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
5161 $content = file_get_contents($fullpathoffile);
5164 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5165 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5166 print
'<input type="hidden" name="action" value="savefile">';
5167 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
5168 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
5169 print
'<input type="hidden" name="module" value="'.$module.
'">';
5171 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
5172 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
5173 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
5176 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
5178 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
5185 if ($tab ==
'menus') {
5186 print
'<!-- tab=menus -->'.
"\n";
5187 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
5188 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
5189 $destdir = $dirins.
'/'.strtolower($module);
5190 $listofobject =
dol_dir_list($destdir.
'/class',
'files', 0,
'\.class\.php$');
5193 $leftmenus = array();
5195 $menus = $moduleobj->menu;
5197 $permissions = $moduleobj->rights;
5198 $crud = array(
'read' =>
'CRUDRead',
'write' =>
'CRUDCreateWrite',
'delete' =>
'Delete');
5201 $groupedRights = array();
5202 foreach ($permissions as $right) {
5204 if (!isset($groupedRights[$key])) {
5205 $groupedRights[$key] = array();
5207 $groupedRights[$key][] = $right;
5209 $groupedRights_json = json_encode($groupedRights);
5211 if ($action ==
'deletemenu') {
5212 $formconfirms = $form->formconfirm(
5213 $_SERVER[
"PHP_SELF"].
'?menukey='.urlencode((
string) (
GETPOSTINT(
'menukey'))).
'&tab='.urlencode((
string) ($tab)).
'&module='.urlencode((
string) ($module)),
5214 $langs->trans(
'Delete'),
5215 ($menus[
GETPOST(
'menukey')][
'fk_menu'] ===
'fk_mainmenu='.strtolower($module) ? $langs->trans(
'Warning: you will delete all menus linked to this one.',
GETPOSTINT(
'menukey')) : $langs->trans(
'Confirm Delete Menu',
GETPOSTINT(
'menukey'))),
5216 'confirm_deletemenu',
5221 print $formconfirms;
5223 if ($action !=
'editfile' || empty($file)) {
5224 print
'<span class="opacitymedium">';
5225 $htmlhelp = $langs->trans(
"MenusDefDescTooltip",
'{s1}');
5226 $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);
5227 print $form->textwithpicto($langs->trans(
"MenusDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
5231 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
5232 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'&find=TOPMENU">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
5238 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5239 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5240 print
'<input type="hidden" name="action" value="addmenu">';
5241 print
'<input type="hidden" name="tab" value="menus">';
5242 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5243 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
5245 print
'<div class="div-table-responsive">';
5246 print
'<table class="noborder small">';
5248 $htmltextenabled =
'<u>'.$langs->trans(
"Examples").
':</u><br>';
5249 $htmltextenabled .=
'1 <span class="opacitymedium">(module always enabled)</span><br>';
5250 $htmltextenabled .=
'0 <span class="opacitymedium">(module always disabled)</span><br>';
5251 $htmltextenabled .=
'isModEnabled(\''.dol_escape_htmltag(strtolower($module)).
'\') <span
class=
"opacitymedium">(enabled when module is enabled)</span>
';
5252 $htmltextperms = '<u>
'.$langs->trans("Examples").':</u><br>
';
5253 $htmltextperms .= '1 <span class=
"opacitymedium">(access always allowed)</span><br>
';
5254 $htmltextperms .= '$user->hasright(\
''.
dol_escape_htmltag(strtolower($module)).
'\', \'myobject\', \'read\') <span class="opacitymedium">(access allowed if user has permission module->object->read)</span>';
5256 print
'<tr class="liste_titre">';
5257 print_liste_field_titre(
"#", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'center tdsticky tdstickygray ');
5260 print_liste_field_titre(
"LinkToParentMenu", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'minwidth100 ');
5263 print_liste_field_titre(
"URL", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'', $langs->transnoentitiesnoconv(
'DetailUrl'));
5265 print_liste_field_titre(
"Position", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'right ');
5266 print_liste_field_titre(
"Enabled", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'center ', $langs->trans(
'DetailEnabled').
'<br><br>'.$htmltextenabled);
5267 print_liste_field_titre(
"Rights", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'', $langs->trans(
'DetailRight').
'<br><br>'.$htmltextperms);
5268 print_liste_field_titre(
"Target", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'', $langs->trans(
'DetailTarget'));
5269 print_liste_field_titre(
"MenuForUsers", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'center minwidth100 ', $langs->trans(
'DetailUser'));
5270 print_liste_field_titre(
"", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'center ', $langs->trans(
''));
5273 $r = count($menus) + 1;
5276 print
'<td class="center tdsticky tdstickygray"><input type="hidden" readonly class="center maxwidth50" name="propenabled" value="#"></td>';
5277 print
'<td class="center">';
5278 print
'<select class="maxwidth50" name="type">';
5279 print
'<option value="">'.$langs->trans(
"........").
'</option><option value="'.
dol_escape_htmltag(
"left").
'">left</option><option value="'.
dol_escape_htmltag(
"top").
'">top</option>';
5280 print
'</select></td>';
5281 print
'<td class="left"><input type="text" class="left maxwidth100" name="titre" value="'.dol_escape_htmltag(
GETPOST(
'titre',
'alpha')).
'"></td>';
5282 print
'<td class="left">';
5283 print
'<select name="fk_menu">';
5284 print
'<option value="">'.$langs->trans(
"........").
'</option>';
5285 foreach ($menus as $obj) {
5286 if ($obj[
'type'] ==
'left' && !empty($obj[
'leftmenu'])) {
5287 print
"<option value=".strtolower($obj[
'leftmenu']).
">".$obj[
'leftmenu'].
"</option>";
5292 print
'<td class="left"><input type="text" class="left maxwidth50" name="mainmenu" value="'.(empty(
GETPOST(
'mainmenu')) ? strtolower($module) :
dol_escape_htmltag(
GETPOST(
'mainmenu',
'alpha'))).
'"></td>';
5293 print
'<td class="center"><input id="leftmenu" type="text" class="left maxwidth50" name="leftmenu" value="'.dol_escape_htmltag(
GETPOST(
'leftmenu',
'alpha')).
'"></td>';
5295 print
'<td class="left"><input id="url" type="text" class="left maxwidth100" name="url" value="'.dol_escape_htmltag(
GETPOST(
'url',
'alpha')).
'"></td>';
5296 print
'<td class="left"><input type="text" class="left maxwidth75" name="langs" value="'.strtolower($module).
'@'.strtolower($module).
'" readonly></td>';
5298 print
'<td class="center"><input type="text" class="center maxwidth50 tdstickygray" name="position" value="'.(1000 + $r).
'" readonly></td>';
5300 print
'<td class="center">';
5301 print
'<input type="enabled" class="maxwidth125" value="'.dol_escape_htmltag(GETPOSTISSET(
'enabled') ?
GETPOST(
'enabled') :
'isModEnabled(\''.$module.
'\')').
'">';
5310 print
'<td class="left">';
5311 print
'<select class="maxwidth" name="objects" id="objects">';
5312 print
'<option value=""></option>';
5313 if (is_array($objects)) {
5314 foreach ($objects as $value) {
5315 print
'<option value="'.strtolower($value).
'">'.
dol_escape_htmltag(strtolower($value)).
'</option>';
5319 print
'<select class="maxwidth hideobject" name="perms" id="perms">';
5322 print
'<td class="center"><input type="text" class="center maxwidth50" name="target" value="'.dol_escape_htmltag(
GETPOST(
'target',
'alpha')).
'"></td>';
5323 print
'<td class="center"><select class="maxwidth10" name="user"><option value="2">'.$langs->trans(
"AllMenus").
'</option><option value="0">'.$langs->trans(
"Internal").
'</option><option value="1">'.$langs->trans(
"External").
'</option></select></td>';
5325 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
5326 print
'<input type="submit" class="button" name="add" value="'.$langs->trans(
"Add").
'">';
5334 if (count($menus)) {
5336 foreach ($menus as $menu) {
5340 $value = substr($string, strpos($string,
'fk_leftmenu=') + strlen(
'fk_leftmenu='));
5342 $propFk_menu = !empty($menu[
'fk_menu']) ? $menu[
'fk_menu'] :
GETPOST(
'fk_menu');
5343 $propTitre = !empty($menu[
'titre']) ? $menu[
'titre'] :
GETPOST(
'titre');
5344 $propMainmenu = !empty($menu[
'mainmenu']) ? $menu[
'mainmenu'] :
GETPOST(
'mainmenu');
5345 $propLeftmenu = !empty($menu[
'leftmenu']) ? $menu[
'leftmenu'] :
GETPOST(
'leftmenu');
5346 $propUrl = !empty($menu[
'url']) ? $menu[
'url'] :
GETPOST(
'url',
'alpha');
5347 $propPerms = !empty($menu[
'perms']) ? $menu[
'perms'] :
GETPOST(
'perms');
5348 $propUser = !empty($menu[
'user']) ? $menu[
'user'] :
GETPOST(
'user');
5349 $propTarget = !empty($menu[
'target']) ? $menu[
'target'] :
GETPOST(
'target');
5350 $propEnabled = !empty($menu[
'enabled']) ? $menu[
'enabled'] :
GETPOST(
'enabled');
5352 $objPerms = (empty($arguments[1]) ?
'' : trim($arguments[1]));
5353 $valPerms = (empty($arguments[2]) ?
'' : trim($arguments[2]));
5357 if ($action ==
'editmenu' &&
GETPOSTINT(
'menukey') == $i) {
5359 print
'<tr class="oddeven">';
5360 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5361 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5362 print
'<input type="hidden" name="action" value="update_menu">';
5363 print
'<input type="hidden" name="tab" value="menus">';
5364 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5365 print
'<input type="hidden" name="menukey" value="'.$i.
'"/>';
5367 print
'<td class="tdsticky tdstickygray">';
5371 print
'<td class="center">
5372 <select class="center maxwidth50" name="type">
5373 <option value="'.dol_escape_htmltag($menu[
'type']).
'">
5376 print
'<option value="'.($menu[
'type'] ==
'left' ?
'top' :
'left').
'">';
5377 if ($menu[
'type'] ==
'left') {
5382 print
'</option></select></td>';
5384 print
'<td><input type="text" class="left maxwidth100" name="titre" value="'.dol_escape_htmltag($propTitre).
'"></td>';
5395 print
'<input type="text" name="fk_menu" class="maxwidth150" value="'.dol_escape_htmltag($propFk_menu).
'">';
5397 print
'<td><input type="text" class="left maxwidth50" name="mainmenu" value="'.dol_escape_htmltag($propMainmenu).
'" readonly></td>';
5398 print
'<td><input type="text" class="left maxwidth50" name="leftmenu" value="'.dol_escape_htmltag($propLeftmenu).
'" readonly></td>';
5400 print
'<td><input type="text" class="left maxwidth250" name="url" value="'.dol_escape_htmltag($propUrl).
'"></td>';
5401 print
'<td><input type="text" class="left maxwidth50" name="langs" value="'.strtolower($module).
'@'.strtolower($module).
'" readonly></td>';
5403 print
'<td class="center"><input type="text" class="center maxwidth50 tdstickygray" name="position" value="'.($menu[
'position']).
'" readonly></td>';
5405 print
'<td class="nowraponall">';
5406 print
'<input type="text" class="maxwidth125" name="enabled" value="'.dol_escape_htmltag($propEnabled !=
'' ? $propEnabled :
"isModEnabled('".
dol_escape_htmltag($module).
"')").
'">';
5407 $htmltext =
'<u>'.$langs->trans(
"Examples").
':</u><br>';
5408 $htmltext .=
'1 <span class="opacitymedium">(always enabled)</span><br>';
5409 $htmltext .=
'0 <span class="opacitymedium">(always disabled)</span><br>';
5410 $htmltext .=
'isModEnabled(\''.dol_escape_htmltag($module).
'\') <span
class=
"opacitymedium">(enabled when module is enabled)</span><br>
';
5411 print $form->textwithpicto('', $htmltext);
5413 print '<select
class=
"maxwidth50" name=
"enabledselect">
';
5414 print '<option value=
"1">1 (always enabled)</option>
';
5415 print '<option value=
"0">0 (always
disabled)</option>
';
5416 print '<option value=
"isModEnabled(\''.dol_escape_htmltag($module).'\')" >isModEnabled(\
''.
dol_escape_htmltag($module).
'\')</option>
';
5421 print '<td
class=
"nowraponall">
';
5422 print '<input
type=
"text" name=
"perms" value=
"'.dol_escape_htmltag($propPerms).'">
';
5424 if (!empty($objPerms)) {
5425 print '<input
type=
"hidden" name=
"objects" value=
"'.$objPerms.'" />
';
5426 print '<select
class=
"center maxwidth50" name=
"perms">
';
5427 if (!empty($valPerms)) {
5428 print '<option selected value=
"'.dol_escape_htmltag($valPerms).'">
'.dol_escape_htmltag($langs->trans($crud[$valPerms])).'</option>
';
5429 foreach ($crud as $key => $val) {
5430 if ($valPerms != $key) {
5431 print '<option value=
"'.dol_escape_htmltag($key).'">
'.dol_escape_htmltag($langs->trans($val)).'</option>
';
5437 print '<select
class=
"center maxwidth50" name=
"objects">
';
5438 print '<option></option>
';
5439 foreach ($objects as $obj) {
5440 print '<option value=
"'.dol_escape_htmltag(strtolower($obj)).'">
'.dol_escape_htmltag($obj).'</option>
';
5443 print '<select
class=
"center maxwidth50" name=
"perms">
';
5444 foreach ($crud as $key => $val) {
5445 print '<option value=
"'.dol_escape_htmltag($key).'">
'.dol_escape_htmltag($key).'</option>
';
5451 print '<td
class=
"center"><input
type=
"text" class=
"center maxwidth50" name=
"target" value=
"'.dol_escape_htmltag($propTarget).'"></td>
';
5452 print '<td
class=
"center"><select
class=
"center maxwidth10" name=
"user"><option value=
"2">
'.$langs->trans("AllMenus").'</option><option value=
"0">
'.$langs->trans("Internal").'</option><option value=
"1">
'.$langs->trans("External").'</option></select></td>
';
5453 print '<td
class=
"center minwidth75 tdstickyright tdstickyghostwhite maxwidth75">
';
5454 print '<input
class=
"reposition button smallpaddingimp" type=
"submit" name=
"edit" value=
"'.$langs->trans("Modify
").'">
';
5455 print '<input
class=
"reposition button button-cancel smallpaddingimp" type=
"submit" name=
"cancel" value=
"'.$langs->trans("Cancel
").'">
';
5460 print '<tr
class=
"oddeven">
';
5462 print '<td
class=
"tdsticky tdstickygray">
';
5466 print '<td
class=
"center">
';
5467 print dol_escape_htmltag($menu['type']);
5472 print dol_escape_htmltag($menu['titre
']);
5476 print '<td
class=
"tdoverflowmax100" title=
"'.dol_escape_htmltag($menu['fk_menu']).'">
';
5477 print dol_escape_htmltag($menu['fk_menu
']);
5481 print dol_escape_htmltag($menu['mainmenu
']);
5485 print dol_escape_htmltag($menu['leftmenu
']);
5488 print '<td
class=
"tdoverflowmax250" title=
"'.dol_escape_htmltag($menu['url']).'">
';
5489 print dol_escape_htmltag($menu['url
']);
5493 print dol_escape_htmltag($menu['langs
']);
5497 print '<td
class=
"center">
';
5498 print dol_escape_htmltag($menu['position']);
5502 print '<td
class=
"tdoverflowmax200" title=
"'.dol_escape_htmltag($menu['enabled']).'">
';
5503 print dol_escape_htmltag($menu['enabled
']);
5507 print '<td
class=
"tdoverflowmax200" title=
"'.dol_escape_htmltag($menu['perms']).'">
';
5508 print dol_escape_htmltag($langs->trans($menu['perms
']));
5512 print '<td
class=
"center tdoverflowmax200" title=
"'.dol_escape_htmltag($menu['target']).'">
';
5513 print dol_escape_htmltag($menu['target
']);
5516 print '<td
class=
"center">
';
5517 if ($menu['user'] == 2) {
5518 print $langs->trans("AllMenus");
5519 } elseif ($menu['user'] == 0) {
5520 print $langs->trans('Internal
');
5521 } elseif ($menu['user'] == 1) {
5522 print $langs->trans('External
');
5524 print $menu['user']; // should not happen
5527 print '<td
class=
"center minwidth75 tdstickyright tdstickyghostwhite">
';
5528 if ($menu['titre
'] != 'Module
'.$module.'Name
') {
5529 print '<a
class=
"editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href=
"'.$_SERVER["PHP_SELF
"].'?action=editmenu&token='.newToken().'&menukey='.urlencode((string) ($i)).'&tab='.urlencode((string) ($tab)).'&module='.urlencode((string) ($module)).'&tabobj='.urlencode((string) ($tabobj)).'">
'.img_edit().'</a>
';
5530 print '<a
class=
"deletefielda reposition marginleftonly marginrighttonly paddingright paddingleft" href=
"'.$_SERVER["PHP_SELF
"].'?action=deletemenu&token='.newToken().'&menukey='.urlencode((string) ($i - 1)).'&tab='.urlencode((string) ($tab)).'&module='.urlencode((string) ($module)).'">
'.img_delete().'</a>
';
5537 print '<tr><td colspan=
"14"><span
class=
"opacitymedium">
'.$langs->trans("None").'</span></td></tr>
';
5546 $(document).ready(
function() {
5548 $(
"#leftmenu").on(
"input",
function() {
5549 var inputLeftMenu = $(
"#leftmenu").val();
5550 if (inputLeftMenu !== \
'\') {
5551 var url = \
''.dol_escape_js(strtolower($module)).
'\' + inputLeftMenu + \
'.php\';
5558 var groupedRights = ' . $groupedRights_json .
';
5559 var objectsSelect = $("select[id=\'objects\']");
5560 var permsSelect = $("select[id=\'perms\']");
5562 objectsSelect.change(function() {
5563 var selectedObject = $(this).val();
5565 permsSelect.empty();
5567 var rights = groupedRights[selectedObject];
5570 for (var i = 0; i < rights.length; i++) {
5571 var right = rights[i];
5572 var option = $("<option></option>").attr("value", right[5]).text(right[5]);
5573 permsSelect.append(option);
5576 var option = $("<option></option>").attr("value", "read").text("read");
5577 permsSelect.append(option);
5580 if (selectedObject !== "" && selectedObject !== null && rights) {
5585 if (objectsSelect.val() === "" || objectsSelect.val() === null) {
5596 $content = file_get_contents($fullpathoffile);
5599 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5600 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5601 print
'<input type="hidden" name="action" value="savefile">';
5602 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
5603 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
5604 print
'<input type="hidden" name="module" value="'.$module.
'">';
5606 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
5607 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
5608 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
5611 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
5613 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
5620 if ($tab ==
'permissions') {
5621 print
'<!-- tab=permissions -->'.
"\n";
5622 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
5624 $perms = $moduleobj->rights;
5627 $dir = $dirread.
'/'.$modulelowercase.
'/class';
5628 $listofobject =
dol_dir_list($dir,
'files', 0,
'\.class\.php$');
5629 $objects = array(
'myobject');
5631 foreach ($listofobject as $fileobj) {
5632 $tmpcontent = file_get_contents($fileobj[
'fullname']);
5633 if (preg_match(
'/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) {
5634 $objects[$fileobj[
'fullname']] = $reg[1];
5639 $crud = array(
'read' =>
'CRUDRead',
'write' =>
'CRUDCreateWrite',
'delete' =>
'Delete');
5640 $labels = array(
"Read objects of ".$module,
"Create/Update objects of ".$module,
"Delete objects of ".$module);
5642 $action =
GETPOST(
'action',
'alpha');
5644 if ($action ==
'deleteright') {
5645 $formconfirm = $form->formconfirm(
5646 $_SERVER[
"PHP_SELF"].
'?permskey='.urlencode((
string) (
GETPOSTINT(
'permskey'))).
'&tab='.urlencode((
string) ($tab)).
'&module='.urlencode((
string) ($module)).
'&tabobj='.urlencode((
string) ($tabobj)),
5647 $langs->trans(
'Delete'),
5648 $langs->trans(
'Confirm Delete Right',
GETPOST(
'permskey',
'alpha')),
5649 'confirm_deleteright',
5657 if ($action !=
'editfile' || empty($file)) {
5658 print
'<!-- Tab to manage permissions -->'.
"\n";
5659 print
'<span class="opacitymedium">';
5660 $htmlhelp = $langs->trans(
"PermissionsDefDescTooltip",
'{s1}');
5661 $htmlhelp = str_replace(
'{s1}',
'<a target="adminbis" class="nofocusvisible" href="'.DOL_URL_ROOT.
'/admin/perms.php">'.$langs->trans(
'DefaultRights').
'</a>', $htmlhelp);
5662 print $form->textwithpicto($langs->trans(
"PermissionsDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
5666 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
5667 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'&find=PERMISSIONS">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
5673 print
'<!-- form to add permissions -->'.
"\n";
5674 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5675 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5676 print
'<input type="hidden" name="action" value="addright">';
5677 print
'<input type="hidden" name="tab" value="permissions">';
5678 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5679 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
5681 print
'<div class="div-table-responsive">';
5682 print
'<table class="noborder">';
5684 print
'<tr class="liste_titre">';
5686 print_liste_field_titre(
"Object", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
"center");
5693 print
'<tr class="small">';
5694 print
'<td><input type="hidden" readonly name="id" class="width75" value="0"></td>';
5696 print
'<td><select class="minwidth100" name="permissionObj" id="permissionObj">';
5697 print
'<option value=""></option>';
5698 foreach ($objects as $obj) {
5699 if ($obj !=
'myobject') {
5700 print
'<option value="'.$obj.
'">'.$obj.
'</option>';
5703 print
'</select></td>';
5705 print
'<td><select class="maxwidth75" name="crud" id="crud">';
5706 print
'<option value=""></option>';
5707 foreach ($crud as $key => $val) {
5708 print
'<option value="'.$key.
'">'.$langs->trans($val).
'</option>';
5713 print
'<input type="text" name="label" id="label" class="minwidth200">';
5716 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
5717 print
'<input type="submit" class="button" name="add" value="'.$langs->trans(
"Add").
'">';
5721 if (count($perms)) {
5723 foreach ($perms as $perm) {
5727 if ($action ==
'edit_right' && $perm[0] ==
GETPOSTINT(
'permskey')) {
5728 print
'<tr class="oddeven">';
5729 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="modifPerms">';
5730 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5731 print
'<input type="hidden" name="tab" value="permissions">';
5732 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5733 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
5734 print
'<input type="hidden" name="action" value="update_right">';
5735 print
'<input type="hidden" name="counter" value="'.$i.
'">';
5737 print
'<input type="hidden" name="permskey" value="'.$perm[0].
'">';
5739 print
'<td class="tdsticky tdstickygray">';
5740 print
'<input class="width75" type="text" readonly value="'.dol_escape_htmltag($perm[0]).
'"/>';
5744 print
'<select name="crud">';
5745 print
'<option value="'.dol_escape_htmltag($perm[5]).
'">'.$langs->trans($perm[5]).
'</option>';
5746 foreach ($crud as $i => $x) {
5747 if ($perm[5] != $i) {
5748 print
'<option value="'.$i.
'">'.$langs->trans(ucfirst($x)).
'</option>';
5754 print
'<td><select name="permissionObj" >';
5755 print
'<option value="'.dol_escape_htmltag($perm[4]).
'">'.ucfirst($perm[4]).
'</option>';
5756 print
'</select></td>';
5759 print
'<input type="text" name="label" value="'.dol_escape_htmltag($perm[1]).
'">';
5762 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
5763 print
'<input id ="modifyPerm" class="reposition button smallpaddingimp" type="submit" name="modifyright" value="'.$langs->trans(
"Modify").
'"/>';
5765 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
5772 print
'<tr class="oddeven">';
5779 if (in_array($perm[5], array(
'lire',
'read',
'creer',
'write',
'effacer',
'delete'))) {
5787 if (in_array($perm[5], array(
'lire',
'read',
'creer',
'write',
'effacer',
'delete'))) {
5788 print ucfirst($langs->trans($perm[5]));
5790 print ucfirst($langs->trans($perm[4]));
5795 print $langs->trans($perm[1]);
5798 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
5799 print
'<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit_right&token='.
newToken().
'&permskey='.urlencode($perm[0]).
'&tab='.urlencode($tab).
'&module='.urlencode($module).
'&tabobj='.urlencode($tabobj).
'">'.
img_edit().
'</a>';
5800 print
'<a class="marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?action=deleteright&token='.
newToken().
'&permskey='.urlencode((
string) ($i)).
'&tab='.urlencode((
string) ($tab)).
'&module='.urlencode((
string) ($module)).
'&tabobj='.urlencode((
string) ($tabobj)).
'">'.
img_delete().
'</a>';
5808 print
'<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
5816 function updateInputField() {
5817 value1 = $("#crud").val();
5818 value2 = $("#permissionObj").val();
5820 // Vérifie si les deux sélections sont faites
5821 if (value1 && value2) {
5822 switch(value1.toLowerCase()){
5824 $("#label").val("Read "+value2+" object of '.ucfirst($module).
'")
5827 $("#label").val("Create/Update "+value2+" object of '.ucfirst($module).
'")
5830 $("#label").val("Delete "+value2+" object of '.ucfirst($module).
'")
5838 $("#crud, #permissionObj").change(function(){
5839 console.log("We change selection");
5847 $content = file_get_contents($fullpathoffile);
5850 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5851 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5852 print
'<input type="hidden" name="action" value="savefile">';
5853 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
5854 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
5855 print
'<input type="hidden" name="module" value="'.$module.
'">';
5857 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
5858 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
5859 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
5862 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
5864 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
5871 if ($tab ==
'hooks') {
5872 print
'<!-- tab=hooks -->'.
"\n";
5873 if ($action !=
'editfile' || empty($file)) {
5874 print
'<span class="opacitymedium">'.$langs->trans(
"HooksDefDesc").
'</span><br>';
5879 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
5881 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
5883 print
'<a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'&find=HOOKSCONTEXTS">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
5887 $pathtohook = strtolower($module).
'/class/actions_'.strtolower($module).
'.class.php';
5888 print
'<span class="fa fa-file"></span> '.$langs->trans(
"HooksFile").
' : ';
5890 print
'<strong class="wordbreak">'.$pathtohook.
'</strong>';
5892 print
'<td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a> ';
5893 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
5895 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
5896 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=inithook&token='.
newToken().
'&format=php&file='.urlencode($pathtohook).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</td>';
5903 $content = file_get_contents($fullpathoffile);
5906 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5907 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5908 print
'<input type="hidden" name="action" value="savefile">';
5909 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
5910 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
5911 print
'<input type="hidden" name="module" value="'.$module.
'">';
5913 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
5914 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
5915 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
5918 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
5920 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
5927 if ($tab ==
'triggers') {
5928 print
'<!-- tab=triggers -->'.
"\n";
5929 require_once DOL_DOCUMENT_ROOT.
'/core/class/interfaces.class.php';
5932 $triggers = $interfaces->getTriggersList(array(
'/'.strtolower($module).
'/core/triggers'));
5934 if ($action !=
'editfile' || empty($file)) {
5935 print
'<span class="opacitymedium">'.$langs->trans(
"TriggerDefDesc").
'</span><br>';
5940 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
5942 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
5944 print
'<a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'&find=module_parts">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
5947 if (!empty($triggers)) {
5948 foreach ($triggers as $trigger) {
5949 $pathtofile = $trigger[
'relpath'];
5952 print
'<span class="fa fa-file"></span> '.$langs->trans(
"TriggersFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
5953 print
'</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a></td>';
5954 print
'<td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
5959 print
'<span class="fa fa-file"></span> '.$langs->trans(
"TriggersFile");
5960 print
' : <span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
5961 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=inittrigger&token='.
newToken().
'&format=php">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a></td>';
5970 $content = file_get_contents($fullpathoffile);
5973 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5974 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5975 print
'<input type="hidden" name="action" value="savefile">';
5976 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
5977 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
5978 print
'<input type="hidden" name="module" value="'.$module.
'">';
5980 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
5981 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
5982 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
5985 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
5987 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
5994 if ($tab ==
'css') {
5995 print
'<!-- tab=css -->'.
"\n";
5996 if ($action !=
'editfile' || empty($file)) {
5997 print
'<span class="opacitymedium">'.$langs->trans(
"CSSDesc").
'</span><br>';
6003 $pathtohook = strtolower($module).
'/css/'.strtolower($module).
'.css.php';
6004 print
'<span class="fa fa-file"></span> '.$langs->trans(
"CSSFile").
' : ';
6006 print
'<strong class="wordbreak">'.$pathtohook.
'</strong>';
6007 print
'</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a></td>';
6008 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
6010 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6011 print
'</td><td><a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initcss&token='.
newToken().
'&format=php&file='.urlencode($pathtohook).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a></td>';
6017 $content = file_get_contents($fullpathoffile);
6020 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6021 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6022 print
'<input type="hidden" name="action" value="savefile">';
6023 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6024 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6025 print
'<input type="hidden" name="module" value="'.$module.
'">';
6027 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6028 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6031 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6033 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6041 print
'<!-- tab=js -->'.
"\n";
6042 if ($action !=
'editfile' || empty($file)) {
6043 print
'<span class="opacitymedium">'.$langs->trans(
"JSDesc").
'</span><br>';
6049 $pathtohook = strtolower($module).
'/js/'.strtolower($module).
'.js.php';
6050 print
'<span class="fa fa-file"></span> '.$langs->trans(
"JSFile").
' : ';
6052 print
'<strong class="wordbreak">'.$pathtohook.
'</strong>';
6053 print
'</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a></td>';
6054 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtohook).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
6056 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6057 print
'</td><td><a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initjs&token='.
newToken().
'&format=php&file='.urlencode($pathtohook).
'">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a></td>';
6063 $content = file_get_contents($fullpathoffile);
6066 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6067 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6068 print
'<input type="hidden" name="action" value="savefile">';
6069 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6070 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6071 print
'<input type="hidden" name="module" value="'.$module.
'">';
6073 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6074 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6077 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6079 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6086 if ($tab ==
'widgets') {
6087 print
'<!-- tab=widgets -->'.
"\n";
6088 require_once DOL_DOCUMENT_ROOT.
'/core/boxes/modules_boxes.php';
6092 if ($action !=
'editfile' || empty($file)) {
6093 print
'<span class="opacitymedium">'.$langs->trans(
"WidgetDesc").
'</span><br>';
6097 if (!empty($widgets)) {
6098 foreach ($widgets as $widget) {
6099 $pathtofile = $widget[
'relpath'];
6101 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"WidgetFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6102 print
'</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
6103 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
6107 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"WidgetFile").
' : <span class="opacitymedium">'.$langs->trans(
"NoWidget").
'</span>';
6108 print
'</td><td><a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initwidget&token='.
newToken().
'&format=php">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
6115 $content = file_get_contents($fullpathoffile);
6118 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6119 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6120 print
'<input type="hidden" name="action" value="savefile">';
6121 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6122 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6123 print
'<input type="hidden" name="module" value="'.$module.
'">';
6125 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6126 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6129 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6131 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6138 if ($tab ==
'emailings') {
6139 print
'<!-- tab=emailings -->'.
"\n";
6140 require_once DOL_DOCUMENT_ROOT.
'/core/modules/mailings/modules_mailings.php';
6144 if ($action !=
'editfile' || empty($file)) {
6145 print
'<span class="opacitymedium">'.$langs->trans(
"EmailingSelectorDesc").
'</span><br>';
6149 if (!empty($emailingselectors)) {
6150 foreach ($emailingselectors as $emailingselector) {
6151 $pathtofile = $emailingselector[
'relpath'];
6153 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"EmailingSelectorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6154 print
'</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
6155 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
6159 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"EmailingSelectorFile").
' : <span class="opacitymedium">'.$langs->trans(
"NoEmailingSelector").
'</span>';
6160 print
'</td><td><a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initemailing&token='.
newToken().
'&format=php">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
6167 $content = file_get_contents($fullpathoffile);
6170 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6171 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6172 print
'<input type="hidden" name="action" value="savefile">';
6173 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6174 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6175 print
'<input type="hidden" name="module" value="'.$module.
'">';
6177 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6178 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6181 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6183 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6190 if ($tab ==
'exportimport') {
6191 print
'<!-- tab=exportimport -->'.
"\n";
6192 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
6194 $exportlist = $moduleobj->export_label;
6195 $importlist = $moduleobj->import_label;
6197 if ($action !=
'editfile' || empty($file)) {
6198 print
'<span class="opacitymedium">'.$langs->transnoentities(
'ImportExportProfiles').
'</span><br>';
6201 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' ('.$langs->trans(
"ExportsArea").
') : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6202 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'&find=EXPORT">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
6204 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' ('.$langs->trans(
"ImportArea").
') : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6205 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'&find=IMPORT">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
6210 $content = file_get_contents($fullpathoffile);
6213 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6214 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6215 print
'<input type="hidden" name="action" value="savefile">';
6216 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6217 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6218 print
'<input type="hidden" name="module" value="'.$module.
'">';
6220 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
6221 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
6222 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6225 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6227 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6234 if ($tab ==
'cli') {
6235 print
'<!-- tab=cli -->'.
"\n";
6236 $clifiles = array();
6239 $dircli = array(
'/'.strtolower($module).
'/scripts');
6241 foreach ($dircli as $reldir) {
6246 if (!is_dir($newdir)) {
6250 $handle = opendir($newdir);
6252 if (is_resource($handle)) {
6253 while (($tmpfile = readdir($handle)) !==
false) {
6254 if (is_readable($newdir.
'/'.$tmpfile) && preg_match(
'/^(.+)\.php/', $tmpfile, $reg)) {
6255 if (preg_match(
'/\.back$/', $tmpfile)) {
6259 $clifiles[$i][
'relpath'] = preg_replace(
'/^\//',
'', $reldir).
'/'.$tmpfile;
6268 if ($action !=
'editfile' || empty($file)) {
6269 print
'<span class="opacitymedium">'.$langs->trans(
"CLIDesc").
'</span><br>';
6273 if (!empty($clifiles)) {
6274 foreach ($clifiles as $clifile) {
6275 $pathtofile = $clifile[
'relpath'];
6277 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"CLIFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6278 print
'</td><td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a></td>';
6279 print
'<td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
6283 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"CLIFile").
' : <span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6284 print
'</td><td><a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initcli&token='.
newToken().
'&format=php">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a>';
6291 $content = file_get_contents($fullpathoffile);
6294 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6295 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6296 print
'<input type="hidden" name="action" value="savefile">';
6297 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6298 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6299 print
'<input type="hidden" name="module" value="'.$module.
'">';
6301 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6302 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6305 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6307 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6314 if ($tab ==
'cron') {
6315 print
'<!-- tab=cron -->'.
"\n";
6316 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
6318 $cronjobs = $moduleobj->cronjobs;
6320 if ($action !=
'editfile' || empty($file)) {
6321 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>';
6324 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6325 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format=php&file='.urlencode($pathtofile).
'&find=CRON">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
6331 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6332 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6333 print
'<input type="hidden" name="action" value="addproperty">';
6334 print
'<input type="hidden" name="tab" value="objects">';
6335 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
6336 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
6338 print
'<div class="div-table-responsive">';
6339 print
'<table class="noborder">';
6341 print
'<tr class="liste_titre">';
6349 if (count($cronjobs)) {
6350 foreach ($cronjobs as $cron) {
6351 print
'<tr class="oddeven">';
6354 print $cron[
'label'];
6359 if ($cron[
'jobtype'] ==
'method') {
6360 $text = $langs->trans(
"CronClass");
6361 $texttoshow = $langs->trans(
'CronModule').
': '.$module.
'<br>';
6362 $texttoshow .= $langs->trans(
'CronClass').
': '.$cron[
'class'].
'<br>';
6363 $texttoshow .= $langs->trans(
'CronObject').
': '.$cron[
'objectname'].
'<br>';
6364 $texttoshow .= $langs->trans(
'CronMethod').
': '.$cron[
'method'];
6365 $texttoshow .=
'<br>'.$langs->trans(
'CronArgs').
': '.$cron[
'parameters'];
6366 $texttoshow .=
'<br>'.$langs->trans(
'Comment').
': '.$langs->trans($cron[
'comment']);
6367 } elseif ($cron[
'jobtype'] ==
'command') {
6368 $text = $langs->trans(
'CronCommand');
6369 $texttoshow = $langs->trans(
'CronCommand').
': '.
dol_trunc($cron[
'command']);
6370 $texttoshow .=
'<br>'.$langs->trans(
'CronArgs').
': '.$cron[
'parameters'];
6371 $texttoshow .=
'<br>'.$langs->trans(
'Comment').
': '.$langs->trans($cron[
'comment']);
6373 print $form->textwithpicto($text, $texttoshow, 1);
6377 if ($cron[
'unitfrequency'] ==
"60") {
6378 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Minutes');
6380 if ($cron[
'unitfrequency'] ==
"3600") {
6381 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Hours');
6383 if ($cron[
'unitfrequency'] ==
"86400") {
6384 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Days');
6386 if ($cron[
'unitfrequency'] ==
"604800") {
6387 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Weeks');
6392 print $cron[
'status'];
6396 if (!empty($cron[
'comment'])) {
6397 print $cron[
'comment'];
6404 print
'<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
6414 $content = file_get_contents($fullpathoffile);
6417 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6418 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6419 print
'<input type="hidden" name="action" value="savefile">';
6420 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6421 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6422 print
'<input type="hidden" name="module" value="'.$module.
'">';
6424 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
6425 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
6426 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6429 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6431 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6438 if ($tab ==
'specifications') {
6439 print
'<!-- tab=specifications -->'.
"\n";
6442 if ($action !=
'editfile' || empty($file)) {
6443 print
'<span class="opacitymedium">'.$langs->trans(
"SpecDefDesc").
'</span><br>';
6447 if (is_array($specs) && !empty($specs)) {
6448 foreach ($specs as $spec) {
6449 $pathtofile = $modulelowercase.
'/doc/'.$spec[
'relativename'];
6450 $format =
'asciidoc';
6451 if (preg_match(
'/\.md$/i', $spec[
'name'])) {
6452 $format =
'markdown';
6455 print
'<span class="fa fa-file"></span> '.$langs->trans(
"SpecificationFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6456 print
'</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a></td>';
6457 print
'<td><a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($pathtofile).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a></td>';
6462 print
'<span class="fa fa-file"></span> '.$langs->trans(
"SpecificationFile").
' : <span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6463 print
'</td><td><a href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=initdoc&token='.
newToken().
'&format=php">'.
img_picto(
'Generate',
'generate',
'class="paddingleft"').
'</a></td>';
6474 $content = file_get_contents($fullpathoffile);
6477 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6478 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6479 print
'<input type="hidden" name="action" value="savefile">';
6480 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6481 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6482 print
'<input type="hidden" name="module" value="'.$module.
'">';
6484 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6485 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6488 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6490 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6496 print
'<br><br><br>';
6498 $FILENAMEDOC = $modulelowercase.
'.html';
6499 $FILENAMEDOCPDF = $modulelowercase.
'.pdf';
6500 $outputfiledoc =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOC;
6501 $outputfiledocurl =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOC;
6502 $outputfiledocrel = $modulelowercase.
'/doc/'.$FILENAMEDOC;
6503 $outputfiledocpdf =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOCPDF;
6504 $outputfiledocurlpdf =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOCPDF;
6505 $outputfiledocrelpdf = $modulelowercase.
'/doc/'.$FILENAMEDOCPDF;
6508 print
'<span class="fa fa-file"></span> '.$langs->trans(
"PathToModuleDocumentation",
"HTML").
' : ';
6510 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6513 print
'<a href="'.$outputfiledocurl.
'" target="_blank" rel="noopener noreferrer">';
6514 print $outputfiledoc;
6517 print
' <span class="opacitymedium">('.$langs->trans(
"GeneratedOn").
' '.
dol_print_date(
dol_filemtime($outputfiledoc),
'dayhour').
')</span>';
6518 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($outputfiledocrel).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
6520 print
'</strong><br>';
6523 print
'<span class="fa fa-file"></span> '.$langs->trans(
"PathToModuleDocumentation",
"PDF").
' : ';
6525 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6528 print
'<a href="'.$outputfiledocurlpdf.
'" target="_blank" rel="noopener noreferrer">';
6529 print $outputfiledocpdf;
6532 print
' <span class="opacitymedium">('.$langs->trans(
"GeneratedOn").
' '.
dol_print_date(
dol_filemtime($outputfiledocpdf),
'dayhour').
')</span>';
6533 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&format='.$format.
'&file='.urlencode($outputfiledocrelpdf).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
6535 print
'</strong><br>';
6539 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="generatedoc">';
6540 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6541 print
'<input type="hidden" name="action" value="generatedoc">';
6542 print
'<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).
'">';
6543 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
6544 print
'<input type="submit" class="button" name="generatedoc" value="'.$langs->trans(
"BuildDocumentation").
'"';
6545 if (!is_array($specs) || empty($specs)) {
6546 print
' disabled="disabled"';
6552 if ($tab ==
'buildpackage') {
6553 print
'<!-- tab=buildpackage -->'.
"\n";
6554 print
'<span class="opacitymedium">'.$langs->trans(
"BuildPackageDesc").
'</span>';
6557 if (!class_exists(
'ZipArchive') && !defined(
'ODTPHP_PATHTOPCLZIP')) {
6558 print
img_warning().
' '.$langs->trans(
"ErrNoZipEngine");
6562 $modulelowercase = strtolower($module);
6568 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
6570 $class =
'mod'.$module;
6572 if (class_exists($class)) {
6574 $moduleobj =
new $class($db);
6575 '@phan-var-force DolibarrMOdules $moduleobj';
6582 $langs->load(
"errors");
6583 dol_print_error($db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
6587 $arrayversion = explode(
'.', $moduleobj->version, 3);
6588 if (count($arrayversion)) {
6589 $FILENAMEZIP =
"module_".$modulelowercase.
'-'.$arrayversion[0].(empty($arrayversion[1]) ?
'.0' :
'.'.$arrayversion[1]).(empty($arrayversion[2]) ?
'' :
".".$arrayversion[2]).
".zip";
6590 $outputfilezip =
dol_buildpath($modulelowercase, 0).
'/bin/'.$FILENAMEZIP;
6595 print
'<span class="fa fa-file"></span> '.$langs->trans(
"PathToModulePackage").
' : ';
6597 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6599 $relativepath = $modulelowercase.
'/bin/'.$FILENAMEZIP;
6600 print
'<strong><a href="'.DOL_URL_ROOT.
'/document.php?modulepart=packages&file='.urlencode($relativepath).
'">'.$outputfilezip.
'</a></strong>';
6601 print
' <span class="opacitymedium">('.$langs->trans(
"GeneratedOn").
' '.
dol_print_date(
dol_filemtime($outputfilezip),
'dayhour').
')</span>';
6602 print
' <a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=confirm_removefile&token='.
newToken().
'&file='.urlencode($relativepath).
'">'.
img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
6610 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="generatepackage">';
6611 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6612 print
'<input type="hidden" name="action" value="generatepackage">';
6613 print
'<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).
'">';
6614 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
6615 print
'<input type="submit" class="button" name="generatepackage" value="'.$langs->trans(
"BuildPackage").
'">';
6619 if ($tab ==
'tabs') {
6620 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
6622 $tabs = $moduleobj->tabs;
6624 if ($action !=
'editfile' || empty($file)) {
6625 print
'<span class="opacitymedium">';
6626 $htmlhelp = $langs->trans(
"TabsDefDescTooltip",
'{s1}');
6627 $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);
6628 print $form->textwithpicto($langs->trans(
"TabsDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
6632 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong>'.$pathtofile.
'</strong>';
6633 print
' <a class="editfielda paddingleft paddingright" href="'.$_SERVER[
'PHP_SELF'].
'?tab='.urlencode($tab).
'&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&action=editfile&format=php&file='.urlencode($pathtofile).
'&find=TABS">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
6639 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6640 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6641 print
'<input type="hidden" name="action" value="addproperty">';
6642 print
'<input type="hidden" name="tab" value="objects">';
6643 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
6644 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
6646 print
'<div class="div-table-responsive">';
6647 print
'<table class="noborder small">';
6649 print
'<tr class="liste_titre">';
6659 foreach ($tabs as $tab) {
6660 $parts = explode(
':', $tab[
'data']);
6662 $objectType = $parts[0];
6663 $tabName = $parts[1];
6664 $tabTitle = isset($parts[2]) ? $parts[2] :
'';
6665 $langFile = isset($parts[3]) ? $parts[3] :
'';
6666 $condition = isset($parts[4]) ? $parts[4] :
'';
6667 $path = isset($parts[5]) ? $parts[5] :
'';
6671 if ($tabName[0] ===
'-') {
6673 $condition = isset($parts[2]) ? $parts[2] :
'';
6676 print
'<tr class="oddeven">';
6683 if ($tabName[0] ===
"+") {
6684 print
'<span class="badge badge-status4 badge-status">' .
dol_escape_htmltag($tabName) .
'</span>';
6686 print
'<span class="badge badge-status8 badge-status">' .
dol_escape_htmltag($tabName) .
'</span>';
6709 print
'<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
6719 $content = file_get_contents($fullpathoffile);
6722 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6723 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6724 print
'<input type="hidden" name="action" value="savefile">';
6725 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6726 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6727 print
'<input type="hidden" name="module" value="'.$module.
'">';
6729 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
6730 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
6731 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6734 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6736 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6743 if ($tab !=
'description') {