33if (!defined(
'NOSCANPOSTFORINJECTION')) {
34 define(
'NOSCANPOSTFORINJECTION',
'1');
38require
'../main.inc.php';
51@phan-var-force string $dolibarr_main_document_root
52@phan-var-force string $dolibarr_main_document_root_alt
54require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/lib/modulebuilder.lib.php';
58require_once DOL_DOCUMENT_ROOT.
'/modulebuilder/class/NamingContractValidator.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/core/class/utils.class.php';
63$langs->loadLangs(array(
"admin",
"modulebuilder",
"exports",
"other",
"cron",
"errors",
"uxdocumentation"));
66$action =
GETPOST(
'action',
'aZ09');
67$confirm =
GETPOST(
'confirm',
'alpha');
68$cancel =
GETPOST(
'cancel',
'alpha');
70$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
71$sortorder =
GETPOST(
'sortorder',
'aZ09');
75$tabobj =
GETPOST(
'tabobj',
'alpha');
76$tabdic =
GETPOST(
'tabdic',
'alpha');
77$propertykey =
GETPOST(
'propertykey',
'alpha');
79 $module =
'initmodule';
84'@phan-var-force string $tab';
86 $tabobj =
'newobjectifnoobj';
89 $tabdic =
'newdicifnodic';
91$file =
GETPOST(
'file',
'alpha');
92$find =
GETPOST(
'find',
'alpha');
109if (!$user->hasRight(
"modulebuilder",
"run")) {
114$tmp = explode(
',', $dolibarr_main_document_root_alt);
119$tmpdir = explode(
'@', $module);
120if (!empty($tmpdir[1])) {
121 $module = $tmpdir[0];
122 $dirread = $tmpdir[1];
125if (
GETPOST(
'dirins',
'alpha')) {
126 $dirread = $dirins =
GETPOST(
'dirins',
'alpha');
130$FILEFLAG =
'modulebuilder.txt';
137if (empty($newmask)) {
149$dirsrootforscan = array($dirread);
153 $dirsrootforscan[] = DOL_DOCUMENT_ROOT;
157$textforlistofdirs =
'<!-- Directory scanned -->'.
"\n";
158$listofmodules = array();
159'@phan-var-force array<string,array{modulenamewithcase:string,moduledescriptorrelpath:string,moduledescriptorfullpath:string,moduledescriptorrootpath,moduletype?:string}> $listofmodules';
161foreach ($dirsrootforscan as $tmpdirread) {
162 $moduletype =
'external';
163 if ($tmpdirread == DOL_DOCUMENT_ROOT) {
164 $moduletype =
'internal';
167 $dirsincustom =
dol_dir_list($tmpdirread,
'directories');
168 if (is_array($dirsincustom) && count($dirsincustom) > 0) {
169 foreach ($dirsincustom as $dircustomcursor) {
170 $fullname = $dircustomcursor[
'fullname'];
173 $dirtoscanrel = basename($fullname).
'/core/modules/';
175 $descriptorfiles =
dol_dir_list(dirname($fullname).
'/'.$dirtoscanrel,
'files', 0,
'mod.*\.class\.php$');
176 if (empty($descriptorfiles)) {
177 $dirtoscanrel =
'core/modules/';
178 $descriptorfiles =
dol_dir_list($fullname.
'/../'.$dirtoscanrel,
'files', 0,
'mod'.strtoupper(basename($fullname)).
'\.class\.php$');
180 $modulenamewithcase =
'';
181 $moduledescriptorrelpath =
'';
182 $moduledescriptorfullpath =
'';
184 foreach ($descriptorfiles as $descriptorcursor) {
185 $modulenamewithcase = preg_replace(
'/^mod/',
'', $descriptorcursor[
'name']);
186 $modulenamewithcase = preg_replace(
'/\.class\.php$/',
'', $modulenamewithcase);
187 $moduledescriptorrelpath = $dirtoscanrel.$descriptorcursor[
'name'];
188 $moduledescriptorfullpath = $descriptorcursor[
'fullname'];
191 if ($modulenamewithcase) {
192 $listofmodules[$dircustomcursor[
'name']] = array(
193 'modulenamewithcase' => $modulenamewithcase,
194 'moduledescriptorrelpath' => $moduledescriptorrelpath,
195 'moduledescriptorfullpath' => $moduledescriptorfullpath,
196 'moduledescriptorrootpath' => $tmpdirread,
197 'moduletype' => $moduletype
205 if ($forceddirread && empty($listofmodules)) {
206 $listofmodules[strtolower($module)] = array(
207 'modulenamewithcase' => $module,
208 'moduledescriptorrelpath' =>
'notyetimplemented',
209 'moduledescriptorfullpath' =>
'notyetimplemented',
210 'moduledescriptorrootpath' =>
'notyetimplemented',
215 $newdircustom = $dirins;
216 if (empty($newdircustom)) {
222 $textforlistofdirs .= $langs->trans(
"DirScanned").
' : ';
224 $textforlistofdirs .=
', ';
226 $textforlistofdirs .=
'<strong class="wordbreakimp">'.$tmpdirread.
'</strong>';
227 if ($tmpdirread == DOL_DOCUMENT_ROOT) {
229 $textforlistofdirs .= $form->textwithpicto(
'', $langs->trans(
"ConstantIsOn",
"MAIN_FEATURES_LEVEL"));
232 $textforlistofdirs .= $form->textwithpicto(
'', $langs->trans(
"ConstantIsOn",
"MODULEBUILDER_ADD_DOCUMENT_ROOT"));
245 $error = error_get_last();
246 if ($error && ($error[
'type'] & (E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR))) {
248 echo
"Fatal error occurred: {$error['message']} in {$error['file']} on line {$error['line']}";
250 if (headers_sent()) {
255register_shutdown_function(
"moduleBuilderShutdownFunction");
269 $licInfo = $user->getFullName($langs);
270 $emailTabs = str_repeat(
"\t", (
int) (max(0, (31 - mb_strlen($licInfo)) / 4)));
271 $licInfo .= ($user->email ? $emailTabs.
'<'.$user->email.
'>' :
'');
288function modulebuilderValidateGeneratedFile(
string $destfile,
NamingContract $nc): void
290 $content = file_get_contents($destfile);
291 if ($content ===
false) {
295 $errors = $validator->validateContent($content, $destfile);
296 if (!empty($errors)) {
298 'ModuleBuilder NamingContract validation warning in ' . $destfile .
': '
299 . implode(
'; ', array_slice($errors, 0, 3)),
302 $safeErrors = array_map(
'dol_escape_htmltag', array_slice($errors, 0, 5));
307if ($dirins && $action ==
'initmodule' && $modulename) {
309 $destdir =
'/not_set/';
312 if (preg_match(
'/[^a-z0-9]/i', $modulename)) {
314 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
318 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
319 $destdir = $dirins.
'/'.strtolower($modulename);
321 $arrayreplacement = [
322 'mymodule' => $ncModule->moduleNameLower,
323 'MyModule' => $ncModule->moduleNameCase,
325 $result =
dolCopyDir($srcdir, $destdir,
'0', 0, $arrayreplacement);
330 $langs->load(
"errors");
331 setEventMessages($langs->trans(
"ErrorFailToCopyDir", $srcdir, $destdir),
null,
'errors');
334 setEventMessages($langs->trans(
"AllFilesDidAlreadyExist", $srcdir, $destdir),
null,
'warnings');
340 $tryToCopyFromSetupClass =
true;
341 $backportDest = $destdir .
'/backport/v16/core/class';
342 $backportFileSrc = DOL_DOCUMENT_ROOT.
'/core/class/html.formsetup.class.php';
343 $backportFileDest = $backportDest.
'/html.formsetup.class.php';
348 $langs->load(
"errors");
349 setEventMessages($langs->trans(
"ErrorFailToCreateDir", $backportDest),
null,
'errors');
350 $tryToCopyFromSetupClass =
false;
353 if ($tryToCopyFromSetupClass) {
354 $result =
dol_copy($backportFileSrc, $backportFileDest);
358 $langs->load(
"errors");
359 setEventMessages($langs->trans(
"ErrorFailToCopyFile", $backportFileSrc, $backportFileDest),
null,
'errors');
361 setEventMessages($langs->trans(
"FileDidAlreadyExist", $backportFileDest),
null,
'warnings');
384 dol_delete_file($destdir.
'/class/actions_'.strtolower($modulename).
'.class.php');
385 dol_delete_file($destdir.
'/class/api_'.strtolower($modulename).
'.class.php');
403 dol_delete_file($destdir.
'/lib/'.strtolower($modulename).
'_myobject.lib.php');
404 dol_delete_file($destdir.
'/test/phpunit/functional/'.$modulename.
'FunctionalTest.php');
406 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject.sql');
407 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject_extrafields.sql');
408 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject.key.sql');
409 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject_extrafields.key.sql');
425 $listofphpfilestoedit =
dol_dir_list($destdir,
'files', 1,
'\.(php|MD|js|sql|txt|xml|lang)$',
'',
'fullname', SORT_ASC, 0, 1);
428 foreach ($listofphpfilestoedit as $phpfileval) {
430 $arrayreplacement = array_merge(
431 $ncModule->getSubstitutionMap(),
433 'htdocs/modulebuilder/template' => $ncModule->moduleNameLower,
434 '---Put here your own copyright and developer email---' => $licInfo,
435 '---Replace with your own copyright and developer email---' => $licInfo,
436 'Editor name' => $editorname,
437 'https://www.example.com' => $editorurl,
438 '$this->version = \'1.0\'' =>
'$this->version = \'' . $version .
'\'',
439 '$this->picto = \'generic\';' => (empty($picto)) ?
'$this->picto = \'generic\'' :
'$this->picto = \'' . $picto .
'\';',
440 'modulefamily' => $family,
444 '$this->numero = 500000' =>
'$this->numero = '.$idmodule,
449 $arrayreplacement[
'---Replace with your own copyright and developer email---'] =
dol_print_date($now,
'%Y').
"\t\t" .
getDolGlobalString(
'MODULEBUILDER_SPECIFIC_AUTHOR');
456 setEventMessages($langs->trans(
"ErrorFailToMakeReplacementInto", $phpfileval[
'fullname']),
null,
'errors');
461 setEventMessages($langs->trans(
"ContentOfREADMECustomized"),
null,
'warnings');
463 file_put_contents($destdir.
'/README.md',
getDolGlobalString(
"MODULEBUILDER_SPECIFIC_README"));
475 $module = $modulename;
477 clearstatcache(
true);
478 if (function_exists(
'opcache_invalidate')) {
482 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?module='.$modulename);
487$destdir =
'/not_set/';
488$destfile =
'/not_set/';
489$srcfile =
'/not_set/';
492if ($dirins && in_array($action, array(
'initapi',
'initphpunit',
'initpagecontact',
'initpagedocument',
'initpagenote',
'initpageagenda')) && !empty($module) ) {
493 $modulename = ucfirst($module);
494 $objectname = $tabobj;
495 $varnametoupdate =
'';
496 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
497 $destdir = $dirins.
'/'.strtolower($module);
503 if ($action ==
'initapi') {
504 if (file_exists($dirins.
'/'.strtolower($module).
'/class/api_'.strtolower($module).
'.class.php')) {
505 $result =
dol_copy(DOL_DOCUMENT_ROOT.
'/modulebuilder/template/class/api_mymodule.class.php', $dirins.
'/'.strtolower($module).
'/class/api_'.strtolower($module).
'.class.php',
'0', 1);
507 dol_mkdir($dirins.
'/'.strtolower($module).
'/class');
508 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
509 $srcfile = $srcdir.
'/class/api_mymodule.class.php';
510 $destfile = $dirins.
'/'.strtolower($module).
'/class/api_'.strtolower($module).
'.class.php';
511 } elseif ($action ==
'initphpunit') {
512 dol_mkdir($dirins.
'/'.strtolower($module).
'/test/phpunit');
513 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
514 $srcfile = $srcdir.
'/test/phpunit/MyObjectTest.php';
515 $destfile = $dirins.
'/'.strtolower($module).
'/test/phpunit/'.strtolower($objectname).
'Test.php';
516 } elseif ($action ==
'initpagecontact') {
517 dol_mkdir($dirins.
'/'.strtolower($module));
518 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
519 $srcfile = $srcdir.
'/myobject_contact.php';
520 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_contact.php';
521 $varnametoupdate =
'showtabofpagecontact';
522 } elseif ($action ==
'initpagedocument') {
523 dol_mkdir($dirins.
'/'.strtolower($module));
524 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
525 $srcfile = $srcdir.
'/myobject_document.php';
526 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_document.php';
527 $varnametoupdate =
'showtabofpagedocument';
528 } elseif ($action ==
'initpagenote') {
529 dol_mkdir($dirins.
'/'.strtolower($module));
530 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
531 $srcfile = $srcdir.
'/myobject_note.php';
532 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_note.php';
533 $varnametoupdate =
'showtabofpagenote';
534 } elseif ($action ==
'initpageagenda') {
535 dol_mkdir($dirins.
'/'.strtolower($module));
536 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
537 $srcfile = $srcdir.
'/myobject_agenda.php';
538 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_agenda.php';
539 $varnametoupdate =
'showtabofpageagenda';
542 if (!file_exists($destfile)) {
543 $result =
dol_copy($srcfile, $destfile,
'0', 0);
550 }
catch (\InvalidArgumentException $e) {
552 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
556 if (!$error && $ncApiObj !==
null) {
557 $arrayreplacement = array_merge(
558 $ncApiObj->getSubstitutionMap(),
560 'htdocs/modulebuilder/template' => $ncApiObj->moduleNameLower,
561 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now),
565 if ($action ==
'initapi') {
566 if (count($objects) >= 1) {
572 $headerFix = $arrayreplacement;
573 unset($headerFix[
'MYOBJECT']);
576 modulebuilderValidateGeneratedFile($destfile, $ncApiObj);
580 modulebuilderValidateGeneratedFile($destfile, $ncApiObj);
584 if ($varnametoupdate) {
586 $srcfile = $dirins.
'/'.strtolower($module).
'/lib/'.strtolower($module).
'_'.strtolower($objectname).
'.lib.php';
587 $arrayreplacement = array(
'/\$'.preg_quote($varnametoupdate,
'/').
' = 0;/' =>
'$'.$varnametoupdate.
' = 1;');
592 $langs->load(
"errors");
593 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
599if ($dirins && $action ==
'initsqlextrafields' && !empty($module) ) {
600 $modulename = ucfirst($module);
601 $objectname = $tabobj;
603 dol_mkdir($dirins.
'/'.strtolower($module).
'/sql');
604 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
605 $srcfile1 = $srcdir.
'/sql/llx_mymodule_myobject_extrafields.sql';
606 $destfile1 = $dirins.
'/'.strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.sql';
607 $result1 =
dol_copy($srcfile1, $destfile1,
'0', 0);
608 $srcfile2 = $srcdir.
'/sql/llx_mymodule_myobject_extrafields.key.sql';
609 $destfile2 = $dirins.
'/'.strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.key.sql';
610 $result2 =
dol_copy($srcfile2, $destfile2,
'0', 0);
612 if ($result1 > 0 && $result2 > 0) {
613 $modulename = ucfirst($module);
618 }
catch (\InvalidArgumentException $e) {
620 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
624 if (!$error && $ncSqlObj !==
null) {
625 $arrayreplacement = array_merge(
626 $ncSqlObj->getSubstitutionMap(),
628 'htdocs/modulebuilder/template' => $ncSqlObj->moduleNameLower,
629 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now),
635 modulebuilderValidateGeneratedFile($destfile1, $ncSqlObj);
636 modulebuilderValidateGeneratedFile($destfile2, $ncSqlObj);
639 $langs->load(
"errors");
641 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile1),
null,
'errors');
644 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile2),
null,
'errors');
649 $srcfile = $dirins.
'/'.strtolower($module).
'/class/'.strtolower($objectname).
'.class.php';
650 $arrayreplacement = array(
'/\$this->isextrafieldmanaged = 0;/' =>
'$this->isextrafieldmanaged = 1;');
651 $arrayreplacement = array(
'/\$isextrafieldmanaged = 0;/' =>
'$isextrafieldmanaged = 1;');
657if ($dirins && $action ==
'inithook' && !empty($module) ) {
658 dol_mkdir($dirins.
'/'.strtolower($module).
'/class');
659 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
660 $srcfile = $srcdir.
'/class/actions_mymodule.class.php';
661 $destfile = $dirins.
'/'.strtolower($module).
'/class/actions_'.strtolower($module).
'.class.php';
662 $result =
dol_copy($srcfile, $destfile,
'0', 0);
665 $modulename = ucfirst($module);
668 $arrayreplacement = array(
669 'mymodule' => strtolower($modulename),
670 'MyModule' => $modulename,
671 'MYMODULE' => strtoupper($modulename),
672 'My module' => $modulename,
673 'my module' => $modulename,
674 'Mon module' => $modulename,
675 'mon module' => $modulename,
676 'htdocs/modulebuilder/template' => strtolower($modulename),
677 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
683 $langs->load(
"errors");
684 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
690if ($dirins && $action ==
'inittrigger' && !empty($module) ) {
691 dol_mkdir($dirins.
'/'.strtolower($module).
'/core/triggers');
692 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
693 $srcfile = $srcdir.
'/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php';
694 $destfile = $dirins.
'/'.strtolower($module).
'/core/triggers/interface_99_mod'.$module.
'_'.$module.
'Triggers.class.php';
695 $result =
dol_copy($srcfile, $destfile,
'0', 0);
698 $modulename = ucfirst($module);
701 $arrayreplacement = array(
702 'mymodule' => strtolower($modulename),
703 'MyModule' => $modulename,
704 'MYMODULE' => strtoupper($modulename),
705 'My module' => $modulename,
706 'my module' => $modulename,
707 'Mon module' => $modulename,
708 'mon module' => $modulename,
709 'htdocs/modulebuilder/template' => strtolower($modulename),
710 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
716 $langs->load(
"errors");
717 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
723if ($dirins && $action ==
'initwidget' && !empty($module) ) {
724 dol_mkdir($dirins.
'/'.strtolower($module).
'/core/boxes');
725 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
726 $srcfile = $srcdir.
'/core/boxes/mymodulewidget1.php';
727 $destfile = $dirins.
'/'.strtolower($module).
'/core/boxes/'.strtolower($module).
'widget1.php';
728 $result =
dol_copy($srcfile, $destfile,
'0', 0);
731 $modulename = ucfirst($module);
734 $arrayreplacement = array(
735 'mymodule' => strtolower($modulename),
736 'MyModule' => $modulename,
737 'MYMODULE' => strtoupper($modulename),
738 'My module' => $modulename,
739 'my module' => $modulename,
740 'Mon module' => $modulename,
741 'mon module' => $modulename,
742 'htdocs/modulebuilder/template' => strtolower($modulename),
743 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
749 $langs->load(
"errors");
750 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
756if ($dirins && $action ==
'initemailing' && !empty($module) ) {
757 dol_mkdir($dirins.
'/'.strtolower($module).
'/core/modules/mailings');
758 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
759 $srcfile = $srcdir.
'/core/modules/mailings/mailing_mymodule_selector1.modules.php';
760 $destfile = $dirins.
'/'.strtolower($module).
'/core/modules/mailings/mailing_'.strtolower($module).
'_selector1.modules.php';
761 $result =
dol_copy($srcfile, $destfile,
'0', 0);
764 $modulename = ucfirst($module);
767 $arrayreplacement = array(
768 'mymodule' => strtolower($modulename),
769 'MyModule' => $modulename,
770 'MYMODULE' => strtoupper($modulename),
771 'My module' => $modulename,
772 'my module' => $modulename,
773 'Mon module' => $modulename,
774 'mon module' => $modulename,
775 'htdocs/modulebuilder/template' => strtolower($modulename),
776 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
782 $langs->load(
"errors");
783 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
789if ($dirins && $action ==
'initcss' && !empty($module) ) {
790 dol_mkdir($dirins.
'/'.strtolower($module).
'/css');
791 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
792 $srcfile = $srcdir.
'/css/mymodule.css.php';
793 $destfile = $dirins.
'/'.strtolower($module).
'/css/'.strtolower($module).
'.css.php';
794 $result =
dol_copy($srcfile, $destfile,
'0', 0);
797 $modulename = ucfirst($module);
800 $arrayreplacement = array(
801 'mymodule' => strtolower($modulename),
802 'MyModule' => $modulename,
803 'MYMODULE' => strtoupper($modulename),
804 'My module' => $modulename,
805 'my module' => $modulename,
806 'Mon module' => $modulename,
807 'mon module' => $modulename,
808 'htdocs/modulebuilder/template' => strtolower($modulename),
809 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
816 $srcfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
817 $arrayreplacement = array(
'/\/\/\s*\''.preg_quote(
'/'.strtolower($module).
'/css/'.strtolower($module).
'.css.php',
'/').
'\'/
' => '\
'/'.strtolower($module).
'/css/'.strtolower($module).
'.css.php\'');
820 $langs->load(
"errors");
821 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
827if ($dirins && $action ==
'initjs' && !empty($module) ) {
828 dol_mkdir($dirins.
'/'.strtolower($module).
'/js');
829 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
830 $srcfile = $srcdir.
'/js/mymodule.js.php';
831 $destfile = $dirins.
'/'.strtolower($module).
'/js/'.strtolower($module).
'.js.php';
832 $result =
dol_copy($srcfile, $destfile,
'0', 0);
835 $modulename = ucfirst($module);
838 $arrayreplacement = array(
839 'mymodule' => strtolower($modulename),
840 'MyModule' => $modulename,
841 'MYMODULE' => strtoupper($modulename),
842 'My module' => $modulename,
843 'my module' => $modulename,
844 'Mon module' => $modulename,
845 'mon module' => $modulename,
846 'htdocs/modulebuilder/template' => strtolower($modulename),
847 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
854 $srcfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
855 $arrayreplacement = array(
'/\/\/\s*\''.preg_quote(
'/'.strtolower($module).
'/js/'.strtolower($module).
'.js.php',
'/').
'\'/
' => '\
'/'.strtolower($module).
'/js/'.strtolower($module).
'.js.php\'');
858 $langs->load(
"errors");
859 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
865if ($dirins && $action ==
'initcli' && !empty($module) ) {
866 dol_mkdir($dirins.
'/'.strtolower($module).
'/scripts');
867 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
868 $srcfile = $srcdir.
'/scripts/mymodule.php';
869 $destfile = $dirins.
'/'.strtolower($module).
'/scripts/'.strtolower($module).
'.php';
870 $result =
dol_copy($srcfile, $destfile,
'0', 0);
873 $modulename = ucfirst($module);
876 $arrayreplacement = array(
877 'mymodule' => strtolower($modulename),
878 'MyModule' => $modulename,
879 'MYMODULE' => strtoupper($modulename),
880 'My module' => $modulename,
881 'my module' => $modulename,
882 'Mon module' => $modulename,
883 'mon module' => $modulename,
884 'htdocs/modulebuilder/template' => strtolower($modulename),
885 '__MYCOMPANY_NAME__' =>
$mysoc->name,
886 '__KEYWORDS__' => $modulename,
887 '__USER_FULLNAME__' => $user->getFullName($langs),
888 '__USER_EMAIL__' => $user->email,
890 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
896 $langs->load(
"errors");
897 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
902$moduledescriptorfile =
'/not_set/';
903$modulelowercase =
null;
906if ($dirins && $action ==
'initdoc' && !empty($module) ) {
907 dol_mkdir($dirins.
'/'.strtolower($module).
'/doc');
908 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
909 $srcfile = $srcdir.
'/doc/Documentation.asciidoc';
910 $destfile = $dirins.
'/'.strtolower($module).
'/doc/Documentation.asciidoc';
911 $result =
dol_copy($srcfile, $destfile,
'0', 0);
914 $modulename = ucfirst($module);
915 $modulelowercase = strtolower($module);
918 $arrayreplacement = array(
919 'mymodule' => strtolower($modulename),
920 'MyModule' => $modulename,
921 'MYMODULE' => strtoupper($modulename),
922 'My module' => $modulename,
923 'my module' => $modulename,
924 'Mon module' => $modulename,
925 'mon module' => $modulename,
926 'htdocs/modulebuilder/template' => strtolower($modulename),
927 '__MYCOMPANY_NAME__' =>
$mysoc->name,
928 '__KEYWORDS__' => $modulename,
929 '__USER_FULLNAME__' => $user->getFullName($langs),
930 '__USER_EMAIL__' => $user->email,
932 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
939 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
940 $destdir = $dirins.
'/'.strtolower($module);
942 foreach ($objects as $path => $obj) {
947 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
951 if (file_exists($dirins.
'/'.strtolower($module).
'/class/api_'.strtolower($module).
'.class.php')) {
952 $apiFile = $dirins.
'/'.strtolower($module).
'/class/api_'.strtolower($module).
'.class.php';
957 if (file_exists($dirins.
'/'.strtolower($module).
'/ChangeLog.md')) {
958 $changeLog = $dirins.
'/'.strtolower($module).
'/ChangeLog.md';
959 $string = file_get_contents($changeLog);
961 $replace = explode(
"\n", $string);
962 $strreplace = array();
963 foreach ($replace as $line) {
967 if (strpos($line,
'##') !==
false) {
968 $strreplace[$line] = str_replace(
'##',
'', $line);
970 $strreplace[$line] = $line;
973 $stringLog = implode(
"\n", $strreplace);
975 dolReplaceInFile($destfile, array(
'//include::ChangeLog.md[]' =>
'',
'__CHANGELOG__' => $stringLog));
979 $FILENAMEDOC = $modulelowercase.
'.html';
980 $FILENAMEDOCPDF = $modulelowercase.
'.pdf';
981 $outputfiledoc =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOC;
982 $outputfiledocurl =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOC;
983 $outputfiledocpdf =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOCPDF;
984 $outputfiledocurlpdf =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOCPDF;
989 $langs->load(
"errors");
990 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
996if ($dirins && $action ==
'addlanguage' && !empty($module) ) {
997 $newlangcode =
GETPOST(
'newlangcode',
'aZ09');
1000 $modulelowercase = strtolower($module);
1005 if ($diroflang == $dolibarr_main_document_root.
'/'.$modulelowercase) {
1007 $diroflang = $dolibarr_main_document_root;
1009 $srcfile = $diroflang.
'/langs/en_US/'.$modulelowercase.
'.lang';
1010 $destfile = $diroflang.
'/langs/'.$newlangcode.
'/'.$modulelowercase.
'.lang';
1012 $result =
dol_copy($srcfile, $destfile,
'0', 0);
1014 setEventMessages($langs->trans(
"ErrorFailToCopyFile", $srcfile, $destfile),
null,
'errors');
1017 $srcdir = $diroflang.
'/langs/en_US';
1018 $srcfile = $diroflang.
'/langs/en_US/'.$modulelowercase.
'.lang';
1019 $destdir = $diroflang.
'/langs/'.$newlangcode;
1021 $arrayofreplacement = array();
1023 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template/langs/en_US';
1024 $arrayofreplacement = array(
'mymodule' => $modulelowercase);
1026 $result =
dolCopyDir($srcdir, $destdir,
'0', 0, $arrayofreplacement);
1029 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Language")),
null,
'errors');
1035if ($dirins && $action ==
'confirm_removefile' && !empty($module) ) {
1036 $objectname = $tabobj;
1037 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
1038 $destdir = $dirins.
'/'.strtolower($module);
1043 if ($relativefilename) {
1044 $dirnametodelete = dirname($relativefilename);
1045 $filetodelete = $dirins.
'/'.$relativefilename;
1046 $dirtodelete = $dirins.
'/'.$dirnametodelete;
1051 $keyofobjecttodelete = array_search($objectname, $objects);
1052 if ($keyofobjecttodelete !==
false) {
1053 unset($objects[$keyofobjecttodelete]);
1057 if (strpos($relativefilename,
'api') !==
false) {
1058 $file_api = $destdir.
'/class/api_'.strtolower($module).
'.class.php';
1062 if (count($objects) == 0) {
1074 setEventMessages($langs->trans(
"ErrorFailToDeleteFile", basename($filetodelete)),
null,
'errors');
1077 if (preg_match(
'/\.sql$/', $relativefilename)) {
1078 if (preg_match(
'/\.key\.sql$/', $relativefilename)) {
1079 $relativefilename = preg_replace(
'/\.key\.sql$/',
'.sql', $relativefilename);
1080 $filetodelete = $dirins.
'/'.$relativefilename;
1082 } elseif (preg_match(
'/\.sql$/', $relativefilename)) {
1083 $relativefilename = preg_replace(
'/\.sql$/',
'.key.sql', $relativefilename);
1084 $filetodelete = $dirins.
'/'.$relativefilename;
1094 if (in_array($tab, array(
'css',
'js'))) {
1095 $srcfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
1096 $arrayreplacement = array(
'/^\s*\''.preg_quote(
'/'.$relativefilename,
'/').
'\',*/m
' => '
1100 if (preg_match(
'/_extrafields/', $relativefilename)) {
1102 $srcfile = $dirins.
'/'.strtolower($module).
'/class/'.strtolower($objectname).
'.class.php';
1103 $arrayreplacement = array(
'/\$isextrafieldmanaged = 1;/' =>
'$isextrafieldmanaged = 0;');
1108 $varnametoupdate =
'';
1110 if (preg_match(
'/_([a-z]+)\.php$/', $relativefilename, $reg)) {
1111 $varnametoupdate =
'showtabofpage'.$reg[1];
1113 if ($varnametoupdate) {
1114 $srcfile = $dirins.
'/'.strtolower($module).
'/lib/'.strtolower($module).
'_'.strtolower($objectname).
'.lib.php';
1115 $arrayreplacement = array(
'/\$'.preg_quote($varnametoupdate,
'/').
' = 1;/' =>
'$'.preg_quote($varnametoupdate,
'/').
' = 0;');
1123if ($dirins && $action ==
'initobject' && $module && $objectname) {
1128 $dirins = $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
1129 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
1131 if (preg_match(
'/[^a-z0-9]/i', $objectname)) {
1133 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
1134 $tabobj =
'newobject';
1136 if (class_exists($objectname)) {
1139 setEventMessages($langs->trans(
"AnObjectWithThisClassNameAlreadyExists"),
null,
'errors');
1140 $tabobj =
'newobject';
1145 }
catch (\InvalidArgumentException $e) {
1147 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
1151 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
1152 $destdir = $dirins.
'/'.strtolower($module);
1156 $objectalreadyexists =
dol_is_file($destdir.
'/class/'.strtolower($objectname).
'.class.php');
1169 $dirlist =
dol_dir_list($destdir.
'/class',
'files', 0,
'\.txt$');
1170 $alreadyfound =
false;
1171 foreach ($dirlist as $key => $val) {
1172 $filefound = preg_replace(
'/\.txt$/',
'', $val[
'name']);
1173 if (strtolower($objectname) == strtolower($filefound) && $objectname != $filefound) {
1174 $alreadyfound =
true;
1176 setEventMessages($langs->trans(
"AnObjectAlreadyExistWithThisNameAndDiffCase"),
null,
'errors');
1184 $stringforproperties =
'';
1185 $tablename =
GETPOST(
'initfromtablename',
'alpha');
1187 $_results =
$db->DDLDescTable($tablename);
1188 if (empty($_results)) {
1190 $langs->load(
"errors");
1191 setEventMessages($langs->trans(
"ErrorTableNotFound", $tablename),
null,
'errors');
1240 $stringforproperties =
'// BEGIN MODULEBUILDER PROPERTIES'.
"\n";
1241 $stringforproperties .=
'public $fields = array('.
"\n";
1243 while ($obj =
$db->fetch_object($_results)) {
1245 $fieldname = $obj->Field;
1248 if ($type ==
'int(11)') {
1250 } elseif ($type ==
'float') {
1252 } elseif (strstr($type,
'tinyint')) {
1254 } elseif (strstr($type,
'url')) {
1255 $type =
'varchar(255)';
1256 } elseif ($obj->Field ==
'fk_soc') {
1257 $type =
'integer:Societe:societe/class/societe.class.php';
1258 } elseif (preg_match(
'/^fk_proj/', $obj->Field)) {
1259 $type =
'integer:Project:projet/class/project.class.php:1:fk_statut=1';
1260 } elseif (preg_match(
'/^fk_prod/', $obj->Field)) {
1261 $type =
'integer:Product:product/class/product.class.php:1';
1262 } elseif ($obj->Field ==
'fk_warehouse') {
1263 $type =
'integer:Entrepot:product/stock/class/entrepot.class.php';
1264 } elseif (preg_match(
'/^(fk_user|fk_commercial)/', $obj->Field)) {
1265 $type =
'integer:User:user/class/user.class.php';
1269 $notnull = ($obj->Null ==
'YES' ? 0 : 1);
1270 if ($fieldname ==
'fk_user_modif') {
1274 $label = preg_replace(
'/_/',
'', ucfirst($fieldname));
1275 if ($fieldname ==
'rowid') {
1276 $label =
'TechnicalID';
1278 if ($fieldname ==
'import_key') {
1279 $label =
'ImportId';
1281 if ($fieldname ==
'fk_soc') {
1282 $label =
'ThirdParty';
1284 if (in_array($fieldname, array(
'tms',
'date_modification'))) {
1285 $label =
'DateModification';
1287 if (in_array($fieldname, array(
'datec',
'date_creation'))) {
1288 $label =
'DateCreation';
1290 if ($fieldname ==
'date_valid') {
1291 $label =
'DateValidation';
1293 if ($fieldname ==
'datev') {
1294 $label =
'DateValidation';
1296 if ($fieldname ==
'note_private') {
1297 $label =
'NotePublic';
1299 if ($fieldname ==
'note_public') {
1300 $label =
'NotePrivate';
1302 if ($fieldname ==
'fk_user_creat') {
1303 $label =
'UserAuthor';
1305 if ($fieldname ==
'fk_user_modif') {
1306 $label =
'UserModif';
1308 if ($fieldname ==
'fk_user_valid') {
1309 $label =
'UserValidation';
1313 if (in_array($fieldname, array(
'ref',
'label'))) {
1316 if ($fieldname ==
'entity') {
1319 if ($fieldname ==
'entity') {
1322 if ($fieldname ==
'import_key') {
1325 if ($fieldname ==
'fk_user_creat') {
1328 if ($fieldname ==
'fk_user_modif') {
1331 if (in_array($fieldname, array(
'ref_ext',
'model_pdf',
'note_public',
'note_private'))) {
1338 if ($fieldname ==
'entity') {
1343 if (in_array($fieldname, array(
'status',
'statut',
'fk_status',
'fk_statut'))) {
1346 if ($fieldname ==
'import_key') {
1350 $alwayseditable = 0;
1351 if ($fieldname ==
'label') {
1352 $alwayseditable = 1;
1354 $alwayseditable = 0;
1358 if ($fieldname ==
'entity') {
1365 if (preg_match(
'/^fk_/', $fieldname)) {
1366 $css =
'maxwidth500 widthcentpercentminusxx';
1368 if ($fieldname ==
'label') {
1369 $css =
'minwidth300';
1370 $cssview =
'wordbreak';
1372 if (in_array($fieldname, array(
'note_public',
'note_private'))) {
1373 $cssview =
'wordbreak';
1375 if (in_array($fieldname, array(
'ref',
'label')) || preg_match(
'/integer:/', $type)) {
1376 $csslist =
'tdoverflowmax150';
1381 if (isset($obj->Picto)) {
1382 $picto = $obj->Picto;
1384 if (preg_match(
'/^fk_soc/', $obj->Field)) {
1386 } elseif (preg_match(
'/^fk_contact/', $obj->Field)) {
1388 } elseif (preg_match(
'/^fk_bank/', $obj->Field)) {
1390 } elseif (preg_match(
'/^fk_user/', $obj->Field)) {
1392 } elseif (preg_match(
'/^fk_warehouse/', $obj->Field)) {
1393 $picto =
'warehouse';
1394 } elseif (preg_match(
'/^fk_prod/', $obj->Field)) {
1396 } elseif (preg_match(
'/^fk_proj/', $obj->Field)) {
1398 } elseif (preg_match(
'/^fk_task/', $obj->Field)) {
1403 $lang = $module.
'@'.$module;
1406 $stringforproperties .=
"'".$obj->Field.
"' => array('type' => '".$type.
"', 'label' => '".$label.
"',";
1407 if ($default !=
'') {
1408 $stringforproperties .=
" 'default' => ".$default.
",";
1410 $stringforproperties .=
" 'enabled' => ".$enabled.
",";
1411 $stringforproperties .=
" 'visible' => ".$visible;
1413 $stringforproperties .=
", 'notnull' => ".$notnull;
1415 if ($alwayseditable) {
1416 $stringforproperties .=
", 'alwayseditable' => 1";
1418 if ($fieldname ==
'ref' || $fieldname ==
'code') {
1419 $stringforproperties .=
", 'showoncombobox' => 1";
1421 $stringforproperties .=
", 'position' => ".$position;
1423 $stringforproperties .=
", 'index' => ".$index;
1426 $stringforproperties .=
", 'picto' => '".$picto.
"'";
1429 $stringforproperties .=
", 'css' => '".$css.
"'";
1432 $stringforproperties .=
", 'cssview' => '".$cssview.
"'";
1435 $stringforproperties .=
", 'csslist' => '".$csslist.
"'";
1438 $stringforproperties .=
", 'lang' => '".$lang.
"'";
1440 $stringforproperties .=
"),\n";
1443 $stringforproperties .=
');'.
"\n";
1444 $stringforproperties .=
'// END MODULEBUILDER PROPERTIES'.
"\n";
1448 $filetogenerate = array();
1451 $filetogenerate = [];
1453 'myobject_card.php',
1454 'myobject_note.php',
1455 'myobject_contact.php',
1456 'myobject_document.php',
1457 'myobject_agenda.php',
1458 'myobject_list.php',
1459 'admin/myobject_extrafields.php',
1460 'ajax/myobject.php',
1461 'lib/mymodule_myobject.lib.php',
1463 'sql/llx_mymodule_myobject.sql',
1464 'sql/llx_mymodule_myobject.key.sql',
1465 'sql/llx_mymodule_myobject_extrafields.sql',
1466 'sql/llx_mymodule_myobject_extrafields.key.sql',
1468 'class/myobject.class.php',
1469 'class/myobjectstats.class.php',
1471 'stats/myobject_index.php',
1472 ] as $templateFile) {
1473 $filetogenerate[$templateFile] = $ncObj->applyToFilename($templateFile);
1478 if (!in_array($tabkey, $enabledtabs,
true)) {
1479 unset($filetogenerate[$tabinfo[
'file']]);
1483 if (
GETPOST(
'includerefgeneration',
'aZ09')) {
1484 dol_mkdir($destdir.
'/core/modules/'.strtolower($module));
1487 'core/modules/mymodule/mod_myobject_advanced.php',
1488 'core/modules/mymodule/mod_myobject_standard.php',
1489 'core/modules/mymodule/modules_myobject.php',
1490 ] as $templateFile) {
1491 $filetogenerate[$templateFile] = $ncObj->applyToFilename($templateFile);
1494 if (
GETPOST(
'includedocgeneration',
'aZ09')) {
1495 dol_mkdir($destdir.
'/core/modules/'.strtolower($module));
1496 dol_mkdir($destdir.
'/core/modules/'.strtolower($module).
'/doc');
1499 'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php',
1500 'core/modules/mymodule/doc/pdf_standard_myobject.modules.php',
1501 ] as $templateFile) {
1502 $filetogenerate[$templateFile] = $ncObj->applyToFilename($templateFile);
1506 if (
GETPOST(
'generatepermissions',
'aZ09')) {
1507 $firstobjectname =
'myobject';
1508 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
1510 $class =
'mod'.$module;
1512 if (class_exists($class)) {
1515 '@phan-var-force DolibarrModules $moduleobj';
1527 $moduledescriptorfile = $destdir.
'/core/modules/mod'.$module.
'.class.php';
1529 if ($checkComment < 0) {
1530 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Permissions"),
"mod".$module.
"class.php"),
null,
'warnings');
1532 $generatePerms =
reWriteAllPermissions($moduledescriptorfile, $rights,
null,
null, $objectname, $module, -2);
1533 if ($generatePerms < 0) {
1534 setEventMessages($langs->trans(
"WarningPermissionAlreadyExist", $langs->transnoentities($objectname)),
null,
'warnings');
1540 foreach ($filetogenerate as $srcfile => $destfile) {
1541 $result =
dol_copy($srcdir.
'/'.$srcfile, $destdir.
'/'.$destfile, $newmask, 0);
1545 $langs->load(
"errors");
1546 setEventMessages($langs->trans(
"ErrorFailToCopyFile", $srcdir.
'/'.$srcfile, $destdir.
'/'.$destfile),
null,
'errors');
1549 setEventMessages($langs->trans(
"FileAlreadyExists", $destfile),
null,
'warnings');
1552 $arrayreplacement = array(
1553 '/myobject\.class\.php/' => strtolower($objectname).
'.class.php',
1554 '/myobject\.lib\.php/' => strtolower($objectname).
'.lib.php',
1557 dolReplaceInFile($destdir.
'/'.$destfile, $arrayreplacement,
'',
'0', 0, 1);
1562 if (!$error && $stringforproperties) {
1564 $arrayreplacement = array(
1565 '/\/\/ BEGIN MODULEBUILDER PROPERTIES.*\/\/ END MODULEBUILDER PROPERTIES/ims' => $stringforproperties
1568 dolReplaceInFile($destdir.
'/class/'.strtolower($objectname).
'.class.php', $arrayreplacement,
'',
'0', 0, 1);
1572 if (
GETPOST(
'includerefgeneration',
'aZ09')) {
1574 $arrayreplacement = array(
1575 '/\'visible\'s*=>s*1,\s*\'noteditable\'s*=>s*0,\s*\'default\'s*=>s*\'\'/' =>
"'visible' => 4, 'noteditable' => 1, 'default' => '(PROV)'"
1579 dolReplaceInFile($destdir.
'/class/'.strtolower($objectname).
'.class.php', $arrayreplacement,
'',
'0', 0, 1);
1581 $arrayreplacement = array(
1582 '/\'models\' => 0,/' =>
'\'models\
' => 1,'
1584 dolReplaceInFile($destdir.
'/core/modules/mod'.$module.
'.class.php', $arrayreplacement,
'',
'0', 0, 1);
1588 if (
GETPOST(
'includedocgeneration',
'aZ09')) {
1590 $arrayreplacement = array(
1591 '/\$includedocgeneration = 0;/' =>
'$includedocgeneration = 1;'
1593 dolReplaceInFile($destdir.
'/class/'.strtolower($objectname).
'.class.php', $arrayreplacement,
'',
'0', 0, 1);
1594 dolReplaceInFile($destdir.
'/'.strtolower($objectname).
'_card.php', $arrayreplacement,
'',
'0', 0, 1);
1596 $arrayreplacement = array(
1597 '/\'models\' => 0,/' =>
'\'models\
' => 1,'
1600 dolReplaceInFile($destdir.
'/core/modules/mod'.$module.
'.class.php', $arrayreplacement,
'',
'0', 0, 1);
1607 $listofobject =
dol_dir_list($destdir.
'/class',
'files', 0,
'\.class\.php$');
1609 $firstobjectname =
'';
1611 foreach ($listofobject as $fileobj) {
1612 if (preg_match(
'/^api_/', $fileobj[
'name'])) {
1615 if (preg_match(
'/^actions_/', $fileobj[
'name'])) {
1619 $tmpcontent = file_get_contents($fileobj[
'fullname']);
1621 if (preg_match(
'/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) {
1622 $objectnameloop = $reg[1];
1623 if (empty($firstobjectname)) {
1624 $firstobjectname = $objectnameloop;
1630 \$this->menu[\$r++] = array(
1631 'fk_menu' => 'fk_mainmenu=mymodule',
1633 'titre' => 'MyObject',
1634 'prefix' => img_picto('', \$this->picto, 'class=\"paddingright pictofixedwidth valignmiddle\"'),
1635 'mainmenu' => 'mymodule',
1636 'leftmenu' => 'myobject',
1637 'url' => '/mymodule/myobject_list.php',
1638 'langs' => 'mymodule@mymodule',
1639 'position' => 1000 + \$r,
1640 'enabled' => 'isModEnabled(\"mymodule\")',
1641 'perms' => '".(GETPOST(
'generatepermissions') ?
'$user->hasRight("mymodule", "myobject", "read")' :
'1').
"',
1644 'object' => 'MyObject'
1646 \$this->menu[\$r++] = array(
1647 'fk_menu' => 'fk_mainmenu=mymodule,fk_leftmenu=myobject',
1649 'titre' => 'List MyObject',
1650 'mainmenu' => 'mymodule',
1651 'leftmenu' => 'mymodule_myobject_list',
1652 'url' => '/mymodule/myobject_list.php',
1653 'langs' => 'mymodule@mymodule',
1654 'position' => 1000 + \$r,
1655 'enabled' => 'isModEnabled(\"mymodule\")',
1656 'perms' => '".(
GETPOST(
'generatepermissions') ?
'$user->hasRight("mymodule", "myobject", "read")' :
'1').
"',
1659 'object' => 'MyObject'
1661 \$this->menu[\$r++] = array(
1662 'fk_menu' => 'fk_mainmenu=mymodule,fk_leftmenu=myobject',
1664 'titre' => 'New MyObject',
1665 'mainmenu' => 'mymodule',
1666 'leftmenu' => 'mymodule_myobject_new',
1667 'url' => '/mymodule/myobject_card.php?action=create',
1668 'langs' => 'mymodule@mymodule',
1669 'position' => 1000 + \$r,
1670 'enabled' => 'isModEnabled(\"mymodule\")',
1671 'perms' => '".(
GETPOST(
'generatepermissions') ?
'$user->hasRight("mymodule", "myobject", "write")' :
'1').
"',
1674 'object' => 'MyObject'
1676 $stringtoadd = $ncObj->applyTo($stringtoadd);
1678 $moduledescriptorfile = $destdir.
'/core/modules/mod'.$module.
'.class.php';
1684 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
1686 $class =
'mod'.$module;
1688 if (class_exists($class)) {
1691 '@phan-var-force DolibarrModules $moduleobj';
1704 foreach ($menus as $menu) {
1705 if ($menu[
'leftmenu'] == strtolower($objectname)) {
1711 if ($checkComment < 0) {
1713 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Menus"), basename($moduledescriptorfile)),
null,
'warnings');
1715 $arrayofreplacement = array(
1716 '/* 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 */'
1722 $filetogenerate[] =
'core/modules/mod'.$module.
'.class.php';
1725 if (! $error &&
GETPOST(
'nogeneratelines',
'aZ09')) {
1727 if ($checkComment < 0) {
1729 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Menus"), basename($moduledescriptorfile)),
null,
'warnings');
1733 $destdir .
'/class/' . strtolower($objectname) .
'.class.php',
1734 $destdir .
'/class/api_' . strtolower($module) .
'.class.php',
1735 $destdir .
'/' . strtolower($objectname) .
'_card.php'
1739 $pattern =
'/\/\/BEGIN MODULEBUILDER LINES.*?\/\/END MODULEBUILDER LINES\s*/s';
1740 foreach ($TFilePaths as $filePath) {
1753 $libdestfile = $destdir.
'/'.$ncObj->applyToFilename(
'lib/mymodule_myobject.lib.php');
1755 $marker = $tabinfo[
'marker'];
1756 if (in_array($tabkey, $enabledtabs,
true)) {
1757 $arrayreplacement = array(
1758 '/\$'.$tabinfo[
'var'].
' = getDolGlobalInt\([^;]*\);/' =>
'$'.$tabinfo[
'var'].
' = 1;'
1760 if (
dolReplaceInFile($libdestfile, $arrayreplacement,
'',
'0', 0, 1) < 0) {
1762 dol_syslog(
"modulebuilder: failed to activate tab flag '".$tabkey.
"' in ".$libdestfile, LOG_ERR);
1765 if (!
removePatternFromFile($libdestfile,
'/\h*\/\/ BEGIN MODULEBUILDER TABFLAG '.$marker.
'.*?\/\/ END MODULEBUILDER TABFLAG '.$marker.
'\s*/s')
1766 || !
removePatternFromFile($libdestfile,
'/\h*\/\/ BEGIN MODULEBUILDER TAB '.$marker.
'.*?\/\/ END MODULEBUILDER TAB '.$marker.
'\s*/s')) {
1768 dol_syslog(
"modulebuilder: failed to purge tab '".$tabkey.
"' in ".$libdestfile, LOG_ERR);
1773 if (!$error && !in_array(
'agenda', $enabledtabs,
true)) {
1774 $carddestfile = $destdir.
'/'.$ncObj->applyToFilename(
'myobject_card.php');
1775 if (!
removePatternFromFile($carddestfile,
'/\h*\/\/ BEGIN MODULEBUILDER TAB AGENDA.*?\/\/ END MODULEBUILDER TAB AGENDA\s*/s')) {
1777 dol_syslog(
"modulebuilder: failed to purge agenda widget in ".$carddestfile, LOG_ERR);
1780 if ($objectalreadyexists) {
1781 setEventMessages($langs->trans(
"WarningTabSelectionOnRegeneration"),
null,
'warnings');
1787 foreach ($filetogenerate as $destfile) {
1788 $phpfileval[
'fullname'] = $destdir.
'/'.$destfile;
1795 $arrayreplacement = array_merge(
1796 $ncObj->getSubstitutionMap(),
1798 'htdocs/modulebuilder/template/' => $ncObj->moduleNameLower,
1799 '---Replace with your own copyright and developer email---' => $licenceValue,
1803 if (basename($phpfileval[
'fullname']) ===
'mod'.$module.
'.class.php') {
1811 setEventMessages($langs->trans(
"ErrorFailToMakeReplacementInto", $phpfileval[
'fullname']),
null,
'errors');
1813 modulebuilderValidateGeneratedFile($phpfileval[
'fullname'], $ncObj);
1818 if (!$error && $ncObj !==
null) {
1826 $moduleReplacementAll = array_merge(
1827 $ncObj->getSubstitutionMap(),
1829 'htdocs/modulebuilder/template/' => $ncObj->moduleNameLower,
1830 '---Replace with your own copyright and developer email---' => $licenceValueAll,
1833 $allModulePhpFiles =
dol_dir_list($destdir,
'files', 1,
'\.php$');
1837 $moduledescriptorbasename =
'mod'.$module.
'.class.php';
1838 if (is_array($allModulePhpFiles) && !empty($allModulePhpFiles)) {
1839 foreach ($allModulePhpFiles as $phpFileval) {
1840 if (basename($phpFileval[
'fullname']) === $moduledescriptorbasename) {
1843 $result =
dolReplaceInFile($phpFileval[
'fullname'], $moduleReplacementAll);
1845 setEventMessages($langs->trans(
"ErrorFailToMakeReplacementInto", $phpFileval[
'fullname']),
null,
'warnings');
1850 $moduleLowerForPlaceholder = strtolower($module);
1852 $destdir .
'/stats/myobject_index.php',
1853 $destdir .
'/lib/' . $moduleLowerForPlaceholder .
'_myobject.lib.php',
1854 ] as $placeholder) {
1855 if (file_exists($placeholder)) {
1866 if (is_numeric($object) && $object <= 0) {
1867 $pathoffiletoeditsrc = $destdir.
'/class/'.strtolower($objectname).
'.class.php';
1868 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $pathoffiletoeditsrc),
null,
'errors');
1872 $file = $destdir.
'/class/'.strtolower($objectname).
'.class.php';
1873 $destfile = $destdir.
'/doc/Documentation.asciidoc';
1875 if (file_exists($destfile)) {
1879 if (!$error && $object !==
null) {
1881 $result =
rebuildObjectSql($destdir, $module, $objectname, $newmask,
'', $object);
1890 setEventMessages($langs->trans(
'FilesForObjectInitialized', $objectname),
null);
1891 $tabobj = $objectname;
1893 $tabobj =
'newobject';
1898 $result = unActivateModule(strtolower($module));
1903 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
1904 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=objects&module='.$module);
1910if ($dirins && $action ==
'initdic' && $module && empty($cancel) ) {
1911 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
1912 $destdir = $dirins.
'/'.strtolower($module);
1913 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
1917 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Table")),
null,
'errors');
1921 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
1924 $newdicname = $dicname;
1925 if (!preg_match(
'/^c_/', $newdicname)) {
1926 $newdicname =
'c_'.$dicname;
1929 $class =
'mod'.$module;
1932 if (class_exists($class)) {
1935 '@phan-var-force DolibarrModules $moduleobj';
1945 $langs->load(
"errors");
1946 dol_print_error(
$db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
1951 if ($checkComment < 0) {
1952 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Dictionaries"),
"mod".$module.
"class.php"),
null,
'warnings');
1955 if (function_exists(
'opcache_invalidate')) {
1958 clearstatcache(
true);
1959 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
''));
1966if ($dirins && ($action ==
'droptable' || $action ==
'droptableextrafields') && !empty($module) && !empty($tabobj) ) {
1967 $objectname = $tabobj;
1969 $arrayoftables = array();
1970 if ($action ==
'droptable') {
1971 $arrayoftables[] = MAIN_DB_PREFIX.strtolower($module).
'_'.strtolower($tabobj);
1973 if ($action ==
'droptableextrafields') {
1974 $arrayoftables[] = MAIN_DB_PREFIX.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields';
1977 foreach ($arrayoftables as $tabletodrop) {
1979 $sql =
"SELECT COUNT(*) as nb FROM ".$tabletodrop;
1980 $resql =
$db->query($sql);
1982 $obj =
$db->fetch_object($resql);
1984 $nb = (int) $obj->nb;
1987 if (
$db->lasterrno() ==
'DB_ERROR_NOSUCHTABLE') {
1988 setEventMessages($langs->trans(
"TableDoesNotExists", $tabletodrop),
null,
'warnings');
1994 $resql =
$db->DDLDropTable($tabletodrop);
1996 setEventMessages($langs->trans(
"TableDropped", $tabletodrop),
null,
'mesgs');
1997 } elseif ($nb > 0) {
1998 setEventMessages($langs->trans(
"TableNotEmptyDropCanceled", $tabletodrop),
null,
'warnings');
2003if ($dirins && $action ==
'addproperty' && empty($cancel) && !empty($module) && (!empty($tabobj) || !empty(
GETPOST(
'obj'))) ) {
2008 $dirins = $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
2009 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
2011 $srcdir = $dirread.
'/'.strtolower($module);
2012 $destdir = $dirins.
'/'.strtolower($module);
2016 if (!in_array($objectname, array_values($objects))) {
2018 setEventMessages($langs->trans(
"ErrorObjectNotFound", $langs->transnoentities($objectname)),
null,
'errors');
2021 $addfieldentry = array();
2024 if (!
GETPOST(
'regenerateclasssql') && !
GETPOST(
'regeneratemissing')) {
2025 if (!
GETPOST(
'propname',
'aZ09')) {
2027 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Name")),
null,
'errors');
2029 if (!
GETPOST(
'proplabel',
'alpha')) {
2031 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
2033 if (!
GETPOST(
'proptype',
'alpha')) {
2035 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Type")),
null,
'errors');
2039 if (!$error && !
GETPOST(
'regenerateclasssql') && !
GETPOST(
'regeneratemissing')) {
2043 $proptype =
GETPOST(
'proptype',
'alpha');
2044 if (strpos($proptype,
':') ===
false && strpos($proptype,
'_') ===
false) {
2045 $proptype = strtolower($proptype);
2047 $addfieldentry = array(
2048 'name' =>
GETPOST(
'propname',
'aZ09'),
2049 'label' =>
GETPOST(
'proplabel',
'alpha'),
2050 'type' => $proptype,
2051 'arrayofkeyval' =>
GETPOST(
'proparrayofkeyval',
'nohtml'),
2052 'visible' =>
GETPOST(
'propvisible',
'alphanohtml'),
2053 'enabled' =>
GETPOST(
'propenabled',
'alphanohtml'),
2057 'foreignkey' =>
GETPOST(
'propforeignkey',
'alpha'),
2059 'isameasure' =>
GETPOSTINT(
'propisameasure'),
2060 'showoncombobox' =>
GETPOSTINT(
'propshowoncombobox'),
2061 'comment' =>
GETPOST(
'propcomment',
'alpha'),
2062 'help' =>
GETPOST(
'prophelp',
'alpha'),
2063 'css' =>
GETPOST(
'propcss',
'alpha'),
2064 'cssview' =>
GETPOST(
'propcssview',
'alpha'),
2065 'csslist' =>
GETPOST(
'propcsslist',
'alpha'),
2066 'default' =>
GETPOST(
'propdefault',
'restricthtml'),
2067 'noteditable' =>
GETPOSTINT(
'propnoteditable'),
2072 if (!empty($addfieldentry[
'arrayofkeyval']) && !is_array($addfieldentry[
'arrayofkeyval'])) {
2073 $tmpdecode = json_decode($addfieldentry[
'arrayofkeyval'],
true);
2075 $addfieldentry[
'arrayofkeyval'] = $tmpdecode;
2078 $addfieldentry[
'arrayofkeyval'] = $tmparray;
2090 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
2097 if (is_numeric($object) && $object <= 0) {
2098 $pathoffiletoeditsrc = $destdir.
'/class/'.strtolower($objectname).
'.class.php';
2099 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $pathoffiletoeditsrc),
null,
'errors');
2105 if (!$error && $object !==
null) {
2106 $result =
rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object, $moduletype);
2109 setEventMessages($langs->trans(
'ErrorFailToCreateFile',
'.sql'),
null,
'errors');
2115 clearstatcache(
true);
2117 setEventMessages($langs->trans(
'FilesForObjectUpdated', $objectname),
null);
2122 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj='.$objectname.
'&nocache='.time());
2127if ($dirins && $action ==
'confirm_deleteproperty' && $propertykey ) {
2128 $objectname = $tabobj;
2130 $dirins = $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
2131 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
2133 $srcdir = $dirread.
'/'.strtolower($module);
2134 $destdir = $dirins.
'/'.strtolower($module);
2142 if (is_numeric($object) && $object <= 0) {
2143 $pathoffiletoeditsrc = $destdir.
'/class/'.strtolower($objectname).
'.class.php';
2144 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $pathoffiletoeditsrc),
null,
'errors');
2150 if (!$error && $object !==
null) {
2151 $result =
rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object);
2154 setEventMessages($langs->trans(
'ErrorFailToCreateFile',
'.sql'),
null,
'errors');
2160 setEventMessages($langs->trans(
'FilesForObjectUpdated', $objectname),
null);
2162 clearstatcache(
true);
2165 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj='.$objectname);
2170if ($dirins && $action ==
'confirm_deletemodule' ) {
2171 if (preg_match(
'/[^a-z0-9_]/i', $module)) {
2173 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
2177 $modulelowercase = strtolower($module);
2180 $dir = $dirins.
'/'.$modulelowercase;
2182 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2192 $class =
'mod'.$module;
2196 if (class_exists($class)) {
2199 '@phan-var-force DolibarrModules $moduleobj';
2207 $langs->load(
"errors");
2208 setEventMessages($langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module),
null,
'warnings');
2220 clearstatcache(
true);
2221 if (function_exists(
'opcache_invalidate')) {
2225 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?module=deletemodule');
2233 $module =
'deletemodule';
2236if ($dirins && $action ==
'confirm_deleteobject' && $objectname ) {
2237 if (preg_match(
'/[^a-z0-9_]/i', $objectname)) {
2239 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
2243 $modulelowercase = strtolower($module);
2244 $objectlowercase = strtolower($objectname);
2247 $dir = $dirins.
'/'.$modulelowercase;
2252 }
catch (\InvalidArgumentException $e) {
2254 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
2258 if (!$error && $ncObjDel !==
null) {
2260 'myobject_card.php',
2261 'myobject_note.php',
2262 'myobject_contact.php',
2263 'myobject_document.php',
2264 'myobject_agenda.php',
2265 'myobject_list.php',
2266 'admin/myobject_extrafields.php',
2267 'lib/mymodule_myobject.lib.php',
2268 'sql/llx_mymodule_myobject.sql',
2269 'sql/llx_mymodule_myobject_extrafields.sql',
2270 'sql/llx_mymodule_myobject.key.sql',
2271 'sql/llx_mymodule_myobject_extrafields.key.sql',
2272 'scripts/myobject.php',
2273 'class/myobject.class.php',
2274 'class/myobjectstats.class.php',
2275 'core/modules/mymodule/mod_myobject_advanced.php',
2276 'core/modules/mymodule/mod_myobject_standard.php',
2277 'core/modules/mymodule/modules_myobject.php',
2278 'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php',
2279 'core/modules/mymodule/doc/pdf_standard_myobject.modules.php',
2280 'stats/myobject_index.php',
2281 ] as $templateFile) {
2282 $filetodelete[$templateFile] = $ncObjDel->applyToFilename($templateFile);
2285 $filetodelete[
'ajax/myobject.lib.php'] =
'ajax/' . $ncObjDel->objectNameLower .
'.php';
2286 $filetodelete[
'test/phpunit/MyObjectTest.php'] =
'test/phpunit/' . $ncObjDel->objectNameLower .
'Test.php';
2287 $filetodelete[
'class/api_myobject.class.php'] =
'class/api_' . $ncObjDel->moduleNameLower .
'.class.php';
2292 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2294 $class =
'mod'.$module;
2296 if (class_exists($class)) {
2299 '@phan-var-force DolibarrModules $moduleobj';
2307 $langs->load(
"errors");
2308 dol_print_error(
$db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
2311 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2317 if ($rewriteMenu < 0) {
2318 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Menus"),
"mod".$module.
"class.php"),
null,
'warnings');
2320 reWriteAllMenus($moduledescriptorfile, $menus, $objectname,
null, -1);
2326 if ($rewritePerms < 0) {
2327 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Permissions"),
"mod".$module.
"class.php"),
null,
'warnings');
2331 if ($rewritePerms && $rewriteMenu) {
2333 $file_doc = $dirins.
'/'.strtolower($module).
'/doc/Documentation.asciidoc';
2336 clearstatcache(
true);
2337 if (function_exists(
'opcache_invalidate')) {
2341 foreach ($filetodelete as $tmpfiletodelete) {
2343 $resulttmp =
dol_delete_file($dir.
'/'.$tmpfiletodelete.
'.back', 0, 0, 1);
2349 if ($resultko == 0) {
2352 setEventMessages($langs->trans(
"ErrorSomeFilesCouldNotBeDeleted"),
null,
'warnings');
2359 $tabobj =
'newobject';
2361 $tabobj =
'deleteobject';
2366 $result = unActivateModule(strtolower($module));
2371 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
2372 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=objects&tabobj=deleteobject&module='.urlencode($module));
2377if (($dirins && $action ==
'confirm_deletedictionary' && $dicname) || ($dirins && $action ==
'confirm_deletedictionary' &&
GETPOST(
'dictionnarykey')) ) {
2378 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2379 $destdir = $dirins.
'/'.strtolower($module);
2380 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2382 if (preg_match(
'/[^a-z0-9_]/i', $dicname)) {
2384 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
2387 if (!empty($dicname)) {
2388 $newdicname = $dicname;
2389 if (!preg_match(
'/^c_/', $newdicname)) {
2390 $newdicname =
'c_'.strtolower($dicname);
2397 $class =
'mod'.$module;
2400 if (class_exists($class)) {
2403 '@phan-var-force DolibarrModules $moduleobj';
2413 $langs->load(
"errors");
2414 dol_print_error(
$db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
2420 if ($checkComment < 0) {
2422 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Dictionaries"),
"mod".$module.
"class.php"),
null,
'warnings');
2425 if (!empty(
GETPOST(
'dictionnarykey'))) {
2426 $newdicname = $dicts[
'tabname'][
GETPOSTINT(
'dictionnarykey') - 1];
2430 $checkTable =
false;
2431 if ($newdicname !==
null) {
2432 $checkTable =
$db->DDLDescTable(MAIN_DB_PREFIX.strtolower($newdicname));
2435 if (is_bool($checkTable) ||
$db->num_rows($checkTable) <= 0) {
2440 $keyToDelete =
null;
2441 foreach ($dicts[
'tabname'] as $key => $table) {
2443 if (strtolower($table) === $newdicname) {
2444 $keyToDelete = $key;
2449 if ($keyToDelete !==
null) {
2450 $keysToDelete = [
'tabname',
'tablib',
'tabsql',
'tabsqlsort',
'tabfield',
'tabfieldvalue',
'tabfieldinsert',
'tabrowid',
'tabcond',
'tabhelp'];
2451 foreach ($keysToDelete as $key) {
2452 unset($dicts[$key][$keyToDelete]);
2456 setEventMessages($langs->trans(
"ErrorDictionaryNotFound", ucfirst($dicname)),
null,
'errors');
2458 if (!$error && $newdicname !==
null) {
2460 $_results =
$db->DDLDropTable(MAIN_DB_PREFIX.strtolower($newdicname));
2461 if ($_results < 0) {
2463 $langs->load(
"errors");
2464 setEventMessages($langs->trans(
"ErrorTableNotFound", $newdicname),
null,
'errors');
2469 setEventMessages($langs->trans(
"DictionaryDeleted", ucfirst(substr($newdicname, 2))),
null);
2471 if (function_exists(
'opcache_invalidate')) {
2474 clearstatcache(
true);
2475 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
''));
2479if ($dirins && $action ==
'updatedictionary' &&
GETPOST(
'dictionnarykey') ) {
2480 $keydict =
GETPOSTINT(
'dictionnarykey') - 1 ;
2482 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2483 $destdir = $dirins.
'/'.strtolower($module);
2484 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2486 $class =
'mod'.$module;
2489 if (class_exists($class)) {
2492 '@phan-var-force DolibarrModules $moduleobj';
2502 $langs->load(
"errors");
2503 dol_print_error(
$db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
2508 if (!empty(
GETPOST(
'tablib')) &&
GETPOST(
'tablib') !== $dicts[
'tablib'][$keydict]) {
2509 $dicts[
'tablib'][$keydict] = ucfirst(strtolower(
GETPOST(
'tablib')));
2511 if ($checkComment < 0) {
2512 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Dictionaries"),
"mod".$module.
"class.php"),
null,
'warnings');
2515 if ($updateDict > 0) {
2518 if (function_exists(
'opcache_invalidate')) {
2521 clearstatcache(
true);
2522 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
''));
2528if ($dirins && $action ==
'generatedoc' ) {
2529 $modulelowercase = strtolower($module);
2534 $FILENAMEDOC = strtolower($module).
'.html';
2537 $result = $util->generateDoc($module);
2540 setEventMessages($langs->trans(
"DocFileGeneratedInto", $dirofmodule),
null);
2546if ($dirins && $action ==
'generatepackage' ) {
2547 $modulelowercase = strtolower($module);
2549 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2559 $class =
'mod'.$module;
2562 if (class_exists($class)) {
2565 '@phan-var-force DolibarrModules $moduleobj';
2575 $langs->load(
"errors");
2576 dol_print_error(
$db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
2580 $arrayversion = explode(
'.',
$moduleobj->version, 3);
2581 if (count($arrayversion)) {
2582 $FILENAMEZIP =
"module_".$modulelowercase.
'-'.$arrayversion[0].(empty($arrayversion[1]) ?
'.0' :
'.'.$arrayversion[1]).(empty($arrayversion[2]) ?
'' :
'.'.$arrayversion[2]).
'.zip';
2585 $outputfilezip = $dirofmodule.
'/'.$FILENAMEZIP;
2591 $result = dol_compress_dir($dir, $outputfilezip,
'zip',
'/\/bin\/|\.git|\.old|\.back|\.ssh/', $modulelowercase);
2594 setEventMessages($langs->trans(
"ZipFileGeneratedInto", $outputfilezip),
null);
2597 $langs->load(
"errors");
2598 setEventMessages($langs->trans(
"ErrorFailToGenerateFile", $outputfilezip),
null,
'errors');
2602 $langs->load(
"errors");
2603 setEventMessages($langs->trans(
"ErrorCheckVersionIsDefined"),
null,
'errors');
2608if ($dirins && $action ==
'addright' && !empty($module) && empty($cancel) ) {
2612 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2614 $class =
'mod'.$module;
2616 if (class_exists($class)) {
2619 '@phan-var-force DolibarrModules $moduleobj';
2628 if (!
GETPOST(
'label',
'alpha')) {
2630 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
2632 if (!
GETPOST(
'permissionObj',
'alpha')) {
2634 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Rights")),
null,
'errors');
2638 $label =
GETPOST(
'label',
'alpha');
2639 $objectForPerms = strtolower(
GETPOST(
'permissionObj',
'alpha'));
2640 $crud =
GETPOST(
'crud',
'alpha');
2644 $permsForObject = array();
2648 $permissions = array();
2650 $allObject = array();
2652 $countPerms = count($permissions);
2654 for ($i = 0; $i < $countPerms; $i++) {
2655 if ($permissions[$i][4] == $objectForPerms) {
2657 if (count($permsForObject) < 3) {
2658 $permsForObject[] = $permissions[$i];
2661 $allObject[] = $permissions[$i][4];
2665 $countPermsObj = count($permsForObject);
2666 for ($j = 0; $j < $countPermsObj; $j++) {
2667 if (in_array($crud, $permsForObject[$j])) {
2669 setEventMessages($langs->trans(
"ErrorExistingPermission", $langs->transnoentities($crud), $langs->transnoentities($objectForPerms)),
null,
'errors');
2673 $rightToAdd = array();
2675 $key = $countPerms + 1;
2677 $rightToAdd = array(
2680 4 => $objectForPerms,
2685 $result = unActivateModule(strtolower($module));
2690 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
2693 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2697 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Permissions"),
"mod".$module.
"class.php"),
null,
'warnings');
2702 clearstatcache(
true);
2703 if (function_exists(
'opcache_invalidate')) {
2706 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=permissions&module='.$module);
2714if ($dirins &&
GETPOST(
'action') ==
'update_right' &&
GETPOST(
'modifyright') && empty($cancel) ) {
2717 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2719 $class =
'mod'.$module;
2721 if (class_exists($class)) {
2724 '@phan-var-force DolibarrModules $moduleobj';
2732 if (!
GETPOST(
'label',
'alpha')) {
2734 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
2736 if (!
GETPOST(
'permissionObj',
'alpha')) {
2738 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Rights")),
null,
'errors');
2741 $label =
GETPOST(
'label',
'alpha');
2742 $objectForPerms = strtolower(
GETPOST(
'permissionObj',
'alpha'));
2743 $crud =
GETPOST(
'crud',
'alpha');
2746 if ($label ==
"Read objects of $module" && $crud !=
"read") {
2750 if ($label ==
"Create/Update objects of $module" && $crud !=
"write") {
2754 if ($label ==
"Delete objects of $module" && $crud !=
"delete") {
2766 if (array_key_exists($key, $permissions)) {
2767 $x1 = $permissions[$key][1];
2768 $x2 = $permissions[$key][4];
2769 $x3 = $permissions[$key][5];
2777 $permsForObject = array();
2781 $allObject = array();
2783 $countPerms = count($permissions);
2784 for ($i = 0; $i < $countPerms; $i++) {
2785 if ($permissions[$i][4] == $objectForPerms) {
2787 if (count($permsForObject) < 3) {
2788 $permsForObject[] = $permissions[$i];
2791 $allObject[] = $permissions[$i][4];
2794 if ($label != $x1 && $crud != $x3) {
2795 $countPermsObj = count($permsForObject);
2796 for ($j = 0; $j < $countPermsObj; $j++) {
2797 if (in_array($label, $permsForObject[$j])) {
2799 setEventMessages($langs->trans(
"ErrorExistingPermission", $langs->transnoentities($label), $langs->transnoentities($objectForPerms)),
null,
'errors');
2806 $result = unActivateModule(strtolower($module));
2811 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
2814 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2818 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Permissions"),
"mod".$module.
"class.php"),
null,
'warnings');
2820 $rightUpdated =
null;
2823 clearstatcache(
true);
2824 if (function_exists(
'opcache_invalidate')) {
2827 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=permissions&module='.$module);
2833if ($dirins && $action ==
'confirm_deleteright' && !empty($module) &&
GETPOSTINT(
'permskey') ) {
2836 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2838 $class =
'mod'.$module;
2840 if (class_exists($class)) {
2843 '@phan-var-force DolibarrModules $moduleobj';
2857 $result = unActivateModule(strtolower($module));
2862 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
2863 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=permissions&module='.$module);
2868 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2871 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Permissions"),
"mod".$module.
"class.php"),
null,
'warnings');
2876 clearstatcache(
true);
2877 if (function_exists(
'opcache_invalidate')) {
2881 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=permissions&module='.$module);
2887if ($action ==
'savefile' && empty($cancel) ) {
2888 $relofcustom = basename($dirins);
2892 if (!preg_match(
'/^'.$relofcustom.
'/', $file)) {
2893 $file = $relofcustom.
'/'.$file;
2901 dol_copy($pathoffile, $pathoffilebackup,
'0', 1);
2904 $check =
'restricthtml';
2905 $srclang = dol_mimetype($pathoffile,
'', 3);
2906 if ($srclang ==
'md') {
2907 $check =
'restricthtml';
2909 if ($srclang ==
'lang') {
2910 $check =
'restricthtml';
2912 if ($srclang ==
'php') {
2916 $content =
GETPOST(
'editfilecontent', $check);
2921 $result = file_put_contents($pathoffile, $content);
2938if ($action ==
'set' && $user->admin ) {
2941 $param .=
'&module='.urlencode($module);
2944 $param .=
'&tab='.urlencode($tab);
2945 $param .=
'&tabobj='.urlencode($tabobj);
2947 $value =
GETPOST(
'value',
'alpha');
2948 $resarray = activateModule($value, 1, 0);
2949 if (!empty($resarray[
'errors'])) {
2953 if ($resarray[
'nbperms'] > 0) {
2954 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
2955 $resqltmp =
$db->query($tmpsql);
2957 $obj =
$db->fetch_object($resqltmp);
2959 if ($obj && $obj->nb > 1) {
2960 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
2968 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?".$param);
2973if ($action ==
'reset' && $user->admin ) {
2976 $param .=
'&module='.urlencode($module);
2978 $param .=
'&tab='.urlencode($tab);
2979 $param .=
'&tabobj='.urlencode($tabobj);
2981 $value =
GETPOST(
'value',
'alpha');
2982 $result = unActivateModule(strtolower($value));
2986 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?".$param);
2991if ($dirins && $action ==
'confirm_deletemenu' &&
GETPOSTINT(
'menukey') ) {
2994 $result = unActivateModule(strtolower($module));
2999 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
3000 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
3004 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3006 $class =
'mod'.$module;
3008 if (class_exists($class)) {
3011 '@phan-var-force DolibarrModules $moduleobj';
3019 $dir = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
3020 $destdir = $dir.
'/'.strtolower($module);
3022 $result = array_map(
'strtolower', $objects);
3026 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
3029 if ($checkcomment < 0) {
3030 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Menus"),
"mod".$module.
"class.php"),
null,
'warnings');
3032 if ($menus[$key][
'fk_menu'] ===
'fk_mainmenu='.strtolower($module)) {
3033 if (in_array(strtolower($menus[$key][
'leftmenu']), $result)) {
3034 reWriteAllMenus($moduledescriptorfile, $menus, $menus[$key][
'leftmenu'], $key, -1);
3042 clearstatcache(
true);
3043 if (function_exists(
'opcache_invalidate')) {
3048 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
3054if ($dirins && $action ==
'addmenu' && empty($cancel) ) {
3057 $result = unActivateModule(strtolower($module));
3062 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
3063 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
3069 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3071 $class =
'mod'.$module;
3073 if (class_exists($class)) {
3076 '@phan-var-force DolibarrModules $moduleobj';
3087 if (!
GETPOST(
'type',
'alpha')) {
3089 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Type")),
null,
'errors');
3091 if (!
GETPOST(
'titre',
'alpha')) {
3093 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Title")),
null,
'errors');
3095 if (!
GETPOST(
'user',
'alpha')) {
3097 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"DetailUser")),
null,
'errors');
3099 if (!
GETPOST(
'url',
'alpha')) {
3101 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Url")),
null,
'errors');
3103 if (!empty(
GETPOST(
'target'))) {
3104 $targets = array(
'_blank',
'_self',
'_parent',
'_top',
'');
3105 if (!in_array(
GETPOST(
'target'), $targets)) {
3107 setEventMessages($langs->trans(
"ErrorFieldValue", $langs->transnoentities(
"target")),
null,
'errors');
3114 foreach ($menus as $menu) {
3117 setEventMessages($langs->trans(
"ErrorFieldExist", $langs->transnoentities(
"url")),
null,
'errors');
3120 if (strtolower(
GETPOST(
'titre')) == strtolower($menu[
'titre'])) {
3122 setEventMessages($langs->trans(
"ErrorFieldExist", $langs->transnoentities(
"titre")),
null,
'errors');
3127 if (
GETPOST(
'type',
'alpha') ==
'left' && !empty(
GETPOST(
'lefmenu',
'alpha'))) {
3128 if (!str_contains(
GETPOST(
'leftmenu'), strtolower($module))) {
3130 setEventMessages($langs->trans(
"WarningFieldsMustContains", $langs->transnoentities(
"LeftmenuId")),
null,
'errors');
3133 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
3134 $destdir = $dirins.
'/'.strtolower($module);
3137 if (
GETPOST(
'type',
'alpha') ==
'left') {
3138 if (empty(
GETPOST(
'leftmenu')) && count($objects) > 0) {
3140 setEventMessages($langs->trans(
"ErrorCoherenceMenu", $langs->transnoentities(
"LeftmenuId"), $langs->transnoentities(
"type")),
null,
'errors');
3143 if (
GETPOST(
'type',
'alpha') ==
'top') {
3145 setEventMessages($langs->trans(
"ErrorTypeMenu", $langs->transnoentities(
"type")),
null,
'errors');
3148 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
3152 'fk_menu' =>
GETPOST(
'fk_menu',
'alpha'),
3153 'type' =>
GETPOST(
'type',
'alpha'),
3154 'titre' => ucfirst(
GETPOST(
'titre',
'alpha')),
3156 'mainmenu' =>
GETPOST(
'mainmenu',
'alpha'),
3157 'leftmenu' =>
GETPOST(
'leftmenu',
'alpha'),
3158 'url' =>
GETPOST(
'url',
'alpha'),
3159 'langs' => strtolower($module).
"@".strtolower($module),
3161 'enabled' =>
GETPOST(
'enabled',
'alpha'),
3162 'perms' =>
'$user->hasRight("'.strtolower($module).
'", "'.
GETPOST(
'objects',
'alpha').
'", "'.
GETPOST(
'perms',
'alpha').
'")',
3163 'target' =>
GETPOST(
'target',
'alpha'),
3167 if (
GETPOST(
'type') ==
'left') {
3168 unset($menuToAdd[
'prefix']);
3169 if (empty(
GETPOST(
'fk_menu'))) {
3170 $menuToAdd[
'fk_menu'] =
'fk_mainmenu='.GETPOST(
'mainmenu',
'alpha');
3172 $menuToAdd[
'fk_menu'] =
'fk_mainmenu='.GETPOST(
'mainmenu',
'alpha').
',fk_leftmenu='.
GETPOST(
'fk_menu');
3175 if (
GETPOST(
'enabled') ==
'1') {
3176 $menuToAdd[
'enabled'] =
'isModEnabled("'.strtolower($module).
'")';
3178 $menuToAdd[
'enabled'] =
"0";
3180 if (empty(
GETPOST(
'objects'))) {
3181 $menuToAdd[
'perms'] =
'1';
3185 if ($checkcomment < 0) {
3186 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Menus"),
"mod".$module.
"class.php"),
null,
'warnings');
3189 $result =
reWriteAllMenus($moduledescriptorfile, $menus, $menuToAdd,
null, 1);
3191 clearstatcache(
true);
3192 if (function_exists(
'opcache_invalidate')) {
3201 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
3209if ($dirins && $action ==
"update_menu" &&
GETPOSTINT(
'menukey') &&
GETPOST(
'tabobj') ) {
3210 $objectname =
GETPOST(
'tabobj');
3211 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
3212 $destdir = $dirins.
'/'.strtolower($module);
3215 if (empty($cancel)) {
3217 $result = unActivateModule(strtolower($module));
3222 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
3223 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
3228 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3230 $class =
'mod'.$module;
3232 if (class_exists($class)) {
3235 '@phan-var-force DolibarrModules $moduleobj';
3245 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
3247 $menuModify = array(
3248 'fk_menu' =>
GETPOST(
'fk_menu',
'alpha'),
3249 'type' =>
GETPOST(
'type',
'alpha'),
3250 'titre' => ucfirst(
GETPOST(
'titre',
'alpha')),
3252 'mainmenu' =>
GETPOST(
'mainmenu',
'alpha'),
3253 'leftmenu' => $menus[$key][
'leftmenu'],
3254 'url' =>
GETPOST(
'url',
'alpha'),
3255 'langs' => strtolower($module).
"@".strtolower($module),
3257 'enabled' =>
GETPOST(
'enabled',
'alpha'),
3258 'perms' =>
GETPOST(
'perms',
'alpha'),
3259 'target' =>
GETPOST(
'target',
'alpha'),
3262 if (!empty(
GETPOST(
'fk_menu')) &&
GETPOST(
'fk_menu') != $menus[$key][
'fk_menu']) {
3263 $menuModify[
'fk_menu'] =
'fk_mainmenu='.GETPOST(
'mainmenu').
',fk_leftmenu='.
GETPOST(
'fk_menu');
3264 } elseif (
GETPOST(
'fk_menu') == $menus[$key][
'fk_menu']) {
3265 $menuModify[
'fk_menu'] = $menus[$key][
'fk_menu'];
3267 $menuModify[
'fk_menu'] =
'fk_mainmenu='.GETPOST(
'mainmenu');
3269 if ($menuModify[
'enabled'] ===
'') {
3270 $menuModify[
'enabled'] =
'1';
3272 if ($menuModify[
'perms'] ===
'') {
3273 $menuModify[
'perms'] =
'1';
3276 if (
GETPOST(
'type',
'alpha') ==
'top') {
3278 setEventMessages($langs->trans(
"ErrorTypeMenu", $langs->transnoentities(
"type")),
null,
'errors');
3285 if ($checkComment < 0) {
3286 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Menus"),
"mod".$module.
"class.php"),
null,
'warnings');
3289 $result =
reWriteAllMenus($moduledescriptorfile, $menus, $menuModify, $key, 2);
3291 clearstatcache(
true);
3292 if (function_exists(
'opcache_invalidate')) {
3299 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));
3304 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
3309 $_POST[
'type'] =
'';
3310 $_POST[
'titre'] =
'';
3311 $_POST[
'fk_menu'] =
'';
3312 $_POST[
'leftmenu'] =
'';
3318if ($dirins && $action ==
"update_props_module" && !empty(
GETPOST(
'keydescription',
'alpha')) && empty($cancel) ) {
3320 $result = unActivateModule(strtolower($module));
3325 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
3326 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
3329 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3330 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
3331 $modulelogfile = $dirins.
'/'.strtolower($module).
'/ChangeLog.md';
3335 $class =
'mod'.$module;
3337 if (class_exists($class)) {
3340 '@phan-var-force DolibarrModules $moduleobj';
3348 $keydescription =
GETPOST(
'keydescription',
'alpha');
3349 switch ($keydescription) {
3351 $propertyToUpdate =
'description';
3358 $propertyToUpdate = $keydescription;
3361 $error =
GETPOST(
'keydescription');
3365 if (isset($propertyToUpdate) && !empty(
GETPOST(
'propsmodule'))) {
3366 $newValue =
GETPOST(
'propsmodule');
3367 $patternToFindLine =
'^\s*\$this->'.$propertyToUpdate.
'\s*=';
3368 $newLine =
"\t\t\$this->$propertyToUpdate = '$newValue';\n";
3370 $fileLines = file($moduledescriptorfile);
3373 foreach ($fileLines as &$line) {
3374 if (preg_match(
'/'.$patternToFindLine.
'/', $line)) {
3375 $result =
dolReplaceInFile($moduledescriptorfile, array($line => $newLine));
3378 } elseif ($result <= -1) {
3379 $langs->load(
"errors");
3380 setEventMessages($langs->trans(
'ErrorFailToEditFile', $moduledescriptorfile),
null,
'warnings');
3388 if ($changedone && $propertyToUpdate ===
'version') {
3392 clearstatcache(
true);
3393 if (function_exists(
'opcache_invalidate')) {
3397 setEventMessages($langs->trans(
'PropertyModuleUpdated', $propertyToUpdate),
null);
3402 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=description&module='.$module);
3423 '/includes/ace/src/ace.js',
3424 '/includes/ace/src/ext-statusbar.js',
3425 '/includes/ace/src/ext-language_tools.js',
3430llxHeader(
'', $langs->trans(
"ModuleBuilder"), $help_url,
'', 0, 0, $morejs, $morecss,
'',
'classforhorizontalscrolloftabs');
3433$text = $langs->trans(
"ModuleBuilder");
3435$morehtmlright =
'<a href="'.DOL_URL_ROOT.
'/admin/tools/ui/index.php" target="_blank" rel="noopener">'.
img_picto(
'',
'book',
'class="pictofixedwidth"').$langs->trans(
"UxComponentsDoc").
'</a>';
3439print
'<div class="info hideonsmartphone">';
3440print $langs->trans(
"ModuleBuilderDesc",
'https://wiki.dolibarr.org/index.php/Module_development').
'</span>';
3446 $message =
info_admin($langs->trans(
"ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.
'/custom', DOL_DOCUMENT_ROOT));
3451 $langs->load(
"errors");
3452 $message =
info_admin($langs->trans(
"ErrorFailedToWriteInDir", $dirins));
3456 $message =
info_admin($langs->trans(
"NotExistsDirect", $dirins).$langs->trans(
"InfDirAlt").$langs->trans(
"InfDirExample"));
3465$infomodulesfound =
'<div style="padding: 12px 9px 12px">'.$form->textwithpicto(
'', $langs->trans(
"ModuleBuilderDesc3", count($listofmodules)).
'<br><br>'.$langs->trans(
"ModuleBuilderDesc4", $FILEFLAG).
'<br>'.$textforlistofdirs).
'</div>';
3469$dolibarrdataroot = preg_replace(
'/([\\/]+)$/i',
'', DOL_DATA_ROOT);
3470$allowonlineinstall =
true;
3471if (
dol_is_file($dolibarrdataroot.
'/installmodules.lock')) {
3472 $allowonlineinstall =
false;
3474if (empty($allowonlineinstall)) {
3477 $message =
info_admin($langs->trans(
'InstallModuleFromWebHasBeenDisabledContactUs'));
3480 $message =
info_admin($langs->trans(
"InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.
'/installmodules.lock'), 0, 0,
'1',
'warning');
3495if (!empty($module) && $module !=
'initmodule' && $module !=
'deletemodule') {
3496 $modulelowercase = strtolower($module);
3497 $loadclasserrormessage =
'';
3502 $fullpathdirtodescriptor = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3507 $class =
'mod'.$module;
3508 }
catch (Throwable $e) {
3509 $loadclasserrormessage = $e->getMessage().
"<br>\n";
3510 $loadclasserrormessage .=
'File: '.$e->getFile().
"<br>\n";
3511 $loadclasserrormessage .=
'Line: '.$e->getLine().
"<br>\n";
3515 if (class_exists($class)) {
3518 '@phan-var-force DolibarrModules $moduleobj';
3522 print $e->getMessage();
3525 if (empty($forceddirread)) {
3528 $langs->load(
"errors");
3529 print
'<!-- ErrorFailedToLoadModuleDescriptorForXXX -->';
3530 print
img_warning(
'').
' '.$langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module).
'<br>';
3531 print $loadclasserrormessage;
3541$head[$h][0] = $_SERVER[
"PHP_SELF"].
'?module=initmodule';
3542$head[$h][1] =
'<span class="valignmiddle text-plus-circle">'.$langs->trans(
"NewModule").
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
3543$head[$h][2] =
'initmodule';
3546$linktoenabledisable =
'';
3548if ( count($listofmodules) > 0) {
3550 $modulelowercase = strtolower($module);
3554 $param .=
'&module='.urlencode($module);
3557 $param .=
'&tab='.urlencode($tab);
3558 $param .=
'&tabobj='.urlencode($tabobj);
3560 $urltomodulesetup =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?search_keyword='.urlencode($module).
'">'.$langs->trans(
'Home').
'-'.$langs->trans(
"Setup").
'-'.$langs->trans(
"Modules").
'</a>';
3564 $linktoenabledisable .=
'<a class="reposition asetresetmodule valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$moduleobj->numero.
'&action=reset&token='.newToken().
'&value=mod'.$module.$param.
'">';
3565 $linktoenabledisable .=
img_picto($langs->trans(
"Warning").
' : '.$langs->trans(
"ModuleIsLive"),
'switch_on',
'', 0, 0, 0,
'',
'warning valignmiddle', 1);
3566 $linktoenabledisable .=
'</a>';
3571 $backtourlparam =
'';
3572 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'module='.$module;
3573 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'tab='.$tab;
3574 $backtourl = $_SERVER[
"PHP_SELF"].$backtourlparam;
3577 if (is_array($objMod->config_page_url)) {
3579 foreach ($objMod->config_page_url as $page) {
3582 $linktoenabledisable .=
' <a class="valignmiddle" href="'.$urlpage.
'" title="'.$langs->trans($page).
'">'.
img_picto(ucfirst($page),
"setup").
'</a>';
3585 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
3586 $urltouse =
dol_buildpath(
'/'.$regs[2].
'/admin/'.$regs[1], 1);
3587 $linktoenabledisable .=
' <a class="valignmiddle" 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"', 0, 0, 0,
'',
'').
'</a>';
3591 $urltouse = DOL_URL_ROOT.
'/admin/'.$urlpage;
3592 $linktoenabledisable .=
' <a class="valignmiddle" 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"', 0, 0, 0,
'',
'').
'</a>';
3596 } elseif (preg_match(
'/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) {
3597 $linktoenabledisable .=
' <a class="valignmiddle" 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"', 0, 0, 0,
'',
'').
'</a>';
3601 $linktoenabledisable .=
'<a class="reposition asetresetmodule valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$moduleobj->numero.
'&action=set&token='.newToken().
'&value=mod'.$module.$param.
'">';
3602 $linktoenabledisable .=
img_picto($langs->trans(
"ModuleIsNotActive", $urltomodulesetup),
'switch_off',
'style="padding-right: 8px"', 0, 0, 0,
'',
'classfortooltip valignmiddle', 1);
3603 $linktoenabledisable .=
"</a>\n";
3608 foreach ($listofmodules as $tmpmodule => $tmpmodulearray) {
3609 $head[$h][0] = $_SERVER[
"PHP_SELF"].
'?module='.$tmpmodulearray[
'modulenamewithcase'].($forceddirread ?
'@'.$dirread :
'');
3610 $head[$h][1] = $tmpmodulearray[
'modulenamewithcase'];
3611 $head[$h][2] = $tmpmodulearray[
'modulenamewithcase'];
3613 if ($tmpmodulearray[
'modulenamewithcase'] == $module) {
3614 $head[$h][4] =
'<span class="inline-block valignmiddle">'.$linktoenabledisable.
'</span>';
3621$head[$h][0] = $_SERVER[
"PHP_SELF"].
'?module=deletemodule';
3622$head[$h][1] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"DangerZone");
3623$head[$h][2] =
'deletemodule';
3629if ($module ==
'initmodule') {
3631 print
'<!-- section init module -->'.
"\n";
3632 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3633 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3634 print
'<input type="hidden" name="action" value="initmodule">';
3635 print
'<input type="hidden" name="module" value="initmodule">';
3640 print
'<div class="tagtable table-border">';
3642 print
'<div class="tagtr"><div class="tagtd paddingright">';
3643 print
'<span class="opacitymedium">'.$langs->trans(
"IdModule").
'</span>';
3644 print
'</div><div class="tagtd">';
3645 print
'<input type="number" min="100000" name="idmodule" class="width100" value="500000">';
3646 print
'<span class="opacitymedium small">';
3647 print
' ';
3648 print
dolButtonToOpenUrlInDialogPopup(
'popup_modules_id', $langs->transnoentitiesnoconv(
"SeeIDsInUse"), $langs->transnoentitiesnoconv(
"SeeIDsInUse"),
'/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info&hidetitle=1',
'',
'');
3650 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
'</div></div>';
3654 print
'<div class="tagtr"><div class="tagtd paddingright">';
3655 print
'<span class="opacitymedium fieldrequired">'.$langs->trans(
"ModuleName").
'</span>';
3656 print
'</div><div class="tagtd">';
3657 print
'<input type="text" name="modulename" value="'.dol_escape_htmltag($modulename).
'" autofocus>';
3658 print
' '.$form->textwithpicto(
'', $langs->trans(
"EnterNameOfModuleDesc"));
3659 print
'</div></div>';
3661 print
'<div class="tagtr"><div class="tagtd paddingright">';
3662 print
'<span class="opacitymedium">'.$langs->trans(
"Description").
'</span>';
3663 print
'</div><div class="tagtd">';
3664 print
'<input type="text" name="description" value="" class="minwidth500"><br>';
3665 print
'</div></div>';
3667 print
'<div class="tagtr"><div class="tagtd paddingright">';
3668 print
'<span class="opacitymedium">'.$langs->trans(
"Version").
'</span>';
3669 print
'</div><div class="tagtd">';
3670 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")).
'">';
3671 print
'</div></div>';
3673 print
'<div class="tagtr"><div class="tagtd paddingright">';
3674 print
'<span class="opacitymedium">'.$langs->trans(
"Family").
'</span>';
3675 print
'</div><div class="tagtd">';
3676 print
'<select name="family" id="family" class="minwidth400">';
3677 $arrayoffamilies = array(
3678 'hr' =>
"ModuleFamilyHr",
3679 'crm' =>
"ModuleFamilyCrm",
3680 'srm' =>
"ModuleFamilySrm",
3681 'financial' =>
'ModuleFamilyFinancial',
3682 'products' =>
'ModuleFamilyProducts',
3683 'projects' =>
'ModuleFamilyProjects',
3684 'ecm' =>
'ModuleFamilyECM',
3685 'technic' =>
'ModuleFamilyTechnic',
3686 'portal' =>
'ModuleFamilyPortal',
3687 'interface' =>
'ModuleFamilyInterface',
3688 'base' =>
'ModuleFamilyBase',
3689 'other' =>
'ModuleFamilyOther'
3691 foreach ($arrayoffamilies as $key => $value) {
3692 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>';
3696 print
'</div></div>';
3698 print
'<div class="tagtr"><div class="tagtd paddingright">';
3699 print
'<span class="opacitymedium">'.$langs->trans(
"Picto").
'</span>';
3700 print
'</div><div class="tagtd">';
3701 print
'<input type="text" name="idpicto" value="'.(GETPOSTISSET(
'idpicto') ?
GETPOST(
'idpicto') :
getDolGlobalString(
'MODULEBUILDER_DEFAULTPICTO',
'fa-file')).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"Picto")).
'">';
3702 print $form->textwithpicto(
'', $langs->trans(
"Example").
': fa-file, fa-globe, ... any font awesome code.<br>Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]');
3704 print
' ';
3706 print
'<span class="opacitymedium small">';
3707 print
dolButtonToOpenUrlInDialogPopup(
'popup_picto_id', $langs->transnoentitiesnoconv(
"DocIconsList"), $langs->transnoentitiesnoconv(
"DocIconsList"),
'/admin/tools/ui/components/icons.php?hidenavmenu=1&displayMode=icon-only&mode=no-btn#img-picto-section-list',
'',
'');
3710 print
'</div></div>';
3712 print
'<div class="tagtr"><div class="tagtd paddingright">';
3713 print
'<span class="opacitymedium">'.$langs->trans(
"EditorName").
'</span>';
3714 print
'</div><div class="tagtd">';
3715 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")).
'" spellcheck="false"><br>';
3716 print
'</div></div>';
3718 print
'<div class="tagtr"><div class="tagtd paddingright">';
3719 print
'<span class="opacitymedium">'.$langs->trans(
"EditorUrl").
'</span>';
3720 print
'</div><div class="tagtd">';
3721 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")).
'" spellcheck="false"><br>';
3722 print
'</div></div>';
3726 print
'<br><center>';
3727 print
'<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans(
"Create")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
3730} elseif ($module ==
'deletemodule') {
3731 print
'<!-- Form to init a module -->'.
"\n";
3732 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="delete">';
3733 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3734 print
'<input type="hidden" name="action" value="confirm_deletemodule">';
3735 print
'<input type="hidden" name="module" value="deletemodule">';
3737 print $langs->trans(
"EnterNameOfModuleToDeleteDesc").
'<br><br>';
3739 print
'<input type="text" name="module" placeholder="'.dol_escape_htmltag($langs->trans(
"ModuleKey")).
'" value="" autofocus>';
3740 print
'<input type="submit" class="button smallpaddingimp" value="'.$langs->trans(
"Delete").
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
3742} elseif (!empty($module) && $modulelowercase !==
null) {
3745 $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
3746 $destdir = $dirread.
'/'.strtolower($module);
3750 $countDictionaries = (!empty(
$moduleobj->dictionaries) ? count(
$moduleobj->dictionaries[
'tabname']) : 0);
3764 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=description&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3765 $head2[$h][1] = $langs->trans(
"Description");
3766 $head2[$h][2] =
'description';
3769 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3770 $head2[$h][1] = ((!is_array($objects) || count($objects) <= 0) ? $langs->trans(
"Objects") : $langs->trans(
"Objects").
'<span class="marginleftonlyshort badge">'.count($objects).
"</span>");
3771 $head2[$h][2] =
'objects';
3774 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=languages&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3775 $head2[$h][1] = ($countLangs <= 0 ? $langs->trans(
"Languages") : $langs->trans(
"Languages").
'<span class="marginleftonlyshort badge">'.$countLangs.
"</span>");
3776 $head2[$h][2] =
'languages';
3779 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=permissions&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3780 $head2[$h][1] = ($countRights <= 0 ? $langs->trans(
"Permissions") : $langs->trans(
"Permissions").
'<span class="marginleftonlyshort badge">'.$countRights.
"</span>");
3781 $head2[$h][2] =
'permissions';
3784 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3785 $head2[$h][1] = ($countDictionaries == 0 ? $langs->trans(
"Dictionaries") : $langs->trans(
'Dictionaries').
'<span class="marginleftonlyshort badge">'.$countDictionaries.
"</span>");
3786 $head2[$h][2] =
'dictionaries';
3789 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=tabs&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3790 $head2[$h][1] = $langs->trans(
"Tabs");
3791 $head2[$h][2] =
'tabs';
3794 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=menus&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3795 $head2[$h][1] = ($countMenus <= 0 ? $langs->trans(
"Menus") : $langs->trans(
"Menus").
'<span class="marginleftonlyshort badge">'.$countMenus.
"</span>");
3796 $head2[$h][2] =
'menus';
3799 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=hooks&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3800 $head2[$h][1] = $langs->trans(
"Hooks");
3801 $head2[$h][2] =
'hooks';
3804 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=triggers&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3805 $head2[$h][1] = ($countTriggers <= 0 ? $langs->trans(
"Triggers") : $langs->trans(
"Triggers").
'<span class="marginleftonlyshort badge">'.$countTriggers.
"</span>");
3806 $head2[$h][2] =
'triggers';
3809 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=widgets&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3810 $head2[$h][1] = ($countWidgets <= 0 ? $langs->trans(
"Widgets") : $langs->trans(
"Widgets").
'<span class="marginleftonlyshort badge">'.$countWidgets.
"</span>");
3811 $head2[$h][2] =
'widgets';
3814 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=emailings&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3815 $head2[$h][1] = ($countEmailingSelectors <= 0 ? $langs->trans(
"EmailingSelectors") : $langs->trans(
"EmailingSelectors").
'<span class="marginleftonlyshort badge">'.$countEmailingSelectors.
"</span>");
3816 $head2[$h][2] =
'emailings';
3819 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=exportimport&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3820 $head2[$h][1] = $langs->trans(
"ImportExportProfiles");
3821 $head2[$h][2] =
'exportimport';
3824 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=css&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3825 $head2[$h][1] = ($countCss <= 0 ? $langs->trans(
"CSS") : $langs->trans(
"CSS").
" (".$countCss.
")");
3826 $head2[$h][2] =
'css';
3829 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=js&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3830 $head2[$h][1] = ($countJs <= 0 ? $langs->trans(
"JS") : $langs->trans(
"JS").
'<span class="marginleftonlyshort badge">'.$countJs.
"</span>");
3831 $head2[$h][2] =
'js';
3834 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=cli&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3835 $head2[$h][1] = ($countCLI <= 0 ? $langs->trans(
"CLI") : $langs->trans(
"CLI").
'<span class="marginleftonlyshort badge">'.$countCLI.
"</span>");
3836 $head2[$h][2] =
'cli';
3839 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=cron&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3840 $head2[$h][1] = $langs->trans(
"CronList");
3841 $head2[$h][2] =
'cron';
3844 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=specifications&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3845 $head2[$h][1] = ($hasDoc <= 0 ? $langs->trans(
"Documentation") : $langs->trans(
"Documentation").
'<span class="marginleftonlyshort badge">'.$hasDoc.
"</span>");
3846 $head2[$h][2] =
'specifications';
3849 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=buildpackage&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3850 $head2[$h][1] = $langs->trans(
"BuildPackage");
3851 $head2[$h][2] =
'buildpackage';
3854 $MAXTABFOROBJECT = 12;
3856 print
'<!-- Section for a given module -->';
3860 if ($tab ==
'description') {
3861 print
'<!-- tab=description -->'.
"\n";
3862 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3863 $pathtofilereadme = $modulelowercase.
'/README.md';
3864 $pathtochangelog = $modulelowercase.
'/ChangeLog.md';
3865 $pathtoindex = $modulelowercase.
'/'.$modulelowercase.
'index.php';
3867 $realpathofmodule = realpath($dirread.
'/'.$modulelowercase);
3869 if ($action !=
'editfile' || empty($file)) {
3870 $morehtmlright =
'';
3871 if ($realpathofmodule != $dirread.
'/'.$modulelowercase) {
3872 $morehtmlright =
'<div style="padding: 12px 9px 12px">'.$form->textwithpicto(
'',
'<span class="opacitymedium">'.$langs->trans(
"RealPathOfModule").
' :</span> <strong class="wordbreak">'.$realpathofmodule.
'</strong>').
'</div>';
3875 print
dol_get_fiche_head($head2, $tab,
'', -1,
'', 0, $morehtmlright,
'', $MAXTABFOROBJECT,
'formodulesuffix');
3877 print
'<span class="opacitymedium">'.$langs->trans(
"ModuleBuilderDesc".$tab).
'</span>';
3883 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3884 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>';
3887 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"Index").
' : <strong class="wordbreak">'.$pathtoindex.
'</strong>';
3888 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($pathtoindex).
'">'.
img_picto($langs->trans(
"Edit"),
'edit').
'</a>';
3892 $listofsetuppages =
dol_dir_list($realpathofmodule.
'/admin',
'files', 0,
'\.php$');
3893 foreach ($listofsetuppages as $setuppage) {
3896 if (preg_match(
'/^([a-z]+)_extrafields.php/', $setuppage[
'relativename'], $reg)) {
3898 $fileofclass = $realpathofmodule.
'/class/'.$reg[1].
'.class.php';
3899 if (is_readable($fileofclass) && !preg_match(
'/public\s+\$isextrafieldmanaged\s+=\s+1/', file_get_contents($fileofclass))) {
3906 print
'<span class="fa fa-file"></span> ';
3907 if ($setuppage[
'relativename'] ==
'about.php') {
3908 print $langs->trans(
"AboutFile");
3910 print $langs->trans(
"SetupFile");
3913 print
'<strong class="wordbreak bold"><a href="'.dol_buildpath($modulelowercase.
'/admin/'.$setuppage[
'relativename'], 1).
'" target="_test">'.$modulelowercase.
'/admin/'.$setuppage[
'relativename'].
'</a></strong>';
3914 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>';
3918 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"ReadmeFile").
' : <strong class="wordbreak">'.$pathtofilereadme.
'</strong>';
3919 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>';
3922 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"ChangeLog").
' : <strong class="wordbreak">'.$pathtochangelog.
'</strong>';
3923 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>';
3929 print
load_fiche_titre($form->textwithpicto($langs->trans(
"DescriptorFile"), $langs->transnoentitiesnoconv(
"File").
' '.$pathtofile),
'',
'');
3932 print
'<div class="underbanner clearboth"></div>';
3933 print
'<div class="fichecenter">';
3934 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3935 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3936 print
'<input type="hidden" name="action" value="update_props_module">';
3937 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
3938 print
'<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).
'">';
3939 print
'<input type="hidden" name="keydescription" value="'.dol_escape_htmltag(
GETPOST(
'keydescription',
'alpha')).
'">';
3941 print
'<div class="div-table-responsive-no-min">';
3942 print
'<table class="border centpercent">';
3943 print
'<tr class="liste_titre"><td class="titlefield">';
3944 print $langs->trans(
"Parameter");
3946 print $langs->trans(
"Value");
3950 print $langs->trans(
"IdModule");
3953 print
'<span class="opacitymedium">';
3955 print
dolButtonToOpenUrlInDialogPopup(
'popup_modules_id', $langs->transnoentitiesnoconv(
"SeeIDsInUse"), $langs->transnoentitiesnoconv(
"SeeIDsInUse"),
'/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info',
'',
'');
3956 print
' - <a href="https://wiki.dolibarr.org/index.php/List_of_modules_id" target="_blank" rel="noopener noreferrer external">'.$langs->trans(
"SeeReservedIDsRangeHere").
'</a>)';
3961 print $langs->trans(
"ModuleName");
3967 print $langs->trans(
"Description");
3969 if ($action ==
'edit_moduledescription' &&
GETPOST(
'keydescription',
'alpha') ===
'desc') {
3970 print
'<input class="minwidth500" name="propsmodule" value="'.dol_escape_htmltag(
$moduleobj->description).
'" spellcheck="false">';
3971 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifydesc" value="'.$langs->trans(
"Modify").
'"/>';
3972 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
3975 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>';
3977 $moduledescritpionautotrans =
$moduleobj->getDesc();
3978 if ($moduledescritpionautotrans !=
"Module".
$moduleobj->name.
"Desc") {
3980 print
' '.$form->textwithpicto(
'', $langs->trans(
"ModuleTranslatedIntoLangForKeyInto",
"Module".$moduleobj->name.
"Desc", $moduledescritpionautotrans));
3981 } elseif ($moduledescritpionautotrans !=
"Module".
$moduleobj->numero.
"Desc") {
3983 print
' '.$form->textwithpicto(
'', $langs->trans(
"ModuleTranslatedIntoLangForKeyInto",
"Module".$moduleobj->numero.
"Desc", $moduledescritpionautotrans));
3989 print $langs->trans(
"Version");
3991 if ($action ==
'edit_moduledescription' &&
GETPOST(
'keydescription',
'alpha') ===
'version') {
3992 print
'<input name="propsmodule" value="'.dol_escape_htmltag(
$moduleobj->getVersion()).
'">';
3993 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifyversion" value="'.$langs->trans(
"Modify").
'"/>';
3994 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
3997 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>';
4002 print $langs->trans(
"Family");
4005 if ($action ==
'edit_moduledescription' &&
GETPOST(
'keydescription',
'alpha') ===
'family') {
4006 print
'<select name="propsmodule" id="family" class="minwidth400">';
4007 $arrayoffamilies = array(
4008 'hr' =>
"ModuleFamilyHr",
4009 'crm' =>
"ModuleFamilyCrm",
4010 'srm' =>
"ModuleFamilySrm",
4011 'financial' =>
'ModuleFamilyFinancial',
4012 'products' =>
'ModuleFamilyProducts',
4013 'projects' =>
'ModuleFamilyProjects',
4014 'ecm' =>
'ModuleFamilyECM',
4015 'technic' =>
'ModuleFamilyTechnic',
4016 'portal' =>
'ModuleFamilyPortal',
4017 'interface' =>
'ModuleFamilyInterface',
4018 'base' =>
'ModuleFamilyBase',
4019 'other' =>
'ModuleFamilyOther'
4021 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>';
4022 foreach ($arrayoffamilies as $key => $value) {
4024 print
'<option value="'.$key.
'" data-html="'.
dol_escape_htmltag($langs->trans($value).
' <span class="opacitymedium">- '.$key.
'</span>').
'">'.$langs->trans($value).
'</option>';
4028 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifyfamily" value="'.$langs->trans(
"Modify").
'"/>';
4029 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
4032 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>';
4036 print
'<!-- picto of module -->'.
"\n";
4038 print $langs->trans(
"Picto");
4040 if ($action ==
'edit_modulepicto' &&
GETPOST(
'keydescription',
'alpha') ===
'picto') {
4041 print
'<input class="minwidth200 maxwidth500" name="propsmodule" value="'.dol_escape_htmltag(
$moduleobj->picto).
'" spellcheck="false">';
4043 print $form->textwithpicto(
'', $langs->trans(
"Example").
': fa-file, fa-globe, ... any font awesome code.<br>Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]] where faprefix can be far,far, facolor can be a text like \'red\' orvalue like \'#FF0000\' and fasize is CSS font size like \'1em\'');
4045 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifypicto" value="'.$langs->trans(
"Modify").
'"/>';
4046 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
4048 print
' ';
4050 print
'<span class="opacitymedium small">';
4051 print
dolButtonToOpenUrlInDialogPopup(
'popup_picto_id', $langs->transnoentitiesnoconv(
"DocIconsList"), $langs->transnoentitiesnoconv(
"DocIconsList"),
'/admin/tools/ui/components/icons.php?hidenavmenu=1&displayMode=icon-only&mode=no-btn#img-picto-section-list',
'',
'');
4055 print
' '.img_picto(
'',
$moduleobj->picto,
'class="valignmiddle pictomodule paddingrightonly"');
4056 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>';
4061 print $langs->trans(
"EditorName");
4063 if ($action ==
'edit_moduledescription' &&
GETPOST(
'keydescription',
'alpha') ===
'editor_name') {
4064 print
'<input name="propsmodule" value="'.dol_escape_htmltag(
$moduleobj->editor_name).
'" spellcheck="false">';
4065 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifyname" value="'.$langs->trans(
"Modify").
'"/>';
4066 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
4069 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>';
4074 print $langs->trans(
"EditorUrl");
4076 if ($action ==
'edit_moduledescription' &&
GETPOST(
'keydescription',
'alpha') ===
'editor_url') {
4077 print
'<input name="propsmodule" value="'.dol_escape_htmltag(
$moduleobj->editor_url).
'" spellcheck="false">';
4078 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifyeditorurl" value="'.$langs->trans(
"Modify").
'"/>';
4079 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
4082 print
'<a href="'.$moduleobj->editor_url.
'" target="_blank" rel="noopener">'.
$moduleobj->editor_url.
' '.
img_picto(
'',
'globe').
'</a>';
4084 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>';
4092 print $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module).
'<br>';
4099 print
load_fiche_titre($form->textwithpicto($langs->trans(
"ReadmeFile"), $langs->transnoentitiesnoconv(
"File").
' '.$pathtofilereadme),
'',
'');
4101 print
'<!-- readme file -->';
4102 if (
dol_is_file($dirread.
'/'.$pathtofilereadme)) {
4103 print
'<div class="underbanner clearboth"></div><div class="fichecenter">'.$moduleobj->getDescLong().
'</div>';
4105 print
'<span class="opacitymedium">'.$langs->trans(
"ErrorFileNotFound", $pathtofilereadme).
'</span>';
4111 print
load_fiche_titre($form->textwithpicto($langs->trans(
"ChangeLog"), $langs->transnoentitiesnoconv(
"File").
' '.$pathtochangelog),
'',
'');
4113 print
'<!-- changelog file -->';
4115 print
'<div class="underbanner clearboth"></div><div class="fichecenter">'.$moduleobj->getChangeLog().
'</div>';
4117 print
'<span class="opacitymedium">'.$langs->trans(
"ErrorFileNotFound", $pathtochangelog).
'</span>';
4126 if ($fullpathoffile) {
4127 $content = file_get_contents($fullpathoffile);
4131 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4132 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4133 print
'<input type="hidden" name="action" value="savefile">';
4134 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4135 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4136 print
'<input type="hidden" name="module" value="'.$module.
'">';
4140 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
4141 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
4142 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
4147 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
4149 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4155 print
dol_get_fiche_head($head2, $tab,
'', -1,
'', 0,
'',
'', $MAXTABFOROBJECT,
'formodulesuffix');
4158 if ($tab ==
'languages') {
4159 print
'<!-- tab=languages -->'.
"\n";
4160 if ($action !=
'editfile' || empty($file)) {
4161 print
'<span class="opacitymedium">'.$langs->trans(
"LanguageDefDesc").
'</span><br>';
4165 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4166 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4167 print
'<input type="hidden" name="action" value="addlanguage">';
4168 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4169 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4170 print
'<input type="hidden" name="module" value="'.$module.
'">';
4171 print $formadmin->select_language(
getDolGlobalString(
'MAIN_LANG_DEFAULT'),
'newlangcode', 0, array(), 1, 0, 0,
'minwidth300', 1);
4172 print
'<input type="submit" name="addlanguage" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans(
"AddLanguageFile")).
'"><br>';
4178 $modulelowercase = strtolower($module);
4182 $diroflang .=
'/langs';
4183 $langfiles =
dol_dir_list($diroflang,
'files', 1,
'\.lang$');
4185 if (!preg_match(
'/custom/', $dirread)) {
4187 $diroflang = $dirread;
4188 $diroflang .=
'/langs';
4189 $langfiles =
dol_dir_list($diroflang,
'files', 1, $modulelowercase.
'\.lang$');
4192 print
'<table class="none">';
4193 foreach ($langfiles as $langfile) {
4194 $pathtofile = $modulelowercase.
'/langs/'.$langfile[
'relativename'];
4195 if (!preg_match(
'/custom/', $dirread)) {
4196 $pathtofile =
'langs/'.$langfile[
'relativename'];
4198 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"LanguageFile").
' '.basename(dirname($pathtofile)).
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
4199 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>';
4200 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>';
4211 $content = file_get_contents($fullpathoffile);
4214 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4215 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4216 print
'<input type="hidden" name="action" value="savefile">';
4217 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4218 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4219 print
'<input type="hidden" name="module" value="'.$module.
'">';
4221 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
4222 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'text'));
4225 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
4227 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4234 if ($tab ==
'objects') {
4235 print
'<!-- tab=objects -->'.
"\n";
4240 $dir = $dirread.
'/'.$modulelowercase.
'/class';
4242 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj=newobject';
4243 $head3[$h][1] =
'<span class="valignmiddle text-plus-circle">'.$langs->trans(
"NewObjectInModulebuilder").
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
4244 $head3[$h][2] =
'newobject';
4248 $listofobject =
dol_dir_list($dir,
'files', 0,
'\.class\.php$');
4250 $firstobjectname =
'';
4251 foreach ($listofobject as $fileobj) {
4252 if (preg_match(
'/^api_/', $fileobj[
'name'])) {
4255 if (preg_match(
'/^actions_/', $fileobj[
'name'])) {
4259 $tmpcontent = file_get_contents($fileobj[
'fullname']);
4260 if (preg_match(
'/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) {
4262 $objectname = $reg[1];
4263 if (empty($firstobjectname)) {
4264 $firstobjectname = $objectname;
4266 $pictoname =
'generic';
4267 if (preg_match(
'/\$picto\s*=\s*["\']([^"\']+)["\']/', $tmpcontent, $reg)) {
4268 $pictoname = $reg[1];
4271 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj='.$objectname;
4272 $head3[$h][1] =
img_picto(
'', $pictoname,
'class="pictofixedwidth valignmiddle"').$objectname;
4273 $head3[$h][2] = $objectname;
4279 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj=deleteobject';
4280 $head3[$h][1] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"DangerZone");
4281 $head3[$h][2] =
'deleteobject';
4286 if ($tabobj ==
'newobjectifnoobj') {
4287 if ($firstobjectname) {
4288 $tabobj = $firstobjectname;
4290 $tabobj =
'newobject';
4294 print
dol_get_fiche_head($head3, $tabobj,
'', -1,
'', 0,
'',
'', 0,
'forobjectsuffix');
4297 if ($tabobj ==
'newobject') {
4299 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4300 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4301 print
'<input type="hidden" name="action" value="initobject">';
4302 print
'<input type="hidden" name="tab" value="objects">';
4303 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4308 print
'<span class="opacitymedium">'.$langs->trans(
"EnterNameOfObjectDesc").
'</span><br><br>';
4310 print
'<div class="tagtable">';
4312 print
'<div class="tagtr"><div class="tagtd">';
4313 print
'<span class="opacitymedium">'.$langs->trans(
"ObjectKey").
'</span> ';
4314 print
'</div><div class="tagtd">';
4315 print
'<input type="text" name="objectname" maxlength="64" value="'.dol_escape_htmltag(GETPOSTISSET(
'objectname') ?
GETPOST(
'objectname',
'alpha') : $modulename).
'" required autofocus>';
4316 print $form->textwithpicto(
'', $langs->trans(
"Example").
': MyObject, ACamelCaseName, ...');
4317 print
'</div></div>';
4319 print
'<div class="tagtr"><div class="tagtd">';
4320 print
'<span class="opacitymedium">'.$langs->trans(
"Picto").
'</span> ';
4321 print
'</div><div class="tagtd">';
4322 print
'<input type="text" name="idpicto" value="fa-file" placeholder="'.dol_escape_htmltag($langs->trans(
"Picto")).
'">';
4324 print $form->textwithpicto(
'', $langs->trans(
"Example").
': fa-file, fa-globe, ... any font awesome code.<br>Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]] where faprefix can be far,far, facolor can be a text like \'red\' orvalue like \'#FF0000\' and fasize is CSS font size like \'1em\'');
4326 print
'<span class="opacitymedium small">';
4327 print
' ';
4328 print
dolButtonToOpenUrlInDialogPopup(
'popup_picto_id', $langs->transnoentitiesnoconv(
"DocIconsList"), $langs->transnoentitiesnoconv(
"DocIconsList"),
'/admin/tools/ui/components/icons.php?hidenavmenu=1&displayMode=icon-only&mode=no-btn#img-picto-section-list',
'',
'');
4331 print
'</div></div>';
4333 print
'<div class="tagtr"><div class="tagtd">';
4334 print
'<span class="opacitymedium">'.$langs->trans(
"DefinePropertiesFromExistingTable").
'</span> ';
4335 print
'</div><div class="tagtd">';
4336 print
'<input type="text" name="initfromtablename" value="'.GETPOST(
'initfromtablename').
'" placeholder="'.$langs->trans(
"TableName").
'">';
4337 print $form->textwithpicto(
'', $langs->trans(
"DefinePropertiesFromExistingTableDesc").
'<br>'.$langs->trans(
"DefinePropertiesFromExistingTableDesc2"));
4338 print
'</div></div>';
4343 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>';
4344 print
'<input type="checkbox" name="includedocgeneration" id="includedocgeneration" value="includedocgeneration"> <label for="includedocgeneration">'.$form->textwithpicto($langs->trans(
"IncludeDocGeneration"), $langs->trans(
"IncludeDocGenerationHelp")).
'</label><br>';
4345 print
'<input type="checkbox" name="generatepermissions" id="generatepermissions" value="generatepermissions"> <label for="generatepermissions">'.$form->textwithpicto($langs->trans(
"GeneratePermissions"), $langs->trans(
"GeneratePermissionsHelp")).
'</label><br>';
4346 print
'<input type="checkbox" name="nogeneratelines" id="nogeneratelines" value="nogeneratelines"> <label for="nogeneratelines">'.$form->textwithpicto($langs->trans(
"NoGenerateLines"), $langs->trans(
"NoGenerateLinesHelp")).
'</label><br>';
4347 print
'<br><span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"EnabledTabsForObject"), $langs->trans(
"EnabledTabsForObjectHelp")).
'</span><br>';
4349 $checked = in_array($tabkey, $enabledtabsdefault,
true) ?
' checked' :
'';
4350 print
'<input type="checkbox" name="enabledtab[]" id="enabledtab_'.$tabkey.
'" value="'.
dol_escape_htmltag($tabkey).
'"'.$checked.
'> ';
4351 print
'<label for="enabledtab_'.$tabkey.
'">'.
dol_escape_htmltag($langs->trans($tabinfo[
'label'])).
'</label> ';
4355 print
'<input type="submit" class="button small" name="create" value="'.dol_escape_htmltag($langs->trans(
"GenerateCode")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
4371 } elseif ($tabobj ==
'createproperty') {
4372 $attributesUnique = array(
4373 'proplabel' => $form->textwithpicto($langs->trans(
"Label"), $langs->trans(
"YouCanUseTranslationKey")),
4374 'propname' => $form->textwithpicto($langs->trans(
"Code"), $langs->trans(
"PropertyDesc"), 1,
'help',
'extracss', 0, 3,
'propertyhelp'),
4375 'proptype' => $form->textwithpicto($langs->trans(
"Type"), $langs->trans(
"TypeOfFieldsHelpIntro").
'<br><br>'.$langs->trans(
"TypeOfFieldsHelp"), 1,
'help',
'extracss', 0, 3,
'typehelp'),
4376 'proparrayofkeyval' => $form->textwithpicto($langs->trans(
"ArrayOfKeyValues"), $langs->trans(
"ArrayOfKeyValuesDesc")),
4377 'propnotnull' => $form->textwithpicto($langs->trans(
"NotNull"), $langs->trans(
"NotNullDesc")),
4378 'propdefault' => $langs->trans(
"DefaultValue"),
4379 'propindex' => $langs->trans(
"DatabaseIndex"),
4380 'propforeignkey' => $form->textwithpicto($langs->trans(
"ForeignKey"), $langs->trans(
"ForeignKeyDesc"), 1,
'help',
'extracss', 0, 3,
'foreignkeyhelp'),
4381 'propposition' => $langs->trans(
"Position"),
4382 'propenabled' => $form->textwithpicto($langs->trans(
"Enabled"), $langs->trans(
"EnabledDesc"), 1,
'help',
'extracss', 0, 3,
'enabledhelp'),
4383 'propvisible' => $form->textwithpicto($langs->trans(
"Visibility"), $langs->trans(
"VisibleDesc").
'<br><br>'.$langs->trans(
"ItCanBeAnExpression"), 1,
'help',
'extracss', 0, 3,
'visiblehelp'),
4384 'propnoteditable' => $langs->trans(
"NotEditable"),
4386 'propsearchall' => $form->textwithpicto($langs->trans(
"SearchAll"), $langs->trans(
"SearchAllDesc")),
4387 'propisameasure' => $form->textwithpicto($langs->trans(
"IsAMeasure"), $langs->trans(
"IsAMeasureDesc")),
4388 'propcss' => $langs->trans(
"CSSClass"),
4389 'propcssview' => $langs->trans(
"CSSViewClass"),
4390 'propcsslist' => $langs->trans(
"CSSListClass"),
4391 'prophelp' => $langs->trans(
"KeyForTooltip"),
4392 'propshowoncombobox' => $langs->trans(
"ShowOnCombobox"),
4394 'propcomment' => $langs->trans(
"Comment"),
4396 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?tab=objects&module='.urlencode($module).
'&tabobj=createproperty&obj='.urlencode(
GETPOST(
'obj')).
'" method="POST">';
4397 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4398 print
'<input type="hidden" name="action" value="addproperty">';
4399 print
'<input type="hidden" name="tab" value="objects">';
4400 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4401 print
'<input type="hidden" name="obj" value="'.dol_escape_htmltag(
GETPOST(
'obj')).
'">';
4403 print
'<table class="border centpercent tableforfieldcreate">'.
"\n";
4405 foreach ($attributesUnique as $key => $attribute) {
4406 if ($counter % 2 === 0) {
4409 if ($key ==
'propname' || $key ==
'proplabel') {
4410 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>';
4411 } elseif ($key ==
'proptype') {
4412 print
'<td class="titlefieldcreate fieldrequired">'.$attribute.
'</td><td class="valuefieldcreate maxwidth50">';
4413 print
'<input class="maxwidth200" name="'.$key.
'" id="'.$key.
'" list="datalist'.$key.
'" type="text" value="'.
dol_escape_htmltag(
GETPOST($key,
'alpha')).
'">';
4415 print
'<datalist id="datalist'.$key.
'">';
4416 print
'<option>varchar(128)</option>';
4417 print
'<option>email</option>';
4418 print
'<option>phone</option>';
4419 print
'<option>ip</option>';
4420 print
'<option>url</option>';
4421 print
'<option>password</option>';
4422 print
'<option>text</option>';
4423 print
'<option>html</option>';
4424 print
'<option>date</option>';
4425 print
'<option>datetime</option>';
4426 print
'<option>integer</option>';
4427 print
'<option>stars(5)</option>';
4428 print
'<option>double(28,4)</option>';
4429 print
'<option>real</option>';
4430 print
'<option>integer:ClassName:RelativePath/To/ClassFile.class.php[:1[:FILTER]]</option>';
4439 print
'</datalist>';
4443 } elseif ($key ==
'propvisible') {
4444 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>';
4445 } elseif ($key ==
'propenabled') {
4448 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>';
4449 } elseif ($key ==
'proparrayofkeyval') {
4450 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>';
4452 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>';
4455 if ($counter % 2 === 0) {
4459 if ($counter % 2 !== 0) {
4460 while ($counter % 2 !== 0) {
4466 print
'</table><br>'.
"\n";
4467 print
'<div class="center">';
4468 print
'<input type="submit" class="button button-save" name="add" value="' .
dol_escape_htmltag($langs->trans(
'Create')) .
'">';
4469 print
'<input type="button" class="button button-cancel" name="cancel" value="' .
dol_escape_htmltag($langs->trans(
'Cancel')) .
'" onclick="goBack()">';
4475 var url = "'.$_SERVER[
"PHP_SELF"].
'?tab=objects&module='.urlencode($module).
'";
4476 window.location.href = url;
4478 $(document).ready(function() {
4479 $("#proplabel").on("keyup", function() {
4480 console.log("key up on label");
4481 s = cleanString($("#proplabel").val());
4482 $("#propname").val(s);
4485 function cleanString( stringtoclean )
4487 // allow "a-z", "A-Z", "0-9" and "_"
4488 stringtoclean = stringtoclean.replace(/[^a-z0-9_]+/ig, "");
4489 stringtoclean = stringtoclean.toLowerCase();
4490 if (!isNaN(stringtoclean)) {
4493 while ( stringtoclean.length > 1 && !isNaN( stringtoclean.charAt(0)) ){
4494 stringtoclean = stringtoclean.substr(1)
4496 if (stringtoclean.length > 28) {
4497 stringtoclean = stringtoclean.substring(0, 27);
4499 return stringtoclean;
4504 } elseif ($tabobj ==
'deleteobject') {
4506 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4507 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4508 print
'<input type="hidden" name="action" value="confirm_deleteobject">';
4509 print
'<input type="hidden" name="tab" value="objects">';
4510 print
'<input type="hidden" name="tabobj" value="deleteobject">';
4511 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4513 print $langs->trans(
"EnterNameOfObjectToDeleteDesc").
'<br><br>';
4515 print
'<input type="text" class="valignmiddle" name="objectname" value="" placeholder="'.dol_escape_htmltag($langs->trans(
"ObjectKey")).
'" autofocus>';
4516 print
'<input type="submit" class="button smallpaddingimp" name="delete" value="'.dol_escape_htmltag($langs->trans(
"Delete")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
4520 if ($action ==
'deleteproperty') {
4521 $formconfirm = $form->formconfirm(
4522 $_SERVER[
"PHP_SELF"].
'?propertykey='.urlencode(
GETPOST(
'propertykey',
'alpha')).
'&objectname='.urlencode($objectname).
'&tab='.urlencode($tab).
'&module='.urlencode($module).
'&tabobj='.urlencode($tabobj),
4523 $langs->trans(
'Delete'),
4524 $langs->trans(
'ConfirmDeleteProperty',
GETPOST(
'propertykey',
'alpha')),
4525 'confirm_deleteproperty',
4534 if ($action !=
'editfile' || empty($file)) {
4538 $pathtoclass = strtolower($module).
'/class/'.strtolower($tabobj).
'.class.php';
4539 $pathtoapi = strtolower($module).
'/class/api_'.strtolower($module).
'.class.php';
4540 $pathtoagenda = strtolower($module).
'/'.strtolower($tabobj).
'_agenda.php';
4541 $pathtocard = strtolower($module).
'/'.strtolower($tabobj).
'_card.php';
4542 $pathtodocument = strtolower($module).
'/'.strtolower($tabobj).
'_document.php';
4543 $pathtolist = strtolower($module).
'/'.strtolower($tabobj).
'_list.php';
4544 $pathtonote = strtolower($module).
'/'.strtolower($tabobj).
'_note.php';
4545 $pathtocontact = strtolower($module).
'/'.strtolower($tabobj).
'_contact.php';
4546 $pathtophpunit = strtolower($module).
'/test/phpunit/'.strtolower($tabobj).
'Test.php';
4549 clearstatcache(
true);
4550 if (function_exists(
'opcache_invalidate')) {
4551 opcache_invalidate($dirread.
'/'.$pathtoclass,
true);
4554 if (empty($forceddirread) && empty($dirread)) {
4556 $stringofinclude =
"dol_include_once(".$pathtoclass.
")";
4558 $result = include_once $dirread.
'/'.$pathtoclass;
4559 $stringofinclude =
"@include_once ".$dirread.
'/'.$pathtoclass;
4562 if (class_exists($tabobj)) {
4564 $tmpobject = @
new $tabobj(
$db);
4566 dol_syslog(
'Failed to load Constructor of class: '.$e->getMessage(), LOG_WARNING);
4569 print
'<span class="warning">'.$langs->trans(
'Failed to find the class '.$tabobj.
' despite the '.$stringofinclude).
'</span><br><br>';
4573 $pathtosql = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'-'.strtolower($module).
'.sql';
4576 $pathtosql = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'.sql';
4579 $pathtosql =
'install/mysql/tables/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'-'.strtolower($module).
'.sql';
4582 $pathtosql =
'install/mysql/tables/llx_'.strtolower($module).
'-'.strtolower($module).
'.sql';
4585 $pathtosql =
'install/mysql/tables/llx_'.strtolower($module).
'.sql';
4586 $pathtosqlextra =
'install/mysql/tables/llx_'.strtolower($module).
'_extrafields.sql';
4589 $pathtosqlextra =
'install/mysql/tables/llx_'.strtolower($module).
'_extrafields-'.strtolower($module).
'.sql';
4592 $pathtosqlextra =
'install/mysql/tables/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields-'.strtolower($module).
'.sql';
4595 $pathtosqlextra = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields.sql';
4598 $pathtosqlextra = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields-'.strtolower($module).
'.sql';
4600 $pathtosqlroot = preg_replace(
'/\/llx_.*$/',
'', $pathtosql);
4602 $pathtosqlkey = preg_replace(
'/\.sql$/',
'.key.sql', $pathtosql);
4603 $pathtosqlextrakey = preg_replace(
'/\.sql$/',
'.key.sql', $pathtosqlextra);
4605 $pathtolib = strtolower($module).
'/lib/'.strtolower($module).
'.lib.php';
4606 $pathtoobjlib = strtolower($module).
'/lib/'.strtolower($module).
'_'.strtolower($tabobj).
'.lib.php';
4608 $tmpobject = $tmpobject ??
null;
4609 if (is_object($tmpobject) && property_exists($tmpobject,
'picto')) {
4610 $pathtopicto = $tmpobject->picto;
4611 $realpathtopicto =
'';
4613 $pathtopicto = strtolower($module).
'/img/object_'.strtolower($tabobj).
'.png';
4614 $realpathtopicto = $dirread.
'/'.$pathtopicto;
4619 $realpathtoclass = $dirread.
'/'.$pathtoclass;
4620 $realpathtoapi = $dirread.
'/'.$pathtoapi;
4621 $realpathtoagenda = $dirread.
'/'.$pathtoagenda;
4622 $realpathtocard = $dirread.
'/'.$pathtocard;
4623 $realpathtodocument = $dirread.
'/'.$pathtodocument;
4624 $realpathtolist = $dirread.
'/'.$pathtolist;
4625 $realpathtonote = $dirread.
'/'.$pathtonote;
4626 $realpathtocontact = $dirread.
'/'.$pathtocontact;
4627 $realpathtophpunit = $dirread.
'/'.$pathtophpunit;
4628 $realpathtosql = $dirread.
'/'.$pathtosql;
4629 $realpathtosqlextra = $dirread.
'/'.$pathtosqlextra;
4630 $realpathtosqlkey = $dirread.
'/'.$pathtosqlkey;
4631 $realpathtosqlextrakey = $dirread.
'/'.$pathtosqlextrakey;
4632 $realpathtolib = $dirread.
'/'.$pathtolib;
4633 $realpathtoobjlib = $dirread.
'/'.$pathtoobjlib;
4635 if (empty($realpathtoapi)) {
4636 $pathtoapi = strtolower($module).
'/class/api_'.strtolower($module).
's.class.php';
4637 $realpathtoapi = $dirread.
'/'.$pathtoapi;
4647 if ($realpathtopicto &&
dol_is_file($realpathtopicto)) {
4648 $htmltooltip .=
'<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>';
4649 $htmltooltip .=
'<br>';
4650 } elseif (!empty($tmpobject)) {
4651 $htmltooltip .=
'<span class="fa fa-file-image-o"></span> '.$langs->trans(
"Image").
' : '.
img_picto(
'', $tmpobject->picto,
'class="pictofixedwidth valignmiddle"').$tmpobject->picto;
4652 $htmltooltip .=
'<br>';
4654 $htmltooltip .=
'<span class="fa fa-file-image-o"></span> '.$langs->trans(
"IsExtraFieldManaged").
' : '.
yn(empty($tmpobject->isextrafieldmanaged) ? 0 : 1, 1, 2);
4655 $htmltooltip .=
'<br>';
4656 $htmltooltip .=
'<span class="fa fa-file-image-o"></span> '.$langs->trans(
"IsMultiEntityManaged").
' : '.
yn(empty($tmpobject->ismultientitymanaged) ? 0 : 1, 1, 2);
4657 $htmltooltip .=
'<br>';
4659 print
'<!-- section for object -->';
4660 print
'<div class="fichehalfleft smallxxx">';
4662 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>';
4663 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>';
4664 print $form->textwithpicto(
'', $htmltooltip, 1,
'help',
'valignmiddle', 1);
4669 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>';
4671 $file = file_get_contents($realpathtoapi);
4672 if (preg_match(
'/var '.$tabobj.
'\s+([^\s]*)\s/ims', $file, $objs)) {
4673 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>';
4675 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>';
4676 print $form->textwithpicto(
'', $langs->trans(
"InfoForApiFile"), 1,
'warning');
4680 print
'<a href="#" class="classfortooltip" target="apiexplorer" title="'.$langs->trans(
"ModuleMustBeEnabled", $module).
'"><strike>'.$langs->trans(
"ApiExplorer").
'</strike></a>';
4682 print
'<a href="'.DOL_URL_ROOT.
'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans(
"ApiExplorer").
'</a>';
4685 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>';
4688 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>';
4692 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>';
4694 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>';
4696 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>';
4698 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>';
4704 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>';
4705 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>';
4707 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>';
4708 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>';
4712 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>';
4713 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>';
4714 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>';
4717 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>';
4718 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>';
4721 if (!empty($tmpobject->isextrafieldmanaged)) {
4722 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>';
4724 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>';
4726 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>';
4728 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>';
4730 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>';
4735 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>';
4737 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>';
4739 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>';
4741 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>';
4747 print
'<div class="fichehalfleft smallxxxx">';
4748 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>';
4749 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>';
4751 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>';
4752 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>';
4755 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>';
4756 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>';
4759 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>';
4761 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>';
4765 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>';
4766 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>';
4769 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>';
4771 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>';
4775 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>';
4776 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>';
4779 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>';
4781 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>';
4785 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>';
4786 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>';
4789 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>';
4791 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>';
4798 print
'<br><br><br>';
4800 if (!empty($tmpobject)) {
4801 $reflector =
new ReflectionClass($tabobj);
4802 $reflectorproperties = $reflector->getProperties();
4803 $reflectorpropdefault = $reflector->getDefaultProperties();
4807 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4808 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4809 print
'<input type="hidden" name="action" value="addproperty">';
4810 print
'<input type="hidden" name="tab" value="objects">';
4811 print
'<input type="hidden" name="page_y" value="">';
4812 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module.($forceddirread ?
'@'.$dirread :
'')).
'">';
4813 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
4815 print
'<input class="button smallpaddingimp" type="submit" name="regenerateclasssql" value="'.$langs->trans(
"RegenerateClassAndSql").
'">';
4816 print
'<br><br class="clearboth">';
4817 print
'<br class="clearboth">';
4819 $mod = strtolower($module);
4820 $obj = strtolower($tabobj);
4821 $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));
4822 $nbOfProperties = count($reflectorpropdefault[
'fields']);
4824 print_barre_liste($langs->trans(
"ObjectProperties"), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', 0, $nbOfProperties,
'', 0, $newproperty,
'margintoponly', 0, 0, 0, 1);
4827 print
'<!-- Table with properties of object -->'.
"\n";
4828 print
'<div class="div-table-responsive">';
4829 print
'<table class="noborder small">';
4830 print
'<tr class="liste_titre">';
4831 if (!empty(
$conf->main_checkbox_left_column)) {
4832 print
'<th class="tdstickyright tdstickyghostwhite"></th>';
4834 print
'<th class="tdsticky tdstickygray">';
4835 $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>';
4836 print $form->textwithpicto($langs->trans(
"Code"), $htmltext, 1,
'help',
'extracss', 0, 3,
'propertyhelp');
4839 print $form->textwithpicto($langs->trans(
"Label"), $langs->trans(
"YouCanUseTranslationKey"));
4841 print
'<th>'.$form->textwithpicto($langs->trans(
"Type"), $langs->trans(
"TypeOfFieldsHelpIntro").
'<br><br>'.$langs->trans(
"TypeOfFieldsHelp"), 1,
'help',
'extracss', 0, 3,
'typehelp').
'</th>';
4842 print
'<th>'.$form->textwithpicto($langs->trans(
"ArrayOfKeyValues"), $langs->trans(
"ArrayOfKeyValuesDesc")).
'</th>';
4843 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"NotNull"), $langs->trans(
"NotNullDesc")).
'</th>';
4844 print
'<th class="center">'.$langs->trans(
"DefaultValue").
'</th>';
4845 print
'<th class="center">'.$langs->trans(
"DatabaseIndex").
'</th>';
4846 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"ForeignKey"), $langs->trans(
"ForeignKeyDesc"), 1,
'help',
'extracss', 0, 3,
'foreignkeyhelp').
'</th>';
4847 print
'<th class="right">'.$langs->trans(
"Position").
'</th>';
4848 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"Enabled"), $langs->trans(
"EnabledDesc"), 1,
'help',
'extracss', 0, 3,
'enabledhelp').
'</th>';
4849 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"Visibility"), $langs->trans(
"VisibleDesc").
'<br><br>'.$langs->trans(
"ItCanBeAnExpression"), 1,
'help',
'extracss', 0, 3,
'visiblehelp').
'</th>';
4850 print
'<th class="center">'.$langs->trans(
"NotEditable").
'</th>';
4852 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"SearchAll"), $langs->trans(
"SearchAllDesc")).
'</th>';
4853 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"IsAMeasure"), $langs->trans(
"IsAMeasureDesc")).
'</th>';
4854 print
'<th class="center">'.$langs->trans(
"CSSClass").
'</th>';
4855 print
'<th class="center">'.$langs->trans(
"CSSViewClass").
'</th>';
4856 print
'<th class="center">'.$langs->trans(
"CSSListClass").
'</th>';
4857 print
'<th>'.$langs->trans(
"KeyForTooltip").
'</th>';
4858 print
'<th class="center">'.$langs->trans(
"ShowOnCombobox").
'</th>';
4860 print
'<th>'.$form->textwithpicto($langs->trans(
"Validate"), $langs->trans(
"ValidateModBuilderDesc")).
'</th>';
4861 print
'<th>'.$langs->trans(
"Comment").
'</th>';
4862 if (empty(
$conf->main_checkbox_left_column)) {
4863 print
'<th class="tdstickyright tdstickyghostwhite"></th>';
4870 $properties =
dol_sort_array($reflectorpropdefault[
'fields'],
'position');
4871 if (!empty($properties)) {
4873 foreach ($properties as $propkey => $propval) {
4888 $propname = $propkey;
4889 $proplabel = $propval[
'label'];
4890 $proptype = $propval[
'type'];
4891 $proparrayofkeyval = !empty($propval[
'arrayofkeyval']) ? $propval[
'arrayofkeyval'] :
'';
4892 $propnotnull = !empty($propval[
'notnull']) ? $propval[
'notnull'] :
'0';
4893 $propdefault = !empty($propval[
'default']) ? $propval[
'default'] :
'';
4894 $propindex = !empty($propval[
'index']) ? $propval[
'index'] :
'';
4895 $propforeignkey = !empty($propval[
'foreignkey']) ? $propval[
'foreignkey'] :
'';
4896 $propposition = $propval[
'position'];
4897 $propenabled = $propval[
'enabled'];
4898 $propvisible = $propval[
'visible'];
4899 $propnoteditable = !empty($propval[
'noteditable']) ? $propval[
'noteditable'] : 0;
4901 $propsearchall = !empty($propval[
'searchall']) ? $propval[
'searchall'] : 0;
4902 $propisameasure = !empty($propval[
'isameasure']) ? $propval[
'isameasure'] : 0;
4903 $propcss = !empty($propval[
'css']) ? $propval[
'css'] :
'';
4904 $propcssview = !empty($propval[
'cssview']) ? $propval[
'cssview'] :
'';
4905 $propcsslist = !empty($propval[
'csslist']) ? $propval[
'csslist'] :
'';
4906 $prophelp = !empty($propval[
'help']) ? $propval[
'help'] :
'';
4907 $propshowoncombobox = !empty($propval[
'showoncombobox']) ? $propval[
'showoncombobox'] : 0;
4909 $propvalidate = !empty($propval[
'validate']) ? $propval[
'validate'] : 0;
4910 $propcomment = !empty($propval[
'comment']) ? $propval[
'comment'] :
'';
4912 print
'<!-- line for object property -->'.
"\n";
4913 print
'<tr class="oddeven">';
4915 if (!empty(
$conf->main_checkbox_left_column)) {
4916 if ($action ==
'editproperty' && $propname == $propertykey) {
4917 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
4918 print
'<input class="reposition button smallpaddingimp" type="submit" name="edit" value="'.$langs->trans(
"Save").
'">';
4919 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
4922 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
4923 if ($propname !=
'rowid') {
4924 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>';
4925 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>';
4930 print
'<td class="tdsticky tdstickygray">';
4933 if ($action ==
'editproperty' && $propname == $propertykey) {
4935 print
'<input type="hidden" name="propname" value="'.dol_escape_htmltag($propname).
'">';
4936 print
'<input name="proplabel" class="maxwidth125" value="'.dol_escape_htmltag($proplabel).
'">';
4938 print
'<td class="tdoverflowmax150">';
4939 print
'<input name="proptype" id="proptype" class="maxwidth125" value="'.dol_escape_htmltag($proptype).
'" list="datalistproptype"></input>';
4941 print
'<datalist id="datalistproptype">';
4942 print
'<option>varchar(128)</option>';
4943 print
'<option>email</option>';
4944 print
'<option>phone</option>';
4945 print
'<option>ip</option>';
4946 print
'<option>url</option>';
4947 print
'<option>password</option>';
4948 print
'<option>text</option>';
4949 print
'<option>html</option>';
4950 print
'<option>date</option>';
4951 print
'<option>datetime</option>';
4952 print
'<option>integer</option>';
4953 print
'<option>stars(5)</option>';
4954 print
'<option>double(28,4)</option>';
4955 print
'<option>real</option>';
4956 print
'<option>integer:ClassName:RelativePath/To/ClassFile.class.php[:1[:FILTER]]</option>';
4965 print
'</datalist>';
4968 print
'<td class="tdoverflowmax200">';
4969 print
'<textarea name="proparrayofkeyval">';
4970 if (isset($proparrayofkeyval)) {
4971 if (is_array($proparrayofkeyval) || $proparrayofkeyval !=
'') {
4975 print
'</textarea>';
4978 print
'<input class="center width50" name="propnotnull" value="'.dol_escape_htmltag($propnotnull).
'">';
4981 print
'<input class="maxwidth50" name="propdefault" value="'.dol_escape_htmltag($propdefault).
'">';
4983 print
'<td class="center">';
4984 print
'<input class="center maxwidth50" name="propindex" value="'.dol_escape_htmltag($propindex).
'">';
4987 print
'<input class="center maxwidth100" name="propforeignkey" value="'.dol_escape_htmltag($propforeignkey).
'">';
4990 print
'<input class="right width50" name="propposition" value="'.dol_escape_htmltag($propposition).
'">';
4993 print
'<input class="center width75" name="propenabled" value="'.dol_escape_htmltag($propenabled).
'">';
4996 print
'<input class="center width75" name="propvisible" value="'.dol_escape_htmltag($propvisible).
'">';
4999 print
'<input class="center width50" name="propnoteditable" size="2" value="'.dol_escape_htmltag($propnoteditable).
'">';
5005 print
'<input class="center width50" name="propsearchall" value="'.dol_escape_htmltag($propsearchall).
'">';
5008 print
'<input class="center width50" name="propisameasure" value="'.dol_escape_htmltag($propisameasure).
'">';
5011 print
'<input class="center maxwidth50" name="propcss" value="'.dol_escape_htmltag($propcss).
'">';
5014 print
'<input class="center maxwidth50" name="propcssview" value="'.dol_escape_htmltag($propcssview).
'">';
5017 print
'<input class="center maxwidth50" name="propcsslist" value="'.dol_escape_htmltag($propcsslist).
'">';
5020 print
'<input class="maxwidth100" name="prophelp" value="'.dol_escape_htmltag($prophelp).
'">';
5023 print
'<input class="center maxwidth50" name="propshowoncombobox" value="'.dol_escape_htmltag($propshowoncombobox).
'">';
5026 print
'<input type="number" step="1" min="0" max="1" class="text maxwidth100" name="propvalidate" value="'.dol_escape_htmltag($propvalidate).
'">';
5029 print
'<input class="maxwidth100" name="propcomment" value="'.dol_escape_htmltag($propcomment).
'">';
5031 if (empty(
$conf->main_checkbox_left_column)) {
5032 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
5033 print
'<input class="reposition button smallpaddingimp" type="submit" name="edit" value="'.$langs->trans(
"Save").
'">';
5034 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
5038 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($proplabel).
'">';
5041 print
'<td class="tdoverflowmax200">';
5044 if (preg_match(
'/^varchar/', $proptype, $matches)) {
5045 $pictoType =
'varchar';
5046 } elseif (preg_match(
'/^integer:/', $proptype, $matches)) {
5047 $pictoType =
'link';
5048 } elseif (strpos($proptype,
'integer') === 0) {
5049 $pictoType = substr($proptype, 0, 3);
5050 } elseif (strpos($proptype,
'timestamp') === 0) {
5051 $pictoType =
'datetime';
5052 } elseif (strpos($proptype,
'real') === 0) {
5053 $pictoType =
'double';
5054 } elseif (strpos($proptype,
'stars') === 0) {
5055 $pictoType =
'stars';
5059 print
'<td class="tdoverflowmax200">';
5060 if ($proparrayofkeyval) {
5061 print
'<span title="'.dol_escape_htmltag(json_encode($proparrayofkeyval, JSON_UNESCAPED_UNICODE)).
'">';
5066 print
'<td class="center">';
5072 print
'<td class="center">';
5073 print $propindex ?
'1' :
'';
5075 print
'<td class="center">';
5078 print
'<td class="right">';
5081 print
'<td class="center tdoverflowmax100" title="'.($propnoteditable ?
dol_escape_htmltag($propnoteditable) :
'').
'">';
5085 print
'<td class="center tdoverflowmax100" title="'.($propvisible ?
dol_escape_htmltag($propvisible) :
'0').
'">';
5089 print
'<td class="center tdoverflowmax100" title="'.($propnoteditable ?
dol_escape_htmltag($propnoteditable) :
'').
'">';
5095 print
'<td class="center">';
5096 print $propsearchall ?
'1' :
'';
5098 print
'<td class="center">';
5101 print
'<td class="center tdoverflowmax100" title="'.($propcss ?
dol_escape_htmltag($propcss) :
'').
'">';
5104 print
'<td class="center tdoverflowmax100" title="'.($propcssview ?
dol_escape_htmltag($propcssview) :
'').
'">';
5107 print
'<td class="center tdoverflowmax100" title="'.($propcsslist ?
dol_escape_htmltag($propcsslist) :
'').
'">';
5111 print
'<td class="tdoverflowmax150" title="'.($prophelp ?
dol_escape_htmltag($prophelp) :
'').
'">';
5114 print
'<td class="center">';
5120 print
'<td class="center">';
5123 print
'<td class="tdoverflowmax200">';
5124 print
'<span title="'.dol_escape_htmltag($propcomment).
'">';
5128 if (empty(
$conf->main_checkbox_left_column)) {
5129 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
5130 if ($propname !=
'rowid') {
5131 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>';
5132 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>';
5140 if ($tab ==
'specifications') {
5141 if ($action !=
'editfile' || empty($file)) {
5142 print
'<span class="opacitymedium">'.$langs->trans(
"SpecDefDesc").
'</span><br>';
5147 foreach ($specs as $spec) {
5148 $pathtofile = $modulelowercase.
'/doc/'.$spec[
'relativename'];
5149 $format =
'asciidoc';
5150 if (preg_match(
'/\.md$/i', $spec[
'name'])) {
5151 $format =
'markdown';
5153 print
'<span class="fa fa-file"></span> '.$langs->trans(
"SpecificationFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
5154 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>';
5164 $content = file_get_contents($fullpathoffile);
5167 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5168 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5169 print
'<input type="hidden" name="action" value="savefile">';
5170 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
5171 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
5172 print
'<input type="hidden" name="module" value="'.$module.
'">';
5174 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
5175 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
5178 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
5180 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
5186 $langs->load(
"errors");
5187 print
'<tr><td><span class="warning">'.$langs->trans(
'ErrorModuleBuilderNoFieldProperty').
'</warning></td></tr>';
5194 $langs->load(
"errors");
5195 print
'<span class="warning">'.$langs->trans(
'ErrorModuleBuilderFailedToInit', $tabobj, (
string)
$db).
'</warning>';
5199 print $e->getMessage();
5203 if (empty($forceddirread)) {
5206 $fullpathoffile = $dirread.
'/'.$file;
5209 $content = file_get_contents($fullpathoffile);
5212 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5213 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5214 print
'<input type="hidden" name="action" value="savefile">';
5215 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
5216 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
5217 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
5218 print
'<input type="hidden" name="module" value="'.$module.($forceddirread ?
'@'.$dirread :
'').
'">';
5220 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
5221 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
5224 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
5226 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
5236 if ($tab ==
'dictionaries') {
5237 print
'<!-- tab=dictionaries -->'.
"\n";
5238 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
5242 if ($action ==
'deletedict') {
5243 $formconfirm = $form->formconfirm(
5244 $_SERVER[
"PHP_SELF"].
'?dictionnarykey='.urlencode((
string) (
GETPOSTINT(
'dictionnarykey'))).
'&tab='.urlencode((
string) ($tab)).
'&module='.urlencode((
string) ($module)),
5245 $langs->trans(
'Delete'),
5246 $langs->trans(
'Confirm Delete Dictionnary',
GETPOST(
'dictionnarykey',
'alpha')),
5247 'confirm_deletedictionary',
5255 if ($action !=
'editfile' || empty($file)) {
5256 print
'<span class="opacitymedium">';
5257 $htmlhelp = $langs->trans(
"DictionariesDefDescTooltip",
'{s1}');
5258 $htmlhelp = str_replace(
'{s1}',
'<a target="adminbis" class="nofocusvisible" href="'.DOL_URL_ROOT.
'/admin/dict.php">'.$langs->trans(
'Setup').
' - '.$langs->trans(
'Dictionaries').
'</a>', $htmlhelp);
5259 print $form->textwithpicto($langs->trans(
"DictionariesDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
5263 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
5264 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>';
5266 if (is_array($dicts) && !empty($dicts)) {
5267 print
'<span class="fa fa-file"></span> '.$langs->trans(
"LanguageFile").
' :</span> ';
5268 print
'<strong class="wordbreak">'.$dicts[
'langs'].
'</strong>';
5279 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabdic=newdictionary';
5280 $head3[$h][1] =
'<span class="valignmiddle text-plus-circle">'.$langs->trans(
"NewDictionary").
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
5281 $head3[$h][2] =
'newdictionary';
5322 $newdict = dolGetButtonTitle($langs->trans(
'NewDictionary'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/modulebuilder/index.php?tab=dictionaries&module='.urlencode($module).
'&tabdic=newdictionary');
5323 print_barre_liste($langs->trans(
"ListOfDictionariesEntries"), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', 0,
'',
'', 0, $newdict,
'', 0, 0, 0, 1);
5325 if ($tabdic !=
'newdictionary') {
5326 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5327 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5328 print
'<input type="hidden" name="action" value="addDictionary">';
5329 print
'<input type="hidden" name="tab" value="dictionaries">';
5330 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5331 print
'<input type="hidden" name="tabdic" value="'.dol_escape_htmltag($tabdic).
'">';
5333 print
'<div class="div-table-responsive">';
5334 print
'<table class="noborder">';
5336 print
'<tr class="liste_titre">';
5337 print_liste_field_titre(
"#", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'thsticky thstickygrey ');
5350 if (!empty($dicts) && is_array($dicts) && !empty($dicts[
'tabname']) && is_array($dicts[
'tabname'])) {
5352 $maxi = count($dicts[
'tabname']);
5353 while ($i < $maxi) {
5354 if ($action ==
'editdict' && $i ==
GETPOSTINT(
'dictionnarykey') - 1) {
5355 print
'<tr class="oddeven">';
5356 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5357 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5358 print
'<input type="hidden" name="tab" value="dictionaries">';
5359 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5360 print
'<input type="hidden" name="action" value="updatedictionary">';
5361 print
'<input type="hidden" name="dictionnarykey" value="'.($i + 1).
'">';
5363 print
'<td class="tdsticky tdstickygray">';
5368 print
'<input type="text" name="tabname" value="'.$dicts[
'tabname'][$i].
'" readonly class="tdstickygray">';
5372 print
'<input type="text" name="tablib" value="'.$dicts[
'tablib'][$i].
'">';
5376 print
'<input type="text" name="tabsql" value="'.$dicts[
'tabsql'][$i].
'" readonly class="tdstickygray">';
5380 print
'<select name="tabsqlsort">';
5381 print
'<option value="'.dol_escape_htmltag($dicts[
'tabsqlsort'][$i]).
'">'.$dicts[
'tabsqlsort'][$i].
'</option>';
5385 print
'<td><select name="tabfield" >';
5386 print
'<option value="'.dol_escape_htmltag($dicts[
'tabfield'][$i]).
'">'.$dicts[
'tabfield'][$i].
'</option>';
5387 print
'</select></td>';
5389 print
'<td><select name="tabfieldvalue" >';
5390 print
'<option value="'.dol_escape_htmltag($dicts[
'tabfieldvalue'][$i]).
'">'.$dicts[
'tabfieldvalue'][$i].
'</option>';
5391 print
'</select></td>';
5393 print
'<td><select name="tabfieldinsert" >';
5394 print
'<option value="'.dol_escape_htmltag($dicts[
'tabfieldinsert'][$i]).
'">'.$dicts[
'tabfieldinsert'][$i].
'</option>';
5395 print
'</select></td>';
5398 print
'<input type="text" name="tabrowid" value="'.dol_escape_htmltag($dicts[
'tabrowid'][$i]).
'" readonly class="tdstickygray">';
5402 print
'<input type="text" name="tabcond" value="'.dol_escape_htmltag((empty($dicts[
'tabcond'][$i]) ?
'disabled' :
'enabled')).
'" readonly class="tdstickygray">';
5405 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
5406 print
'<input id ="updatedict" class="reposition button smallpaddingimp" type="submit" name="updatedict" value="'.$langs->trans(
"Modify").
'"/>';
5408 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
5414 print
'<tr class="oddeven">';
5416 print
'<td class="tdsticky tdstickygray">';
5421 print $dicts[
'tabname'][$i];
5425 print $dicts[
'tablib'][$i];
5429 print $dicts[
'tabsql'][$i];
5433 print $dicts[
'tabsqlsort'][$i];
5437 print $dicts[
'tabfield'][$i];
5441 print $dicts[
'tabfieldvalue'][$i];
5445 print $dicts[
'tabfieldinsert'][$i];
5449 print $dicts[
'tabrowid'][$i];
5453 print $dicts[
'tabcond'][$i];
5456 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
5457 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>';
5458 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>';
5466 print
'<tr><td colspan="11"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
5475 if ($tabdic ==
'newdictionary') {
5477 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5478 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5479 print
'<input type="hidden" name="action" value="initdic">';
5480 print
'<input type="hidden" name="tab" value="dictionaries">';
5481 print
'<input type="hidden" name="tabdic" value="'.$tabdic.
'">';
5483 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5485 print
'<span class="opacitymedium">'.$langs->trans(
"EnterNameOfDictionaryDesc").
'</span><br><br>';
5488 print
'<table class="border centpercent">';
5490 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>';
5491 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>';
5492 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>';
5493 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>';
5494 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"FieldsView").
'</td><td><input type="text" name="field" value="'.
dol_escape_htmltag(
GETPOST(
'field',
'alpha')).
'"></td></tr>';
5495 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"FieldsEdit").
'</td><td><input type="text" name="fieldvalue" value="'.
dol_escape_htmltag(
GETPOST(
'fieldvalue',
'alpha')).
'"></td></tr>';
5496 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"FieldsInsert").
'</td><td><input type="text" name="fieldinsert" value="'.
dol_escape_htmltag(
GETPOST(
'fieldinsert',
'alpha')).
'"></td></tr>';
5497 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Rowid").
'</td><td><input type="text" name="rowid" value="'.
dol_escape_htmltag(
GETPOST(
'rowid',
'alpha')).
'"></td></tr>';
5499 print
'</tbody></table>';
5500 print
'<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans(
"GenerateCode")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
5501 print
'<input id="cancel" type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
5505 $(document).ready(function() {
5506 $("input[name=\'dicname\']").on("blur", function() {
5507 if ($(this).val().length > 0) {
5508 $("input[name=\'label\']").val($(this).val());
5509 $("input[name=\'sql\']").val("SELECT f.rowid as rowid, f.code, f.label, f.active FROM llx_c_" + $(this).val() + " as f");
5510 $("input[name=\'sqlsort\']").val("label ASC");
5511 $("input[name=\'field\']").val("code,label");
5512 $("input[name=\'fieldvalue\']").val("code,label");
5513 $("input[name=\'fieldinsert\']").val("code,label");
5514 $("input[name=\'rowid\']").val("rowid");
5516 $("input[name=\'label\']").val("");
5517 $("input[name=\'sql\']").val("");
5518 $("input[name=\'sqlsort\']").val("");
5519 $("input[name=\'field\']").val("");
5520 $("input[name=\'fieldvalue\']").val("");
5521 $("input[name=\'fieldinsert\']").val("");
5522 $("input[name=\'rowid\']").val("");
5525 $("input[id=\'cancel\']").click(function() {
5526 window.history.back();
5543 } elseif ($tabdic ==
'deletedictionary') {
5545 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5546 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5547 print
'<input type="hidden" name="action" value="confirm_deletedictionary">';
5548 print
'<input type="hidden" name="tab" value="dictionaries">';
5549 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5551 print $langs->trans(
"EnterNameOfDictionnaryToDeleteDesc").
'<br><br>';
5553 print
'<input type="text" name="dicname" value="'.dol_escape_htmltag($modulename).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"DicKey")).
'">';
5554 print
'<input type="submit" class="button smallpaddingimp" name="delete" value="'.dol_escape_htmltag($langs->trans(
"Delete")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
5562 $content = file_get_contents($fullpathoffile);
5565 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5566 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5567 print
'<input type="hidden" name="action" value="savefile">';
5568 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
5569 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
5570 print
'<input type="hidden" name="module" value="'.$module.
'">';
5572 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
5573 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
5574 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
5577 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
5579 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
5586 if ($tab ==
'menus') {
5587 print
'<!-- tab=menus -->'.
"\n";
5588 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
5589 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
5590 $destdir = $dirins.
'/'.strtolower($module);
5591 $listofobject =
dol_dir_list($destdir.
'/class',
'files', 0,
'\.class\.php$');
5594 $leftmenus = array();
5599 $crud = array(
'read' =>
'CRUDRead',
'write' =>
'CRUDCreateWrite',
'delete' =>
'Delete');
5602 $groupedRights = array();
5603 foreach ($permissions as $right) {
5605 if (!isset($groupedRights[$key])) {
5606 $groupedRights[$key] = array();
5608 $groupedRights[$key][] = $right;
5610 $groupedRights_json = json_encode($groupedRights);
5612 if ($action ==
'deletemenu') {
5613 $formconfirms = $form->formconfirm(
5614 $_SERVER[
"PHP_SELF"].
'?menukey='.urlencode((
string) (
GETPOSTINT(
'menukey'))).
'&tab='.urlencode((
string) ($tab)).
'&module='.urlencode((
string) ($module)),
5615 $langs->trans(
'Delete'),
5616 ($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'))),
5617 'confirm_deletemenu',
5622 print $formconfirms;
5624 if ($action !=
'editfile' || empty($file)) {
5625 print
'<span class="opacitymedium">';
5626 $htmlhelp = $langs->trans(
"MenusDefDescTooltip",
'{s1}');
5627 $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);
5628 print $form->textwithpicto($langs->trans(
"MenusDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
5633 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
5634 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>';
5638 $listODifferentUrlsInMenu = array();
5639 foreach ($menus as $obj) {
5640 if (preg_match(
'/^\/'.preg_quote(strtolower($module),
'/').
'\//', $obj[
'url']) && !empty($pathoffile)) {
5641 if (!empty($listODifferentUrlsInMenu[$pathoffile])) {
5644 $pathtofile = $obj[
'url'];
5645 $listODifferentUrlsInMenu[$pathoffile] = $pathtofile;
5646 print
'<span class="fa fa-file"></span> '.$langs->trans(
"PageLinkedByAMenuEntry").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
5647 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>';
5656 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5657 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5658 print
'<input type="hidden" name="action" value="addmenu">';
5659 print
'<input type="hidden" name="tab" value="menus">';
5660 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5661 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
5663 print
'<div class="div-table-responsive">';
5664 print
'<table class="noborder small">';
5666 $htmltextenabled =
'<u>'.$langs->trans(
"Examples").
':</u><br>';
5667 $htmltextenabled .=
'1 <span class="opacitymedium">(module always enabled)</span><br>';
5668 $htmltextenabled .=
'0 <span class="opacitymedium">(module always disabled)</span><br>';
5669 $htmltextenabled .=
'isModEnabled(\''.dol_escape_htmltag(strtolower($module)).
'\') <span
class=
"opacitymedium">(enabled when module is enabled)</span>
';
5670 $htmltextperms = '<u>
'.$langs->trans("Examples").':</u><br>
';
5671 $htmltextperms .= '1 <span class=
"opacitymedium">(access always allowed)</span><br>
';
5672 $htmltextperms .= '$user->hasright(\
''.
dol_escape_htmltag(strtolower($module)).
'\', \'myobject\', \'read\') <span class="opacitymedium">(access allowed if user has permission module->object->read)</span>';
5674 print
'<tr class="liste_titre">';
5675 print_liste_field_titre(
"#", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'center tdsticky tdstickygray ');
5678 print_liste_field_titre(
"LinkToParentMenu", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'minwidth100 ');
5681 print_liste_field_titre(
"URL", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'', $langs->transnoentitiesnoconv(
'DetailUrl'));
5683 print_liste_field_titre(
"Position", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'right ');
5684 print_liste_field_titre(
"Enabled", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'center ', $langs->trans(
'DetailEnabled').
'<br><br>'.$htmltextenabled);
5685 print_liste_field_titre(
"Rights", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'', $langs->trans(
'DetailRight').
'<br><br>'.$htmltextperms);
5686 print_liste_field_titre(
"Target", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'', $langs->trans(
'DetailTarget'));
5687 print_liste_field_titre(
"MenuForUsers", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'center minwidth100 ', $langs->trans(
'DetailUser'));
5688 print_liste_field_titre(
"", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'center ', $langs->trans(
''));
5691 $r = count($menus) + 1;
5694 print
'<td class="center tdsticky tdstickygray"><input type="hidden" readonly class="center maxwidth50" name="propenabled" value="#"></td>';
5695 print
'<td class="center">';
5696 print
'<select class="maxwidth50" name="type">';
5697 print
'<option value="">'.$langs->trans(
"........").
'</option><option value="'.
dol_escape_htmltag(
"left").
'">left</option><option value="'.
dol_escape_htmltag(
"top").
'">top</option>';
5698 print
'</select></td>';
5699 print
'<td class="left"><input type="text" class="left maxwidth100" name="titre" value="'.dol_escape_htmltag(
GETPOST(
'titre',
'alpha')).
'"></td>';
5700 print
'<td class="left">';
5701 print
'<select name="fk_menu">';
5702 print
'<option value="">'.$langs->trans(
"........").
'</option>';
5703 foreach ($menus as $obj) {
5704 if ($obj[
'type'] ==
'left' && !empty($obj[
'leftmenu'])) {
5705 print
"<option value=".strtolower($obj[
'leftmenu']).
">".$obj[
'leftmenu'].
"</option>";
5710 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>';
5711 print
'<td class="center"><input id="leftmenu" type="text" class="left maxwidth50" name="leftmenu" value="'.dol_escape_htmltag(
GETPOST(
'leftmenu',
'alpha')).
'"></td>';
5713 print
'<td class="left"><input id="url" type="text" class="left maxwidth100" name="url" value="'.dol_escape_htmltag(
GETPOST(
'url',
'alpha')).
'"></td>';
5714 print
'<td class="left"><input type="text" class="left maxwidth75" name="langs" value="'.strtolower($module).
'@'.strtolower($module).
'" readonly></td>';
5716 print
'<td class="center"><input type="text" class="center maxwidth50 tdstickygray" name="position" value="'.(1000 + $r).
'" readonly></td>';
5718 print
'<td class="center">';
5719 print
'<input type="enabled" class="maxwidth125" value="'.dol_escape_htmltag(GETPOSTISSET(
'enabled') ?
GETPOST(
'enabled') :
'isModEnabled(\''.$module.
'\')').
'">';
5728 print
'<td class="left">';
5729 print
'<select class="maxwidth" name="objects" id="objects">';
5730 print
'<option value=""></option>';
5731 if (is_array($objects)) {
5732 foreach ($objects as $value) {
5733 print
'<option value="'.strtolower($value).
'">'.
dol_escape_htmltag(strtolower($value)).
'</option>';
5737 print
'<select class="maxwidth hideobject" name="perms" id="perms">';
5740 print
'<td class="center"><input type="text" class="center maxwidth50" name="target" value="'.dol_escape_htmltag(
GETPOST(
'target',
'alpha')).
'"></td>';
5741 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>';
5743 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
5744 print
'<input type="submit" class="button" name="add" value="'.$langs->trans(
"Add").
'">';
5752 if (count($menus)) {
5754 foreach ($menus as $menu) {
5758 $value = substr($string, strpos($string,
'fk_leftmenu=') + strlen(
'fk_leftmenu='));
5760 $propFk_menu = !empty($menu[
'fk_menu']) ? $menu[
'fk_menu'] :
GETPOST(
'fk_menu');
5761 $propTitre = !empty($menu[
'titre']) ? $menu[
'titre'] :
GETPOST(
'titre');
5762 $propMainmenu = !empty($menu[
'mainmenu']) ? $menu[
'mainmenu'] :
GETPOST(
'mainmenu');
5763 $propLeftmenu = !empty($menu[
'leftmenu']) ? $menu[
'leftmenu'] :
GETPOST(
'leftmenu');
5764 $propUrl = !empty($menu[
'url']) ? $menu[
'url'] :
GETPOST(
'url',
'alpha');
5765 $propPerms = !empty($menu[
'perms']) ? $menu[
'perms'] :
GETPOST(
'perms');
5766 $propUser = !empty($menu[
'user']) ? $menu[
'user'] :
GETPOST(
'user');
5767 $propTarget = !empty($menu[
'target']) ? $menu[
'target'] :
GETPOST(
'target');
5768 $propEnabled = !empty($menu[
'enabled']) ? $menu[
'enabled'] :
GETPOST(
'enabled');
5770 $objPerms = (empty($arguments[1]) ?
'' : trim($arguments[1]));
5771 $valPerms = (empty($arguments[2]) ?
'' : trim($arguments[2]));
5775 if ($action ==
'editmenu' &&
GETPOSTINT(
'menukey') == $i) {
5777 print
'<tr class="oddeven">';
5778 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5779 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5780 print
'<input type="hidden" name="action" value="update_menu">';
5781 print
'<input type="hidden" name="tab" value="menus">';
5782 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5783 print
'<input type="hidden" name="menukey" value="'.$i.
'"/>';
5785 print
'<td class="tdsticky tdstickygray">';
5789 print
'<td class="center">
5790 <select class="center maxwidth50" name="type">
5791 <option value="'.dol_escape_htmltag($menu[
'type']).
'">
5794 print
'<option value="'.($menu[
'type'] ==
'left' ?
'top' :
'left').
'">';
5795 if ($menu[
'type'] ==
'left') {
5800 print
'</option></select></td>';
5802 print
'<td><input type="text" class="left maxwidth100" name="titre" value="'.dol_escape_htmltag($propTitre).
'"></td>';
5813 print
'<input type="text" name="fk_menu" class="maxwidth150" value="'.dol_escape_htmltag($propFk_menu).
'">';
5815 print
'<td><input type="text" class="left maxwidth50" name="mainmenu" value="'.dol_escape_htmltag($propMainmenu).
'" readonly></td>';
5816 print
'<td><input type="text" class="left maxwidth50" name="leftmenu" value="'.dol_escape_htmltag($propLeftmenu).
'" readonly></td>';
5818 print
'<td><input type="text" class="left maxwidth250" name="url" value="'.dol_escape_htmltag($propUrl).
'"></td>';
5819 print
'<td><input type="text" class="left maxwidth50" name="langs" value="'.strtolower($module).
'@'.strtolower($module).
'" readonly></td>';
5821 print
'<td class="center"><input type="text" class="center maxwidth50 tdstickygray" name="position" value="'.($menu[
'position']).
'" readonly></td>';
5823 print
'<td class="nowraponall">';
5824 print
'<input type="text" class="maxwidth125" name="enabled" value="'.dol_escape_htmltag($propEnabled !=
'' ? $propEnabled :
"isModEnabled('".
dol_escape_htmltag($module).
"')").
'">';
5825 $htmltext =
'<u>'.$langs->trans(
"Examples").
':</u><br>';
5826 $htmltext .=
'1 <span class="opacitymedium">(always enabled)</span><br>';
5827 $htmltext .=
'0 <span class="opacitymedium">(always disabled)</span><br>';
5828 $htmltext .=
'isModEnabled(\''.dol_escape_htmltag($module).
'\') <span
class=
"opacitymedium">(enabled when module is enabled)</span><br>
';
5829 print $form->textwithpicto('', $htmltext);
5831 print '<select
class=
"maxwidth50" name=
"enabledselect">
';
5832 print '<option value=
"1">1 (always enabled)</option>
';
5833 print '<option value=
"0">0 (always
disabled)</option>
';
5839 print '<td
class=
"nowraponall">
';
5840 print '<input
type=
"text" name=
"perms" value=
"'.dol_escape_htmltag($propPerms).'">
';
5842 if (!empty($objPerms)) {
5843 print '<input
type=
"hidden" name=
"objects" value=
"'.$objPerms.'" />
';
5844 print '<select
class=
"center maxwidth50" name=
"perms">
';
5845 if (!empty($valPerms)) {
5846 print '<option selected value=
"'.dol_escape_htmltag($valPerms).'">
'.dol_escape_htmltag($langs->trans($crud[$valPerms])).'</option>
';
5847 foreach ($crud as $key => $val) {
5848 if ($valPerms != $key) {
5849 print '<option value=
"'.dol_escape_htmltag($key).'">
'.dol_escape_htmltag($langs->trans($val)).'</option>
';
5855 print '<select
class=
"center maxwidth50" name=
"objects">
';
5856 print '<option></option>
';
5857 foreach ($objects as $obj) {
5858 print '<option value=
"'.dol_escape_htmltag(strtolower($obj)).'">
'.dol_escape_htmltag($obj).'</option>
';
5861 print '<select
class=
"center maxwidth50" name=
"perms">
';
5862 foreach ($crud as $key => $val) {
5863 print '<option value=
"'.dol_escape_htmltag($key).'">
'.dol_escape_htmltag($key).'</option>
';
5869 print '<td
class=
"center"><input
type=
"text" class=
"center maxwidth50" name=
"target" value=
"'.dol_escape_htmltag($propTarget).'"></td>
';
5870 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>
';
5871 print '<td
class=
"center minwidth75 tdstickyright tdstickyghostwhite maxwidth75">
';
5872 print '<input
class=
"reposition button smallpaddingimp" type=
"submit" name=
"edit" value=
"'.$langs->trans("Modify
").'">
';
5873 print '<input
class=
"reposition button button-cancel smallpaddingimp" type=
"submit" name=
"cancel" value=
"'.$langs->trans("Cancel
").'">
';
5878 print '<tr
class=
"oddeven">
';
5880 print '<td
class=
"tdsticky tdstickygray">
';
5884 print '<td
class=
"center">
';
5885 print dol_escape_htmltag($menu['type']);
5890 print dol_escape_htmltag($menu['titre
']);
5894 print '<td
class=
"tdoverflowmax100" title=
"'.dol_escape_htmltag($menu['fk_menu']).'">
';
5895 print dol_escape_htmltag($menu['fk_menu
']);
5899 print dol_escape_htmltag($menu['mainmenu
']);
5903 print dol_escape_htmltag($menu['leftmenu
']);
5906 print '<td
class=
"tdoverflowmax250" title=
"'.dol_escape_htmltag($menu['url']).'">
';
5907 print dol_escape_htmltag($menu['url
']);
5911 print dol_escape_htmltag($menu['langs
']);
5915 print '<td
class=
"center">
';
5916 print dol_escape_htmltag((string) $menu['position']);
5920 print '<td
class=
"tdoverflowmax200" title=
"'.dol_escape_htmltag($menu['enabled']).'">
';
5921 print dol_escape_htmltag($menu['enabled
']);
5925 print '<td
class=
"tdoverflowmax200" title=
"'.dol_escape_htmltag($menu['perms']).'">
';
5926 print dol_escape_htmltag($langs->trans($menu['perms
']));
5930 print '<td
class=
"center tdoverflowmax200" title=
"'.dol_escape_htmltag($menu['target']).'">
';
5931 print dol_escape_htmltag($menu['target
']);
5934 print '<td
class=
"center">
';
5935 if ($menu['user'] == 2) {
5936 print $langs->trans("AllMenus");
5937 } elseif ($menu['user'] == 0) {
5938 print $langs->trans('Internal
');
5939 } elseif ($menu['user'] == 1) {
5940 print $langs->trans('External
');
5942 print $menu['user']; // should not happen
5945 print '<td
class=
"center minwidth75 tdstickyright tdstickyghostwhite">
';
5946 if ($menu['titre
'] != 'Module
'.$module.'Name
') {
5947 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>
';
5948 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>
';
5955 print '<tr><td colspan=
"14"><span
class=
"opacitymedium">
'.$langs->trans("None").'</span></td></tr>
';
5964 $(document).ready(
function() {
5966 $(
"#leftmenu").on(
"input",
function() {
5967 var inputLeftMenu = $(
"#leftmenu").val();
5968 if (inputLeftMenu !== \
'\') {
5969 var url = \
''.dol_escape_js(strtolower($module)).
'\' + inputLeftMenu + \
'.php\';
5976 var groupedRights = ' . $groupedRights_json .
';
5977 var objectsSelect = $("select[id=\'objects\']");
5978 var permsSelect = $("select[id=\'perms\']");
5980 objectsSelect.change(function() {
5981 var selectedObject = $(this).val();
5983 permsSelect.empty();
5985 var rights = groupedRights[selectedObject];
5988 for (var i = 0; i < rights.length; i++) {
5989 var right = rights[i];
5990 var option = $("<option></option>").attr("value", right[5]).text(right[5]);
5991 permsSelect.append(option);
5994 var option = $("<option></option>").attr("value", "read").text("read");
5995 permsSelect.append(option);
5998 if (selectedObject !== "" && selectedObject !== null && rights) {
6003 if (objectsSelect.val() === "" || objectsSelect.val() === null) {
6014 $content = file_get_contents($fullpathoffile);
6017 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6018 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6019 print
'<input type="hidden" name="action" value="savefile">';
6020 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6021 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6022 print
'<input type="hidden" name="module" value="'.$module.
'">';
6024 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
6025 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
6026 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6029 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6031 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6038 if ($tab ==
'permissions') {
6039 print
'<!-- tab=permissions -->'.
"\n";
6040 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
6045 $dir = $dirread.
'/'.$modulelowercase.
'/class';
6046 $listofobject =
dol_dir_list($dir,
'files', 0,
'\.class\.php$');
6047 $objects = array(
'myobject');
6049 foreach ($listofobject as $fileobj) {
6050 $tmpcontent = file_get_contents($fileobj[
'fullname']);
6051 if (preg_match(
'/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) {
6052 $objects[$fileobj[
'fullname']] = $reg[1];
6057 $crud = array(
'read' =>
'CRUDRead',
'write' =>
'CRUDCreateWrite',
'delete' =>
'Delete');
6058 $labels = array(
"Read objects of ".$module,
"Create/Update objects of ".$module,
"Delete objects of ".$module);
6060 $action =
GETPOST(
'action',
'alpha');
6062 if ($action ==
'deleteright') {
6063 $formconfirm = $form->formconfirm(
6064 $_SERVER[
"PHP_SELF"].
'?permskey='.urlencode((
string) (
GETPOSTINT(
'permskey'))).
'&tab='.urlencode((
string) ($tab)).
'&module='.urlencode((
string) ($module)).
'&tabobj='.urlencode((
string) ($tabobj)),
6065 $langs->trans(
'Delete'),
6066 $langs->trans(
'Confirm Delete Right',
GETPOST(
'permskey',
'alpha')),
6067 'confirm_deleteright',
6075 if ($action !=
'editfile' || empty($file)) {
6076 print
'<!-- Tab to manage permissions -->'.
"\n";
6077 print
'<span class="opacitymedium">';
6078 $htmlhelp = $langs->trans(
"PermissionsDefDescTooltip");
6081 print $form->textwithpicto($langs->trans(
"PermissionsDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
6085 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6086 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>';
6092 print
'<!-- form to add permissions -->'.
"\n";
6093 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6094 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6095 print
'<input type="hidden" name="action" value="addright">';
6096 print
'<input type="hidden" name="tab" value="permissions">';
6097 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
6098 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
6100 print
'<div class="div-table-responsive">';
6101 print
'<table class="noborder">';
6103 print
'<tr class="liste_titre">';
6105 print_liste_field_titre(
"Object", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
"center");
6112 print
'<tr class="small">';
6113 print
'<td><input type="hidden" readonly name="id" class="width75" value="0"></td>';
6115 print
'<td><select class="minwidth100" name="permissionObj" id="permissionObj">';
6116 print
'<option value=""></option>';
6117 foreach ($objects as $obj) {
6118 if ($obj !=
'myobject') {
6119 print
'<option value="'.$obj.
'">'.$obj.
'</option>';
6122 print
'</select></td>';
6124 print
'<td><select class="maxwidth75" name="crud" id="crud">';
6125 print
'<option value=""></option>';
6126 foreach ($crud as $key => $val) {
6127 print
'<option value="'.$key.
'">'.$langs->trans($val).
'</option>';
6132 print
'<input type="text" name="label" id="label" class="minwidth200">';
6135 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
6136 print
'<input type="submit" class="button" name="add" value="'.$langs->trans(
"Add").
'">';
6140 if (count($perms)) {
6142 foreach ($perms as $perm) {
6146 if ($action ==
'edit_right' && $perm[0] ==
GETPOSTINT(
'permskey')) {
6147 print
'<tr class="oddeven">';
6148 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="modifPerms">';
6149 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6150 print
'<input type="hidden" name="tab" value="permissions">';
6151 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
6152 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
6153 print
'<input type="hidden" name="action" value="update_right">';
6154 print
'<input type="hidden" name="counter" value="'.$i.
'">';
6156 print
'<input type="hidden" name="permskey" value="'.$perm[0].
'">';
6158 print
'<td class="tdsticky tdstickygray">';
6159 print
'<input class="width75" type="text" readonly value="'.dol_escape_htmltag($perm[0]).
'"/>';
6163 print
'<select name="crud">';
6164 print
'<option value="'.dol_escape_htmltag($perm[5]).
'">'.$langs->trans($perm[5]).
'</option>';
6165 foreach ($crud as $i => $x) {
6166 if ($perm[5] != $i) {
6167 print
'<option value="'.$i.
'">'.$langs->trans(ucfirst($x)).
'</option>';
6173 print
'<td><select name="permissionObj" >';
6174 print
'<option value="'.dol_escape_htmltag($perm[4]).
'">'.ucfirst($perm[4]).
'</option>';
6175 print
'</select></td>';
6178 print
'<input type="text" name="label" value="'.dol_escape_htmltag($perm[1]).
'">';
6181 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
6182 print
'<input id ="modifyPerm" class="reposition button smallpaddingimp" type="submit" name="modifyright" value="'.$langs->trans(
"Modify").
'"/>';
6184 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
6191 print
'<tr class="oddeven">';
6198 if (in_array($perm[5], array(
'lire',
'read',
'creer',
'write',
'effacer',
'delete'))) {
6206 if (in_array($perm[5], array(
'lire',
'read',
'creer',
'write',
'effacer',
'delete'))) {
6207 print ucfirst($langs->trans($perm[5]));
6209 print ucfirst($langs->trans($perm[4]));
6214 print $langs->trans($perm[1]);
6217 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
6218 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>';
6219 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>';
6227 print
'<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
6235 function updateInputField() {
6236 value1 = $("#crud").val();
6237 value2 = $("#permissionObj").val();
6239 // Vérifie si les deux sélections sont faites
6240 if (value1 && value2) {
6241 switch(value1.toLowerCase()){
6243 $("#label").val("Read "+value2+" object of '.ucfirst($module).
'")
6246 $("#label").val("Create/Update "+value2+" object of '.ucfirst($module).
'")
6249 $("#label").val("Delete "+value2+" object of '.ucfirst($module).
'")
6257 $("#crud, #permissionObj").change(function(){
6258 console.log("We change selection");
6266 $content = file_get_contents($fullpathoffile);
6269 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6270 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6271 print
'<input type="hidden" name="action" value="savefile">';
6272 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6273 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6274 print
'<input type="hidden" name="module" value="'.$module.
'">';
6276 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
6277 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
6278 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6281 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6283 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6290 if ($tab ==
'hooks') {
6291 print
'<!-- tab=hooks -->'.
"\n";
6292 if ($action !=
'editfile' || empty($file)) {
6293 print
'<span class="opacitymedium">'.$langs->trans(
"HooksDefDesc").
'</span><br>';
6298 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
6300 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6302 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>';
6306 $pathtohook = strtolower($module).
'/class/actions_'.strtolower($module).
'.class.php';
6307 print
'<span class="fa fa-file"></span> '.$langs->trans(
"HooksFile").
' : ';
6309 print
'<strong class="wordbreak">'.$pathtohook.
'</strong>';
6311 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> ';
6312 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>';
6314 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6315 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>';
6322 $content = file_get_contents($fullpathoffile);
6325 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6326 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6327 print
'<input type="hidden" name="action" value="savefile">';
6328 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6329 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6330 print
'<input type="hidden" name="module" value="'.$module.
'">';
6332 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
6333 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
6334 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6337 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6339 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6346 if ($tab ==
'triggers') {
6347 print
'<!-- tab=triggers -->'.
"\n";
6348 require_once DOL_DOCUMENT_ROOT.
'/core/class/interfaces.class.php';
6351 $triggers = $interfaces->getTriggersList(array(
'/'.strtolower($module).
'/core/triggers'));
6353 if ($action !=
'editfile' || empty($file)) {
6354 print
'<span class="opacitymedium">'.$langs->trans(
"TriggerDefDesc").
'</span><br>';
6359 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
6361 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6363 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>';
6366 if (!empty($triggers)) {
6367 foreach ($triggers as $trigger) {
6368 $pathtofile = $trigger[
'relpath'];
6371 print
'<span class="fa fa-file"></span> '.$langs->trans(
"TriggersFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6372 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>';
6373 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>';
6378 print
'<span class="fa fa-file"></span> '.$langs->trans(
"TriggersFile");
6379 print
' : <span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6380 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>';
6389 $content = file_get_contents($fullpathoffile);
6392 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6393 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6394 print
'<input type="hidden" name="action" value="savefile">';
6395 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6396 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6397 print
'<input type="hidden" name="module" value="'.$module.
'">';
6399 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
6400 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
6401 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6404 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6406 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6413 if ($tab ==
'css') {
6414 print
'<!-- tab=css -->'.
"\n";
6415 if ($action !=
'editfile' || empty($file)) {
6416 print
'<span class="opacitymedium">'.$langs->trans(
"CSSDesc").
'</span><br>';
6422 $pathtohook = strtolower($module).
'/css/'.strtolower($module).
'.css.php';
6423 print
'<span class="fa fa-file"></span> '.$langs->trans(
"CSSFile").
' : ';
6425 print
'<strong class="wordbreak">'.$pathtohook.
'</strong>';
6426 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>';
6427 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>';
6429 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6430 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>';
6436 $content = file_get_contents($fullpathoffile);
6439 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6440 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6441 print
'<input type="hidden" name="action" value="savefile">';
6442 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6443 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6444 print
'<input type="hidden" name="module" value="'.$module.
'">';
6446 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6447 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6450 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6452 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6460 print
'<!-- tab=js -->'.
"\n";
6461 if ($action !=
'editfile' || empty($file)) {
6462 print
'<span class="opacitymedium">'.$langs->trans(
"JSDesc").
'</span><br>';
6468 $pathtohook = strtolower($module).
'/js/'.strtolower($module).
'.js.php';
6469 print
'<span class="fa fa-file"></span> '.$langs->trans(
"JSFile").
' : ';
6471 print
'<strong class="wordbreak">'.$pathtohook.
'</strong>';
6472 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>';
6473 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>';
6475 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6476 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>';
6482 $content = file_get_contents($fullpathoffile);
6485 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6486 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6487 print
'<input type="hidden" name="action" value="savefile">';
6488 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6489 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6490 print
'<input type="hidden" name="module" value="'.$module.
'">';
6492 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6493 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6496 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6498 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6505 if ($tab ==
'widgets') {
6506 print
'<!-- tab=widgets -->'.
"\n";
6507 require_once DOL_DOCUMENT_ROOT.
'/core/boxes/modules_boxes.php';
6511 if ($action !=
'editfile' || empty($file)) {
6512 print
'<span class="opacitymedium">'.$langs->trans(
"WidgetDesc").
'</span><br>';
6516 if (!empty($widgets)) {
6517 foreach ($widgets as $widget) {
6518 $pathtofile = $widget[
'relpath'];
6520 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"WidgetFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6521 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>';
6522 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>';
6526 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"WidgetFile").
' : <span class="opacitymedium">'.$langs->trans(
"NoWidget").
'</span>';
6527 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>';
6534 $content = file_get_contents($fullpathoffile);
6537 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6538 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6539 print
'<input type="hidden" name="action" value="savefile">';
6540 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6541 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6542 print
'<input type="hidden" name="module" value="'.$module.
'">';
6544 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6545 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6548 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6550 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6557 if ($tab ==
'emailings') {
6558 print
'<!-- tab=emailings -->'.
"\n";
6559 require_once DOL_DOCUMENT_ROOT.
'/core/modules/mailings/modules_mailings.php';
6563 if ($action !=
'editfile' || empty($file)) {
6564 print
'<span class="opacitymedium">'.$langs->trans(
"EmailingSelectorDesc").
'</span><br>';
6568 if (!empty($emailingselectors)) {
6569 foreach ($emailingselectors as $emailingselector) {
6570 $pathtofile = $emailingselector[
'relpath'];
6572 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"EmailingSelectorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6573 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>';
6574 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>';
6578 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"EmailingSelectorFile").
' : <span class="opacitymedium">'.$langs->trans(
"NoEmailingSelector").
'</span>';
6579 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>';
6586 $content = file_get_contents($fullpathoffile);
6589 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6590 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6591 print
'<input type="hidden" name="action" value="savefile">';
6592 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6593 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6594 print
'<input type="hidden" name="module" value="'.$module.
'">';
6596 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6597 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6600 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6602 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6609 if ($tab ==
'exportimport') {
6610 print
'<!-- tab=exportimport -->'.
"\n";
6611 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
6616 if ($action !=
'editfile' || empty($file)) {
6617 print
'<span class="opacitymedium">'.$langs->transnoentities(
'ImportExportProfiles').
'</span><br>';
6620 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' ('.$langs->trans(
"ExportsArea").
') : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6621 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>';
6623 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' ('.$langs->trans(
"ImportArea").
') : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6624 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>';
6629 $content = file_get_contents($fullpathoffile);
6632 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6633 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6634 print
'<input type="hidden" name="action" value="savefile">';
6635 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6636 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6637 print
'<input type="hidden" name="module" value="'.$module.
'">';
6639 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
6640 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
6641 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6644 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6646 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6653 if ($tab ==
'cli') {
6654 print
'<!-- tab=cli -->'.
"\n";
6655 $clifiles = array();
6658 $dircli = array(
'/'.strtolower($module).
'/scripts');
6660 foreach ($dircli as $reldir) {
6665 if (!is_dir($newdir)) {
6669 $handle = opendir($newdir);
6671 if (is_resource($handle)) {
6672 while (($tmpfile = readdir($handle)) !==
false) {
6673 if (is_readable($newdir.
'/'.$tmpfile) && preg_match(
'/^(.+)\.php/', $tmpfile, $reg)) {
6674 if (preg_match(
'/\.back$/', $tmpfile)) {
6678 $clifiles[$i][
'relpath'] = preg_replace(
'/^\//',
'', $reldir).
'/'.$tmpfile;
6687 if ($action !=
'editfile' || empty($file)) {
6688 print
'<span class="opacitymedium">'.$langs->trans(
"CLIDesc").
'</span><br>';
6692 if (!empty($clifiles)) {
6693 foreach ($clifiles as $clifile) {
6694 $pathtofile = $clifile[
'relpath'];
6696 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"CLIFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6697 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>';
6698 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>';
6702 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"CLIFile").
' : <span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6703 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>';
6710 $content = file_get_contents($fullpathoffile);
6713 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6714 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6715 print
'<input type="hidden" name="action" value="savefile">';
6716 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6717 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6718 print
'<input type="hidden" name="module" value="'.$module.
'">';
6720 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6721 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6724 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6726 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6733 if ($tab ==
'cron') {
6734 print
'<!-- tab=cron -->'.
"\n";
6735 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
6739 if ($action !=
'editfile' || empty($file)) {
6740 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>';
6743 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6744 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>';
6750 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6751 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6752 print
'<input type="hidden" name="action" value="addproperty">';
6753 print
'<input type="hidden" name="tab" value="objects">';
6754 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
6755 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
6757 print
'<div class="div-table-responsive">';
6758 print
'<table class="noborder">';
6760 print
'<tr class="liste_titre">';
6768 if (count($cronjobs)) {
6769 foreach ($cronjobs as $cron) {
6770 print
'<tr class="oddeven">';
6773 print $cron[
'label'];
6778 if ($cron[
'jobtype'] ==
'method') {
6779 $text = $langs->trans(
"CronClass");
6780 $texttoshow = $langs->trans(
'CronModule').
': '.$module.
'<br>';
6781 $texttoshow .= $langs->trans(
'CronClass').
': '.$cron[
'class'].
'<br>';
6782 $texttoshow .= $langs->trans(
'CronObject').
': '.$cron[
'objectname'].
'<br>';
6783 $texttoshow .= $langs->trans(
'CronMethod').
': '.$cron[
'method'];
6784 $texttoshow .=
'<br>'.$langs->trans(
'CronArgs').
': '.$cron[
'parameters'];
6785 $texttoshow .=
'<br>'.$langs->trans(
'Comment').
': '.$langs->trans($cron[
'comment']);
6786 } elseif ($cron[
'jobtype'] ==
'command') {
6787 $text = $langs->trans(
'CronCommand');
6788 $texttoshow = $langs->trans(
'CronCommand').
': '.
dol_trunc($cron[
'command']);
6789 $texttoshow .=
'<br>'.$langs->trans(
'CronArgs').
': '.$cron[
'parameters'];
6790 $texttoshow .=
'<br>'.$langs->trans(
'Comment').
': '.$langs->trans($cron[
'comment']);
6792 print $form->textwithpicto($text, $texttoshow, 1);
6796 if ($cron[
'unitfrequency'] ==
"60") {
6797 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Minutes');
6799 if ($cron[
'unitfrequency'] ==
"3600") {
6800 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Hours');
6802 if ($cron[
'unitfrequency'] ==
"86400") {
6803 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Days');
6805 if ($cron[
'unitfrequency'] ==
"604800") {
6806 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Weeks');
6811 print $cron[
'status'];
6815 if (!empty($cron[
'comment'])) {
6816 print $cron[
'comment'];
6823 print
'<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
6833 $content = file_get_contents($fullpathoffile);
6836 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6837 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6838 print
'<input type="hidden" name="action" value="savefile">';
6839 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6840 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6841 print
'<input type="hidden" name="module" value="'.$module.
'">';
6843 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
6844 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
6845 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6848 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6850 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6857 if ($tab ==
'specifications') {
6858 print
'<!-- tab=specifications -->'.
"\n";
6861 if ($action !=
'editfile' || empty($file)) {
6862 print
'<span class="opacitymedium">'.$langs->trans(
"SpecDefDesc").
'</span><br>';
6866 if (is_array($specs) && !empty($specs)) {
6867 foreach ($specs as $spec) {
6868 $pathtofile = $modulelowercase.
'/doc/'.$spec[
'relativename'];
6869 $format =
'asciidoc';
6870 if (preg_match(
'/\.md$/i', $spec[
'name'])) {
6871 $format =
'markdown';
6874 print
'<span class="fa fa-file"></span> '.$langs->trans(
"SpecificationFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6875 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>';
6876 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>';
6881 print
'<span class="fa fa-file"></span> '.$langs->trans(
"SpecificationFile").
' : <span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6882 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>';
6893 $content = file_get_contents($fullpathoffile);
6896 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6897 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6898 print
'<input type="hidden" name="action" value="savefile">';
6899 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6900 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6901 print
'<input type="hidden" name="module" value="'.$module.
'">';
6903 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6904 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6907 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6909 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6915 print
'<br><br><br>';
6917 $FILENAMEDOC = $modulelowercase.
'.html';
6918 $FILENAMEDOCPDF = $modulelowercase.
'.pdf';
6919 $outputfiledoc =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOC;
6920 $outputfiledocurl =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOC;
6921 $outputfiledocrel = $modulelowercase.
'/doc/'.$FILENAMEDOC;
6922 $outputfiledocpdf =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOCPDF;
6923 $outputfiledocurlpdf =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOCPDF;
6924 $outputfiledocrelpdf = $modulelowercase.
'/doc/'.$FILENAMEDOCPDF;
6927 print
'<span class="fa fa-file"></span> '.$langs->trans(
"PathToModuleDocumentation",
"HTML").
' : ';
6929 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6932 print
'<a href="'.$outputfiledocurl.
'" target="_blank" rel="noopener noreferrer">';
6933 print $outputfiledoc;
6936 print
' <span class="opacitymedium">('.$langs->trans(
"GeneratedOn").
' '.
dol_print_date(
dol_filemtime($outputfiledoc),
'dayhour').
')</span>';
6937 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>';
6939 print
'</strong><br>';
6942 print
'<span class="fa fa-file"></span> '.$langs->trans(
"PathToModuleDocumentation",
"PDF").
' : ';
6944 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6947 print
'<a href="'.$outputfiledocurlpdf.
'" target="_blank" rel="noopener noreferrer">';
6948 print $outputfiledocpdf;
6951 print
' <span class="opacitymedium">('.$langs->trans(
"GeneratedOn").
' '.
dol_print_date(
dol_filemtime($outputfiledocpdf),
'dayhour').
')</span>';
6952 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>';
6954 print
'</strong><br>';
6958 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="generatedoc">';
6959 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6960 print
'<input type="hidden" name="action" value="generatedoc">';
6961 print
'<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).
'">';
6962 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
6963 print
'<input type="submit" class="button" name="generatedoc" value="'.$langs->trans(
"BuildDocumentation").
'"';
6964 if (!is_array($specs) || empty($specs)) {
6965 print
' disabled="disabled"';
6971 if ($tab ==
'buildpackage') {
6972 print
'<!-- tab=buildpackage -->'.
"\n";
6973 print
'<span class="opacitymedium">'.$langs->trans(
"BuildPackageDesc").
'</span>';
6976 if (!class_exists(
'ZipArchive') && !defined(
'ODTPHP_PATHTOPCLZIP')) {
6977 print
img_warning().
' '.$langs->trans(
"ErrNoZipEngine");
6981 $modulelowercase = strtolower($module);
6987 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
6989 $class =
'mod'.$module;
6991 if (class_exists($class)) {
6994 '@phan-var-force DolibarrModules $moduleobj';
7003 $langs->load(
"errors");
7004 dol_print_error(
$db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
7008 $outputfilezip =
null;
7009 $arrayversion = explode(
'.',
$moduleobj->version, 3);
7010 if (count($arrayversion)) {
7011 $FILENAMEZIP =
"module_".$modulelowercase.
'-'.$arrayversion[0].(empty($arrayversion[1]) ?
'.0' :
'.'.$arrayversion[1]).(empty($arrayversion[2]) ?
'' :
".".$arrayversion[2]).
".zip";
7012 $outputfilezip =
dol_buildpath($modulelowercase, 0).
'/bin/'.$FILENAMEZIP;
7017 print
'<span class="fa fa-file"></span> '.$langs->trans(
"PathToModulePackage").
' : ';
7018 if ($outputfilezip ===
null || !
dol_is_file($outputfilezip)) {
7019 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
7021 $relativepath = $modulelowercase.
'/bin/'.$FILENAMEZIP;
7022 print
'<strong><a href="'.DOL_URL_ROOT.
'/document.php?modulepart=packages&file='.urlencode($relativepath).
'">'.$outputfilezip.
'</a></strong>';
7023 print
' <span class="opacitymedium">('.$langs->trans(
"GeneratedOn").
' '.
dol_print_date(
dol_filemtime($outputfilezip),
'dayhour').
')</span>';
7024 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>';
7032 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="generatepackage">';
7033 print
'<input type="hidden" name="token" value="'.newToken().
'">';
7034 print
'<input type="hidden" name="action" value="generatepackage">';
7035 print
'<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).
'">';
7036 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
7037 print
'<input type="submit" class="button" name="generatepackage" value="'.$langs->trans(
"BuildPackage").
'">';
7041 if ($tab ==
'tabs') {
7042 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
7046 if ($action !=
'editfile' || empty($file)) {
7047 print
'<span class="opacitymedium">';
7048 $htmlhelp = $langs->trans(
"TabsDefDescTooltip",
'{s1}');
7049 $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);
7050 print $form->textwithpicto($langs->trans(
"TabsDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
7054 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong>'.$pathtofile.
'</strong>';
7055 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>';
7061 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
7062 print
'<input type="hidden" name="token" value="'.newToken().
'">';
7063 print
'<input type="hidden" name="action" value="addproperty">';
7064 print
'<input type="hidden" name="tab" value="objects">';
7065 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
7066 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
7068 print
'<div class="div-table-responsive">';
7069 print
'<table class="noborder small">';
7071 print
'<tr class="liste_titre">';
7081 foreach ($tabs as $tab) {
7082 $parts = explode(
':', $tab[
'data']);
7084 $objectType = $parts[0];
7085 $tabName = $parts[1];
7086 $tabTitle = isset($parts[2]) ? $parts[2] :
'';
7087 $langFile = isset($parts[3]) ? $parts[3] :
'';
7088 $condition = isset($parts[4]) ? $parts[4] :
'';
7089 $path = isset($parts[5]) ? $parts[5] :
'';
7093 if ($tabName[0] ===
'-') {
7095 $condition = isset($parts[2]) ? $parts[2] :
'';
7098 print
'<tr class="oddeven">';
7105 if ($tabName[0] ===
"+") {
7106 print
'<span class="badge badge-status4 badge-status">' .
dol_escape_htmltag($tabName) .
'</span>';
7108 print
'<span class="badge badge-status8 badge-status">' .
dol_escape_htmltag($tabName) .
'</span>';
7131 print
'<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
7141 $content = file_get_contents($fullpathoffile);
7144 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
7145 print
'<input type="hidden" name="token" value="'.newToken().
'">';
7146 print
'<input type="hidden" name="action" value="savefile">';
7147 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
7148 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
7149 print
'<input type="hidden" name="module" value="'.$module.
'">';
7151 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
7152 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
7153 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
7156 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
7158 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
7165 if ($tab !=
'description') {
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage a WYSIWYG editor.
Class to manage triggers.
static getEmailingSelectorsList($forcedir=null)
Return list of widget.
static getWidgetsList($forcedirwidget=null)
Return list of widget.
Immutable value object holding all case variants of a module/object pair.
Strict implementation — reports any residual myobject/mymodule token as a warning.
Class to manage utility methods.
removePatternFromFile(string $filePath, string $pattern)
Removes content from a file that matches a given pattern.
dol_filemtime($pathoffile)
Return time of a file.
dol_copy($srcfile, $destfile, $newmask='0', $overwriteifexists=1, $testvirus=0, $indexdatabase=0)
Copy a file to another file.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_delete_dir($dir, $nophperrors=0)
Remove a directory (not recursive, so content must be empty).
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayreplacement=null, $excludesubdir=0, $excludefileext=null, $excludearchivefiles=0)
Copy a dir to another dir.
dol_is_file($pathoffile)
Return if path is a file.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_is_dir($folder)
Test if filename is a directory.
dolReplaceInFile($srcfile, $arrayreplacement, $destfile='', $newmask='0', $indexdatabase=0, $arrayreplacementisregex=0)
Make replacement of strings into a file.
dol_is_dir_empty($dir)
Return if path is empty.
dol_now($mode='gmt')
Return date for now.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
dolExplodeIntoArray($string, $delimiter=';', $kv='=')
Split a string with 2 keys into key array.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $jsonclose='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_sanitizePathName($str, $newstr='_', $unaccent=0, $allowdash=0)
Clean a string to use it as a path name.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
getPictoForType($key, $morecss='')
Return the picto for a data type.
dolChmod($filepath, $newmask='')
Change mod of a file.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
dol_string_unaccent($str)
Clean a string from all accent characters to be used as ref, login or by dol_sanitizeFileName.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_string_nounprintableascii($str, $removetabcrlf=1)
Clean a string from all non printable ASCII chars (0x00-0x1F and 0x7F).
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
treeview li table
No Email.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
getLicenceHeader($user, $langs, $now)
Produce copyright replacement string for user.
foreach( $dirsrootforscan as $tmpdirread) moduleBuilderShutdownFunction()
Add management to catch fatal errors - shutdown handler.
updateDictionaryInFile($module, $file, $dicts)
Updates a dictionary in a module descriptor file.
deletePropsAndPermsFromDoc($file, $objectname)
Delete property and permissions from documentation ascii file if we delete an object.
filterEnabledTabs($requested, $map)
Filter a list of requested tab keys against the known optional tabs map.
createNewDictionnary($modulename, $file, $namedic, $dictionnaires=null)
Create a new dictionary table.
countItemsInDirectory($path, $type=1)
count directories or files in modulebuilder folder
writePermsInAsciiDoc($file, $destfile)
Write all permissions of each object in AsciiDoc format.
reWriteAllMenus($file, $menus, $menuWantTo, $key, $action)
rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='', $object=null, $moduletype='external')
Save data into a memory area shared by all users, all sessions on server.
writeApiUrlsInDoc($file_api, $file_doc)
Generate Urls and add them to documentation module.
dolGetListOfObjectClasses($destdir)
Get list of existing objects from a directory.
writePropsInAsciiDoc($file, $objectname, $destfile)
Write all properties of the object in AsciiDoc format.
removeObjectFromApiFile($file, $objects, $objectname)
Remove Object variables and methods from API_Module File.
dolReplaceInFilePreservingModuleBuilderMarkers($file, $arrayreplacement)
Apply substitutions to a module descriptor file while preserving the MODULEBUILDER comment markers.
rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='', $addfieldentry=array(), $delfieldentry='')
Regenerate files .class.php.
reWriteAllPermissions($file, $permissions, $key, $right, $objectname, $module, $action)
Rewriting all permissions after any actions.
checkExistComment($file, $number)
Function to check if comment BEGIN and END exists in modMyModule class.
getModuleBuilderObjectTabs()
Return the map of optional tabs that can be generated for a ModuleBuilder object.
addObjectsToApiFile($srcfile, $file, $objects, $modulename)
Add Object in ModuleApi File.
$conf db user
Active Directory does not allow anonymous connections.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
$conf db name
Only used if Module[ID]Name translation string is not found.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.