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.
'/modulebuilder/class/RightsSyncService.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
61require_once DOL_DOCUMENT_ROOT.
'/core/class/utils.class.php';
64$langs->loadLangs(array(
"admin",
"modulebuilder",
"exports",
"other",
"cron",
"errors",
"uxdocumentation"));
67$action =
GETPOST(
'action',
'aZ09');
68$confirm =
GETPOST(
'confirm',
'alpha');
69$cancel =
GETPOST(
'cancel',
'alpha');
71$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
72$sortorder =
GETPOST(
'sortorder',
'aZ09');
76$tabobj =
GETPOST(
'tabobj',
'alpha');
77$tabdic =
GETPOST(
'tabdic',
'alpha');
78$propertykey =
GETPOST(
'propertykey',
'alpha');
80 $module =
'initmodule';
85'@phan-var-force string $tab';
87 $tabobj =
'newobjectifnoobj';
90 $tabdic =
'newdicifnodic';
92$file =
GETPOST(
'file',
'alpha');
93$find =
GETPOST(
'find',
'alpha');
110if (!$user->hasRight(
"modulebuilder",
"run")) {
115$tmp = explode(
',', $dolibarr_main_document_root_alt);
120$tmpdir = explode(
'@', $module);
121if (!empty($tmpdir[1])) {
122 $module = $tmpdir[0];
123 $dirread = $tmpdir[1];
126if (
GETPOST(
'dirins',
'alpha')) {
127 $dirread = $dirins =
GETPOST(
'dirins',
'alpha');
131$FILEFLAG =
'modulebuilder.txt';
138if (empty($newmask)) {
150$dirsrootforscan = array($dirread);
154 $dirsrootforscan[] = DOL_DOCUMENT_ROOT;
158$textforlistofdirs =
'<!-- Directory scanned -->'.
"\n";
159$listofmodules = array();
160'@phan-var-force array<string,array{modulenamewithcase:string,moduledescriptorrelpath:string,moduledescriptorfullpath:string,moduledescriptorrootpath,moduletype?:string}> $listofmodules';
162foreach ($dirsrootforscan as $tmpdirread) {
163 $moduletype =
'external';
164 if ($tmpdirread == DOL_DOCUMENT_ROOT) {
165 $moduletype =
'internal';
168 $dirsincustom =
dol_dir_list($tmpdirread,
'directories');
169 if (is_array($dirsincustom) && count($dirsincustom) > 0) {
170 foreach ($dirsincustom as $dircustomcursor) {
171 $fullname = $dircustomcursor[
'fullname'];
174 $dirtoscanrel = basename($fullname).
'/core/modules/';
176 $descriptorfiles =
dol_dir_list(dirname($fullname).
'/'.$dirtoscanrel,
'files', 0,
'mod.*\.class\.php$');
177 if (empty($descriptorfiles)) {
178 $dirtoscanrel =
'core/modules/';
179 $descriptorfiles =
dol_dir_list($fullname.
'/../'.$dirtoscanrel,
'files', 0,
'mod'.strtoupper(basename($fullname)).
'\.class\.php$');
181 $modulenamewithcase =
'';
182 $moduledescriptorrelpath =
'';
183 $moduledescriptorfullpath =
'';
185 foreach ($descriptorfiles as $descriptorcursor) {
186 $modulenamewithcase = preg_replace(
'/^mod/',
'', $descriptorcursor[
'name']);
187 $modulenamewithcase = preg_replace(
'/\.class\.php$/',
'', $modulenamewithcase);
188 $moduledescriptorrelpath = $dirtoscanrel.$descriptorcursor[
'name'];
189 $moduledescriptorfullpath = $descriptorcursor[
'fullname'];
192 if ($modulenamewithcase) {
193 $listofmodules[$dircustomcursor[
'name']] = array(
194 'modulenamewithcase' => $modulenamewithcase,
195 'moduledescriptorrelpath' => $moduledescriptorrelpath,
196 'moduledescriptorfullpath' => $moduledescriptorfullpath,
197 'moduledescriptorrootpath' => $tmpdirread,
198 'moduletype' => $moduletype
206 if ($forceddirread && empty($listofmodules)) {
207 $listofmodules[strtolower($module)] = array(
208 'modulenamewithcase' => $module,
209 'moduledescriptorrelpath' =>
'notyetimplemented',
210 'moduledescriptorfullpath' =>
'notyetimplemented',
211 'moduledescriptorrootpath' =>
'notyetimplemented',
216 $newdircustom = $dirins;
217 if (empty($newdircustom)) {
223 $textforlistofdirs .= $langs->trans(
"DirScanned").
' : ';
225 $textforlistofdirs .=
', ';
227 $textforlistofdirs .=
'<strong class="wordbreakimp">'.$tmpdirread.
'</strong>';
228 if ($tmpdirread == DOL_DOCUMENT_ROOT) {
230 $textforlistofdirs .= $form->textwithpicto(
'', $langs->trans(
"ConstantIsOn",
"MAIN_FEATURES_LEVEL"));
233 $textforlistofdirs .= $form->textwithpicto(
'', $langs->trans(
"ConstantIsOn",
"MODULEBUILDER_ADD_DOCUMENT_ROOT"));
246 $error = error_get_last();
247 if ($error && ($error[
'type'] & (E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR))) {
249 echo
"Fatal error occurred: {$error['message']} in {$error['file']} on line {$error['line']}";
251 if (headers_sent()) {
256register_shutdown_function(
"moduleBuilderShutdownFunction");
270 $licInfo = $user->getFullName($langs);
271 $emailTabs = str_repeat(
"\t", (
int) (max(0, (31 - mb_strlen($licInfo)) / 4)));
272 $licInfo .= ($user->email ? $emailTabs.
'<'.$user->email.
'>' :
'');
291 $content = file_get_contents($destfile);
292 if ($content ===
false) {
296 $errors = $validator->validateContent($content, $destfile);
297 if (!empty($errors)) {
299 'ModuleBuilder NamingContract validation warning in ' . $destfile .
': '
300 . implode(
'; ', array_slice($errors, 0, 3)),
303 $safeErrors = array_map(
'dol_escape_htmltag', array_slice($errors, 0, 5));
319 $report = $service->sync($cmd);
321 if ($report->hasWarnings()) {
322 $safe = array_map(
'dol_escape_htmltag', array_slice($report->warnings, 0, 5));
323 setEventMessages($langs->trans(
'ModuleBuilderPermissionsNormalized').
'<br>'.implode(
'<br>', $safe),
null,
'warnings');
325 if ($report->hasConflicts()) {
326 $safe = array_map(
'dol_escape_htmltag', array_slice($report->conflicts, 0, 5));
327 setEventMessages($langs->trans(
'ModuleBuilderPermissionsNotChanged').
'<br>'.implode(
'<br>', $safe),
null,
'errors');
333if ($dirins && $action ==
'initmodule' && $modulename) {
335 $destdir =
'/not_set/';
338 if (preg_match(
'/[^a-z0-9]/i', $modulename)) {
340 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
344 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
345 $destdir = $dirins.
'/'.strtolower($modulename);
347 $arrayreplacement = [
348 'mymodule' => $ncModule->moduleNameLower,
349 'MyModule' => $ncModule->moduleNameCase,
351 $result =
dolCopyDir($srcdir, $destdir,
'0', 0, $arrayreplacement);
356 $langs->load(
"errors");
357 setEventMessages($langs->trans(
"ErrorFailToCopyDir", $srcdir, $destdir),
null,
'errors');
360 setEventMessages($langs->trans(
"AllFilesDidAlreadyExist", $srcdir, $destdir),
null,
'warnings');
366 $tryToCopyFromSetupClass =
true;
367 $backportDest = $destdir .
'/backport/v16/core/class';
368 $backportFileSrc = DOL_DOCUMENT_ROOT.
'/core/class/html.formsetup.class.php';
369 $backportFileDest = $backportDest.
'/html.formsetup.class.php';
374 $langs->load(
"errors");
375 setEventMessages($langs->trans(
"ErrorFailToCreateDir", $backportDest),
null,
'errors');
376 $tryToCopyFromSetupClass =
false;
379 if ($tryToCopyFromSetupClass) {
380 $result =
dol_copy($backportFileSrc, $backportFileDest);
384 $langs->load(
"errors");
385 setEventMessages($langs->trans(
"ErrorFailToCopyFile", $backportFileSrc, $backportFileDest),
null,
'errors');
387 setEventMessages($langs->trans(
"FileDidAlreadyExist", $backportFileDest),
null,
'warnings');
410 dol_delete_file($destdir.
'/class/actions_'.strtolower($modulename).
'.class.php');
411 dol_delete_file($destdir.
'/class/api_'.strtolower($modulename).
'.class.php');
429 dol_delete_file($destdir.
'/lib/'.strtolower($modulename).
'_myobject.lib.php');
430 dol_delete_file($destdir.
'/test/phpunit/functional/'.$modulename.
'FunctionalTest.php');
432 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject.sql');
433 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject_extrafields.sql');
434 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject.key.sql');
435 dol_delete_file($destdir.
'/sql/llx_'.strtolower($modulename).
'_myobject_extrafields.key.sql');
451 $listofphpfilestoedit =
dol_dir_list($destdir,
'files', 1,
'\.(php|MD|js|sql|txt|xml|lang)$',
'',
'fullname', SORT_ASC, 0, 1);
454 foreach ($listofphpfilestoedit as $phpfileval) {
456 $arrayreplacement = array_merge(
457 $ncModule->getSubstitutionMap(),
459 'htdocs/modulebuilder/template' => $ncModule->moduleNameLower,
460 '---Put here your own copyright and developer email---' => $licInfo,
461 '---Replace with your own copyright and developer email---' => $licInfo,
462 'Editor name' => $editorname,
463 'https://www.example.com' => $editorurl,
464 '$this->version = \'1.0\'' =>
'$this->version = \'' . $version .
'\'',
465 '$this->picto = \'generic\';' => (empty($picto)) ?
'$this->picto = \'generic\'' :
'$this->picto = \'' . $picto .
'\';',
466 'modulefamily' => $family,
470 '$this->numero = 500000' =>
'$this->numero = '.$idmodule,
475 $arrayreplacement[
'---Replace with your own copyright and developer email---'] =
dol_print_date($now,
'%Y').
"\t\t" .
getDolGlobalString(
'MODULEBUILDER_SPECIFIC_AUTHOR');
482 setEventMessages($langs->trans(
"ErrorFailToMakeReplacementInto", $phpfileval[
'fullname']),
null,
'errors');
487 setEventMessages($langs->trans(
"ContentOfREADMECustomized"),
null,
'warnings');
489 file_put_contents($destdir.
'/README.md',
getDolGlobalString(
"MODULEBUILDER_SPECIFIC_README"));
501 $module = $modulename;
503 clearstatcache(
true);
504 if (function_exists(
'opcache_invalidate')) {
508 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?module='.$modulename);
513$destdir =
'/not_set/';
514$destfile =
'/not_set/';
515$srcfile =
'/not_set/';
518if ($dirins && in_array($action, array(
'initapi',
'initphpunit',
'initpagecontact',
'initpagedocument',
'initpagenote',
'initpageagenda')) && !empty($module) ) {
519 $modulename = ucfirst($module);
520 $objectname = $tabobj;
521 $varnametoupdate =
'';
522 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
523 $destdir = $dirins.
'/'.strtolower($module);
529 if ($action ==
'initapi') {
530 if (file_exists($dirins.
'/'.strtolower($module).
'/class/api_'.strtolower($module).
'.class.php')) {
531 $result =
dol_copy(DOL_DOCUMENT_ROOT.
'/modulebuilder/template/class/api_mymodule.class.php', $dirins.
'/'.strtolower($module).
'/class/api_'.strtolower($module).
'.class.php',
'0', 1);
533 dol_mkdir($dirins.
'/'.strtolower($module).
'/class');
534 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
535 $srcfile = $srcdir.
'/class/api_mymodule.class.php';
536 $destfile = $dirins.
'/'.strtolower($module).
'/class/api_'.strtolower($module).
'.class.php';
537 } elseif ($action ==
'initphpunit') {
538 dol_mkdir($dirins.
'/'.strtolower($module).
'/test/phpunit');
539 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
540 $srcfile = $srcdir.
'/test/phpunit/MyObjectTest.php';
541 $destfile = $dirins.
'/'.strtolower($module).
'/test/phpunit/'.strtolower($objectname).
'Test.php';
542 } elseif ($action ==
'initpagecontact') {
543 dol_mkdir($dirins.
'/'.strtolower($module));
544 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
545 $srcfile = $srcdir.
'/myobject_contact.php';
546 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_contact.php';
547 $varnametoupdate =
'showtabofpagecontact';
548 } elseif ($action ==
'initpagedocument') {
549 dol_mkdir($dirins.
'/'.strtolower($module));
550 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
551 $srcfile = $srcdir.
'/myobject_document.php';
552 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_document.php';
553 $varnametoupdate =
'showtabofpagedocument';
554 } elseif ($action ==
'initpagenote') {
555 dol_mkdir($dirins.
'/'.strtolower($module));
556 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
557 $srcfile = $srcdir.
'/myobject_note.php';
558 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_note.php';
559 $varnametoupdate =
'showtabofpagenote';
560 } elseif ($action ==
'initpageagenda') {
561 dol_mkdir($dirins.
'/'.strtolower($module));
562 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
563 $srcfile = $srcdir.
'/myobject_agenda.php';
564 $destfile = $dirins.
'/'.strtolower($module).
'/'.strtolower($objectname).
'_agenda.php';
565 $varnametoupdate =
'showtabofpageagenda';
568 if (!file_exists($destfile)) {
569 $result =
dol_copy($srcfile, $destfile,
'0', 0);
576 }
catch (\InvalidArgumentException $e) {
578 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
582 if (!$error && $ncApiObj !==
null) {
583 $arrayreplacement = array_merge(
584 $ncApiObj->getSubstitutionMap(),
586 'htdocs/modulebuilder/template' => $ncApiObj->moduleNameLower,
587 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now),
591 if ($action ==
'initapi') {
592 if (count($objects) >= 1) {
598 $headerFix = $arrayreplacement;
599 unset($headerFix[
'MYOBJECT']);
610 if ($varnametoupdate) {
612 $srcfile = $dirins.
'/'.strtolower($module).
'/lib/'.strtolower($module).
'_'.strtolower($objectname).
'.lib.php';
613 $arrayreplacement = array(
'/\$'.preg_quote($varnametoupdate,
'/').
' = 0;/' =>
'$'.$varnametoupdate.
' = 1;');
618 $langs->load(
"errors");
619 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
625if ($dirins && $action ==
'initsqlextrafields' && !empty($module) ) {
626 $modulename = ucfirst($module);
627 $objectname = $tabobj;
629 dol_mkdir($dirins.
'/'.strtolower($module).
'/sql');
630 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
631 $srcfile1 = $srcdir.
'/sql/llx_mymodule_myobject_extrafields.sql';
632 $destfile1 = $dirins.
'/'.strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.sql';
633 $result1 =
dol_copy($srcfile1, $destfile1,
'0', 0);
634 $srcfile2 = $srcdir.
'/sql/llx_mymodule_myobject_extrafields.key.sql';
635 $destfile2 = $dirins.
'/'.strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($objectname).
'_extrafields.key.sql';
636 $result2 =
dol_copy($srcfile2, $destfile2,
'0', 0);
638 if ($result1 > 0 && $result2 > 0) {
639 $modulename = ucfirst($module);
644 }
catch (\InvalidArgumentException $e) {
646 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
650 if (!$error && $ncSqlObj !==
null) {
651 $arrayreplacement = array_merge(
652 $ncSqlObj->getSubstitutionMap(),
654 'htdocs/modulebuilder/template' => $ncSqlObj->moduleNameLower,
655 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now),
665 $langs->load(
"errors");
667 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile1),
null,
'errors');
670 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile2),
null,
'errors');
675 $srcfile = $dirins.
'/'.strtolower($module).
'/class/'.strtolower($objectname).
'.class.php';
676 $arrayreplacement = array(
'/\$this->isextrafieldmanaged = 0;/' =>
'$this->isextrafieldmanaged = 1;');
677 $arrayreplacement = array(
'/\$isextrafieldmanaged = 0;/' =>
'$isextrafieldmanaged = 1;');
683if ($dirins && $action ==
'inithook' && !empty($module) ) {
684 dol_mkdir($dirins.
'/'.strtolower($module).
'/class');
685 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
686 $srcfile = $srcdir.
'/class/actions_mymodule.class.php';
687 $destfile = $dirins.
'/'.strtolower($module).
'/class/actions_'.strtolower($module).
'.class.php';
688 $result =
dol_copy($srcfile, $destfile,
'0', 0);
691 $modulename = ucfirst($module);
694 $arrayreplacement = array(
695 'mymodule' => strtolower($modulename),
696 'MyModule' => $modulename,
697 'MYMODULE' => strtoupper($modulename),
698 'My module' => $modulename,
699 'my module' => $modulename,
700 'Mon module' => $modulename,
701 'mon module' => $modulename,
702 'htdocs/modulebuilder/template' => strtolower($modulename),
703 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
709 $langs->load(
"errors");
710 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
716if ($dirins && $action ==
'inittrigger' && !empty($module) ) {
717 dol_mkdir($dirins.
'/'.strtolower($module).
'/core/triggers');
718 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
719 $srcfile = $srcdir.
'/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php';
720 $destfile = $dirins.
'/'.strtolower($module).
'/core/triggers/interface_99_mod'.$module.
'_'.$module.
'Triggers.class.php';
721 $result =
dol_copy($srcfile, $destfile,
'0', 0);
724 $modulename = ucfirst($module);
727 $arrayreplacement = array(
728 'mymodule' => strtolower($modulename),
729 'MyModule' => $modulename,
730 'MYMODULE' => strtoupper($modulename),
731 'My module' => $modulename,
732 'my module' => $modulename,
733 'Mon module' => $modulename,
734 'mon module' => $modulename,
735 'htdocs/modulebuilder/template' => strtolower($modulename),
736 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
742 $langs->load(
"errors");
743 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
749if ($dirins && $action ==
'initwidget' && !empty($module) ) {
750 dol_mkdir($dirins.
'/'.strtolower($module).
'/core/boxes');
751 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
752 $srcfile = $srcdir.
'/core/boxes/mymodulewidget1.php';
753 $destfile = $dirins.
'/'.strtolower($module).
'/core/boxes/'.strtolower($module).
'widget1.php';
754 $result =
dol_copy($srcfile, $destfile,
'0', 0);
757 $modulename = ucfirst($module);
760 $arrayreplacement = array(
761 'mymodule' => strtolower($modulename),
762 'MyModule' => $modulename,
763 'MYMODULE' => strtoupper($modulename),
764 'My module' => $modulename,
765 'my module' => $modulename,
766 'Mon module' => $modulename,
767 'mon module' => $modulename,
768 'htdocs/modulebuilder/template' => strtolower($modulename),
769 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
775 $langs->load(
"errors");
776 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
782if ($dirins && $action ==
'initemailing' && !empty($module) ) {
783 dol_mkdir($dirins.
'/'.strtolower($module).
'/core/modules/mailings');
784 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
785 $srcfile = $srcdir.
'/core/modules/mailings/mailing_mymodule_selector1.modules.php';
786 $destfile = $dirins.
'/'.strtolower($module).
'/core/modules/mailings/mailing_'.strtolower($module).
'_selector1.modules.php';
787 $result =
dol_copy($srcfile, $destfile,
'0', 0);
790 $modulename = ucfirst($module);
793 $arrayreplacement = array(
794 'mymodule' => strtolower($modulename),
795 'MyModule' => $modulename,
796 'MYMODULE' => strtoupper($modulename),
797 'My module' => $modulename,
798 'my module' => $modulename,
799 'Mon module' => $modulename,
800 'mon module' => $modulename,
801 'htdocs/modulebuilder/template' => strtolower($modulename),
802 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
808 $langs->load(
"errors");
809 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
815if ($dirins && $action ==
'initcss' && !empty($module) ) {
816 dol_mkdir($dirins.
'/'.strtolower($module).
'/css');
817 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
818 $srcfile = $srcdir.
'/css/mymodule.css.php';
819 $destfile = $dirins.
'/'.strtolower($module).
'/css/'.strtolower($module).
'.css.php';
820 $result =
dol_copy($srcfile, $destfile,
'0', 0);
823 $modulename = ucfirst($module);
826 $arrayreplacement = array(
827 'mymodule' => strtolower($modulename),
828 'MyModule' => $modulename,
829 'MYMODULE' => strtoupper($modulename),
830 'My module' => $modulename,
831 'my module' => $modulename,
832 'Mon module' => $modulename,
833 'mon module' => $modulename,
834 'htdocs/modulebuilder/template' => strtolower($modulename),
835 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
842 $srcfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
843 $arrayreplacement = array(
'/\/\/\s*\''.preg_quote(
'/'.strtolower($module).
'/css/'.strtolower($module).
'.css.php',
'/').
'\'/
' => '\
'/'.strtolower($module).
'/css/'.strtolower($module).
'.css.php\'');
846 $langs->load(
"errors");
847 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
853if ($dirins && $action ==
'initjs' && !empty($module) ) {
854 dol_mkdir($dirins.
'/'.strtolower($module).
'/js');
855 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
856 $srcfile = $srcdir.
'/js/mymodule.js.php';
857 $destfile = $dirins.
'/'.strtolower($module).
'/js/'.strtolower($module).
'.js.php';
858 $result =
dol_copy($srcfile, $destfile,
'0', 0);
861 $modulename = ucfirst($module);
864 $arrayreplacement = array(
865 'mymodule' => strtolower($modulename),
866 'MyModule' => $modulename,
867 'MYMODULE' => strtoupper($modulename),
868 'My module' => $modulename,
869 'my module' => $modulename,
870 'Mon module' => $modulename,
871 'mon module' => $modulename,
872 'htdocs/modulebuilder/template' => strtolower($modulename),
873 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
880 $srcfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
881 $arrayreplacement = array(
'/\/\/\s*\''.preg_quote(
'/'.strtolower($module).
'/js/'.strtolower($module).
'.js.php',
'/').
'\'/
' => '\
'/'.strtolower($module).
'/js/'.strtolower($module).
'.js.php\'');
884 $langs->load(
"errors");
885 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
891if ($dirins && $action ==
'initcli' && !empty($module) ) {
892 dol_mkdir($dirins.
'/'.strtolower($module).
'/scripts');
893 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
894 $srcfile = $srcdir.
'/scripts/mymodule.php';
895 $destfile = $dirins.
'/'.strtolower($module).
'/scripts/'.strtolower($module).
'.php';
896 $result =
dol_copy($srcfile, $destfile,
'0', 0);
899 $modulename = ucfirst($module);
902 $arrayreplacement = array(
903 'mymodule' => strtolower($modulename),
904 'MyModule' => $modulename,
905 'MYMODULE' => strtoupper($modulename),
906 'My module' => $modulename,
907 'my module' => $modulename,
908 'Mon module' => $modulename,
909 'mon module' => $modulename,
910 'htdocs/modulebuilder/template' => strtolower($modulename),
911 '__MYCOMPANY_NAME__' =>
$mysoc->name,
912 '__KEYWORDS__' => $modulename,
913 '__USER_FULLNAME__' => $user->getFullName($langs),
914 '__USER_EMAIL__' => $user->email,
916 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
922 $langs->load(
"errors");
923 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
928$moduledescriptorfile =
'/not_set/';
929$modulelowercase =
null;
932if ($dirins && $action ==
'initdoc' && !empty($module) ) {
933 dol_mkdir($dirins.
'/'.strtolower($module).
'/doc');
934 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
935 $srcfile = $srcdir.
'/doc/Documentation.asciidoc';
936 $destfile = $dirins.
'/'.strtolower($module).
'/doc/Documentation.asciidoc';
937 $result =
dol_copy($srcfile, $destfile,
'0', 0);
940 $modulename = ucfirst($module);
941 $modulelowercase = strtolower($module);
944 $arrayreplacement = array(
945 'mymodule' => strtolower($modulename),
946 'MyModule' => $modulename,
947 'MYMODULE' => strtoupper($modulename),
948 'My module' => $modulename,
949 'my module' => $modulename,
950 'Mon module' => $modulename,
951 'mon module' => $modulename,
952 'htdocs/modulebuilder/template' => strtolower($modulename),
953 '__MYCOMPANY_NAME__' =>
$mysoc->name,
954 '__KEYWORDS__' => $modulename,
955 '__USER_FULLNAME__' => $user->getFullName($langs),
956 '__USER_EMAIL__' => $user->email,
958 '---Replace with your own copyright and developer email---' =>
getLicenceHeader($user, $langs, $now)
965 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
966 $destdir = $dirins.
'/'.strtolower($module);
968 foreach ($objects as $path => $obj) {
973 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
977 if (file_exists($dirins.
'/'.strtolower($module).
'/class/api_'.strtolower($module).
'.class.php')) {
978 $apiFile = $dirins.
'/'.strtolower($module).
'/class/api_'.strtolower($module).
'.class.php';
983 if (file_exists($dirins.
'/'.strtolower($module).
'/ChangeLog.md')) {
984 $changeLog = $dirins.
'/'.strtolower($module).
'/ChangeLog.md';
985 $string = file_get_contents($changeLog);
987 $replace = explode(
"\n", $string);
988 $strreplace = array();
989 foreach ($replace as $line) {
993 if (strpos($line,
'##') !==
false) {
994 $strreplace[$line] = str_replace(
'##',
'', $line);
996 $strreplace[$line] = $line;
999 $stringLog = implode(
"\n", $strreplace);
1001 dolReplaceInFile($destfile, array(
'//include::ChangeLog.md[]' =>
'',
'__CHANGELOG__' => $stringLog));
1005 $FILENAMEDOC = $modulelowercase.
'.html';
1006 $FILENAMEDOCPDF = $modulelowercase.
'.pdf';
1007 $outputfiledoc =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOC;
1008 $outputfiledocurl =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOC;
1009 $outputfiledocpdf =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOCPDF;
1010 $outputfiledocurlpdf =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOCPDF;
1015 $langs->load(
"errors");
1016 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $destfile),
null,
'errors');
1022if ($dirins && $action ==
'addlanguage' && !empty($module) ) {
1023 $newlangcode =
GETPOST(
'newlangcode',
'aZ09');
1026 $modulelowercase = strtolower($module);
1031 if ($diroflang == $dolibarr_main_document_root.
'/'.$modulelowercase) {
1033 $diroflang = $dolibarr_main_document_root;
1035 $srcfile = $diroflang.
'/langs/en_US/'.$modulelowercase.
'.lang';
1036 $destfile = $diroflang.
'/langs/'.$newlangcode.
'/'.$modulelowercase.
'.lang';
1038 $result =
dol_copy($srcfile, $destfile,
'0', 0);
1040 setEventMessages($langs->trans(
"ErrorFailToCopyFile", $srcfile, $destfile),
null,
'errors');
1043 $srcdir = $diroflang.
'/langs/en_US';
1044 $srcfile = $diroflang.
'/langs/en_US/'.$modulelowercase.
'.lang';
1045 $destdir = $diroflang.
'/langs/'.$newlangcode;
1047 $arrayofreplacement = array();
1049 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template/langs/en_US';
1050 $arrayofreplacement = array(
'mymodule' => $modulelowercase);
1052 $result =
dolCopyDir($srcdir, $destdir,
'0', 0, $arrayofreplacement);
1055 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Language")),
null,
'errors');
1061if ($dirins && $action ==
'confirm_removefile' && !empty($module) ) {
1062 $objectname = $tabobj;
1063 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
1064 $destdir = $dirins.
'/'.strtolower($module);
1069 if ($relativefilename) {
1070 $dirnametodelete = dirname($relativefilename);
1071 $filetodelete = $dirins.
'/'.$relativefilename;
1072 $dirtodelete = $dirins.
'/'.$dirnametodelete;
1077 $keyofobjecttodelete = array_search($objectname, $objects);
1078 if ($keyofobjecttodelete !==
false) {
1079 unset($objects[$keyofobjecttodelete]);
1083 if (strpos($relativefilename,
'api') !==
false) {
1084 $file_api = $destdir.
'/class/api_'.strtolower($module).
'.class.php';
1088 if (count($objects) == 0) {
1100 setEventMessages($langs->trans(
"ErrorFailToDeleteFile", basename($filetodelete)),
null,
'errors');
1103 if (preg_match(
'/\.sql$/', $relativefilename)) {
1104 if (preg_match(
'/\.key\.sql$/', $relativefilename)) {
1105 $relativefilename = preg_replace(
'/\.key\.sql$/',
'.sql', $relativefilename);
1106 $filetodelete = $dirins.
'/'.$relativefilename;
1108 } elseif (preg_match(
'/\.sql$/', $relativefilename)) {
1109 $relativefilename = preg_replace(
'/\.sql$/',
'.key.sql', $relativefilename);
1110 $filetodelete = $dirins.
'/'.$relativefilename;
1120 if (in_array($tab, array(
'css',
'js'))) {
1121 $srcfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
1122 $arrayreplacement = array(
'/^\s*\''.preg_quote(
'/'.$relativefilename,
'/').
'\',*/m
' => '
1126 if (preg_match(
'/_extrafields/', $relativefilename)) {
1128 $srcfile = $dirins.
'/'.strtolower($module).
'/class/'.strtolower($objectname).
'.class.php';
1129 $arrayreplacement = array(
'/\$isextrafieldmanaged = 1;/' =>
'$isextrafieldmanaged = 0;');
1134 $varnametoupdate =
'';
1136 if (preg_match(
'/_([a-z]+)\.php$/', $relativefilename, $reg)) {
1137 $varnametoupdate =
'showtabofpage'.$reg[1];
1139 if ($varnametoupdate) {
1140 $srcfile = $dirins.
'/'.strtolower($module).
'/lib/'.strtolower($module).
'_'.strtolower($objectname).
'.lib.php';
1141 $arrayreplacement = array(
'/\$'.preg_quote($varnametoupdate,
'/').
' = 1;/' =>
'$'.preg_quote($varnametoupdate,
'/').
' = 0;');
1149if ($dirins && $action ==
'initobject' && $module && $objectname) {
1154 $dirins = $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
1155 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
1157 if (preg_match(
'/[^a-z0-9]/i', $objectname)) {
1159 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
1160 $tabobj =
'newobject';
1162 if (class_exists($objectname)) {
1165 setEventMessages($langs->trans(
"AnObjectWithThisClassNameAlreadyExists"),
null,
'errors');
1166 $tabobj =
'newobject';
1171 }
catch (\InvalidArgumentException $e) {
1173 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
1177 $srcdir = DOL_DOCUMENT_ROOT.
'/modulebuilder/template';
1178 $destdir = $dirins.
'/'.strtolower($module);
1182 $objectalreadyexists =
dol_is_file($destdir.
'/class/'.strtolower($objectname).
'.class.php');
1195 $dirlist =
dol_dir_list($destdir.
'/class',
'files', 0,
'\.txt$');
1196 $alreadyfound =
false;
1197 foreach ($dirlist as $key => $val) {
1198 $filefound = preg_replace(
'/\.txt$/',
'', $val[
'name']);
1199 if (strtolower($objectname) == strtolower($filefound) && $objectname != $filefound) {
1200 $alreadyfound =
true;
1202 setEventMessages($langs->trans(
"AnObjectAlreadyExistWithThisNameAndDiffCase"),
null,
'errors');
1210 $stringforproperties =
'';
1211 $tablename =
GETPOST(
'initfromtablename',
'alpha');
1213 $_results =
$db->DDLDescTable($tablename);
1214 if (empty($_results)) {
1216 $langs->load(
"errors");
1217 setEventMessages($langs->trans(
"ErrorTableNotFound", $tablename),
null,
'errors');
1266 $stringforproperties =
'// BEGIN MODULEBUILDER PROPERTIES'.
"\n";
1267 $stringforproperties .=
'public $fields = array('.
"\n";
1269 while ($obj =
$db->fetch_object($_results)) {
1271 $fieldname = $obj->Field;
1274 if ($type ==
'int(11)') {
1276 } elseif ($type ==
'float') {
1278 } elseif (strstr($type,
'tinyint')) {
1280 } elseif (strstr($type,
'url')) {
1281 $type =
'varchar(255)';
1282 } elseif ($obj->Field ==
'fk_soc') {
1283 $type =
'integer:Societe:societe/class/societe.class.php';
1284 } elseif (preg_match(
'/^fk_proj/', $obj->Field)) {
1285 $type =
'integer:Project:projet/class/project.class.php:1:fk_statut=1';
1286 } elseif (preg_match(
'/^fk_prod/', $obj->Field)) {
1287 $type =
'integer:Product:product/class/product.class.php:1';
1288 } elseif ($obj->Field ==
'fk_warehouse') {
1289 $type =
'integer:Entrepot:product/stock/class/entrepot.class.php';
1290 } elseif (preg_match(
'/^(fk_user|fk_commercial)/', $obj->Field)) {
1291 $type =
'integer:User:user/class/user.class.php';
1295 $notnull = ($obj->Null ==
'YES' ? 0 : 1);
1296 if ($fieldname ==
'fk_user_modif') {
1300 $label = preg_replace(
'/_/',
'', ucfirst($fieldname));
1301 if ($fieldname ==
'rowid') {
1302 $label =
'TechnicalID';
1304 if ($fieldname ==
'import_key') {
1305 $label =
'ImportId';
1307 if ($fieldname ==
'fk_soc') {
1308 $label =
'ThirdParty';
1310 if (in_array($fieldname, array(
'tms',
'date_modification'))) {
1311 $label =
'DateModification';
1313 if (in_array($fieldname, array(
'datec',
'date_creation'))) {
1314 $label =
'DateCreation';
1316 if ($fieldname ==
'date_valid') {
1317 $label =
'DateValidation';
1319 if ($fieldname ==
'datev') {
1320 $label =
'DateValidation';
1322 if ($fieldname ==
'note_private') {
1323 $label =
'NotePublic';
1325 if ($fieldname ==
'note_public') {
1326 $label =
'NotePrivate';
1328 if ($fieldname ==
'fk_user_creat') {
1329 $label =
'UserAuthor';
1331 if ($fieldname ==
'fk_user_modif') {
1332 $label =
'UserModif';
1334 if ($fieldname ==
'fk_user_valid') {
1335 $label =
'UserValidation';
1339 if (in_array($fieldname, array(
'ref',
'label'))) {
1342 if ($fieldname ==
'entity') {
1345 if ($fieldname ==
'entity') {
1348 if ($fieldname ==
'import_key') {
1351 if ($fieldname ==
'fk_user_creat') {
1354 if ($fieldname ==
'fk_user_modif') {
1357 if (in_array($fieldname, array(
'ref_ext',
'model_pdf',
'note_public',
'note_private'))) {
1364 if ($fieldname ==
'entity') {
1369 if (in_array($fieldname, array(
'status',
'statut',
'fk_status',
'fk_statut'))) {
1372 if ($fieldname ==
'import_key') {
1376 $alwayseditable = 0;
1377 if ($fieldname ==
'label') {
1378 $alwayseditable = 1;
1380 $alwayseditable = 0;
1384 if ($fieldname ==
'entity') {
1391 if (preg_match(
'/^fk_/', $fieldname)) {
1392 $css =
'maxwidth500 widthcentpercentminusxx';
1394 if ($fieldname ==
'label') {
1395 $css =
'minwidth300';
1396 $cssview =
'wordbreak';
1398 if (in_array($fieldname, array(
'note_public',
'note_private'))) {
1399 $cssview =
'wordbreak';
1401 if (in_array($fieldname, array(
'ref',
'label')) || preg_match(
'/integer:/', $type)) {
1402 $csslist =
'tdoverflowmax150';
1407 if (isset($obj->Picto)) {
1408 $picto = $obj->Picto;
1410 if (preg_match(
'/^fk_soc/', $obj->Field)) {
1412 } elseif (preg_match(
'/^fk_contact/', $obj->Field)) {
1414 } elseif (preg_match(
'/^fk_bank/', $obj->Field)) {
1416 } elseif (preg_match(
'/^fk_user/', $obj->Field)) {
1418 } elseif (preg_match(
'/^fk_warehouse/', $obj->Field)) {
1419 $picto =
'warehouse';
1420 } elseif (preg_match(
'/^fk_prod/', $obj->Field)) {
1422 } elseif (preg_match(
'/^fk_proj/', $obj->Field)) {
1424 } elseif (preg_match(
'/^fk_task/', $obj->Field)) {
1429 $lang = $module.
'@'.$module;
1432 $stringforproperties .=
"'".$obj->Field.
"' => array('type' => '".$type.
"', 'label' => '".$label.
"',";
1433 if ($default !=
'') {
1434 $stringforproperties .=
" 'default' => ".$default.
",";
1436 $stringforproperties .=
" 'enabled' => ".$enabled.
",";
1437 $stringforproperties .=
" 'visible' => ".$visible;
1439 $stringforproperties .=
", 'notnull' => ".$notnull;
1441 if ($alwayseditable) {
1442 $stringforproperties .=
", 'alwayseditable' => 1";
1444 if ($fieldname ==
'ref' || $fieldname ==
'code') {
1445 $stringforproperties .=
", 'showoncombobox' => 1";
1447 $stringforproperties .=
", 'position' => ".$position;
1449 $stringforproperties .=
", 'index' => ".$index;
1452 $stringforproperties .=
", 'picto' => '".$picto.
"'";
1455 $stringforproperties .=
", 'css' => '".$css.
"'";
1458 $stringforproperties .=
", 'cssview' => '".$cssview.
"'";
1461 $stringforproperties .=
", 'csslist' => '".$csslist.
"'";
1464 $stringforproperties .=
", 'lang' => '".$lang.
"'";
1466 $stringforproperties .=
"),\n";
1469 $stringforproperties .=
');'.
"\n";
1470 $stringforproperties .=
'// END MODULEBUILDER PROPERTIES'.
"\n";
1474 $filetogenerate = array();
1477 $filetogenerate = [];
1479 'myobject_card.php',
1480 'myobject_note.php',
1481 'myobject_contact.php',
1482 'myobject_document.php',
1483 'myobject_agenda.php',
1484 'myobject_list.php',
1485 'admin/myobject_extrafields.php',
1486 'ajax/myobject.php',
1487 'lib/mymodule_myobject.lib.php',
1489 'sql/llx_mymodule_myobject.sql',
1490 'sql/llx_mymodule_myobject.key.sql',
1491 'sql/llx_mymodule_myobject_extrafields.sql',
1492 'sql/llx_mymodule_myobject_extrafields.key.sql',
1494 'class/myobject.class.php',
1495 'class/myobjectstats.class.php',
1497 'stats/myobject_index.php',
1498 ] as $templateFile) {
1499 $filetogenerate[$templateFile] = $ncObj->applyToFilename($templateFile);
1504 if (!in_array($tabkey, $enabledtabs,
true)) {
1505 unset($filetogenerate[$tabinfo[
'file']]);
1509 if (
GETPOST(
'includerefgeneration',
'aZ09')) {
1510 dol_mkdir($destdir.
'/core/modules/'.strtolower($module));
1513 'core/modules/mymodule/mod_myobject_advanced.php',
1514 'core/modules/mymodule/mod_myobject_standard.php',
1515 'core/modules/mymodule/modules_myobject.php',
1516 ] as $templateFile) {
1517 $filetogenerate[$templateFile] = $ncObj->applyToFilename($templateFile);
1520 if (
GETPOST(
'includedocgeneration',
'aZ09')) {
1521 dol_mkdir($destdir.
'/core/modules/'.strtolower($module));
1522 dol_mkdir($destdir.
'/core/modules/'.strtolower($module).
'/doc');
1525 'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php',
1526 'core/modules/mymodule/doc/pdf_standard_myobject.modules.php',
1527 ] as $templateFile) {
1528 $filetogenerate[$templateFile] = $ncObj->applyToFilename($templateFile);
1532 if (
GETPOST(
'generatepermissions',
'aZ09')) {
1533 $firstobjectname =
'myobject';
1534 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
1536 $class =
'mod'.$module;
1538 if (class_exists($class)) {
1541 '@phan-var-force DolibarrModules $moduleobj';
1553 $moduledescriptorfile = $destdir.
'/core/modules/mod'.$module.
'.class.php';
1555 if ($checkComment < 0) {
1556 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Permissions"),
"mod".$module.
"class.php"),
null,
'warnings');
1559 if ($reportPerms->skipped > 0) {
1560 setEventMessages($langs->trans(
"WarningPermissionAlreadyExist", $langs->transnoentities($objectname)),
null,
'warnings');
1566 foreach ($filetogenerate as $srcfile => $destfile) {
1567 $result =
dol_copy($srcdir.
'/'.$srcfile, $destdir.
'/'.$destfile, $newmask, 0);
1571 $langs->load(
"errors");
1572 setEventMessages($langs->trans(
"ErrorFailToCopyFile", $srcdir.
'/'.$srcfile, $destdir.
'/'.$destfile),
null,
'errors');
1575 setEventMessages($langs->trans(
"FileAlreadyExists", $destfile),
null,
'warnings');
1578 $arrayreplacement = array(
1579 '/myobject\.class\.php/' => strtolower($objectname).
'.class.php',
1580 '/myobject\.lib\.php/' => strtolower($objectname).
'.lib.php',
1583 dolReplaceInFile($destdir.
'/'.$destfile, $arrayreplacement,
'',
'0', 0, 1);
1588 if (!$error && $stringforproperties) {
1590 $arrayreplacement = array(
1591 '/\/\/ BEGIN MODULEBUILDER PROPERTIES.*\/\/ END MODULEBUILDER PROPERTIES/ims' => $stringforproperties
1594 dolReplaceInFile($destdir.
'/class/'.strtolower($objectname).
'.class.php', $arrayreplacement,
'',
'0', 0, 1);
1598 if (
GETPOST(
'includerefgeneration',
'aZ09')) {
1600 $arrayreplacement = array(
1601 '/\'visible\'s*=>s*1,\s*\'noteditable\'s*=>s*0,\s*\'default\'s*=>s*\'\'/' =>
"'visible' => 4, 'noteditable' => 1, 'default' => '(PROV)'"
1605 dolReplaceInFile($destdir.
'/class/'.strtolower($objectname).
'.class.php', $arrayreplacement,
'',
'0', 0, 1);
1607 $arrayreplacement = array(
1608 '/\'models\' => 0,/' =>
'\'models\
' => 1,'
1610 dolReplaceInFile($destdir.
'/core/modules/mod'.$module.
'.class.php', $arrayreplacement,
'',
'0', 0, 1);
1614 if (
GETPOST(
'includedocgeneration',
'aZ09')) {
1616 $arrayreplacement = array(
1617 '/\$includedocgeneration = 0;/' =>
'$includedocgeneration = 1;'
1619 dolReplaceInFile($destdir.
'/class/'.strtolower($objectname).
'.class.php', $arrayreplacement,
'',
'0', 0, 1);
1620 dolReplaceInFile($destdir.
'/'.strtolower($objectname).
'_card.php', $arrayreplacement,
'',
'0', 0, 1);
1622 $arrayreplacement = array(
1623 '/\'models\' => 0,/' =>
'\'models\
' => 1,'
1626 dolReplaceInFile($destdir.
'/core/modules/mod'.$module.
'.class.php', $arrayreplacement,
'',
'0', 0, 1);
1633 $listofobject =
dol_dir_list($destdir.
'/class',
'files', 0,
'\.class\.php$');
1635 $firstobjectname =
'';
1637 foreach ($listofobject as $fileobj) {
1638 if (preg_match(
'/^api_/', $fileobj[
'name'])) {
1641 if (preg_match(
'/^actions_/', $fileobj[
'name'])) {
1645 $tmpcontent = file_get_contents($fileobj[
'fullname']);
1647 if (preg_match(
'/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) {
1648 $objectnameloop = $reg[1];
1649 if (empty($firstobjectname)) {
1650 $firstobjectname = $objectnameloop;
1656 \$this->menu[\$r++] = array(
1657 'fk_menu' => 'fk_mainmenu=mymodule',
1659 'titre' => 'MyObject',
1660 'prefix' => img_picto('', \$this->picto, 'class=\"paddingright pictofixedwidth valignmiddle\"'),
1661 'mainmenu' => 'mymodule',
1662 'leftmenu' => 'myobject',
1663 'url' => '/mymodule/myobject_list.php',
1664 'langs' => 'mymodule@mymodule',
1665 'position' => 1000 + \$r,
1666 'enabled' => 'isModEnabled(\"mymodule\")',
1667 'perms' => '".(GETPOST(
'generatepermissions') ?
'$user->hasRight("mymodule", "myobject", "read")' :
'1').
"',
1670 'object' => 'MyObject'
1672 \$this->menu[\$r++] = array(
1673 'fk_menu' => 'fk_mainmenu=mymodule,fk_leftmenu=myobject',
1675 'titre' => 'List MyObject',
1676 'mainmenu' => 'mymodule',
1677 'leftmenu' => 'mymodule_myobject_list',
1678 'url' => '/mymodule/myobject_list.php',
1679 'langs' => 'mymodule@mymodule',
1680 'position' => 1000 + \$r,
1681 'enabled' => 'isModEnabled(\"mymodule\")',
1682 'perms' => '".(
GETPOST(
'generatepermissions') ?
'$user->hasRight("mymodule", "myobject", "read")' :
'1').
"',
1685 'object' => 'MyObject'
1687 \$this->menu[\$r++] = array(
1688 'fk_menu' => 'fk_mainmenu=mymodule,fk_leftmenu=myobject',
1690 'titre' => 'New MyObject',
1691 'mainmenu' => 'mymodule',
1692 'leftmenu' => 'mymodule_myobject_new',
1693 'url' => '/mymodule/myobject_card.php?action=create',
1694 'langs' => 'mymodule@mymodule',
1695 'position' => 1000 + \$r,
1696 'enabled' => 'isModEnabled(\"mymodule\")',
1697 'perms' => '".(
GETPOST(
'generatepermissions') ?
'$user->hasRight("mymodule", "myobject", "write")' :
'1').
"',
1700 'object' => 'MyObject'
1702 $stringtoadd = $ncObj->applyTo($stringtoadd);
1704 $moduledescriptorfile = $destdir.
'/core/modules/mod'.$module.
'.class.php';
1710 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
1712 $class =
'mod'.$module;
1714 if (class_exists($class)) {
1717 '@phan-var-force DolibarrModules $moduleobj';
1730 foreach ($menus as $menu) {
1731 if ($menu[
'leftmenu'] == strtolower($objectname)) {
1737 if ($checkComment < 0) {
1739 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Menus"), basename($moduledescriptorfile)),
null,
'warnings');
1741 $arrayofreplacement = array(
1742 '/* 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 */'
1748 $filetogenerate[] =
'core/modules/mod'.$module.
'.class.php';
1751 if (! $error &&
GETPOST(
'nogeneratelines',
'aZ09')) {
1753 if ($checkComment < 0) {
1755 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Menus"), basename($moduledescriptorfile)),
null,
'warnings');
1759 $destdir .
'/class/' . strtolower($objectname) .
'.class.php',
1760 $destdir .
'/class/api_' . strtolower($module) .
'.class.php',
1761 $destdir .
'/' . strtolower($objectname) .
'_card.php'
1765 $pattern =
'/\/\/BEGIN MODULEBUILDER LINES.*?\/\/END MODULEBUILDER LINES\s*/s';
1766 foreach ($TFilePaths as $filePath) {
1779 $libdestfile = $destdir.
'/'.$ncObj->applyToFilename(
'lib/mymodule_myobject.lib.php');
1781 $marker = $tabinfo[
'marker'];
1782 if (in_array($tabkey, $enabledtabs,
true)) {
1783 $arrayreplacement = array(
1784 '/\$'.$tabinfo[
'var'].
' = getDolGlobalInt\([^;]*\);/' =>
'$'.$tabinfo[
'var'].
' = 1;'
1786 if (
dolReplaceInFile($libdestfile, $arrayreplacement,
'',
'0', 0, 1) < 0) {
1788 dol_syslog(
"modulebuilder: failed to activate tab flag '".$tabkey.
"' in ".$libdestfile, LOG_ERR);
1791 if (!
removePatternFromFile($libdestfile,
'/\h*\/\/ BEGIN MODULEBUILDER TABFLAG '.$marker.
'.*?\/\/ END MODULEBUILDER TABFLAG '.$marker.
'\s*/s')
1792 || !
removePatternFromFile($libdestfile,
'/\h*\/\/ BEGIN MODULEBUILDER TAB '.$marker.
'.*?\/\/ END MODULEBUILDER TAB '.$marker.
'\s*/s')) {
1794 dol_syslog(
"modulebuilder: failed to purge tab '".$tabkey.
"' in ".$libdestfile, LOG_ERR);
1799 if (!$error && !in_array(
'agenda', $enabledtabs,
true)) {
1800 $carddestfile = $destdir.
'/'.$ncObj->applyToFilename(
'myobject_card.php');
1801 if (!
removePatternFromFile($carddestfile,
'/\h*\/\/ BEGIN MODULEBUILDER TAB AGENDA.*?\/\/ END MODULEBUILDER TAB AGENDA\s*/s')) {
1803 dol_syslog(
"modulebuilder: failed to purge agenda widget in ".$carddestfile, LOG_ERR);
1806 if ($objectalreadyexists) {
1807 setEventMessages($langs->trans(
"WarningTabSelectionOnRegeneration"),
null,
'warnings');
1813 foreach ($filetogenerate as $destfile) {
1814 $phpfileval[
'fullname'] = $destdir.
'/'.$destfile;
1821 $arrayreplacement = array_merge(
1822 $ncObj->getSubstitutionMap(),
1824 'htdocs/modulebuilder/template/' => $ncObj->moduleNameLower,
1825 '---Replace with your own copyright and developer email---' => $licenceValue,
1829 if (basename($phpfileval[
'fullname']) ===
'mod'.$module.
'.class.php') {
1837 setEventMessages($langs->trans(
"ErrorFailToMakeReplacementInto", $phpfileval[
'fullname']),
null,
'errors');
1844 if (!$error && $ncObj !==
null) {
1852 $moduleReplacementAll = array_merge(
1853 $ncObj->getSubstitutionMap(),
1855 'htdocs/modulebuilder/template/' => $ncObj->moduleNameLower,
1856 '---Replace with your own copyright and developer email---' => $licenceValueAll,
1859 $allModulePhpFiles =
dol_dir_list($destdir,
'files', 1,
'\.php$');
1863 $moduledescriptorbasename =
'mod'.$module.
'.class.php';
1864 if (is_array($allModulePhpFiles) && !empty($allModulePhpFiles)) {
1865 foreach ($allModulePhpFiles as $phpFileval) {
1866 if (basename($phpFileval[
'fullname']) === $moduledescriptorbasename) {
1869 $result =
dolReplaceInFile($phpFileval[
'fullname'], $moduleReplacementAll);
1871 setEventMessages($langs->trans(
"ErrorFailToMakeReplacementInto", $phpFileval[
'fullname']),
null,
'warnings');
1876 $moduleLowerForPlaceholder = strtolower($module);
1878 $destdir .
'/stats/myobject_index.php',
1879 $destdir .
'/lib/' . $moduleLowerForPlaceholder .
'_myobject.lib.php',
1880 ] as $placeholder) {
1881 if (file_exists($placeholder)) {
1892 if (is_numeric($object) && $object <= 0) {
1893 $pathoffiletoeditsrc = $destdir.
'/class/'.strtolower($objectname).
'.class.php';
1894 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $pathoffiletoeditsrc),
null,
'errors');
1898 $file = $destdir.
'/class/'.strtolower($objectname).
'.class.php';
1899 $destfile = $destdir.
'/doc/Documentation.asciidoc';
1901 if (file_exists($destfile)) {
1905 if (!$error && $object !==
null) {
1907 $result =
rebuildObjectSql($destdir, $module, $objectname, $newmask,
'', $object);
1916 setEventMessages($langs->trans(
'FilesForObjectInitialized', $objectname),
null);
1917 $tabobj = $objectname;
1919 $tabobj =
'newobject';
1924 $result = unActivateModule(strtolower($module));
1929 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
1930 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=objects&module='.$module);
1936if ($dirins && $action ==
'initdic' && $module && empty($cancel) ) {
1937 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
1938 $destdir = $dirins.
'/'.strtolower($module);
1939 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
1943 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Table")),
null,
'errors');
1947 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
1950 $newdicname = $dicname;
1951 if (!preg_match(
'/^c_/', $newdicname)) {
1952 $newdicname =
'c_'.$dicname;
1955 $class =
'mod'.$module;
1958 if (class_exists($class)) {
1961 '@phan-var-force DolibarrModules $moduleobj';
1971 $langs->load(
"errors");
1972 dol_print_error(
$db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
1977 if ($checkComment < 0) {
1978 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Dictionaries"),
"mod".$module.
"class.php"),
null,
'warnings');
1981 if (function_exists(
'opcache_invalidate')) {
1984 clearstatcache(
true);
1985 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
''));
1992if ($dirins && ($action ==
'droptable' || $action ==
'droptableextrafields') && !empty($module) && !empty($tabobj) ) {
1993 $objectname = $tabobj;
1995 $arrayoftables = array();
1996 if ($action ==
'droptable') {
1997 $arrayoftables[] = MAIN_DB_PREFIX.strtolower($module).
'_'.strtolower($tabobj);
1999 if ($action ==
'droptableextrafields') {
2000 $arrayoftables[] = MAIN_DB_PREFIX.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields';
2003 foreach ($arrayoftables as $tabletodrop) {
2005 $sql =
"SELECT COUNT(*) as nb FROM ".$tabletodrop;
2006 $resql =
$db->query($sql);
2008 $obj =
$db->fetch_object($resql);
2010 $nb = (int) $obj->nb;
2013 if (
$db->lasterrno() ==
'DB_ERROR_NOSUCHTABLE') {
2014 setEventMessages($langs->trans(
"TableDoesNotExists", $tabletodrop),
null,
'warnings');
2020 $resql =
$db->DDLDropTable($tabletodrop);
2022 setEventMessages($langs->trans(
"TableDropped", $tabletodrop),
null,
'mesgs');
2023 } elseif ($nb > 0) {
2024 setEventMessages($langs->trans(
"TableNotEmptyDropCanceled", $tabletodrop),
null,
'warnings');
2029if ($dirins && $action ==
'addproperty' && empty($cancel) && !empty($module) && (!empty($tabobj) || !empty(
GETPOST(
'obj'))) ) {
2034 $dirins = $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
2035 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
2037 $srcdir = $dirread.
'/'.strtolower($module);
2038 $destdir = $dirins.
'/'.strtolower($module);
2042 if (!in_array($objectname, array_values($objects))) {
2044 setEventMessages($langs->trans(
"ErrorObjectNotFound", $langs->transnoentities($objectname)),
null,
'errors');
2047 $addfieldentry = array();
2050 if (!
GETPOST(
'regenerateclasssql') && !
GETPOST(
'regeneratemissing')) {
2051 if (!
GETPOST(
'propname',
'aZ09')) {
2053 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Name")),
null,
'errors');
2055 if (!
GETPOST(
'proplabel',
'alpha')) {
2057 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
2059 if (!
GETPOST(
'proptype',
'alpha')) {
2061 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Type")),
null,
'errors');
2065 if (!$error && !
GETPOST(
'regenerateclasssql') && !
GETPOST(
'regeneratemissing')) {
2069 $proptype =
GETPOST(
'proptype',
'alpha');
2070 if (strpos($proptype,
':') ===
false && strpos($proptype,
'_') ===
false) {
2071 $proptype = strtolower($proptype);
2073 $addfieldentry = array(
2074 'name' =>
GETPOST(
'propname',
'aZ09'),
2075 'label' =>
GETPOST(
'proplabel',
'alpha'),
2076 'type' => $proptype,
2077 'arrayofkeyval' =>
GETPOST(
'proparrayofkeyval',
'nohtml'),
2078 'visible' =>
GETPOST(
'propvisible',
'alphanohtml'),
2079 'enabled' =>
GETPOST(
'propenabled',
'alphanohtml'),
2083 'foreignkey' =>
GETPOST(
'propforeignkey',
'alpha'),
2085 'isameasure' =>
GETPOSTINT(
'propisameasure'),
2086 'showoncombobox' =>
GETPOSTINT(
'propshowoncombobox'),
2087 'comment' =>
GETPOST(
'propcomment',
'alpha'),
2088 'help' =>
GETPOST(
'prophelp',
'alpha'),
2089 'css' =>
GETPOST(
'propcss',
'alpha'),
2090 'cssview' =>
GETPOST(
'propcssview',
'alpha'),
2091 'csslist' =>
GETPOST(
'propcsslist',
'alpha'),
2092 'default' =>
GETPOST(
'propdefault',
'restricthtml'),
2093 'noteditable' =>
GETPOSTINT(
'propnoteditable'),
2098 if (!empty($addfieldentry[
'arrayofkeyval']) && !is_array($addfieldentry[
'arrayofkeyval'])) {
2099 $tmpdecode = json_decode($addfieldentry[
'arrayofkeyval'],
true);
2101 $addfieldentry[
'arrayofkeyval'] = $tmpdecode;
2104 $addfieldentry[
'arrayofkeyval'] = $tmparray;
2116 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
2123 if (is_numeric($object) && $object <= 0) {
2124 $pathoffiletoeditsrc = $destdir.
'/class/'.strtolower($objectname).
'.class.php';
2125 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $pathoffiletoeditsrc),
null,
'errors');
2131 if (!$error && $object !==
null) {
2132 $result =
rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object, $moduletype);
2135 setEventMessages($langs->trans(
'ErrorFailToCreateFile',
'.sql'),
null,
'errors');
2141 clearstatcache(
true);
2143 setEventMessages($langs->trans(
'FilesForObjectUpdated', $objectname),
null);
2148 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj='.$objectname.
'&nocache='.time());
2153if ($dirins && $action ==
'confirm_deleteproperty' && $propertykey ) {
2154 $objectname = $tabobj;
2156 $dirins = $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
2157 $moduletype = $listofmodules[strtolower($module)][
'moduletype'];
2159 $srcdir = $dirread.
'/'.strtolower($module);
2160 $destdir = $dirins.
'/'.strtolower($module);
2168 if (is_numeric($object) && $object <= 0) {
2169 $pathoffiletoeditsrc = $destdir.
'/class/'.strtolower($objectname).
'.class.php';
2170 setEventMessages($langs->trans(
'ErrorFailToCreateFile', $pathoffiletoeditsrc),
null,
'errors');
2176 if (!$error && $object !==
null) {
2177 $result =
rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object);
2180 setEventMessages($langs->trans(
'ErrorFailToCreateFile',
'.sql'),
null,
'errors');
2186 setEventMessages($langs->trans(
'FilesForObjectUpdated', $objectname),
null);
2188 clearstatcache(
true);
2191 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj='.$objectname);
2196if ($dirins && $action ==
'confirm_deletemodule' ) {
2197 if (preg_match(
'/[^a-z0-9_]/i', $module)) {
2199 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
2203 $modulelowercase = strtolower($module);
2206 $dir = $dirins.
'/'.$modulelowercase;
2208 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2218 $class =
'mod'.$module;
2222 if (class_exists($class)) {
2225 '@phan-var-force DolibarrModules $moduleobj';
2233 $langs->load(
"errors");
2234 setEventMessages($langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module),
null,
'warnings');
2246 clearstatcache(
true);
2247 if (function_exists(
'opcache_invalidate')) {
2251 header(
"Location: ".$_SERVER[
"PHP_SELF"].
'?module=deletemodule');
2259 $module =
'deletemodule';
2262if ($dirins && $action ==
'confirm_deleteobject' && $objectname ) {
2263 if (preg_match(
'/[^a-z0-9_]/i', $objectname)) {
2265 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
2269 $modulelowercase = strtolower($module);
2270 $objectlowercase = strtolower($objectname);
2273 $dir = $dirins.
'/'.$modulelowercase;
2278 }
catch (\InvalidArgumentException $e) {
2280 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
2284 if (!$error && $ncObjDel !==
null) {
2286 'myobject_card.php',
2287 'myobject_note.php',
2288 'myobject_contact.php',
2289 'myobject_document.php',
2290 'myobject_agenda.php',
2291 'myobject_list.php',
2292 'admin/myobject_extrafields.php',
2293 'lib/mymodule_myobject.lib.php',
2294 'sql/llx_mymodule_myobject.sql',
2295 'sql/llx_mymodule_myobject_extrafields.sql',
2296 'sql/llx_mymodule_myobject.key.sql',
2297 'sql/llx_mymodule_myobject_extrafields.key.sql',
2298 'scripts/myobject.php',
2299 'class/myobject.class.php',
2300 'class/myobjectstats.class.php',
2301 'core/modules/mymodule/mod_myobject_advanced.php',
2302 'core/modules/mymodule/mod_myobject_standard.php',
2303 'core/modules/mymodule/modules_myobject.php',
2304 'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php',
2305 'core/modules/mymodule/doc/pdf_standard_myobject.modules.php',
2306 'stats/myobject_index.php',
2307 ] as $templateFile) {
2308 $filetodelete[$templateFile] = $ncObjDel->applyToFilename($templateFile);
2311 $filetodelete[
'ajax/myobject.lib.php'] =
'ajax/' . $ncObjDel->objectNameLower .
'.php';
2312 $filetodelete[
'test/phpunit/MyObjectTest.php'] =
'test/phpunit/' . $ncObjDel->objectNameLower .
'Test.php';
2313 $filetodelete[
'class/api_myobject.class.php'] =
'class/api_' . $ncObjDel->moduleNameLower .
'.class.php';
2318 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2320 $class =
'mod'.$module;
2322 if (class_exists($class)) {
2325 '@phan-var-force DolibarrModules $moduleobj';
2333 $langs->load(
"errors");
2334 dol_print_error(
$db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
2337 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2343 if ($rewriteMenu < 0) {
2344 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Menus"),
"mod".$module.
"class.php"),
null,
'warnings');
2346 reWriteAllMenus($moduledescriptorfile, $menus, $objectname,
null, -1);
2352 if ($rewritePerms < 0) {
2353 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Permissions"),
"mod".$module.
"class.php"),
null,
'warnings');
2359 if ($rewritePerms && $rewriteMenu) {
2361 $file_doc = $dirins.
'/'.strtolower($module).
'/doc/Documentation.asciidoc';
2364 clearstatcache(
true);
2365 if (function_exists(
'opcache_invalidate')) {
2369 foreach ($filetodelete as $tmpfiletodelete) {
2371 $resulttmp =
dol_delete_file($dir.
'/'.$tmpfiletodelete.
'.back', 1, 0, 1);
2377 if ($resultko == 0) {
2380 setEventMessages($langs->trans(
"ErrorSomeFilesCouldNotBeDeleted"),
null,
'warnings');
2387 $tabobj =
'newobject';
2389 $tabobj =
'deleteobject';
2394 $result = unActivateModule(strtolower($module));
2399 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
2400 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=objects&tabobj=deleteobject&module='.urlencode($module));
2405if (($dirins && $action ==
'confirm_deletedictionary' && $dicname) || ($dirins && $action ==
'confirm_deletedictionary' &&
GETPOST(
'dictionnarykey')) ) {
2406 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2407 $destdir = $dirins.
'/'.strtolower($module);
2408 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2410 if (preg_match(
'/[^a-z0-9_]/i', $dicname)) {
2412 setEventMessages($langs->trans(
"SpaceOrSpecialCharAreNotAllowed"),
null,
'errors');
2415 if (!empty($dicname)) {
2416 $newdicname = $dicname;
2417 if (!preg_match(
'/^c_/', $newdicname)) {
2418 $newdicname =
'c_'.strtolower($dicname);
2425 $class =
'mod'.$module;
2428 if (class_exists($class)) {
2431 '@phan-var-force DolibarrModules $moduleobj';
2441 $langs->load(
"errors");
2442 dol_print_error(
$db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
2448 if ($checkComment < 0) {
2450 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Dictionaries"),
"mod".$module.
"class.php"),
null,
'warnings');
2453 if (!empty(
GETPOST(
'dictionnarykey'))) {
2454 $newdicname = $dicts[
'tabname'][
GETPOSTINT(
'dictionnarykey') - 1];
2458 $checkTable =
false;
2459 if ($newdicname !==
null) {
2460 $checkTable =
$db->DDLDescTable(MAIN_DB_PREFIX.strtolower($newdicname));
2463 if (is_bool($checkTable) ||
$db->num_rows($checkTable) <= 0) {
2468 $keyToDelete =
null;
2469 foreach ($dicts[
'tabname'] as $key => $table) {
2471 if (strtolower($table) === $newdicname) {
2472 $keyToDelete = $key;
2477 if ($keyToDelete !==
null) {
2478 $keysToDelete = [
'tabname',
'tablib',
'tabsql',
'tabsqlsort',
'tabfield',
'tabfieldvalue',
'tabfieldinsert',
'tabrowid',
'tabcond',
'tabhelp'];
2479 foreach ($keysToDelete as $key) {
2480 unset($dicts[$key][$keyToDelete]);
2484 setEventMessages($langs->trans(
"ErrorDictionaryNotFound", ucfirst($dicname)),
null,
'errors');
2486 if (!$error && $newdicname !==
null) {
2488 $_results =
$db->DDLDropTable(MAIN_DB_PREFIX.strtolower($newdicname));
2489 if ($_results < 0) {
2491 $langs->load(
"errors");
2492 setEventMessages($langs->trans(
"ErrorTableNotFound", $newdicname),
null,
'errors');
2497 setEventMessages($langs->trans(
"DictionaryDeleted", ucfirst(substr($newdicname, 2))),
null);
2499 if (function_exists(
'opcache_invalidate')) {
2502 clearstatcache(
true);
2503 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
''));
2507if ($dirins && $action ==
'updatedictionary' &&
GETPOST(
'dictionnarykey') ) {
2508 $keydict =
GETPOSTINT(
'dictionnarykey') - 1 ;
2510 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2511 $destdir = $dirins.
'/'.strtolower($module);
2512 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2514 $class =
'mod'.$module;
2517 if (class_exists($class)) {
2520 '@phan-var-force DolibarrModules $moduleobj';
2530 $langs->load(
"errors");
2531 dol_print_error(
$db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
2536 if (!empty(
GETPOST(
'tablib')) &&
GETPOST(
'tablib') !== $dicts[
'tablib'][$keydict]) {
2537 $dicts[
'tablib'][$keydict] = ucfirst(strtolower(
GETPOST(
'tablib')));
2539 if ($checkComment < 0) {
2540 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Dictionaries"),
"mod".$module.
"class.php"),
null,
'warnings');
2543 if ($updateDict > 0) {
2546 if (function_exists(
'opcache_invalidate')) {
2549 clearstatcache(
true);
2550 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
''));
2556if ($dirins && $action ==
'generatedoc' ) {
2557 $modulelowercase = strtolower($module);
2562 $FILENAMEDOC = strtolower($module).
'.html';
2565 $result = $util->generateDoc($module);
2568 setEventMessages($langs->trans(
"DocFileGeneratedInto", $dirofmodule),
null);
2574if ($dirins && $action ==
'generatepackage' ) {
2575 $modulelowercase = strtolower($module);
2577 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2587 $class =
'mod'.$module;
2590 if (class_exists($class)) {
2593 '@phan-var-force DolibarrModules $moduleobj';
2603 $langs->load(
"errors");
2604 dol_print_error(
$db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
2608 $arrayversion = explode(
'.',
$moduleobj->version, 3);
2609 if (count($arrayversion)) {
2610 $FILENAMEZIP =
"module_".$modulelowercase.
'-'.$arrayversion[0].(empty($arrayversion[1]) ?
'.0' :
'.'.$arrayversion[1]).(empty($arrayversion[2]) ?
'' :
'.'.$arrayversion[2]).
'.zip';
2613 $outputfilezip = $dirofmodule.
'/'.$FILENAMEZIP;
2619 $result = dol_compress_dir($dir, $outputfilezip,
'zip',
'/\/bin\/|\.git|\.old|\.back|\.ssh/', $modulelowercase);
2622 setEventMessages($langs->trans(
"ZipFileGeneratedInto", $outputfilezip),
null);
2625 $langs->load(
"errors");
2626 setEventMessages($langs->trans(
"ErrorFailToGenerateFile", $outputfilezip),
null,
'errors');
2630 $langs->load(
"errors");
2631 setEventMessages($langs->trans(
"ErrorCheckVersionIsDefined"),
null,
'errors');
2636if ($dirins && $action ==
'addright' && !empty($module) && empty($cancel) ) {
2640 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2642 $class =
'mod'.$module;
2644 if (class_exists($class)) {
2647 '@phan-var-force DolibarrModules $moduleobj';
2656 if (!
GETPOST(
'label',
'alpha')) {
2658 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
2660 if (!
GETPOST(
'permissionObj',
'alpha')) {
2662 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Rights")),
null,
'errors');
2665 $label =
GETPOST(
'label',
'alpha');
2666 $objectForPerms = strtolower(
GETPOST(
'permissionObj',
'alpha'));
2667 $crud =
GETPOST(
'crud',
'alpha');
2671 $permsForObject = array();
2675 $permissions = array();
2677 $allObject = array();
2679 $countPerms = count($permissions);
2681 for ($i = 0; $i < $countPerms; $i++) {
2682 if ($permissions[$i][4] == $objectForPerms) {
2684 if (count($permsForObject) < 3) {
2685 $permsForObject[] = $permissions[$i];
2688 $allObject[] = $permissions[$i][4];
2692 $countPermsObj = count($permsForObject);
2693 for ($j = 0; $j < $countPermsObj; $j++) {
2694 if (in_array($crud, $permsForObject[$j])) {
2696 setEventMessages($langs->trans(
"ErrorExistingPermission", $langs->transnoentities($crud), $langs->transnoentities($objectForPerms)),
null,
'errors');
2702 $result = unActivateModule(strtolower($module));
2707 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
2710 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2714 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Permissions"),
"mod".$module.
"class.php"),
null,
'warnings');
2717 if (!$reportPerms->hasConflicts()) {
2720 clearstatcache(
true);
2721 if (function_exists(
'opcache_invalidate')) {
2724 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=permissions&module='.$module);
2733if ($dirins &&
GETPOST(
'action') ==
'update_right' &&
GETPOST(
'modifyright') && empty($cancel) ) {
2736 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2738 $class =
'mod'.$module;
2740 if (class_exists($class)) {
2743 '@phan-var-force DolibarrModules $moduleobj';
2751 if (!
GETPOST(
'label',
'alpha')) {
2753 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label")),
null,
'errors');
2755 if (!
GETPOST(
'permissionObj',
'alpha')) {
2757 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Rights")),
null,
'errors');
2760 $label =
GETPOST(
'label',
'alpha');
2761 $objectForPerms = strtolower(
GETPOST(
'permissionObj',
'alpha'));
2762 $crud =
GETPOST(
'crud',
'alpha');
2765 if ($label ==
"Read objects of $module" && $crud !=
"read") {
2769 if ($label ==
"Create/Update objects of $module" && $crud !=
"write") {
2773 if ($label ==
"Delete objects of $module" && $crud !=
"delete") {
2785 if (array_key_exists($key, $permissions)) {
2786 $x1 = $permissions[$key][1];
2787 $x2 = $permissions[$key][4];
2788 $x3 = $permissions[$key][5];
2796 $permsForObject = array();
2800 $allObject = array();
2802 $countPerms = count($permissions);
2803 for ($i = 0; $i < $countPerms; $i++) {
2804 if ($permissions[$i][4] == $objectForPerms) {
2806 if (count($permsForObject) < 3) {
2807 $permsForObject[] = $permissions[$i];
2810 $allObject[] = $permissions[$i][4];
2813 if ($label != $x1 && $crud != $x3) {
2814 $countPermsObj = count($permsForObject);
2815 for ($j = 0; $j < $countPermsObj; $j++) {
2816 if (in_array($label, $permsForObject[$j])) {
2818 setEventMessages($langs->trans(
"ErrorExistingPermission", $langs->transnoentities($label), $langs->transnoentities($objectForPerms)),
null,
'errors');
2825 $result = unActivateModule(strtolower($module));
2830 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
2833 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2837 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Permissions"),
"mod".$module.
"class.php"),
null,
'warnings');
2840 if (!$reportPerms->hasConflicts()) {
2842 clearstatcache(
true);
2843 if (function_exists(
'opcache_invalidate')) {
2846 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=permissions&module='.$module);
2853if ($dirins && $action ==
'confirm_deleteright' && !empty($module) &&
GETPOSTINT(
'permskey') ) {
2856 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
2858 $class =
'mod'.$module;
2860 if (class_exists($class)) {
2863 '@phan-var-force DolibarrModules $moduleobj';
2877 $result = unActivateModule(strtolower($module));
2882 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
2883 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=permissions&module='.$module);
2888 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
2891 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Permissions"),
"mod".$module.
"class.php"),
null,
'warnings');
2894 if (!$reportPerms->hasConflicts()) {
2897 clearstatcache(
true);
2898 if (function_exists(
'opcache_invalidate')) {
2902 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=permissions&module='.$module);
2909if ($action ==
'savefile' && empty($cancel) ) {
2910 $relofcustom = basename($dirins);
2914 if (!preg_match(
'/^'.$relofcustom.
'/', $file)) {
2915 $file = $relofcustom.
'/'.$file;
2923 dol_copy($pathoffile, $pathoffilebackup,
'0', 1);
2926 $check =
'restricthtml';
2928 if ($srclang ==
'md') {
2929 $check =
'restricthtml';
2931 if ($srclang ==
'lang') {
2932 $check =
'restricthtml';
2934 if ($srclang ==
'php') {
2938 $content =
GETPOST(
'editfilecontent', $check);
2943 $result = file_put_contents($pathoffile, $content);
2960if ($action ==
'set' && $user->admin ) {
2963 $param .=
'&module='.urlencode($module);
2966 $param .=
'&tab='.urlencode($tab);
2967 $param .=
'&tabobj='.urlencode($tabobj);
2969 $value =
GETPOST(
'value',
'alpha');
2970 $resarray = activateModule($value, 1, 0);
2971 if (!empty($resarray[
'errors'])) {
2975 if ($resarray[
'nbperms'] > 0) {
2976 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
2977 $resqltmp =
$db->query($tmpsql);
2979 $obj =
$db->fetch_object($resqltmp);
2981 if ($obj && $obj->nb > 1) {
2982 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
2990 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?".$param);
2995if ($action ==
'reset' && $user->admin ) {
2998 $param .=
'&module='.urlencode($module);
3000 $param .=
'&tab='.urlencode($tab);
3001 $param .=
'&tabobj='.urlencode($tabobj);
3003 $value =
GETPOST(
'value',
'alpha');
3004 $result = unActivateModule(strtolower($value));
3008 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?".$param);
3013if ($dirins && $action ==
'confirm_deletemenu' &&
GETPOSTINT(
'menukey') ) {
3016 $result = unActivateModule(strtolower($module));
3021 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
3022 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
3026 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3028 $class =
'mod'.$module;
3030 if (class_exists($class)) {
3033 '@phan-var-force DolibarrModules $moduleobj';
3041 $dir = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
3042 $destdir = $dir.
'/'.strtolower($module);
3044 $result = array_map(
'strtolower', $objects);
3048 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
3051 if ($checkcomment < 0) {
3052 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Menus"),
"mod".$module.
"class.php"),
null,
'warnings');
3054 if ($menus[$key][
'fk_menu'] ===
'fk_mainmenu='.strtolower($module)) {
3055 if (in_array(strtolower($menus[$key][
'leftmenu']), $result)) {
3056 reWriteAllMenus($moduledescriptorfile, $menus, $menus[$key][
'leftmenu'], $key, -1);
3064 clearstatcache(
true);
3065 if (function_exists(
'opcache_invalidate')) {
3070 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
3076if ($dirins && $action ==
'addmenu' && empty($cancel) ) {
3079 $result = unActivateModule(strtolower($module));
3084 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
3085 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
3091 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3093 $class =
'mod'.$module;
3095 if (class_exists($class)) {
3098 '@phan-var-force DolibarrModules $moduleobj';
3109 if (!
GETPOST(
'type',
'alpha')) {
3111 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Type")),
null,
'errors');
3113 if (!
GETPOST(
'titre',
'alpha')) {
3115 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Title")),
null,
'errors');
3117 if (!
GETPOST(
'user',
'alpha')) {
3119 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"DetailUser")),
null,
'errors');
3121 if (!
GETPOST(
'url',
'alpha')) {
3123 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Url")),
null,
'errors');
3125 if (!empty(
GETPOST(
'target'))) {
3126 $targets = array(
'_blank',
'_self',
'_parent',
'_top',
'');
3127 if (!in_array(
GETPOST(
'target'), $targets)) {
3129 setEventMessages($langs->trans(
"ErrorFieldValue", $langs->transnoentities(
"target")),
null,
'errors');
3136 foreach ($menus as $menu) {
3139 setEventMessages($langs->trans(
"ErrorFieldExist", $langs->transnoentities(
"url")),
null,
'errors');
3142 if (strtolower(
GETPOST(
'titre')) == strtolower($menu[
'titre'])) {
3144 setEventMessages($langs->trans(
"ErrorFieldExist", $langs->transnoentities(
"titre")),
null,
'errors');
3149 if (
GETPOST(
'type',
'alpha') ==
'left' && !empty(
GETPOST(
'lefmenu',
'alpha'))) {
3150 if (!str_contains(
GETPOST(
'leftmenu'), strtolower($module))) {
3152 setEventMessages($langs->trans(
"WarningFieldsMustContains", $langs->transnoentities(
"LeftmenuId")),
null,
'errors');
3155 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
3156 $destdir = $dirins.
'/'.strtolower($module);
3159 if (
GETPOST(
'type',
'alpha') ==
'left') {
3160 if (empty(
GETPOST(
'leftmenu')) && count($objects) > 0) {
3162 setEventMessages($langs->trans(
"ErrorCoherenceMenu", $langs->transnoentities(
"LeftmenuId"), $langs->transnoentities(
"type")),
null,
'errors');
3165 if (
GETPOST(
'type',
'alpha') ==
'top') {
3167 setEventMessages($langs->trans(
"ErrorTypeMenu", $langs->transnoentities(
"type")),
null,
'errors');
3170 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
3174 'fk_menu' =>
GETPOST(
'fk_menu',
'alpha'),
3175 'type' =>
GETPOST(
'type',
'alpha'),
3176 'titre' => ucfirst(
GETPOST(
'titre',
'alpha')),
3178 'mainmenu' =>
GETPOST(
'mainmenu',
'alpha'),
3179 'leftmenu' =>
GETPOST(
'leftmenu',
'alpha'),
3180 'url' =>
GETPOST(
'url',
'alpha'),
3181 'langs' => strtolower($module).
"@".strtolower($module),
3183 'enabled' =>
GETPOST(
'enabled',
'alpha'),
3184 'perms' =>
'$user->hasRight("'.strtolower($module).
'", "'.
GETPOST(
'objects',
'alpha').
'", "'.
GETPOST(
'perms',
'alpha').
'")',
3185 'target' =>
GETPOST(
'target',
'alpha'),
3189 if (
GETPOST(
'type') ==
'left') {
3190 unset($menuToAdd[
'prefix']);
3191 if (empty(
GETPOST(
'fk_menu'))) {
3192 $menuToAdd[
'fk_menu'] =
'fk_mainmenu='.GETPOST(
'mainmenu',
'alpha');
3194 $menuToAdd[
'fk_menu'] =
'fk_mainmenu='.GETPOST(
'mainmenu',
'alpha').
',fk_leftmenu='.
GETPOST(
'fk_menu');
3197 if (
GETPOST(
'enabled') ==
'1') {
3198 $menuToAdd[
'enabled'] =
'isModEnabled("'.strtolower($module).
'")';
3200 $menuToAdd[
'enabled'] =
"0";
3202 if (empty(
GETPOST(
'objects'))) {
3203 $menuToAdd[
'perms'] =
'1';
3207 if ($checkcomment < 0) {
3208 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Menus"),
"mod".$module.
"class.php"),
null,
'warnings');
3211 $result =
reWriteAllMenus($moduledescriptorfile, $menus, $menuToAdd,
null, 1);
3213 clearstatcache(
true);
3214 if (function_exists(
'opcache_invalidate')) {
3223 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
3231if ($dirins && $action ==
"update_menu" &&
GETPOSTINT(
'menukey') &&
GETPOST(
'tabobj') ) {
3232 $objectname =
GETPOST(
'tabobj');
3233 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
3234 $destdir = $dirins.
'/'.strtolower($module);
3237 if (empty($cancel)) {
3239 $result = unActivateModule(strtolower($module));
3244 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
3245 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
3250 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3252 $class =
'mod'.$module;
3254 if (class_exists($class)) {
3257 '@phan-var-force DolibarrModules $moduleobj';
3267 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
3269 $menuModify = array(
3270 'fk_menu' =>
GETPOST(
'fk_menu',
'alpha'),
3271 'type' =>
GETPOST(
'type',
'alpha'),
3272 'titre' => ucfirst(
GETPOST(
'titre',
'alpha')),
3274 'mainmenu' =>
GETPOST(
'mainmenu',
'alpha'),
3275 'leftmenu' => $menus[$key][
'leftmenu'],
3276 'url' =>
GETPOST(
'url',
'alpha'),
3277 'langs' => strtolower($module).
"@".strtolower($module),
3279 'enabled' =>
GETPOST(
'enabled',
'alpha'),
3280 'perms' =>
GETPOST(
'perms',
'alpha'),
3281 'target' =>
GETPOST(
'target',
'alpha'),
3284 if (!empty(
GETPOST(
'fk_menu')) &&
GETPOST(
'fk_menu') != $menus[$key][
'fk_menu']) {
3285 $menuModify[
'fk_menu'] =
'fk_mainmenu='.GETPOST(
'mainmenu').
',fk_leftmenu='.
GETPOST(
'fk_menu');
3286 } elseif (
GETPOST(
'fk_menu') == $menus[$key][
'fk_menu']) {
3287 $menuModify[
'fk_menu'] = $menus[$key][
'fk_menu'];
3289 $menuModify[
'fk_menu'] =
'fk_mainmenu='.GETPOST(
'mainmenu');
3291 if ($menuModify[
'enabled'] ===
'') {
3292 $menuModify[
'enabled'] =
'1';
3294 if ($menuModify[
'perms'] ===
'') {
3295 $menuModify[
'perms'] =
'1';
3298 if (
GETPOST(
'type',
'alpha') ==
'top') {
3300 setEventMessages($langs->trans(
"ErrorTypeMenu", $langs->transnoentities(
"type")),
null,
'errors');
3307 if ($checkComment < 0) {
3308 setEventMessages($langs->trans(
"WarningCommentNotFound", $langs->trans(
"Menus"),
"mod".$module.
"class.php"),
null,
'warnings');
3311 $result =
reWriteAllMenus($moduledescriptorfile, $menus, $menuModify, $key, 2);
3313 clearstatcache(
true);
3314 if (function_exists(
'opcache_invalidate')) {
3321 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));
3326 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
3331 $_POST[
'type'] =
'';
3332 $_POST[
'titre'] =
'';
3333 $_POST[
'fk_menu'] =
'';
3334 $_POST[
'leftmenu'] =
'';
3340if ($dirins && $action ==
"update_props_module" && !empty(
GETPOST(
'keydescription',
'alpha')) && empty($cancel) ) {
3342 $result = unActivateModule(strtolower($module));
3347 setEventMessages($langs->trans(
'WarningModuleNeedRefresh', $langs->transnoentities($module)),
null,
'warnings');
3348 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=menus&module='.$module);
3351 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3352 $moduledescriptorfile = $dirins.
'/'.strtolower($module).
'/core/modules/mod'.$module.
'.class.php';
3353 $modulelogfile = $dirins.
'/'.strtolower($module).
'/ChangeLog.md';
3357 $class =
'mod'.$module;
3359 if (class_exists($class)) {
3362 '@phan-var-force DolibarrModules $moduleobj';
3370 $keydescription =
GETPOST(
'keydescription',
'alpha');
3371 switch ($keydescription) {
3373 $propertyToUpdate =
'description';
3380 $propertyToUpdate = $keydescription;
3383 $error =
GETPOST(
'keydescription');
3387 if (isset($propertyToUpdate) && !empty(
GETPOST(
'propsmodule'))) {
3388 $newValue =
GETPOST(
'propsmodule');
3389 $patternToFindLine =
'^\s*\$this->'.$propertyToUpdate.
'\s*=';
3390 $newLine =
"\t\t\$this->$propertyToUpdate = '$newValue';\n";
3392 $fileLines = file($moduledescriptorfile);
3395 foreach ($fileLines as &$line) {
3396 if (preg_match(
'/'.$patternToFindLine.
'/', $line)) {
3397 $result =
dolReplaceInFile($moduledescriptorfile, array($line => $newLine));
3400 } elseif ($result <= -1) {
3401 $langs->load(
"errors");
3402 setEventMessages($langs->trans(
'ErrorFailToEditFile', $moduledescriptorfile),
null,
'warnings');
3410 if ($changedone && $propertyToUpdate ===
'version') {
3414 clearstatcache(
true);
3415 if (function_exists(
'opcache_invalidate')) {
3419 setEventMessages($langs->trans(
'PropertyModuleUpdated', $propertyToUpdate),
null);
3424 header(
"Location: ".DOL_URL_ROOT.
'/modulebuilder/index.php?tab=description&module='.$module);
3445 '/includes/ace/src/ace.js',
3446 '/includes/ace/src/ext-statusbar.js',
3447 '/includes/ace/src/ext-language_tools.js',
3452llxHeader(
'', $langs->trans(
"ModuleBuilder"), $help_url,
'', 0, 0, $morejs, $morecss,
'',
'classforhorizontalscrolloftabs');
3455$text = $langs->trans(
"ModuleBuilder");
3457$morehtmlright =
'<a href="'.DOL_URL_ROOT.
'/admin/tools/ui/index.php" target="_blank" rel="noopener">'.
img_picto(
'',
'book',
'class="pictofixedwidth"').$langs->trans(
"UxComponentsDoc").
'</a>';
3461print
'<div class="info hideonsmartphone">';
3462print $langs->trans(
"ModuleBuilderDesc",
'https://wiki.dolibarr.org/index.php/Module_development').
'</span>';
3468 $message =
info_admin($langs->trans(
"ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.
'/custom', DOL_DOCUMENT_ROOT));
3473 $langs->load(
"errors");
3474 $message =
info_admin($langs->trans(
"ErrorFailedToWriteInDir", $dirins));
3478 $message =
info_admin($langs->trans(
"NotExistsDirect", $dirins).$langs->trans(
"InfDirAlt").$langs->trans(
"InfDirExample"));
3487$infomodulesfound =
'<div style="padding: 12px 9px 12px">'.$form->textwithpicto(
'', $langs->trans(
"ModuleBuilderDesc3", count($listofmodules)).
'<br><br>'.$langs->trans(
"ModuleBuilderDesc4", $FILEFLAG).
'<br>'.$textforlistofdirs).
'</div>';
3491$dolibarrdataroot = preg_replace(
'/([\\/]+)$/i',
'', DOL_DATA_ROOT);
3492$allowonlineinstall =
true;
3493if (
dol_is_file($dolibarrdataroot.
'/installmodules.lock')) {
3494 $allowonlineinstall =
false;
3496if (empty($allowonlineinstall)) {
3499 $message =
info_admin($langs->trans(
'InstallModuleFromWebHasBeenDisabledContactUs'));
3502 $message =
info_admin($langs->trans(
"InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.
'/installmodules.lock'), 0, 0,
'1',
'warning');
3517if (!empty($module) && $module !=
'initmodule' && $module !=
'deletemodule') {
3518 $modulelowercase = strtolower($module);
3519 $loadclasserrormessage =
'';
3524 $fullpathdirtodescriptor = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3529 $class =
'mod'.$module;
3530 }
catch (Throwable $e) {
3531 $loadclasserrormessage = $e->getMessage().
"<br>\n";
3532 $loadclasserrormessage .=
'File: '.$e->getFile().
"<br>\n";
3533 $loadclasserrormessage .=
'Line: '.$e->getLine().
"<br>\n";
3537 if (class_exists($class)) {
3540 '@phan-var-force DolibarrModules $moduleobj';
3544 print $e->getMessage();
3547 if (empty($forceddirread)) {
3550 $langs->load(
"errors");
3551 print
'<!-- ErrorFailedToLoadModuleDescriptorForXXX -->';
3552 print
img_warning(
'').
' '.$langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module).
'<br>';
3553 print $loadclasserrormessage;
3563$head[$h][0] = $_SERVER[
"PHP_SELF"].
'?module=initmodule';
3564$head[$h][1] =
'<span class="valignmiddle text-plus-circle">'.$langs->trans(
"NewModule").
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
3565$head[$h][2] =
'initmodule';
3568$linktoenabledisable =
'';
3570if ( count($listofmodules) > 0) {
3572 $modulelowercase = strtolower($module);
3576 $param .=
'&module='.urlencode($module);
3579 $param .=
'&tab='.urlencode($tab);
3580 $param .=
'&tabobj='.urlencode($tabobj);
3582 $urltomodulesetup =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?search_keyword='.urlencode($module).
'">'.$langs->trans(
'Home').
'-'.$langs->trans(
"Setup").
'-'.$langs->trans(
"Modules").
'</a>';
3586 $linktoenabledisable .=
'<a class="reposition asetresetmodule valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$moduleobj->numero.
'&action=reset&token='.
newToken().
'&value=mod'.$module.$param.
'">';
3587 $linktoenabledisable .=
img_picto($langs->trans(
"Warning").
' : '.$langs->trans(
"ModuleIsLive"),
'switch_on',
'', 0, 0, 0,
'',
'warning valignmiddle', 1);
3588 $linktoenabledisable .=
'</a>';
3593 $backtourlparam =
'';
3594 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'module='.$module;
3595 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'tab='.$tab;
3596 $backtourl = $_SERVER[
"PHP_SELF"].$backtourlparam;
3599 if (is_array($objMod->config_page_url)) {
3601 foreach ($objMod->config_page_url as $page) {
3604 $linktoenabledisable .=
' <a class="valignmiddle" href="'.$urlpage.
'" title="'.$langs->trans($page).
'">'.
img_picto(ucfirst($page),
"setup").
'</a>';
3607 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
3608 $urltouse =
dol_buildpath(
'/'.$regs[2].
'/admin/'.$regs[1], 1);
3609 $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>';
3613 $urltouse = DOL_URL_ROOT.
'/admin/'.$urlpage;
3614 $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>';
3618 } elseif (preg_match(
'/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) {
3619 $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>';
3623 $linktoenabledisable .=
'<a class="reposition asetresetmodule valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$moduleobj->numero.
'&action=set&token='.
newToken().
'&value=mod'.$module.$param.
'">';
3624 $linktoenabledisable .=
img_picto($langs->trans(
"ModuleIsNotActive", $urltomodulesetup),
'switch_off',
'style="padding-right: 8px"', 0, 0, 0,
'',
'classfortooltip valignmiddle', 1);
3625 $linktoenabledisable .=
"</a>\n";
3630 foreach ($listofmodules as $tmpmodule => $tmpmodulearray) {
3631 $head[$h][0] = $_SERVER[
"PHP_SELF"].
'?module='.$tmpmodulearray[
'modulenamewithcase'].($forceddirread ?
'@'.$dirread :
'');
3632 $head[$h][1] = $tmpmodulearray[
'modulenamewithcase'];
3633 $head[$h][2] = $tmpmodulearray[
'modulenamewithcase'];
3635 if ($tmpmodulearray[
'modulenamewithcase'] == $module) {
3636 $head[$h][4] =
'<span class="inline-block valignmiddle">'.$linktoenabledisable.
'</span>';
3643$head[$h][0] = $_SERVER[
"PHP_SELF"].
'?module=deletemodule';
3644$head[$h][1] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"DangerZone");
3645$head[$h][2] =
'deletemodule';
3651if ($module ==
'initmodule') {
3653 print
'<!-- section init module -->'.
"\n";
3654 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3655 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3656 print
'<input type="hidden" name="action" value="initmodule">';
3657 print
'<input type="hidden" name="module" value="initmodule">';
3662 print
'<div class="tagtable table-border">';
3664 print
'<div class="tagtr"><div class="tagtd paddingright">';
3665 print
'<span class="opacitymedium">'.$langs->trans(
"IdModule").
'</span>';
3666 print
'</div><div class="tagtd">';
3667 print
'<input type="number" min="100000" name="idmodule" class="width100" value="500000">';
3668 print
'<span class="opacitymedium small">';
3669 print
' ';
3670 print
dolButtonToOpenUrlInDialogPopup(
'popup_modules_id', $langs->transnoentitiesnoconv(
"SeeIDsInUse"), $langs->transnoentitiesnoconv(
"SeeIDsInUse"),
'/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info&hidetitle=1',
'',
'');
3672 print
'<a href="https://wiki.dolibarr.org/index.php/List_of_modules_id" target="_blank" rel="noopener noreferrer external">'.$langs->trans(
"SeeReservedIDsRangeHere").
'</a>';
3674 print
'</div></div>';
3676 print
'<div class="tagtr"><div class="tagtd paddingright">';
3677 print
'<span class="opacitymedium fieldrequired">'.$langs->trans(
"ModuleName").
'</span>';
3678 print
'</div><div class="tagtd">';
3679 print
'<input type="text" name="modulename" value="'.dol_escape_htmltag($modulename).
'" autofocus>';
3680 print
' '.$form->textwithpicto(
'', $langs->trans(
"EnterNameOfModuleDesc"));
3681 print
'</div></div>';
3683 print
'<div class="tagtr"><div class="tagtd paddingright">';
3684 print
'<span class="opacitymedium">'.$langs->trans(
"Description").
'</span>';
3685 print
'</div><div class="tagtd">';
3686 print
'<input type="text" name="description" value="" class="minwidth500"><br>';
3687 print
'</div></div>';
3689 print
'<div class="tagtr"><div class="tagtd paddingright">';
3690 print
'<span class="opacitymedium">'.$langs->trans(
"Version").
'</span>';
3691 print
'</div><div class="tagtd">';
3692 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")).
'">';
3693 print
'</div></div>';
3695 print
'<div class="tagtr"><div class="tagtd paddingright">';
3696 print
'<span class="opacitymedium">'.$langs->trans(
"Family").
'</span>';
3697 print
'</div><div class="tagtd">';
3698 print
'<select name="family" id="family" class="minwidth400">';
3699 $arrayoffamilies = array(
3700 'hr' =>
"ModuleFamilyHr",
3701 'crm' =>
"ModuleFamilyCrm",
3702 'srm' =>
"ModuleFamilySrm",
3703 'financial' =>
'ModuleFamilyFinancial',
3704 'products' =>
'ModuleFamilyProducts',
3705 'projects' =>
'ModuleFamilyProjects',
3706 'ecm' =>
'ModuleFamilyECM',
3707 'technic' =>
'ModuleFamilyTechnic',
3708 'portal' =>
'ModuleFamilyPortal',
3709 'interface' =>
'ModuleFamilyInterface',
3710 'base' =>
'ModuleFamilyBase',
3711 'other' =>
'ModuleFamilyOther'
3713 foreach ($arrayoffamilies as $key => $value) {
3714 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>';
3718 print
'</div></div>';
3720 print
'<div class="tagtr"><div class="tagtd paddingright">';
3721 print
'<span class="opacitymedium">'.$langs->trans(
"Picto").
'</span>';
3722 print
'</div><div class="tagtd">';
3723 print
'<input type="text" name="idpicto" value="'.(GETPOSTISSET(
'idpicto') ?
GETPOST(
'idpicto') :
getDolGlobalString(
'MODULEBUILDER_DEFAULTPICTO',
'fa-file')).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"Picto")).
'">';
3724 print $form->textwithpicto(
'', $langs->trans(
"Example").
': fa-file, fa-globe, ... any font awesome code.<br>Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]');
3726 print
' ';
3728 print
'<span class="opacitymedium small">';
3729 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',
'',
'');
3732 print
'</div></div>';
3734 print
'<div class="tagtr"><div class="tagtd paddingright">';
3735 print
'<span class="opacitymedium">'.$langs->trans(
"EditorName").
'</span>';
3736 print
'</div><div class="tagtd">';
3737 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>';
3738 print
'</div></div>';
3740 print
'<div class="tagtr"><div class="tagtd paddingright">';
3741 print
'<span class="opacitymedium">'.$langs->trans(
"EditorUrl").
'</span>';
3742 print
'</div><div class="tagtd">';
3743 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>';
3744 print
'</div></div>';
3748 print
'<br><center>';
3749 print
'<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans(
"Create")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
3752} elseif ($module ==
'deletemodule') {
3753 print
'<!-- Form to init a module -->'.
"\n";
3754 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="delete">';
3755 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3756 print
'<input type="hidden" name="action" value="confirm_deletemodule">';
3757 print
'<input type="hidden" name="module" value="deletemodule">';
3759 print $langs->trans(
"EnterNameOfModuleToDeleteDesc").
'<br><br>';
3761 print
'<input type="text" name="module" placeholder="'.dol_escape_htmltag($langs->trans(
"ModuleKey")).
'" value="" autofocus>';
3762 print
'<input type="submit" class="button smallpaddingimp" value="'.$langs->trans(
"Delete").
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
3764} elseif (!empty($module) && $modulelowercase !==
null) {
3767 $dirread = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
3768 $destdir = $dirread.
'/'.strtolower($module);
3772 $countDictionaries = (!empty(
$moduleobj->dictionaries) ? count(
$moduleobj->dictionaries[
'tabname']) : 0);
3786 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=description&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3787 $head2[$h][1] = $langs->trans(
"Description");
3788 $head2[$h][2] =
'description';
3791 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3792 $head2[$h][1] = ((!is_array($objects) || count($objects) <= 0) ? $langs->trans(
"Objects") : $langs->trans(
"Objects").
'<span class="marginleftonlyshort badge">'.count($objects).
"</span>");
3793 $head2[$h][2] =
'objects';
3796 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=languages&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3797 $head2[$h][1] = ($countLangs <= 0 ? $langs->trans(
"Languages") : $langs->trans(
"Languages").
'<span class="marginleftonlyshort badge">'.$countLangs.
"</span>");
3798 $head2[$h][2] =
'languages';
3801 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=permissions&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3802 $head2[$h][1] = ($countRights <= 0 ? $langs->trans(
"Permissions") : $langs->trans(
"Permissions").
'<span class="marginleftonlyshort badge">'.$countRights.
"</span>");
3803 $head2[$h][2] =
'permissions';
3806 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3807 $head2[$h][1] = ($countDictionaries == 0 ? $langs->trans(
"Dictionaries") : $langs->trans(
'Dictionaries').
'<span class="marginleftonlyshort badge">'.$countDictionaries.
"</span>");
3808 $head2[$h][2] =
'dictionaries';
3811 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=tabs&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3812 $head2[$h][1] = $langs->trans(
"Tabs");
3813 $head2[$h][2] =
'tabs';
3816 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=menus&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3817 $head2[$h][1] = ($countMenus <= 0 ? $langs->trans(
"Menus") : $langs->trans(
"Menus").
'<span class="marginleftonlyshort badge">'.$countMenus.
"</span>");
3818 $head2[$h][2] =
'menus';
3821 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=hooks&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3822 $head2[$h][1] = $langs->trans(
"Hooks");
3823 $head2[$h][2] =
'hooks';
3826 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=triggers&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3827 $head2[$h][1] = ($countTriggers <= 0 ? $langs->trans(
"Triggers") : $langs->trans(
"Triggers").
'<span class="marginleftonlyshort badge">'.$countTriggers.
"</span>");
3828 $head2[$h][2] =
'triggers';
3831 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=widgets&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3832 $head2[$h][1] = ($countWidgets <= 0 ? $langs->trans(
"Widgets") : $langs->trans(
"Widgets").
'<span class="marginleftonlyshort badge">'.$countWidgets.
"</span>");
3833 $head2[$h][2] =
'widgets';
3836 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=emailings&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3837 $head2[$h][1] = ($countEmailingSelectors <= 0 ? $langs->trans(
"EmailingSelectors") : $langs->trans(
"EmailingSelectors").
'<span class="marginleftonlyshort badge">'.$countEmailingSelectors.
"</span>");
3838 $head2[$h][2] =
'emailings';
3841 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=exportimport&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3842 $head2[$h][1] = $langs->trans(
"ImportExportProfiles");
3843 $head2[$h][2] =
'exportimport';
3846 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=css&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3847 $head2[$h][1] = ($countCss <= 0 ? $langs->trans(
"CSS") : $langs->trans(
"CSS").
" (".$countCss.
")");
3848 $head2[$h][2] =
'css';
3851 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=js&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3852 $head2[$h][1] = ($countJs <= 0 ? $langs->trans(
"JS") : $langs->trans(
"JS").
'<span class="marginleftonlyshort badge">'.$countJs.
"</span>");
3853 $head2[$h][2] =
'js';
3856 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=cli&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3857 $head2[$h][1] = ($countCLI <= 0 ? $langs->trans(
"CLI") : $langs->trans(
"CLI").
'<span class="marginleftonlyshort badge">'.$countCLI.
"</span>");
3858 $head2[$h][2] =
'cli';
3861 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=cron&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3862 $head2[$h][1] = $langs->trans(
"CronList");
3863 $head2[$h][2] =
'cron';
3866 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=specifications&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3867 $head2[$h][1] = ($hasDoc <= 0 ? $langs->trans(
"Documentation") : $langs->trans(
"Documentation").
'<span class="marginleftonlyshort badge">'.$hasDoc.
"</span>");
3868 $head2[$h][2] =
'specifications';
3871 $head2[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=buildpackage&module='.$module.($forceddirread ?
'@'.$dirread :
'');
3872 $head2[$h][1] = $langs->trans(
"BuildPackage");
3873 $head2[$h][2] =
'buildpackage';
3876 $MAXTABFOROBJECT = 12;
3878 print
'<!-- Section for a given module -->';
3882 if ($tab ==
'description') {
3883 print
'<!-- tab=description -->'.
"\n";
3884 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
3885 $pathtofilereadme = $modulelowercase.
'/README.md';
3886 $pathtochangelog = $modulelowercase.
'/ChangeLog.md';
3887 $pathtoindex = $modulelowercase.
'/'.$modulelowercase.
'index.php';
3889 $realpathofmodule = realpath($dirread.
'/'.$modulelowercase);
3891 if ($action !=
'editfile' || empty($file)) {
3892 $morehtmlright =
'';
3893 if ($realpathofmodule != $dirread.
'/'.$modulelowercase) {
3894 $morehtmlright =
'<div style="padding: 12px 9px 12px">'.$form->textwithpicto(
'',
'<span class="opacitymedium">'.$langs->trans(
"RealPathOfModule").
' :</span> <strong class="wordbreak">'.$realpathofmodule.
'</strong>').
'</div>';
3897 print
dol_get_fiche_head($head2, $tab,
'', -1,
'', 0, $morehtmlright,
'', $MAXTABFOROBJECT,
'formodulesuffix');
3899 print
'<span class="opacitymedium">'.$langs->trans(
"ModuleBuilderDesc".$tab).
'</span>';
3905 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
3906 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>';
3909 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"Index").
' : <strong class="wordbreak">'.$pathtoindex.
'</strong>';
3910 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>';
3914 $listofsetuppages =
dol_dir_list($realpathofmodule.
'/admin',
'files', 0,
'\.php$');
3915 foreach ($listofsetuppages as $setuppage) {
3918 if (preg_match(
'/^([a-z]+)_extrafields.php/', $setuppage[
'relativename'], $reg)) {
3920 $fileofclass = $realpathofmodule.
'/class/'.$reg[1].
'.class.php';
3921 if (is_readable($fileofclass) && !preg_match(
'/public\s+\$isextrafieldmanaged\s+=\s+1/', file_get_contents($fileofclass))) {
3928 print
'<span class="fa fa-file"></span> ';
3929 if ($setuppage[
'relativename'] ==
'about.php') {
3930 print $langs->trans(
"AboutFile");
3932 print $langs->trans(
"SetupFile");
3935 print
'<strong class="wordbreak bold"><a href="'.dol_buildpath($modulelowercase.
'/admin/'.$setuppage[
'relativename'], 1).
'" target="_test">'.$modulelowercase.
'/admin/'.$setuppage[
'relativename'].
'</a></strong>';
3936 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>';
3940 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"ReadmeFile").
' : <strong class="wordbreak">'.$pathtofilereadme.
'</strong>';
3941 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>';
3944 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"ChangeLog").
' : <strong class="wordbreak">'.$pathtochangelog.
'</strong>';
3945 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>';
3951 print
load_fiche_titre($form->textwithpicto($langs->trans(
"DescriptorFile"), $langs->transnoentitiesnoconv(
"File").
' '.$pathtofile),
'',
'');
3954 print
'<div class="underbanner clearboth"></div>';
3955 print
'<div class="fichecenter">';
3956 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
3957 print
'<input type="hidden" name="token" value="'.newToken().
'">';
3958 print
'<input type="hidden" name="action" value="update_props_module">';
3959 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
3960 print
'<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).
'">';
3961 print
'<input type="hidden" name="keydescription" value="'.dol_escape_htmltag(
GETPOST(
'keydescription',
'alpha')).
'">';
3963 print
'<div class="div-table-responsive-no-min">';
3964 print
'<table class="border centpercent">';
3965 print
'<tr class="liste_titre"><td class="titlefield">';
3966 print $langs->trans(
"Parameter");
3968 print $langs->trans(
"Value");
3972 print $langs->trans(
"IdModule");
3975 print
'<span class="opacitymedium">';
3977 print
dolButtonToOpenUrlInDialogPopup(
'popup_modules_id', $langs->transnoentitiesnoconv(
"SeeIDsInUse"), $langs->transnoentitiesnoconv(
"SeeIDsInUse"),
'/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info',
'',
'');
3978 print
' - <a href="https://wiki.dolibarr.org/index.php/List_of_modules_id" target="_blank" rel="noopener noreferrer external">'.$langs->trans(
"SeeReservedIDsRangeHere").
'</a>)';
3983 print $langs->trans(
"ModuleName");
3989 print $langs->trans(
"Description");
3991 if ($action ==
'edit_moduledescription' &&
GETPOST(
'keydescription',
'alpha') ===
'desc') {
3992 print
'<input class="minwidth500" name="propsmodule" value="'.dol_escape_htmltag(
$moduleobj->description).
'" spellcheck="false">';
3993 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifydesc" 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=desc">'.
img_edit().
'</a>';
3999 $moduledescritpionautotrans =
$moduleobj->getDesc();
4000 if ($moduledescritpionautotrans !=
"Module".
$moduleobj->name.
"Desc") {
4002 print
' '.$form->textwithpicto(
'', $langs->trans(
"ModuleTranslatedIntoLangForKeyInto",
"Module".$moduleobj->name.
"Desc", $moduledescritpionautotrans));
4003 } elseif ($moduledescritpionautotrans !=
"Module".
$moduleobj->numero.
"Desc") {
4005 print
' '.$form->textwithpicto(
'', $langs->trans(
"ModuleTranslatedIntoLangForKeyInto",
"Module".$moduleobj->numero.
"Desc", $moduledescritpionautotrans));
4011 print $langs->trans(
"Version");
4013 if ($action ==
'edit_moduledescription' &&
GETPOST(
'keydescription',
'alpha') ===
'version') {
4014 print
'<input name="propsmodule" value="'.dol_escape_htmltag(
$moduleobj->getVersion()).
'">';
4015 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifyversion" value="'.$langs->trans(
"Modify").
'"/>';
4016 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
4019 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>';
4024 print $langs->trans(
"Family");
4027 if ($action ==
'edit_moduledescription' &&
GETPOST(
'keydescription',
'alpha') ===
'family') {
4028 print
'<select name="propsmodule" id="family" class="minwidth400">';
4029 $arrayoffamilies = array(
4030 'hr' =>
"ModuleFamilyHr",
4031 'crm' =>
"ModuleFamilyCrm",
4032 'srm' =>
"ModuleFamilySrm",
4033 'financial' =>
'ModuleFamilyFinancial',
4034 'products' =>
'ModuleFamilyProducts',
4035 'projects' =>
'ModuleFamilyProjects',
4036 'ecm' =>
'ModuleFamilyECM',
4037 'technic' =>
'ModuleFamilyTechnic',
4038 'portal' =>
'ModuleFamilyPortal',
4039 'interface' =>
'ModuleFamilyInterface',
4040 'base' =>
'ModuleFamilyBase',
4041 'other' =>
'ModuleFamilyOther'
4043 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>';
4044 foreach ($arrayoffamilies as $key => $value) {
4046 print
'<option value="'.$key.
'" data-html="'.
dol_escape_htmltag($langs->trans($value).
' <span class="opacitymedium">- '.$key.
'</span>').
'">'.$langs->trans($value).
'</option>';
4050 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifyfamily" value="'.$langs->trans(
"Modify").
'"/>';
4051 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
4054 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>';
4058 print
'<!-- picto of module -->'.
"\n";
4060 print $langs->trans(
"Picto");
4062 if ($action ==
'edit_modulepicto' &&
GETPOST(
'keydescription',
'alpha') ===
'picto') {
4063 print
'<input class="minwidth200 maxwidth500" name="propsmodule" value="'.dol_escape_htmltag(
$moduleobj->picto).
'" spellcheck="false">';
4065 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\'');
4067 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifypicto" value="'.$langs->trans(
"Modify").
'"/>';
4068 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
4070 print
' ';
4072 print
'<span class="opacitymedium small">';
4073 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',
'',
'');
4077 print
' '.img_picto(
'',
$moduleobj->picto,
'class="valignmiddle pictomodule paddingrightonly"');
4078 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>';
4083 print $langs->trans(
"EditorName");
4085 if ($action ==
'edit_moduledescription' &&
GETPOST(
'keydescription',
'alpha') ===
'editor_name') {
4086 print
'<input name="propsmodule" value="'.dol_escape_htmltag(
$moduleobj->editor_name).
'" spellcheck="false">';
4087 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifyname" value="'.$langs->trans(
"Modify").
'"/>';
4088 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
4091 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>';
4096 print $langs->trans(
"EditorUrl");
4098 if ($action ==
'edit_moduledescription' &&
GETPOST(
'keydescription',
'alpha') ===
'editor_url') {
4099 print
'<input name="propsmodule" value="'.dol_escape_htmltag(
$moduleobj->editor_url).
'" spellcheck="false">';
4100 print
'<input class="reposition button smallpaddingimp" type="submit" name="modifyeditorurl" value="'.$langs->trans(
"Modify").
'"/>';
4101 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
4104 print
'<a href="'.$moduleobj->editor_url.
'" target="_blank" rel="noopener">'.
$moduleobj->editor_url.
' '.
img_picto(
'',
'globe').
'</a>';
4106 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>';
4114 print $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module).
'<br>';
4121 print
load_fiche_titre($form->textwithpicto($langs->trans(
"ReadmeFile"), $langs->transnoentitiesnoconv(
"File").
' '.$pathtofilereadme),
'',
'');
4123 print
'<!-- readme file -->';
4124 if (
dol_is_file($dirread.
'/'.$pathtofilereadme)) {
4125 print
'<div class="underbanner clearboth"></div><div class="fichecenter">'.$moduleobj->getDescLong().
'</div>';
4127 print
'<span class="opacitymedium">'.$langs->trans(
"ErrorFileNotFound", $pathtofilereadme).
'</span>';
4133 print
load_fiche_titre($form->textwithpicto($langs->trans(
"ChangeLog"), $langs->transnoentitiesnoconv(
"File").
' '.$pathtochangelog),
'',
'');
4135 print
'<!-- changelog file -->';
4137 print
'<div class="underbanner clearboth"></div><div class="fichecenter">'.$moduleobj->getChangeLog().
'</div>';
4139 print
'<span class="opacitymedium">'.$langs->trans(
"ErrorFileNotFound", $pathtochangelog).
'</span>';
4148 if ($fullpathoffile) {
4149 $content = file_get_contents($fullpathoffile);
4153 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4154 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4155 print
'<input type="hidden" name="action" value="savefile">';
4156 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4157 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4158 print
'<input type="hidden" name="module" value="'.$module.
'">';
4162 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
4163 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
4164 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
4169 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
4171 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4177 print
dol_get_fiche_head($head2, $tab,
'', -1,
'', 0,
'',
'', $MAXTABFOROBJECT,
'formodulesuffix');
4180 if ($tab ==
'languages') {
4181 print
'<!-- tab=languages -->'.
"\n";
4182 if ($action !=
'editfile' || empty($file)) {
4183 print
'<span class="opacitymedium">'.$langs->trans(
"LanguageDefDesc").
'</span><br>';
4187 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4188 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4189 print
'<input type="hidden" name="action" value="addlanguage">';
4190 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4191 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4192 print
'<input type="hidden" name="module" value="'.$module.
'">';
4193 print $formadmin->select_language(
getDolGlobalString(
'MAIN_LANG_DEFAULT'),
'newlangcode', 0, array(), 1, 0, 0,
'minwidth300', 1);
4194 print
'<input type="submit" name="addlanguage" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans(
"AddLanguageFile")).
'"><br>';
4200 $modulelowercase = strtolower($module);
4204 $diroflang .=
'/langs';
4205 $langfiles =
dol_dir_list($diroflang,
'files', 1,
'\.lang$');
4207 if (!preg_match(
'/custom/', $dirread)) {
4209 $diroflang = $dirread;
4210 $diroflang .=
'/langs';
4211 $langfiles =
dol_dir_list($diroflang,
'files', 1, $modulelowercase.
'\.lang$');
4214 print
'<table class="none">';
4215 foreach ($langfiles as $langfile) {
4216 $pathtofile = $modulelowercase.
'/langs/'.$langfile[
'relativename'];
4217 if (!preg_match(
'/custom/', $dirread)) {
4218 $pathtofile =
'langs/'.$langfile[
'relativename'];
4220 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"LanguageFile").
' '.basename(dirname($pathtofile)).
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
4221 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>';
4222 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>';
4233 $content = file_get_contents($fullpathoffile);
4236 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4237 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4238 print
'<input type="hidden" name="action" value="savefile">';
4239 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
4240 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
4241 print
'<input type="hidden" name="module" value="'.$module.
'">';
4243 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
4244 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'text'));
4247 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
4249 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
4256 if ($tab ==
'objects') {
4257 print
'<!-- tab=objects -->'.
"\n";
4262 $dir = $dirread.
'/'.$modulelowercase.
'/class';
4264 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj=newobject';
4265 $head3[$h][1] =
'<span class="valignmiddle text-plus-circle">'.$langs->trans(
"NewObjectInModulebuilder").
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
4266 $head3[$h][2] =
'newobject';
4270 $listofobject =
dol_dir_list($dir,
'files', 0,
'\.class\.php$');
4272 $firstobjectname =
'';
4273 foreach ($listofobject as $fileobj) {
4274 if (preg_match(
'/^api_/', $fileobj[
'name'])) {
4277 if (preg_match(
'/^actions_/', $fileobj[
'name'])) {
4281 $tmpcontent = file_get_contents($fileobj[
'fullname']);
4282 if (preg_match(
'/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) {
4284 $objectname = $reg[1];
4285 if (empty($firstobjectname)) {
4286 $firstobjectname = $objectname;
4288 $pictoname =
'generic';
4289 if (preg_match(
'/\$picto\s*=\s*["\']([^"\']+)["\']/', $tmpcontent, $reg)) {
4290 $pictoname = $reg[1];
4293 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj='.$objectname;
4294 $head3[$h][1] =
img_picto(
'', $pictoname,
'class="pictofixedwidth valignmiddle"').$objectname;
4295 $head3[$h][2] = $objectname;
4301 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=objects&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabobj=deleteobject';
4302 $head3[$h][1] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"DangerZone");
4303 $head3[$h][2] =
'deleteobject';
4308 if ($tabobj ==
'newobjectifnoobj') {
4309 if ($firstobjectname) {
4310 $tabobj = $firstobjectname;
4312 $tabobj =
'newobject';
4316 print
dol_get_fiche_head($head3, $tabobj,
'', -1,
'', 0,
'',
'', 0,
'forobjectsuffix');
4319 if ($tabobj ==
'newobject') {
4321 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4322 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4323 print
'<input type="hidden" name="action" value="initobject">';
4324 print
'<input type="hidden" name="tab" value="objects">';
4325 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4330 print
'<span class="opacitymedium">'.$langs->trans(
"EnterNameOfObjectDesc").
'</span><br><br>';
4332 print
'<div class="tagtable">';
4334 print
'<div class="tagtr"><div class="tagtd">';
4335 print
'<span class="opacitymedium">'.$langs->trans(
"ObjectKey").
'</span> ';
4336 print
'</div><div class="tagtd">';
4337 print
'<input type="text" name="objectname" maxlength="64" value="'.dol_escape_htmltag(GETPOSTISSET(
'objectname') ?
GETPOST(
'objectname',
'alpha') : $modulename).
'" required autofocus>';
4338 print $form->textwithpicto(
'', $langs->trans(
"Example").
': MyObject, ACamelCaseName, ...');
4339 print
'</div></div>';
4341 print
'<div class="tagtr"><div class="tagtd">';
4342 print
'<span class="opacitymedium">'.$langs->trans(
"Picto").
'</span> ';
4343 print
'</div><div class="tagtd">';
4344 print
'<input type="text" name="idpicto" value="fa-file" placeholder="'.dol_escape_htmltag($langs->trans(
"Picto")).
'">';
4346 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\'');
4348 print
'<span class="opacitymedium small">';
4349 print
' ';
4350 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',
'',
'');
4353 print
'</div></div>';
4355 print
'<div class="tagtr"><div class="tagtd">';
4356 print
'<span class="opacitymedium">'.$langs->trans(
"DefinePropertiesFromExistingTable").
'</span> ';
4357 print
'</div><div class="tagtd">';
4358 print
'<input type="text" name="initfromtablename" value="'.GETPOST(
'initfromtablename').
'" placeholder="'.$langs->trans(
"TableName").
'">';
4359 print $form->textwithpicto(
'', $langs->trans(
"DefinePropertiesFromExistingTableDesc").
'<br>'.$langs->trans(
"DefinePropertiesFromExistingTableDesc2"));
4360 print
'</div></div>';
4365 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>';
4366 print
'<input type="checkbox" name="includedocgeneration" id="includedocgeneration" value="includedocgeneration"> <label for="includedocgeneration">'.$form->textwithpicto($langs->trans(
"IncludeDocGeneration"), $langs->trans(
"IncludeDocGenerationHelp")).
'</label><br>';
4367 print
'<input type="checkbox" name="generatepermissions" id="generatepermissions" value="generatepermissions"> <label for="generatepermissions">'.$form->textwithpicto($langs->trans(
"GeneratePermissions"), $langs->trans(
"GeneratePermissionsHelp")).
'</label><br>';
4368 print
'<input type="checkbox" name="nogeneratelines" id="nogeneratelines" value="nogeneratelines"> <label for="nogeneratelines">'.$form->textwithpicto($langs->trans(
"NoGenerateLines"), $langs->trans(
"NoGenerateLinesHelp")).
'</label><br>';
4369 print
'<br><span class="opacitymedium">'.$form->textwithpicto($langs->trans(
"EnabledTabsForObject"), $langs->trans(
"EnabledTabsForObjectHelp")).
'</span><br>';
4371 $checked = in_array($tabkey, $enabledtabsdefault,
true) ?
' checked' :
'';
4372 print
'<input type="checkbox" name="enabledtab[]" id="enabledtab_'.$tabkey.
'" value="'.
dol_escape_htmltag($tabkey).
'"'.$checked.
'> ';
4373 print
'<label for="enabledtab_'.$tabkey.
'">'.
dol_escape_htmltag($langs->trans($tabinfo[
'label'])).
'</label> ';
4377 print
'<input type="submit" class="button small" name="create" value="'.dol_escape_htmltag($langs->trans(
"GenerateCode")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
4393 } elseif ($tabobj ==
'createproperty') {
4394 $attributesUnique = array(
4395 'proplabel' => $form->textwithpicto($langs->trans(
"Label"), $langs->trans(
"YouCanUseTranslationKey")),
4396 'propname' => $form->textwithpicto($langs->trans(
"Code"), $langs->trans(
"PropertyDesc"), 1,
'help',
'extracss', 0, 3,
'propertyhelp'),
4397 'proptype' => $form->textwithpicto($langs->trans(
"Type"), $langs->trans(
"TypeOfFieldsHelpIntro").
'<br><br>'.$langs->trans(
"TypeOfFieldsHelp"), 1,
'help',
'extracss', 0, 3,
'typehelp'),
4398 'proparrayofkeyval' => $form->textwithpicto($langs->trans(
"ArrayOfKeyValues"), $langs->trans(
"ArrayOfKeyValuesDesc")),
4399 'propnotnull' => $form->textwithpicto($langs->trans(
"NotNull"), $langs->trans(
"NotNullDesc")),
4400 'propdefault' => $langs->trans(
"DefaultValue"),
4401 'propindex' => $langs->trans(
"DatabaseIndex"),
4402 'propforeignkey' => $form->textwithpicto($langs->trans(
"ForeignKey"), $langs->trans(
"ForeignKeyDesc"), 1,
'help',
'extracss', 0, 3,
'foreignkeyhelp'),
4403 'propposition' => $langs->trans(
"Position"),
4404 'propenabled' => $form->textwithpicto($langs->trans(
"Enabled"), $langs->trans(
"EnabledDesc"), 1,
'help',
'extracss', 0, 3,
'enabledhelp'),
4405 'propvisible' => $form->textwithpicto($langs->trans(
"Visibility"), $langs->trans(
"VisibleDesc").
'<br><br>'.$langs->trans(
"ItCanBeAnExpression"), 1,
'help',
'extracss', 0, 3,
'visiblehelp'),
4406 'propnoteditable' => $langs->trans(
"NotEditable"),
4408 'propsearchall' => $form->textwithpicto($langs->trans(
"SearchAll"), $langs->trans(
"SearchAllDesc")),
4409 'propisameasure' => $form->textwithpicto($langs->trans(
"IsAMeasure"), $langs->trans(
"IsAMeasureDesc")),
4410 'propcss' => $langs->trans(
"CSSClass"),
4411 'propcssview' => $langs->trans(
"CSSViewClass"),
4412 'propcsslist' => $langs->trans(
"CSSListClass"),
4413 'prophelp' => $langs->trans(
"KeyForTooltip"),
4414 'propshowoncombobox' => $langs->trans(
"ShowOnCombobox"),
4416 'propcomment' => $langs->trans(
"Comment"),
4418 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?tab=objects&module='.urlencode($module).
'&tabobj=createproperty&obj='.urlencode(
GETPOST(
'obj')).
'" method="POST">';
4419 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4420 print
'<input type="hidden" name="action" value="addproperty">';
4421 print
'<input type="hidden" name="tab" value="objects">';
4422 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4423 print
'<input type="hidden" name="obj" value="'.dol_escape_htmltag(
GETPOST(
'obj')).
'">';
4425 print
'<table class="border centpercent tableforfieldcreate">'.
"\n";
4427 foreach ($attributesUnique as $key => $attribute) {
4428 if ($counter % 2 === 0) {
4431 if ($key ==
'propname' || $key ==
'proplabel') {
4432 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>';
4433 } elseif ($key ==
'proptype') {
4434 print
'<td class="titlefieldcreate fieldrequired">'.$attribute.
'</td><td class="valuefieldcreate maxwidth50">';
4435 print
'<input class="maxwidth200" name="'.$key.
'" id="'.$key.
'" list="datalist'.$key.
'" type="text" value="'.
dol_escape_htmltag(
GETPOST($key,
'alpha')).
'">';
4437 print
'<datalist id="datalist'.$key.
'">';
4438 print
'<option>varchar(128)</option>';
4439 print
'<option>email</option>';
4440 print
'<option>phone</option>';
4441 print
'<option>ip</option>';
4442 print
'<option>url</option>';
4443 print
'<option>password</option>';
4444 print
'<option>text</option>';
4445 print
'<option>html</option>';
4446 print
'<option>date</option>';
4447 print
'<option>datetime</option>';
4448 print
'<option>integer</option>';
4449 print
'<option>stars(5)</option>';
4450 print
'<option>double(28,4)</option>';
4451 print
'<option>real</option>';
4452 print
'<option>integer:ClassName:RelativePath/To/ClassFile.class.php[:1[:FILTER]]</option>';
4461 print
'</datalist>';
4465 } elseif ($key ==
'propvisible') {
4466 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>';
4467 } elseif ($key ==
'propenabled') {
4470 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>';
4471 } elseif ($key ==
'proparrayofkeyval') {
4472 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>';
4474 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>';
4477 if ($counter % 2 === 0) {
4481 if ($counter % 2 !== 0) {
4482 while ($counter % 2 !== 0) {
4488 print
'</table><br>'.
"\n";
4489 print
'<div class="center">';
4490 print
'<input type="submit" class="button button-save" name="add" value="' .
dol_escape_htmltag($langs->trans(
'Create')) .
'">';
4491 print
'<input type="button" class="button button-cancel" name="cancel" value="' .
dol_escape_htmltag($langs->trans(
'Cancel')) .
'" onclick="goBack()">';
4497 var url = "'.$_SERVER[
"PHP_SELF"].
'?tab=objects&module='.urlencode($module).
'";
4498 window.location.href = url;
4500 $(document).ready(function() {
4501 $("#proplabel").on("keyup", function() {
4502 console.log("key up on label");
4503 s = cleanString($("#proplabel").val());
4504 $("#propname").val(s);
4507 function cleanString( stringtoclean )
4509 // allow "a-z", "A-Z", "0-9" and "_"
4510 stringtoclean = stringtoclean.replace(/[^a-z0-9_]+/ig, "");
4511 stringtoclean = stringtoclean.toLowerCase();
4512 if (!isNaN(stringtoclean)) {
4515 while ( stringtoclean.length > 1 && !isNaN( stringtoclean.charAt(0)) ){
4516 stringtoclean = stringtoclean.substr(1)
4518 if (stringtoclean.length > 28) {
4519 stringtoclean = stringtoclean.substring(0, 27);
4521 return stringtoclean;
4526 } elseif ($tabobj ==
'deleteobject') {
4528 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4529 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4530 print
'<input type="hidden" name="action" value="confirm_deleteobject">';
4531 print
'<input type="hidden" name="tab" value="objects">';
4532 print
'<input type="hidden" name="tabobj" value="deleteobject">';
4533 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
4535 print $langs->trans(
"EnterNameOfObjectToDeleteDesc").
'<br><br>';
4537 print
'<input type="text" class="valignmiddle" name="objectname" value="" placeholder="'.dol_escape_htmltag($langs->trans(
"ObjectKey")).
'" autofocus>';
4538 print
'<input type="submit" class="button smallpaddingimp" name="delete" value="'.dol_escape_htmltag($langs->trans(
"Delete")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
4542 if ($action ==
'deleteproperty') {
4543 $formconfirm = $form->formconfirm(
4544 $_SERVER[
"PHP_SELF"].
'?propertykey='.urlencode(
GETPOST(
'propertykey',
'alpha')).
'&objectname='.urlencode($objectname).
'&tab='.urlencode($tab).
'&module='.urlencode($module).
'&tabobj='.urlencode($tabobj),
4545 $langs->trans(
'Delete'),
4546 $langs->trans(
'ConfirmDeleteProperty',
GETPOST(
'propertykey',
'alpha')),
4547 'confirm_deleteproperty',
4556 if ($action !=
'editfile' || empty($file)) {
4560 $pathtoclass = strtolower($module).
'/class/'.strtolower($tabobj).
'.class.php';
4561 $pathtoapi = strtolower($module).
'/class/api_'.strtolower($module).
'.class.php';
4562 $pathtoagenda = strtolower($module).
'/'.strtolower($tabobj).
'_agenda.php';
4563 $pathtocard = strtolower($module).
'/'.strtolower($tabobj).
'_card.php';
4564 $pathtodocument = strtolower($module).
'/'.strtolower($tabobj).
'_document.php';
4565 $pathtolist = strtolower($module).
'/'.strtolower($tabobj).
'_list.php';
4566 $pathtonote = strtolower($module).
'/'.strtolower($tabobj).
'_note.php';
4567 $pathtocontact = strtolower($module).
'/'.strtolower($tabobj).
'_contact.php';
4568 $pathtophpunit = strtolower($module).
'/test/phpunit/'.strtolower($tabobj).
'Test.php';
4571 clearstatcache(
true);
4572 if (function_exists(
'opcache_invalidate')) {
4573 opcache_invalidate($dirread.
'/'.$pathtoclass,
true);
4576 if (empty($forceddirread) && empty($dirread)) {
4578 $stringofinclude =
"dol_include_once(".$pathtoclass.
")";
4580 $result = include_once $dirread.
'/'.$pathtoclass;
4581 $stringofinclude =
"@include_once ".$dirread.
'/'.$pathtoclass;
4584 if (class_exists($tabobj)) {
4586 $tmpobject = @
new $tabobj(
$db);
4588 dol_syslog(
'Failed to load Constructor of class: '.$e->getMessage(), LOG_WARNING);
4591 print
'<span class="warning">'.$langs->trans(
'Failed to find the class '.$tabobj.
' despite the '.$stringofinclude).
'</span><br><br>';
4595 $pathtosql = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'-'.strtolower($module).
'.sql';
4598 $pathtosql = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'.sql';
4601 $pathtosql =
'install/mysql/tables/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'-'.strtolower($module).
'.sql';
4604 $pathtosql =
'install/mysql/tables/llx_'.strtolower($module).
'-'.strtolower($module).
'.sql';
4607 $pathtosql =
'install/mysql/tables/llx_'.strtolower($module).
'.sql';
4608 $pathtosqlextra =
'install/mysql/tables/llx_'.strtolower($module).
'_extrafields.sql';
4611 $pathtosqlextra =
'install/mysql/tables/llx_'.strtolower($module).
'_extrafields-'.strtolower($module).
'.sql';
4614 $pathtosqlextra =
'install/mysql/tables/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields-'.strtolower($module).
'.sql';
4617 $pathtosqlextra = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields.sql';
4620 $pathtosqlextra = strtolower($module).
'/sql/llx_'.strtolower($module).
'_'.strtolower($tabobj).
'_extrafields-'.strtolower($module).
'.sql';
4622 $pathtosqlroot = preg_replace(
'/\/llx_.*$/',
'', $pathtosql);
4624 $pathtosqlkey = preg_replace(
'/\.sql$/',
'.key.sql', $pathtosql);
4625 $pathtosqlextrakey = preg_replace(
'/\.sql$/',
'.key.sql', $pathtosqlextra);
4627 $pathtolib = strtolower($module).
'/lib/'.strtolower($module).
'.lib.php';
4628 $pathtoobjlib = strtolower($module).
'/lib/'.strtolower($module).
'_'.strtolower($tabobj).
'.lib.php';
4630 $tmpobject = $tmpobject ??
null;
4631 if (is_object($tmpobject) && property_exists($tmpobject,
'picto')) {
4632 $pathtopicto = $tmpobject->picto;
4633 $realpathtopicto =
'';
4635 $pathtopicto = strtolower($module).
'/img/object_'.strtolower($tabobj).
'.png';
4636 $realpathtopicto = $dirread.
'/'.$pathtopicto;
4641 $realpathtoclass = $dirread.
'/'.$pathtoclass;
4642 $realpathtoapi = $dirread.
'/'.$pathtoapi;
4643 $realpathtoagenda = $dirread.
'/'.$pathtoagenda;
4644 $realpathtocard = $dirread.
'/'.$pathtocard;
4645 $realpathtodocument = $dirread.
'/'.$pathtodocument;
4646 $realpathtolist = $dirread.
'/'.$pathtolist;
4647 $realpathtonote = $dirread.
'/'.$pathtonote;
4648 $realpathtocontact = $dirread.
'/'.$pathtocontact;
4649 $realpathtophpunit = $dirread.
'/'.$pathtophpunit;
4650 $realpathtosql = $dirread.
'/'.$pathtosql;
4651 $realpathtosqlextra = $dirread.
'/'.$pathtosqlextra;
4652 $realpathtosqlkey = $dirread.
'/'.$pathtosqlkey;
4653 $realpathtosqlextrakey = $dirread.
'/'.$pathtosqlextrakey;
4654 $realpathtolib = $dirread.
'/'.$pathtolib;
4655 $realpathtoobjlib = $dirread.
'/'.$pathtoobjlib;
4657 if (empty($realpathtoapi)) {
4658 $pathtoapi = strtolower($module).
'/class/api_'.strtolower($module).
's.class.php';
4659 $realpathtoapi = $dirread.
'/'.$pathtoapi;
4669 if ($realpathtopicto &&
dol_is_file($realpathtopicto)) {
4670 $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>';
4671 $htmltooltip .=
'<br>';
4672 } elseif (!empty($tmpobject)) {
4673 $htmltooltip .=
'<span class="fa fa-file-image-o"></span> '.$langs->trans(
"Image").
' : '.
img_picto(
'', $tmpobject->picto,
'class="pictofixedwidth valignmiddle"').$tmpobject->picto;
4674 $htmltooltip .=
'<br>';
4676 $htmltooltip .=
'<span class="fa fa-file-image-o"></span> '.$langs->trans(
"IsExtraFieldManaged").
' : '.
yn(empty($tmpobject->isextrafieldmanaged) ? 0 : 1, 1, 2);
4677 $htmltooltip .=
'<br>';
4678 $htmltooltip .=
'<span class="fa fa-file-image-o"></span> '.$langs->trans(
"IsMultiEntityManaged").
' : '.
yn(empty($tmpobject->ismultientitymanaged) ? 0 : 1, 1, 2);
4679 $htmltooltip .=
'<br>';
4681 print
'<!-- section for object -->';
4682 print
'<div class="fichehalfleft smallxxx">';
4684 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>';
4685 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>';
4686 print $form->textwithpicto(
'', $htmltooltip, 1,
'help',
'valignmiddle', 1);
4691 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>';
4693 $file = file_get_contents($realpathtoapi);
4694 if (preg_match(
'/var '.$tabobj.
'\s+([^\s]*)\s/ims', $file, $objs)) {
4695 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>';
4697 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>';
4698 print $form->textwithpicto(
'', $langs->trans(
"InfoForApiFile"), 1,
'warning');
4702 print
'<a href="#" class="classfortooltip" target="apiexplorer" title="'.$langs->trans(
"ModuleMustBeEnabled", $module).
'"><strike>'.$langs->trans(
"ApiExplorer").
'</strike></a>';
4704 print
'<a href="'.DOL_URL_ROOT.
'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans(
"ApiExplorer").
'</a>';
4707 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>';
4710 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>';
4714 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>';
4716 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>';
4718 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>';
4720 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>';
4726 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>';
4727 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>';
4729 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>';
4730 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>';
4734 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>';
4735 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>';
4736 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>';
4739 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>';
4740 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>';
4743 if (!empty($tmpobject->isextrafieldmanaged)) {
4744 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>';
4746 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>';
4748 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>';
4750 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>';
4752 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>';
4757 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>';
4759 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>';
4761 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>';
4763 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>';
4769 print
'<div class="fichehalfleft smallxxxx">';
4770 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>';
4771 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>';
4773 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>';
4774 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>';
4777 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>';
4778 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>';
4781 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>';
4783 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>';
4787 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>';
4788 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>';
4791 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>';
4793 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>';
4797 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>';
4798 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>';
4801 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>';
4803 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>';
4807 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>';
4808 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>';
4811 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>';
4813 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>';
4820 print
'<br><br><br>';
4822 if (!empty($tmpobject)) {
4823 $reflector =
new ReflectionClass($tabobj);
4824 $reflectorproperties = $reflector->getProperties();
4825 $reflectorpropdefault = $reflector->getDefaultProperties();
4829 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
4830 print
'<input type="hidden" name="token" value="'.newToken().
'">';
4831 print
'<input type="hidden" name="action" value="addproperty">';
4832 print
'<input type="hidden" name="tab" value="objects">';
4833 print
'<input type="hidden" name="page_y" value="">';
4834 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module.($forceddirread ?
'@'.$dirread :
'')).
'">';
4835 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
4837 print
'<input class="button smallpaddingimp" type="submit" name="regenerateclasssql" value="'.$langs->trans(
"RegenerateClassAndSql").
'">';
4838 print
'<br><br class="clearboth">';
4839 print
'<br class="clearboth">';
4841 $mod = strtolower($module);
4842 $obj = strtolower($tabobj);
4843 $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));
4844 $nbOfProperties = count($reflectorpropdefault[
'fields']);
4846 print_barre_liste($langs->trans(
"ObjectProperties"), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', 0, $nbOfProperties,
'', 0, $newproperty,
'margintoponly', 0, 0, 0, 1);
4849 print
'<!-- Table with properties of object -->'.
"\n";
4850 print
'<div class="div-table-responsive">';
4851 print
'<table class="noborder small">';
4852 print
'<tr class="liste_titre">';
4853 if (!empty(
$conf->main_checkbox_left_column)) {
4854 print
'<th class="tdstickyright tdstickyghostwhite"></th>';
4856 print
'<th class="tdsticky tdstickygray">';
4857 $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>';
4858 print $form->textwithpicto($langs->trans(
"Code"), $htmltext, 1,
'help',
'extracss', 0, 3,
'propertyhelp');
4861 print $form->textwithpicto($langs->trans(
"Label"), $langs->trans(
"YouCanUseTranslationKey"));
4863 print
'<th>'.$form->textwithpicto($langs->trans(
"Type"), $langs->trans(
"TypeOfFieldsHelpIntro").
'<br><br>'.$langs->trans(
"TypeOfFieldsHelp"), 1,
'help',
'extracss', 0, 3,
'typehelp').
'</th>';
4864 print
'<th>'.$form->textwithpicto($langs->trans(
"ArrayOfKeyValues"), $langs->trans(
"ArrayOfKeyValuesDesc")).
'</th>';
4865 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"NotNull"), $langs->trans(
"NotNullDesc")).
'</th>';
4866 print
'<th class="center">'.$langs->trans(
"DefaultValue").
'</th>';
4867 print
'<th class="center">'.$langs->trans(
"DatabaseIndex").
'</th>';
4868 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"ForeignKey"), $langs->trans(
"ForeignKeyDesc"), 1,
'help',
'extracss', 0, 3,
'foreignkeyhelp').
'</th>';
4869 print
'<th class="right">'.$langs->trans(
"Position").
'</th>';
4870 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"Enabled"), $langs->trans(
"EnabledDesc"), 1,
'help',
'extracss', 0, 3,
'enabledhelp').
'</th>';
4871 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"Visibility"), $langs->trans(
"VisibleDesc").
'<br><br>'.$langs->trans(
"ItCanBeAnExpression"), 1,
'help',
'extracss', 0, 3,
'visiblehelp').
'</th>';
4872 print
'<th class="center">'.$langs->trans(
"NotEditable").
'</th>';
4874 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"SearchAll"), $langs->trans(
"SearchAllDesc")).
'</th>';
4875 print
'<th class="center">'.$form->textwithpicto($langs->trans(
"IsAMeasure"), $langs->trans(
"IsAMeasureDesc")).
'</th>';
4876 print
'<th class="center">'.$langs->trans(
"CSSClass").
'</th>';
4877 print
'<th class="center">'.$langs->trans(
"CSSViewClass").
'</th>';
4878 print
'<th class="center">'.$langs->trans(
"CSSListClass").
'</th>';
4879 print
'<th>'.$langs->trans(
"KeyForTooltip").
'</th>';
4880 print
'<th class="center">'.$langs->trans(
"ShowOnCombobox").
'</th>';
4882 print
'<th>'.$form->textwithpicto($langs->trans(
"Validate"), $langs->trans(
"ValidateModBuilderDesc")).
'</th>';
4883 print
'<th>'.$langs->trans(
"Comment").
'</th>';
4884 if (empty(
$conf->main_checkbox_left_column)) {
4885 print
'<th class="tdstickyright tdstickyghostwhite"></th>';
4892 $properties =
dol_sort_array($reflectorpropdefault[
'fields'],
'position');
4893 if (!empty($properties)) {
4895 foreach ($properties as $propkey => $propval) {
4910 $propname = $propkey;
4911 $proplabel = $propval[
'label'];
4912 $proptype = $propval[
'type'];
4913 $proparrayofkeyval = !empty($propval[
'arrayofkeyval']) ? $propval[
'arrayofkeyval'] :
'';
4914 $propnotnull = !empty($propval[
'notnull']) ? $propval[
'notnull'] :
'0';
4915 $propdefault = !empty($propval[
'default']) ? $propval[
'default'] :
'';
4916 $propindex = !empty($propval[
'index']) ? $propval[
'index'] :
'';
4917 $propforeignkey = !empty($propval[
'foreignkey']) ? $propval[
'foreignkey'] :
'';
4918 $propposition = $propval[
'position'];
4919 $propenabled = $propval[
'enabled'];
4920 $propvisible = $propval[
'visible'];
4921 $propnoteditable = !empty($propval[
'noteditable']) ? $propval[
'noteditable'] : 0;
4923 $propsearchall = !empty($propval[
'searchall']) ? $propval[
'searchall'] : 0;
4924 $propisameasure = !empty($propval[
'isameasure']) ? $propval[
'isameasure'] : 0;
4925 $propcss = !empty($propval[
'css']) ? $propval[
'css'] :
'';
4926 $propcssview = !empty($propval[
'cssview']) ? $propval[
'cssview'] :
'';
4927 $propcsslist = !empty($propval[
'csslist']) ? $propval[
'csslist'] :
'';
4928 $prophelp = !empty($propval[
'help']) ? $propval[
'help'] :
'';
4929 $propshowoncombobox = !empty($propval[
'showoncombobox']) ? $propval[
'showoncombobox'] : 0;
4931 $propvalidate = !empty($propval[
'validate']) ? $propval[
'validate'] : 0;
4932 $propcomment = !empty($propval[
'comment']) ? $propval[
'comment'] :
'';
4934 print
'<!-- line for object property -->'.
"\n";
4935 print
'<tr class="oddeven">';
4937 if (!empty(
$conf->main_checkbox_left_column)) {
4938 if ($action ==
'editproperty' && $propname == $propertykey) {
4939 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
4940 print
'<input class="reposition button smallpaddingimp" type="submit" name="edit" value="'.$langs->trans(
"Save").
'">';
4941 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
4944 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
4945 if ($propname !=
'rowid') {
4946 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>';
4947 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>';
4952 print
'<td class="tdsticky tdstickygray">';
4955 if ($action ==
'editproperty' && $propname == $propertykey) {
4957 print
'<input type="hidden" name="propname" value="'.dol_escape_htmltag($propname).
'">';
4958 print
'<input name="proplabel" class="maxwidth125" value="'.dol_escape_htmltag($proplabel).
'">';
4960 print
'<td class="tdoverflowmax150">';
4961 print
'<input name="proptype" id="proptype" class="maxwidth125" value="'.dol_escape_htmltag($proptype).
'" list="datalistproptype"></input>';
4963 print
'<datalist id="datalistproptype">';
4964 print
'<option>varchar(128)</option>';
4965 print
'<option>email</option>';
4966 print
'<option>phone</option>';
4967 print
'<option>ip</option>';
4968 print
'<option>url</option>';
4969 print
'<option>password</option>';
4970 print
'<option>text</option>';
4971 print
'<option>html</option>';
4972 print
'<option>date</option>';
4973 print
'<option>datetime</option>';
4974 print
'<option>integer</option>';
4975 print
'<option>stars(5)</option>';
4976 print
'<option>double(28,4)</option>';
4977 print
'<option>real</option>';
4978 print
'<option>integer:ClassName:RelativePath/To/ClassFile.class.php[:1[:FILTER]]</option>';
4987 print
'</datalist>';
4990 print
'<td class="tdoverflowmax200">';
4991 print
'<textarea name="proparrayofkeyval">';
4992 if (isset($proparrayofkeyval)) {
4993 if (is_array($proparrayofkeyval) || $proparrayofkeyval !=
'') {
4997 print
'</textarea>';
5000 print
'<input class="center width50" name="propnotnull" value="'.dol_escape_htmltag($propnotnull).
'">';
5003 print
'<input class="maxwidth50" name="propdefault" value="'.dol_escape_htmltag($propdefault).
'">';
5005 print
'<td class="center">';
5006 print
'<input class="center maxwidth50" name="propindex" value="'.dol_escape_htmltag($propindex).
'">';
5009 print
'<input class="center maxwidth100" name="propforeignkey" value="'.dol_escape_htmltag($propforeignkey).
'">';
5012 print
'<input class="right width50" name="propposition" value="'.dol_escape_htmltag($propposition).
'">';
5015 print
'<input class="center width75" name="propenabled" value="'.dol_escape_htmltag($propenabled).
'">';
5018 print
'<input class="center width75" name="propvisible" value="'.dol_escape_htmltag($propvisible).
'">';
5021 print
'<input class="center width50" name="propnoteditable" size="2" value="'.dol_escape_htmltag($propnoteditable).
'">';
5027 print
'<input class="center width50" name="propsearchall" value="'.dol_escape_htmltag($propsearchall).
'">';
5030 print
'<input class="center width50" name="propisameasure" value="'.dol_escape_htmltag($propisameasure).
'">';
5033 print
'<input class="center maxwidth50" name="propcss" value="'.dol_escape_htmltag($propcss).
'">';
5036 print
'<input class="center maxwidth50" name="propcssview" value="'.dol_escape_htmltag($propcssview).
'">';
5039 print
'<input class="center maxwidth50" name="propcsslist" value="'.dol_escape_htmltag($propcsslist).
'">';
5042 print
'<input class="maxwidth100" name="prophelp" value="'.dol_escape_htmltag($prophelp).
'">';
5045 print
'<input class="center maxwidth50" name="propshowoncombobox" value="'.dol_escape_htmltag($propshowoncombobox).
'">';
5048 print
'<input type="number" step="1" min="0" max="1" class="text maxwidth100" name="propvalidate" value="'.dol_escape_htmltag($propvalidate).
'">';
5051 print
'<input class="maxwidth100" name="propcomment" value="'.dol_escape_htmltag($propcomment).
'">';
5053 if (empty(
$conf->main_checkbox_left_column)) {
5054 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
5055 print
'<input class="reposition button smallpaddingimp" type="submit" name="edit" value="'.$langs->trans(
"Save").
'">';
5056 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
5060 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($proplabel).
'">';
5063 print
'<td class="tdoverflowmax200">';
5066 if (preg_match(
'/^varchar/', $proptype, $matches)) {
5067 $pictoType =
'varchar';
5068 } elseif (preg_match(
'/^integer:/', $proptype, $matches)) {
5069 $pictoType =
'link';
5070 } elseif (strpos($proptype,
'integer') === 0) {
5071 $pictoType = substr($proptype, 0, 3);
5072 } elseif (strpos($proptype,
'timestamp') === 0) {
5073 $pictoType =
'datetime';
5074 } elseif (strpos($proptype,
'real') === 0) {
5075 $pictoType =
'double';
5076 } elseif (strpos($proptype,
'stars') === 0) {
5077 $pictoType =
'stars';
5081 print
'<td class="tdoverflowmax200">';
5082 if ($proparrayofkeyval) {
5083 print
'<span title="'.dol_escape_htmltag(json_encode($proparrayofkeyval, JSON_UNESCAPED_UNICODE)).
'">';
5088 print
'<td class="center">';
5094 print
'<td class="center">';
5095 print $propindex ?
'1' :
'';
5097 print
'<td class="center">';
5100 print
'<td class="right">';
5103 print
'<td class="center tdoverflowmax100" title="'.($propnoteditable ?
dol_escape_htmltag($propnoteditable) :
'').
'">';
5107 print
'<td class="center tdoverflowmax100" title="'.($propvisible ?
dol_escape_htmltag($propvisible) :
'0').
'">';
5111 print
'<td class="center tdoverflowmax100" title="'.($propnoteditable ?
dol_escape_htmltag($propnoteditable) :
'').
'">';
5117 print
'<td class="center">';
5118 print $propsearchall ?
'1' :
'';
5120 print
'<td class="center">';
5123 print
'<td class="center tdoverflowmax100" title="'.($propcss ?
dol_escape_htmltag($propcss) :
'').
'">';
5126 print
'<td class="center tdoverflowmax100" title="'.($propcssview ?
dol_escape_htmltag($propcssview) :
'').
'">';
5129 print
'<td class="center tdoverflowmax100" title="'.($propcsslist ?
dol_escape_htmltag($propcsslist) :
'').
'">';
5133 print
'<td class="tdoverflowmax150" title="'.($prophelp ?
dol_escape_htmltag($prophelp) :
'').
'">';
5136 print
'<td class="center">';
5142 print
'<td class="center">';
5145 print
'<td class="tdoverflowmax200">';
5146 print
'<span title="'.dol_escape_htmltag($propcomment).
'">';
5150 if (empty(
$conf->main_checkbox_left_column)) {
5151 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
5152 if ($propname !=
'rowid') {
5153 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>';
5154 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>';
5162 if ($tab ==
'specifications') {
5163 if ($action !=
'editfile' || empty($file)) {
5164 print
'<span class="opacitymedium">'.$langs->trans(
"SpecDefDesc").
'</span><br>';
5169 foreach ($specs as $spec) {
5170 $pathtofile = $modulelowercase.
'/doc/'.$spec[
'relativename'];
5171 $format =
'asciidoc';
5172 if (preg_match(
'/\.md$/i', $spec[
'name'])) {
5173 $format =
'markdown';
5175 print
'<span class="fa fa-file"></span> '.$langs->trans(
"SpecificationFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
5176 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>';
5186 $content = file_get_contents($fullpathoffile);
5189 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5190 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5191 print
'<input type="hidden" name="action" value="savefile">';
5192 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
5193 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
5194 print
'<input type="hidden" name="module" value="'.$module.
'">';
5196 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
5197 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
5200 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
5202 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
5208 $langs->load(
"errors");
5209 print
'<tr><td><span class="warning">'.$langs->trans(
'ErrorModuleBuilderNoFieldProperty').
'</warning></td></tr>';
5216 $langs->load(
"errors");
5217 print
'<span class="warning">'.$langs->trans(
'ErrorModuleBuilderFailedToInit', $tabobj, (
string)
$db).
'</warning>';
5221 print $e->getMessage();
5225 if (empty($forceddirread)) {
5228 $fullpathoffile = $dirread.
'/'.$file;
5231 $content = file_get_contents($fullpathoffile);
5234 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5235 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5236 print
'<input type="hidden" name="action" value="savefile">';
5237 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
5238 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
5239 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
5240 print
'<input type="hidden" name="module" value="'.$module.($forceddirread ?
'@'.$dirread :
'').
'">';
5242 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
5243 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
5246 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
5248 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
5258 if ($tab ==
'dictionaries') {
5259 print
'<!-- tab=dictionaries -->'.
"\n";
5260 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
5264 if ($action ==
'deletedict') {
5265 $formconfirm = $form->formconfirm(
5266 $_SERVER[
"PHP_SELF"].
'?dictionnarykey='.urlencode((
string) (
GETPOSTINT(
'dictionnarykey'))).
'&tab='.urlencode((
string) ($tab)).
'&module='.urlencode((
string) ($module)),
5267 $langs->trans(
'Delete'),
5268 $langs->trans(
'Confirm Delete Dictionnary',
GETPOST(
'dictionnarykey',
'alpha')),
5269 'confirm_deletedictionary',
5277 if ($action !=
'editfile' || empty($file)) {
5278 print
'<span class="opacitymedium">';
5279 $htmlhelp = $langs->trans(
"DictionariesDefDescTooltip",
'{s1}');
5280 $htmlhelp = str_replace(
'{s1}',
'<a target="adminbis" class="nofocusvisible" href="'.DOL_URL_ROOT.
'/admin/dict.php">'.$langs->trans(
'Setup').
' - '.$langs->trans(
'Dictionaries').
'</a>', $htmlhelp);
5281 print $form->textwithpicto($langs->trans(
"DictionariesDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
5285 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
5286 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>';
5288 if (is_array($dicts) && !empty($dicts)) {
5289 print
'<span class="fa fa-file"></span> '.$langs->trans(
"LanguageFile").
' :</span> ';
5290 print
'<strong class="wordbreak">'.$dicts[
'langs'].
'</strong>';
5301 $head3[$h][0] = $_SERVER[
"PHP_SELF"].
'?tab=dictionaries&module='.$module.($forceddirread ?
'@'.$dirread :
'').
'&tabdic=newdictionary';
5302 $head3[$h][1] =
'<span class="valignmiddle text-plus-circle">'.$langs->trans(
"NewDictionary").
'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
5303 $head3[$h][2] =
'newdictionary';
5344 $newdict =
dolGetButtonTitle($langs->trans(
'NewDictionary'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/modulebuilder/index.php?tab=dictionaries&module='.urlencode($module).
'&tabdic=newdictionary');
5345 print_barre_liste($langs->trans(
"ListOfDictionariesEntries"), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', 0,
'',
'', 0, $newdict,
'', 0, 0, 0, 1);
5347 if ($tabdic !=
'newdictionary') {
5348 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5349 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5350 print
'<input type="hidden" name="action" value="addDictionary">';
5351 print
'<input type="hidden" name="tab" value="dictionaries">';
5352 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5353 print
'<input type="hidden" name="tabdic" value="'.dol_escape_htmltag($tabdic).
'">';
5355 print
'<div class="div-table-responsive">';
5356 print
'<table class="noborder">';
5358 print
'<tr class="liste_titre">';
5359 print_liste_field_titre(
"#", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'thsticky thstickygrey ');
5372 if (!empty($dicts) && is_array($dicts) && !empty($dicts[
'tabname']) && is_array($dicts[
'tabname'])) {
5374 $maxi = count($dicts[
'tabname']);
5375 while ($i < $maxi) {
5376 if ($action ==
'editdict' && $i ==
GETPOSTINT(
'dictionnarykey') - 1) {
5377 print
'<tr class="oddeven">';
5378 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5379 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5380 print
'<input type="hidden" name="tab" value="dictionaries">';
5381 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5382 print
'<input type="hidden" name="action" value="updatedictionary">';
5383 print
'<input type="hidden" name="dictionnarykey" value="'.($i + 1).
'">';
5385 print
'<td class="tdsticky tdstickygray">';
5390 print
'<input type="text" name="tabname" value="'.$dicts[
'tabname'][$i].
'" readonly class="tdstickygray">';
5394 print
'<input type="text" name="tablib" value="'.$dicts[
'tablib'][$i].
'">';
5398 print
'<input type="text" name="tabsql" value="'.$dicts[
'tabsql'][$i].
'" readonly class="tdstickygray">';
5402 print
'<select name="tabsqlsort">';
5403 print
'<option value="'.dol_escape_htmltag($dicts[
'tabsqlsort'][$i]).
'">'.$dicts[
'tabsqlsort'][$i].
'</option>';
5407 print
'<td><select name="tabfield" >';
5408 print
'<option value="'.dol_escape_htmltag($dicts[
'tabfield'][$i]).
'">'.$dicts[
'tabfield'][$i].
'</option>';
5409 print
'</select></td>';
5411 print
'<td><select name="tabfieldvalue" >';
5412 print
'<option value="'.dol_escape_htmltag($dicts[
'tabfieldvalue'][$i]).
'">'.$dicts[
'tabfieldvalue'][$i].
'</option>';
5413 print
'</select></td>';
5415 print
'<td><select name="tabfieldinsert" >';
5416 print
'<option value="'.dol_escape_htmltag($dicts[
'tabfieldinsert'][$i]).
'">'.$dicts[
'tabfieldinsert'][$i].
'</option>';
5417 print
'</select></td>';
5420 print
'<input type="text" name="tabrowid" value="'.dol_escape_htmltag($dicts[
'tabrowid'][$i]).
'" readonly class="tdstickygray">';
5424 print
'<input type="text" name="tabcond" value="'.dol_escape_htmltag((empty($dicts[
'tabcond'][$i]) ?
'disabled' :
'enabled')).
'" readonly class="tdstickygray">';
5427 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
5428 print
'<input id ="updatedict" class="reposition button smallpaddingimp" type="submit" name="updatedict" value="'.$langs->trans(
"Modify").
'"/>';
5430 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
5436 print
'<tr class="oddeven">';
5438 print
'<td class="tdsticky tdstickygray">';
5443 print $dicts[
'tabname'][$i];
5447 print $dicts[
'tablib'][$i];
5451 print $dicts[
'tabsql'][$i];
5455 print $dicts[
'tabsqlsort'][$i];
5459 print $dicts[
'tabfield'][$i];
5463 print $dicts[
'tabfieldvalue'][$i];
5467 print $dicts[
'tabfieldinsert'][$i];
5471 print $dicts[
'tabrowid'][$i];
5475 print $dicts[
'tabcond'][$i];
5478 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
5479 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>';
5480 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>';
5488 print
'<tr><td colspan="11"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
5497 if ($tabdic ==
'newdictionary') {
5499 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5500 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5501 print
'<input type="hidden" name="action" value="initdic">';
5502 print
'<input type="hidden" name="tab" value="dictionaries">';
5503 print
'<input type="hidden" name="tabdic" value="'.$tabdic.
'">';
5505 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5507 print
'<span class="opacitymedium">'.$langs->trans(
"EnterNameOfDictionaryDesc").
'</span><br><br>';
5510 print
'<table class="border centpercent">';
5512 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>';
5513 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>';
5514 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>';
5515 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>';
5516 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"FieldsView").
'</td><td><input type="text" name="field" value="'.
dol_escape_htmltag(
GETPOST(
'field',
'alpha')).
'"></td></tr>';
5517 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"FieldsEdit").
'</td><td><input type="text" name="fieldvalue" value="'.
dol_escape_htmltag(
GETPOST(
'fieldvalue',
'alpha')).
'"></td></tr>';
5518 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"FieldsInsert").
'</td><td><input type="text" name="fieldinsert" value="'.
dol_escape_htmltag(
GETPOST(
'fieldinsert',
'alpha')).
'"></td></tr>';
5519 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Rowid").
'</td><td><input type="text" name="rowid" value="'.
dol_escape_htmltag(
GETPOST(
'rowid',
'alpha')).
'"></td></tr>';
5521 print
'</tbody></table>';
5522 print
'<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans(
"GenerateCode")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
5523 print
'<input id="cancel" type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
5527 $(document).ready(function() {
5528 $("input[name=\'dicname\']").on("blur", function() {
5529 if ($(this).val().length > 0) {
5530 $("input[name=\'label\']").val($(this).val());
5531 $("input[name=\'sql\']").val("SELECT f.rowid as rowid, f.code, f.label, f.active FROM llx_c_" + $(this).val() + " as f");
5532 $("input[name=\'sqlsort\']").val("label ASC");
5533 $("input[name=\'field\']").val("code,label");
5534 $("input[name=\'fieldvalue\']").val("code,label");
5535 $("input[name=\'fieldinsert\']").val("code,label");
5536 $("input[name=\'rowid\']").val("rowid");
5538 $("input[name=\'label\']").val("");
5539 $("input[name=\'sql\']").val("");
5540 $("input[name=\'sqlsort\']").val("");
5541 $("input[name=\'field\']").val("");
5542 $("input[name=\'fieldvalue\']").val("");
5543 $("input[name=\'fieldinsert\']").val("");
5544 $("input[name=\'rowid\']").val("");
5547 $("input[id=\'cancel\']").click(function() {
5548 window.history.back();
5565 } elseif ($tabdic ==
'deletedictionary') {
5567 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5568 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5569 print
'<input type="hidden" name="action" value="confirm_deletedictionary">';
5570 print
'<input type="hidden" name="tab" value="dictionaries">';
5571 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5573 print $langs->trans(
"EnterNameOfDictionnaryToDeleteDesc").
'<br><br>';
5575 print
'<input type="text" name="dicname" value="'.dol_escape_htmltag($modulename).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"DicKey")).
'">';
5576 print
'<input type="submit" class="button smallpaddingimp" name="delete" value="'.dol_escape_htmltag($langs->trans(
"Delete")).
'"'.($dirins ?
'' :
' disabled="disabled"').
'>';
5584 $content = file_get_contents($fullpathoffile);
5587 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5588 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5589 print
'<input type="hidden" name="action" value="savefile">';
5590 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
5591 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
5592 print
'<input type="hidden" name="module" value="'.$module.
'">';
5594 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
5595 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
5596 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
5599 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
5601 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
5608 if ($tab ==
'menus') {
5609 print
'<!-- tab=menus -->'.
"\n";
5610 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
5611 $dirins = $listofmodules[strtolower($module)][
'moduledescriptorrootpath'];
5612 $destdir = $dirins.
'/'.strtolower($module);
5613 $listofobject =
dol_dir_list($destdir.
'/class',
'files', 0,
'\.class\.php$');
5616 $leftmenus = array();
5621 $crud = array(
'read' =>
'CRUDRead',
'write' =>
'CRUDCreateWrite',
'delete' =>
'Delete');
5624 $groupedRights = array();
5625 foreach ($permissions as $right) {
5627 if (!isset($groupedRights[$key])) {
5628 $groupedRights[$key] = array();
5630 $groupedRights[$key][] = $right;
5632 $groupedRights_json = json_encode($groupedRights);
5634 if ($action ==
'deletemenu') {
5635 $formconfirms = $form->formconfirm(
5636 $_SERVER[
"PHP_SELF"].
'?menukey='.urlencode((
string) (
GETPOSTINT(
'menukey'))).
'&tab='.urlencode((
string) ($tab)).
'&module='.urlencode((
string) ($module)),
5637 $langs->trans(
'Delete'),
5638 ($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'))),
5639 'confirm_deletemenu',
5644 print $formconfirms;
5646 if ($action !=
'editfile' || empty($file)) {
5647 print
'<span class="opacitymedium">';
5648 $htmlhelp = $langs->trans(
"MenusDefDescTooltip",
'{s1}');
5649 $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);
5650 print $form->textwithpicto($langs->trans(
"MenusDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
5655 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
5656 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>';
5660 $listODifferentUrlsInMenu = array();
5661 foreach ($menus as $obj) {
5662 if (preg_match(
'/^\/'.preg_quote(strtolower($module),
'/').
'\//', $obj[
'url']) && !empty($pathoffile)) {
5663 if (!empty($listODifferentUrlsInMenu[$pathoffile])) {
5666 $pathtofile = $obj[
'url'];
5667 $listODifferentUrlsInMenu[$pathoffile] = $pathtofile;
5668 print
'<span class="fa fa-file"></span> '.$langs->trans(
"PageLinkedByAMenuEntry").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
5669 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>';
5678 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5679 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5680 print
'<input type="hidden" name="action" value="addmenu">';
5681 print
'<input type="hidden" name="tab" value="menus">';
5682 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5683 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
5685 print
'<div class="div-table-responsive">';
5686 print
'<table class="noborder small">';
5688 $htmltextenabled =
'<u>'.$langs->trans(
"Examples").
':</u><br>';
5689 $htmltextenabled .=
'1 <span class="opacitymedium">(module always enabled)</span><br>';
5690 $htmltextenabled .=
'0 <span class="opacitymedium">(module always disabled)</span><br>';
5691 $htmltextenabled .=
'isModEnabled(\''.dol_escape_htmltag(strtolower($module)).
'\') <span
class=
"opacitymedium">(enabled when module is enabled)</span>
';
5692 $htmltextperms = '<u>
'.$langs->trans("Examples").':</u><br>
';
5693 $htmltextperms .= '1 <span class=
"opacitymedium">(access always allowed)</span><br>
';
5694 $htmltextperms .= '$user->hasright(\
''.
dol_escape_htmltag(strtolower($module)).
'\', \'myobject\', \'read\') <span class="opacitymedium">(access allowed if user has permission module->object->read)</span>';
5696 print
'<tr class="liste_titre">';
5697 print_liste_field_titre(
"#", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'center tdsticky tdstickygray ');
5700 print_liste_field_titre(
"LinkToParentMenu", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'minwidth100 ');
5703 print_liste_field_titre(
"URL", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'', $langs->transnoentitiesnoconv(
'DetailUrl'));
5705 print_liste_field_titre(
"Position", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'right ');
5706 print_liste_field_titre(
"Enabled", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'center ', $langs->trans(
'DetailEnabled').
'<br><br>'.$htmltextenabled);
5707 print_liste_field_titre(
"Rights", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'', $langs->trans(
'DetailRight').
'<br><br>'.$htmltextperms);
5708 print_liste_field_titre(
"Target", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'', $langs->trans(
'DetailTarget'));
5709 print_liste_field_titre(
"MenuForUsers", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'center minwidth100 ', $langs->trans(
'DetailUser'));
5710 print_liste_field_titre(
"", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
'center ', $langs->trans(
''));
5713 $r = count($menus) + 1;
5716 print
'<td class="center tdsticky tdstickygray"><input type="hidden" readonly class="center maxwidth50" name="propenabled" value="#"></td>';
5717 print
'<td class="center">';
5718 print
'<select class="maxwidth50" name="type">';
5719 print
'<option value="">'.$langs->trans(
"........").
'</option><option value="'.
dol_escape_htmltag(
"left").
'">left</option><option value="'.
dol_escape_htmltag(
"top").
'">top</option>';
5720 print
'</select></td>';
5721 print
'<td class="left"><input type="text" class="left maxwidth100" name="titre" value="'.dol_escape_htmltag(
GETPOST(
'titre',
'alpha')).
'"></td>';
5722 print
'<td class="left">';
5723 print
'<select name="fk_menu">';
5724 print
'<option value="">'.$langs->trans(
"........").
'</option>';
5725 foreach ($menus as $obj) {
5726 if ($obj[
'type'] ==
'left' && !empty($obj[
'leftmenu'])) {
5727 print
"<option value=".strtolower($obj[
'leftmenu']).
">".$obj[
'leftmenu'].
"</option>";
5732 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>';
5733 print
'<td class="center"><input id="leftmenu" type="text" class="left maxwidth50" name="leftmenu" value="'.dol_escape_htmltag(
GETPOST(
'leftmenu',
'alpha')).
'"></td>';
5735 print
'<td class="left"><input id="url" type="text" class="left maxwidth100" name="url" value="'.dol_escape_htmltag(
GETPOST(
'url',
'alpha')).
'"></td>';
5736 print
'<td class="left"><input type="text" class="left maxwidth75" name="langs" value="'.strtolower($module).
'@'.strtolower($module).
'" readonly></td>';
5738 print
'<td class="center"><input type="text" class="center maxwidth50 tdstickygray" name="position" value="'.(1000 + $r).
'" readonly></td>';
5740 print
'<td class="center">';
5741 print
'<input type="enabled" class="maxwidth125" value="'.dol_escape_htmltag(GETPOSTISSET(
'enabled') ?
GETPOST(
'enabled') :
'isModEnabled(\''.$module.
'\')').
'">';
5750 print
'<td class="left">';
5751 print
'<select class="maxwidth" name="objects" id="objects">';
5752 print
'<option value=""></option>';
5753 if (is_array($objects)) {
5754 foreach ($objects as $value) {
5755 print
'<option value="'.strtolower($value).
'">'.
dol_escape_htmltag(strtolower($value)).
'</option>';
5759 print
'<select class="maxwidth hideobject" name="perms" id="perms">';
5762 print
'<td class="center"><input type="text" class="center maxwidth50" name="target" value="'.dol_escape_htmltag(
GETPOST(
'target',
'alpha')).
'"></td>';
5763 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>';
5765 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
5766 print
'<input type="submit" class="button" name="add" value="'.$langs->trans(
"Add").
'">';
5774 if (count($menus)) {
5776 foreach ($menus as $menu) {
5780 $value = substr($string, strpos($string,
'fk_leftmenu=') + strlen(
'fk_leftmenu='));
5782 $propFk_menu = !empty($menu[
'fk_menu']) ? $menu[
'fk_menu'] :
GETPOST(
'fk_menu');
5783 $propTitre = !empty($menu[
'titre']) ? $menu[
'titre'] :
GETPOST(
'titre');
5784 $propMainmenu = !empty($menu[
'mainmenu']) ? $menu[
'mainmenu'] :
GETPOST(
'mainmenu');
5785 $propLeftmenu = !empty($menu[
'leftmenu']) ? $menu[
'leftmenu'] :
GETPOST(
'leftmenu');
5786 $propUrl = !empty($menu[
'url']) ? $menu[
'url'] :
GETPOST(
'url',
'alpha');
5787 $propPerms = !empty($menu[
'perms']) ? $menu[
'perms'] :
GETPOST(
'perms');
5788 $propUser = !empty($menu[
'user']) ? $menu[
'user'] :
GETPOST(
'user');
5789 $propTarget = !empty($menu[
'target']) ? $menu[
'target'] :
GETPOST(
'target');
5790 $propEnabled = !empty($menu[
'enabled']) ? $menu[
'enabled'] :
GETPOST(
'enabled');
5792 $objPerms = (empty($arguments[1]) ?
'' : trim($arguments[1]));
5793 $valPerms = (empty($arguments[2]) ?
'' : trim($arguments[2]));
5797 if ($action ==
'editmenu' &&
GETPOSTINT(
'menukey') == $i) {
5799 print
'<tr class="oddeven">';
5800 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
5801 print
'<input type="hidden" name="token" value="'.newToken().
'">';
5802 print
'<input type="hidden" name="action" value="update_menu">';
5803 print
'<input type="hidden" name="tab" value="menus">';
5804 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
5805 print
'<input type="hidden" name="menukey" value="'.$i.
'"/>';
5807 print
'<td class="tdsticky tdstickygray">';
5811 print
'<td class="center">
5812 <select class="center maxwidth50" name="type">
5813 <option value="'.dol_escape_htmltag($menu[
'type']).
'">
5816 print
'<option value="'.($menu[
'type'] ==
'left' ?
'top' :
'left').
'">';
5817 if ($menu[
'type'] ==
'left') {
5822 print
'</option></select></td>';
5824 print
'<td><input type="text" class="left maxwidth100" name="titre" value="'.dol_escape_htmltag($propTitre).
'"></td>';
5835 print
'<input type="text" name="fk_menu" class="maxwidth150" value="'.dol_escape_htmltag($propFk_menu).
'">';
5837 print
'<td><input type="text" class="left maxwidth50" name="mainmenu" value="'.dol_escape_htmltag($propMainmenu).
'" readonly></td>';
5838 print
'<td><input type="text" class="left maxwidth50" name="leftmenu" value="'.dol_escape_htmltag($propLeftmenu).
'" readonly></td>';
5840 print
'<td><input type="text" class="left maxwidth250" name="url" value="'.dol_escape_htmltag($propUrl).
'"></td>';
5841 print
'<td><input type="text" class="left maxwidth50" name="langs" value="'.strtolower($module).
'@'.strtolower($module).
'" readonly></td>';
5843 print
'<td class="center"><input type="text" class="center maxwidth50 tdstickygray" name="position" value="'.($menu[
'position']).
'" readonly></td>';
5845 print
'<td class="nowraponall">';
5846 print
'<input type="text" class="maxwidth125" name="enabled" value="'.dol_escape_htmltag($propEnabled !=
'' ? $propEnabled :
"isModEnabled('".
dol_escape_htmltag($module).
"')").
'">';
5847 $htmltext =
'<u>'.$langs->trans(
"Examples").
':</u><br>';
5848 $htmltext .=
'1 <span class="opacitymedium">(always enabled)</span><br>';
5849 $htmltext .=
'0 <span class="opacitymedium">(always disabled)</span><br>';
5850 $htmltext .=
'isModEnabled(\''.dol_escape_htmltag($module).
'\') <span
class=
"opacitymedium">(enabled when module is enabled)</span><br>
';
5851 print $form->textwithpicto('', $htmltext);
5853 print '<select
class=
"maxwidth50" name=
"enabledselect">
';
5854 print '<option value=
"1">1 (always enabled)</option>
';
5855 print '<option value=
"0">0 (always
disabled)</option>
';
5861 print '<td
class=
"nowraponall">
';
5862 print '<input
type=
"text" name=
"perms" value=
"'.dol_escape_htmltag($propPerms).'">
';
5864 if (!empty($objPerms)) {
5865 print '<input
type=
"hidden" name=
"objects" value=
"'.$objPerms.'" />
';
5866 print '<select
class=
"center maxwidth50" name=
"perms">
';
5867 if (!empty($valPerms)) {
5868 print '<option selected value=
"'.dol_escape_htmltag($valPerms).'">
'.dol_escape_htmltag($langs->trans($crud[$valPerms])).'</option>
';
5869 foreach ($crud as $key => $val) {
5870 if ($valPerms != $key) {
5871 print '<option value=
"'.dol_escape_htmltag($key).'">
'.dol_escape_htmltag($langs->trans($val)).'</option>
';
5877 print '<select
class=
"center maxwidth50" name=
"objects">
';
5878 print '<option></option>
';
5879 foreach ($objects as $obj) {
5880 print '<option value=
"'.dol_escape_htmltag(strtolower($obj)).'">
'.dol_escape_htmltag($obj).'</option>
';
5883 print '<select
class=
"center maxwidth50" name=
"perms">
';
5884 foreach ($crud as $key => $val) {
5885 print '<option value=
"'.dol_escape_htmltag($key).'">
'.dol_escape_htmltag($key).'</option>
';
5891 print '<td
class=
"center"><input
type=
"text" class=
"center maxwidth50" name=
"target" value=
"'.dol_escape_htmltag($propTarget).'"></td>
';
5892 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>
';
5893 print '<td
class=
"center minwidth75 tdstickyright tdstickyghostwhite maxwidth75">
';
5894 print '<input
class=
"reposition button smallpaddingimp" type=
"submit" name=
"edit" value=
"'.$langs->trans("Modify
").'">
';
5895 print '<input
class=
"reposition button button-cancel smallpaddingimp" type=
"submit" name=
"cancel" value=
"'.$langs->trans("Cancel
").'">
';
5900 print '<tr
class=
"oddeven">
';
5902 print '<td
class=
"tdsticky tdstickygray">
';
5906 print '<td
class=
"center">
';
5907 print dol_escape_htmltag($menu['type']);
5912 print dol_escape_htmltag($menu['titre
']);
5916 print '<td
class=
"tdoverflowmax100" title=
"'.dol_escape_htmltag($menu['fk_menu']).'">
';
5917 print dol_escape_htmltag($menu['fk_menu
']);
5921 print dol_escape_htmltag($menu['mainmenu
']);
5925 print dol_escape_htmltag($menu['leftmenu
']);
5928 print '<td
class=
"tdoverflowmax250" title=
"'.dol_escape_htmltag($menu['url']).'">
';
5929 print dol_escape_htmltag($menu['url
']);
5933 print dol_escape_htmltag($menu['langs
']);
5937 print '<td
class=
"center">
';
5938 print dol_escape_htmltag((string) $menu['position']);
5942 print '<td
class=
"tdoverflowmax200" title=
"'.dol_escape_htmltag($menu['enabled']).'">
';
5943 print dol_escape_htmltag($menu['enabled
']);
5947 print '<td
class=
"tdoverflowmax200" title=
"'.dol_escape_htmltag($menu['perms']).'">
';
5948 print dol_escape_htmltag($langs->trans($menu['perms
']));
5952 print '<td
class=
"center tdoverflowmax200" title=
"'.dol_escape_htmltag($menu['target']).'">
';
5953 print dol_escape_htmltag($menu['target
']);
5956 print '<td
class=
"center">
';
5957 if ($menu['user'] == 2) {
5958 print $langs->trans("AllMenus");
5959 } elseif ($menu['user'] == 0) {
5960 print $langs->trans('Internal
');
5961 } elseif ($menu['user'] == 1) {
5962 print $langs->trans('External
');
5964 print $menu['user']; // should not happen
5967 print '<td
class=
"center minwidth75 tdstickyright tdstickyghostwhite">
';
5968 if ($menu['titre
'] != 'Module
'.$module.'Name
') {
5969 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>
';
5970 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>
';
5977 print '<tr><td colspan=
"14"><span
class=
"opacitymedium">
'.$langs->trans("None").'</span></td></tr>
';
5986 $(document).ready(
function() {
5988 $(
"#leftmenu").on(
"input",
function() {
5989 var inputLeftMenu = $(
"#leftmenu").val();
5990 if (inputLeftMenu !== \
'\') {
5991 var url = \
''.dol_escape_js(strtolower($module)).
'\' + inputLeftMenu + \
'.php\';
5998 var groupedRights = ' . $groupedRights_json .
';
5999 var objectsSelect = $("select[id=\'objects\']");
6000 var permsSelect = $("select[id=\'perms\']");
6002 objectsSelect.change(function() {
6003 var selectedObject = $(this).val();
6005 permsSelect.empty();
6007 var rights = groupedRights[selectedObject];
6010 for (var i = 0; i < rights.length; i++) {
6011 var right = rights[i];
6012 var option = $("<option></option>").attr("value", right[5]).text(right[5]);
6013 permsSelect.append(option);
6016 var option = $("<option></option>").attr("value", "read").text("read");
6017 permsSelect.append(option);
6020 if (selectedObject !== "" && selectedObject !== null && rights) {
6025 if (objectsSelect.val() === "" || objectsSelect.val() === null) {
6036 $content = file_get_contents($fullpathoffile);
6039 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6040 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6041 print
'<input type="hidden" name="action" value="savefile">';
6042 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6043 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6044 print
'<input type="hidden" name="module" value="'.$module.
'">';
6046 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
6047 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
6048 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6051 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6053 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6060 if ($tab ==
'permissions') {
6061 print
'<!-- tab=permissions -->'.
"\n";
6062 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
6067 $dir = $dirread.
'/'.$modulelowercase.
'/class';
6068 $listofobject =
dol_dir_list($dir,
'files', 0,
'\.class\.php$');
6069 $objects = array(
'myobject');
6071 foreach ($listofobject as $fileobj) {
6072 $tmpcontent = file_get_contents($fileobj[
'fullname']);
6073 if (preg_match(
'/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) {
6074 $objects[$fileobj[
'fullname']] = $reg[1];
6079 $crud = array(
'read' =>
'CRUDRead',
'write' =>
'CRUDCreateWrite',
'delete' =>
'Delete');
6080 $labels = array(
"Read objects of ".$module,
"Create/Update objects of ".$module,
"Delete objects of ".$module);
6082 $action =
GETPOST(
'action',
'alpha');
6084 if ($action ==
'deleteright') {
6085 $formconfirm = $form->formconfirm(
6086 $_SERVER[
"PHP_SELF"].
'?permskey='.urlencode((
string) (
GETPOSTINT(
'permskey'))).
'&tab='.urlencode((
string) ($tab)).
'&module='.urlencode((
string) ($module)).
'&tabobj='.urlencode((
string) ($tabobj)),
6087 $langs->trans(
'Delete'),
6088 $langs->trans(
'Confirm Delete Right',
GETPOST(
'permskey',
'alpha')),
6089 'confirm_deleteright',
6097 if ($action !=
'editfile' || empty($file)) {
6098 print
'<!-- Tab to manage permissions -->'.
"\n";
6099 print
'<span class="opacitymedium">';
6100 $htmlhelp = $langs->trans(
"PermissionsDefDescTooltip");
6103 print $form->textwithpicto($langs->trans(
"PermissionsDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
6107 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6108 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>';
6114 print
'<!-- form to add permissions -->'.
"\n";
6115 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6116 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6117 print
'<input type="hidden" name="action" value="addright">';
6118 print
'<input type="hidden" name="tab" value="permissions">';
6119 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
6120 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
6122 print
'<div class="div-table-responsive">';
6123 print
'<table class="noborder">';
6125 print
'<tr class="liste_titre">';
6127 print_liste_field_titre(
"Object", $_SERVER[
"PHP_SELF"],
'',
"", $param,
'', $sortfield, $sortorder,
"center");
6134 print
'<tr class="small">';
6135 print
'<td><input type="hidden" readonly name="id" class="width75" value="0"></td>';
6137 print
'<td><select class="minwidth100" name="permissionObj" id="permissionObj">';
6138 print
'<option value=""></option>';
6139 foreach ($objects as $obj) {
6140 if ($obj !=
'myobject') {
6141 print
'<option value="'.$obj.
'">'.$obj.
'</option>';
6144 print
'</select></td>';
6146 print
'<td><select class="maxwidth75" name="crud" id="crud">';
6147 print
'<option value=""></option>';
6148 foreach ($crud as $key => $val) {
6149 print
'<option value="'.$key.
'">'.$langs->trans($val).
'</option>';
6154 print
'<input type="text" name="label" id="label" class="minwidth200">';
6157 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
6158 print
'<input type="submit" class="button" name="add" value="'.$langs->trans(
"Add").
'">';
6162 if (count($perms)) {
6164 foreach ($perms as $perm) {
6168 if ($action ==
'edit_right' && $perm[0] ==
GETPOSTINT(
'permskey')) {
6169 print
'<tr class="oddeven">';
6170 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="modifPerms">';
6171 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6172 print
'<input type="hidden" name="tab" value="permissions">';
6173 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
6174 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
6175 print
'<input type="hidden" name="action" value="update_right">';
6176 print
'<input type="hidden" name="counter" value="'.$i.
'">';
6178 print
'<input type="hidden" name="permskey" value="'.$perm[0].
'">';
6180 print
'<td class="tdsticky tdstickygray">';
6181 print
'<input class="width75" type="text" readonly value="'.dol_escape_htmltag($perm[0]).
'"/>';
6185 print
'<select name="crud">';
6186 print
'<option value="'.dol_escape_htmltag($perm[5]).
'">'.$langs->trans($perm[5]).
'</option>';
6187 foreach ($crud as $i => $x) {
6188 if ($perm[5] != $i) {
6189 print
'<option value="'.$i.
'">'.$langs->trans(ucfirst($x)).
'</option>';
6195 print
'<td><select name="permissionObj" >';
6196 print
'<option value="'.dol_escape_htmltag($perm[4]).
'">'.ucfirst($perm[4]).
'</option>';
6197 print
'</select></td>';
6200 print
'<input type="text" name="label" value="'.dol_escape_htmltag($perm[1]).
'">';
6203 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
6204 print
'<input id ="modifyPerm" class="reposition button smallpaddingimp" type="submit" name="modifyright" value="'.$langs->trans(
"Modify").
'"/>';
6206 print
'<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'"/>';
6213 print
'<tr class="oddeven">';
6220 if (in_array($perm[5], array(
'lire',
'read',
'creer',
'write',
'effacer',
'delete'))) {
6228 if (in_array($perm[5], array(
'lire',
'read',
'creer',
'write',
'effacer',
'delete'))) {
6229 print ucfirst($langs->trans($perm[5]));
6231 print ucfirst($langs->trans($perm[4]));
6236 print $langs->trans($perm[1]);
6239 print
'<td class="center minwidth75 tdstickyright tdstickyghostwhite">';
6240 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>';
6241 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>';
6249 print
'<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
6257 function updateInputField() {
6258 value1 = $("#crud").val();
6259 value2 = $("#permissionObj").val();
6261 // Check if both selections are made
6262 if (value1 && value2) {
6263 switch(value1.toLowerCase()){
6265 $("#label").val("Read "+value2+" object of '.ucfirst($module).
'")
6268 $("#label").val("Create/Update "+value2+" object of '.ucfirst($module).
'")
6271 $("#label").val("Delete "+value2+" object of '.ucfirst($module).
'")
6279 $("#crud, #permissionObj").change(function(){
6280 console.log("We change selection");
6288 $content = file_get_contents($fullpathoffile);
6291 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6292 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6293 print
'<input type="hidden" name="action" value="savefile">';
6294 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6295 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6296 print
'<input type="hidden" name="module" value="'.$module.
'">';
6298 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
6299 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
6300 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6303 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6305 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6312 if ($tab ==
'hooks') {
6313 print
'<!-- tab=hooks -->'.
"\n";
6314 if ($action !=
'editfile' || empty($file)) {
6315 print
'<span class="opacitymedium">'.$langs->trans(
"HooksDefDesc").
'</span><br>';
6320 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
6322 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6324 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>';
6328 $pathtohook = strtolower($module).
'/class/actions_'.strtolower($module).
'.class.php';
6329 print
'<span class="fa fa-file"></span> '.$langs->trans(
"HooksFile").
' : ';
6331 print
'<strong class="wordbreak">'.$pathtohook.
'</strong>';
6333 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> ';
6334 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>';
6336 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6337 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>';
6344 $content = file_get_contents($fullpathoffile);
6347 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6348 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6349 print
'<input type="hidden" name="action" value="savefile">';
6350 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6351 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6352 print
'<input type="hidden" name="module" value="'.$module.
'">';
6354 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
6355 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
6356 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6359 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6361 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6368 if ($tab ==
'triggers') {
6369 print
'<!-- tab=triggers -->'.
"\n";
6370 require_once DOL_DOCUMENT_ROOT.
'/core/class/interfaces.class.php';
6373 $triggers = $interfaces->getTriggersList(array(
'/'.strtolower($module).
'/core/triggers'));
6375 if ($action !=
'editfile' || empty($file)) {
6376 print
'<span class="opacitymedium">'.$langs->trans(
"TriggerDefDesc").
'</span><br>';
6381 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
6383 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6385 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>';
6388 if (!empty($triggers)) {
6389 foreach ($triggers as $trigger) {
6390 $pathtofile = $trigger[
'relpath'];
6393 print
'<span class="fa fa-file"></span> '.$langs->trans(
"TriggersFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6394 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>';
6395 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>';
6400 print
'<span class="fa fa-file"></span> '.$langs->trans(
"TriggersFile");
6401 print
' : <span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6402 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>';
6411 $content = file_get_contents($fullpathoffile);
6414 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6415 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6416 print
'<input type="hidden" name="action" value="savefile">';
6417 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6418 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6419 print
'<input type="hidden" name="module" value="'.$module.
'">';
6421 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
6422 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
6423 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6426 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6428 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6435 if ($tab ==
'css') {
6436 print
'<!-- tab=css -->'.
"\n";
6437 if ($action !=
'editfile' || empty($file)) {
6438 print
'<span class="opacitymedium">'.$langs->trans(
"CSSDesc").
'</span><br>';
6444 $pathtohook = strtolower($module).
'/css/'.strtolower($module).
'.css.php';
6445 print
'<span class="fa fa-file"></span> '.$langs->trans(
"CSSFile").
' : ';
6447 print
'<strong class="wordbreak">'.$pathtohook.
'</strong>';
6448 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>';
6449 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>';
6451 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6452 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>';
6458 $content = file_get_contents($fullpathoffile);
6461 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6462 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6463 print
'<input type="hidden" name="action" value="savefile">';
6464 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6465 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6466 print
'<input type="hidden" name="module" value="'.$module.
'">';
6468 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6469 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6472 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6474 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6482 print
'<!-- tab=js -->'.
"\n";
6483 if ($action !=
'editfile' || empty($file)) {
6484 print
'<span class="opacitymedium">'.$langs->trans(
"JSDesc").
'</span><br>';
6490 $pathtohook = strtolower($module).
'/js/'.strtolower($module).
'.js.php';
6491 print
'<span class="fa fa-file"></span> '.$langs->trans(
"JSFile").
' : ';
6493 print
'<strong class="wordbreak">'.$pathtohook.
'</strong>';
6494 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>';
6495 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>';
6497 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6498 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>';
6504 $content = file_get_contents($fullpathoffile);
6507 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6508 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6509 print
'<input type="hidden" name="action" value="savefile">';
6510 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6511 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6512 print
'<input type="hidden" name="module" value="'.$module.
'">';
6514 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6515 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6518 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6520 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6527 if ($tab ==
'widgets') {
6528 print
'<!-- tab=widgets -->'.
"\n";
6529 require_once DOL_DOCUMENT_ROOT.
'/core/boxes/modules_boxes.php';
6533 if ($action !=
'editfile' || empty($file)) {
6534 print
'<span class="opacitymedium">'.$langs->trans(
"WidgetDesc").
'</span><br>';
6538 if (!empty($widgets)) {
6539 foreach ($widgets as $widget) {
6540 $pathtofile = $widget[
'relpath'];
6542 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"WidgetFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6543 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>';
6544 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>';
6548 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"WidgetFile").
' : <span class="opacitymedium">'.$langs->trans(
"NoWidget").
'</span>';
6549 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>';
6556 $content = file_get_contents($fullpathoffile);
6559 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6560 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6561 print
'<input type="hidden" name="action" value="savefile">';
6562 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6563 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6564 print
'<input type="hidden" name="module" value="'.$module.
'">';
6566 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6567 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6570 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6572 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6579 if ($tab ==
'emailings') {
6580 print
'<!-- tab=emailings -->'.
"\n";
6581 require_once DOL_DOCUMENT_ROOT.
'/core/modules/mailings/modules_mailings.php';
6585 if ($action !=
'editfile' || empty($file)) {
6586 print
'<span class="opacitymedium">'.$langs->trans(
"EmailingSelectorDesc").
'</span><br>';
6590 if (!empty($emailingselectors)) {
6591 foreach ($emailingselectors as $emailingselector) {
6592 $pathtofile = $emailingselector[
'relpath'];
6594 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"EmailingSelectorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6595 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>';
6596 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>';
6600 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"EmailingSelectorFile").
' : <span class="opacitymedium">'.$langs->trans(
"NoEmailingSelector").
'</span>';
6601 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>';
6608 $content = file_get_contents($fullpathoffile);
6611 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6612 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6613 print
'<input type="hidden" name="action" value="savefile">';
6614 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6615 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6616 print
'<input type="hidden" name="module" value="'.$module.
'">';
6618 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6619 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6622 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6624 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6631 if ($tab ==
'exportimport') {
6632 print
'<!-- tab=exportimport -->'.
"\n";
6633 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
6638 if ($action !=
'editfile' || empty($file)) {
6639 print
'<span class="opacitymedium">'.$langs->transnoentities(
'ImportExportProfiles').
'</span><br>';
6642 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' ('.$langs->trans(
"ExportsArea").
') : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6643 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>';
6645 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' ('.$langs->trans(
"ImportArea").
') : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6646 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>';
6651 $content = file_get_contents($fullpathoffile);
6654 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6655 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6656 print
'<input type="hidden" name="action" value="savefile">';
6657 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6658 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6659 print
'<input type="hidden" name="module" value="'.$module.
'">';
6661 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
6662 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
6663 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6666 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6668 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6675 if ($tab ==
'cli') {
6676 print
'<!-- tab=cli -->'.
"\n";
6677 $clifiles = array();
6680 $dircli = array(
'/'.strtolower($module).
'/scripts');
6682 foreach ($dircli as $reldir) {
6687 if (!is_dir($newdir)) {
6691 $handle = opendir($newdir);
6693 if (is_resource($handle)) {
6694 while (($tmpfile = readdir($handle)) !==
false) {
6695 if (is_readable($newdir.
'/'.$tmpfile) && preg_match(
'/^(.+)\.php/', $tmpfile, $reg)) {
6696 if (preg_match(
'/\.back$/', $tmpfile)) {
6700 $clifiles[$i][
'relpath'] = preg_replace(
'/^\//',
'', $reldir).
'/'.$tmpfile;
6709 if ($action !=
'editfile' || empty($file)) {
6710 print
'<span class="opacitymedium">'.$langs->trans(
"CLIDesc").
'</span><br>';
6714 if (!empty($clifiles)) {
6715 foreach ($clifiles as $clifile) {
6716 $pathtofile = $clifile[
'relpath'];
6718 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"CLIFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6719 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>';
6720 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>';
6724 print
'<tr><td><span class="fa fa-file"></span> '.$langs->trans(
"CLIFile").
' : <span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6725 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>';
6732 $content = file_get_contents($fullpathoffile);
6735 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6736 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6737 print
'<input type="hidden" name="action" value="savefile">';
6738 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6739 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6740 print
'<input type="hidden" name="module" value="'.$module.
'">';
6742 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6743 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6746 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6748 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6755 if ($tab ==
'cron') {
6756 print
'<!-- tab=cron -->'.
"\n";
6757 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
6761 if ($action !=
'editfile' || empty($file)) {
6762 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>';
6765 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6766 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>';
6772 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6773 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6774 print
'<input type="hidden" name="action" value="addproperty">';
6775 print
'<input type="hidden" name="tab" value="objects">';
6776 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
6777 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
6779 print
'<div class="div-table-responsive">';
6780 print
'<table class="noborder">';
6782 print
'<tr class="liste_titre">';
6790 if (count($cronjobs)) {
6791 foreach ($cronjobs as $cron) {
6792 print
'<tr class="oddeven">';
6795 print $cron[
'label'];
6800 if ($cron[
'jobtype'] ==
'method') {
6801 $text = $langs->trans(
"CronClass");
6802 $texttoshow = $langs->trans(
'CronModule').
': '.$module.
'<br>';
6803 $texttoshow .= $langs->trans(
'CronClass').
': '.$cron[
'class'].
'<br>';
6804 $texttoshow .= $langs->trans(
'CronObject').
': '.$cron[
'objectname'].
'<br>';
6805 $texttoshow .= $langs->trans(
'CronMethod').
': '.$cron[
'method'];
6806 $texttoshow .=
'<br>'.$langs->trans(
'CronArgs').
': '.$cron[
'parameters'];
6807 $texttoshow .=
'<br>'.$langs->trans(
'Comment').
': '.$langs->trans($cron[
'comment']);
6808 } elseif ($cron[
'jobtype'] ==
'command') {
6809 $text = $langs->trans(
'CronCommand');
6810 $texttoshow = $langs->trans(
'CronCommand').
': '.
dol_trunc($cron[
'command']);
6811 $texttoshow .=
'<br>'.$langs->trans(
'CronArgs').
': '.$cron[
'parameters'];
6812 $texttoshow .=
'<br>'.$langs->trans(
'Comment').
': '.$langs->trans($cron[
'comment']);
6814 print $form->textwithpicto($text, $texttoshow, 1);
6818 if ($cron[
'unitfrequency'] ==
"60") {
6819 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Minutes');
6821 if ($cron[
'unitfrequency'] ==
"3600") {
6822 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Hours');
6824 if ($cron[
'unitfrequency'] ==
"86400") {
6825 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Days');
6827 if ($cron[
'unitfrequency'] ==
"604800") {
6828 print $langs->trans(
'CronEach').
" ".($cron[
'frequency']).
" ".$langs->trans(
'Weeks');
6833 print $cron[
'status'];
6837 if (!empty($cron[
'comment'])) {
6838 print $cron[
'comment'];
6845 print
'<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
6855 $content = file_get_contents($fullpathoffile);
6858 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6859 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6860 print
'<input type="hidden" name="action" value="savefile">';
6861 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6862 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6863 print
'<input type="hidden" name="module" value="'.$module.
'">';
6865 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
6866 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
6867 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6870 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6872 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6879 if ($tab ==
'specifications') {
6880 print
'<!-- tab=specifications -->'.
"\n";
6883 if ($action !=
'editfile' || empty($file)) {
6884 print
'<span class="opacitymedium">'.$langs->trans(
"SpecDefDesc").
'</span><br>';
6888 if (is_array($specs) && !empty($specs)) {
6889 foreach ($specs as $spec) {
6890 $pathtofile = $modulelowercase.
'/doc/'.$spec[
'relativename'];
6891 $format =
'asciidoc';
6892 if (preg_match(
'/\.md$/i', $spec[
'name'])) {
6893 $format =
'markdown';
6896 print
'<span class="fa fa-file"></span> '.$langs->trans(
"SpecificationFile").
' : <strong class="wordbreak">'.$pathtofile.
'</strong>';
6897 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>';
6898 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>';
6903 print
'<span class="fa fa-file"></span> '.$langs->trans(
"SpecificationFile").
' : <span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6904 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>';
6915 $content = file_get_contents($fullpathoffile);
6918 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
6919 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6920 print
'<input type="hidden" name="action" value="savefile">';
6921 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
6922 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
6923 print
'<input type="hidden" name="module" value="'.$module.
'">';
6925 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%');
6926 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
6929 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
6931 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
6937 print
'<br><br><br>';
6939 $FILENAMEDOC = $modulelowercase.
'.html';
6940 $FILENAMEDOCPDF = $modulelowercase.
'.pdf';
6941 $outputfiledoc =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOC;
6942 $outputfiledocurl =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOC;
6943 $outputfiledocrel = $modulelowercase.
'/doc/'.$FILENAMEDOC;
6944 $outputfiledocpdf =
dol_buildpath($modulelowercase, 0).
'/doc/'.$FILENAMEDOCPDF;
6945 $outputfiledocurlpdf =
dol_buildpath($modulelowercase, 1).
'/doc/'.$FILENAMEDOCPDF;
6946 $outputfiledocrelpdf = $modulelowercase.
'/doc/'.$FILENAMEDOCPDF;
6949 print
'<span class="fa fa-file"></span> '.$langs->trans(
"PathToModuleDocumentation",
"HTML").
' : ';
6951 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6954 print
'<a href="'.$outputfiledocurl.
'" target="_blank" rel="noopener noreferrer">';
6955 print $outputfiledoc;
6958 print
' <span class="opacitymedium">('.$langs->trans(
"GeneratedOn").
' '.
dol_print_date(
dol_filemtime($outputfiledoc),
'dayhour').
')</span>';
6959 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>';
6961 print
'</strong><br>';
6964 print
'<span class="fa fa-file"></span> '.$langs->trans(
"PathToModuleDocumentation",
"PDF").
' : ';
6966 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
6969 print
'<a href="'.$outputfiledocurlpdf.
'" target="_blank" rel="noopener noreferrer">';
6970 print $outputfiledocpdf;
6973 print
' <span class="opacitymedium">('.$langs->trans(
"GeneratedOn").
' '.
dol_print_date(
dol_filemtime($outputfiledocpdf),
'dayhour').
')</span>';
6974 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>';
6976 print
'</strong><br>';
6980 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="generatedoc">';
6981 print
'<input type="hidden" name="token" value="'.newToken().
'">';
6982 print
'<input type="hidden" name="action" value="generatedoc">';
6983 print
'<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).
'">';
6984 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
6985 print
'<input type="submit" class="button" name="generatedoc" value="'.$langs->trans(
"BuildDocumentation").
'"';
6986 if (!is_array($specs) || empty($specs)) {
6987 print
' disabled="disabled"';
6993 if ($tab ==
'buildpackage') {
6994 print
'<!-- tab=buildpackage -->'.
"\n";
6995 print
'<span class="opacitymedium">'.$langs->trans(
"BuildPackageDesc").
'</span>';
6998 if (!class_exists(
'ZipArchive') && !defined(
'ODTPHP_PATHTOPCLZIP')) {
6999 print
img_warning().
' '.$langs->trans(
"ErrNoZipEngine");
7003 $modulelowercase = strtolower($module);
7009 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
7011 $class =
'mod'.$module;
7013 if (class_exists($class)) {
7016 '@phan-var-force DolibarrModules $moduleobj';
7025 $langs->load(
"errors");
7026 dol_print_error(
$db, $langs->trans(
"ErrorFailedToLoadModuleDescriptorForXXX", $module));
7030 $outputfilezip =
null;
7031 $arrayversion = explode(
'.',
$moduleobj->version, 3);
7032 if (count($arrayversion)) {
7033 $FILENAMEZIP =
"module_".$modulelowercase.
'-'.$arrayversion[0].(empty($arrayversion[1]) ?
'.0' :
'.'.$arrayversion[1]).(empty($arrayversion[2]) ?
'' :
".".$arrayversion[2]).
".zip";
7034 $outputfilezip =
dol_buildpath($modulelowercase, 0).
'/bin/'.$FILENAMEZIP;
7039 print
'<span class="fa fa-file"></span> '.$langs->trans(
"PathToModulePackage").
' : ';
7040 if ($outputfilezip ===
null || !
dol_is_file($outputfilezip)) {
7041 print
'<span class="opacitymedium">'.$langs->trans(
"FileNotYetGenerated").
'</span>';
7043 $relativepath = $modulelowercase.
'/bin/'.$FILENAMEZIP;
7044 print
'<strong><a href="'.DOL_URL_ROOT.
'/document.php?modulepart=packages&file='.urlencode($relativepath).
'">'.$outputfilezip.
'</a></strong>';
7045 print
' <span class="opacitymedium">('.$langs->trans(
"GeneratedOn").
' '.
dol_print_date(
dol_filemtime($outputfilezip),
'dayhour').
')</span>';
7046 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>';
7054 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="generatepackage">';
7055 print
'<input type="hidden" name="token" value="'.newToken().
'">';
7056 print
'<input type="hidden" name="action" value="generatepackage">';
7057 print
'<input type="hidden" name="tab" value="'.dol_escape_htmltag($tab).
'">';
7058 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
7059 print
'<input type="submit" class="button" name="generatepackage" value="'.$langs->trans(
"BuildPackage").
'">';
7063 if ($tab ==
'tabs') {
7064 $pathtofile = $listofmodules[strtolower($module)][
'moduledescriptorrelpath'];
7068 if ($action !=
'editfile' || empty($file)) {
7069 print
'<span class="opacitymedium">';
7070 $htmlhelp = $langs->trans(
"TabsDefDescTooltip",
'{s1}');
7071 $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);
7072 print $form->textwithpicto($langs->trans(
"TabsDefDesc"), $htmlhelp, 1,
'help',
'', 0, 2,
'helpondesc').
'<br>';
7076 print
'<span class="fa fa-file"></span> '.$langs->trans(
"DescriptorFile").
' : <strong>'.$pathtofile.
'</strong>';
7077 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>';
7083 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
7084 print
'<input type="hidden" name="token" value="'.newToken().
'">';
7085 print
'<input type="hidden" name="action" value="addproperty">';
7086 print
'<input type="hidden" name="tab" value="objects">';
7087 print
'<input type="hidden" name="module" value="'.dol_escape_htmltag($module).
'">';
7088 print
'<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).
'">';
7090 print
'<div class="div-table-responsive">';
7091 print
'<table class="noborder small">';
7093 print
'<tr class="liste_titre">';
7103 foreach ($tabs as $tab) {
7104 $parts = explode(
':', $tab[
'data']);
7106 $objectType = $parts[0];
7107 $tabName = $parts[1];
7108 $tabTitle = isset($parts[2]) ? $parts[2] :
'';
7109 $langFile = isset($parts[3]) ? $parts[3] :
'';
7110 $condition = isset($parts[4]) ? $parts[4] :
'';
7111 $path = isset($parts[5]) ? $parts[5] :
'';
7115 if ($tabName[0] ===
'-') {
7117 $condition = isset($parts[2]) ? $parts[2] :
'';
7120 print
'<tr class="oddeven">';
7127 if ($tabName[0] ===
"+") {
7128 print
'<span class="badge badge-status4 badge-status">' .
dol_escape_htmltag($tabName) .
'</span>';
7130 print
'<span class="badge badge-status8 badge-status">' .
dol_escape_htmltag($tabName) .
'</span>';
7153 print
'<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
7163 $content = file_get_contents($fullpathoffile);
7166 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
7167 print
'<input type="hidden" name="token" value="'.newToken().
'">';
7168 print
'<input type="hidden" name="action" value="savefile">';
7169 print
'<input type="hidden" name="file" value="'.dol_escape_htmltag($file).
'">';
7170 print
'<input type="hidden" name="tab" value="'.$tab.
'">';
7171 print
'<input type="hidden" name="module" value="'.$module.
'">';
7173 $posCursor = (empty($find)) ? array() : array(
'find' => $find);
7174 $doleditor =
new DolEditor(
'editfilecontent', $content,
'', 300,
'Full',
'In',
true,
false,
'ace', 0,
'99%', 0, $posCursor);
7175 print $doleditor->Create(1,
'',
false, $langs->trans(
"File").
' : '.$file, (
GETPOST(
'format',
'aZ09') ?
GETPOST(
'format',
'aZ09') :
'html'));
7178 print
'<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
7180 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
7187 if ($tab !=
'description') {
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.
Syncs rights straight into the mod<Module>.class.php descriptor file.
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.
Immutable request describing one permissions sync to perform on a module descriptor.
static forObjectDeletion(string $module, string $descriptorFile, array $permissions, string $objectName)
Drop every right attached to an object being deleted.
static forRightDeletion(string $module, string $descriptorFile, array $permissions, int $rightKey)
Remove one right, addressed by its index in the rights array.
static forRightUpdate(string $module, string $descriptorFile, array $permissions, int $rightKey, string $objectName, string $label, string $crud)
Replace one right, addressed by its index in the rights array.
static forRightAddition(string $module, string $descriptorFile, array $permissions, string $objectName, string $label, string $crud)
Append one right to the descriptor.
static forObjectCreation(string $module, string $descriptorFile, array $permissions, string $objectName)
Declare the three CRUD rights of a newly generated object.
Strict implementation — reports any residual myobject/mymodule token as a warning.
Immutable outcome of a permissions sync run.
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.
dolExplodeIntoArray($string, $delimiter=';', $kv='=')
Split a string with 2 keys into key array.
dol_mimetype($file, $default='application/octet-stream', $mode=0)
Return MIME type of a file from its name with extension.
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
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.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_string_unaccent($str)
Clean a string from all accent characters to be used as ref, login or by dol_sanitizeFileName.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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_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.
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)
treeview li table
No Email.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
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.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getPictoForType($key, $morecss='')
Return the picto for a data type.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
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.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
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...
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
getLicenceHeader($user, $langs, $now)
Produce copyright replacement string for user.
modulebuilderValidateGeneratedFile(string $destfile, NamingContract $nc)
Post-generation validation – logs and displays a warning if residual myobject/mymodule tokens remain.
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.
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.