2017-03-29 19:36:50 +00:00
< ? php
2023-10-03 17:39:22 +00:00
/* Copyright ( C ) 2004 - 2023 Laurent Destailleur < eldy @ users . sourceforge . net >
* Copyright ( C ) 2018 - 2019 Nicolas ZABOURI < info @ inovea - conseil . com >
2023-05-01 14:00:58 +00:00
* Copyright ( C ) 2023 Alexandre Janniaux < alexandre . janniaux @ gmail . com >
2026-05-10 23:26:15 +00:00
* Copyright ( C ) 2024 - 2026 MDW < mdeweerd @ users . noreply . github . com >
2026-06-28 07:42:08 +00:00
* Copyright ( C ) 2024 - 2026 Frédéric France < frederic . france @ free . fr >
2017-03-29 19:36:50 +00:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2019-09-23 19:55:30 +00:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
2017-08-02 21:50:17 +00:00
*
* You can also make a direct call the page with parameter like this :
* htdocs / modulebuilder / index . php ? module = Inventory @/ pathtodolibarr / htdocs / product
2017-03-29 19:36:50 +00:00
*/
/**
* \file htdocs / modulebuilder / index . php
* \brief Home page for module builder module
2019-03-17 01:46:28 +00:00
*
* You can add parameter dirins =/ home / ldestailleur / git / dolibarr / htdocs / mymodule to force generation of module
* into the dirins directory .
2017-03-29 19:36:50 +00:00
*/
2021-02-26 17:26:44 +00:00
if ( ! defined ( 'NOSCANPOSTFORINJECTION' )) {
define ( 'NOSCANPOSTFORINJECTION' , '1' ); // Do not check anti SQL+XSS injection attack test
}
2017-07-08 14:52:10 +00:00
2022-09-07 18:08:59 +00:00
// Load Dolibarr environment
2017-03-29 19:36:50 +00:00
require '../main.inc.php' ;
2024-11-04 22:53:20 +00:00
/**
* @ var Conf $conf
* @ var DoliDB $db
* @ var HookManager $hookmanager
* @ var Societe $mysoc
* @ var Translate $langs
* @ var User $user
*
* @ var string $dolibarr_main_document_root
* @ var string $dolibarr_main_document_root_alt
*/
2026-04-10 07:25:45 +00:00
'
@ phan - var - force string $dolibarr_main_document_root
@ phan - var - force string $dolibarr_main_document_root_alt
' ;
2025-11-07 17:24:15 +00:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formadmin.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/modulebuilder.lib.php' ;
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
require_once DOL_DOCUMENT_ROOT . '/modulebuilder/class/NamingContractValidator.class.php' ;
2025-11-07 17:24:15 +00:00
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/class/utils.class.php' ;
2024-11-04 22:53:20 +00:00
2018-05-26 15:57:30 +00:00
// Load translation files required by the page
2025-03-29 12:32:59 +00:00
$langs -> loadLangs ( array ( " admin " , " modulebuilder " , " exports " , " other " , " cron " , " errors " , " uxdocumentation " ));
2017-03-29 19:36:50 +00:00
2022-08-27 11:37:06 +00:00
// GET Parameters
$action = GETPOST ( 'action' , 'aZ09' );
2019-11-13 18:37:08 +00:00
$confirm = GETPOST ( 'confirm' , 'alpha' );
2022-08-27 11:37:06 +00:00
$cancel = GETPOST ( 'cancel' , 'alpha' );
2017-07-08 13:43:36 +00:00
2026-05-29 10:06:40 +00:00
$sortfield = GETPOST ( 'sortfield' , 'aZ09comma' );
2024-02-17 17:39:26 +00:00
$sortorder = GETPOST ( 'sortorder' , 'aZ09' );
2022-02-16 15:43:52 +00:00
2025-02-26 22:14:28 +00:00
$module = ( string ) GETPOST ( 'module' , 'alpha' );
2025-02-05 21:59:37 +00:00
$tab = ( string ) GETPOST ( 'tab' , 'aZ09' );
2019-11-13 18:37:08 +00:00
$tabobj = GETPOST ( 'tabobj' , 'alpha' );
2022-05-18 19:54:38 +00:00
$tabdic = GETPOST ( 'tabdic' , 'alpha' );
2019-11-13 18:37:08 +00:00
$propertykey = GETPOST ( 'propertykey' , 'alpha' );
2021-02-26 17:26:44 +00:00
if ( empty ( $module )) {
$module = 'initmodule' ;
}
if ( empty ( $tab )) {
$tab = 'description' ;
}
2025-02-05 21:59:37 +00:00
'@phan-var-force string $tab' ; // Workaround 'empty()' bug of phan
2021-02-26 17:26:44 +00:00
if ( empty ( $tabobj )) {
$tabobj = 'newobjectifnoobj' ;
}
2022-05-18 19:54:38 +00:00
if ( empty ( $tabdic )) {
$tabdic = 'newdicifnodic' ;
}
2019-11-13 18:37:08 +00:00
$file = GETPOST ( 'file' , 'alpha' );
2024-05-01 16:04:18 +00:00
$find = GETPOST ( 'find' , 'alpha' );
2017-05-08 21:55:46 +00:00
2019-11-13 18:37:08 +00:00
$modulename = dol_sanitizeFileName ( GETPOST ( 'modulename' , 'alpha' ));
$objectname = dol_sanitizeFileName ( GETPOST ( 'objectname' , 'alpha' ));
2022-05-18 19:54:38 +00:00
$dicname = dol_sanitizeFileName ( GETPOST ( 'dicname' , 'alpha' ));
2025-02-26 22:14:28 +00:00
$editorname = ( string ) GETPOST ( 'editorname' , 'alpha' );
$editorurl = ( string ) GETPOST ( 'editorurl' , 'alpha' );
$version = ( string ) GETPOST ( 'version' , 'alpha' );
$family = ( string ) GETPOST ( 'family' , 'alpha' );
$picto = ( string ) GETPOST ( 'idpicto' , 'alpha' );
$idmodule = ( string ) GETPOST ( 'idmodule' , 'alpha' );
2024-08-18 16:16:08 +00:00
$format = '' ; // Prevent undefined in css tab
2017-05-08 19:00:23 +00:00
2017-03-29 19:36:50 +00:00
// Security check
2022-06-09 20:54:22 +00:00
if ( ! isModEnabled ( 'modulebuilder' )) {
2022-09-09 11:58:54 +00:00
accessforbidden ( 'Module ModuleBuilder not enabled' );
2021-02-26 17:26:44 +00:00
}
2025-09-26 21:55:58 +00:00
if ( ! $user -> hasRight ( " modulebuilder " , " run " )) { // after this test $user->hasRight("modulebuilder", "run") is always true, no need to check it more
2022-09-09 11:58:54 +00:00
accessforbidden ( 'ModuleBuilderNotAllowed' );
2021-02-26 17:26:44 +00:00
}
2017-03-29 19:36:50 +00:00
2017-05-08 19:00:23 +00:00
// Dir for custom dirs
2019-11-13 18:37:08 +00:00
$tmp = explode ( ',' , $dolibarr_main_document_root_alt );
2017-06-10 21:50:02 +00:00
$dirins = $tmp [ 0 ];
2017-08-02 21:50:17 +00:00
$dirread = $dirins ;
$forceddirread = 0 ;
$tmpdir = explode ( '@' , $module );
2021-02-26 17:26:44 +00:00
if ( ! empty ( $tmpdir [ 1 ])) {
2019-11-13 18:37:08 +00:00
$module = $tmpdir [ 0 ];
$dirread = $tmpdir [ 1 ];
$forceddirread = 1 ;
2017-08-02 21:50:17 +00:00
}
2021-02-26 17:26:44 +00:00
if ( GETPOST ( 'dirins' , 'alpha' )) {
2019-01-27 10:55:16 +00:00
$dirread = $dirins = GETPOST ( 'dirins' , 'alpha' );
2019-11-13 18:37:08 +00:00
$forceddirread = 1 ;
2018-10-31 14:04:01 +00:00
}
2017-05-08 19:00:23 +00:00
2019-11-13 18:37:08 +00:00
$FILEFLAG = 'modulebuilder.txt' ;
2017-05-08 19:00:23 +00:00
2019-11-13 18:37:08 +00:00
$now = dol_now ();
2017-07-11 23:55:07 +00:00
$newmask = 0 ;
2023-11-27 10:56:32 +00:00
if ( empty ( $newmask ) && getDolGlobalString ( 'MAIN_UMASK' )) {
2024-01-05 03:18:53 +00:00
$newmask = getDolGlobalString ( 'MAIN_UMASK' );
2021-02-26 17:26:44 +00:00
}
if ( empty ( $newmask )) { // This should no happen
2019-11-13 18:37:08 +00:00
$newmask = '0664' ;
2017-07-11 23:55:07 +00:00
}
2017-05-08 19:00:23 +00:00
2024-07-15 18:52:09 +00:00
$result = restrictedArea ( $user , 'modulebuilder' , 0 );
2020-01-31 09:29:41 +00:00
2020-04-03 12:56:15 +00:00
$error = 0 ;
2024-11-04 22:53:20 +00:00
$param = '' ;
2020-01-31 09:29:41 +00:00
2020-09-22 07:42:44 +00:00
$form = new Form ( $db );
2017-07-11 18:47:49 +00:00
2020-08-06 13:55:04 +00:00
// Define $listofmodules
$dirsrootforscan = array ( $dirread );
2022-08-27 11:37:06 +00:00
2020-08-06 13:55:04 +00:00
// Add also the core modules into the list of modules to show/edit
2023-11-27 11:32:53 +00:00
if ( $dirread != DOL_DOCUMENT_ROOT && ( getDolGlobalInt ( 'MAIN_FEATURES_LEVEL' ) >= 2 || getDolGlobalString ( 'MODULEBUILDER_ADD_DOCUMENT_ROOT' ))) {
2021-02-26 17:26:44 +00:00
$dirsrootforscan [] = DOL_DOCUMENT_ROOT ;
}
2020-08-06 13:55:04 +00:00
// Search modules to edit
2020-09-22 07:42:44 +00:00
$textforlistofdirs = '<!-- Directory scanned -->' . " \n " ;
2020-08-06 13:55:04 +00:00
$listofmodules = array ();
2024-11-11 13:48:18 +00:00
'@phan-var-force array<string,array{modulenamewithcase:string,moduledescriptorrelpath:string,moduledescriptorfullpath:string,moduledescriptorrootpath,moduletype?:string}> $listofmodules' ;
2020-08-06 13:55:04 +00:00
$i = 0 ;
2022-12-31 11:39:42 +00:00
foreach ( $dirsrootforscan as $tmpdirread ) {
2020-08-06 13:55:04 +00:00
$moduletype = 'external' ;
2022-12-31 11:39:42 +00:00
if ( $tmpdirread == DOL_DOCUMENT_ROOT ) {
2020-08-06 13:55:04 +00:00
$moduletype = 'internal' ;
}
2022-12-31 11:39:42 +00:00
$dirsincustom = dol_dir_list ( $tmpdirread , 'directories' );
2020-08-06 13:55:04 +00:00
if ( is_array ( $dirsincustom ) && count ( $dirsincustom ) > 0 ) {
foreach ( $dirsincustom as $dircustomcursor ) {
$fullname = $dircustomcursor [ 'fullname' ];
2021-02-26 17:26:44 +00:00
if ( dol_is_file ( $fullname . '/' . $FILEFLAG )) {
2020-08-06 13:55:04 +00:00
// Get real name of module (MyModule instead of mymodule)
$dirtoscanrel = basename ( $fullname ) . '/core/modules/' ;
$descriptorfiles = dol_dir_list ( dirname ( $fullname ) . '/' . $dirtoscanrel , 'files' , 0 , 'mod.*\.class\.php$' );
2021-02-26 17:26:44 +00:00
if ( empty ( $descriptorfiles )) { // If descriptor not found into module dir, we look into main module dir.
2020-08-06 13:55:04 +00:00
$dirtoscanrel = 'core/modules/' ;
$descriptorfiles = dol_dir_list ( $fullname . '/../' . $dirtoscanrel , 'files' , 0 , 'mod' . strtoupper ( basename ( $fullname )) . '\.class\.php$' );
}
$modulenamewithcase = '' ;
$moduledescriptorrelpath = '' ;
$moduledescriptorfullpath = '' ;
foreach ( $descriptorfiles as $descriptorcursor ) {
$modulenamewithcase = preg_replace ( '/^mod/' , '' , $descriptorcursor [ 'name' ]);
$modulenamewithcase = preg_replace ( '/\.class\.php$/' , '' , $modulenamewithcase );
$moduledescriptorrelpath = $dirtoscanrel . $descriptorcursor [ 'name' ];
$moduledescriptorfullpath = $descriptorcursor [ 'fullname' ];
//var_dump($descriptorcursor);
}
2021-02-26 17:26:44 +00:00
if ( $modulenamewithcase ) {
2020-08-06 13:55:04 +00:00
$listofmodules [ $dircustomcursor [ 'name' ]] = array (
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
'modulenamewithcase' => $modulenamewithcase ,
'moduledescriptorrelpath' => $moduledescriptorrelpath ,
'moduledescriptorfullpath' => $moduledescriptorfullpath ,
'moduledescriptorrootpath' => $tmpdirread ,
'moduletype' => $moduletype
2020-08-06 13:55:04 +00:00
);
}
//var_dump($listofmodules);
}
}
}
2021-02-26 17:26:44 +00:00
if ( $forceddirread && empty ( $listofmodules )) { // $forceddirread is 1 if we forced dir to read with dirins=... or with module=...@mydir
2020-08-06 13:55:04 +00:00
$listofmodules [ strtolower ( $module )] = array (
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
'modulenamewithcase' => $module ,
'moduledescriptorrelpath' => 'notyetimplemented' ,
'moduledescriptorfullpath' => 'notyetimplemented' ,
'moduledescriptorrootpath' => 'notyetimplemented' ,
2020-08-06 13:55:04 +00:00
);
}
// Show description of content
$newdircustom = $dirins ;
2021-02-26 17:26:44 +00:00
if ( empty ( $newdircustom )) {
$newdircustom = img_warning ();
}
2020-08-06 13:55:04 +00:00
// If dirread was forced to somewhere else, by using URL
// htdocs/modulebuilder/index.php?module=Inventory@/home/ldestailleur/git/dolibarr/htdocs/product
2021-02-26 17:26:44 +00:00
if ( empty ( $i )) {
$textforlistofdirs .= $langs -> trans ( " DirScanned " ) . ' : ' ;
} else {
$textforlistofdirs .= ', ' ;
}
2022-12-31 11:39:42 +00:00
$textforlistofdirs .= '<strong class="wordbreakimp">' . $tmpdirread . '</strong>' ;
if ( $tmpdirread == DOL_DOCUMENT_ROOT ) {
2022-09-27 10:03:54 +00:00
if ( getDolGlobalInt ( 'MAIN_FEATURES_LEVEL' ) >= 2 ) {
2021-02-26 17:26:44 +00:00
$textforlistofdirs .= $form -> textwithpicto ( '' , $langs -> trans ( " ConstantIsOn " , " MAIN_FEATURES_LEVEL " ));
}
2022-09-27 10:03:54 +00:00
if ( getDolGlobalString ( 'MODULEBUILDER_ADD_DOCUMENT_ROOT' )) {
2021-02-26 17:26:44 +00:00
$textforlistofdirs .= $form -> textwithpicto ( '' , $langs -> trans ( " ConstantIsOn " , " MODULEBUILDER_ADD_DOCUMENT_ROOT " ));
}
2020-09-22 07:42:44 +00:00
}
2020-08-06 13:55:04 +00:00
$i ++ ;
}
2024-09-05 16:10:24 +00:00
/**
* Add management to catch fatal errors - shutdown handler
*
* @ return void
*/
function moduleBuilderShutdownFunction ()
{
$error = error_get_last ();
if ( $error && ( $error [ 'type' ] & ( E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR ))) {
// Handle the fatal error
echo " Fatal error occurred: { $error [ 'message' ] } in { $error [ 'file' ] } on line { $error [ 'line' ] } " ;
2024-09-05 16:27:46 +00:00
// If a header was already send, we suppose it is the llx_Header() so we call the llxFooter()
if ( headers_sent ()) {
llxFooter ();
}
2024-09-05 16:10:24 +00:00
}
}
register_shutdown_function ( " moduleBuilderShutdownFunction " );
2020-08-06 13:55:04 +00:00
2024-08-18 16:16:08 +00:00
/**
* Produce copyright replacement string for user
*
* @ param User $user User to produce the copyright notice for .
* @ param Translate $langs Translation object to use .
* @ param int $now Date for which the copyright will be generated .
*
* @ return string String to be used as replacement after Copyright ( C )
*/
function getLicenceHeader ( $user , $langs , $now )
{
$licInfo = $user -> getFullName ( $langs );
$emailTabs = str_repeat ( " \t " , ( int ) ( max ( 0 , ( 31 - mb_strlen ( $licInfo )) / 4 )));
$licInfo .= ( $user -> email ? $emailTabs . '<' . $user -> email . '>' : '' );
$licInfo = dol_print_date ( $now , '%Y' ) . " \t \t " . $licInfo ;
return $licInfo ;
}
2025-11-07 17:24:15 +00:00
2017-05-08 19:00:23 +00:00
/*
* Actions
*/
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
/**
2026-06-28 07:42:08 +00:00
* Post - generation validation -- logs and displays a warning if residual myobject / mymodule tokens remain .
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
*
* @ param string $destfile Path to the generated file
* @ param NamingContract $nc Contract used for generation
2026-05-26 17:21:29 +00:00
* @ return void No return value , warnings reported as event messages
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
*/
function modulebuilderValidateGeneratedFile ( string $destfile , NamingContract $nc ) : void
{
$content = file_get_contents ( $destfile );
if ( $content === false ) {
return ;
}
$validator = new StrictNamingContractValidator ();
$errors = $validator -> validateContent ( $content , $destfile );
if ( ! empty ( $errors )) {
dol_syslog (
'ModuleBuilder NamingContract validation warning in ' . $destfile . ': '
. implode ( '; ' , array_slice ( $errors , 0 , 3 )),
LOG_WARNING
);
$safeErrors = array_map ( 'dol_escape_htmltag' , array_slice ( $errors , 0 , 5 ));
setEventMessages ( implode ( '<br>' , $safeErrors ), null , 'warnings' );
}
}
2026-05-07 07:36:02 +00:00
if ( $dirins && $action == 'initmodule' && $modulename ) { // Test on permission already done
2026-05-06 15:35:58 +00:00
$modulename = dol_string_nounprintableascii ( dol_string_unaccent ( ucwords ( $modulename ))); // Force first letter in uppercase
2024-08-18 16:16:08 +00:00
$destdir = '/not_set/' ;
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
$ncModule = new NamingContract ( $modulename );
2019-02-09 12:40:22 +00:00
2026-05-06 15:35:58 +00:00
if ( preg_match ( '/[^a-z0-9]/i' , $modulename )) {
2017-10-06 00:42:32 +00:00
$error ++ ;
setEventMessages ( $langs -> trans ( " SpaceOrSpecialCharAreNotAllowed " ), null , 'errors' );
}
2021-02-26 17:26:44 +00:00
if ( ! $error ) {
2017-10-06 00:42:32 +00:00
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template' ;
$destdir = $dirins . '/' . strtolower ( $modulename );
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
$arrayreplacement = [
'mymodule' => $ncModule -> moduleNameLower ,
'MyModule' => $ncModule -> moduleNameCase ,
];
2024-09-09 23:02:56 +00:00
$result = dolCopyDir ( $srcdir , $destdir , '0' , 0 , $arrayreplacement );
2017-10-06 00:42:32 +00:00
//dol_mkdir($destfile);
2021-02-26 17:26:44 +00:00
if ( $result <= 0 ) {
if ( $result < 0 ) {
2017-10-06 00:42:32 +00:00
$error ++ ;
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( " ErrorFailToCopyDir " , $srcdir , $destdir ), null , 'errors' );
2020-05-21 07:35:30 +00:00
} else {
2020-05-20 22:02:33 +00:00
// $result == 0
2017-10-06 00:42:32 +00:00
setEventMessages ( $langs -> trans ( " AllFilesDidAlreadyExist " , $srcdir , $destdir ), null , 'warnings' );
}
}
2018-06-30 12:35:33 +00:00
2023-11-02 00:59:51 +00:00
// Copy last 'html.formsetup.class.php' to backport folder
if ( getDolGlobalInt ( 'MODULEBUILDER_SUPPORT_COMPATIBILITY_V16' )) {
$tryToCopyFromSetupClass = true ;
$backportDest = $destdir . '/backport/v16/core/class' ;
$backportFileSrc = DOL_DOCUMENT_ROOT . '/core/class/html.formsetup.class.php' ;
$backportFileDest = $backportDest . '/html.formsetup.class.php' ;
$result = dol_mkdir ( $backportDest );
2022-05-20 22:33:28 +00:00
2023-11-02 00:59:51 +00:00
if ( $result < 0 ) {
$error ++ ;
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( " ErrorFailToCreateDir " , $backportDest ), null , 'errors' );
$tryToCopyFromSetupClass = false ;
}
if ( $tryToCopyFromSetupClass ) {
$result = dol_copy ( $backportFileSrc , $backportFileDest );
if ( $result <= 0 ) {
if ( $result < 0 ) {
$error ++ ;
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( " ErrorFailToCopyFile " , $backportFileSrc , $backportFileDest ), null , 'errors' );
} else {
setEventMessages ( $langs -> trans ( " FileDidAlreadyExist " , $backportFileDest ), null , 'warnings' );
}
2022-05-20 22:33:28 +00:00
}
}
}
2023-11-27 10:56:32 +00:00
if ( getDolGlobalString ( 'MODULEBUILDER_USE_ABOUT' )) {
2018-08-28 00:35:45 +00:00
dol_delete_file ( $destdir . '/admin/about.php' );
}
2017-10-06 00:42:32 +00:00
2019-03-10 18:33:28 +00:00
// Delete dir and files that can be generated in sub tabs later if we need them (we want a minimal module first)
2024-01-11 00:41:13 +00:00
dol_delete_dir_recursive ( $destdir . '/ajax' );
2019-03-10 18:33:28 +00:00
dol_delete_dir_recursive ( $destdir . '/build/doxygen' );
dol_delete_dir_recursive ( $destdir . '/core/modules/mailings' );
2022-12-31 12:23:09 +00:00
dol_delete_dir_recursive ( $destdir . '/core/modules/' . strtolower ( $modulename ));
2019-03-10 18:33:28 +00:00
dol_delete_dir_recursive ( $destdir . '/core/tpl' );
dol_delete_dir_recursive ( $destdir . '/core/triggers' );
dol_delete_dir_recursive ( $destdir . '/doc' );
2021-02-09 11:45:06 +00:00
//dol_delete_dir_recursive($destdir.'/.tx');
2019-03-10 18:33:28 +00:00
dol_delete_dir_recursive ( $destdir . '/core/boxes' );
2020-12-27 15:53:15 +00:00
dol_delete_file ( $destdir . '/admin/myobject_extrafields.php' );
2020-12-25 10:46:29 +00:00
2019-03-10 18:33:28 +00:00
dol_delete_file ( $destdir . '/class/actions_' . strtolower ( $modulename ) . '.class.php' );
dol_delete_file ( $destdir . '/class/api_' . strtolower ( $modulename ) . '.class.php' );
2019-10-24 09:41:36 +00:00
dol_delete_file ( $destdir . '/css/' . strtolower ( $modulename ) . '.css.php' );
dol_delete_file ( $destdir . '/js/' . strtolower ( $modulename ) . '.js.php' );
2019-03-10 18:33:28 +00:00
dol_delete_file ( $destdir . '/scripts/' . strtolower ( $modulename ) . '.php' );
2020-06-29 12:37:36 +00:00
2023-11-02 00:59:51 +00:00
dol_delete_file ( $destdir . '/sql/data.sql' );
dol_delete_file ( $destdir . '/sql/update_x.x.x-y.y.y.sql' );
2019-03-10 18:33:28 +00:00
2019-05-02 10:03:14 +00:00
// Delete some files related to Object (because the previous dolCopyDir has copied everything)
2017-10-06 00:42:32 +00:00
dol_delete_file ( $destdir . '/myobject_card.php' );
2021-11-07 12:51:31 +00:00
dol_delete_file ( $destdir . '/myobject_contact.php' );
2017-10-06 00:42:32 +00:00
dol_delete_file ( $destdir . '/myobject_note.php' );
dol_delete_file ( $destdir . '/myobject_document.php' );
dol_delete_file ( $destdir . '/myobject_agenda.php' );
dol_delete_file ( $destdir . '/myobject_list.php' );
2019-03-10 18:33:28 +00:00
dol_delete_file ( $destdir . '/lib/' . strtolower ( $modulename ) . '_myobject.lib.php' );
2024-01-11 00:41:13 +00:00
dol_delete_file ( $destdir . '/test/phpunit/functional/' . $modulename . 'FunctionalTest.php' );
2017-10-06 00:42:32 +00:00
dol_delete_file ( $destdir . '/test/phpunit/MyObjectTest.php' );
2019-06-06 16:55:24 +00:00
dol_delete_file ( $destdir . '/sql/llx_' . strtolower ( $modulename ) . '_myobject.sql' );
2019-03-10 18:33:28 +00:00
dol_delete_file ( $destdir . '/sql/llx_' . strtolower ( $modulename ) . '_myobject_extrafields.sql' );
dol_delete_file ( $destdir . '/sql/llx_' . strtolower ( $modulename ) . '_myobject.key.sql' );
2020-05-05 19:45:10 +00:00
dol_delete_file ( $destdir . '/sql/llx_' . strtolower ( $modulename ) . '_myobject_extrafields.key.sql' );
2017-10-06 00:42:32 +00:00
dol_delete_file ( $destdir . '/class/myobject.class.php' );
2026-04-27 02:55:29 +00:00
dol_delete_file ( $destdir . '/class/myobjectstats.class.php' );
2020-06-29 12:37:36 +00:00
dol_delete_dir ( $destdir . '/class' , 1 );
dol_delete_dir ( $destdir . '/css' , 1 );
2023-11-02 00:59:51 +00:00
dol_delete_dir ( $destdir . '/js' , 1 );
dol_delete_dir ( $destdir . '/scripts' , 1 );
dol_delete_dir ( $destdir . '/sql' , 1 );
dol_delete_dir ( $destdir . '/test/phpunit/functionnal' , 1 );
2020-06-29 12:37:36 +00:00
dol_delete_dir ( $destdir . '/test/phpunit' , 1 );
dol_delete_dir ( $destdir . '/test' , 1 );
2017-10-06 00:42:32 +00:00
}
// Edit PHP files
2021-02-26 17:26:44 +00:00
if ( ! $error ) {
2017-10-06 00:42:32 +00:00
$listofphpfilestoedit = dol_dir_list ( $destdir , 'files' , 1 , '\.(php|MD|js|sql|txt|xml|lang)$' , '' , 'fullname' , SORT_ASC , 0 , 1 );
2024-08-18 16:16:08 +00:00
$licInfo = getLicenceHeader ( $user , $langs , $now );
2021-02-26 17:26:44 +00:00
foreach ( $listofphpfilestoedit as $phpfileval ) {
2017-10-06 00:42:32 +00:00
//var_dump($phpfileval['fullname']);
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
$arrayreplacement = array_merge (
$ncModule -> getSubstitutionMap (),
[
'htdocs/modulebuilder/template' => $ncModule -> moduleNameLower ,
'---Put here your own copyright and developer email---' => $licInfo ,
'---Replace with your own copyright and developer email---' => $licInfo ,
'Editor name' => $editorname ,
'https://www.example.com' => $editorurl ,
'$this->version = \'1.0\'' => '$this->version = \'' . $version . '\'' ,
'$this->picto = \'generic\';' => ( empty ( $picto )) ? '$this->picto = \'generic\'' : '$this->picto = \'' . $picto . '\';' ,
'modulefamily' => $family ,
// Key '500000' would be cast to int(500000) by PHP, then renumbered to 0 by
2026-06-28 07:42:08 +00:00
// array_merge -- causing str_replace to search for '0' instead of '500000'.
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
// Use a string key that matches the exact assignment line to avoid this.
'$this->numero = 500000' => '$this->numero = ' . $idmodule ,
]
2017-10-06 00:42:32 +00:00
);
2023-11-27 10:56:32 +00:00
if ( getDolGlobalString ( 'MODULEBUILDER_SPECIFIC_AUTHOR' )) {
2024-08-18 16:16:08 +00:00
$arrayreplacement [ '---Replace with your own copyright and developer email---' ] = dol_print_date ( $now , '%Y' ) . " \t \t " . getDolGlobalString ( 'MODULEBUILDER_SPECIFIC_AUTHOR' );
2022-05-01 13:05:25 +00:00
}
2019-03-28 22:57:17 +00:00
2024-03-07 19:16:48 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
2025-02-26 22:14:28 +00:00
$result = dolReplaceInFile ( $phpfileval [ 'fullname' ], $arrayreplacement ); // @phpstan-ignore-line
2017-10-06 00:42:32 +00:00
//var_dump($result);
2021-02-26 17:26:44 +00:00
if ( $result < 0 ) {
2017-10-06 00:42:32 +00:00
setEventMessages ( $langs -> trans ( " ErrorFailToMakeReplacementInto " , $phpfileval [ 'fullname' ]), null , 'errors' );
}
}
2018-06-30 12:35:33 +00:00
2023-11-27 10:56:32 +00:00
if ( getDolGlobalString ( 'MODULEBUILDER_SPECIFIC_README' )) {
2019-08-30 00:21:34 +00:00
setEventMessages ( $langs -> trans ( " ContentOfREADMECustomized " ), null , 'warnings' );
2018-08-28 00:37:06 +00:00
dol_delete_file ( $destdir . '/README.md' );
2025-12-15 15:57:06 +00:00
file_put_contents ( $destdir . '/README.md' , getDolGlobalString ( " MODULEBUILDER_SPECIFIC_README " ));
dolChmod ( $destdir . '/README.md' );
2018-08-28 00:37:06 +00:00
}
2023-07-27 23:19:03 +00:00
// for create file to add properties
// file_put_contents($destdir.'/'.strtolower($modulename).'propertycard.php','');
// $srcFileCard = DOL_DOCUMENT_ROOT.'/modulebuilder/card.php';
// $destFileCard = $dirins.'/'.strtolower($modulename).'/template/card.php';
2024-09-22 23:59:14 +00:00
// dol_copy($srcFileCard, $destdir.'/'.strtolower($modulename).'propertycard.php', '0',1, $arrayreplacement);
2017-10-06 00:42:32 +00:00
}
2021-02-26 17:26:44 +00:00
if ( ! $error ) {
2024-10-28 10:42:35 +00:00
setEventMessages ( $langs -> trans ( 'ModuleInitialized' , $destdir ), null );
2019-11-13 18:37:08 +00:00
$module = $modulename ;
2021-11-07 12:51:31 +00:00
clearstatcache ( true );
if ( function_exists ( 'opcache_invalidate' )) {
opcache_reset (); // remove the include cache hell !
}
header ( " Location: " . $_SERVER [ " PHP_SELF " ] . '?module=' . $modulename );
exit ;
2017-10-06 00:42:32 +00:00
}
2017-05-08 19:00:23 +00:00
}
2017-03-29 19:36:50 +00:00
2024-08-18 16:16:08 +00:00
$destdir = '/not_set/' ; // Initialize (for static analysis)
$destfile = '/not_set/' ; // Initialize (for static analysis)
$srcfile = '/not_set/' ; // Initialize (for static analysis)
2021-04-19 13:22:07 +00:00
2022-05-01 13:05:25 +00:00
// init API, PHPUnit
2025-09-26 21:55:58 +00:00
if ( $dirins && in_array ( $action , array ( 'initapi' , 'initphpunit' , 'initpagecontact' , 'initpagedocument' , 'initpagenote' , 'initpageagenda' )) && ! empty ( $module ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2020-04-05 00:44:59 +00:00
$modulename = ucfirst ( $module ); // Force first letter in uppercase
$objectname = $tabobj ;
2022-05-01 13:05:25 +00:00
$varnametoupdate = '' ;
2023-03-07 15:07:10 +00:00
$dirins = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrootpath' ];
$destdir = $dirins . '/' . strtolower ( $module );
2020-04-05 00:44:59 +00:00
2023-03-07 15:07:10 +00:00
// Get list of existing objects
2023-03-18 01:43:49 +00:00
$objects = dolGetListOfObjectClasses ( $destdir );
2023-03-01 15:40:01 +00:00
2023-03-07 15:07:10 +00:00
2024-09-01 18:34:20 +00:00
if ( $action == 'initapi' ) { // Test on permission already done
2023-03-01 15:40:01 +00:00
if ( file_exists ( $dirins . '/' . strtolower ( $module ) . '/class/api_' . strtolower ( $module ) . '.class.php' )) {
2024-09-22 23:59:14 +00:00
$result = dol_copy ( DOL_DOCUMENT_ROOT . '/modulebuilder/template/class/api_mymodule.class.php' , $dirins . '/' . strtolower ( $module ) . '/class/api_' . strtolower ( $module ) . '.class.php' , '0' , 1 );
2023-03-01 15:40:01 +00:00
}
2022-05-01 13:05:25 +00:00
dol_mkdir ( $dirins . '/' . strtolower ( $module ) . '/class' );
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template' ;
$srcfile = $srcdir . '/class/api_mymodule.class.php' ;
$destfile = $dirins . '/' . strtolower ( $module ) . '/class/api_' . strtolower ( $module ) . '.class.php' ;
2024-09-01 18:34:20 +00:00
} elseif ( $action == 'initphpunit' ) { // Test on permission already done
2022-05-01 13:05:25 +00:00
dol_mkdir ( $dirins . '/' . strtolower ( $module ) . '/test/phpunit' );
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template' ;
$srcfile = $srcdir . '/test/phpunit/MyObjectTest.php' ;
$destfile = $dirins . '/' . strtolower ( $module ) . '/test/phpunit/' . strtolower ( $objectname ) . 'Test.php' ;
2024-09-01 18:34:20 +00:00
} elseif ( $action == 'initpagecontact' ) { // Test on permission already done
2022-05-01 13:05:25 +00:00
dol_mkdir ( $dirins . '/' . strtolower ( $module ));
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template' ;
$srcfile = $srcdir . '/myobject_contact.php' ;
$destfile = $dirins . '/' . strtolower ( $module ) . '/' . strtolower ( $objectname ) . '_contact.php' ;
$varnametoupdate = 'showtabofpagecontact' ;
2024-09-01 18:34:20 +00:00
} elseif ( $action == 'initpagedocument' ) { // Test on permission already done
2022-05-01 13:05:25 +00:00
dol_mkdir ( $dirins . '/' . strtolower ( $module ));
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template' ;
$srcfile = $srcdir . '/myobject_document.php' ;
$destfile = $dirins . '/' . strtolower ( $module ) . '/' . strtolower ( $objectname ) . '_document.php' ;
$varnametoupdate = 'showtabofpagedocument' ;
2024-09-01 18:34:20 +00:00
} elseif ( $action == 'initpagenote' ) { // Test on permission already done
2022-05-01 13:05:25 +00:00
dol_mkdir ( $dirins . '/' . strtolower ( $module ));
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template' ;
$srcfile = $srcdir . '/myobject_note.php' ;
$destfile = $dirins . '/' . strtolower ( $module ) . '/' . strtolower ( $objectname ) . '_note.php' ;
$varnametoupdate = 'showtabofpagenote' ;
2024-09-01 18:34:20 +00:00
} elseif ( $action == 'initpageagenda' ) { // Test on permission already done
2022-05-01 13:05:25 +00:00
dol_mkdir ( $dirins . '/' . strtolower ( $module ));
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template' ;
$srcfile = $srcdir . '/myobject_agenda.php' ;
$destfile = $dirins . '/' . strtolower ( $module ) . '/' . strtolower ( $objectname ) . '_agenda.php' ;
$varnametoupdate = 'showtabofpageagenda' ;
2020-04-05 00:44:59 +00:00
}
2021-04-19 13:22:07 +00:00
2023-03-01 15:40:01 +00:00
if ( ! file_exists ( $destfile )) {
2024-09-22 23:59:14 +00:00
$result = dol_copy ( $srcfile , $destfile , '0' , 0 );
2023-03-01 15:40:01 +00:00
}
2019-05-02 10:03:14 +00:00
2021-04-19 13:24:14 +00:00
if ( $result > 0 ) {
2020-04-05 00:44:59 +00:00
//var_dump($phpfileval['fullname']);
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
try {
$ncApiObj = new NamingContract ( $modulename , $objectname );
} catch ( \InvalidArgumentException $e ) {
$error ++ ;
setEventMessages ( $langs -> trans ( " SpaceOrSpecialCharAreNotAllowed " ), null , 'errors' );
$ncApiObj = null ;
}
2024-08-18 16:16:08 +00:00
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
if ( ! $error && $ncApiObj !== null ) {
$arrayreplacement = array_merge (
$ncApiObj -> getSubstitutionMap (),
[
'htdocs/modulebuilder/template' => $ncApiObj -> moduleNameLower ,
'---Replace with your own copyright and developer email---' => getLicenceHeader ( $user , $langs , $now ),
]
);
2023-03-07 15:07:10 +00:00
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
if ( $action == 'initapi' ) { // Test on permission already done
if ( count ( $objects ) >= 1 ) {
addObjectsToApiFile ( $srcfile , $destfile , $objects , $modulename );
}
// Fix PHPDoc header and class-declaration residuals left by addObjectsToApiFile.
// 'MYOBJECT' (uppercase) is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
// placeholder that addObjectsToApiFile keeps for future object additions.
$headerFix = $arrayreplacement ;
unset ( $headerFix [ 'MYOBJECT' ]);
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
dolReplaceInFile ( $destfile , $headerFix );
modulebuilderValidateGeneratedFile ( $destfile , $ncApiObj );
} else {
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
dolReplaceInFile ( $destfile , $arrayreplacement );
modulebuilderValidateGeneratedFile ( $destfile , $ncApiObj );
2024-03-14 15:39:12 +00:00
}
2023-03-01 15:40:01 +00:00
}
2022-05-01 13:05:25 +00:00
if ( $varnametoupdate ) {
// Now we update the object file to set $$varnametoupdate to 1
$srcfile = $dirins . '/' . strtolower ( $module ) . '/lib/' . strtolower ( $module ) . '_' . strtolower ( $objectname ) . '.lib.php' ;
2023-12-21 18:39:02 +00:00
$arrayreplacement = array ( '/\$' . preg_quote ( $varnametoupdate , '/' ) . ' = 0;/' => '$' . $varnametoupdate . ' = 1;' );
2024-03-07 19:16:48 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
2024-09-06 11:47:24 +00:00
dolReplaceInFile ( $srcfile , $arrayreplacement , '' , '0' , 0 , 1 );
2022-05-01 13:05:25 +00:00
}
2021-04-19 13:24:14 +00:00
} else {
2020-04-05 00:44:59 +00:00
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( 'ErrorFailToCreateFile' , $destfile ), null , 'errors' );
}
2019-05-02 10:03:14 +00:00
}
2021-04-19 13:22:07 +00:00
// init ExtraFields
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'initsqlextrafields' && ! empty ( $module ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2020-01-30 00:48:28 +00:00
$modulename = ucfirst ( $module ); // Force first letter in uppercase
2019-08-28 11:04:22 +00:00
$objectname = $tabobj ;
dol_mkdir ( $dirins . '/' . strtolower ( $module ) . '/sql' );
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template' ;
$srcfile1 = $srcdir . '/sql/llx_mymodule_myobject_extrafields.sql' ;
$destfile1 = $dirins . '/' . strtolower ( $module ) . '/sql/llx_' . strtolower ( $module ) . '_' . strtolower ( $objectname ) . '_extrafields.sql' ;
2024-09-22 23:59:14 +00:00
$result1 = dol_copy ( $srcfile1 , $destfile1 , '0' , 0 );
2019-08-28 11:04:22 +00:00
$srcfile2 = $srcdir . '/sql/llx_mymodule_myobject_extrafields.key.sql' ;
$destfile2 = $dirins . '/' . strtolower ( $module ) . '/sql/llx_' . strtolower ( $module ) . '_' . strtolower ( $objectname ) . '_extrafields.key.sql' ;
2024-09-22 23:59:14 +00:00
$result2 = dol_copy ( $srcfile2 , $destfile2 , '0' , 0 );
2019-08-28 11:04:22 +00:00
2021-04-19 13:24:14 +00:00
if ( $result1 > 0 && $result2 > 0 ) {
2020-01-30 00:48:28 +00:00
$modulename = ucfirst ( $module ); // Force first letter in uppercase
2019-08-28 11:04:22 +00:00
//var_dump($phpfileval['fullname']);
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
try {
$ncSqlObj = new NamingContract ( $modulename , $objectname );
} catch ( \InvalidArgumentException $e ) {
$error ++ ;
setEventMessages ( $langs -> trans ( " SpaceOrSpecialCharAreNotAllowed " ), null , 'errors' );
$ncSqlObj = null ;
}
if ( ! $error && $ncSqlObj !== null ) {
$arrayreplacement = array_merge (
$ncSqlObj -> getSubstitutionMap (),
[
'htdocs/modulebuilder/template' => $ncSqlObj -> moduleNameLower ,
'---Replace with your own copyright and developer email---' => getLicenceHeader ( $user , $langs , $now ),
]
);
2019-08-28 11:04:22 +00:00
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
dolReplaceInFile ( $destfile1 , $arrayreplacement );
dolReplaceInFile ( $destfile2 , $arrayreplacement );
modulebuilderValidateGeneratedFile ( $destfile1 , $ncSqlObj );
modulebuilderValidateGeneratedFile ( $destfile2 , $ncSqlObj );
}
2021-04-19 13:24:14 +00:00
} else {
2019-10-24 12:08:26 +00:00
$langs -> load ( " errors " );
2022-04-12 13:26:21 +00:00
if ( $result1 <= 0 ) {
setEventMessages ( $langs -> trans ( 'ErrorFailToCreateFile' , $destfile1 ), null , 'errors' );
}
if ( $result2 <= 0 ) {
setEventMessages ( $langs -> trans ( 'ErrorFailToCreateFile' , $destfile2 ), null , 'errors' );
}
2019-10-24 12:08:26 +00:00
}
2022-04-12 13:51:46 +00:00
2024-05-04 22:34:19 +00:00
// Now we update the object file to set $this->isextrafieldmanaged to 1
2022-04-12 13:51:46 +00:00
$srcfile = $dirins . '/' . strtolower ( $module ) . '/class/' . strtolower ( $objectname ) . '.class.php' ;
2024-05-04 22:34:19 +00:00
$arrayreplacement = array ( '/\$this->isextrafieldmanaged = 0;/' => '$this->isextrafieldmanaged = 1;' );
2025-07-31 13:18:28 +00:00
$arrayreplacement = array ( '/\$isextrafieldmanaged = 0;/' => '$isextrafieldmanaged = 1;' );
2024-09-06 11:47:24 +00:00
dolReplaceInFile ( $srcfile , $arrayreplacement , '' , '0' , 0 , 1 );
2019-08-28 11:04:22 +00:00
}
2021-04-19 13:22:07 +00:00
// init Hook
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'inithook' && ! empty ( $module ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2020-04-05 00:44:59 +00:00
dol_mkdir ( $dirins . '/' . strtolower ( $module ) . '/class' );
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template' ;
$srcfile = $srcdir . '/class/actions_mymodule.class.php' ;
$destfile = $dirins . '/' . strtolower ( $module ) . '/class/actions_' . strtolower ( $module ) . '.class.php' ;
2024-09-22 23:59:14 +00:00
$result = dol_copy ( $srcfile , $destfile , '0' , 0 );
2019-05-02 10:03:14 +00:00
2021-04-19 13:24:14 +00:00
if ( $result > 0 ) {
2020-04-05 00:44:59 +00:00
$modulename = ucfirst ( $module ); // Force first letter in uppercase
//var_dump($phpfileval['fullname']);
$arrayreplacement = array (
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
'mymodule' => strtolower ( $modulename ),
'MyModule' => $modulename ,
'MYMODULE' => strtoupper ( $modulename ),
'My module' => $modulename ,
'my module' => $modulename ,
'Mon module' => $modulename ,
'mon module' => $modulename ,
'htdocs/modulebuilder/template' => strtolower ( $modulename ),
2024-08-18 16:16:08 +00:00
'---Replace with your own copyright and developer email---' => getLicenceHeader ( $user , $langs , $now )
2020-04-05 00:44:59 +00:00
);
2024-03-07 19:16:48 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
2020-04-05 00:44:59 +00:00
dolReplaceInFile ( $destfile , $arrayreplacement );
2021-04-19 13:24:14 +00:00
} else {
2020-04-05 00:44:59 +00:00
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( 'ErrorFailToCreateFile' , $destfile ), null , 'errors' );
}
2019-03-10 18:33:28 +00:00
}
2021-04-19 13:22:07 +00:00
// init Trigger
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'inittrigger' && ! empty ( $module ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2020-04-05 00:44:59 +00:00
dol_mkdir ( $dirins . '/' . strtolower ( $module ) . '/core/triggers' );
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template' ;
$srcfile = $srcdir . '/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php' ;
$destfile = $dirins . '/' . strtolower ( $module ) . '/core/triggers/interface_99_mod' . $module . '_' . $module . 'Triggers.class.php' ;
2024-09-22 23:59:14 +00:00
$result = dol_copy ( $srcfile , $destfile , '0' , 0 );
2020-04-05 00:44:59 +00:00
2021-04-19 13:24:14 +00:00
if ( $result > 0 ) {
2020-04-05 00:44:59 +00:00
$modulename = ucfirst ( $module ); // Force first letter in uppercase
2019-03-10 18:33:28 +00:00
2020-04-05 00:44:59 +00:00
//var_dump($phpfileval['fullname']);
$arrayreplacement = array (
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
'mymodule' => strtolower ( $modulename ),
'MyModule' => $modulename ,
'MYMODULE' => strtoupper ( $modulename ),
'My module' => $modulename ,
'my module' => $modulename ,
'Mon module' => $modulename ,
'mon module' => $modulename ,
'htdocs/modulebuilder/template' => strtolower ( $modulename ),
2024-08-18 16:16:08 +00:00
'---Replace with your own copyright and developer email---' => getLicenceHeader ( $user , $langs , $now )
2020-04-05 00:44:59 +00:00
);
2024-03-07 19:16:48 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
2020-04-05 00:44:59 +00:00
dolReplaceInFile ( $destfile , $arrayreplacement );
2021-04-19 13:24:14 +00:00
} else {
2020-04-05 00:44:59 +00:00
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( 'ErrorFailToCreateFile' , $destfile ), null , 'errors' );
}
2019-03-10 18:33:28 +00:00
}
2021-04-19 13:22:07 +00:00
// init Widget
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'initwidget' && ! empty ( $module ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2020-04-05 00:44:59 +00:00
dol_mkdir ( $dirins . '/' . strtolower ( $module ) . '/core/boxes' );
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template' ;
$srcfile = $srcdir . '/core/boxes/mymodulewidget1.php' ;
$destfile = $dirins . '/' . strtolower ( $module ) . '/core/boxes/' . strtolower ( $module ) . 'widget1.php' ;
2024-09-22 23:59:14 +00:00
$result = dol_copy ( $srcfile , $destfile , '0' , 0 );
2019-03-10 18:33:28 +00:00
2021-04-19 13:24:14 +00:00
if ( $result > 0 ) {
2020-04-05 00:44:59 +00:00
$modulename = ucfirst ( $module ); // Force first letter in uppercase
//var_dump($phpfileval['fullname']);
$arrayreplacement = array (
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
'mymodule' => strtolower ( $modulename ),
'MyModule' => $modulename ,
'MYMODULE' => strtoupper ( $modulename ),
'My module' => $modulename ,
'my module' => $modulename ,
'Mon module' => $modulename ,
'mon module' => $modulename ,
'htdocs/modulebuilder/template' => strtolower ( $modulename ),
2024-08-18 16:16:08 +00:00
'---Replace with your own copyright and developer email---' => getLicenceHeader ( $user , $langs , $now )
2020-04-05 00:44:59 +00:00
);
2024-03-07 19:16:48 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
2020-04-05 00:44:59 +00:00
dolReplaceInFile ( $destfile , $arrayreplacement );
2021-04-19 13:24:14 +00:00
} else {
2020-04-05 00:44:59 +00:00
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( 'ErrorFailToCreateFile' , $destfile ), null , 'errors' );
}
2019-03-10 18:33:28 +00:00
}
2021-04-19 13:22:07 +00:00
2024-01-11 01:47:42 +00:00
// init EmailSelector
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'initemailing' && ! empty ( $module ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2024-01-11 01:47:42 +00:00
dol_mkdir ( $dirins . '/' . strtolower ( $module ) . '/core/modules/mailings' );
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template' ;
2024-01-11 13:37:32 +00:00
$srcfile = $srcdir . '/core/modules/mailings/mailing_mymodule_selector1.modules.php' ;
2024-01-11 01:47:42 +00:00
$destfile = $dirins . '/' . strtolower ( $module ) . '/core/modules/mailings/mailing_' . strtolower ( $module ) . '_selector1.modules.php' ;
2024-09-22 23:59:14 +00:00
$result = dol_copy ( $srcfile , $destfile , '0' , 0 );
2024-01-11 01:47:42 +00:00
if ( $result > 0 ) {
$modulename = ucfirst ( $module ); // Force first letter in uppercase
//var_dump($phpfileval['fullname']);
$arrayreplacement = array (
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
'mymodule' => strtolower ( $modulename ),
'MyModule' => $modulename ,
'MYMODULE' => strtoupper ( $modulename ),
'My module' => $modulename ,
'my module' => $modulename ,
'Mon module' => $modulename ,
'mon module' => $modulename ,
'htdocs/modulebuilder/template' => strtolower ( $modulename ),
2024-08-18 16:16:08 +00:00
'---Replace with your own copyright and developer email---' => getLicenceHeader ( $user , $langs , $now )
2024-01-11 01:47:42 +00:00
);
2024-03-07 19:16:48 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
2024-01-11 01:47:42 +00:00
dolReplaceInFile ( $destfile , $arrayreplacement );
} else {
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( 'ErrorFailToCreateFile' , $destfile ), null , 'errors' );
}
}
2021-04-19 13:22:07 +00:00
// init CSS
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'initcss' && ! empty ( $module ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2019-10-24 09:41:36 +00:00
dol_mkdir ( $dirins . '/' . strtolower ( $module ) . '/css' );
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template' ;
$srcfile = $srcdir . '/css/mymodule.css.php' ;
2019-10-24 12:08:26 +00:00
$destfile = $dirins . '/' . strtolower ( $module ) . '/css/' . strtolower ( $module ) . '.css.php' ;
2024-09-22 23:59:14 +00:00
$result = dol_copy ( $srcfile , $destfile , '0' , 0 );
2019-10-24 09:41:36 +00:00
2021-04-19 13:24:14 +00:00
if ( $result > 0 ) {
2020-01-30 00:48:28 +00:00
$modulename = ucfirst ( $module ); // Force first letter in uppercase
2019-10-24 09:41:36 +00:00
//var_dump($phpfileval['fullname']);
2020-01-30 00:48:28 +00:00
$arrayreplacement = array (
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
'mymodule' => strtolower ( $modulename ),
'MyModule' => $modulename ,
'MYMODULE' => strtoupper ( $modulename ),
'My module' => $modulename ,
'my module' => $modulename ,
'Mon module' => $modulename ,
'mon module' => $modulename ,
'htdocs/modulebuilder/template' => strtolower ( $modulename ),
2024-08-18 16:16:08 +00:00
'---Replace with your own copyright and developer email---' => getLicenceHeader ( $user , $langs , $now )
2019-10-24 09:41:36 +00:00
);
2024-03-07 19:16:48 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
2019-10-24 09:41:36 +00:00
dolReplaceInFile ( $destfile , $arrayreplacement );
2019-11-01 02:10:48 +00:00
// Update descriptor file to uncomment file
2020-04-05 00:44:59 +00:00
$srcfile = $dirins . '/' . strtolower ( $module ) . '/core/modules/mod' . $module . '.class.php' ;
$arrayreplacement = array ( '/\/\/\s*\'' . preg_quote ( '/' . strtolower ( $module ) . '/css/' . strtolower ( $module ) . '.css.php' , '/' ) . '\'/' => '\'/' . strtolower ( $module ) . '/css/' . strtolower ( $module ) . '.css.php\'' );
2024-09-06 11:47:24 +00:00
dolReplaceInFile ( $srcfile , $arrayreplacement , '' , '0' , 0 , 1 );
2021-04-19 13:24:14 +00:00
} else {
2019-10-24 12:08:26 +00:00
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( 'ErrorFailToCreateFile' , $destfile ), null , 'errors' );
}
2019-10-24 09:41:36 +00:00
}
2020-05-29 13:29:47 +00:00
2021-04-19 13:22:07 +00:00
// init JS
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'initjs' && ! empty ( $module ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2019-10-24 09:41:36 +00:00
dol_mkdir ( $dirins . '/' . strtolower ( $module ) . '/js' );
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template' ;
$srcfile = $srcdir . '/js/mymodule.js.php' ;
2019-10-24 12:08:26 +00:00
$destfile = $dirins . '/' . strtolower ( $module ) . '/js/' . strtolower ( $module ) . '.js.php' ;
2024-09-22 23:59:14 +00:00
$result = dol_copy ( $srcfile , $destfile , '0' , 0 );
2019-10-24 09:41:36 +00:00
2021-04-19 13:24:14 +00:00
if ( $result > 0 ) {
2020-01-30 00:48:28 +00:00
$modulename = ucfirst ( $module ); // Force first letter in uppercase
2019-10-24 09:41:36 +00:00
//var_dump($phpfileval['fullname']);
2020-01-30 00:48:28 +00:00
$arrayreplacement = array (
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
'mymodule' => strtolower ( $modulename ),
'MyModule' => $modulename ,
'MYMODULE' => strtoupper ( $modulename ),
'My module' => $modulename ,
'my module' => $modulename ,
'Mon module' => $modulename ,
'mon module' => $modulename ,
'htdocs/modulebuilder/template' => strtolower ( $modulename ),
2024-08-18 16:16:08 +00:00
'---Replace with your own copyright and developer email---' => getLicenceHeader ( $user , $langs , $now )
2019-10-24 09:41:36 +00:00
);
2024-03-07 19:16:48 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
2019-10-24 09:41:36 +00:00
dolReplaceInFile ( $destfile , $arrayreplacement );
2019-11-01 02:10:48 +00:00
// Update descriptor file to uncomment file
$srcfile = $dirins . '/' . strtolower ( $module ) . '/core/modules/mod' . $module . '.class.php' ;
$arrayreplacement = array ( '/\/\/\s*\'' . preg_quote ( '/' . strtolower ( $module ) . '/js/' . strtolower ( $module ) . '.js.php' , '/' ) . '\'/' => '\'/' . strtolower ( $module ) . '/js/' . strtolower ( $module ) . '.js.php\'' );
2024-09-06 11:47:24 +00:00
dolReplaceInFile ( $srcfile , $arrayreplacement , '' , '0' , 0 , 1 );
2021-04-19 13:24:14 +00:00
} else {
2019-10-24 12:08:26 +00:00
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( 'ErrorFailToCreateFile' , $destfile ), null , 'errors' );
}
2019-10-24 09:41:36 +00:00
}
2021-04-19 13:22:07 +00:00
// init CLI
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'initcli' && ! empty ( $module ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2020-04-05 00:44:59 +00:00
dol_mkdir ( $dirins . '/' . strtolower ( $module ) . '/scripts' );
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template' ;
$srcfile = $srcdir . '/scripts/mymodule.php' ;
$destfile = $dirins . '/' . strtolower ( $module ) . '/scripts/' . strtolower ( $module ) . '.php' ;
2024-09-22 23:59:14 +00:00
$result = dol_copy ( $srcfile , $destfile , '0' , 0 );
2019-03-10 18:33:28 +00:00
2021-02-26 17:26:44 +00:00
if ( $result > 0 ) {
2020-04-05 00:44:59 +00:00
$modulename = ucfirst ( $module ); // Force first letter in uppercase
//var_dump($phpfileval['fullname']);
$arrayreplacement = array (
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
'mymodule' => strtolower ( $modulename ),
'MyModule' => $modulename ,
'MYMODULE' => strtoupper ( $modulename ),
'My module' => $modulename ,
'my module' => $modulename ,
'Mon module' => $modulename ,
'mon module' => $modulename ,
'htdocs/modulebuilder/template' => strtolower ( $modulename ),
'__MYCOMPANY_NAME__' => $mysoc -> name ,
'__KEYWORDS__' => $modulename ,
'__USER_FULLNAME__' => $user -> getFullName ( $langs ),
'__USER_EMAIL__' => $user -> email ,
'__YYYY-MM-DD__' => dol_print_date ( $now , 'dayrfc' ),
2024-08-18 16:16:08 +00:00
'---Replace with your own copyright and developer email---' => getLicenceHeader ( $user , $langs , $now )
2020-04-05 00:44:59 +00:00
);
2024-03-07 19:16:48 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
2020-04-05 00:44:59 +00:00
dolReplaceInFile ( $destfile , $arrayreplacement );
2021-04-19 13:24:14 +00:00
} else {
2020-04-05 00:44:59 +00:00
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( 'ErrorFailToCreateFile' , $destfile ), null , 'errors' );
}
2019-03-10 18:33:28 +00:00
}
2021-04-19 13:22:07 +00:00
2024-08-18 16:16:08 +00:00
$moduledescriptorfile = '/not_set/' ;
2025-02-05 21:59:37 +00:00
$modulelowercase = null ;
2024-08-18 16:16:08 +00:00
2021-04-19 13:22:07 +00:00
// init Doc
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'initdoc' && ! empty ( $module ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2020-04-05 00:44:59 +00:00
dol_mkdir ( $dirins . '/' . strtolower ( $module ) . '/doc' );
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template' ;
$srcfile = $srcdir . '/doc/Documentation.asciidoc' ;
$destfile = $dirins . '/' . strtolower ( $module ) . '/doc/Documentation.asciidoc' ;
2024-09-22 23:59:14 +00:00
$result = dol_copy ( $srcfile , $destfile , '0' , 0 );
2020-04-05 00:44:59 +00:00
2021-04-19 13:24:14 +00:00
if ( $result > 0 ) {
2020-04-05 00:44:59 +00:00
$modulename = ucfirst ( $module ); // Force first letter in uppercase
$modulelowercase = strtolower ( $module );
2019-03-10 18:33:28 +00:00
2020-04-05 00:44:59 +00:00
//var_dump($phpfileval['fullname']);
$arrayreplacement = array (
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
'mymodule' => strtolower ( $modulename ),
'MyModule' => $modulename ,
'MYMODULE' => strtoupper ( $modulename ),
'My module' => $modulename ,
'my module' => $modulename ,
'Mon module' => $modulename ,
'mon module' => $modulename ,
'htdocs/modulebuilder/template' => strtolower ( $modulename ),
'__MYCOMPANY_NAME__' => $mysoc -> name ,
'__KEYWORDS__' => $modulename ,
'__USER_FULLNAME__' => $user -> getFullName ( $langs ),
'__USER_EMAIL__' => $user -> email ,
'__YYYY-MM-DD__' => dol_print_date ( $now , 'dayrfc' ),
2024-08-18 16:16:08 +00:00
'---Replace with your own copyright and developer email---' => getLicenceHeader ( $user , $langs , $now )
2020-04-05 00:44:59 +00:00
);
2024-03-07 19:16:48 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
2020-04-05 00:44:59 +00:00
dolReplaceInFile ( $destfile , $arrayreplacement );
2023-03-18 01:55:35 +00:00
// add table of properties
$dirins = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrootpath' ];
$destdir = $dirins . '/' . strtolower ( $module );
2023-03-18 13:58:00 +00:00
$objects = dolGetListOfObjectClasses ( $destdir );
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
foreach ( $objects as $path => $obj ) {
2023-03-18 01:55:35 +00:00
writePropsInAsciiDoc ( $path , $obj , $destfile );
}
2023-03-24 17:21:06 +00:00
// add table of permissions
$moduledescriptorfile = $dirins . '/' . strtolower ( $module ) . '/core/modules/mod' . $module . '.class.php' ;
writePermsInAsciiDoc ( $moduledescriptorfile , $destfile );
2023-08-16 10:45:01 +00:00
// add api urls if file exist
if ( file_exists ( $dirins . '/' . strtolower ( $module ) . '/class/api_' . strtolower ( $module ) . '.class.php' )) {
$apiFile = $dirins . '/' . strtolower ( $module ) . '/class/api_' . strtolower ( $module ) . '.class.php' ;
writeApiUrlsInDoc ( $apiFile , $destfile );
}
2023-09-08 12:45:59 +00:00
// add ChangeLog in Doc
if ( file_exists ( $dirins . '/' . strtolower ( $module ) . '/ChangeLog.md' )) {
$changeLog = $dirins . '/' . strtolower ( $module ) . '/ChangeLog.md' ;
$string = file_get_contents ( $changeLog );
$replace = explode ( " \n " , $string );
$strreplace = array ();
foreach ( $replace as $line ) {
if ( $line === '' ) {
continue ;
}
if ( strpos ( $line , '##' ) !== false ) {
$strreplace [ $line ] = str_replace ( '##' , '' , $line );
} else {
$strreplace [ $line ] = $line ;
}
}
$stringLog = implode ( " \n " , $strreplace );
2024-03-07 19:16:48 +00:00
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
2023-09-08 19:34:54 +00:00
dolReplaceInFile ( $destfile , array ( '//include::ChangeLog.md[]' => '' , '__CHANGELOG__' => $stringLog ));
2023-09-08 12:45:59 +00:00
}
2020-04-05 00:44:59 +00:00
// Delete old documentation files
$FILENAMEDOC = $modulelowercase . '.html' ;
$FILENAMEDOCPDF = $modulelowercase . '.pdf' ;
$outputfiledoc = dol_buildpath ( $modulelowercase , 0 ) . '/doc/' . $FILENAMEDOC ;
$outputfiledocurl = dol_buildpath ( $modulelowercase , 1 ) . '/doc/' . $FILENAMEDOC ;
$outputfiledocpdf = dol_buildpath ( $modulelowercase , 0 ) . '/doc/' . $FILENAMEDOCPDF ;
$outputfiledocurlpdf = dol_buildpath ( $modulelowercase , 1 ) . '/doc/' . $FILENAMEDOCPDF ;
dol_delete_file ( $outputfiledoc , 0 , 0 , 0 , null , false , 0 );
dol_delete_file ( $outputfiledocpdf , 0 , 0 , 0 , null , false , 0 );
2021-04-19 13:24:14 +00:00
} else {
2020-04-05 00:44:59 +00:00
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( 'ErrorFailToCreateFile' , $destfile ), null , 'errors' );
}
2019-03-10 18:33:28 +00:00
}
2021-04-19 13:22:07 +00:00
// add Language
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'addlanguage' && ! empty ( $module ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2019-11-13 18:37:08 +00:00
$newlangcode = GETPOST ( 'newlangcode' , 'aZ09' );
2021-05-02 10:15:31 +00:00
if ( $newlangcode ) {
$modulelowercase = strtolower ( $module );
// Dir for module
$diroflang = dol_buildpath ( $modulelowercase , 0 );
2021-11-19 15:38:41 +00:00
if ( $diroflang == $dolibarr_main_document_root . '/' . $modulelowercase ) {
2021-05-02 10:15:31 +00:00
// This is not a custom module, we force diroflang to htdocs root
2021-11-19 15:38:41 +00:00
$diroflang = $dolibarr_main_document_root ;
2021-05-02 10:15:31 +00:00
$srcfile = $diroflang . '/langs/en_US/' . $modulelowercase . '.lang' ;
$destfile = $diroflang . '/langs/' . $newlangcode . '/' . $modulelowercase . '.lang' ;
2024-09-22 23:59:14 +00:00
$result = dol_copy ( $srcfile , $destfile , '0' , 0 );
2021-05-02 10:15:31 +00:00
if ( $result < 0 ) {
setEventMessages ( $langs -> trans ( " ErrorFailToCopyFile " , $srcfile , $destfile ), null , 'errors' );
}
} else {
2023-03-07 16:05:17 +00:00
$srcdir = $diroflang . '/langs/en_US' ;
$srcfile = $diroflang . '/langs/en_US/' . $modulelowercase . '.lang' ;
$destdir = $diroflang . '/langs/' . $newlangcode ;
2021-05-02 10:15:31 +00:00
2023-03-07 16:05:17 +00:00
$arrayofreplacement = array ();
2025-04-20 11:21:21 +00:00
if ( ! dol_is_dir ( $srcdir ) || ! dol_is_file ( $srcfile )) {
2023-03-07 16:05:17 +00:00
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template/langs/en_US' ;
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
$arrayofreplacement = array ( 'mymodule' => $modulelowercase );
2023-03-07 16:05:17 +00:00
}
2024-09-09 23:02:56 +00:00
$result = dolCopyDir ( $srcdir , $destdir , '0' , 0 , $arrayofreplacement );
2021-05-02 10:15:31 +00:00
}
} else {
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentitiesnoconv ( " Language " )), null , 'errors' );
}
2017-11-19 15:26:39 +00:00
}
2021-04-19 13:22:07 +00:00
2023-03-07 14:51:27 +00:00
// Remove/delete File
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'confirm_removefile' && ! empty ( $module ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2022-04-12 13:51:46 +00:00
$objectname = $tabobj ;
2023-03-07 15:07:10 +00:00
$dirins = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrootpath' ];
$destdir = $dirins . '/' . strtolower ( $module );
2022-04-12 13:51:46 +00:00
2022-01-19 14:20:10 +00:00
$relativefilename = dol_sanitizePathName ( GETPOST ( 'file' , 'restricthtml' ));
2023-03-01 15:40:01 +00:00
2023-03-07 14:51:27 +00:00
// Now we delete the file
if ( $relativefilename ) {
$dirnametodelete = dirname ( $relativefilename );
$filetodelete = $dirins . '/' . $relativefilename ;
$dirtodelete = $dirins . '/' . $dirnametodelete ;
2024-03-14 15:39:12 +00:00
// Get list of existing objects
$objects = dolGetListOfObjectClasses ( $destdir );
$keyofobjecttodelete = array_search ( $objectname , $objects );
if ( $keyofobjecttodelete !== false ) {
unset ( $objects [ $keyofobjecttodelete ]);
}
// Delete or modify the file
2023-04-13 15:13:56 +00:00
if ( strpos ( $relativefilename , 'api' ) !== false ) {
2023-06-14 13:36:43 +00:00
$file_api = $destdir . '/class/api_' . strtolower ( $module ) . '.class.php' ;
2024-03-14 15:39:12 +00:00
$removeFile = removeObjectFromApiFile ( $file_api , $objects , $objectname );
if ( count ( $objects ) == 0 ) {
2026-07-29 11:20:28 +00:00
$result = dol_delete_file ( $filetodelete , 1 );
2023-04-13 15:13:56 +00:00
}
2024-03-14 15:39:12 +00:00
2023-04-13 15:13:56 +00:00
if ( $removeFile ) {
setEventMessages ( $langs -> trans ( " ApiObjectDeleted " ), null );
}
} else {
2026-07-29 11:20:28 +00:00
$result = dol_delete_file ( $filetodelete , 1 );
2023-04-13 15:13:56 +00:00
}
2024-03-14 15:39:12 +00:00
2023-03-07 14:51:27 +00:00
if ( ! $result ) {
setEventMessages ( $langs -> trans ( " ErrorFailToDeleteFile " , basename ( $filetodelete )), null , 'errors' );
} else {
// If we delete a .sql file, we delete also the other .sql file
if ( preg_match ( '/\.sql$/' , $relativefilename )) {
if ( preg_match ( '/\.key\.sql$/' , $relativefilename )) {
$relativefilename = preg_replace ( '/\.key\.sql$/' , '.sql' , $relativefilename );
$filetodelete = $dirins . '/' . $relativefilename ;
2026-07-29 11:20:28 +00:00
$result = dol_delete_file ( $filetodelete , 1 );
2023-03-07 14:51:27 +00:00
} elseif ( preg_match ( '/\.sql$/' , $relativefilename )) {
$relativefilename = preg_replace ( '/\.sql$/' , '.key.sql' , $relativefilename );
$filetodelete = $dirins . '/' . $relativefilename ;
2026-07-29 11:20:28 +00:00
$result = dol_delete_file ( $filetodelete , 1 );
2022-04-12 13:26:21 +00:00
}
}
2020-04-05 00:44:59 +00:00
2023-03-07 14:51:27 +00:00
if ( dol_is_dir_empty ( $dirtodelete )) {
dol_delete_dir ( $dirtodelete );
}
2022-04-12 13:51:46 +00:00
2023-03-07 14:51:27 +00:00
// Update descriptor file to comment file
if ( in_array ( $tab , array ( 'css' , 'js' ))) {
$srcfile = $dirins . '/' . strtolower ( $module ) . '/core/modules/mod' . $module . '.class.php' ;
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
$arrayreplacement = array ( '/^\s*\'' . preg_quote ( '/' . $relativefilename , '/' ) . '\',*/m' => ' // \'/' . $relativefilename . '\',' );
2024-09-06 11:47:24 +00:00
dolReplaceInFile ( $srcfile , $arrayreplacement , '' , '0' , 0 , 1 );
2023-03-07 14:51:27 +00:00
}
2022-05-01 13:05:25 +00:00
2023-03-07 14:51:27 +00:00
if ( preg_match ( '/_extrafields/' , $relativefilename )) {
// Now we update the object file to set $isextrafieldmanaged to 0
$srcfile = $dirins . '/' . strtolower ( $module ) . '/class/' . strtolower ( $objectname ) . '.class.php' ;
$arrayreplacement = array ( '/\$isextrafieldmanaged = 1;/' => '$isextrafieldmanaged = 0;' );
2024-09-06 11:47:24 +00:00
dolReplaceInFile ( $srcfile , $arrayreplacement , '' , '0' , 0 , 1 );
2023-03-07 14:51:27 +00:00
}
2023-03-01 15:40:01 +00:00
2023-03-07 14:51:27 +00:00
// Now we update the lib file to set $showtabofpagexxx to 0
$varnametoupdate = '' ;
$reg = array ();
if ( preg_match ( '/_([a-z]+)\.php$/' , $relativefilename , $reg )) {
$varnametoupdate = 'showtabofpage' . $reg [ 1 ];
}
if ( $varnametoupdate ) {
$srcfile = $dirins . '/' . strtolower ( $module ) . '/lib/' . strtolower ( $module ) . '_' . strtolower ( $objectname ) . '.lib.php' ;
2023-12-21 18:39:02 +00:00
$arrayreplacement = array ( '/\$' . preg_quote ( $varnametoupdate , '/' ) . ' = 1;/' => '$' . preg_quote ( $varnametoupdate , '/' ) . ' = 0;' );
2024-09-06 11:47:24 +00:00
dolReplaceInFile ( $srcfile , $arrayreplacement , '' , '0' , 0 , 1 );
2022-05-01 13:05:25 +00:00
}
2020-04-05 00:44:59 +00:00
}
}
2019-03-10 18:33:28 +00:00
}
2022-09-27 11:37:38 +00:00
// Init an object
2026-05-07 07:36:02 +00:00
if ( $dirins && $action == 'initobject' && $module && $objectname ) { // Test on permission already done
2024-03-13 19:17:26 +00:00
$warning = 0 ;
2026-05-06 15:35:58 +00:00
$objectname = dol_string_nounprintableascii ( dol_string_unaccent ( ucwords ( $objectname ))); // Force first letter in uppercase
2020-04-03 12:56:15 +00:00
2020-08-06 13:55:04 +00:00
$dirins = $dirread = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrootpath' ];
$moduletype = $listofmodules [ strtolower ( $module )][ 'moduletype' ];
2026-05-06 15:35:58 +00:00
if ( preg_match ( '/[^a-z0-9]/i' , $objectname )) {
2017-10-06 00:42:32 +00:00
$error ++ ;
setEventMessages ( $langs -> trans ( " SpaceOrSpecialCharAreNotAllowed " ), null , 'errors' );
2019-11-13 18:37:08 +00:00
$tabobj = 'newobject' ;
2017-10-06 00:42:32 +00:00
}
2020-04-03 13:14:59 +00:00
if ( class_exists ( $objectname )) {
// TODO Add a more efficient detection. Scan disk ?
$error ++ ;
setEventMessages ( $langs -> trans ( " AnObjectWithThisClassNameAlreadyExists " ), null , 'errors' );
$tabobj = 'newobject' ;
}
2017-10-06 00:42:32 +00:00
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
try {
$ncObj = new NamingContract ( $module , $objectname );
} catch ( \InvalidArgumentException $e ) {
$error ++ ;
setEventMessages ( $langs -> trans ( " SpaceOrSpecialCharAreNotAllowed " ), null , 'errors' );
$ncObj = null ;
}
2017-10-06 00:42:32 +00:00
$srcdir = DOL_DOCUMENT_ROOT . '/modulebuilder/template' ;
$destdir = $dirins . '/' . strtolower ( $module );
NEW: ModuleBuilder - selectable object tabs (+ fixes for multi-object generation) (#38570)
* NEW : add ModuleBuilder object-tabs map and filter helpers
Add getModuleBuilderObjectTabs() (source-of-truth map of optional object
tabs) and filterEnabledTabs() (sanitizes user-requested tab keys against the
map). Covered by ModuleBuilderLibTest.
Next: add BEGIN/END markers around tab flags and blocks in template lib (Task 2)
* NEW : wrap object tab flags and blocks with MODULEBUILDER markers
Surround each optional tab flag declaration (TABFLAG) and each prepareHead tab
block (TAB) with BEGIN/END MODULEBUILDER comment markers, so the generator can
purge a whole tab atomically while keeping $h and $head intact. Card tab is
not wrapped (always generated).
Next: add tab selection checkboxes to the newobject form in modulebuilder/index.php (Task 3)
* NEW : add object tab selection checkboxes to newobject form
Render one checkbox per optional tab (contact, note, document, agenda) in the
ModuleBuilder newobject form, all checked by default and reflecting posted
state on redisplay.
Next: handle enabledtab in initobject — exclude files, purge blocks, hardcode flags (Task 4)
* NEW : apply object tab selection during object generation
Excludes page files of unselected tabs, purges their prepareHead flag and
block via MODULEBUILDER markers, and hardcodes the show flag to 1 for selected
tabs. Emits a best-effort warning when regenerating an existing object.
Next: add language keys EnabledTabsForObject(Help) + WarningTabSelectionOnRegeneration (Task 5)
* NEW : add language keys for object tab selection
Next: add ChangeLog entry (Task 6)
* DOC : changelog entry for ModuleBuilder selectable object tabs
* FIX : purge agenda card widget when agenda tab is excluded
Audit finding: myobject_card.php hardcodes a 'SeeAll' link to myobject_agenda.php
in an event widget. When the agenda tab is excluded the page is not generated,
leaving a latent dead link if the widget is enabled. Wrap the widget with
MODULEBUILDER TAB AGENDA markers and purge it from the generated card when the
agenda tab is not selected.
Next: functional verification (step 5 of dev workflow)
* FIX : check file operation results when applying object tab selection
PR review: align with the nogeneratelines pattern by checking the return of
removePatternFromFile/dolReplaceInFile and raising $error + dol_syslog with the
failing tab/file context, instead of ignoring silent write failures during
object generation. Add PR reference to the changelog entry.
* FIX : do not abort object generation when nogeneratelines targets a missing file
The nogeneratelines handler purges the MODULEBUILDER LINES block from class,
API and card files. When API generation is disabled the api_<module>.class.php
file does not exist, so removePatternFromFile returns false and $error was
incremented, which skipped the whole success path (name substitution,
rebuildObjectClass, $tabobj assignment). Generated classes kept the literal
'class MyObject', so dolGetListOfObjectClasses listed every object as MyObject.
Guard each purge with file_exists so a missing optional file is skipped.
* FIX : keep module descriptor out of the blanket name substitution
The 'substitute all module php files' pass applied the object/module name map
to every .php file including the module descriptor. That rewrote the persistent
/* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */ marker placeholders to the
first object name, so generating a second object could no longer find them
(checkExistComment returned -1, 'comments not found for section Menus' warning)
and its menu entries were not inserted. Skip the descriptor in that loop: its
module name is already resolved by initmodule and its object entries are added
by the dedicated menu/permission blocks.
* FIX : preserve MODULEBUILDER markers when substituting the module descriptor
The previous commit only skipped the descriptor in the secondary substitution
pass, but the primary pass (over $filetogenerate, which includes the descriptor)
still rewrote its persistent /* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */
markers to the first object name. Those markers cannot simply be excluded from
substitution because the descriptor also has functional MYOBJECT/MYMODULE tokens
(e.g. the MYMODULE_MYOBJECT_ADDON numbering constant) that must be resolved.
Add dolReplaceInFilePreservingModuleBuilderMarkers(): it hides every MODULEBUILDER
marker behind a sentinel, applies the substitution, then restores the markers
verbatim. Use it for the descriptor in the primary pass; the descriptor stays
excluded from the secondary pass. Generating a second object now finds the
markers (checkExistComment) and inserts its menu entries without warning.
Verified by CLI: markers preserved across two successive objects, while content
(rights, exports, addon constant) is correctly substituted.
* FIX : silence phan on the new ModuleBuilder test and typed closure
CI phan (diff-only) flagged the freshly added test file: PhanUndeclaredExtendedClass
(\CommonClassTest) and PhanUndeclaredMethod (assertSame), like the sibling
NamingContractTest. Add the same @phan-file-suppress block (plus
PhanTypeMismatchArgumentProbablyReal for the non-array guard test case). Also
type the preg_replace_callback parameter (array $matches) to clear
PhanPluginUnknownClosureParamType. phpstan is already green; no phpstan
annotations added.
* FIX : drop closure in marker-preserving substitution to satisfy phan
phan's PhanPluginUnknownArrayClosureParamType wanted key/value types on the
preg_replace_callback closure parameter. Replace the callback with preg_match_all
plus a str_replace loop over the unique markers: same behaviour, no closure,
no plugin warning.
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-09 17:04:00 +00:00
// Optional tabs selected by user, and detection of an already generated object (for idempotence warning)
$enabledtabs = filterEnabledTabs ( GETPOST ( 'enabledtab' , 'array' ), getModuleBuilderObjectTabs ());
$objectalreadyexists = dol_is_file ( $destdir . '/class/' . strtolower ( $objectname ) . '.class.php' );
2017-10-11 17:41:19 +00:00
// The dir was not created by init
dol_mkdir ( $destdir . '/class' );
dol_mkdir ( $destdir . '/img' );
dol_mkdir ( $destdir . '/lib' );
dol_mkdir ( $destdir . '/scripts' );
dol_mkdir ( $destdir . '/sql' );
2024-10-03 18:51:08 +00:00
dol_mkdir ( $destdir . '/ajax' );
2026-04-05 18:56:00 +00:00
dol_mkdir ( $destdir . '/stats' );
2017-10-11 17:41:19 +00:00
2024-04-18 00:21:42 +00:00
// Scan dir class to find if an object with the same name already exists.
2021-02-26 17:26:44 +00:00
if ( ! $error ) {
2019-11-13 18:37:08 +00:00
$dirlist = dol_dir_list ( $destdir . '/class' , 'files' , 0 , '\.txt$' );
$alreadyfound = false ;
2021-02-26 17:26:44 +00:00
foreach ( $dirlist as $key => $val ) {
2019-11-13 18:37:08 +00:00
$filefound = preg_replace ( '/\.txt$/' , '' , $val [ 'name' ]);
2021-02-26 17:26:44 +00:00
if ( strtolower ( $objectname ) == strtolower ( $filefound ) && $objectname != $filefound ) {
2019-11-13 18:37:08 +00:00
$alreadyfound = true ;
2017-10-06 00:42:32 +00:00
$error ++ ;
setEventMessages ( $langs -> trans ( " AnObjectAlreadyExistWithThisNameAndDiffCase " ), null , 'errors' );
break ;
}
}
}
2024-04-18 00:21:42 +00:00
// If we must reuse an existing table for properties, define $stringforproperties
2024-08-17 16:42:37 +00:00
// Generate class file from the table
2022-09-27 11:37:38 +00:00
$stringforproperties = '' ;
$tablename = GETPOST ( 'initfromtablename' , 'alpha' );
if ( $tablename ) {
$_results = $db -> DDLDescTable ( $tablename );
if ( empty ( $_results )) {
$error ++ ;
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( " ErrorTableNotFound " , $tablename ), null , 'errors' );
} else {
/**
2025-08-04 22:45:00 +00:00
* 'type' field format ( 'integer' , 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]' , 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]' , 'varchar(x)' , 'double(24,8)' , 'real' , 'price' , 'text' , 'text:none' , 'html' , 'date' , 'datetime' , 'timestamp' , 'duration' , 'email' , 'phone' , 'ip' , 'url' , 'password' )
2026-05-29 10:16:42 +00:00
* Note : Filter can be a string like " (t.ref:like:'SO-%') or (t.date_creation:>:'20160101') or (t.nature:is:NULL) "
2022-09-27 11:37:38 +00:00
* 'label' the translation key .
* 'picto' is code of a picto to show before value in forms
* 'enabled' is a condition when the field must be managed ( Example : 1 or '$conf->global->MY_SETUP_PARAM' or 'isModEnabled("multicurrency")' ... )
* 'position' is the sort order of field .
* 'notnull' is set to 1 if not null in database . Set to - 1 if we must set data to null if empty ( '' or 0 ) .
* 'visible' says if field is visible in list ( Examples : 0 = Not visible , 1 = Visible on list and create / update / view forms , 2 = Visible on list only , 3 = Visible on create / update / view form only ( not list ), 4 = Visible on list and update / view form only ( not create ) . 5 = Visible on list and view only ( not create / not update ) . Using a negative value means field is not shown by default on list but can be selected for viewing )
* 'noteditable' says if field is not editable ( 1 or 0 )
* 'alwayseditable' says if field can be modified also when status is not draft ( '1' or '0' )
2025-09-03 10:54:17 +00:00
* 'default' is a default value for creation ( can still be overwritten by the Setup of Default Values if the field is editable in creation form ) . Note : If default is set to '(PROV)' and field is 'ref' , the default value will be set to '(PROVid)' where id is rowid when a new record is created .
2022-09-27 11:37:38 +00:00
* 'index' if we want an index in database .
2024-08-18 16:16:08 +00:00
* 'foreignkey' => 'tablename.field' if the field is a foreign key ( it is recommended to name the field fk_ ... ) .
2022-09-27 11:37:38 +00:00
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button .
* 'isameasure' must be set to 1 or 2 if field can be used for measure . Field type must be summable like integer or double ( 24 , 8 ) . Use 1 in most cases , or 2 if you don ' t want to see the column total into list ( for example for percentage )
2024-08-18 16:16:08 +00:00
* 'css' and 'cssview' and 'csslist' is the CSS style to use on field . 'css' is used in creation and update . 'cssview' is used in view mode . 'csslist' is used for columns in lists . For example : 'css' => 'minwidth300 maxwidth500 widthcentpercentminusx' , 'cssview' => 'wordbreak' , 'csslist' => 'tdoverflowmax200'
2022-09-27 11:37:38 +00:00
* 'help' is a 'TranslationString' to use to show a tooltip on field . You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click .
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute . In most cases , this is never set into the definition of $fields into class , but is set dynamically by some part of code .
2024-08-18 16:16:08 +00:00
* 'arrayofkeyval' to set a list of values if type is a list of predefined values . For example : array ( " 0 " => " Draft " , " 1 " => " Active " , " -1 " => " Cancel " ) . Note that type can be 'integer' or 'varchar'
2022-09-27 11:37:38 +00:00
* 'autofocusoncreate' to have field having the focus on a create form . Only 1 field should have this property set to 1.
* 'comment' is not used . You can store here any text of your choice . It is not used by application .
* 'validate' is 1 if need to validate with $this -> validateField ()
* 'copytoclipboard' is 1 or 2 to allow to add a picto to copy value into clipboard ( 1 = picto after label , 2 = picto after value )
*/
/* public $fields = array (
2024-08-18 16:16:08 +00:00
'rowid' => array ( 'type' => 'integer' , 'label' => 'TechnicalID' , 'enabled' => 1 , 'visible' => - 2 , 'notnull' => 1 , 'index' => 1 , 'position' => 1 , 'comment' => 'Id' ),
'ref' => array ( 'type' => 'varchar(128)' , 'label' => 'Ref' , 'enabled' => 1 , 'visible' => 1 , 'notnull' => 1 , 'showoncombobox' => 1 , 'index' => 1 , 'position' => 10 , 'searchall' => 1 , 'comment' => 'Reference of object' ),
'entity' => array ( 'type' => 'integer' , 'label' => 'Entity' , 'enabled' => 1 , 'visible' => 0 , 'default' => 1 , 'notnull' => 1 , 'index' => 1 , 'position' => 20 ),
'label' => array ( 'type' => 'varchar(255)' , 'label' => 'Label' , 'enabled' => 1 , 'visible' => 1 , 'position' => 30 , 'searchall' => 1 , 'css' => 'minwidth200' , 'help' => 'Help text' , 'alwayseditable' => '1' ),
'amount' => array ( 'type' => 'double(24,8)' , 'label' => 'Amount' , 'enabled' => 1 , 'visible' => 1 , 'default' => 'null' , 'position' => 40 , 'searchall' => 0 , 'isameasure' => 1 , 'help' => 'Help text' ),
'fk_soc' => array ( 'type' => 'integer:Societe:societe/class/societe.class.php' , 'label' => 'ThirdParty' , 'visible' => 1 , 'enabled' => 1 , 'position' => 50 , 'notnull' => - 1 , 'index' => 1 , 'searchall' => 1 , 'help' => 'LinkToThirdparty' ),
'description' => array ( 'type' => 'text' , 'label' => 'Descrption' , 'enabled' => 1 , 'visible' => 0 , 'position' => 60 ),
'note_public' => array ( 'type' => 'html' , 'label' => 'NotePublic' , 'enabled' => 1 , 'visible' => 0 , 'position' => 61 ),
'note_private' => array ( 'type' => 'html' , 'label' => 'NotePrivate' , 'enabled' => 1 , 'visible' => 0 , 'position' => 62 ),
'date_creation' => array ( 'type' => 'datetime' , 'label' => 'DateCreation' , 'enabled' => 1 , 'visible' => - 2 , 'notnull' => 1 , 'position' => 500 ),
'tms' => array ( 'type' => 'timestamp' , 'label' => 'DateModification' , 'enabled' => 1 , 'visible' => - 2 , 'notnull' => 1 , 'position' => 501 ),
//'date_valid' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -2, 'position' => 502),
'fk_user_creat' => array ( 'type' => 'integer' , 'label' => 'UserAuthor' , 'enabled' => 1 , 'visible' => - 2 , 'notnull' => 1 , 'position' => 510 ),
'fk_user_modif' => array ( 'type' => 'integer' , 'label' => 'UserModif' , 'enabled' => 1 , 'visible' => - 2 , 'notnull' => - 1 , 'position' => 511 ),
//'fk_user_valid' => array('type' => 'integer', 'label' => 'UserValidation', 'enabled' => 1, 'visible' => -1, 'position' => 512),
'import_key' => array ( 'type' => 'varchar(14)' , 'label' => 'ImportId' , 'enabled' => 1 , 'visible' => - 2 , 'notnull' => - 1 , 'index' => 0 , 'position' => 1000 ),
'status' => array ( 'type' => 'integer' , 'label' => 'Status' , 'enabled' => 1 , 'visible' => 1 , 'notnull' => 1 , 'default' => 0 , 'index' => 1 , 'position' => 1000 , 'arrayofkeyval' => array ( 0 => 'Draft' , 1 => 'Active' , - 1 => 'Cancel' )),
2022-09-27 11:37:38 +00:00
); */
$stringforproperties = '// BEGIN MODULEBUILDER PROPERTIES' . " \n " ;
2024-08-18 16:16:08 +00:00
$stringforproperties .= 'public $fields = array(' . " \n " ;
2022-09-27 11:37:38 +00:00
$i = 10 ;
while ( $obj = $db -> fetch_object ( $_results )) {
// fieldname
$fieldname = $obj -> Field ;
// type
$type = $obj -> Type ;
if ( $type == 'int(11)' ) {
$type = 'integer' ;
2025-08-04 22:08:56 +00:00
} elseif ( $type == 'float' ) {
2022-09-27 11:37:38 +00:00
$type = 'real' ;
2025-08-04 22:08:56 +00:00
} elseif ( strstr ( $type , 'tinyint' )) {
2022-09-27 11:37:38 +00:00
$type = 'integer' ;
2025-08-04 22:08:56 +00:00
} elseif ( strstr ( $type , 'url' )) {
$type = 'varchar(255)' ;
} elseif ( $obj -> Field == 'fk_soc' ) {
2022-09-27 11:37:38 +00:00
$type = 'integer:Societe:societe/class/societe.class.php' ;
2025-08-04 22:08:56 +00:00
} elseif ( preg_match ( '/^fk_proj/' , $obj -> Field )) {
2022-09-27 11:37:38 +00:00
$type = 'integer:Project:projet/class/project.class.php:1:fk_statut=1' ;
2025-08-04 22:08:56 +00:00
} elseif ( preg_match ( '/^fk_prod/' , $obj -> Field )) {
2022-09-27 11:37:38 +00:00
$type = 'integer:Product:product/class/product.class.php:1' ;
2025-08-04 22:08:56 +00:00
} elseif ( $obj -> Field == 'fk_warehouse' ) {
2022-09-27 11:37:38 +00:00
$type = 'integer:Entrepot:product/stock/class/entrepot.class.php' ;
2025-08-04 22:08:56 +00:00
} elseif ( preg_match ( '/^(fk_user|fk_commercial)/' , $obj -> Field )) {
2022-09-27 11:37:38 +00:00
$type = 'integer:User:user/class/user.class.php' ;
}
// notnull
$notnull = ( $obj -> Null == 'YES' ? 0 : 1 );
if ( $fieldname == 'fk_user_modif' ) {
$notnull = - 1 ;
}
// label
$label = preg_replace ( '/_/' , '' , ucfirst ( $fieldname ));
if ( $fieldname == 'rowid' ) {
$label = 'TechnicalID' ;
}
if ( $fieldname == 'import_key' ) {
$label = 'ImportId' ;
}
if ( $fieldname == 'fk_soc' ) {
$label = 'ThirdParty' ;
}
2025-07-31 14:08:51 +00:00
if ( in_array ( $fieldname , array ( 'tms' , 'date_modification' ))) {
2022-09-27 11:37:38 +00:00
$label = 'DateModification' ;
}
2025-07-31 14:08:51 +00:00
if ( in_array ( $fieldname , array ( 'datec' , 'date_creation' ))) {
2022-09-27 11:37:38 +00:00
$label = 'DateCreation' ;
}
if ( $fieldname == 'date_valid' ) {
$label = 'DateValidation' ;
}
if ( $fieldname == 'datev' ) {
$label = 'DateValidation' ;
}
if ( $fieldname == 'note_private' ) {
$label = 'NotePublic' ;
}
if ( $fieldname == 'note_public' ) {
$label = 'NotePrivate' ;
}
if ( $fieldname == 'fk_user_creat' ) {
$label = 'UserAuthor' ;
}
if ( $fieldname == 'fk_user_modif' ) {
$label = 'UserModif' ;
}
if ( $fieldname == 'fk_user_valid' ) {
$label = 'UserValidation' ;
}
// visible
$visible = - 1 ;
2024-08-17 16:42:37 +00:00
if ( in_array ( $fieldname , array ( 'ref' , 'label' ))) {
$visible = 1 ;
}
if ( $fieldname == 'entity' ) {
$visible = - 2 ;
}
2022-09-27 11:37:38 +00:00
if ( $fieldname == 'entity' ) {
$visible = - 2 ;
}
if ( $fieldname == 'import_key' ) {
$visible = - 2 ;
}
if ( $fieldname == 'fk_user_creat' ) {
$visible = - 2 ;
}
if ( $fieldname == 'fk_user_modif' ) {
$visible = - 2 ;
}
if ( in_array ( $fieldname , array ( 'ref_ext' , 'model_pdf' , 'note_public' , 'note_private' ))) {
$visible = 0 ;
}
// enabled
$enabled = 1 ;
// default
$default = '' ;
if ( $fieldname == 'entity' ) {
$default = 1 ;
}
// position
$position = $i ;
if ( in_array ( $fieldname , array ( 'status' , 'statut' , 'fk_status' , 'fk_statut' ))) {
$position = 500 ;
}
if ( $fieldname == 'import_key' ) {
$position = 900 ;
}
// $alwayseditable
2025-02-05 21:59:37 +00:00
$alwayseditable = 0 ;
2022-09-27 11:37:38 +00:00
if ( $fieldname == 'label' ) {
$alwayseditable = 1 ;
2024-08-18 16:16:08 +00:00
} else {
$alwayseditable = 0 ;
2022-09-27 11:37:38 +00:00
}
// index
$index = 0 ;
if ( $fieldname == 'entity' ) {
$index = 1 ;
}
// css, cssview, csslist
$css = '' ;
$cssview = '' ;
$csslist = '' ;
if ( preg_match ( '/^fk_/' , $fieldname )) {
$css = 'maxwidth500 widthcentpercentminusxx' ;
}
if ( $fieldname == 'label' ) {
$css = 'minwidth300' ;
$cssview = 'wordbreak' ;
}
if ( in_array ( $fieldname , array ( 'note_public' , 'note_private' ))) {
$cssview = 'wordbreak' ;
}
if ( in_array ( $fieldname , array ( 'ref' , 'label' )) || preg_match ( '/integer:/' , $type )) {
$csslist = 'tdoverflowmax150' ;
}
// type
2025-07-31 14:08:51 +00:00
$picto = '' ;
if ( isset ( $obj -> Picto )) { // This should never exists
2024-11-14 22:30:11 +00:00
$picto = $obj -> Picto ;
}
2025-07-31 14:08:51 +00:00
if ( preg_match ( '/^fk_soc/' , $obj -> Field )) {
2022-09-27 11:37:38 +00:00
$picto = 'company' ;
2025-07-31 14:08:51 +00:00
} elseif ( preg_match ( '/^fk_contact/' , $obj -> Field )) {
$picto = 'contact' ;
} elseif ( preg_match ( '/^fk_bank/' , $obj -> Field )) {
$picto = 'bank' ;
} elseif ( preg_match ( '/^fk_user/' , $obj -> Field )) {
$picto = 'user' ;
} elseif ( preg_match ( '/^fk_warehouse/' , $obj -> Field )) {
$picto = 'warehouse' ;
} elseif ( preg_match ( '/^fk_prod/' , $obj -> Field )) {
$picto = 'product' ;
} elseif ( preg_match ( '/^fk_proj/' , $obj -> Field )) {
2022-09-27 11:37:38 +00:00
$picto = 'project' ;
2025-07-31 14:08:51 +00:00
} elseif ( preg_match ( '/^fk_task/' , $obj -> Field )) {
$picto = 'task' ;
2022-09-27 11:37:38 +00:00
}
2025-07-31 13:04:52 +00:00
// lang
$lang = $module . '@' . $module ;
2022-09-27 11:37:38 +00:00
// Build the property string
2024-08-18 16:16:08 +00:00
$stringforproperties .= " ' " . $obj -> Field . " ' => array('type' => ' " . $type . " ', 'label' => ' " . $label . " ', " ;
2022-09-27 11:37:38 +00:00
if ( $default != '' ) {
2024-08-18 16:16:08 +00:00
$stringforproperties .= " 'default' => " . $default . " , " ;
2022-09-27 11:37:38 +00:00
}
2024-08-18 16:16:08 +00:00
$stringforproperties .= " 'enabled' => " . $enabled . " , " ;
$stringforproperties .= " 'visible' => " . $visible ;
2022-09-27 11:37:38 +00:00
if ( $notnull ) {
2024-08-18 16:16:08 +00:00
$stringforproperties .= " , 'notnull' => " . $notnull ;
2022-09-27 11:37:38 +00:00
}
if ( $alwayseditable ) {
2024-08-18 16:16:08 +00:00
$stringforproperties .= " , 'alwayseditable' => 1 " ;
2022-09-27 11:37:38 +00:00
}
if ( $fieldname == 'ref' || $fieldname == 'code' ) {
2024-08-18 16:16:08 +00:00
$stringforproperties .= " , 'showoncombobox' => 1 " ;
2022-09-27 11:37:38 +00:00
}
2024-08-18 16:16:08 +00:00
$stringforproperties .= " , 'position' => " . $position ;
2022-09-27 11:37:38 +00:00
if ( $index ) {
2024-08-18 16:16:08 +00:00
$stringforproperties .= " , 'index' => " . $index ;
2022-09-27 11:37:38 +00:00
}
if ( $picto ) {
2024-08-18 16:16:08 +00:00
$stringforproperties .= " , 'picto' => ' " . $picto . " ' " ;
2022-09-27 11:37:38 +00:00
}
if ( $css ) {
2024-08-18 16:16:08 +00:00
$stringforproperties .= " , 'css' => ' " . $css . " ' " ;
2022-09-27 11:37:38 +00:00
}
if ( $cssview ) {
2024-08-18 16:16:08 +00:00
$stringforproperties .= " , 'cssview' => ' " . $cssview . " ' " ;
2022-09-27 11:37:38 +00:00
}
if ( $csslist ) {
2024-08-18 16:16:08 +00:00
$stringforproperties .= " , 'csslist' => ' " . $csslist . " ' " ;
2022-09-27 11:37:38 +00:00
}
2025-08-01 15:20:18 +00:00
$stringforproperties .= " , 'lang' => ' " . $lang . " ' " ;
2022-09-27 11:37:38 +00:00
$stringforproperties .= " ), \n " ;
$i += 5 ;
}
$stringforproperties .= ');' . " \n " ;
$stringforproperties .= '// END MODULEBUILDER PROPERTIES' . " \n " ;
}
}
2026-04-05 18:56:00 +00:00
$filetogenerate = array ();
2021-02-26 17:26:44 +00:00
if ( ! $error ) {
2018-08-24 09:45:22 +00:00
// Copy some files
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
$filetogenerate = [];
foreach ([
'myobject_card.php' ,
'myobject_note.php' ,
'myobject_contact.php' ,
'myobject_document.php' ,
'myobject_agenda.php' ,
'myobject_list.php' ,
'admin/myobject_extrafields.php' ,
'ajax/myobject.php' ,
'lib/mymodule_myobject.lib.php' ,
//'test/phpunit/MyObjectTest.php',
'sql/llx_mymodule_myobject.sql' ,
'sql/llx_mymodule_myobject.key.sql' ,
'sql/llx_mymodule_myobject_extrafields.sql' ,
'sql/llx_mymodule_myobject_extrafields.key.sql' ,
//'scripts/mymodule.php',
'class/myobject.class.php' ,
'class/myobjectstats.class.php' ,
//'class/api_mymodule.class.php',
'stats/myobject_index.php' ,
] as $templateFile ) {
$filetogenerate [ $templateFile ] = $ncObj -> applyToFilename ( $templateFile );
}
2017-10-06 00:42:32 +00:00
NEW: ModuleBuilder - selectable object tabs (+ fixes for multi-object generation) (#38570)
* NEW : add ModuleBuilder object-tabs map and filter helpers
Add getModuleBuilderObjectTabs() (source-of-truth map of optional object
tabs) and filterEnabledTabs() (sanitizes user-requested tab keys against the
map). Covered by ModuleBuilderLibTest.
Next: add BEGIN/END markers around tab flags and blocks in template lib (Task 2)
* NEW : wrap object tab flags and blocks with MODULEBUILDER markers
Surround each optional tab flag declaration (TABFLAG) and each prepareHead tab
block (TAB) with BEGIN/END MODULEBUILDER comment markers, so the generator can
purge a whole tab atomically while keeping $h and $head intact. Card tab is
not wrapped (always generated).
Next: add tab selection checkboxes to the newobject form in modulebuilder/index.php (Task 3)
* NEW : add object tab selection checkboxes to newobject form
Render one checkbox per optional tab (contact, note, document, agenda) in the
ModuleBuilder newobject form, all checked by default and reflecting posted
state on redisplay.
Next: handle enabledtab in initobject — exclude files, purge blocks, hardcode flags (Task 4)
* NEW : apply object tab selection during object generation
Excludes page files of unselected tabs, purges their prepareHead flag and
block via MODULEBUILDER markers, and hardcodes the show flag to 1 for selected
tabs. Emits a best-effort warning when regenerating an existing object.
Next: add language keys EnabledTabsForObject(Help) + WarningTabSelectionOnRegeneration (Task 5)
* NEW : add language keys for object tab selection
Next: add ChangeLog entry (Task 6)
* DOC : changelog entry for ModuleBuilder selectable object tabs
* FIX : purge agenda card widget when agenda tab is excluded
Audit finding: myobject_card.php hardcodes a 'SeeAll' link to myobject_agenda.php
in an event widget. When the agenda tab is excluded the page is not generated,
leaving a latent dead link if the widget is enabled. Wrap the widget with
MODULEBUILDER TAB AGENDA markers and purge it from the generated card when the
agenda tab is not selected.
Next: functional verification (step 5 of dev workflow)
* FIX : check file operation results when applying object tab selection
PR review: align with the nogeneratelines pattern by checking the return of
removePatternFromFile/dolReplaceInFile and raising $error + dol_syslog with the
failing tab/file context, instead of ignoring silent write failures during
object generation. Add PR reference to the changelog entry.
* FIX : do not abort object generation when nogeneratelines targets a missing file
The nogeneratelines handler purges the MODULEBUILDER LINES block from class,
API and card files. When API generation is disabled the api_<module>.class.php
file does not exist, so removePatternFromFile returns false and $error was
incremented, which skipped the whole success path (name substitution,
rebuildObjectClass, $tabobj assignment). Generated classes kept the literal
'class MyObject', so dolGetListOfObjectClasses listed every object as MyObject.
Guard each purge with file_exists so a missing optional file is skipped.
* FIX : keep module descriptor out of the blanket name substitution
The 'substitute all module php files' pass applied the object/module name map
to every .php file including the module descriptor. That rewrote the persistent
/* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */ marker placeholders to the
first object name, so generating a second object could no longer find them
(checkExistComment returned -1, 'comments not found for section Menus' warning)
and its menu entries were not inserted. Skip the descriptor in that loop: its
module name is already resolved by initmodule and its object entries are added
by the dedicated menu/permission blocks.
* FIX : preserve MODULEBUILDER markers when substituting the module descriptor
The previous commit only skipped the descriptor in the secondary substitution
pass, but the primary pass (over $filetogenerate, which includes the descriptor)
still rewrote its persistent /* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */
markers to the first object name. Those markers cannot simply be excluded from
substitution because the descriptor also has functional MYOBJECT/MYMODULE tokens
(e.g. the MYMODULE_MYOBJECT_ADDON numbering constant) that must be resolved.
Add dolReplaceInFilePreservingModuleBuilderMarkers(): it hides every MODULEBUILDER
marker behind a sentinel, applies the substitution, then restores the markers
verbatim. Use it for the descriptor in the primary pass; the descriptor stays
excluded from the secondary pass. Generating a second object now finds the
markers (checkExistComment) and inserts its menu entries without warning.
Verified by CLI: markers preserved across two successive objects, while content
(rights, exports, addon constant) is correctly substituted.
* FIX : silence phan on the new ModuleBuilder test and typed closure
CI phan (diff-only) flagged the freshly added test file: PhanUndeclaredExtendedClass
(\CommonClassTest) and PhanUndeclaredMethod (assertSame), like the sibling
NamingContractTest. Add the same @phan-file-suppress block (plus
PhanTypeMismatchArgumentProbablyReal for the non-array guard test case). Also
type the preg_replace_callback parameter (array $matches) to clear
PhanPluginUnknownClosureParamType. phpstan is already green; no phpstan
annotations added.
* FIX : drop closure in marker-preserving substitution to satisfy phan
phan's PhanPluginUnknownArrayClosureParamType wanted key/value types on the
preg_replace_callback closure parameter. Replace the callback with preg_match_all
plus a str_replace loop over the unique markers: same behaviour, no closure,
no plugin warning.
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-09 17:04:00 +00:00
// Exclude tab page files for tabs not selected by user
foreach ( getModuleBuilderObjectTabs () as $tabkey => $tabinfo ) {
if ( ! in_array ( $tabkey , $enabledtabs , true )) {
unset ( $filetogenerate [ $tabinfo [ 'file' ]]);
}
}
2021-02-26 17:26:44 +00:00
if ( GETPOST ( 'includerefgeneration' , 'aZ09' )) {
2019-11-01 16:54:17 +00:00
dol_mkdir ( $destdir . '/core/modules/' . strtolower ( $module ));
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
foreach ([
'core/modules/mymodule/mod_myobject_advanced.php' ,
'core/modules/mymodule/mod_myobject_standard.php' ,
'core/modules/mymodule/modules_myobject.php' ,
] as $templateFile ) {
$filetogenerate [ $templateFile ] = $ncObj -> applyToFilename ( $templateFile );
}
2019-11-01 14:53:57 +00:00
}
2021-02-26 17:26:44 +00:00
if ( GETPOST ( 'includedocgeneration' , 'aZ09' )) {
2019-11-01 16:54:17 +00:00
dol_mkdir ( $destdir . '/core/modules/' . strtolower ( $module ));
dol_mkdir ( $destdir . '/core/modules/' . strtolower ( $module ) . '/doc' );
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
foreach ([
'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php' ,
'core/modules/mymodule/doc/pdf_standard_myobject.modules.php' ,
] as $templateFile ) {
$filetogenerate [ $templateFile ] = $ncObj -> applyToFilename ( $templateFile );
}
2019-11-01 14:53:57 +00:00
}
2026-05-10 23:26:15 +00:00
$class = null ;
2023-02-03 10:01:06 +00:00
if ( GETPOST ( 'generatepermissions' , 'aZ09' )) {
2023-02-21 15:01:03 +00:00
$firstobjectname = 'myobject' ;
2023-02-03 10:01:06 +00:00
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
dol_include_once ( $pathtofile );
$class = 'mod' . $module ;
2024-08-18 16:16:08 +00:00
$moduleobj = null ;
2023-02-03 10:01:06 +00:00
if ( class_exists ( $class )) {
try {
$moduleobj = new $class ( $db );
2024-08-18 16:16:08 +00:00
'@phan-var-force DolibarrModules $moduleobj' ;
2024-11-04 22:53:20 +00:00
/** @var DolibarrModules $moduleobj */
2023-02-03 10:01:06 +00:00
} catch ( Exception $e ) {
$error ++ ;
dol_print_error ( $db , $e -> getMessage ());
}
}
2024-08-18 16:16:08 +00:00
if ( is_object ( $moduleobj )) {
$rights = $moduleobj -> rights ;
} else {
$rights = [];
}
2023-05-03 13:33:58 +00:00
$moduledescriptorfile = $destdir . '/core/modules/mod' . $module . '.class.php' ;
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
$checkComment = checkExistComment ( $moduledescriptorfile , 1 );
2023-09-05 13:43:23 +00:00
if ( $checkComment < 0 ) {
setEventMessages ( $langs -> trans ( " WarningCommentNotFound " , $langs -> trans ( " Permissions " ), " mod " . $module . " class.php " ), null , 'warnings' );
} else {
$generatePerms = reWriteAllPermissions ( $moduledescriptorfile , $rights , null , null , $objectname , $module , - 2 );
if ( $generatePerms < 0 ) {
setEventMessages ( $langs -> trans ( " WarningPermissionAlreadyExist " , $langs -> transnoentities ( $objectname )), null , 'warnings' );
}
2023-02-03 10:01:06 +00:00
}
}
2019-11-01 14:53:57 +00:00
2022-09-27 11:37:38 +00:00
if ( ! $error ) {
foreach ( $filetogenerate as $srcfile => $destfile ) {
$result = dol_copy ( $srcdir . '/' . $srcfile , $destdir . '/' . $destfile , $newmask , 0 );
if ( $result <= 0 ) {
if ( $result < 0 ) {
2024-03-13 19:17:26 +00:00
$warning ++ ;
2022-09-27 11:37:38 +00:00
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( " ErrorFailToCopyFile " , $srcdir . '/' . $srcfile , $destdir . '/' . $destfile ), null , 'errors' );
} else {
// $result == 0
setEventMessages ( $langs -> trans ( " FileAlreadyExists " , $destfile ), null , 'warnings' );
}
2017-10-06 00:42:32 +00:00
}
2023-05-01 14:00:58 +00:00
$arrayreplacement = array (
'/myobject\.class\.php/' => strtolower ( $objectname ) . '.class.php' ,
'/myobject\.lib\.php/' => strtolower ( $objectname ) . '.lib.php' ,
);
2024-03-13 19:17:26 +00:00
2024-09-06 11:47:24 +00:00
dolReplaceInFile ( $destdir . '/' . $destfile , $arrayreplacement , '' , '0' , 0 , 1 );
2017-10-06 00:42:32 +00:00
}
}
2022-09-27 11:37:38 +00:00
// Replace property section with $stringforproperties
if ( ! $error && $stringforproperties ) {
//var_dump($stringforproperties);exit;
$arrayreplacement = array (
'/\/\/ BEGIN MODULEBUILDER PROPERTIES.*\/\/ END MODULEBUILDER PROPERTIES/ims' => $stringforproperties
);
2024-09-06 11:47:24 +00:00
dolReplaceInFile ( $destdir . '/class/' . strtolower ( $objectname ) . '.class.php' , $arrayreplacement , '' , '0' , 0 , 1 );
2022-09-27 11:37:38 +00:00
}
2019-11-01 16:54:17 +00:00
// Edit the class 'class/'.strtolower($objectname).'.class.php'
if ( GETPOST ( 'includerefgeneration' , 'aZ09' )) {
2024-08-18 16:16:08 +00:00
// Replace 'visible' => 1, 'noteditable' => 0, 'default' => ''
2020-04-03 15:53:17 +00:00
$arrayreplacement = array (
2024-08-18 16:16:08 +00:00
'/\'visible\'s*=>s*1,\s*\'noteditable\'s*=>s*0,\s*\'default\'s*=>s*\'\'/' => " 'visible' => 4, 'noteditable' => 1, 'default' => '(PROV)' "
2020-04-03 15:53:17 +00:00
);
2019-11-01 16:54:17 +00:00
//var_dump($arrayreplacement);exit;
//var_dump($destdir.'/class/'.strtolower($objectname).'.class.php');exit;
2024-09-06 11:47:24 +00:00
dolReplaceInFile ( $destdir . '/class/' . strtolower ( $objectname ) . '.class.php' , $arrayreplacement , '' , '0' , 0 , 1 );
2020-04-03 15:53:17 +00:00
$arrayreplacement = array (
'/\'models\' => 0,/' => '\'models\' => 1,'
);
2024-09-06 11:47:24 +00:00
dolReplaceInFile ( $destdir . '/core/modules/mod' . $module . '.class.php' , $arrayreplacement , '' , '0' , 0 , 1 );
2019-11-01 16:54:17 +00:00
}
// Edit the setup file and the card page
if ( GETPOST ( 'includedocgeneration' , 'aZ09' )) {
2020-04-03 15:53:17 +00:00
// Replace some var init into some files
$arrayreplacement = array (
'/\$includedocgeneration = 0;/' => '$includedocgeneration = 1;'
);
2024-09-06 11:47:24 +00:00
dolReplaceInFile ( $destdir . '/class/' . strtolower ( $objectname ) . '.class.php' , $arrayreplacement , '' , '0' , 0 , 1 );
dolReplaceInFile ( $destdir . '/' . strtolower ( $objectname ) . '_card.php' , $arrayreplacement , '' , '0' , 0 , 1 );
2020-04-03 15:53:17 +00:00
$arrayreplacement = array (
'/\'models\' => 0,/' => '\'models\' => 1,'
);
2020-05-31 22:01:23 +00:00
2024-09-06 11:47:24 +00:00
dolReplaceInFile ( $destdir . '/core/modules/mod' . $module . '.class.php' , $arrayreplacement , '' , '0' , 0 , 1 );
2019-11-01 16:54:17 +00:00
}
2024-08-18 16:16:08 +00:00
// TODO Update entries '$myTmpObjects['MyObject'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0);'
2020-06-01 14:44:22 +00:00
2019-10-19 23:09:11 +00:00
// Scan for object class files
$listofobject = dol_dir_list ( $destdir . '/class' , 'files' , 0 , '\.class\.php$' );
2017-10-06 00:42:32 +00:00
2020-01-30 00:48:28 +00:00
$firstobjectname = '' ;
2024-11-04 22:53:20 +00:00
$stringtoadd = '' ;
2021-02-26 17:26:44 +00:00
foreach ( $listofobject as $fileobj ) {
if ( preg_match ( '/^api_/' , $fileobj [ 'name' ])) {
continue ;
}
if ( preg_match ( '/^actions_/' , $fileobj [ 'name' ])) {
continue ;
}
2017-10-06 00:42:32 +00:00
2020-01-30 00:48:28 +00:00
$tmpcontent = file_get_contents ( $fileobj [ 'fullname' ]);
$reg = array ();
2021-02-26 17:26:44 +00:00
if ( preg_match ( '/class\s+([^\s]*)\s+extends\s+CommonObject/ims' , $tmpcontent , $reg )) {
2019-10-19 23:09:11 +00:00
$objectnameloop = $reg [ 1 ];
2021-02-26 17:26:44 +00:00
if ( empty ( $firstobjectname )) {
$firstobjectname = $objectnameloop ;
}
2017-12-11 12:50:26 +00:00
}
2019-10-19 23:09:11 +00:00
// Regenerate left menu entry in descriptor for $objectname
$stringtoadd = "
2024-08-18 16:16:08 +00:00
\ $this -> menu [ \ $r ++ ] = array (
'fk_menu' => 'fk_mainmenu=mymodule' ,
'type' => 'left' ,
'titre' => 'MyObject' ,
2023-05-23 15:37:52 +00:00
'prefix' => img_picto ( '' , \ $this -> picto , 'class=\"paddingright pictofixedwidth valignmiddle\"' ),
2024-08-18 16:16:08 +00:00
'mainmenu' => 'mymodule' ,
'leftmenu' => 'myobject' ,
'url' => '/mymodule/myobject_list.php' ,
'langs' => 'mymodule@mymodule' ,
'position' => 1000 + \ $r ,
'enabled' => 'isModEnabled(\"mymodule\")' ,
'perms' => '".(GETPOST(' generatepermissions ') ? ' $user -> hasRight ( " mymodule " , " myobject " , " read " ) ' : ' 1 ')."' ,
'target' => '' ,
'user' => 2 ,
'object' => 'MyObject'
);
\ $this -> menu [ \ $r ++ ] = array (
'fk_menu' => 'fk_mainmenu=mymodule,fk_leftmenu=myobject' ,
'type' => 'left' ,
'titre' => 'List MyObject' ,
'mainmenu' => 'mymodule' ,
'leftmenu' => 'mymodule_myobject_list' ,
'url' => '/mymodule/myobject_list.php' ,
'langs' => 'mymodule@mymodule' ,
'position' => 1000 + \ $r ,
'enabled' => 'isModEnabled(\"mymodule\")' ,
'perms' => '".(GETPOST(' generatepermissions ') ? ' $user -> hasRight ( " mymodule " , " myobject " , " read " ) ' : ' 1 ')."' ,
'target' => '' ,
'user' => 2 ,
'object' => 'MyObject'
2023-05-23 15:37:52 +00:00
);
2024-08-18 16:16:08 +00:00
\ $this -> menu [ \ $r ++ ] = array (
'fk_menu' => 'fk_mainmenu=mymodule,fk_leftmenu=myobject' ,
'type' => 'left' ,
'titre' => 'New MyObject' ,
'mainmenu' => 'mymodule' ,
'leftmenu' => 'mymodule_myobject_new' ,
'url' => '/mymodule/myobject_card.php?action=create' ,
'langs' => 'mymodule@mymodule' ,
'position' => 1000 + \ $r ,
'enabled' => 'isModEnabled(\"mymodule\")' ,
'perms' => '".(GETPOST(' generatepermissions ') ? ' $user -> hasRight ( " mymodule " , " myobject " , " write " ) ' : ' 1 ')."' ,
'target' => '' ,
'user' => 2 ,
'object' => 'MyObject'
2024-04-18 00:21:42 +00:00
); " ;
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
$stringtoadd = $ncObj -> applyTo ( $stringtoadd );
2019-10-19 23:09:11 +00:00
2020-01-30 00:48:28 +00:00
$moduledescriptorfile = $destdir . '/core/modules/mod' . $module . '.class.php' ;
2022-12-29 15:10:53 +00:00
}
2023-12-04 12:46:42 +00:00
// TODO Allow a replace with regex using dolReplaceInFile with param arryreplacementisregex to 1
// TODO Avoid duplicate addition
2019-10-19 23:09:11 +00:00
2023-12-04 12:46:42 +00:00
// load class and check if menu exist with same object name
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
dol_include_once ( $pathtofile );
$class = 'mod' . $module ;
2024-08-18 16:16:08 +00:00
$moduleobj = null ;
2023-02-09 10:07:30 +00:00
if ( class_exists ( $class )) {
try {
$moduleobj = new $class ( $db );
2024-08-18 16:16:08 +00:00
'@phan-var-force DolibarrModules $moduleobj' ;
2024-11-04 22:53:20 +00:00
/** @var DolibarrModules $moduleobj */
2023-02-09 10:07:30 +00:00
} catch ( Exception $e ) {
$error ++ ;
dol_print_error ( $db , $e -> getMessage ());
}
}
2024-08-18 16:16:08 +00:00
if ( is_object ( $moduleobj )) {
$menus = $moduleobj -> menu ;
} else {
$menus = array ();
}
2023-12-04 12:46:42 +00:00
$counter = 0 ;
2023-02-09 10:07:30 +00:00
foreach ( $menus as $menu ) {
2023-02-10 17:02:25 +00:00
if ( $menu [ 'leftmenu' ] == strtolower ( $objectname )) {
2023-02-09 10:07:30 +00:00
$counter ++ ;
}
}
if ( ! $counter ) {
2023-09-05 13:43:23 +00:00
$checkComment = checkExistComment ( $moduledescriptorfile , 0 );
if ( $checkComment < 0 ) {
2024-03-13 19:17:26 +00:00
$warning ++ ;
setEventMessages ( $langs -> trans ( " WarningCommentNotFound " , $langs -> trans ( " Menus " ), basename ( $moduledescriptorfile )), null , 'warnings' );
2023-09-05 13:43:23 +00:00
} else {
2026-04-04 11:56:39 +00:00
$arrayofreplacement = array (
'/* BEGIN MODULEBUILDER LEFTMENU MYOBJECT */' => '/* BEGIN MODULEBUILDER LEFTMENU ' . strtoupper ( $objectname ) . ' */' . $stringtoadd . " \n \t \t " . '/* END MODULEBUILDER LEFTMENU ' . strtoupper ( $objectname ) . ' */' . " \n \t \t " . '/* BEGIN MODULEBUILDER LEFTMENU MYOBJECT */'
);
2023-12-21 18:39:02 +00:00
dolReplaceInFile ( $moduledescriptorfile , $arrayofreplacement );
2023-09-05 13:43:23 +00:00
}
2023-02-09 10:07:30 +00:00
}
2023-12-04 12:46:42 +00:00
// Add module descriptor to list of files to replace "MyObject' string with real name of object.
$filetogenerate [] = 'core/modules/mod' . $module . '.class.php' ;
2017-10-06 00:42:32 +00:00
}
2026-05-18 14:13:35 +00:00
if ( ! $error && GETPOST ( 'nogeneratelines' , 'aZ09' )) {
$checkComment = checkExistComment ( $moduledescriptorfile , 0 );
if ( $checkComment < 0 ) {
$warning ++ ;
setEventMessages ( $langs -> trans ( " WarningCommentNotFound " , $langs -> trans ( " Menus " ), basename ( $moduledescriptorfile )), null , 'warnings' );
} else {
// File path
$TFilePaths = [
$destdir . '/class/' . strtolower ( $objectname ) . '.class.php' ,
$destdir . '/class/api_' . strtolower ( $module ) . '.class.php' ,
$destdir . '/' . strtolower ( $objectname ) . '_card.php'
];
// Pattern to remove everything between the tags
$pattern = '/\/\/BEGIN MODULEBUILDER LINES.*?\/\/END MODULEBUILDER LINES\s*/s' ;
foreach ( $TFilePaths as $filePath ) {
NEW: ModuleBuilder - selectable object tabs (+ fixes for multi-object generation) (#38570)
* NEW : add ModuleBuilder object-tabs map and filter helpers
Add getModuleBuilderObjectTabs() (source-of-truth map of optional object
tabs) and filterEnabledTabs() (sanitizes user-requested tab keys against the
map). Covered by ModuleBuilderLibTest.
Next: add BEGIN/END markers around tab flags and blocks in template lib (Task 2)
* NEW : wrap object tab flags and blocks with MODULEBUILDER markers
Surround each optional tab flag declaration (TABFLAG) and each prepareHead tab
block (TAB) with BEGIN/END MODULEBUILDER comment markers, so the generator can
purge a whole tab atomically while keeping $h and $head intact. Card tab is
not wrapped (always generated).
Next: add tab selection checkboxes to the newobject form in modulebuilder/index.php (Task 3)
* NEW : add object tab selection checkboxes to newobject form
Render one checkbox per optional tab (contact, note, document, agenda) in the
ModuleBuilder newobject form, all checked by default and reflecting posted
state on redisplay.
Next: handle enabledtab in initobject — exclude files, purge blocks, hardcode flags (Task 4)
* NEW : apply object tab selection during object generation
Excludes page files of unselected tabs, purges their prepareHead flag and
block via MODULEBUILDER markers, and hardcodes the show flag to 1 for selected
tabs. Emits a best-effort warning when regenerating an existing object.
Next: add language keys EnabledTabsForObject(Help) + WarningTabSelectionOnRegeneration (Task 5)
* NEW : add language keys for object tab selection
Next: add ChangeLog entry (Task 6)
* DOC : changelog entry for ModuleBuilder selectable object tabs
* FIX : purge agenda card widget when agenda tab is excluded
Audit finding: myobject_card.php hardcodes a 'SeeAll' link to myobject_agenda.php
in an event widget. When the agenda tab is excluded the page is not generated,
leaving a latent dead link if the widget is enabled. Wrap the widget with
MODULEBUILDER TAB AGENDA markers and purge it from the generated card when the
agenda tab is not selected.
Next: functional verification (step 5 of dev workflow)
* FIX : check file operation results when applying object tab selection
PR review: align with the nogeneratelines pattern by checking the return of
removePatternFromFile/dolReplaceInFile and raising $error + dol_syslog with the
failing tab/file context, instead of ignoring silent write failures during
object generation. Add PR reference to the changelog entry.
* FIX : do not abort object generation when nogeneratelines targets a missing file
The nogeneratelines handler purges the MODULEBUILDER LINES block from class,
API and card files. When API generation is disabled the api_<module>.class.php
file does not exist, so removePatternFromFile returns false and $error was
incremented, which skipped the whole success path (name substitution,
rebuildObjectClass, $tabobj assignment). Generated classes kept the literal
'class MyObject', so dolGetListOfObjectClasses listed every object as MyObject.
Guard each purge with file_exists so a missing optional file is skipped.
* FIX : keep module descriptor out of the blanket name substitution
The 'substitute all module php files' pass applied the object/module name map
to every .php file including the module descriptor. That rewrote the persistent
/* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */ marker placeholders to the
first object name, so generating a second object could no longer find them
(checkExistComment returned -1, 'comments not found for section Menus' warning)
and its menu entries were not inserted. Skip the descriptor in that loop: its
module name is already resolved by initmodule and its object entries are added
by the dedicated menu/permission blocks.
* FIX : preserve MODULEBUILDER markers when substituting the module descriptor
The previous commit only skipped the descriptor in the secondary substitution
pass, but the primary pass (over $filetogenerate, which includes the descriptor)
still rewrote its persistent /* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */
markers to the first object name. Those markers cannot simply be excluded from
substitution because the descriptor also has functional MYOBJECT/MYMODULE tokens
(e.g. the MYMODULE_MYOBJECT_ADDON numbering constant) that must be resolved.
Add dolReplaceInFilePreservingModuleBuilderMarkers(): it hides every MODULEBUILDER
marker behind a sentinel, applies the substitution, then restores the markers
verbatim. Use it for the descriptor in the primary pass; the descriptor stays
excluded from the secondary pass. Generating a second object now finds the
markers (checkExistComment) and inserts its menu entries without warning.
Verified by CLI: markers preserved across two successive objects, while content
(rights, exports, addon constant) is correctly substituted.
* FIX : silence phan on the new ModuleBuilder test and typed closure
CI phan (diff-only) flagged the freshly added test file: PhanUndeclaredExtendedClass
(\CommonClassTest) and PhanUndeclaredMethod (assertSame), like the sibling
NamingContractTest. Add the same @phan-file-suppress block (plus
PhanTypeMismatchArgumentProbablyReal for the non-array guard test case). Also
type the preg_replace_callback parameter (array $matches) to clear
PhanPluginUnknownClosureParamType. phpstan is already green; no phpstan
annotations added.
* FIX : drop closure in marker-preserving substitution to satisfy phan
phan's PhanPluginUnknownArrayClosureParamType wanted key/value types on the
preg_replace_callback closure parameter. Replace the callback with preg_match_all
plus a str_replace loop over the unique markers: same behaviour, no closure,
no plugin warning.
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-09 17:04:00 +00:00
// Skip files that were not generated (e.g. the API class when API generation is disabled);
// a missing optional file must not abort the whole object generation.
if ( file_exists ( $filePath ) && ! removePatternFromFile ( $filePath , $pattern )) {
$error ++ ;
}
}
}
}
// Apply object tab selection on the generated lib file:
// selected tabs -> hardcode the show flag to 1 (visible without extra config) ; unselected -> remove flag declaration and tab block
if ( ! $error ) {
$libdestfile = $destdir . '/' . $ncObj -> applyToFilename ( 'lib/mymodule_myobject.lib.php' );
foreach ( getModuleBuilderObjectTabs () as $tabkey => $tabinfo ) {
$marker = $tabinfo [ 'marker' ];
if ( in_array ( $tabkey , $enabledtabs , true )) {
$arrayreplacement = array (
'/\$' . $tabinfo [ 'var' ] . ' = getDolGlobalInt\([^;]*\);/' => '$' . $tabinfo [ 'var' ] . ' = 1;'
);
if ( dolReplaceInFile ( $libdestfile , $arrayreplacement , '' , '0' , 0 , 1 ) < 0 ) {
$error ++ ;
dol_syslog ( " modulebuilder: failed to activate tab flag ' " . $tabkey . " ' in " . $libdestfile , LOG_ERR );
}
} else {
if ( ! removePatternFromFile ( $libdestfile , '/\h*\/\/ BEGIN MODULEBUILDER TABFLAG ' . $marker . '.*?\/\/ END MODULEBUILDER TABFLAG ' . $marker . '\s*/s' )
|| ! removePatternFromFile ( $libdestfile , '/\h*\/\/ BEGIN MODULEBUILDER TAB ' . $marker . '.*?\/\/ END MODULEBUILDER TAB ' . $marker . '\s*/s' )) {
2026-05-18 14:13:35 +00:00
$error ++ ;
NEW: ModuleBuilder - selectable object tabs (+ fixes for multi-object generation) (#38570)
* NEW : add ModuleBuilder object-tabs map and filter helpers
Add getModuleBuilderObjectTabs() (source-of-truth map of optional object
tabs) and filterEnabledTabs() (sanitizes user-requested tab keys against the
map). Covered by ModuleBuilderLibTest.
Next: add BEGIN/END markers around tab flags and blocks in template lib (Task 2)
* NEW : wrap object tab flags and blocks with MODULEBUILDER markers
Surround each optional tab flag declaration (TABFLAG) and each prepareHead tab
block (TAB) with BEGIN/END MODULEBUILDER comment markers, so the generator can
purge a whole tab atomically while keeping $h and $head intact. Card tab is
not wrapped (always generated).
Next: add tab selection checkboxes to the newobject form in modulebuilder/index.php (Task 3)
* NEW : add object tab selection checkboxes to newobject form
Render one checkbox per optional tab (contact, note, document, agenda) in the
ModuleBuilder newobject form, all checked by default and reflecting posted
state on redisplay.
Next: handle enabledtab in initobject — exclude files, purge blocks, hardcode flags (Task 4)
* NEW : apply object tab selection during object generation
Excludes page files of unselected tabs, purges their prepareHead flag and
block via MODULEBUILDER markers, and hardcodes the show flag to 1 for selected
tabs. Emits a best-effort warning when regenerating an existing object.
Next: add language keys EnabledTabsForObject(Help) + WarningTabSelectionOnRegeneration (Task 5)
* NEW : add language keys for object tab selection
Next: add ChangeLog entry (Task 6)
* DOC : changelog entry for ModuleBuilder selectable object tabs
* FIX : purge agenda card widget when agenda tab is excluded
Audit finding: myobject_card.php hardcodes a 'SeeAll' link to myobject_agenda.php
in an event widget. When the agenda tab is excluded the page is not generated,
leaving a latent dead link if the widget is enabled. Wrap the widget with
MODULEBUILDER TAB AGENDA markers and purge it from the generated card when the
agenda tab is not selected.
Next: functional verification (step 5 of dev workflow)
* FIX : check file operation results when applying object tab selection
PR review: align with the nogeneratelines pattern by checking the return of
removePatternFromFile/dolReplaceInFile and raising $error + dol_syslog with the
failing tab/file context, instead of ignoring silent write failures during
object generation. Add PR reference to the changelog entry.
* FIX : do not abort object generation when nogeneratelines targets a missing file
The nogeneratelines handler purges the MODULEBUILDER LINES block from class,
API and card files. When API generation is disabled the api_<module>.class.php
file does not exist, so removePatternFromFile returns false and $error was
incremented, which skipped the whole success path (name substitution,
rebuildObjectClass, $tabobj assignment). Generated classes kept the literal
'class MyObject', so dolGetListOfObjectClasses listed every object as MyObject.
Guard each purge with file_exists so a missing optional file is skipped.
* FIX : keep module descriptor out of the blanket name substitution
The 'substitute all module php files' pass applied the object/module name map
to every .php file including the module descriptor. That rewrote the persistent
/* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */ marker placeholders to the
first object name, so generating a second object could no longer find them
(checkExistComment returned -1, 'comments not found for section Menus' warning)
and its menu entries were not inserted. Skip the descriptor in that loop: its
module name is already resolved by initmodule and its object entries are added
by the dedicated menu/permission blocks.
* FIX : preserve MODULEBUILDER markers when substituting the module descriptor
The previous commit only skipped the descriptor in the secondary substitution
pass, but the primary pass (over $filetogenerate, which includes the descriptor)
still rewrote its persistent /* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */
markers to the first object name. Those markers cannot simply be excluded from
substitution because the descriptor also has functional MYOBJECT/MYMODULE tokens
(e.g. the MYMODULE_MYOBJECT_ADDON numbering constant) that must be resolved.
Add dolReplaceInFilePreservingModuleBuilderMarkers(): it hides every MODULEBUILDER
marker behind a sentinel, applies the substitution, then restores the markers
verbatim. Use it for the descriptor in the primary pass; the descriptor stays
excluded from the secondary pass. Generating a second object now finds the
markers (checkExistComment) and inserts its menu entries without warning.
Verified by CLI: markers preserved across two successive objects, while content
(rights, exports, addon constant) is correctly substituted.
* FIX : silence phan on the new ModuleBuilder test and typed closure
CI phan (diff-only) flagged the freshly added test file: PhanUndeclaredExtendedClass
(\CommonClassTest) and PhanUndeclaredMethod (assertSame), like the sibling
NamingContractTest. Add the same @phan-file-suppress block (plus
PhanTypeMismatchArgumentProbablyReal for the non-array guard test case). Also
type the preg_replace_callback parameter (array $matches) to clear
PhanPluginUnknownClosureParamType. phpstan is already green; no phpstan
annotations added.
* FIX : drop closure in marker-preserving substitution to satisfy phan
phan's PhanPluginUnknownArrayClosureParamType wanted key/value types on the
preg_replace_callback closure parameter. Replace the callback with preg_match_all
plus a str_replace loop over the unique markers: same behaviour, no closure,
no plugin warning.
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-09 17:04:00 +00:00
dol_syslog ( " modulebuilder: failed to purge tab ' " . $tabkey . " ' in " . $libdestfile , LOG_ERR );
2026-05-18 14:13:35 +00:00
}
}
}
NEW: ModuleBuilder - selectable object tabs (+ fixes for multi-object generation) (#38570)
* NEW : add ModuleBuilder object-tabs map and filter helpers
Add getModuleBuilderObjectTabs() (source-of-truth map of optional object
tabs) and filterEnabledTabs() (sanitizes user-requested tab keys against the
map). Covered by ModuleBuilderLibTest.
Next: add BEGIN/END markers around tab flags and blocks in template lib (Task 2)
* NEW : wrap object tab flags and blocks with MODULEBUILDER markers
Surround each optional tab flag declaration (TABFLAG) and each prepareHead tab
block (TAB) with BEGIN/END MODULEBUILDER comment markers, so the generator can
purge a whole tab atomically while keeping $h and $head intact. Card tab is
not wrapped (always generated).
Next: add tab selection checkboxes to the newobject form in modulebuilder/index.php (Task 3)
* NEW : add object tab selection checkboxes to newobject form
Render one checkbox per optional tab (contact, note, document, agenda) in the
ModuleBuilder newobject form, all checked by default and reflecting posted
state on redisplay.
Next: handle enabledtab in initobject — exclude files, purge blocks, hardcode flags (Task 4)
* NEW : apply object tab selection during object generation
Excludes page files of unselected tabs, purges their prepareHead flag and
block via MODULEBUILDER markers, and hardcodes the show flag to 1 for selected
tabs. Emits a best-effort warning when regenerating an existing object.
Next: add language keys EnabledTabsForObject(Help) + WarningTabSelectionOnRegeneration (Task 5)
* NEW : add language keys for object tab selection
Next: add ChangeLog entry (Task 6)
* DOC : changelog entry for ModuleBuilder selectable object tabs
* FIX : purge agenda card widget when agenda tab is excluded
Audit finding: myobject_card.php hardcodes a 'SeeAll' link to myobject_agenda.php
in an event widget. When the agenda tab is excluded the page is not generated,
leaving a latent dead link if the widget is enabled. Wrap the widget with
MODULEBUILDER TAB AGENDA markers and purge it from the generated card when the
agenda tab is not selected.
Next: functional verification (step 5 of dev workflow)
* FIX : check file operation results when applying object tab selection
PR review: align with the nogeneratelines pattern by checking the return of
removePatternFromFile/dolReplaceInFile and raising $error + dol_syslog with the
failing tab/file context, instead of ignoring silent write failures during
object generation. Add PR reference to the changelog entry.
* FIX : do not abort object generation when nogeneratelines targets a missing file
The nogeneratelines handler purges the MODULEBUILDER LINES block from class,
API and card files. When API generation is disabled the api_<module>.class.php
file does not exist, so removePatternFromFile returns false and $error was
incremented, which skipped the whole success path (name substitution,
rebuildObjectClass, $tabobj assignment). Generated classes kept the literal
'class MyObject', so dolGetListOfObjectClasses listed every object as MyObject.
Guard each purge with file_exists so a missing optional file is skipped.
* FIX : keep module descriptor out of the blanket name substitution
The 'substitute all module php files' pass applied the object/module name map
to every .php file including the module descriptor. That rewrote the persistent
/* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */ marker placeholders to the
first object name, so generating a second object could no longer find them
(checkExistComment returned -1, 'comments not found for section Menus' warning)
and its menu entries were not inserted. Skip the descriptor in that loop: its
module name is already resolved by initmodule and its object entries are added
by the dedicated menu/permission blocks.
* FIX : preserve MODULEBUILDER markers when substituting the module descriptor
The previous commit only skipped the descriptor in the secondary substitution
pass, but the primary pass (over $filetogenerate, which includes the descriptor)
still rewrote its persistent /* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */
markers to the first object name. Those markers cannot simply be excluded from
substitution because the descriptor also has functional MYOBJECT/MYMODULE tokens
(e.g. the MYMODULE_MYOBJECT_ADDON numbering constant) that must be resolved.
Add dolReplaceInFilePreservingModuleBuilderMarkers(): it hides every MODULEBUILDER
marker behind a sentinel, applies the substitution, then restores the markers
verbatim. Use it for the descriptor in the primary pass; the descriptor stays
excluded from the secondary pass. Generating a second object now finds the
markers (checkExistComment) and inserts its menu entries without warning.
Verified by CLI: markers preserved across two successive objects, while content
(rights, exports, addon constant) is correctly substituted.
* FIX : silence phan on the new ModuleBuilder test and typed closure
CI phan (diff-only) flagged the freshly added test file: PhanUndeclaredExtendedClass
(\CommonClassTest) and PhanUndeclaredMethod (assertSame), like the sibling
NamingContractTest. Add the same @phan-file-suppress block (plus
PhanTypeMismatchArgumentProbablyReal for the non-array guard test case). Also
type the preg_replace_callback parameter (array $matches) to clear
PhanPluginUnknownClosureParamType. phpstan is already green; no phpstan
annotations added.
* FIX : drop closure in marker-preserving substitution to satisfy phan
phan's PhanPluginUnknownArrayClosureParamType wanted key/value types on the
preg_replace_callback closure parameter. Replace the callback with preg_match_all
plus a str_replace loop over the unique markers: same behaviour, no closure,
no plugin warning.
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-09 17:04:00 +00:00
// Agenda has an extra event widget on the card page: purge it too to avoid a dead link when the agenda tab is excluded
if ( ! $error && ! in_array ( 'agenda' , $enabledtabs , true )) {
$carddestfile = $destdir . '/' . $ncObj -> applyToFilename ( 'myobject_card.php' );
if ( ! removePatternFromFile ( $carddestfile , '/\h*\/\/ BEGIN MODULEBUILDER TAB AGENDA.*?\/\/ END MODULEBUILDER TAB AGENDA\s*/s' )) {
$error ++ ;
dol_syslog ( " modulebuilder: failed to purge agenda widget in " . $carddestfile , LOG_ERR );
}
}
if ( $objectalreadyexists ) {
setEventMessages ( $langs -> trans ( " WarningTabSelectionOnRegeneration " ), null , 'warnings' );
}
2026-05-18 14:13:35 +00:00
}
2021-02-26 17:26:44 +00:00
if ( ! $error ) {
2019-11-01 16:54:17 +00:00
// Edit PHP files to make replacement
2021-02-26 17:26:44 +00:00
foreach ( $filetogenerate as $destfile ) {
2017-10-06 00:42:32 +00:00
$phpfileval [ 'fullname' ] = $destdir . '/' . $destfile ;
//var_dump($phpfileval['fullname']);
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
$licenceValue = getDolGlobalString ( 'MODULEBUILDER_SPECIFIC_AUTHOR' )
? dol_print_date ( $now , '%Y' ) . ' ' . getDolGlobalString ( 'MODULEBUILDER_SPECIFIC_AUTHOR' )
: getLicenceHeader ( $user , $langs , $now );
$arrayreplacement = array_merge (
$ncObj -> getSubstitutionMap (),
[
'htdocs/modulebuilder/template/' => $ncObj -> moduleNameLower ,
'---Replace with your own copyright and developer email---' => $licenceValue ,
]
2017-10-06 00:42:32 +00:00
);
NEW: ModuleBuilder - selectable object tabs (+ fixes for multi-object generation) (#38570)
* NEW : add ModuleBuilder object-tabs map and filter helpers
Add getModuleBuilderObjectTabs() (source-of-truth map of optional object
tabs) and filterEnabledTabs() (sanitizes user-requested tab keys against the
map). Covered by ModuleBuilderLibTest.
Next: add BEGIN/END markers around tab flags and blocks in template lib (Task 2)
* NEW : wrap object tab flags and blocks with MODULEBUILDER markers
Surround each optional tab flag declaration (TABFLAG) and each prepareHead tab
block (TAB) with BEGIN/END MODULEBUILDER comment markers, so the generator can
purge a whole tab atomically while keeping $h and $head intact. Card tab is
not wrapped (always generated).
Next: add tab selection checkboxes to the newobject form in modulebuilder/index.php (Task 3)
* NEW : add object tab selection checkboxes to newobject form
Render one checkbox per optional tab (contact, note, document, agenda) in the
ModuleBuilder newobject form, all checked by default and reflecting posted
state on redisplay.
Next: handle enabledtab in initobject — exclude files, purge blocks, hardcode flags (Task 4)
* NEW : apply object tab selection during object generation
Excludes page files of unselected tabs, purges their prepareHead flag and
block via MODULEBUILDER markers, and hardcodes the show flag to 1 for selected
tabs. Emits a best-effort warning when regenerating an existing object.
Next: add language keys EnabledTabsForObject(Help) + WarningTabSelectionOnRegeneration (Task 5)
* NEW : add language keys for object tab selection
Next: add ChangeLog entry (Task 6)
* DOC : changelog entry for ModuleBuilder selectable object tabs
* FIX : purge agenda card widget when agenda tab is excluded
Audit finding: myobject_card.php hardcodes a 'SeeAll' link to myobject_agenda.php
in an event widget. When the agenda tab is excluded the page is not generated,
leaving a latent dead link if the widget is enabled. Wrap the widget with
MODULEBUILDER TAB AGENDA markers and purge it from the generated card when the
agenda tab is not selected.
Next: functional verification (step 5 of dev workflow)
* FIX : check file operation results when applying object tab selection
PR review: align with the nogeneratelines pattern by checking the return of
removePatternFromFile/dolReplaceInFile and raising $error + dol_syslog with the
failing tab/file context, instead of ignoring silent write failures during
object generation. Add PR reference to the changelog entry.
* FIX : do not abort object generation when nogeneratelines targets a missing file
The nogeneratelines handler purges the MODULEBUILDER LINES block from class,
API and card files. When API generation is disabled the api_<module>.class.php
file does not exist, so removePatternFromFile returns false and $error was
incremented, which skipped the whole success path (name substitution,
rebuildObjectClass, $tabobj assignment). Generated classes kept the literal
'class MyObject', so dolGetListOfObjectClasses listed every object as MyObject.
Guard each purge with file_exists so a missing optional file is skipped.
* FIX : keep module descriptor out of the blanket name substitution
The 'substitute all module php files' pass applied the object/module name map
to every .php file including the module descriptor. That rewrote the persistent
/* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */ marker placeholders to the
first object name, so generating a second object could no longer find them
(checkExistComment returned -1, 'comments not found for section Menus' warning)
and its menu entries were not inserted. Skip the descriptor in that loop: its
module name is already resolved by initmodule and its object entries are added
by the dedicated menu/permission blocks.
* FIX : preserve MODULEBUILDER markers when substituting the module descriptor
The previous commit only skipped the descriptor in the secondary substitution
pass, but the primary pass (over $filetogenerate, which includes the descriptor)
still rewrote its persistent /* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */
markers to the first object name. Those markers cannot simply be excluded from
substitution because the descriptor also has functional MYOBJECT/MYMODULE tokens
(e.g. the MYMODULE_MYOBJECT_ADDON numbering constant) that must be resolved.
Add dolReplaceInFilePreservingModuleBuilderMarkers(): it hides every MODULEBUILDER
marker behind a sentinel, applies the substitution, then restores the markers
verbatim. Use it for the descriptor in the primary pass; the descriptor stays
excluded from the secondary pass. Generating a second object now finds the
markers (checkExistComment) and inserts its menu entries without warning.
Verified by CLI: markers preserved across two successive objects, while content
(rights, exports, addon constant) is correctly substituted.
* FIX : silence phan on the new ModuleBuilder test and typed closure
CI phan (diff-only) flagged the freshly added test file: PhanUndeclaredExtendedClass
(\CommonClassTest) and PhanUndeclaredMethod (assertSame), like the sibling
NamingContractTest. Add the same @phan-file-suppress block (plus
PhanTypeMismatchArgumentProbablyReal for the non-array guard test case). Also
type the preg_replace_callback parameter (array $matches) to clear
PhanPluginUnknownClosureParamType. phpstan is already green; no phpstan
annotations added.
* FIX : drop closure in marker-preserving substitution to satisfy phan
phan's PhanPluginUnknownArrayClosureParamType wanted key/value types on the
preg_replace_callback closure parameter. Replace the callback with preg_match_all
plus a str_replace loop over the unique markers: same behaviour, no closure,
no plugin warning.
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-09 17:04:00 +00:00
if ( basename ( $phpfileval [ 'fullname' ]) === 'mod' . $module . '.class.php' ) {
// Module descriptor: substitute content but keep the persistent MODULEBUILDER markers intact
$result = dolReplaceInFilePreservingModuleBuilderMarkers ( $phpfileval [ 'fullname' ], $arrayreplacement );
} else {
$result = dolReplaceInFile ( $phpfileval [ 'fullname' ], $arrayreplacement ); // @phpstan-ignore-line
}
2017-10-06 00:42:32 +00:00
//var_dump($result);
2021-02-26 17:26:44 +00:00
if ( $result < 0 ) {
2017-10-06 00:42:32 +00:00
setEventMessages ( $langs -> trans ( " ErrorFailToMakeReplacementInto " , $phpfileval [ 'fullname' ]), null , 'errors' );
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
} else {
modulebuilderValidateGeneratedFile ( $phpfileval [ 'fullname' ], $ncObj );
}
}
}
if ( ! $error && $ncObj !== null ) {
// Apply object name substitution to ALL PHP files in the module directory.
// initmodule only substitutes the module name; files it creates (e.g. testmodindex.php,
// lib/testmod.lib.php, admin/setup.php) still contain myobject/mymodule placeholders
// that must be resolved when an object is first added.
$licenceValueAll = getDolGlobalString ( 'MODULEBUILDER_SPECIFIC_AUTHOR' )
? dol_print_date ( $now , '%Y' ) . ' ' . getDolGlobalString ( 'MODULEBUILDER_SPECIFIC_AUTHOR' )
: getLicenceHeader ( $user , $langs , $now );
$moduleReplacementAll = array_merge (
$ncObj -> getSubstitutionMap (),
[
'htdocs/modulebuilder/template/' => $ncObj -> moduleNameLower ,
'---Replace with your own copyright and developer email---' => $licenceValueAll ,
]
);
$allModulePhpFiles = dol_dir_list ( $destdir , 'files' , 1 , '\.php$' );
NEW: ModuleBuilder - selectable object tabs (+ fixes for multi-object generation) (#38570)
* NEW : add ModuleBuilder object-tabs map and filter helpers
Add getModuleBuilderObjectTabs() (source-of-truth map of optional object
tabs) and filterEnabledTabs() (sanitizes user-requested tab keys against the
map). Covered by ModuleBuilderLibTest.
Next: add BEGIN/END markers around tab flags and blocks in template lib (Task 2)
* NEW : wrap object tab flags and blocks with MODULEBUILDER markers
Surround each optional tab flag declaration (TABFLAG) and each prepareHead tab
block (TAB) with BEGIN/END MODULEBUILDER comment markers, so the generator can
purge a whole tab atomically while keeping $h and $head intact. Card tab is
not wrapped (always generated).
Next: add tab selection checkboxes to the newobject form in modulebuilder/index.php (Task 3)
* NEW : add object tab selection checkboxes to newobject form
Render one checkbox per optional tab (contact, note, document, agenda) in the
ModuleBuilder newobject form, all checked by default and reflecting posted
state on redisplay.
Next: handle enabledtab in initobject — exclude files, purge blocks, hardcode flags (Task 4)
* NEW : apply object tab selection during object generation
Excludes page files of unselected tabs, purges their prepareHead flag and
block via MODULEBUILDER markers, and hardcodes the show flag to 1 for selected
tabs. Emits a best-effort warning when regenerating an existing object.
Next: add language keys EnabledTabsForObject(Help) + WarningTabSelectionOnRegeneration (Task 5)
* NEW : add language keys for object tab selection
Next: add ChangeLog entry (Task 6)
* DOC : changelog entry for ModuleBuilder selectable object tabs
* FIX : purge agenda card widget when agenda tab is excluded
Audit finding: myobject_card.php hardcodes a 'SeeAll' link to myobject_agenda.php
in an event widget. When the agenda tab is excluded the page is not generated,
leaving a latent dead link if the widget is enabled. Wrap the widget with
MODULEBUILDER TAB AGENDA markers and purge it from the generated card when the
agenda tab is not selected.
Next: functional verification (step 5 of dev workflow)
* FIX : check file operation results when applying object tab selection
PR review: align with the nogeneratelines pattern by checking the return of
removePatternFromFile/dolReplaceInFile and raising $error + dol_syslog with the
failing tab/file context, instead of ignoring silent write failures during
object generation. Add PR reference to the changelog entry.
* FIX : do not abort object generation when nogeneratelines targets a missing file
The nogeneratelines handler purges the MODULEBUILDER LINES block from class,
API and card files. When API generation is disabled the api_<module>.class.php
file does not exist, so removePatternFromFile returns false and $error was
incremented, which skipped the whole success path (name substitution,
rebuildObjectClass, $tabobj assignment). Generated classes kept the literal
'class MyObject', so dolGetListOfObjectClasses listed every object as MyObject.
Guard each purge with file_exists so a missing optional file is skipped.
* FIX : keep module descriptor out of the blanket name substitution
The 'substitute all module php files' pass applied the object/module name map
to every .php file including the module descriptor. That rewrote the persistent
/* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */ marker placeholders to the
first object name, so generating a second object could no longer find them
(checkExistComment returned -1, 'comments not found for section Menus' warning)
and its menu entries were not inserted. Skip the descriptor in that loop: its
module name is already resolved by initmodule and its object entries are added
by the dedicated menu/permission blocks.
* FIX : preserve MODULEBUILDER markers when substituting the module descriptor
The previous commit only skipped the descriptor in the secondary substitution
pass, but the primary pass (over $filetogenerate, which includes the descriptor)
still rewrote its persistent /* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */
markers to the first object name. Those markers cannot simply be excluded from
substitution because the descriptor also has functional MYOBJECT/MYMODULE tokens
(e.g. the MYMODULE_MYOBJECT_ADDON numbering constant) that must be resolved.
Add dolReplaceInFilePreservingModuleBuilderMarkers(): it hides every MODULEBUILDER
marker behind a sentinel, applies the substitution, then restores the markers
verbatim. Use it for the descriptor in the primary pass; the descriptor stays
excluded from the secondary pass. Generating a second object now finds the
markers (checkExistComment) and inserts its menu entries without warning.
Verified by CLI: markers preserved across two successive objects, while content
(rights, exports, addon constant) is correctly substituted.
* FIX : silence phan on the new ModuleBuilder test and typed closure
CI phan (diff-only) flagged the freshly added test file: PhanUndeclaredExtendedClass
(\CommonClassTest) and PhanUndeclaredMethod (assertSame), like the sibling
NamingContractTest. Add the same @phan-file-suppress block (plus
PhanTypeMismatchArgumentProbablyReal for the non-array guard test case). Also
type the preg_replace_callback parameter (array $matches) to clear
PhanPluginUnknownClosureParamType. phpstan is already green; no phpstan
annotations added.
* FIX : drop closure in marker-preserving substitution to satisfy phan
phan's PhanPluginUnknownArrayClosureParamType wanted key/value types on the
preg_replace_callback closure parameter. Replace the callback with preg_match_all
plus a str_replace loop over the unique markers: same behaviour, no closure,
no plugin warning.
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-09 17:04:00 +00:00
// The module descriptor must NOT go through the blanket substitution: it keeps persistent
// MYOBJECT/MYMODULE markers (TOPMENU/LEFTMENU) reused when generating subsequent objects, and its
// own placeholders are already resolved by initmodule and the dedicated menu/permission blocks.
$moduledescriptorbasename = 'mod' . $module . '.class.php' ;
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
if ( is_array ( $allModulePhpFiles ) && ! empty ( $allModulePhpFiles )) {
foreach ( $allModulePhpFiles as $phpFileval ) {
NEW: ModuleBuilder - selectable object tabs (+ fixes for multi-object generation) (#38570)
* NEW : add ModuleBuilder object-tabs map and filter helpers
Add getModuleBuilderObjectTabs() (source-of-truth map of optional object
tabs) and filterEnabledTabs() (sanitizes user-requested tab keys against the
map). Covered by ModuleBuilderLibTest.
Next: add BEGIN/END markers around tab flags and blocks in template lib (Task 2)
* NEW : wrap object tab flags and blocks with MODULEBUILDER markers
Surround each optional tab flag declaration (TABFLAG) and each prepareHead tab
block (TAB) with BEGIN/END MODULEBUILDER comment markers, so the generator can
purge a whole tab atomically while keeping $h and $head intact. Card tab is
not wrapped (always generated).
Next: add tab selection checkboxes to the newobject form in modulebuilder/index.php (Task 3)
* NEW : add object tab selection checkboxes to newobject form
Render one checkbox per optional tab (contact, note, document, agenda) in the
ModuleBuilder newobject form, all checked by default and reflecting posted
state on redisplay.
Next: handle enabledtab in initobject — exclude files, purge blocks, hardcode flags (Task 4)
* NEW : apply object tab selection during object generation
Excludes page files of unselected tabs, purges their prepareHead flag and
block via MODULEBUILDER markers, and hardcodes the show flag to 1 for selected
tabs. Emits a best-effort warning when regenerating an existing object.
Next: add language keys EnabledTabsForObject(Help) + WarningTabSelectionOnRegeneration (Task 5)
* NEW : add language keys for object tab selection
Next: add ChangeLog entry (Task 6)
* DOC : changelog entry for ModuleBuilder selectable object tabs
* FIX : purge agenda card widget when agenda tab is excluded
Audit finding: myobject_card.php hardcodes a 'SeeAll' link to myobject_agenda.php
in an event widget. When the agenda tab is excluded the page is not generated,
leaving a latent dead link if the widget is enabled. Wrap the widget with
MODULEBUILDER TAB AGENDA markers and purge it from the generated card when the
agenda tab is not selected.
Next: functional verification (step 5 of dev workflow)
* FIX : check file operation results when applying object tab selection
PR review: align with the nogeneratelines pattern by checking the return of
removePatternFromFile/dolReplaceInFile and raising $error + dol_syslog with the
failing tab/file context, instead of ignoring silent write failures during
object generation. Add PR reference to the changelog entry.
* FIX : do not abort object generation when nogeneratelines targets a missing file
The nogeneratelines handler purges the MODULEBUILDER LINES block from class,
API and card files. When API generation is disabled the api_<module>.class.php
file does not exist, so removePatternFromFile returns false and $error was
incremented, which skipped the whole success path (name substitution,
rebuildObjectClass, $tabobj assignment). Generated classes kept the literal
'class MyObject', so dolGetListOfObjectClasses listed every object as MyObject.
Guard each purge with file_exists so a missing optional file is skipped.
* FIX : keep module descriptor out of the blanket name substitution
The 'substitute all module php files' pass applied the object/module name map
to every .php file including the module descriptor. That rewrote the persistent
/* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */ marker placeholders to the
first object name, so generating a second object could no longer find them
(checkExistComment returned -1, 'comments not found for section Menus' warning)
and its menu entries were not inserted. Skip the descriptor in that loop: its
module name is already resolved by initmodule and its object entries are added
by the dedicated menu/permission blocks.
* FIX : preserve MODULEBUILDER markers when substituting the module descriptor
The previous commit only skipped the descriptor in the secondary substitution
pass, but the primary pass (over $filetogenerate, which includes the descriptor)
still rewrote its persistent /* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */
markers to the first object name. Those markers cannot simply be excluded from
substitution because the descriptor also has functional MYOBJECT/MYMODULE tokens
(e.g. the MYMODULE_MYOBJECT_ADDON numbering constant) that must be resolved.
Add dolReplaceInFilePreservingModuleBuilderMarkers(): it hides every MODULEBUILDER
marker behind a sentinel, applies the substitution, then restores the markers
verbatim. Use it for the descriptor in the primary pass; the descriptor stays
excluded from the secondary pass. Generating a second object now finds the
markers (checkExistComment) and inserts its menu entries without warning.
Verified by CLI: markers preserved across two successive objects, while content
(rights, exports, addon constant) is correctly substituted.
* FIX : silence phan on the new ModuleBuilder test and typed closure
CI phan (diff-only) flagged the freshly added test file: PhanUndeclaredExtendedClass
(\CommonClassTest) and PhanUndeclaredMethod (assertSame), like the sibling
NamingContractTest. Add the same @phan-file-suppress block (plus
PhanTypeMismatchArgumentProbablyReal for the non-array guard test case). Also
type the preg_replace_callback parameter (array $matches) to clear
PhanPluginUnknownClosureParamType. phpstan is already green; no phpstan
annotations added.
* FIX : drop closure in marker-preserving substitution to satisfy phan
phan's PhanPluginUnknownArrayClosureParamType wanted key/value types on the
preg_replace_callback closure parameter. Replace the callback with preg_match_all
plus a str_replace loop over the unique markers: same behaviour, no closure,
no plugin warning.
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-09 17:04:00 +00:00
if ( basename ( $phpFileval [ 'fullname' ]) === $moduledescriptorbasename ) {
continue ;
}
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
$result = dolReplaceInFile ( $phpFileval [ 'fullname' ], $moduleReplacementAll );
if ( $result < 0 ) {
setEventMessages ( $langs -> trans ( " ErrorFailToMakeReplacementInto " , $phpFileval [ 'fullname' ]), null , 'warnings' );
}
}
}
// Delete initmodule placeholder files superseded by initobject-generated files.
$moduleLowerForPlaceholder = strtolower ( $module );
foreach ([
$destdir . '/stats/myobject_index.php' ,
$destdir . '/lib/' . $moduleLowerForPlaceholder . '_myobject.lib.php' ,
] as $placeholder ) {
if ( file_exists ( $placeholder )) {
dol_delete_file ( $placeholder );
2017-10-06 00:42:32 +00:00
}
}
}
2026-05-10 23:26:15 +00:00
$object = null ;
2021-02-26 17:26:44 +00:00
if ( ! $error ) {
2017-10-06 00:42:32 +00:00
// Edit the class file to write properties
2020-01-30 00:48:28 +00:00
$object = rebuildObjectClass ( $destdir , $module , $objectname , $newmask );
2022-09-26 23:05:22 +00:00
if ( is_numeric ( $object ) && $object <= 0 ) {
$pathoffiletoeditsrc = $destdir . '/class/' . strtolower ( $objectname ) . '.class.php' ;
setEventMessages ( $langs -> trans ( 'ErrorFailToCreateFile' , $pathoffiletoeditsrc ), null , 'errors' );
2024-03-13 19:17:26 +00:00
$warning ++ ;
2021-02-26 17:26:44 +00:00
}
2023-03-21 15:00:50 +00:00
// check if documentation was generate and add table of properties object
$file = $destdir . '/class/' . strtolower ( $objectname ) . '.class.php' ;
$destfile = $destdir . '/doc/Documentation.asciidoc' ;
if ( file_exists ( $destfile )) {
writePropsInAsciiDoc ( $file , $objectname , $destfile );
}
2017-10-06 00:42:32 +00:00
}
2026-05-10 23:26:15 +00:00
if ( ! $error && $object !== null ) {
2017-10-06 00:42:32 +00:00
// Edit sql with new properties
2020-01-30 00:48:28 +00:00
$result = rebuildObjectSql ( $destdir , $module , $objectname , $newmask , '' , $object );
2022-09-26 23:05:22 +00:00
if ( $result <= 0 ) {
setEventMessages ( $langs -> trans ( 'ErrorFailToCreateFile' , '.sql' ), null );
2021-02-26 17:26:44 +00:00
$error ++ ;
}
2017-10-06 00:42:32 +00:00
}
2021-02-26 17:26:44 +00:00
if ( ! $error ) {
2017-10-06 00:42:32 +00:00
setEventMessages ( $langs -> trans ( 'FilesForObjectInitialized' , $objectname ), null );
2019-11-01 16:54:17 +00:00
$tabobj = $objectname ;
2022-09-27 11:37:38 +00:00
} else {
$tabobj = 'newobject' ;
2017-10-06 00:42:32 +00:00
}
2023-03-13 14:16:06 +00:00
// check if module is enabled
if ( isModEnabled ( strtolower ( $module ))) {
$result = unActivateModule ( strtolower ( $module ));
2024-03-13 19:17:26 +00:00
dolibarr_set_const ( $db , " MAIN_IHM_PARAMS_REV " , getDolGlobalInt ( 'MAIN_IHM_PARAMS_REV' ) + 1 , 'chaine' , 0 , '' , $conf -> entity );
2023-03-13 14:16:06 +00:00
if ( $result ) {
setEventMessages ( $result , null , 'errors' );
}
2023-10-13 13:42:15 +00:00
setEventMessages ( $langs -> trans ( 'WarningModuleNeedRefresh' , $langs -> transnoentities ( $module )), null , 'warnings' );
2023-03-13 14:16:06 +00:00
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=objects&module=' . $module );
exit ;
}
2017-07-11 23:55:07 +00:00
}
2022-05-18 19:54:38 +00:00
// Add a dictionary
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'initdic' && $module && empty ( $cancel ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2023-08-09 10:37:20 +00:00
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
$destdir = $dirins . '/' . strtolower ( $module );
$moduledescriptorfile = $dirins . '/' . strtolower ( $module ) . '/core/modules/mod' . $module . '.class.php' ;
2023-09-08 10:11:52 +00:00
if ( ! GETPOST ( 'dicname' )) {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Table " )), null , 'errors' );
}
if ( ! GETPOST ( 'label' )) {
$error ++ ;
2024-01-14 11:26:37 +00:00
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Label " )), null , 'errors' );
2023-09-08 10:11:52 +00:00
}
2022-05-18 19:54:38 +00:00
if ( ! $error ) {
$newdicname = $dicname ;
2022-05-19 11:08:00 +00:00
if ( ! preg_match ( '/^c_/' , $newdicname )) {
2022-05-18 19:54:38 +00:00
$newdicname = 'c_' . $dicname ;
}
2023-08-09 10:37:20 +00:00
dol_include_once ( $pathtofile );
$class = 'mod' . $module ;
2022-05-18 19:54:38 +00:00
2026-05-10 23:26:15 +00:00
$moduleobj = null ;
2023-08-09 10:37:20 +00:00
if ( class_exists ( $class )) {
try {
$moduleobj = new $class ( $db );
2024-08-18 16:16:08 +00:00
'@phan-var-force DolibarrModules $moduleobj' ;
2024-11-04 22:53:20 +00:00
/** @var DolibarrModules $moduleobj */
2023-08-09 10:37:20 +00:00
} catch ( Exception $e ) {
$error ++ ;
dol_print_error ( $db , $e -> getMessage ());
}
} else {
$error ++ ;
2026-05-10 23:26:15 +00:00
}
if ( $moduleobj === null ) {
2023-08-09 10:37:20 +00:00
$langs -> load ( " errors " );
dol_print_error ( $db , $langs -> trans ( " ErrorFailedToLoadModuleDescriptorForXXX " , $module ));
exit ;
}
$dictionaries = $moduleobj -> dictionaries ;
2023-09-05 13:43:23 +00:00
$checkComment = checkExistComment ( $moduledescriptorfile , 2 );
if ( $checkComment < 0 ) {
setEventMessages ( $langs -> trans ( " WarningCommentNotFound " , $langs -> trans ( " Dictionaries " ), " mod " . $module . " class.php " ), null , 'warnings' );
} else {
createNewDictionnary ( $module , $moduledescriptorfile , $newdicname , $dictionaries );
if ( function_exists ( 'opcache_invalidate' )) {
opcache_reset (); // remove the include cache hell !
}
clearstatcache ( true );
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=dictionaries&module=' . $module . ( $forceddirread ? '@' . $dirread : '' ));
exit ;
2023-08-09 10:37:20 +00:00
}
2022-05-18 19:54:38 +00:00
}
}
// Delete a SQL table
2025-09-26 21:55:58 +00:00
if ( $dirins && ( $action == 'droptable' || $action == 'droptableextrafields' ) && ! empty ( $module ) && ! empty ( $tabobj ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2017-11-21 10:50:57 +00:00
$objectname = $tabobj ;
2020-01-30 00:48:28 +00:00
$arrayoftables = array ();
2024-09-03 14:33:02 +00:00
if ( $action == 'droptable' ) { // Test on permission already done
2021-02-26 17:26:44 +00:00
$arrayoftables [] = MAIN_DB_PREFIX . strtolower ( $module ) . '_' . strtolower ( $tabobj );
}
2024-09-03 14:33:02 +00:00
if ( $action == 'droptableextrafields' ) { // Test on permission already done
2021-02-26 17:26:44 +00:00
$arrayoftables [] = MAIN_DB_PREFIX . strtolower ( $module ) . '_' . strtolower ( $tabobj ) . '_extrafields' ;
}
2017-11-21 10:50:57 +00:00
2021-02-26 17:26:44 +00:00
foreach ( $arrayoftables as $tabletodrop ) {
2017-11-21 10:50:57 +00:00
$nb = - 1 ;
2020-01-30 00:48:28 +00:00
$sql = " SELECT COUNT(*) as nb FROM " . $tabletodrop ;
2017-11-21 10:50:57 +00:00
$resql = $db -> query ( $sql );
2021-02-26 17:26:44 +00:00
if ( $resql ) {
2017-11-21 10:50:57 +00:00
$obj = $db -> fetch_object ( $resql );
2021-02-26 17:26:44 +00:00
if ( $obj ) {
2025-09-15 14:16:22 +00:00
$nb = ( int ) $obj -> nb ;
2017-11-21 10:50:57 +00:00
}
2020-05-21 07:35:30 +00:00
} else {
2021-02-26 17:26:44 +00:00
if ( $db -> lasterrno () == 'DB_ERROR_NOSUCHTABLE' ) {
2017-11-21 10:50:57 +00:00
setEventMessages ( $langs -> trans ( " TableDoesNotExists " , $tabletodrop ), null , 'warnings' );
2020-05-21 07:35:30 +00:00
} else {
2017-11-21 10:50:57 +00:00
dol_print_error ( $db );
}
}
2021-02-26 17:26:44 +00:00
if ( $nb == 0 ) {
2019-11-13 18:37:08 +00:00
$resql = $db -> DDLDropTable ( $tabletodrop );
2017-11-21 10:50:57 +00:00
//var_dump($resql);
setEventMessages ( $langs -> trans ( " TableDropped " , $tabletodrop ), null , 'mesgs' );
2021-02-26 17:26:44 +00:00
} elseif ( $nb > 0 ) {
2017-11-21 10:50:57 +00:00
setEventMessages ( $langs -> trans ( " TableNotEmptyDropCanceled " , $tabletodrop ), null , 'warnings' );
}
}
}
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'addproperty' && empty ( $cancel ) && ! empty ( $module ) && ( ! empty ( $tabobj ) || ! empty ( GETPOST ( 'obj' ))) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2018-01-15 16:38:15 +00:00
$error = 0 ;
2023-10-13 18:07:39 +00:00
$objectname = ( GETPOST ( 'obj' ) ? GETPOST ( 'obj' ) : $tabobj );
2017-10-06 00:42:32 +00:00
2020-08-06 13:55:04 +00:00
$dirins = $dirread = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrootpath' ];
$moduletype = $listofmodules [ strtolower ( $module )][ 'moduletype' ];
2017-10-06 00:42:32 +00:00
$srcdir = $dirread . '/' . strtolower ( $module );
$destdir = $dirins . '/' . strtolower ( $module );
dol_mkdir ( $destdir );
2023-07-28 17:41:25 +00:00
$objects = dolGetListOfObjectClasses ( $destdir );
if ( ! in_array ( $objectname , array_values ( $objects ))) {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorObjectNotFound " , $langs -> transnoentities ( $objectname )), null , 'errors' );
}
2024-08-18 16:16:08 +00:00
$addfieldentry = array ();
2018-01-15 16:38:15 +00:00
// We click on add property
2021-02-26 17:26:44 +00:00
if ( ! GETPOST ( 'regenerateclasssql' ) && ! GETPOST ( 'regeneratemissing' )) {
if ( ! GETPOST ( 'propname' , 'aZ09' )) {
2018-01-15 16:38:15 +00:00
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Name " )), null , 'errors' );
}
2021-02-26 17:26:44 +00:00
if ( ! GETPOST ( 'proplabel' , 'alpha' )) {
2018-01-15 16:38:15 +00:00
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Label " )), null , 'errors' );
}
2021-02-26 17:26:44 +00:00
if ( ! GETPOST ( 'proptype' , 'alpha' )) {
2018-01-15 16:38:15 +00:00
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Type " )), null , 'errors' );
}
2017-10-06 00:42:32 +00:00
2024-08-18 16:16:08 +00:00
2023-10-13 18:07:39 +00:00
if ( ! $error && ! GETPOST ( 'regenerateclasssql' ) && ! GETPOST ( 'regeneratemissing' )) {
2026-06-13 22:49:05 +00:00
// Preserve case for composite types such as 'integer:Societe:societe/class/societe.class.php:1:(...__SHARED_ENTITIES__...)'
// because the colon-separated parts include PHP class names (case-sensitive) and __XXX__ substitution
// tokens that are uppercase by convention. Only lowercase simple atomic types (#34602).
$proptype = GETPOST ( 'proptype' , 'alpha' );
if ( strpos ( $proptype , ':' ) === false && strpos ( $proptype , '_' ) === false ) {
$proptype = strtolower ( $proptype );
}
2022-03-10 21:17:04 +00:00
$addfieldentry = array (
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
'name' => GETPOST ( 'propname' , 'aZ09' ),
'label' => GETPOST ( 'proplabel' , 'alpha' ),
2026-06-13 22:49:05 +00:00
'type' => $proptype ,
2025-08-04 23:04:22 +00:00
'arrayofkeyval' => GETPOST ( 'proparrayofkeyval' , 'nohtml' ), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
'visible' => GETPOST ( 'propvisible' , 'alphanohtml' ),
'enabled' => GETPOST ( 'propenabled' , 'alphanohtml' ),
'position' => GETPOSTINT ( 'propposition' ),
'notnull' => GETPOSTINT ( 'propnotnull' ),
'index' => GETPOSTINT ( 'propindex' ),
'foreignkey' => GETPOST ( 'propforeignkey' , 'alpha' ),
'searchall' => GETPOSTINT ( 'propsearchall' ),
'isameasure' => GETPOSTINT ( 'propisameasure' ),
2026-06-21 21:30:54 +00:00
'showoncombobox' => GETPOSTINT ( 'propshowoncombobox' ),
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
'comment' => GETPOST ( 'propcomment' , 'alpha' ),
'help' => GETPOST ( 'prophelp' , 'alpha' ),
'css' => GETPOST ( 'propcss' , 'alpha' ), // Can be 'maxwidth500 widthcentpercentminusxx' for example
'cssview' => GETPOST ( 'propcssview' , 'alpha' ),
'csslist' => GETPOST ( 'propcsslist' , 'alpha' ),
'default' => GETPOST ( 'propdefault' , 'restricthtml' ),
2024-08-18 16:16:08 +00:00
'noteditable' => GETPOSTINT ( 'propnoteditable' ),
//'alwayseditable' => GETPOSTINT('propalwayseditable'),
Fix: GETPOST(...,'int') to GETPOSTINT(...) (#28448)
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: Update spelling exceptions
* Qual: Ignore Phan Notice
2024-02-27 13:05:53 +00:00
'validate' => GETPOSTINT ( 'propvalidate' )
2022-03-10 21:17:04 +00:00
);
2023-10-13 22:47:25 +00:00
2022-03-10 21:17:04 +00:00
if ( ! empty ( $addfieldentry [ 'arrayofkeyval' ]) && ! is_array ( $addfieldentry [ 'arrayofkeyval' ])) {
2023-10-13 22:47:25 +00:00
$tmpdecode = json_decode ( $addfieldentry [ 'arrayofkeyval' ], true );
if ( $tmpdecode ) { // If string is already a json
$addfieldentry [ 'arrayofkeyval' ] = $tmpdecode ;
} else { // If string is a list of lines with "key,value"
$tmparray = dolExplodeIntoArray ( $addfieldentry [ 'arrayofkeyval' ], " \n " , " , " );
$addfieldentry [ 'arrayofkeyval' ] = $tmparray ;
}
2022-03-10 21:17:04 +00:00
}
2018-01-15 16:38:15 +00:00
}
}
2023-10-13 22:47:25 +00:00
2019-05-02 10:03:14 +00:00
/* if ( GETPOST ( 'regeneratemissing' ))
2017-10-06 00:42:32 +00:00
{
2018-01-15 16:38:15 +00:00
setEventMessages ( $langs -> trans ( " FeatureNotYetAvailable " ), null , 'warnings' );
$error ++ ;
2019-05-02 10:03:14 +00:00
} */
2017-10-06 00:42:32 +00:00
2022-07-15 13:35:45 +00:00
$moduletype = $listofmodules [ strtolower ( $module )][ 'moduletype' ];
2026-05-10 23:26:15 +00:00
$object = null ;
2017-10-06 00:42:32 +00:00
// Edit the class file to write properties
2021-02-26 17:26:44 +00:00
if ( ! $error ) {
2020-08-06 13:55:04 +00:00
$object = rebuildObjectClass ( $destdir , $module , $objectname , $newmask , $srcdir , $addfieldentry , $moduletype );
2022-03-10 21:17:04 +00:00
2021-02-26 17:26:44 +00:00
if ( is_numeric ( $object ) && $object <= 0 ) {
2022-09-26 23:05:22 +00:00
$pathoffiletoeditsrc = $destdir . '/class/' . strtolower ( $objectname ) . '.class.php' ;
setEventMessages ( $langs -> trans ( 'ErrorFailToCreateFile' , $pathoffiletoeditsrc ), null , 'errors' );
2019-08-28 10:10:28 +00:00
$error ++ ;
}
2017-10-06 00:42:32 +00:00
}
2017-07-12 09:52:07 +00:00
2017-10-06 00:42:32 +00:00
// Edit sql with new properties
2026-05-10 23:26:15 +00:00
if ( ! $error && $object !== null ) {
2020-08-06 13:55:04 +00:00
$result = rebuildObjectSql ( $destdir , $module , $objectname , $newmask , $srcdir , $object , $moduletype );
2022-07-15 13:35:45 +00:00
2021-02-26 17:26:44 +00:00
if ( $result <= 0 ) {
2022-09-26 23:05:22 +00:00
setEventMessages ( $langs -> trans ( 'ErrorFailToCreateFile' , '.sql' ), null , 'errors' );
2017-09-22 21:38:25 +00:00
$error ++ ;
}
2017-10-06 00:42:32 +00:00
}
2017-07-11 23:55:07 +00:00
2021-02-26 17:26:44 +00:00
if ( ! $error ) {
2022-07-15 13:35:45 +00:00
clearstatcache ( true );
2017-10-06 00:42:32 +00:00
setEventMessages ( $langs -> trans ( 'FilesForObjectUpdated' , $objectname ), null );
2017-09-05 20:33:55 +00:00
2022-03-10 21:17:04 +00:00
setEventMessages ( $langs -> trans ( 'WarningDatabaseIsNotUpdated' ), null );
2017-10-06 00:42:32 +00:00
// Make a redirect to reload all data
2020-01-30 00:48:28 +00:00
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=objects&module=' . $module . ( $forceddirread ? '@' . $dirread : '' ) . '&tabobj=' . $objectname . '&nocache=' . time ());
2017-10-06 00:42:32 +00:00
exit ;
}
2017-06-17 17:40:48 +00:00
}
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'confirm_deleteproperty' && $propertykey /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2017-09-05 18:42:34 +00:00
$objectname = $tabobj ;
2021-04-09 09:28:40 +00:00
$dirins = $dirread = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrootpath' ];
$moduletype = $listofmodules [ strtolower ( $module )][ 'moduletype' ];
2017-09-05 18:42:34 +00:00
$srcdir = $dirread . '/' . strtolower ( $module );
$destdir = $dirins . '/' . strtolower ( $module );
dol_mkdir ( $destdir );
2026-05-10 23:26:15 +00:00
$object = null ;
2017-09-05 18:42:34 +00:00
// Edit the class file to write properties
2021-02-26 17:26:44 +00:00
if ( ! $error ) {
2019-11-13 18:37:08 +00:00
$object = rebuildObjectClass ( $destdir , $module , $objectname , $newmask , $srcdir , array (), $propertykey );
2022-09-26 23:05:22 +00:00
2021-02-26 17:26:44 +00:00
if ( is_numeric ( $object ) && $object <= 0 ) {
2022-09-26 23:05:22 +00:00
$pathoffiletoeditsrc = $destdir . '/class/' . strtolower ( $objectname ) . '.class.php' ;
setEventMessages ( $langs -> trans ( 'ErrorFailToCreateFile' , $pathoffiletoeditsrc ), null , 'errors' );
2021-02-26 17:26:44 +00:00
$error ++ ;
}
2017-09-05 18:42:34 +00:00
}
// Edit sql with new properties
2026-05-10 23:26:15 +00:00
if ( ! $error && $object !== null ) {
2019-11-13 18:37:08 +00:00
$result = rebuildObjectSql ( $destdir , $module , $objectname , $newmask , $srcdir , $object );
2022-09-26 23:05:22 +00:00
2021-02-26 17:26:44 +00:00
if ( $result <= 0 ) {
2022-09-26 23:05:22 +00:00
setEventMessages ( $langs -> trans ( 'ErrorFailToCreateFile' , '.sql' ), null , 'errors' );
2021-02-26 17:26:44 +00:00
$error ++ ;
}
2017-09-05 18:42:34 +00:00
}
2021-02-26 17:26:44 +00:00
if ( ! $error ) {
2017-09-05 18:42:34 +00:00
setEventMessages ( $langs -> trans ( 'FilesForObjectUpdated' , $objectname ), null );
2017-09-05 20:33:55 +00:00
2017-10-31 22:10:29 +00:00
clearstatcache ( true );
2018-03-13 19:23:59 +00:00
2017-10-06 00:42:32 +00:00
// Make a redirect to reload all data
2020-01-30 00:48:28 +00:00
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=objects&module=' . $module . ( $forceddirread ? '@' . $dirread : '' ) . '&tabobj=' . $objectname );
2017-10-06 00:42:32 +00:00
exit ;
2017-09-05 18:42:34 +00:00
}
}
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'confirm_deletemodule' /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2021-02-26 17:26:44 +00:00
if ( preg_match ( '/[^a-z0-9_]/i' , $module )) {
2017-10-06 00:42:32 +00:00
$error ++ ;
setEventMessages ( $langs -> trans ( " SpaceOrSpecialCharAreNotAllowed " ), null , 'errors' );
}
2021-02-26 17:26:44 +00:00
if ( ! $error ) {
2019-11-13 18:37:08 +00:00
$modulelowercase = strtolower ( $module );
2017-10-06 00:42:32 +00:00
// Dir for module
$dir = $dirins . '/' . $modulelowercase ;
2022-11-26 10:13:48 +00:00
2022-11-26 09:06:39 +00:00
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
2022-11-26 10:13:48 +00:00
// Dir for module
2022-11-26 09:06:39 +00:00
$dir = dol_buildpath ( $modulelowercase , 0 );
// Zip file to build
$FILENAMEZIP = '' ;
// Load module
dol_include_once ( $pathtofile );
$class = 'mod' . $module ;
2024-08-18 16:16:08 +00:00
$moduleobj = null ;
2022-11-26 09:06:39 +00:00
if ( class_exists ( $class )) {
try {
$moduleobj = new $class ( $db );
2024-11-11 13:48:18 +00:00
'@phan-var-force DolibarrModules $moduleobj' ;
2024-11-04 22:53:20 +00:00
/** @var DolibarrModules $moduleobj */
2022-11-26 09:06:39 +00:00
} catch ( Exception $e ) {
$error ++ ;
dol_print_error ( $db , $e -> getMessage ());
}
} else {
$error ++ ;
$langs -> load ( " errors " );
2024-03-13 19:17:26 +00:00
setEventMessages ( $langs -> trans ( " ErrorFailedToLoadModuleDescriptorForXXX " , $module ), null , 'warnings' );
2022-11-26 09:06:39 +00:00
}
2022-11-26 10:13:48 +00:00
2024-03-13 19:17:26 +00:00
if ( $moduleobj ) {
$moduleobj -> remove ();
}
2017-10-06 00:42:32 +00:00
$result = dol_delete_dir_recursive ( $dir );
2021-02-26 17:26:44 +00:00
if ( $result > 0 ) {
2017-10-06 00:42:32 +00:00
setEventMessages ( $langs -> trans ( " DirWasRemoved " , $modulelowercase ), null );
2021-11-07 12:51:31 +00:00
clearstatcache ( true );
if ( function_exists ( 'opcache_invalidate' )) {
opcache_reset (); // remove the include cache hell !
}
header ( " Location: " . $_SERVER [ " PHP_SELF " ] . '?module=deletemodule' );
exit ;
2020-05-21 07:35:30 +00:00
} else {
2017-10-06 00:42:32 +00:00
setEventMessages ( $langs -> trans ( " PurgeNothingToDelete " ), null , 'warnings' );
}
}
$action = '' ;
$module = 'deletemodule' ;
2017-06-18 10:30:18 +00:00
}
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'confirm_deleteobject' && $objectname /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2021-02-26 17:26:44 +00:00
if ( preg_match ( '/[^a-z0-9_]/i' , $objectname )) {
2017-10-06 00:42:32 +00:00
$error ++ ;
setEventMessages ( $langs -> trans ( " SpaceOrSpecialCharAreNotAllowed " ), null , 'errors' );
}
2021-02-26 17:26:44 +00:00
if ( ! $error ) {
2019-11-13 18:37:08 +00:00
$modulelowercase = strtolower ( $module );
$objectlowercase = strtolower ( $objectname );
2017-10-06 00:42:32 +00:00
// Dir for module
$dir = $dirins . '/' . $modulelowercase ;
// Delete some files
NEW : Replace MyObject MyModule occurences (#38370)
* [COREMB] Centralize myobject/mymodule substitutions via NamingContract value object
Introduce NamingContract (immutable value object) and NamingContractValidator
to replace 6 scattered ad-hoc $arrayreplacement blocks across index.php and
modulebuilder.lib.php. Fixes a critical bug where MYOBJECT token was commented
out in initobject, leaving generated class files with unsubstituted placeholders.
- NamingContract: canonical ordered substitution map (12 tokens with object,
7 module-only), applyTo() via str_replace (not make_substitutions, to avoid
processing Dolibarr __(key)__ patterns in raw templates), applyToFilename()
for lowercase-only filename substitution
- StrictNamingContractValidator: post-generation scan for residual myobject/
mymodule tokens, skipping /* BEGIN/END MODULEBUILDER */ structural markers
- modulebuilderValidateGeneratedFile() helper: non-blocking warnings with
XSS-safe output via dol_escape_htmltag()
- Collision guard: InvalidArgumentException if module === object name
(case-insensitive), wrapped in try-catch at all instantiation sites
- 24 PHPUnit tests, 52 assertions
* fix(initobject): apply object substitution to all module PHP files
After initmodule creates the module structure, files like index.php,
lib/module.lib.php, admin/setup.php and class/api_module.class.php
still contain myobject/mymodule placeholders. initobject now scans
ALL PHP files in the module directory and applies the full NamingContract
substitution, and deletes the orphan stats/myobject_index.php placeholder.
* fix(initmodule): prevent array_merge from renumbering the '500000' key
PHP casts numeric string keys like '500000' to int(500000) internally.
array_merge() then renumbers integer keys starting from 0, turning
'500000' into key 0. make_substitutions() then calls str_replace(0, ...)
which casts 0 to the string '0', replacing EVERY zero digit in every
generated file with the idmodule value.
Fix: replace the bare '500000' key with '$this->numero = 500000' so that
array_merge sees a non-numeric string key and preserves it as-is.
* Fix initapi: apply header substitution after addObjectsToApiFile
addObjectsToApiFile substitutes properties/constructor/includes via regex
but leaves PHPDoc header and class declaration with mymodule/myobject tokens.
Fix: apply $arrayreplacement (minus 'MYOBJECT' uppercase key) after
addObjectsToApiFile to resolve the remaining residuals.
'MYOBJECT' is excluded to preserve the /* BEGIN MODULEBUILDER API MYOBJECT */
placeholder that addObjectsToApiFile relies on for future object additions.
* Move NamingContractTest to core test directory
NamingContract and NamingContractValidator are core modulebuilder classes;
their tests belong alongside other Dolibarr core tests in test/phpunit/,
not in htdocs/modulebuilder/test/phpunit/ (the custom-module pattern).
Updated require_once paths accordingly.
* fix useless file
* fix(phpcs): add missing @param descriptions and function docblocks
- NamingContract: merge adjacent string literals in exception message,
add description to @param $content in applyTo()
- NamingContractValidator: add descriptions to all bare @param tags
in interface and StrictNamingContractValidator methods
- NamingContractTest: add /** @return void */ docblocks to all test
methods, merge unnecessary string concat on template variable
* fix(phan/phpstan): remove readonly, add baselines for test file
- NamingContract: replace readonly properties with plain public string
(readonly requires PHP 8.1, phan minimum target is PHP 7.2)
- dev/tools/phan/baseline.txt: add NamingContractTest.php suppression
for PhanUndeclaredMethod (PHPUnit stubs not available in phan scope)
- NamingContractTest.php: add @phpstan-ignore class.notFound on class
declaration and method.notFound on each assertion call (PHPUnit not
in phpstan bootstrap, consistent with CommonClassTest.class.php)
* fix(phan/phpstan): suppress typed property warnings, NoopNew, class.notFound
- baseline.txt: add PhanCompatibleTypedProperty for NamingContract.class.php
(typed properties require PHP 7.4, phan min target is 7.2 — warning only
but phan exits 1 on any issue including warnings)
- baseline.txt: add PhanNoopNew for NamingContractTest.php (constructor
called for exception side-effect in guard tests is intentional)
- NamingContractTest.php: move @phpstan-ignore class.notFound to inline
comment on class declaration (docblock placement not picked up by phpstan)
* fix(phan/phpstan): add missing phan suppress on index.php l.574, fix phpstan class docblock
- index.php l.574: add @phan-suppress-next-line PhanPluginSuspiciousParamPosition
(same pattern as l.577 and l.587 for identical dolReplaceInFile calls
where local variable name $destfile matches parameter #3 of the function)
- NamingContractTest.php: use standalone /** @phpstan-ignore class.notFound */
docblock before class declaration (inline // comment not picked up by phpstan
on class declarations; separate docblock matches CommonClassTest.class.php pattern)
* Update baseline.txt
* fix(phan): add phan-file-suppress on NamingContractTest for PHPUnit undeclared methods
* fix(phan): suppress PhanNoopNew on expectException patterns in NamingContractTest
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-05-25 12:52:38 +00:00
try {
$ncObjDel = new NamingContract ( $module , $objectname );
} catch ( \InvalidArgumentException $e ) {
$error ++ ;
setEventMessages ( $langs -> trans ( " SpaceOrSpecialCharAreNotAllowed " ), null , 'errors' );
$ncObjDel = null ;
}
$filetodelete = [];
if ( ! $error && $ncObjDel !== null ) {
foreach ([
'myobject_card.php' ,
'myobject_note.php' ,
'myobject_contact.php' ,
'myobject_document.php' ,
'myobject_agenda.php' ,
'myobject_list.php' ,
'admin/myobject_extrafields.php' ,
'lib/mymodule_myobject.lib.php' ,
'sql/llx_mymodule_myobject.sql' ,
'sql/llx_mymodule_myobject_extrafields.sql' ,
'sql/llx_mymodule_myobject.key.sql' ,
'sql/llx_mymodule_myobject_extrafields.key.sql' ,
'scripts/myobject.php' ,
'class/myobject.class.php' ,
'class/myobjectstats.class.php' ,
'core/modules/mymodule/mod_myobject_advanced.php' ,
'core/modules/mymodule/mod_myobject_standard.php' ,
'core/modules/mymodule/modules_myobject.php' ,
'core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php' ,
'core/modules/mymodule/doc/pdf_standard_myobject.modules.php' ,
'stats/myobject_index.php' ,
] as $templateFile ) {
$filetodelete [ $templateFile ] = $ncObjDel -> applyToFilename ( $templateFile );
}
// Exceptions: target filenames differ from simple token substitution
$filetodelete [ 'ajax/myobject.lib.php' ] = 'ajax/' . $ncObjDel -> objectNameLower . '.php' ;
$filetodelete [ 'test/phpunit/MyObjectTest.php' ] = 'test/phpunit/' . $ncObjDel -> objectNameLower . 'Test.php' ;
$filetodelete [ 'class/api_myobject.class.php' ] = 'class/api_' . $ncObjDel -> moduleNameLower . '.class.php' ;
}
2017-10-06 00:42:32 +00:00
2022-12-29 15:10:53 +00:00
//menu for the object selected
2023-05-23 15:37:52 +00:00
// load class and check if menu,permission,documentation exist for this object
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
dol_include_once ( $pathtofile );
2023-12-04 12:46:42 +00:00
$class = 'mod' . $module ;
2024-08-18 16:16:08 +00:00
$moduleobj = null ;
2023-02-09 10:07:30 +00:00
if ( class_exists ( $class )) {
try {
$moduleobj = new $class ( $db );
2024-11-11 13:48:18 +00:00
'@phan-var-force DolibarrModules $moduleobj' ;
2024-11-04 22:53:20 +00:00
/** @var DolibarrModules $moduleobj */
2023-02-09 10:07:30 +00:00
} catch ( Exception $e ) {
$error ++ ;
dol_print_error ( $db , $e -> getMessage ());
}
2024-11-11 13:48:18 +00:00
} else {
$error ++ ;
$langs -> load ( " errors " );
dol_print_error ( $db , $langs -> trans ( " ErrorFailedToLoadModuleDescriptorForXXX " , $module ));
exit ;
2023-02-09 10:07:30 +00:00
}
2022-12-29 15:10:53 +00:00
$moduledescriptorfile = $dirins . '/' . strtolower ( $module ) . '/core/modules/mod' . $module . '.class.php' ;
2023-05-23 15:37:52 +00:00
// delete menus linked to the object
$menus = $moduleobj -> menu ;
2023-09-05 13:43:23 +00:00
$rewriteMenu = checkExistComment ( $moduledescriptorfile , 0 );
if ( $rewriteMenu < 0 ) {
setEventMessages ( $langs -> trans ( " WarningCommentNotFound " , $langs -> trans ( " Menus " ), " mod " . $module . " class.php " ), null , 'warnings' );
} else {
reWriteAllMenus ( $moduledescriptorfile , $menus , $objectname , null , - 1 );
}
2022-12-29 15:10:53 +00:00
2023-02-03 10:09:59 +00:00
// regenerate permissions and delete them
2023-05-03 13:33:58 +00:00
$permissions = $moduleobj -> rights ;
2023-09-05 13:43:23 +00:00
$rewritePerms = checkExistComment ( $moduledescriptorfile , 1 );
if ( $rewritePerms < 0 ) {
setEventMessages ( $langs -> trans ( " WarningCommentNotFound " , $langs -> trans ( " Permissions " ), " mod " . $module . " class.php " ), null , 'warnings' );
} else {
reWriteAllPermissions ( $moduledescriptorfile , $permissions , null , null , $objectname , '' , - 1 );
2023-08-30 15:00:12 +00:00
}
2023-09-05 13:43:23 +00:00
if ( $rewritePerms && $rewriteMenu ) {
// check if documentation has been generated
$file_doc = $dirins . '/' . strtolower ( $module ) . '/doc/Documentation.asciidoc' ;
deletePropsAndPermsFromDoc ( $file_doc , $objectname );
2023-05-23 15:37:52 +00:00
2023-09-05 13:43:23 +00:00
clearstatcache ( true );
if ( function_exists ( 'opcache_invalidate' )) {
opcache_reset (); // remove the include cache hell !
}
$resultko = 0 ;
foreach ( $filetodelete as $tmpfiletodelete ) {
2026-07-29 11:20:28 +00:00
$resulttmp = dol_delete_file ( $dir . '/' . $tmpfiletodelete , 1 , 0 , 1 );
$resulttmp = dol_delete_file ( $dir . '/' . $tmpfiletodelete . '.back' , 1 , 0 , 1 );
2023-09-05 13:43:23 +00:00
if ( ! $resulttmp ) {
$resultko ++ ;
}
2021-02-26 17:26:44 +00:00
}
2017-10-06 00:42:32 +00:00
2023-09-05 13:43:23 +00:00
if ( $resultko == 0 ) {
setEventMessages ( $langs -> trans ( " FilesDeleted " ), null );
} else {
setEventMessages ( $langs -> trans ( " ErrorSomeFilesCouldNotBeDeleted " ), null , 'warnings' );
}
2017-10-06 00:42:32 +00:00
}
}
$action = '' ;
2023-10-13 13:42:15 +00:00
if ( ! $error ) {
$tabobj = 'newobject' ;
} else {
$tabobj = 'deleteobject' ;
}
2023-03-13 14:16:06 +00:00
// check if module is enabled
if ( isModEnabled ( strtolower ( $module ))) {
$result = unActivateModule ( strtolower ( $module ));
2024-09-05 14:05:37 +00:00
dolibarr_set_const ( $db , " MAIN_IHM_PARAMS_REV " , getDolGlobalInt ( 'MAIN_IHM_PARAMS_REV' ) + 1 , 'chaine' , 0 , '' , $conf -> entity );
2023-03-13 14:16:06 +00:00
if ( $result ) {
setEventMessages ( $result , null , 'errors' );
}
2023-10-13 13:42:15 +00:00
setEventMessages ( $langs -> trans ( 'WarningModuleNeedRefresh' , $langs -> transnoentities ( $module )), null , 'warnings' );
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=objects&tabobj=deleteobject&module=' . urlencode ( $module ));
2023-03-13 14:16:06 +00:00
exit ;
}
2017-06-14 09:44:12 +00:00
}
2025-09-26 21:55:58 +00:00
if (( $dirins && $action == 'confirm_deletedictionary' && $dicname ) || ( $dirins && $action == 'confirm_deletedictionary' && GETPOST ( 'dictionnarykey' )) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2023-08-09 11:19:52 +00:00
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
$destdir = $dirins . '/' . strtolower ( $module );
$moduledescriptorfile = $dirins . '/' . strtolower ( $module ) . '/core/modules/mod' . $module . '.class.php' ;
if ( preg_match ( '/[^a-z0-9_]/i' , $dicname )) {
$error ++ ;
setEventMessages ( $langs -> trans ( " SpaceOrSpecialCharAreNotAllowed " ), null , 'errors' );
}
2023-08-10 08:04:17 +00:00
if ( ! empty ( $dicname )) {
$newdicname = $dicname ;
if ( ! preg_match ( '/^c_/' , $newdicname )) {
$newdicname = 'c_' . strtolower ( $dicname );
}
2024-08-18 16:16:08 +00:00
} else {
$newdicname = null ;
2023-08-09 11:19:52 +00:00
}
dol_include_once ( $pathtofile );
$class = 'mod' . $module ;
2026-05-10 23:26:15 +00:00
$moduleobj = null ;
2023-08-09 11:19:52 +00:00
if ( class_exists ( $class )) {
try {
$moduleobj = new $class ( $db );
2024-08-18 16:16:08 +00:00
'@phan-var-force DolibarrModules $moduleobj' ;
2024-11-04 22:53:20 +00:00
/** @var DolibarrModules $moduleobj */
2023-08-09 11:19:52 +00:00
} catch ( Exception $e ) {
$error ++ ;
dol_print_error ( $db , $e -> getMessage ());
}
} else {
$error ++ ;
2026-05-10 23:26:15 +00:00
}
if ( $moduleobj === null ) {
2023-08-09 11:19:52 +00:00
$langs -> load ( " errors " );
dol_print_error ( $db , $langs -> trans ( " ErrorFailedToLoadModuleDescriptorForXXX " , $module ));
exit ;
}
2023-08-10 08:04:17 +00:00
2023-08-09 11:19:52 +00:00
$dicts = $moduleobj -> dictionaries ;
2023-09-05 13:43:23 +00:00
$checkComment = checkExistComment ( $moduledescriptorfile , 2 );
if ( $checkComment < 0 ) {
$error ++ ;
setEventMessages ( $langs -> trans ( " WarningCommentNotFound " , $langs -> trans ( " Dictionaries " ), " mod " . $module . " class.php " ), null , 'warnings' );
}
2023-08-09 11:19:52 +00:00
2023-08-10 08:04:17 +00:00
if ( ! empty ( GETPOST ( 'dictionnarykey' ))) {
2024-08-15 14:57:02 +00:00
$newdicname = $dicts [ 'tabname' ][ GETPOSTINT ( 'dictionnarykey' ) - 1 ];
2023-08-10 08:04:17 +00:00
}
2024-08-18 16:16:08 +00:00
// Lookup the table dicname
$checkTable = false ;
if ( $newdicname !== null ) {
$checkTable = $db -> DDLDescTable ( MAIN_DB_PREFIX . strtolower ( $newdicname ));
}
2024-08-18 16:17:04 +00:00
if ( is_bool ( $checkTable ) || $db -> num_rows ( $checkTable ) <= 0 ) { // @phpstan-ignore-line
2023-08-09 11:19:52 +00:00
$error ++ ;
}
// search the key by name
$keyToDelete = null ;
foreach ( $dicts [ 'tabname' ] as $key => $table ) {
2023-08-09 11:43:44 +00:00
//var_dump($table." /////// ".$newdicname);exit;
if ( strtolower ( $table ) === $newdicname ) {
2023-08-09 11:19:52 +00:00
$keyToDelete = $key ;
break ;
}
}
// delete all dicname's key values from the dictionary
if ( $keyToDelete !== null ) {
$keysToDelete = [ 'tabname' , 'tablib' , 'tabsql' , 'tabsqlsort' , 'tabfield' , 'tabfieldvalue' , 'tabfieldinsert' , 'tabrowid' , 'tabcond' , 'tabhelp' ];
foreach ( $keysToDelete as $key ) {
unset ( $dicts [ $key ][ $keyToDelete ]);
}
} else {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorDictionaryNotFound " , ucfirst ( $dicname )), null , 'errors' );
}
2024-10-30 20:33:30 +00:00
if ( ! $error && $newdicname !== null ) {
2023-08-09 11:19:52 +00:00
// delete table
$_results = $db -> DDLDropTable ( MAIN_DB_PREFIX . strtolower ( $newdicname ));
if ( $_results < 0 ) {
dol_print_error ( $db );
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( " ErrorTableNotFound " , $newdicname ), null , 'errors' );
}
// rebuild file after update dictionaries
$result = updateDictionaryInFile ( $module , $moduledescriptorfile , $dicts );
if ( $result > 0 ) {
setEventMessages ( $langs -> trans ( " DictionaryDeleted " , ucfirst ( substr ( $newdicname , 2 ))), null );
}
2023-09-08 10:11:52 +00:00
if ( function_exists ( 'opcache_invalidate' )) {
opcache_reset (); // remove the include cache hell !
}
clearstatcache ( true );
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=dictionaries&module=' . $module . ( $forceddirread ? '@' . $dirread : '' ));
exit ;
2023-08-09 11:19:52 +00:00
}
}
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'updatedictionary' && GETPOST ( 'dictionnarykey' ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2024-08-15 14:57:02 +00:00
$keydict = GETPOSTINT ( 'dictionnarykey' ) - 1 ;
2023-08-09 11:19:52 +00:00
2023-08-10 08:41:58 +00:00
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
$destdir = $dirins . '/' . strtolower ( $module );
$moduledescriptorfile = $dirins . '/' . strtolower ( $module ) . '/core/modules/mod' . $module . '.class.php' ;
dol_include_once ( $pathtofile );
2023-12-04 12:46:42 +00:00
$class = 'mod' . $module ;
2023-08-10 08:41:58 +00:00
2026-05-10 23:26:15 +00:00
$moduleobj = null ;
2023-08-10 08:41:58 +00:00
if ( class_exists ( $class )) {
try {
$moduleobj = new $class ( $db );
2024-11-11 13:48:18 +00:00
'@phan-var-force DolibarrModules $moduleobj' ;
2024-11-04 22:53:20 +00:00
/** @var DolibarrModules $moduleobj */
2023-08-10 08:41:58 +00:00
} catch ( Exception $e ) {
$error ++ ;
dol_print_error ( $db , $e -> getMessage ());
}
} else {
$error ++ ;
2026-05-10 23:26:15 +00:00
}
if ( $moduleobj === null ) {
2023-08-10 08:41:58 +00:00
$langs -> load ( " errors " );
dol_print_error ( $db , $langs -> trans ( " ErrorFailedToLoadModuleDescriptorForXXX " , $module ));
exit ;
}
$dicts = $moduleobj -> dictionaries ;
if ( ! empty ( GETPOST ( 'tablib' )) && GETPOST ( 'tablib' ) !== $dicts [ 'tablib' ][ $keydict ]) {
$dicts [ 'tablib' ][ $keydict ] = ucfirst ( strtolower ( GETPOST ( 'tablib' )));
2023-09-05 13:43:23 +00:00
$checkComment = checkExistComment ( $moduledescriptorfile , 2 );
if ( $checkComment < 0 ) {
setEventMessages ( $langs -> trans ( " WarningCommentNotFound " , $langs -> trans ( " Dictionaries " ), " mod " . $module . " class.php " ), null , 'warnings' );
} else {
$updateDict = updateDictionaryInFile ( $module , $moduledescriptorfile , $dicts );
if ( $updateDict > 0 ) {
setEventMessages ( $langs -> trans ( " DictionaryNameUpdated " , ucfirst ( GETPOST ( 'tablib' ))), null );
}
if ( function_exists ( 'opcache_invalidate' )) {
opcache_reset (); // remove the include cache hell !
}
clearstatcache ( true );
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=dictionaries&module=' . $module . ( $forceddirread ? '@' . $dirread : '' ));
exit ;
2023-08-10 08:41:58 +00:00
}
}
//var_dump(GETPOST('tablib'));exit;
}
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'generatedoc' /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2021-05-02 10:15:31 +00:00
$modulelowercase = strtolower ( $module );
// Dir for module
$dirofmodule = dol_buildpath ( $modulelowercase , 0 ) . '/doc' ;
$FILENAMEDOC = strtolower ( $module ) . '.html' ;
$util = new Utils ( $db );
$result = $util -> generateDoc ( $module );
if ( $result > 0 ) {
setEventMessages ( $langs -> trans ( " DocFileGeneratedInto " , $dirofmodule ), null );
} else {
setEventMessages ( $util -> error , $util -> errors , 'errors' );
}
}
2017-07-11 18:47:49 +00:00
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'generatepackage' /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2019-11-13 18:37:08 +00:00
$modulelowercase = strtolower ( $module );
2017-10-06 00:42:32 +00:00
2021-05-02 10:15:31 +00:00
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
2017-10-06 00:42:32 +00:00
// Dir for module
2021-05-02 10:15:31 +00:00
$dir = dol_buildpath ( $modulelowercase , 0 );
2017-10-06 00:42:32 +00:00
// Zip file to build
2019-11-13 18:37:08 +00:00
$FILENAMEZIP = '' ;
2017-10-06 00:42:32 +00:00
// Load module
2021-05-02 10:15:31 +00:00
dol_include_once ( $pathtofile );
2019-11-13 18:37:08 +00:00
$class = 'mod' . $module ;
2017-10-06 00:42:32 +00:00
2026-05-10 23:26:15 +00:00
$moduleobj = null ;
2021-02-26 17:26:44 +00:00
if ( class_exists ( $class )) {
2017-10-06 00:42:32 +00:00
try {
$moduleobj = new $class ( $db );
2024-11-11 13:48:18 +00:00
'@phan-var-force DolibarrModules $moduleobj' ;
2024-11-04 22:53:20 +00:00
/** @var DolibarrModules $moduleobj */
2021-02-26 17:26:44 +00:00
} catch ( Exception $e ) {
2017-10-06 00:42:32 +00:00
$error ++ ;
2021-05-02 10:15:31 +00:00
dol_print_error ( $db , $e -> getMessage ());
2017-10-06 00:42:32 +00:00
}
2020-05-21 07:35:30 +00:00
} else {
2017-10-06 00:42:32 +00:00
$error ++ ;
2026-05-10 23:26:15 +00:00
}
if ( $moduleobj === null ) {
2017-10-06 00:42:32 +00:00
$langs -> load ( " errors " );
2021-05-02 10:15:31 +00:00
dol_print_error ( $db , $langs -> trans ( " ErrorFailedToLoadModuleDescriptorForXXX " , $module ));
2017-10-06 00:42:32 +00:00
exit ;
}
2019-11-13 18:37:08 +00:00
$arrayversion = explode ( '.' , $moduleobj -> version , 3 );
2021-02-26 17:26:44 +00:00
if ( count ( $arrayversion )) {
2022-10-12 14:17:25 +00:00
$FILENAMEZIP = " module_ " . $modulelowercase . '-' . $arrayversion [ 0 ] . ( empty ( $arrayversion [ 1 ]) ? '.0' : '.' . $arrayversion [ 1 ]) . ( empty ( $arrayversion [ 2 ]) ? '' : '.' . $arrayversion [ 2 ]) . '.zip' ;
2017-10-06 00:42:32 +00:00
$dirofmodule = dol_buildpath ( $modulelowercase , 0 ) . '/bin' ;
$outputfilezip = $dirofmodule . '/' . $FILENAMEZIP ;
2025-02-05 21:59:37 +00:00
if ( ! dol_is_dir ( $dirofmodule )) {
dol_mkdir ( $dirofmodule );
2017-07-17 09:05:38 +00:00
}
2025-02-05 21:59:37 +00:00
// Note: We exclude /bin/ to not include the already generated zip
$result = dol_compress_dir ( $dir , $outputfilezip , 'zip' , '/\/bin\/|\.git|\.old|\.back|\.ssh/' , $modulelowercase );
2017-07-17 09:05:38 +00:00
2021-02-26 17:26:44 +00:00
if ( $result > 0 ) {
2017-10-06 00:42:32 +00:00
setEventMessages ( $langs -> trans ( " ZipFileGeneratedInto " , $outputfilezip ), null );
2020-05-21 07:35:30 +00:00
} else {
2017-10-06 00:42:32 +00:00
$error ++ ;
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( " ErrorFailToGenerateFile " , $outputfilezip ), null , 'errors' );
}
2020-05-21 07:35:30 +00:00
} else {
2017-10-06 00:42:32 +00:00
$error ++ ;
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( " ErrorCheckVersionIsDefined " ), null , 'errors' );
}
2017-05-28 12:43:17 +00:00
}
2017-03-29 19:36:50 +00:00
2023-02-03 14:13:00 +00:00
// Add permission
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'addright' && ! empty ( $module ) && empty ( $cancel ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2023-02-03 14:13:00 +00:00
$error = 0 ;
// load class and check if right exist
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
dol_include_once ( $pathtofile );
2023-12-04 12:46:42 +00:00
$class = 'mod' . $module ;
2024-08-18 16:16:08 +00:00
$moduleobj = null ;
2023-02-03 14:13:00 +00:00
if ( class_exists ( $class )) {
try {
$moduleobj = new $class ( $db );
2024-08-18 16:16:08 +00:00
'@phan-var-force DolibarrModules $moduleobj' ;
2024-11-04 22:53:20 +00:00
/** @var DolibarrModules $moduleobj */
2023-02-03 14:13:00 +00:00
} catch ( Exception $e ) {
$error ++ ;
dol_print_error ( $db , $e -> getMessage ());
}
}
2024-01-12 17:06:50 +00:00
// verify information entered
2023-02-03 14:13:00 +00:00
if ( ! GETPOST ( 'label' , 'alpha' )) {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Label " )), null , 'errors' );
}
if ( ! GETPOST ( 'permissionObj' , 'alpha' )) {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Rights " )), null , 'errors' );
}
2023-03-16 09:40:18 +00:00
$id = GETPOST ( 'id' , 'alpha' );
2023-02-03 14:13:00 +00:00
$label = GETPOST ( 'label' , 'alpha' );
$objectForPerms = strtolower ( GETPOST ( 'permissionObj' , 'alpha' ));
$crud = GETPOST ( 'crud' , 'alpha' );
//check existing object permission
$counter = 0 ;
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
$permsForObject = array ();
2024-08-18 16:16:08 +00:00
if ( is_object ( $moduleobj )) {
$permissions = $moduleobj -> rights ;
} else {
$permissions = array ();
}
2023-02-03 14:13:00 +00:00
$allObject = array ();
2023-02-07 14:26:23 +00:00
$countPerms = count ( $permissions );
2023-02-07 13:58:29 +00:00
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
for ( $i = 0 ; $i < $countPerms ; $i ++ ) {
2023-02-03 14:13:00 +00:00
if ( $permissions [ $i ][ 4 ] == $objectForPerms ) {
$counter ++ ;
if ( count ( $permsForObject ) < 3 ) {
$permsForObject [] = $permissions [ $i ];
}
}
$allObject [] = $permissions [ $i ][ 4 ];
}
2023-02-07 13:58:29 +00:00
2023-02-03 14:13:00 +00:00
// check if label of object already exists
2023-02-07 14:26:23 +00:00
$countPermsObj = count ( $permsForObject );
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
for ( $j = 0 ; $j < $countPermsObj ; $j ++ ) {
2023-06-12 12:16:09 +00:00
if ( in_array ( $crud , $permsForObject [ $j ])) {
2023-03-16 09:40:18 +00:00
$error ++ ;
2023-06-12 12:16:09 +00:00
setEventMessages ( $langs -> trans ( " ErrorExistingPermission " , $langs -> transnoentities ( $crud ), $langs -> transnoentities ( $objectForPerms )), null , 'errors' );
2023-02-03 14:13:00 +00:00
}
}
2023-03-16 09:40:18 +00:00
2024-08-18 16:16:08 +00:00
$rightToAdd = array ();
2023-02-03 14:13:00 +00:00
if ( ! $error ) {
2023-03-16 09:40:18 +00:00
$key = $countPerms + 1 ;
//prepare right to add
2024-08-18 16:16:08 +00:00
$rightToAdd = array (
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
0 => $id ,
1 => $label ,
4 => $objectForPerms ,
5 => $crud
2024-08-18 16:16:08 +00:00
);
2023-03-16 09:40:18 +00:00
2023-02-03 14:13:00 +00:00
if ( isModEnabled ( strtolower ( $module ))) {
$result = unActivateModule ( strtolower ( $module ));
2024-09-05 14:05:37 +00:00
dolibarr_set_const ( $db , " MAIN_IHM_PARAMS_REV " , getDolGlobalInt ( 'MAIN_IHM_PARAMS_REV' ) + 1 , 'chaine' , 0 , '' , $conf -> entity );
2023-02-03 14:13:00 +00:00
if ( $result ) {
setEventMessages ( $result , null , 'errors' );
}
2023-10-13 13:42:15 +00:00
setEventMessages ( $langs -> trans ( 'WarningModuleNeedRefresh' , $langs -> transnoentities ( $module )), null , 'warnings' );
2023-02-03 14:13:00 +00:00
}
2023-03-07 14:51:27 +00:00
2025-08-06 11:19:01 +00:00
$moduledescriptorfile = $dirins . '/' . strtolower ( $module ) . '/core/modules/mod' . $module . '.class.php' ;
// Rewriting all permissions section in the descriptor file
$rewrite = checkExistComment ( $moduledescriptorfile , 1 );
if ( $rewrite < 0 ) {
setEventMessages ( $langs -> trans ( " WarningCommentNotFound " , $langs -> trans ( " Permissions " ), " mod " . $module . " class.php " ), null , 'warnings' );
} else {
reWriteAllPermissions ( $moduledescriptorfile , $permissions , $key , $rightToAdd , '' , '' , 1 );
setEventMessages ( $langs -> trans ( 'PermissionAddedSuccesfuly' ), null );
clearstatcache ( true );
if ( function_exists ( 'opcache_invalidate' )) {
opcache_reset (); // remove the include cache hell !
}
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=permissions&module=' . $module );
exit ;
2023-09-05 13:43:23 +00:00
}
2023-03-07 14:51:27 +00:00
}
2023-02-03 14:13:00 +00:00
}
2019-03-13 17:11:15 +00:00
2023-02-03 16:06:05 +00:00
// Update permission
2025-09-26 21:55:58 +00:00
if ( $dirins && GETPOST ( 'action' ) == 'update_right' && GETPOST ( 'modifyright' ) && empty ( $cancel ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2023-02-03 16:06:05 +00:00
$error = 0 ;
// load class and check if right exist
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
dol_include_once ( $pathtofile );
2023-12-04 12:46:42 +00:00
$class = 'mod' . $module ;
2024-08-18 16:16:08 +00:00
$moduleobj = null ;
2023-02-03 16:06:05 +00:00
if ( class_exists ( $class )) {
try {
$moduleobj = new $class ( $db );
2024-08-18 16:16:08 +00:00
'@phan-var-force DolibarrModules $moduleobj' ;
2024-11-04 22:53:20 +00:00
/** @var DolibarrModules $moduleobj */
2023-02-03 16:06:05 +00:00
} catch ( Exception $e ) {
$error ++ ;
dol_print_error ( $db , $e -> getMessage ());
}
}
2024-01-12 17:06:50 +00:00
// verify information entered
2023-02-03 16:06:05 +00:00
if ( ! GETPOST ( 'label' , 'alpha' )) {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Label " )), null , 'errors' );
}
if ( ! GETPOST ( 'permissionObj' , 'alpha' )) {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Rights " )), null , 'errors' );
}
$label = GETPOST ( 'label' , 'alpha' );
$objectForPerms = strtolower ( GETPOST ( 'permissionObj' , 'alpha' ));
$crud = GETPOST ( 'crud' , 'alpha' );
if ( $label == " Read objects of $module " && $crud != " read " ) {
$crud = " read " ;
2024-03-14 01:56:56 +00:00
// $label = "Read objects of $module";
2023-02-03 16:06:05 +00:00
}
if ( $label == " Create/Update objects of $module " && $crud != " write " ) {
$crud = " write " ;
2024-03-14 01:56:56 +00:00
// $label = "Create/Update objects of $module";
2023-02-03 16:06:05 +00:00
}
if ( $label == " Delete objects of $module " && $crud != " delete " ) {
$crud = " delete " ;
2024-03-14 01:56:56 +00:00
// $label = "Delete objects of $module";
2023-02-03 16:06:05 +00:00
}
2024-08-18 16:16:08 +00:00
if ( is_object ( $moduleobj )) {
$permissions = $moduleobj -> rights ;
} else {
$permissions = [];
}
$key = GETPOSTINT ( 'counter' ) - 1 ;
2023-02-03 16:06:05 +00:00
//get permission want to delete from permissions array
2024-08-18 16:16:08 +00:00
if ( array_key_exists ( $key , $permissions )) {
$x1 = $permissions [ $key ][ 1 ];
$x2 = $permissions [ $key ][ 4 ];
$x3 = $permissions [ $key ][ 5 ];
} else {
$x1 = null ;
$x2 = null ;
$x3 = null ;
}
2023-12-04 12:46:42 +00:00
//check existing object permission
$counter = 0 ;
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
$permsForObject = array ();
2024-08-18 16:16:08 +00:00
// $permissions = $moduleobj->rights; // Already fetched above
2023-12-04 12:46:42 +00:00
$firstRight = 0 ;
$existRight = 0 ;
$allObject = array ();
2023-02-03 16:06:05 +00:00
2023-12-04 12:46:42 +00:00
$countPerms = count ( $permissions );
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
for ( $i = 0 ; $i < $countPerms ; $i ++ ) {
2023-02-03 16:06:05 +00:00
if ( $permissions [ $i ][ 4 ] == $objectForPerms ) {
2023-02-07 13:58:29 +00:00
$counter ++ ;
2023-02-03 16:06:05 +00:00
if ( count ( $permsForObject ) < 3 ) {
$permsForObject [] = $permissions [ $i ];
}
}
$allObject [] = $permissions [ $i ][ 4 ];
}
if ( $label != $x1 && $crud != $x3 ) {
2023-02-07 14:26:23 +00:00
$countPermsObj = count ( $permsForObject );
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
for ( $j = 0 ; $j < $countPermsObj ; $j ++ ) {
2023-02-03 16:06:05 +00:00
if ( in_array ( $label , $permsForObject [ $j ])) {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorExistingPermission " , $langs -> transnoentities ( $label ), $langs -> transnoentities ( $objectForPerms )), null , 'errors' );
}
}
}
if ( ! $error ) {
if ( isModEnabled ( strtolower ( $module ))) {
$result = unActivateModule ( strtolower ( $module ));
2024-09-05 14:05:37 +00:00
dolibarr_set_const ( $db , " MAIN_IHM_PARAMS_REV " , getDolGlobalInt ( 'MAIN_IHM_PARAMS_REV' ) + 1 , 'chaine' , 0 , '' , $conf -> entity );
2023-02-03 16:06:05 +00:00
if ( $result ) {
setEventMessages ( $result , null , 'errors' );
}
2023-10-13 13:42:15 +00:00
setEventMessages ( $langs -> trans ( 'WarningModuleNeedRefresh' , $langs -> transnoentities ( $module )), null , 'warnings' );
2023-02-03 16:06:05 +00:00
}
2019-03-13 17:11:15 +00:00
2023-02-03 16:06:05 +00:00
$moduledescriptorfile = $dirins . '/' . strtolower ( $module ) . '/core/modules/mod' . $module . '.class.php' ;
2023-03-16 09:40:18 +00:00
// rewriting all permissions after update permission needed
2023-09-05 13:43:23 +00:00
$rewrite = checkExistComment ( $moduledescriptorfile , 1 );
if ( $rewrite < 0 ) {
setEventMessages ( $langs -> trans ( " WarningCommentNotFound " , $langs -> trans ( " Permissions " ), " mod " . $module . " class.php " ), null , 'warnings' );
} else {
2024-08-18 16:16:08 +00:00
$rightUpdated = null ; // I not set at this point
2023-09-05 13:43:23 +00:00
reWriteAllPermissions ( $moduledescriptorfile , $permissions , $key , $rightUpdated , '' , '' , 2 );
setEventMessages ( $langs -> trans ( 'PermissionUpdatedSuccesfuly' ), null );
clearstatcache ( true );
if ( function_exists ( 'opcache_invalidate' )) {
opcache_reset (); // remove the include cache hell !
}
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=permissions&module=' . $module );
exit ;
2023-03-07 14:51:27 +00:00
}
2023-02-03 16:06:05 +00:00
}
}
2023-02-03 14:23:50 +00:00
// Delete permission
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'confirm_deleteright' && ! empty ( $module ) && GETPOSTINT ( 'permskey' ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2023-02-03 14:23:50 +00:00
$error = 0 ;
// load class and check if right exist
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
dol_include_once ( $pathtofile );
2023-03-07 14:51:27 +00:00
$class = 'mod' . $module ;
2024-08-18 16:16:08 +00:00
$moduleobj = null ;
2023-02-03 14:23:50 +00:00
if ( class_exists ( $class )) {
try {
$moduleobj = new $class ( $db );
2024-11-11 13:48:18 +00:00
'@phan-var-force DolibarrModules $moduleobj' ;
2024-11-04 22:53:20 +00:00
/** @var DolibarrModules $moduleobj */
2023-02-03 14:23:50 +00:00
} catch ( Exception $e ) {
$error ++ ;
dol_print_error ( $db , $e -> getMessage ());
}
}
2023-03-07 14:51:27 +00:00
$permissions = $moduleobj -> rights ;
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
$key = GETPOSTINT ( 'permskey' ) - 1 ;
2023-03-15 09:33:42 +00:00
2023-03-16 09:40:18 +00:00
if ( ! $error ) {
2023-02-03 14:23:50 +00:00
// check if module is enabled
if ( isModEnabled ( strtolower ( $module ))) {
$result = unActivateModule ( strtolower ( $module ));
2024-09-05 14:05:37 +00:00
dolibarr_set_const ( $db , " MAIN_IHM_PARAMS_REV " , getDolGlobalInt ( 'MAIN_IHM_PARAMS_REV' ) + 1 , 'chaine' , 0 , '' , $conf -> entity );
2023-02-03 14:23:50 +00:00
if ( $result ) {
setEventMessages ( $result , null , 'errors' );
}
2023-10-13 13:42:15 +00:00
setEventMessages ( $langs -> trans ( 'WarningModuleNeedRefresh' , $langs -> transnoentities ( $module )), null , 'warnings' );
2023-03-07 14:51:27 +00:00
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=permissions&module=' . $module );
2023-02-07 14:14:26 +00:00
exit ;
2023-09-05 13:43:23 +00:00
}
// rewriting all permissions
$moduledescriptorfile = $dirins . '/' . strtolower ( $module ) . '/core/modules/mod' . $module . '.class.php' ;
$rewrite = checkExistComment ( $moduledescriptorfile , 1 );
if ( $rewrite < 0 ) {
setEventMessages ( $langs -> trans ( " WarningCommentNotFound " , $langs -> trans ( " Permissions " ), " mod " . $module . " class.php " ), null , 'warnings' );
2023-02-03 14:23:50 +00:00
} else {
2023-09-05 13:43:23 +00:00
reWriteAllPermissions ( $moduledescriptorfile , $permissions , $key , null , '' , '' , 0 );
2023-02-03 14:23:50 +00:00
setEventMessages ( $langs -> trans ( 'PermissionDeletedSuccesfuly' ), null );
2023-03-07 14:51:27 +00:00
clearstatcache ( true );
if ( function_exists ( 'opcache_invalidate' )) {
opcache_reset (); // remove the include cache hell !
}
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=permissions&module=' . $module );
2023-02-03 14:23:50 +00:00
exit ;
}
}
}
2017-07-08 14:52:10 +00:00
// Save file
2025-09-26 21:55:58 +00:00
if ( $action == 'savefile' && empty ( $cancel ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2017-10-06 00:42:32 +00:00
$relofcustom = basename ( $dirins );
2021-02-26 17:26:44 +00:00
if ( $relofcustom ) {
2017-10-06 00:42:32 +00:00
// Check that relative path ($file) start with name 'custom'
2021-02-26 17:26:44 +00:00
if ( ! preg_match ( '/^' . $relofcustom . '/' , $file )) {
$file = $relofcustom . '/' . $file ;
}
2017-10-06 00:42:32 +00:00
2019-11-13 18:37:08 +00:00
$pathoffile = dol_buildpath ( $file , 0 );
$pathoffilebackup = dol_buildpath ( $file . '.back' , 0 );
2017-10-06 00:42:32 +00:00
// Save old version
2021-02-26 17:26:44 +00:00
if ( dol_is_file ( $pathoffile )) {
2024-09-22 23:59:14 +00:00
dol_copy ( $pathoffile , $pathoffilebackup , '0' , 1 );
2017-10-06 00:42:32 +00:00
}
2020-09-17 14:57:39 +00:00
$check = 'restricthtml' ;
$srclang = dol_mimetype ( $pathoffile , '' , 3 );
2021-02-26 17:26:44 +00:00
if ( $srclang == 'md' ) {
$check = 'restricthtml' ;
}
if ( $srclang == 'lang' ) {
$check = 'restricthtml' ;
}
if ( $srclang == 'php' ) {
$check = 'none' ;
}
2020-09-17 14:57:39 +00:00
$content = GETPOST ( 'editfilecontent' , $check );
2017-10-06 00:42:32 +00:00
// Save file on disk
2021-02-26 17:26:44 +00:00
if ( $content ) {
2017-10-06 00:42:32 +00:00
dol_delete_file ( $pathoffile );
2019-03-17 18:33:25 +00:00
$result = file_put_contents ( $pathoffile , $content );
2021-02-26 17:26:44 +00:00
if ( $result ) {
2023-02-17 18:30:50 +00:00
dolChmod ( $pathoffile , $newmask );
2017-10-06 00:42:32 +00:00
2020-04-05 00:44:59 +00:00
setEventMessages ( $langs -> trans ( " FileSaved " ), null );
2020-05-21 07:35:30 +00:00
} else {
2020-04-05 00:44:59 +00:00
setEventMessages ( $langs -> trans ( " ErrorFailedToSaveFile " ), null , 'errors' );
2019-03-17 18:33:25 +00:00
}
2020-05-21 07:35:30 +00:00
} else {
2017-09-22 23:24:31 +00:00
setEventMessages ( $langs -> trans ( " ContentCantBeEmpty " ), null , 'errors' );
2017-10-06 00:42:32 +00:00
//$action='editfile';
$error ++ ;
}
}
2017-07-08 13:43:36 +00:00
}
2017-07-16 12:57:30 +00:00
// Enable module
2025-09-26 21:55:58 +00:00
if ( $action == 'set' && $user -> admin /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2020-01-30 00:48:28 +00:00
$param = '' ;
2021-02-26 17:26:44 +00:00
if ( $module ) {
$param .= '&module=' . urlencode ( $module );
}
2025-02-05 21:59:37 +00:00
$param .= '&tab=' . urlencode ( $tab );
$param .= '&tabobj=' . urlencode ( $tabobj );
2017-07-24 11:55:12 +00:00
2019-01-27 10:55:16 +00:00
$value = GETPOST ( 'value' , 'alpha' );
2026-02-09 21:43:56 +00:00
$resarray = activateModule ( $value , 1 , 0 );
2021-02-26 17:26:44 +00:00
if ( ! empty ( $resarray [ 'errors' ])) {
setEventMessages ( '' , $resarray [ 'errors' ], 'errors' );
} else {
2017-07-16 12:57:30 +00:00
//var_dump($resarray);exit;
2021-02-26 17:26:44 +00:00
if ( $resarray [ 'nbperms' ] > 0 ) {
2020-01-30 00:48:28 +00:00
$tmpsql = " SELECT COUNT(rowid) as nb FROM " . MAIN_DB_PREFIX . " user WHERE admin <> 1 " ;
$resqltmp = $db -> query ( $tmpsql );
2021-02-26 17:26:44 +00:00
if ( $resqltmp ) {
2020-01-30 00:48:28 +00:00
$obj = $db -> fetch_object ( $resqltmp );
2017-07-16 12:57:30 +00:00
//var_dump($obj->nb);exit;
2021-02-26 17:26:44 +00:00
if ( $obj && $obj -> nb > 1 ) {
2017-07-16 12:57:30 +00:00
$msg = $langs -> trans ( 'ModuleEnabledAdminMustCheckRights' );
setEventMessages ( $msg , null , 'warnings' );
}
2021-02-26 17:26:44 +00:00
} else {
dol_print_error ( $db );
}
2017-07-16 12:57:30 +00:00
}
}
header ( " Location: " . $_SERVER [ " PHP_SELF " ] . " ? " . $param );
exit ;
}
// Disable module
2025-09-26 21:55:58 +00:00
if ( $action == 'reset' && $user -> admin /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2020-01-30 00:48:28 +00:00
$param = '' ;
2021-02-26 17:26:44 +00:00
if ( $module ) {
$param .= '&module=' . urlencode ( $module );
}
2025-02-05 21:59:37 +00:00
$param .= '&tab=' . urlencode ( $tab );
$param .= '&tabobj=' . urlencode ( $tabobj );
2017-07-24 11:55:12 +00:00
2019-01-27 10:55:16 +00:00
$value = GETPOST ( 'value' , 'alpha' );
2025-12-15 12:14:04 +00:00
$result = unActivateModule ( strtolower ( $value ));
2021-02-26 17:26:44 +00:00
if ( $result ) {
setEventMessages ( $result , null , 'errors' );
}
2017-07-16 12:57:30 +00:00
header ( " Location: " . $_SERVER [ " PHP_SELF " ] . " ? " . $param );
exit ;
}
2017-07-08 13:43:36 +00:00
2025-12-15 12:14:04 +00:00
// Delete menu
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'confirm_deletemenu' && GETPOSTINT ( 'menukey' ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2023-02-09 10:40:43 +00:00
// check if module is enabled
if ( isModEnabled ( strtolower ( $module ))) {
$result = unActivateModule ( strtolower ( $module ));
2024-09-05 14:05:37 +00:00
dolibarr_set_const ( $db , " MAIN_IHM_PARAMS_REV " , getDolGlobalInt ( 'MAIN_IHM_PARAMS_REV' ) + 1 , 'chaine' , 0 , '' , $conf -> entity );
2023-02-09 10:40:43 +00:00
if ( $result ) {
setEventMessages ( $result , null , 'errors' );
}
2023-10-13 13:42:15 +00:00
setEventMessages ( $langs -> trans ( 'WarningModuleNeedRefresh' , $langs -> transnoentities ( $module )), null , 'warnings' );
2023-10-29 15:44:41 +00:00
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=menus&module=' . $module );
exit ;
2023-02-09 10:40:43 +00:00
}
// load class and check if menu exist
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
dol_include_once ( $pathtofile );
2023-12-04 12:46:42 +00:00
$class = 'mod' . $module ;
2024-08-18 16:16:08 +00:00
$moduleobj = null ;
2023-02-09 10:40:43 +00:00
if ( class_exists ( $class )) {
try {
$moduleobj = new $class ( $db );
2024-11-11 13:48:18 +00:00
'@phan-var-force DolibarrModules $moduleobj' ;
2024-11-04 22:53:20 +00:00
/** @var DolibarrModules $moduleobj */
2023-02-09 10:40:43 +00:00
} catch ( Exception $e ) {
$error ++ ;
dol_print_error ( $db , $e -> getMessage ());
}
}
2023-05-23 15:37:52 +00:00
// get all objects and convert value to lower case for compare
$dir = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrootpath' ];
$destdir = $dir . '/' . strtolower ( $module );
$objects = dolGetListOfObjectClasses ( $destdir );
$result = array_map ( 'strtolower' , $objects );
2023-02-09 10:40:43 +00:00
$menus = $moduleobj -> menu ;
Fix: GETPOST(...,'int') to GETPOSTINT(...) (#28448)
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: Update spelling exceptions
* Qual: Ignore Phan Notice
2024-02-27 13:05:53 +00:00
$key = GETPOSTINT ( 'menukey' );
2023-02-09 10:40:43 +00:00
$moduledescriptorfile = $dirins . '/' . strtolower ( $module ) . '/core/modules/mod' . $module . '.class.php' ;
2023-09-05 13:43:23 +00:00
$checkcomment = checkExistComment ( $moduledescriptorfile , 0 );
if ( $checkcomment < 0 ) {
setEventMessages ( $langs -> trans ( " WarningCommentNotFound " , $langs -> trans ( " Menus " ), " mod " . $module . " class.php " ), null , 'warnings' );
} else {
if ( $menus [ $key ][ 'fk_menu' ] === 'fk_mainmenu=' . strtolower ( $module )) {
if ( in_array ( strtolower ( $menus [ $key ][ 'leftmenu' ]), $result )) {
reWriteAllMenus ( $moduledescriptorfile , $menus , $menus [ $key ][ 'leftmenu' ], $key , - 1 );
} else {
reWriteAllMenus ( $moduledescriptorfile , $menus , null , $key , 0 );
}
2023-05-23 15:37:52 +00:00
} else {
reWriteAllMenus ( $moduledescriptorfile , $menus , null , $key , 0 );
2023-02-09 10:40:43 +00:00
}
2023-09-05 13:43:23 +00:00
clearstatcache ( true );
if ( function_exists ( 'opcache_invalidate' )) {
opcache_reset (); // remove the include cache hell !
}
2023-05-23 15:37:52 +00:00
2023-09-05 13:43:23 +00:00
setEventMessages ( $langs -> trans ( 'MenuDeletedSuccessfuly' ), null );
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=menus&module=' . $module );
exit ;
}
2023-02-09 10:40:43 +00:00
}
2017-05-27 11:46:34 +00:00
2023-02-10 17:02:25 +00:00
// Add menu in module without initial object
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == 'addmenu' && empty ( $cancel ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2023-02-10 17:02:25 +00:00
// check if module is enabled
if ( isModEnabled ( strtolower ( $module ))) {
$result = unActivateModule ( strtolower ( $module ));
2024-09-05 14:05:37 +00:00
dolibarr_set_const ( $db , " MAIN_IHM_PARAMS_REV " , getDolGlobalInt ( 'MAIN_IHM_PARAMS_REV' ) + 1 , 'chaine' , 0 , '' , $conf -> entity );
2023-02-10 17:02:25 +00:00
if ( $result ) {
setEventMessages ( $result , null , 'errors' );
}
2023-10-13 13:42:15 +00:00
setEventMessages ( $langs -> trans ( 'WarningModuleNeedRefresh' , $langs -> transnoentities ( $module )), null , 'warnings' );
2023-10-29 15:44:41 +00:00
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=menus&module=' . $module );
exit ;
2023-02-10 17:02:25 +00:00
}
$error = 0 ;
// load class and check if right exist
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
dol_include_once ( $pathtofile );
2023-12-04 12:46:42 +00:00
$class = 'mod' . $module ;
2024-08-18 16:16:08 +00:00
$moduleobj = null ;
2023-02-10 17:02:25 +00:00
if ( class_exists ( $class )) {
try {
$moduleobj = new $class ( $db );
2024-11-11 13:48:18 +00:00
'@phan-var-force DolibarrModules $moduleobj' ;
2024-11-04 22:53:20 +00:00
/** @var DolibarrModules $moduleobj */
2023-02-10 17:02:25 +00:00
} catch ( Exception $e ) {
$error ++ ;
dol_print_error ( $db , $e -> getMessage ());
}
}
2023-05-23 15:37:52 +00:00
// get all menus
2023-02-10 17:02:25 +00:00
$menus = $moduleobj -> menu ;
2023-05-23 15:37:52 +00:00
2023-02-10 17:02:25 +00:00
//verify fields required
if ( ! GETPOST ( 'type' , 'alpha' )) {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Type " )), null , 'errors' );
}
if ( ! GETPOST ( 'titre' , 'alpha' )) {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Title " )), null , 'errors' );
}
if ( ! GETPOST ( 'user' , 'alpha' )) {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " DetailUser " )), null , 'errors' );
}
if ( ! GETPOST ( 'url' , 'alpha' )) {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Url " )), null , 'errors' );
}
if ( ! empty ( GETPOST ( 'target' ))) {
$targets = array ( '_blank' , '_self' , '_parent' , '_top' , '' );
if ( ! in_array ( GETPOST ( 'target' ), $targets )) {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorFieldValue " , $langs -> transnoentities ( " target " )), null , 'errors' );
}
}
2023-05-23 15:37:52 +00:00
2023-02-10 17:02:25 +00:00
// check if title or url already exist in menus
foreach ( $menus as $menu ) {
if ( ! empty ( GETPOST ( 'url' )) && GETPOST ( 'url' ) == $menu [ 'url' ]) {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorFieldExist " , $langs -> transnoentities ( " url " )), null , 'errors' );
break ;
}
if ( strtolower ( GETPOST ( 'titre' )) == strtolower ( $menu [ 'titre' ])) {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorFieldExist " , $langs -> transnoentities ( " titre " )), null , 'errors' );
break ;
}
}
if ( GETPOST ( 'type' , 'alpha' ) == 'left' && ! empty ( GETPOST ( 'lefmenu' , 'alpha' ))) {
if ( ! str_contains ( GETPOST ( 'leftmenu' ), strtolower ( $module ))) {
$error ++ ;
2024-04-04 13:15:04 +00:00
setEventMessages ( $langs -> trans ( " WarningFieldsMustContains " , $langs -> transnoentities ( " LeftmenuId " )), null , 'errors' );
2023-02-10 17:02:25 +00:00
}
}
2023-12-04 12:46:42 +00:00
$dirins = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrootpath' ];
$destdir = $dirins . '/' . strtolower ( $module );
$objects = dolGetListOfObjectClasses ( $destdir );
2023-02-10 17:02:25 +00:00
if ( GETPOST ( 'type' , 'alpha' ) == 'left' ) {
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
if ( empty ( GETPOST ( 'leftmenu' )) && count ( $objects ) > 0 ) {
2023-02-10 17:02:25 +00:00
$error ++ ;
2024-04-04 13:15:04 +00:00
setEventMessages ( $langs -> trans ( " ErrorCoherenceMenu " , $langs -> transnoentities ( " LeftmenuId " ), $langs -> transnoentities ( " type " )), null , 'errors' );
2023-02-10 17:02:25 +00:00
}
}
2023-06-05 14:15:52 +00:00
if ( GETPOST ( 'type' , 'alpha' ) == 'top' ) {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorTypeMenu " , $langs -> transnoentities ( " type " )), null , 'errors' );
}
2023-02-10 17:02:25 +00:00
2023-05-23 15:37:52 +00:00
$moduledescriptorfile = $dirins . '/' . strtolower ( $module ) . '/core/modules/mod' . $module . '.class.php' ;
2023-02-10 17:02:25 +00:00
if ( ! $error ) {
2023-05-23 15:37:52 +00:00
//stock forms in array
$menuToAdd = array (
'fk_menu' => GETPOST ( 'fk_menu' , 'alpha' ),
'type' => GETPOST ( 'type' , 'alpha' ),
'titre' => ucfirst ( GETPOST ( 'titre' , 'alpha' )),
'prefix' => '' ,
'mainmenu' => GETPOST ( 'mainmenu' , 'alpha' ),
'leftmenu' => GETPOST ( 'leftmenu' , 'alpha' ),
'url' => GETPOST ( 'url' , 'alpha' ),
'langs' => strtolower ( $module ) . " @ " . strtolower ( $module ),
'position' => '' ,
'enabled' => GETPOST ( 'enabled' , 'alpha' ),
2023-07-18 10:24:16 +00:00
'perms' => '$user->hasRight("' . strtolower ( $module ) . '", "' . GETPOST ( 'objects' , 'alpha' ) . '", "' . GETPOST ( 'perms' , 'alpha' ) . '")' ,
2023-05-23 15:37:52 +00:00
'target' => GETPOST ( 'target' , 'alpha' ),
2024-11-04 22:53:20 +00:00
'user' => GETPOSTINT ( 'user' ),
2023-05-23 15:37:52 +00:00
);
2023-10-29 15:44:41 +00:00
2023-05-23 15:37:52 +00:00
if ( GETPOST ( 'type' ) == 'left' ) {
unset ( $menuToAdd [ 'prefix' ]);
if ( empty ( GETPOST ( 'fk_menu' ))) {
2023-06-03 23:54:32 +00:00
$menuToAdd [ 'fk_menu' ] = 'fk_mainmenu=' . GETPOST ( 'mainmenu' , 'alpha' );
2023-02-10 17:02:25 +00:00
} else {
2023-05-23 15:37:52 +00:00
$menuToAdd [ 'fk_menu' ] = 'fk_mainmenu=' . GETPOST ( 'mainmenu' , 'alpha' ) . ',fk_leftmenu=' . GETPOST ( 'fk_menu' );
2023-02-10 17:02:25 +00:00
}
}
2023-05-23 15:37:52 +00:00
if ( GETPOST ( 'enabled' ) == '1' ) {
2023-10-29 13:54:27 +00:00
$menuToAdd [ 'enabled' ] = 'isModEnabled("' . strtolower ( $module ) . '")' ;
2023-05-23 15:37:52 +00:00
} else {
$menuToAdd [ 'enabled' ] = " 0 " ;
}
2023-07-19 09:57:13 +00:00
if ( empty ( GETPOST ( 'objects' ))) {
$menuToAdd [ 'perms' ] = '1' ;
}
2023-09-05 13:43:23 +00:00
$checkcomment = checkExistComment ( $moduledescriptorfile , 0 );
if ( $checkcomment < 0 ) {
setEventMessages ( $langs -> trans ( " WarningCommentNotFound " , $langs -> trans ( " Menus " ), " mod " . $module . " class.php " ), null , 'warnings' );
} else {
2023-10-29 15:44:41 +00:00
// Write all menus
$result = reWriteAllMenus ( $moduledescriptorfile , $menus , $menuToAdd , null , 1 );
2023-09-05 13:43:23 +00:00
clearstatcache ( true );
if ( function_exists ( 'opcache_invalidate' )) {
opcache_reset ();
}
2023-10-29 15:44:41 +00:00
/* if ( $result < 0 ) {
setEventMessages ( $langs -> trans ( 'ErrorMenuExistValue' ), null , 'errors' );
header ( " Location: " . $_SERVER [ " PHP_SELF " ] . '?action=editmenu&token=' . newToken () . '&menukey=' . urlencode ( $key + 1 ) . '&tab=' . urlencode ( $tab ) . '&module=' . urlencode ( $module ) . '&tabobj=' . ( $key + 1 ));
exit ;
} */
2023-09-05 13:43:23 +00:00
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=menus&module=' . $module );
setEventMessages ( $langs -> trans ( 'MenuAddedSuccesfuly' ), null );
exit ;
2023-05-23 15:37:52 +00:00
}
2023-02-10 17:02:25 +00:00
}
}
2023-10-29 15:44:41 +00:00
// Modify a menu entry
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == " update_menu " && GETPOSTINT ( 'menukey' ) && GETPOST ( 'tabobj' ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2023-07-17 16:31:00 +00:00
$objectname = GETPOST ( 'tabobj' );
$dirins = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrootpath' ];
$destdir = $dirins . '/' . strtolower ( $module );
$objects = dolGetListOfObjectClasses ( $destdir );
2023-05-23 15:37:52 +00:00
if ( empty ( $cancel )) {
if ( isModEnabled ( strtolower ( $module ))) {
$result = unActivateModule ( strtolower ( $module ));
2024-09-05 14:05:37 +00:00
dolibarr_set_const ( $db , " MAIN_IHM_PARAMS_REV " , getDolGlobalInt ( 'MAIN_IHM_PARAMS_REV' ) + 1 , 'chaine' , 0 , '' , $conf -> entity );
2023-05-23 15:37:52 +00:00
if ( $result ) {
setEventMessages ( $result , null , 'errors' );
}
2023-10-13 13:42:15 +00:00
setEventMessages ( $langs -> trans ( 'WarningModuleNeedRefresh' , $langs -> transnoentities ( $module )), null , 'warnings' );
2023-10-29 15:44:41 +00:00
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=menus&module=' . $module );
exit ;
2023-02-10 17:16:18 +00:00
}
2023-05-23 15:37:52 +00:00
$error = 0 ;
// for loading class and the menu wants to modify
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
dol_include_once ( $pathtofile );
$class = 'mod' . $module ;
2024-08-18 16:16:08 +00:00
$moduleobj = null ;
2023-05-23 15:37:52 +00:00
if ( class_exists ( $class )) {
try {
$moduleobj = new $class ( $db );
2024-11-11 13:48:18 +00:00
'@phan-var-force DolibarrModules $moduleobj' ;
2024-11-04 22:53:20 +00:00
/** @var DolibarrModules $moduleobj */
2023-05-23 15:37:52 +00:00
} catch ( Exception $e ) {
$error ++ ;
dol_print_error ( $db , $e -> getMessage ());
2023-02-10 17:16:18 +00:00
}
}
2023-05-23 15:37:52 +00:00
$menus = $moduleobj -> menu ;
Fix: GETPOST(...,'int') to GETPOSTINT(...) (#28448)
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: Update spelling exceptions
* Qual: Ignore Phan Notice
2024-02-27 13:05:53 +00:00
$key = GETPOSTINT ( 'menukey' ) - 1 ;
2023-02-10 17:16:18 +00:00
2023-05-23 15:37:52 +00:00
$moduledescriptorfile = $dirins . '/' . strtolower ( $module ) . '/core/modules/mod' . $module . '.class.php' ;
2023-12-04 12:46:42 +00:00
//stock forms in array
$menuModify = array (
2023-05-23 15:37:52 +00:00
'fk_menu' => GETPOST ( 'fk_menu' , 'alpha' ),
'type' => GETPOST ( 'type' , 'alpha' ),
'titre' => ucfirst ( GETPOST ( 'titre' , 'alpha' )),
2024-11-04 22:53:20 +00:00
'prefix' => '' ,
2023-05-23 15:37:52 +00:00
'mainmenu' => GETPOST ( 'mainmenu' , 'alpha' ),
'leftmenu' => $menus [ $key ][ 'leftmenu' ],
'url' => GETPOST ( 'url' , 'alpha' ),
'langs' => strtolower ( $module ) . " @ " . strtolower ( $module ),
'position' => '' ,
'enabled' => GETPOST ( 'enabled' , 'alpha' ),
2023-10-29 15:44:41 +00:00
'perms' => GETPOST ( 'perms' , 'alpha' ),
2023-05-23 15:37:52 +00:00
'target' => GETPOST ( 'target' , 'alpha' ),
2024-11-04 22:53:20 +00:00
'user' => GETPOSTINT ( 'user' ),
2023-05-23 15:37:52 +00:00
);
2023-12-04 12:46:42 +00:00
if ( ! empty ( GETPOST ( 'fk_menu' )) && GETPOST ( 'fk_menu' ) != $menus [ $key ][ 'fk_menu' ]) {
$menuModify [ 'fk_menu' ] = 'fk_mainmenu=' . GETPOST ( 'mainmenu' ) . ',fk_leftmenu=' . GETPOST ( 'fk_menu' );
} elseif ( GETPOST ( 'fk_menu' ) == $menus [ $key ][ 'fk_menu' ]) {
$menuModify [ 'fk_menu' ] = $menus [ $key ][ 'fk_menu' ];
} else {
$menuModify [ 'fk_menu' ] = 'fk_mainmenu=' . GETPOST ( 'mainmenu' );
}
if ( $menuModify [ 'enabled' ] === '' ) {
$menuModify [ 'enabled' ] = '1' ;
}
if ( $menuModify [ 'perms' ] === '' ) {
$menuModify [ 'perms' ] = '1' ;
}
2023-10-29 15:44:41 +00:00
2023-12-04 12:46:42 +00:00
if ( GETPOST ( 'type' , 'alpha' ) == 'top' ) {
$error ++ ;
setEventMessages ( $langs -> trans ( " ErrorTypeMenu " , $langs -> transnoentities ( " type " )), null , 'errors' );
}
2023-10-29 15:44:41 +00:00
2023-12-04 12:46:42 +00:00
if ( ! $error ) {
//update menu
$checkComment = checkExistComment ( $moduledescriptorfile , 0 );
2023-05-23 15:37:52 +00:00
2023-12-04 12:46:42 +00:00
if ( $checkComment < 0 ) {
setEventMessages ( $langs -> trans ( " WarningCommentNotFound " , $langs -> trans ( " Menus " ), " mod " . $module . " class.php " ), null , 'warnings' );
} else {
// Write all menus
$result = reWriteAllMenus ( $moduledescriptorfile , $menus , $menuModify , $key , 2 );
2023-10-29 15:44:41 +00:00
2023-12-04 12:46:42 +00:00
clearstatcache ( true );
if ( function_exists ( 'opcache_invalidate' )) {
opcache_reset ();
}
2023-10-29 15:44:41 +00:00
2023-12-04 12:46:42 +00:00
if ( $result < 0 ) {
setEventMessages ( $langs -> trans ( 'ErrorMenuExistValue' ), null , 'errors' );
//var_dump($_SESSION);exit;
2024-03-08 01:52:06 +00:00
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 ));
2023-05-23 15:37:52 +00:00
exit ;
}
2023-12-04 12:46:42 +00:00
setEventMessages ( $langs -> trans ( 'MenuUpdatedSuccessfuly' ), null );
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=menus&module=' . $module );
exit ;
2023-05-23 15:37:52 +00:00
}
2023-12-04 12:46:42 +00:00
}
2023-05-23 15:37:52 +00:00
} else {
2024-03-28 20:29:02 +00:00
$_POST [ 'type' ] = '' ; // TODO Use a var here and later
2023-05-23 15:37:52 +00:00
$_POST [ 'titre' ] = '' ;
$_POST [ 'fk_menu' ] = '' ;
$_POST [ 'leftmenu' ] = '' ;
$_POST [ 'url' ] = '' ;
2023-02-10 17:16:18 +00:00
}
}
2017-10-31 22:10:29 +00:00
2023-08-11 17:34:35 +00:00
// update properties description of module
2025-09-26 21:55:58 +00:00
if ( $dirins && $action == " update_props_module " && ! empty ( GETPOST ( 'keydescription' , 'alpha' )) && empty ( $cancel ) /* && $user->hasRight("modulebuilder", "run") // already checked */ ) {
2023-08-11 17:34:35 +00:00
if ( isModEnabled ( strtolower ( $module ))) {
$result = unActivateModule ( strtolower ( $module ));
2024-09-05 14:05:37 +00:00
dolibarr_set_const ( $db , " MAIN_IHM_PARAMS_REV " , getDolGlobalInt ( 'MAIN_IHM_PARAMS_REV' ) + 1 , 'chaine' , 0 , '' , $conf -> entity );
2023-08-11 17:34:35 +00:00
if ( $result ) {
setEventMessages ( $result , null , 'errors' );
}
2023-10-13 13:42:15 +00:00
setEventMessages ( $langs -> trans ( 'WarningModuleNeedRefresh' , $langs -> transnoentities ( $module )), null , 'warnings' );
2023-10-29 15:44:41 +00:00
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=menus&module=' . $module );
exit ;
2023-08-11 17:34:35 +00:00
}
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
$moduledescriptorfile = $dirins . '/' . strtolower ( $module ) . '/core/modules/mod' . $module . '.class.php' ;
$modulelogfile = $dirins . '/' . strtolower ( $module ) . '/ChangeLog.md' ;
dol_include_once ( $pathtofile );
2023-12-04 12:46:42 +00:00
$class = 'mod' . $module ;
2024-08-18 16:16:08 +00:00
$moduleobj = null ;
2023-08-11 17:34:35 +00:00
if ( class_exists ( $class )) {
try {
$moduleobj = new $class ( $db );
2024-11-11 13:48:18 +00:00
'@phan-var-force DolibarrModules $moduleobj' ;
2024-11-04 22:53:20 +00:00
/** @var DolibarrModules $moduleobj */
2023-08-11 17:34:35 +00:00
} catch ( Exception $e ) {
$error ++ ;
dol_print_error ( $db , $e -> getMessage ());
}
}
$keydescription = GETPOST ( 'keydescription' , 'alpha' );
switch ( $keydescription ) {
case 'desc' :
$propertyToUpdate = 'description' ;
break ;
case 'version' :
case 'family' :
2023-10-13 13:08:50 +00:00
case 'picto' :
2023-08-11 17:34:35 +00:00
case 'editor_name' :
case 'editor_url' :
2023-10-13 13:08:50 +00:00
$propertyToUpdate = $keydescription ;
2023-08-11 17:34:35 +00:00
break ;
default :
$error = GETPOST ( 'keydescription' );
break ;
}
if ( isset ( $propertyToUpdate ) && ! empty ( GETPOST ( 'propsmodule' ))) {
$newValue = GETPOST ( 'propsmodule' );
2025-11-12 14:03:31 +00:00
$patternToFindLine = '^\s*\$this->' . $propertyToUpdate . '\s*=' ; // Must be a regex string
$newLine = " \t \t \$ this-> $propertyToUpdate = ' $newValue '; \n " ; // Must a real string
2023-08-11 17:34:35 +00:00
2025-11-12 14:03:31 +00:00
$fileLines = file ( $moduledescriptorfile ); // Get each line of file into an array
$error = 0 ;
$changedone = 0 ;
2023-08-14 10:37:21 +00:00
foreach ( $fileLines as & $line ) {
2025-11-12 14:03:31 +00:00
if ( preg_match ( '/' . $patternToFindLine . '/' , $line )) {
$result = dolReplaceInFile ( $moduledescriptorfile , array ( $line => $newLine ));
if ( $result > 0 ) {
$changedone ++ ;
} elseif ( $result <= - 1 ) {
$langs -> load ( " errors " );
setEventMessages ( $langs -> trans ( 'ErrorFailToEditFile' , $moduledescriptorfile ), null , 'warnings' );
break ;
}
2023-08-14 10:37:21 +00:00
break ;
}
}
2023-08-11 17:34:35 +00:00
2025-11-12 14:03:31 +00:00
// To complete also the ChangeLogif we update the version
if ( $changedone && $propertyToUpdate === 'version' ) {
dolReplaceInFile ( $modulelogfile , array ( " ## " . $moduleobj -> $propertyToUpdate => $newValue ));
}
2023-08-11 17:34:35 +00:00
clearstatcache ( true );
if ( function_exists ( 'opcache_invalidate' )) {
opcache_reset ();
}
2025-11-12 14:03:31 +00:00
if ( $changedone ) {
setEventMessages ( $langs -> trans ( 'PropertyModuleUpdated' , $propertyToUpdate ), null );
} else {
setEventMessages ( $langs -> trans ( 'NothingProcessed' ), null , 'warnings' );
}
2023-08-11 17:34:35 +00:00
header ( " Location: " . DOL_URL_ROOT . '/modulebuilder/index.php?tab=description&module=' . $module );
exit ;
}
}
2024-09-05 16:27:46 +00:00
2017-03-29 19:36:50 +00:00
/*
* View
*/
2017-09-05 18:42:34 +00:00
$form = new Form ( $db );
2017-10-05 07:54:48 +00:00
$formadmin = new FormAdmin ( $db );
2017-09-05 18:42:34 +00:00
2017-06-10 21:50:02 +00:00
// Set dir where external modules are installed
2021-02-26 17:26:44 +00:00
if ( ! dol_is_dir ( $dirins )) {
2017-10-06 00:42:32 +00:00
dol_mkdir ( $dirins );
2017-06-10 21:50:02 +00:00
}
2019-11-13 18:37:08 +00:00
$dirins_ok = ( dol_is_dir ( $dirins ));
2017-06-10 21:50:02 +00:00
2021-02-16 10:15:42 +00:00
$help_url = '' ;
$morejs = array (
2019-09-28 11:50:32 +00:00
'/includes/ace/src/ace.js' ,
'/includes/ace/src/ext-statusbar.js' ,
'/includes/ace/src/ext-language_tools.js' ,
//'/includes/ace/src/ext-chromevox.js'
2021-02-16 10:15:42 +00:00
);
$morecss = array ();
llxHeader ( '' , $langs -> trans ( " ModuleBuilder " ), $help_url , '' , 0 , 0 , $morejs , $morecss , '' , 'classforhorizontalscrolloftabs' );
2017-03-29 19:36:50 +00:00
2020-01-30 00:48:28 +00:00
$text = $langs -> trans ( " ModuleBuilder " );
2017-03-29 19:36:50 +00:00
2025-11-07 17:24:15 +00:00
$morehtmlright = '<a href="' . DOL_URL_ROOT . '/admin/tools/ui/index.php" target="_blank" rel="noopener">' . img_picto ( '' , 'book' , 'class="pictofixedwidth"' ) . $langs -> trans ( " UxComponentsDoc " ) . '</a>' ;
print load_fiche_titre ( $text , $morehtmlright , 'title_setup' );
2017-03-29 19:36:50 +00:00
2026-04-05 18:56:00 +00:00
print '<div class="info hideonsmartphone">' ;
print $langs -> trans ( " ModuleBuilderDesc " , 'https://wiki.dolibarr.org/index.php/Module_development' ) . '</span>' ;
print '</div>' ;
2017-06-10 21:50:02 +00:00
2020-08-06 13:55:04 +00:00
2020-01-30 00:48:28 +00:00
$message = '' ;
2021-02-26 17:26:44 +00:00
if ( ! $dirins ) {
2020-01-30 00:48:28 +00:00
$message = info_admin ( $langs -> trans ( " ConfFileMustContainCustom " , DOL_DOCUMENT_ROOT . '/custom' , DOL_DOCUMENT_ROOT ));
$allowfromweb = - 1 ;
2020-05-21 07:35:30 +00:00
} else {
2021-02-26 17:26:44 +00:00
if ( $dirins_ok ) {
if ( ! is_writable ( dol_osencode ( $dirins ))) {
2017-10-06 00:42:32 +00:00
$langs -> load ( " errors " );
2020-01-30 00:48:28 +00:00
$message = info_admin ( $langs -> trans ( " ErrorFailedToWriteInDir " , $dirins ));
$allowfromweb = 0 ;
2017-10-06 00:42:32 +00:00
}
2020-05-21 07:35:30 +00:00
} else {
2020-01-30 00:48:28 +00:00
$message = info_admin ( $langs -> trans ( " NotExistsDirect " , $dirins ) . $langs -> trans ( " InfDirAlt " ) . $langs -> trans ( " InfDirExample " ));
$allowfromweb = 0 ;
2017-10-06 00:42:32 +00:00
}
2017-06-10 21:50:02 +00:00
}
2021-02-26 17:26:44 +00:00
if ( $message ) {
2017-10-06 00:42:32 +00:00
print $message ;
2017-06-10 21:50:02 +00:00
}
2017-09-23 23:36:20 +00:00
//print $langs->trans("ModuleBuilderDesc3", count($listofmodules), $FILEFLAG).'<br>';
2022-09-27 10:03:54 +00:00
$infomodulesfound = '<div style="padding: 12px 9px 12px">' . $form -> textwithpicto ( '' , $langs -> trans ( " ModuleBuilderDesc3 " , count ( $listofmodules )) . '<br><br>' . $langs -> trans ( " ModuleBuilderDesc4 " , $FILEFLAG ) . '<br>' . $textforlistofdirs ) . '</div>' ;
2017-05-28 12:43:17 +00:00
2022-11-16 21:36:08 +00:00
$dolibarrdataroot = preg_replace ( '/([\\/]+)$/i' , '' , DOL_DATA_ROOT );
$allowonlineinstall = true ;
if ( dol_is_file ( $dolibarrdataroot . '/installmodules.lock' )) {
$allowonlineinstall = false ;
}
if ( empty ( $allowonlineinstall )) {
if ( getDolGlobalString ( 'MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US' )) {
// Show clean message
$message = info_admin ( $langs -> trans ( 'InstallModuleFromWebHasBeenDisabledContactUs' ));
} else {
// Show technical message
2024-09-06 12:02:53 +00:00
$message = info_admin ( $langs -> trans ( " InstallModuleFromWebHasBeenDisabledByFile " , $dolibarrdataroot . '/installmodules.lock' ), 0 , 0 , '1' , 'warning' );
2022-11-16 21:36:08 +00:00
}
print $message ;
llxFooter ();
exit ( 0 );
}
2017-05-28 12:43:17 +00:00
// Load module descriptor
2019-11-13 18:37:08 +00:00
$error = 0 ;
2017-05-28 12:43:17 +00:00
$moduleobj = null ;
2020-05-29 13:29:47 +00:00
2021-02-26 17:26:44 +00:00
if ( ! empty ( $module ) && $module != 'initmodule' && $module != 'deletemodule' ) {
2019-11-13 18:37:08 +00:00
$modulelowercase = strtolower ( $module );
2020-05-29 13:29:47 +00:00
$loadclasserrormessage = '' ;
2017-06-10 21:50:02 +00:00
2026-05-10 23:26:15 +00:00
$class = null ;
2017-10-06 00:42:32 +00:00
// Load module
2020-05-29 13:29:47 +00:00
try {
$fullpathdirtodescriptor = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
//throw(new Exception());
dol_include_once ( $fullpathdirtodescriptor );
$class = 'mod' . $module ;
2023-05-01 12:33:08 +00:00
} catch ( Throwable $e ) { // This is called in PHP 7 only (includes Error and Exception)
2021-11-07 12:51:31 +00:00
$loadclasserrormessage = $e -> getMessage () . " <br> \n " ;
$loadclasserrormessage .= 'File: ' . $e -> getFile () . " <br> \n " ;
$loadclasserrormessage .= 'Line: ' . $e -> getLine () . " <br> \n " ;
2020-05-29 13:29:47 +00:00
}
2017-10-06 00:42:32 +00:00
2024-08-18 16:16:08 +00:00
$moduleobj = null ;
2021-02-26 17:26:44 +00:00
if ( class_exists ( $class )) {
2017-10-06 00:42:32 +00:00
try {
$moduleobj = new $class ( $db );
2024-11-11 13:48:18 +00:00
'@phan-var-force DolibarrModules $moduleobj' ;
2024-11-04 22:53:20 +00:00
/** @var DolibarrModules $moduleobj */
2020-10-28 16:56:26 +00:00
} catch ( Exception $e ) {
2017-10-06 00:42:32 +00:00
$error ++ ;
print $e -> getMessage ();
}
2020-05-21 07:35:30 +00:00
} else {
2021-02-26 17:26:44 +00:00
if ( empty ( $forceddirread )) {
$error ++ ;
}
2017-10-06 00:42:32 +00:00
$langs -> load ( " errors " );
2021-11-07 12:51:31 +00:00
print '<!-- ErrorFailedToLoadModuleDescriptorForXXX -->' ;
2017-10-06 00:42:32 +00:00
print img_warning ( '' ) . ' ' . $langs -> trans ( " ErrorFailedToLoadModuleDescriptorForXXX " , $module ) . '<br>' ;
2020-05-29 13:29:47 +00:00
print $loadclasserrormessage ;
2026-04-05 18:56:00 +00:00
print '<br>' ;
2017-10-06 00:42:32 +00:00
}
2017-05-28 12:43:17 +00:00
}
// Tabs for all modules
2017-05-08 21:55:46 +00:00
$head = array ();
2019-11-13 18:37:08 +00:00
$h = 0 ;
2017-05-08 21:55:46 +00:00
$head [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?module=initmodule' ;
2019-03-25 09:09:02 +00:00
$head [ $h ][ 1 ] = '<span class="valignmiddle text-plus-circle">' . $langs -> trans ( " NewModule " ) . '</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>' ;
2017-05-08 21:55:46 +00:00
$head [ $h ][ 2 ] = 'initmodule' ;
$h ++ ;
2017-06-10 21:50:02 +00:00
2020-04-03 13:36:41 +00:00
$linktoenabledisable = '' ;
2025-02-26 22:14:28 +00:00
if ( /* is_array($listofmodules) && */ count ( $listofmodules ) > 0 ) {
2021-04-06 16:18:07 +00:00
// Define $linktoenabledisable
2020-04-10 08:59:32 +00:00
$modulelowercase = strtolower ( $module );
2020-04-03 13:36:41 +00:00
2020-04-10 08:59:32 +00:00
$param = '' ;
2021-02-26 17:26:44 +00:00
if ( $module ) {
$param .= '&module=' . urlencode ( $module );
}
2025-02-05 21:59:37 +00:00
$param .= '&tab=' . urlencode ( $tab );
$param .= '&tabobj=' . urlencode ( $tabobj );
2020-04-03 13:36:41 +00:00
2020-04-10 08:59:32 +00:00
$urltomodulesetup = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?search_keyword=' . urlencode ( $module ) . '">' . $langs -> trans ( 'Home' ) . '-' . $langs -> trans ( " Setup " ) . '-' . $langs -> trans ( " Modules " ) . '</a>' ;
2022-09-27 10:03:54 +00:00
// Define $linktoenabledisable to show after module title
if ( isModEnabled ( $modulelowercase )) { // If module is already activated
$linktoenabledisable .= '<a class="reposition asetresetmodule valignmiddle" href="' . $_SERVER [ " PHP_SELF " ] . '?id=' . $moduleobj -> numero . '&action=reset&token=' . newToken () . '&value=mod' . $module . $param . '">' ;
2026-04-27 01:32:54 +00:00
$linktoenabledisable .= img_picto ( $langs -> trans ( " Warning " ) . ' : ' . $langs -> trans ( " ModuleIsLive " ), 'switch_on' , '' , 0 , 0 , 0 , '' , 'warning valignmiddle' , 1 );
2020-04-10 08:59:32 +00:00
$linktoenabledisable .= '</a>' ;
2020-04-03 13:36:41 +00:00
2026-04-27 01:32:54 +00:00
//$linktoenabledisable .= $form->textwithpicto('', $langs->trans("Warning").' : '.$langs->trans("ModuleIsLive"), -1, 'warning');
2021-04-06 16:18:07 +00:00
2020-04-03 13:36:41 +00:00
$objMod = $moduleobj ;
$backtourlparam = '' ;
$backtourlparam .= ( $backtourlparam ? '&' : '?' ) . 'module=' . $module ; // No urlencode here, done later
2025-02-05 21:59:37 +00:00
$backtourlparam .= ( $backtourlparam ? '&' : '?' ) . 'tab=' . $tab ; // No urlencode here, done later
2020-04-03 13:36:41 +00:00
$backtourl = $_SERVER [ " PHP_SELF " ] . $backtourlparam ;
$regs = array ();
2021-02-26 17:26:44 +00:00
if ( is_array ( $objMod -> config_page_url )) {
2020-04-03 13:36:41 +00:00
$i = 0 ;
2021-02-26 17:26:44 +00:00
foreach ( $objMod -> config_page_url as $page ) {
2020-04-03 13:36:41 +00:00
$urlpage = $page ;
2021-02-12 07:49:29 +00:00
if ( $i ++ ) {
2026-04-27 01:32:54 +00:00
$linktoenabledisable .= ' <a class="valignmiddle" href="' . $urlpage . '" title="' . $langs -> trans ( $page ) . '">' . img_picto ( ucfirst ( $page ), " setup " ) . '</a>' ;
2023-12-13 11:46:23 +00:00
// print '<a href="'.$page.'">'.ucfirst($page).'</a> ';
2020-05-21 07:35:30 +00:00
} else {
2021-02-26 17:26:44 +00:00
if ( preg_match ( '/^([^@]+)@([^@]+)$/i' , $urlpage , $regs )) {
2020-04-03 13:36:41 +00:00
$urltouse = dol_buildpath ( '/' . $regs [ 2 ] . '/admin/' . $regs [ 1 ], 1 );
2026-04-27 01:32:54 +00:00
$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>' ;
2020-05-21 07:35:30 +00:00
} else {
2021-02-12 07:49:29 +00:00
// Case standard admin page (not a page provided by the
// module but a page provided by dolibarr)
2021-02-11 17:31:25 +00:00
$urltouse = DOL_URL_ROOT . '/admin/' . $urlpage ;
2026-04-27 01:32:54 +00:00
$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>' ;
2020-04-03 13:36:41 +00:00
}
}
}
2020-05-21 07:35:30 +00:00
} elseif ( preg_match ( '/^([^@]+)@([^@]+)$/i' , $objMod -> config_page_url , $regs )) {
2026-04-27 01:32:54 +00:00
$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>' ;
2020-04-03 13:36:41 +00:00
}
2020-05-21 07:35:30 +00:00
} else {
2024-08-18 16:16:08 +00:00
if ( is_object ( $moduleobj )) {
2021-10-23 14:12:44 +00:00
$linktoenabledisable .= '<a class="reposition asetresetmodule valignmiddle" href="' . $_SERVER [ " PHP_SELF " ] . '?id=' . $moduleobj -> numero . '&action=set&token=' . newToken () . '&value=mod' . $module . $param . '">' ;
2026-04-27 01:32:54 +00:00
$linktoenabledisable .= img_picto ( $langs -> trans ( " ModuleIsNotActive " , $urltomodulesetup ), 'switch_off' , 'style="padding-right: 8px"' , 0 , 0 , 0 , '' , 'classfortooltip valignmiddle' , 1 );
2021-10-23 14:12:44 +00:00
$linktoenabledisable .= " </a> \n " ;
}
2020-04-03 13:36:41 +00:00
}
// Loop to show tab of each module
2021-02-26 17:26:44 +00:00
foreach ( $listofmodules as $tmpmodule => $tmpmodulearray ) {
2020-04-03 13:36:41 +00:00
$head [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?module=' . $tmpmodulearray [ 'modulenamewithcase' ] . ( $forceddirread ? '@' . $dirread : '' );
$head [ $h ][ 1 ] = $tmpmodulearray [ 'modulenamewithcase' ];
$head [ $h ][ 2 ] = $tmpmodulearray [ 'modulenamewithcase' ];
2021-04-06 16:18:07 +00:00
if ( $tmpmodulearray [ 'modulenamewithcase' ] == $module ) {
2026-04-27 01:32:54 +00:00
$head [ $h ][ 4 ] = '<span class="inline-block valignmiddle">' . $linktoenabledisable . '</span>' ;
2021-04-06 16:18:07 +00:00
}
2020-04-03 13:36:41 +00:00
$h ++ ;
}
2017-05-08 19:00:23 +00:00
}
2017-05-08 21:55:46 +00:00
2017-06-18 10:30:18 +00:00
$head [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?module=deletemodule' ;
2022-09-27 10:03:54 +00:00
$head [ $h ][ 1 ] = img_picto ( '' , 'delete' , 'class="pictofixedwidth"' ) . $langs -> trans ( " DangerZone " );
2017-06-18 10:30:18 +00:00
$head [ $h ][ 2 ] = 'deletemodule' ;
$h ++ ;
2017-05-08 21:55:46 +00:00
2021-04-06 16:18:07 +00:00
2020-10-22 20:50:03 +00:00
print dol_get_fiche_head ( $head , $module , '' , - 1 , '' , 0 , $infomodulesfound , '' , 8 ); // Modules
2017-05-08 21:55:46 +00:00
2021-02-26 17:26:44 +00:00
if ( $module == 'initmodule' ) {
2017-10-06 00:42:32 +00:00
// New module
2025-03-29 12:32:59 +00:00
print '<!-- section init module -->' . " \n " ;
2017-10-06 00:42:32 +00:00
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="action" value="initmodule">' ;
print '<input type="hidden" name="module" value="initmodule">' ;
2017-06-10 21:50:02 +00:00
2022-07-06 05:56:42 +00:00
//print '<span class="opacitymedium">'.$langs->trans("ModuleBuilderDesc2", 'conf/conf.php', $newdircustom).'</span><br>';
2019-03-17 01:46:28 +00:00
print '<br>' ;
2017-06-10 21:50:02 +00:00
2025-12-24 02:45:45 +00:00
print '<div class="tagtable table-border">' ;
2022-07-06 03:50:53 +00:00
2023-08-12 11:31:08 +00:00
print '<div class="tagtr"><div class="tagtd paddingright">' ;
2022-09-07 13:50:40 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " IdModule " ) . '</span>' ;
print '</div><div class="tagtd">' ;
2026-01-04 18:12:07 +00:00
print '<input type="number" min="100000" name="idmodule" class="width100" value="500000">' ;
2025-03-29 12:32:59 +00:00
print '<span class="opacitymedium small">' ;
print ' ' ;
print dolButtonToOpenUrlInDialogPopup ( 'popup_modules_id' , $langs -> transnoentitiesnoconv ( " SeeIDsInUse " ), $langs -> transnoentitiesnoconv ( " SeeIDsInUse " ), '/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info&hidetitle=1' , '' , '' );
2022-08-23 10:25:44 +00:00
print ' - ' ;
print '<a href="https://wiki.dolibarr.org/index.php/List_of_modules_id" target="_blank" rel="noopener noreferrer external">' . $langs -> trans ( " SeeReservedIDsRangeHere " ) . '</a>' ;
2022-07-06 13:30:36 +00:00
print '</span>' ;
2022-09-07 13:50:40 +00:00
print '</div></div>' ;
2023-08-12 11:31:08 +00:00
print '<div class="tagtr"><div class="tagtd paddingright">' ;
print '<span class="opacitymedium fieldrequired">' . $langs -> trans ( " ModuleName " ) . '</span>' ;
2022-09-07 13:50:40 +00:00
print '</div><div class="tagtd">' ;
print '<input type="text" name="modulename" value="' . dol_escape_htmltag ( $modulename ) . '" autofocus>' ;
print ' ' . $form -> textwithpicto ( '' , $langs -> trans ( " EnterNameOfModuleDesc " ));
print '</div></div>' ;
2023-08-12 11:31:08 +00:00
print '<div class="tagtr"><div class="tagtd paddingright">' ;
2022-09-07 13:50:40 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " Description " ) . '</span>' ;
print '</div><div class="tagtd">' ;
print '<input type="text" name="description" value="" class="minwidth500"><br>' ;
print '</div></div>' ;
2023-08-12 11:31:08 +00:00
print '<div class="tagtr"><div class="tagtd paddingright">' ;
2022-09-07 13:50:40 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " Version " ) . '</span>' ;
print '</div><div class="tagtd">' ;
2022-10-12 12:06:30 +00:00
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 " )) . '">' ;
2022-09-07 13:50:40 +00:00
print '</div></div>' ;
2023-08-12 11:31:08 +00:00
print '<div class="tagtr"><div class="tagtd paddingright">' ;
2022-09-07 13:50:40 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " Family " ) . '</span>' ;
print '</div><div class="tagtd">' ;
2022-07-06 13:30:36 +00:00
print '<select name="family" id="family" class="minwidth400">' ;
2022-10-12 12:06:30 +00:00
$arrayoffamilies = array (
'hr' => " ModuleFamilyHr " ,
'crm' => " ModuleFamilyCrm " ,
'srm' => " ModuleFamilySrm " ,
'financial' => 'ModuleFamilyFinancial' ,
'products' => 'ModuleFamilyProducts' ,
'projects' => 'ModuleFamilyProjects' ,
'ecm' => 'ModuleFamilyECM' ,
'technic' => 'ModuleFamilyTechnic' ,
'portal' => 'ModuleFamilyPortal' ,
'interface' => 'ModuleFamilyInterface' ,
'base' => 'ModuleFamilyBase' ,
'other' => 'ModuleFamilyOther'
);
foreach ( $arrayoffamilies as $key => $value ) {
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>' ;
}
2022-09-07 13:50:40 +00:00
print '</select>' ;
2022-07-06 13:30:36 +00:00
print ajax_combobox ( " family " );
2022-09-07 13:50:40 +00:00
print '</div></div>' ;
2023-08-12 11:31:08 +00:00
print '<div class="tagtr"><div class="tagtd paddingright">' ;
2022-09-07 13:50:40 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " Picto " ) . '</span>' ;
print '</div><div class="tagtd">' ;
2024-10-28 10:42:35 +00:00
print '<input type="text" name="idpicto" value="' . ( GETPOSTISSET ( 'idpicto' ) ? GETPOST ( 'idpicto' ) : getDolGlobalString ( 'MODULEBUILDER_DEFAULTPICTO' , 'fa-file' )) . '" placeholder="' . dol_escape_htmltag ( $langs -> trans ( " Picto " )) . '">' ;
print $form -> textwithpicto ( '' , $langs -> trans ( " Example " ) . ': fa-file, fa-globe, ... any font awesome code.<br>Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]' );
2025-03-29 12:32:59 +00:00
print ' ' ;
2025-11-12 14:03:31 +00:00
print '<span class="opacitymedium small">' ;
2025-06-14 13:06:01 +00:00
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' , '' , '' );
2025-03-29 12:32:59 +00:00
print '</span>' ;
2022-09-07 13:50:40 +00:00
print '</div></div>' ;
2022-07-06 13:30:36 +00:00
2023-08-12 11:31:08 +00:00
print '<div class="tagtr"><div class="tagtd paddingright">' ;
2022-09-07 13:50:40 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " EditorName " ) . '</span>' ;
print '</div><div class="tagtd">' ;
2026-05-06 15:35:58 +00:00
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>' ;
2022-09-07 13:50:40 +00:00
print '</div></div>' ;
2023-08-12 11:31:08 +00:00
print '<div class="tagtr"><div class="tagtd paddingright">' ;
2022-09-07 13:50:40 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " EditorUrl " ) . '</span>' ;
print '</div><div class="tagtd">' ;
2026-05-06 15:35:58 +00:00
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>' ;
2022-09-07 13:50:40 +00:00
print '</div></div>' ;
2019-03-10 18:33:28 +00:00
2025-07-29 11:36:33 +00:00
print '</div>' ; // End div tagtable
print '<br><center>' ;
print '<input type="submit" class="button" name="create" value="' . dol_escape_htmltag ( $langs -> trans ( " Create " )) . '"' . ( $dirins ? '' : ' disabled="disabled"' ) . '>' ;
print '</center>' ;
2017-10-06 00:42:32 +00:00
print '</form>' ;
2020-05-21 07:35:30 +00:00
} elseif ( $module == 'deletemodule' ) {
2019-11-01 14:53:57 +00:00
print '<!-- Form to init a module -->' . " \n " ;
2019-03-11 14:58:37 +00:00
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST" name="delete">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2019-11-01 14:53:57 +00:00
print '<input type="hidden" name="action" value="confirm_deletemodule">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="module" value="deletemodule">' ;
2017-06-18 10:30:18 +00:00
2017-10-06 00:42:32 +00:00
print $langs -> trans ( " EnterNameOfModuleToDeleteDesc " ) . '<br><br>' ;
2017-06-18 10:30:18 +00:00
2024-04-18 00:21:42 +00:00
print '<input type="text" name="module" placeholder="' . dol_escape_htmltag ( $langs -> trans ( " ModuleKey " )) . '" value="" autofocus>' ;
2020-12-27 15:53:15 +00:00
print '<input type="submit" class="button smallpaddingimp" value="' . $langs -> trans ( " Delete " ) . '"' . ( $dirins ? '' : ' disabled="disabled"' ) . '>' ;
2017-10-06 00:42:32 +00:00
print '</form>' ;
2025-02-05 21:59:37 +00:00
} elseif ( ! empty ( $module ) && $modulelowercase !== null ) {
2017-08-02 21:50:17 +00:00
// Tabs for module
2021-02-26 17:26:44 +00:00
if ( ! $error ) {
2020-04-05 00:44:59 +00:00
$dirread = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrootpath' ];
2023-09-05 16:50:04 +00:00
$destdir = $dirread . '/' . strtolower ( $module );
$objects = dolGetListOfObjectClasses ( $destdir );
$diroflang = dol_buildpath ( $modulelowercase , 0 ) . " /langs " ;
$countLangs = countItemsInDirectory ( $diroflang , 2 );
2023-09-08 10:11:52 +00:00
$countDictionaries = ( ! empty ( $moduleobj -> dictionaries ) ? count ( $moduleobj -> dictionaries [ 'tabname' ]) : 0 );
2023-09-05 16:50:04 +00:00
$countRights = count ( $moduleobj -> rights );
$countMenus = count ( $moduleobj -> menu );
$countTriggers = countItemsInDirectory ( dol_buildpath ( $modulelowercase , 0 ) . " /core/triggers " );
$countWidgets = countItemsInDirectory ( dol_buildpath ( $modulelowercase , 0 ) . " /core/boxes " );
2024-01-11 01:47:42 +00:00
$countEmailingSelectors = countItemsInDirectory ( dol_buildpath ( $modulelowercase , 0 ) . " /core/modules/mailings " );
2023-09-05 16:50:04 +00:00
$countCss = countItemsInDirectory ( dol_buildpath ( $modulelowercase , 0 ) . " /css " );
$countJs = countItemsInDirectory ( dol_buildpath ( $modulelowercase , 0 ) . " /js " );
$countCLI = countItemsInDirectory ( dol_buildpath ( $modulelowercase , 0 ) . " /scripts " );
$hasDoc = countItemsInDirectory ( dol_buildpath ( $modulelowercase , 0 ) . " /doc " );
2023-09-08 10:11:52 +00:00
//var_dump($moduleobj->dictionaries);exit;
2020-04-03 16:07:24 +00:00
$head2 = array ();
$h = 0 ;
2020-01-30 00:48:28 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=description&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
2017-10-06 00:42:32 +00:00
$head2 [ $h ][ 1 ] = $langs -> trans ( " Description " );
$head2 [ $h ][ 2 ] = 'description' ;
$h ++ ;
2022-03-11 09:32:06 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=objects&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
2023-10-13 14:38:51 +00:00
$head2 [ $h ][ 1 ] = (( ! is_array ( $objects ) || count ( $objects ) <= 0 ) ? $langs -> trans ( " Objects " ) : $langs -> trans ( " Objects " ) . '<span class="marginleftonlyshort badge">' . count ( $objects ) . " </span> " );
2022-03-11 09:32:06 +00:00
$head2 [ $h ][ 2 ] = 'objects' ;
$h ++ ;
2020-01-30 00:48:28 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=languages&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
2023-10-13 14:38:51 +00:00
$head2 [ $h ][ 1 ] = ( $countLangs <= 0 ? $langs -> trans ( " Languages " ) : $langs -> trans ( " Languages " ) . '<span class="marginleftonlyshort badge">' . $countLangs . " </span> " );
2017-10-06 00:42:32 +00:00
$head2 [ $h ][ 2 ] = 'languages' ;
$h ++ ;
2020-01-30 00:48:28 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=permissions&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
2023-10-13 14:38:51 +00:00
$head2 [ $h ][ 1 ] = ( $countRights <= 0 ? $langs -> trans ( " Permissions " ) : $langs -> trans ( " Permissions " ) . '<span class="marginleftonlyshort badge">' . $countRights . " </span> " );
2017-10-06 00:42:32 +00:00
$head2 [ $h ][ 2 ] = 'permissions' ;
$h ++ ;
2025-08-05 00:44:52 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=dictionaries&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
$head2 [ $h ][ 1 ] = ( $countDictionaries == 0 ? $langs -> trans ( " Dictionaries " ) : $langs -> trans ( 'Dictionaries' ) . '<span class="marginleftonlyshort badge">' . $countDictionaries . " </span> " );
$head2 [ $h ][ 2 ] = 'dictionaries' ;
$h ++ ;
2022-04-12 09:11:26 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=tabs&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
$head2 [ $h ][ 1 ] = $langs -> trans ( " Tabs " );
$head2 [ $h ][ 2 ] = 'tabs' ;
$h ++ ;
2020-04-03 16:07:24 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=menus&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
2023-10-13 14:38:51 +00:00
$head2 [ $h ][ 1 ] = ( $countMenus <= 0 ? $langs -> trans ( " Menus " ) : $langs -> trans ( " Menus " ) . '<span class="marginleftonlyshort badge">' . $countMenus . " </span> " );
2020-04-03 12:56:15 +00:00
$head2 [ $h ][ 2 ] = 'menus' ;
$h ++ ;
2020-01-30 00:48:28 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=hooks&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
2017-10-06 00:42:32 +00:00
$head2 [ $h ][ 1 ] = $langs -> trans ( " Hooks " );
$head2 [ $h ][ 2 ] = 'hooks' ;
$h ++ ;
2020-01-30 00:48:28 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=triggers&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
2023-10-13 14:38:51 +00:00
$head2 [ $h ][ 1 ] = ( $countTriggers <= 0 ? $langs -> trans ( " Triggers " ) : $langs -> trans ( " Triggers " ) . '<span class="marginleftonlyshort badge">' . $countTriggers . " </span> " );
2017-10-06 00:42:32 +00:00
$head2 [ $h ][ 2 ] = 'triggers' ;
$h ++ ;
2020-01-30 00:48:28 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=widgets&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
2023-10-13 14:38:51 +00:00
$head2 [ $h ][ 1 ] = ( $countWidgets <= 0 ? $langs -> trans ( " Widgets " ) : $langs -> trans ( " Widgets " ) . '<span class="marginleftonlyshort badge">' . $countWidgets . " </span> " );
2017-10-06 00:42:32 +00:00
$head2 [ $h ][ 2 ] = 'widgets' ;
$h ++ ;
2024-01-10 13:52:12 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=emailings&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
$head2 [ $h ][ 1 ] = ( $countEmailingSelectors <= 0 ? $langs -> trans ( " EmailingSelectors " ) : $langs -> trans ( " EmailingSelectors " ) . '<span class="marginleftonlyshort badge">' . $countEmailingSelectors . " </span> " );
$head2 [ $h ][ 2 ] = 'emailings' ;
$h ++ ;
2021-04-06 16:51:43 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=exportimport&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
2026-05-06 19:21:24 +00:00
$head2 [ $h ][ 1 ] = $langs -> trans ( " ImportExportProfiles " );
2021-04-06 16:51:43 +00:00
$head2 [ $h ][ 2 ] = 'exportimport' ;
$h ++ ;
2020-01-30 00:48:28 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=css&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
2023-09-05 16:50:04 +00:00
$head2 [ $h ][ 1 ] = ( $countCss <= 0 ? $langs -> trans ( " CSS " ) : $langs -> trans ( " CSS " ) . " ( " . $countCss . " ) " );
2019-10-24 09:41:36 +00:00
$head2 [ $h ][ 2 ] = 'css' ;
$h ++ ;
2020-01-30 00:48:28 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=js&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
2023-10-13 14:38:51 +00:00
$head2 [ $h ][ 1 ] = ( $countJs <= 0 ? $langs -> trans ( " JS " ) : $langs -> trans ( " JS " ) . '<span class="marginleftonlyshort badge">' . $countJs . " </span> " );
2019-10-24 09:41:36 +00:00
$head2 [ $h ][ 2 ] = 'js' ;
$h ++ ;
2020-01-30 00:48:28 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=cli&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
2023-10-13 14:38:51 +00:00
$head2 [ $h ][ 1 ] = ( $countCLI <= 0 ? $langs -> trans ( " CLI " ) : $langs -> trans ( " CLI " ) . '<span class="marginleftonlyshort badge">' . $countCLI . " </span> " );
2019-03-10 18:33:28 +00:00
$head2 [ $h ][ 2 ] = 'cli' ;
$h ++ ;
2020-01-30 00:48:28 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=cron&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
2017-10-06 00:42:32 +00:00
$head2 [ $h ][ 1 ] = $langs -> trans ( " CronList " );
$head2 [ $h ][ 2 ] = 'cron' ;
$h ++ ;
2020-01-30 00:48:28 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=specifications&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
2025-08-05 01:04:22 +00:00
$head2 [ $h ][ 1 ] = ( $hasDoc <= 0 ? $langs -> trans ( " Documentation " ) : $langs -> trans ( " Documentation " ) . '<span class="marginleftonlyshort badge">' . $hasDoc . " </span> " );
2019-02-09 13:12:36 +00:00
$head2 [ $h ][ 2 ] = 'specifications' ;
$h ++ ;
2020-01-30 00:48:28 +00:00
$head2 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=buildpackage&module=' . $module . ( $forceddirread ? '@' . $dirread : '' );
2017-10-06 00:42:32 +00:00
$head2 [ $h ][ 1 ] = $langs -> trans ( " BuildPackage " );
$head2 [ $h ][ 2 ] = 'buildpackage' ;
$h ++ ;
2025-08-05 00:44:52 +00:00
$MAXTABFOROBJECT = 12 ;
2022-09-27 11:37:38 +00:00
2021-04-06 16:51:43 +00:00
print '<!-- Section for a given module -->' ;
2017-10-06 00:42:32 +00:00
2020-08-06 13:55:04 +00:00
// Note module is inside $dirread
2021-02-26 17:26:44 +00:00
if ( $tab == 'description' ) {
2022-04-12 13:51:46 +00:00
print '<!-- tab=description -->' . " \n " ;
2018-10-31 14:04:01 +00:00
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
2017-10-06 00:42:32 +00:00
$pathtofilereadme = $modulelowercase . '/README.md' ;
$pathtochangelog = $modulelowercase . '/ChangeLog.md' ;
2026-04-10 09:28:27 +00:00
$pathtoindex = $modulelowercase . '/' . $modulelowercase . 'index.php' ;
2017-08-05 08:35:12 +00:00
2023-10-29 16:53:16 +00:00
$realpathofmodule = realpath ( $dirread . '/' . $modulelowercase );
2021-02-26 17:26:44 +00:00
if ( $action != 'editfile' || empty ( $file )) {
2023-03-07 15:46:42 +00:00
$morehtmlright = '' ;
2023-10-29 16:53:16 +00:00
if ( $realpathofmodule != $dirread . '/' . $modulelowercase ) {
$morehtmlright = '<div style="padding: 12px 9px 12px">' . $form -> textwithpicto ( '' , '<span class="opacitymedium">' . $langs -> trans ( " RealPathOfModule " ) . ' :</span> <strong class="wordbreak">' . $realpathofmodule . '</strong>' ) . '</div>' ;
2019-11-01 14:53:57 +00:00
}
2023-03-07 15:46:42 +00:00
print dol_get_fiche_head ( $head2 , $tab , '' , - 1 , '' , 0 , $morehtmlright , '' , $MAXTABFOROBJECT , 'formodulesuffix' ); // Description - level 2
print '<span class="opacitymedium">' . $langs -> trans ( " ModuleBuilderDesc " . $tab ) . '</span>' ;
print '<br><br>' ;
2017-08-05 08:35:12 +00:00
2019-03-10 18:33:28 +00:00
print '<table>' ;
print '<tr><td>' ;
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " DescriptorFile " ) . ' : <strong class="wordbreak">' . $pathtofile . '</strong>' ;
2024-05-01 16:04:18 +00:00
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>' ;
2019-03-10 18:33:28 +00:00
print '</td></tr>' ;
2017-07-18 12:20:37 +00:00
2026-04-10 09:28:27 +00:00
print '<tr><td><span class="fa fa-file"></span> ' . $langs -> trans ( " Index " ) . ' : <strong class="wordbreak">' . $pathtoindex . '</strong>' ;
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>' ;
print '</td></tr>' ;
2023-10-29 16:53:16 +00:00
// List of setup pages
$listofsetuppages = dol_dir_list ( $realpathofmodule . '/admin' , 'files' , 0 , '\.php$' );
foreach ( $listofsetuppages as $setuppage ) {
2026-05-06 15:35:58 +00:00
// If this is a page for extrafields setup of an object
$reg = array ();
if ( preg_match ( '/^([a-z]+)_extrafields.php/' , $setuppage [ 'relativename' ], $reg )) {
// Check that object has $isextrafieldmanaged property set. If not, we should not show this file.
$fileofclass = $realpathofmodule . '/class/' . $reg [ 1 ] . '.class.php' ;
if ( is_readable ( $fileofclass ) && ! preg_match ( '/public\s+\$isextrafieldmanaged\s+=\s+1/' , file_get_contents ( $fileofclass ))) {
continue ;
}
}
2023-10-29 16:53:16 +00:00
//var_dump($setuppage);
print '<tr><td>' ;
2024-11-08 14:43:38 +00:00
print '<span class="fa fa-file"></span> ' ;
2024-11-08 14:59:16 +00:00
if ( $setuppage [ 'relativename' ] == 'about.php' ) {
2024-11-08 14:43:38 +00:00
print $langs -> trans ( " AboutFile " );
} else {
print $langs -> trans ( " SetupFile " );
}
print ' : ' ;
2024-01-12 12:05:14 +00:00
print '<strong class="wordbreak bold"><a href="' . dol_buildpath ( $modulelowercase . '/admin/' . $setuppage [ 'relativename' ], 1 ) . '" target="_test">' . $modulelowercase . '/admin/' . $setuppage [ 'relativename' ] . '</a></strong>' ;
2023-10-29 16:53:16 +00:00
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>' ;
print '</td></tr>' ;
}
2024-10-28 10:42:35 +00:00
print '<tr><td><span class="fa fa-file"></span> ' . $langs -> trans ( " ReadmeFile " ) . ' : <strong class="wordbreak">' . $pathtofilereadme . '</strong>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2019-03-10 18:33:28 +00:00
print '</td></tr>' ;
2017-07-08 14:52:10 +00:00
2024-10-28 10:42:35 +00:00
print '<tr><td><span class="fa fa-file"></span> ' . $langs -> trans ( " ChangeLog " ) . ' : <strong class="wordbreak">' . $pathtochangelog . '</strong>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2019-03-10 18:33:28 +00:00
print '</td></tr>' ;
2017-07-08 14:52:10 +00:00
2019-03-10 18:33:28 +00:00
print '</table>' ;
2017-10-06 00:42:32 +00:00
print '<br>' ;
2022-09-07 13:50:40 +00:00
print load_fiche_titre ( $form -> textwithpicto ( $langs -> trans ( " DescriptorFile " ), $langs -> transnoentitiesnoconv ( " File " ) . ' ' . $pathtofile ), '' , '' );
2017-10-06 00:42:32 +00:00
2024-08-18 16:16:08 +00:00
if ( is_object ( $moduleobj )) {
2017-10-06 00:42:32 +00:00
print '<div class="underbanner clearboth"></div>' ;
print '<div class="fichecenter">' ;
2023-08-11 17:34:35 +00:00
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="action" value="update_props_module">' ;
print '<input type="hidden" name="module" value="' . dol_escape_htmltag ( $module ) . '">' ;
print '<input type="hidden" name="tab" value="' . dol_escape_htmltag ( $tab ) . '">' ;
print '<input type="hidden" name="keydescription" value="' . dol_escape_htmltag ( GETPOST ( 'keydescription' , 'alpha' )) . '">' ;
2025-06-12 22:12:21 +00:00
print '<div class="div-table-responsive-no-min">' ;
2017-10-06 00:42:32 +00:00
print '<table class="border centpercent">' ;
print '<tr class="liste_titre"><td class="titlefield">' ;
print $langs -> trans ( " Parameter " );
print '</td><td>' ;
print $langs -> trans ( " Value " );
print '</td></tr>' ;
print '<tr><td>' ;
2022-09-07 13:50:40 +00:00
print $langs -> trans ( " IdModule " );
2017-10-06 00:42:32 +00:00
print '</td><td>' ;
print $moduleobj -> numero ;
2022-07-06 13:30:36 +00:00
print '<span class="opacitymedium">' ;
2023-03-07 14:51:27 +00:00
print ' (' ;
print dolButtonToOpenUrlInDialogPopup ( 'popup_modules_id' , $langs -> transnoentitiesnoconv ( " SeeIDsInUse " ), $langs -> transnoentitiesnoconv ( " SeeIDsInUse " ), '/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info' , '' , '' );
2021-11-22 01:35:55 +00:00
print ' - <a href="https://wiki.dolibarr.org/index.php/List_of_modules_id" target="_blank" rel="noopener noreferrer external">' . $langs -> trans ( " SeeReservedIDsRangeHere " ) . '</a>)' ;
2022-07-06 13:30:36 +00:00
print '</span>' ;
2017-10-06 00:42:32 +00:00
print '</td></tr>' ;
print '<tr><td>' ;
2022-09-07 13:50:40 +00:00
print $langs -> trans ( " ModuleName " );
2017-10-06 00:42:32 +00:00
print '</td><td>' ;
print $moduleobj -> getName ();
print '</td></tr>' ;
2022-09-07 13:50:40 +00:00
print '<tr><td>' ;
print $langs -> trans ( " Description " );
print '</td><td>' ;
2023-08-11 17:34:35 +00:00
if ( $action == 'edit_moduledescription' && GETPOST ( 'keydescription' , 'alpha' ) === 'desc' ) {
2026-05-06 15:38:27 +00:00
print '<input class="minwidth500" name="propsmodule" value="' . dol_escape_htmltag ( $moduleobj -> description ) . '" spellcheck="false">' ;
2023-08-11 17:34:35 +00:00
print '<input class="reposition button smallpaddingimp" type="submit" name="modifydesc" value="' . $langs -> trans ( " Modify " ) . '"/>' ;
print '<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="' . $langs -> trans ( " Cancel " ) . '"/>' ;
} else {
2024-09-10 14:14:33 +00:00
print $moduleobj -> description ;
2023-08-11 17:34:35 +00:00
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>' ;
2024-09-10 14:14:33 +00:00
$moduledescritpionautotrans = $moduleobj -> getDesc ();
if ( $moduledescritpionautotrans != " Module " . $moduleobj -> name . " Desc " ) {
// $moduledescritpionautotrans has been found into a translation file
print ' ' . $form -> textwithpicto ( '' , $langs -> trans ( " ModuleTranslatedIntoLangForKeyInto " , " Module " . $moduleobj -> name . " Desc " , $moduledescritpionautotrans ));
2024-09-12 19:16:42 +00:00
} elseif ( $moduledescritpionautotrans != " Module " . $moduleobj -> numero . " Desc " ) {
2024-09-10 14:14:33 +00:00
// $moduledescritpionautotrans has been found into a translation file
print ' ' . $form -> textwithpicto ( '' , $langs -> trans ( " ModuleTranslatedIntoLangForKeyInto " , " Module " . $moduleobj -> numero . " Desc " , $moduledescritpionautotrans ));
}
2023-08-11 17:34:35 +00:00
}
2022-09-07 13:50:40 +00:00
print '</td></tr>' ;
2017-10-06 00:42:32 +00:00
print '<tr><td>' ;
print $langs -> trans ( " Version " );
print '</td><td>' ;
2023-08-11 17:34:35 +00:00
if ( $action == 'edit_moduledescription' && GETPOST ( 'keydescription' , 'alpha' ) === 'version' ) {
print '<input name="propsmodule" value="' . dol_escape_htmltag ( $moduleobj -> getVersion ()) . '">' ;
2023-10-13 13:08:50 +00:00
print '<input class="reposition button smallpaddingimp" type="submit" name="modifyversion" value="' . $langs -> trans ( " Modify " ) . '"/>' ;
2023-08-11 17:34:35 +00:00
print '<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="' . $langs -> trans ( " Cancel " ) . '"/>' ;
} else {
print $moduleobj -> getVersion ();
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>' ;
}
2017-10-06 00:42:32 +00:00
print '</td></tr>' ;
print '<tr><td>' ;
print $langs -> trans ( " Family " );
//print "<br>'crm','financial','hr','projects','products','ecm','technic','interface','other'";
print '</td><td>' ;
2023-08-11 17:34:35 +00:00
if ( $action == 'edit_moduledescription' && GETPOST ( 'keydescription' , 'alpha' ) === 'family' ) {
print '<select name="propsmodule" id="family" class="minwidth400">' ;
$arrayoffamilies = array (
'hr' => " ModuleFamilyHr " ,
'crm' => " ModuleFamilyCrm " ,
'srm' => " ModuleFamilySrm " ,
'financial' => 'ModuleFamilyFinancial' ,
'products' => 'ModuleFamilyProducts' ,
'projects' => 'ModuleFamilyProjects' ,
'ecm' => 'ModuleFamilyECM' ,
'technic' => 'ModuleFamilyTechnic' ,
'portal' => 'ModuleFamilyPortal' ,
'interface' => 'ModuleFamilyInterface' ,
'base' => 'ModuleFamilyBase' ,
'other' => 'ModuleFamilyOther'
);
2023-08-14 10:37:21 +00:00
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>' ;
2023-08-11 17:34:35 +00:00
foreach ( $arrayoffamilies as $key => $value ) {
2023-08-14 10:37:21 +00:00
if ( $key != $moduleobj -> family ) {
print '<option value="' . $key . '" data-html="' . dol_escape_htmltag ( $langs -> trans ( $value ) . ' <span class="opacitymedium">- ' . $key . '</span>' ) . '">' . $langs -> trans ( $value ) . '</option>' ;
}
2023-08-11 17:34:35 +00:00
}
print '</select>' ;
2023-10-13 13:08:50 +00:00
print '<input class="reposition button smallpaddingimp" type="submit" name="modifyfamily" value="' . $langs -> trans ( " Modify " ) . '"/>' ;
2023-08-11 17:34:35 +00:00
print '<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="' . $langs -> trans ( " Cancel " ) . '"/>' ;
} else {
print $moduleobj -> family ;
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>' ;
}
2017-10-06 00:42:32 +00:00
print '</td></tr>' ;
2025-11-12 14:03:31 +00:00
print '<!-- picto of module -->' . " \n " ;
2017-10-06 00:42:32 +00:00
print '<tr><td>' ;
2022-07-06 13:30:36 +00:00
print $langs -> trans ( " Picto " );
2017-10-06 00:42:32 +00:00
print '</td><td>' ;
2023-10-13 13:08:50 +00:00
if ( $action == 'edit_modulepicto' && GETPOST ( 'keydescription' , 'alpha' ) === 'picto' ) {
2026-05-06 15:38:27 +00:00
print '<input class="minwidth200 maxwidth500" name="propsmodule" value="' . dol_escape_htmltag ( $moduleobj -> picto ) . '" spellcheck="false">' ;
2025-11-12 14:03:31 +00:00
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\'' );
2023-10-13 13:08:50 +00:00
print '<input class="reposition button smallpaddingimp" type="submit" name="modifypicto" value="' . $langs -> trans ( " Modify " ) . '"/>' ;
print '<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="' . $langs -> trans ( " Cancel " ) . '"/>' ;
2025-11-12 14:03:31 +00:00
print ' ' ;
print '<span class="opacitymedium small">' ;
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' , '' , '' );
print '</span>' ;
2023-10-13 13:08:50 +00:00
} else {
print $moduleobj -> picto ;
print ' ' . img_picto ( '' , $moduleobj -> picto , 'class="valignmiddle pictomodule paddingrightonly"' );
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>' ;
}
2017-10-06 00:42:32 +00:00
print '</td></tr>' ;
2022-06-30 02:26:21 +00:00
print '<tr><td>' ;
2022-07-06 13:30:36 +00:00
print $langs -> trans ( " EditorName " );
2022-06-30 02:26:21 +00:00
print '</td><td>' ;
2023-08-11 17:34:35 +00:00
if ( $action == 'edit_moduledescription' && GETPOST ( 'keydescription' , 'alpha' ) === 'editor_name' ) {
2026-05-06 15:38:27 +00:00
print '<input name="propsmodule" value="' . dol_escape_htmltag ( $moduleobj -> editor_name ) . '" spellcheck="false">' ;
2023-10-13 13:08:50 +00:00
print '<input class="reposition button smallpaddingimp" type="submit" name="modifyname" value="' . $langs -> trans ( " Modify " ) . '"/>' ;
2023-08-11 17:34:35 +00:00
print '<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="' . $langs -> trans ( " Cancel " ) . '"/>' ;
} else {
print $moduleobj -> editor_name ;
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>' ;
}
2022-06-30 02:26:21 +00:00
print '</td></tr>' ;
2017-10-06 00:42:32 +00:00
print '<tr><td>' ;
2022-07-06 13:30:36 +00:00
print $langs -> trans ( " EditorUrl " );
2017-10-06 00:42:32 +00:00
print '</td><td>' ;
2023-08-11 17:34:35 +00:00
if ( $action == 'edit_moduledescription' && GETPOST ( 'keydescription' , 'alpha' ) === 'editor_url' ) {
2026-05-06 15:38:27 +00:00
print '<input name="propsmodule" value="' . dol_escape_htmltag ( $moduleobj -> editor_url ) . '" spellcheck="false">' ;
2023-10-13 13:08:50 +00:00
print '<input class="reposition button smallpaddingimp" type="submit" name="modifyeditorurl" value="' . $langs -> trans ( " Modify " ) . '"/>' ;
2023-08-11 17:34:35 +00:00
print '<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="' . $langs -> trans ( " Cancel " ) . '"/>' ;
} else {
if ( ! empty ( $moduleobj -> editor_url )) {
print '<a href="' . $moduleobj -> editor_url . '" target="_blank" rel="noopener">' . $moduleobj -> editor_url . ' ' . img_picto ( '' , 'globe' ) . '</a>' ;
}
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>' ;
2022-07-06 13:30:36 +00:00
}
2017-10-06 00:42:32 +00:00
print '</td></tr>' ;
print '</table>' ;
2025-06-12 22:12:21 +00:00
print '</div>' ;
2023-08-11 17:34:35 +00:00
print '</form>' ;
2020-05-21 07:35:30 +00:00
} else {
2019-10-16 10:32:26 +00:00
print $langs -> trans ( " ErrorFailedToLoadModuleDescriptorForXXX " , $module ) . '<br>' ;
}
2017-10-06 00:42:32 +00:00
2021-02-26 17:26:44 +00:00
if ( ! empty ( $moduleobj )) {
2017-10-06 00:42:32 +00:00
print '<br><br>' ;
// Readme file
2022-09-07 13:50:40 +00:00
print load_fiche_titre ( $form -> textwithpicto ( $langs -> trans ( " ReadmeFile " ), $langs -> transnoentitiesnoconv ( " File " ) . ' ' . $pathtofilereadme ), '' , '' );
2017-10-06 00:42:32 +00:00
2019-10-16 10:32:26 +00:00
print '<!-- readme file -->' ;
2021-02-26 17:26:44 +00:00
if ( dol_is_file ( $dirread . '/' . $pathtofilereadme )) {
print '<div class="underbanner clearboth"></div><div class="fichecenter">' . $moduleobj -> getDescLong () . '</div>' ;
} else {
print '<span class="opacitymedium">' . $langs -> trans ( " ErrorFileNotFound " , $pathtofilereadme ) . '</span>' ;
}
2017-10-06 00:42:32 +00:00
print '<br><br>' ;
// ChangeLog
2022-09-07 13:50:40 +00:00
print load_fiche_titre ( $form -> textwithpicto ( $langs -> trans ( " ChangeLog " ), $langs -> transnoentitiesnoconv ( " File " ) . ' ' . $pathtochangelog ), '' , '' );
2017-10-06 00:42:32 +00:00
2019-10-16 10:32:26 +00:00
print '<!-- changelog file -->' ;
2021-02-26 17:26:44 +00:00
if ( dol_is_file ( $dirread . '/' . $pathtochangelog )) {
print '<div class="underbanner clearboth"></div><div class="fichecenter">' . $moduleobj -> getChangeLog () . '</div>' ;
} else {
print '<span class="opacitymedium">' . $langs -> trans ( " ErrorFileNotFound " , $pathtochangelog ) . '</span>' ;
}
2017-10-06 00:42:32 +00:00
}
2017-07-08 14:52:10 +00:00
2020-10-27 17:19:31 +00:00
print dol_get_fiche_end ();
2020-05-29 01:26:05 +00:00
} else { // Edit text file
2019-11-13 18:37:08 +00:00
$fullpathoffile = dol_buildpath ( $file , 0 , 1 ); // Description - level 2
2017-07-18 12:20:37 +00:00
2025-02-05 21:59:37 +00:00
$content = '' ;
2021-02-26 17:26:44 +00:00
if ( $fullpathoffile ) {
2017-10-06 00:42:32 +00:00
$content = file_get_contents ( $fullpathoffile );
}
2017-07-18 12:20:37 +00:00
2017-10-06 00:42:32 +00:00
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
print '<input type="hidden" name="module" value="' . $module . '">' ;
2017-07-18 01:18:16 +00:00
2020-10-22 20:50:03 +00:00
print dol_get_fiche_head ( $head2 , $tab , '' , - 1 , '' , 0 , '' , '' , 0 , 'formodulesuffix' );
2017-07-08 14:52:10 +00:00
2024-08-15 14:57:02 +00:00
$posCursor = ( empty ( $find )) ? array () : array ( 'find' => $find );
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' , 0 , $posCursor );
2023-12-04 12:46:42 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'html' ));
2017-10-06 00:42:32 +00:00
2020-10-27 17:19:31 +00:00
print dol_get_fiche_end ();
2017-10-06 00:42:32 +00:00
print '<center>' ;
2020-11-19 19:23:38 +00:00
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
2017-10-06 00:42:32 +00:00
print ' ' ;
2020-11-23 14:12:52 +00:00
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
2017-10-06 00:42:32 +00:00
print '</center>' ;
print '</form>' ;
}
2020-05-21 07:35:30 +00:00
} else {
2022-09-27 11:37:38 +00:00
print dol_get_fiche_head ( $head2 , $tab , '' , - 1 , '' , 0 , '' , '' , $MAXTABFOROBJECT , 'formodulesuffix' ); // Level 2
2017-10-06 00:42:32 +00:00
}
2017-06-10 21:50:02 +00:00
2021-02-26 17:26:44 +00:00
if ( $tab == 'languages' ) {
2022-04-12 13:51:46 +00:00
print '<!-- tab=languages -->' . " \n " ;
2021-02-26 17:26:44 +00:00
if ( $action != 'editfile' || empty ( $file )) {
2019-03-10 18:33:28 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " LanguageDefDesc " ) . '</span><br>' ;
2017-10-06 00:42:32 +00:00
print '<br>' ;
2019-03-11 14:58:37 +00:00
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="action" value="addlanguage">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
print '<input type="hidden" name="module" value="' . $module . '">' ;
2024-08-18 16:16:08 +00:00
print $formadmin -> select_language ( getDolGlobalString ( 'MAIN_LANG_DEFAULT' ), 'newlangcode' , 0 , array (), 1 , 0 , 0 , 'minwidth300' , 1 );
2021-05-05 17:13:40 +00:00
print '<input type="submit" name="addlanguage" class="button smallpaddingimp" value="' . dol_escape_htmltag ( $langs -> trans ( " AddLanguageFile " )) . '"><br>' ;
2017-10-06 00:42:32 +00:00
print '</form>' ;
print '<br>' ;
print '<br>' ;
2021-05-02 10:35:47 +00:00
$modulelowercase = strtolower ( $module );
// Dir for module
$diroflang = dol_buildpath ( $modulelowercase , 0 );
2021-05-02 10:39:33 +00:00
$diroflang .= '/langs' ;
$langfiles = dol_dir_list ( $diroflang , 'files' , 1 , '\.lang$' );
2021-05-02 10:35:47 +00:00
if ( ! preg_match ( '/custom/' , $dirread )) {
2021-05-02 10:39:33 +00:00
// If this is not a module into custom
2021-05-02 10:35:47 +00:00
$diroflang = $dirread ;
$diroflang .= '/langs' ;
$langfiles = dol_dir_list ( $diroflang , 'files' , 1 , $modulelowercase . '\.lang$' );
}
2017-10-06 00:42:32 +00:00
2019-03-10 18:33:28 +00:00
print '<table class="none">' ;
2021-02-26 17:26:44 +00:00
foreach ( $langfiles as $langfile ) {
2017-10-06 00:42:32 +00:00
$pathtofile = $modulelowercase . '/langs/' . $langfile [ 'relativename' ];
2021-05-02 10:39:33 +00:00
if ( ! preg_match ( '/custom/' , $dirread )) { // If this is not a module into custom
$pathtofile = 'langs/' . $langfile [ 'relativename' ];
}
2024-10-28 10:42:35 +00:00
print '<tr><td><span class="fa fa-file"></span> ' . $langs -> trans ( " LanguageFile " ) . ' ' . basename ( dirname ( $pathtofile )) . ' : <strong class="wordbreak">' . $pathtofile . '</strong>' ;
2022-10-12 14:17:25 +00:00
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>' ;
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>' ;
2019-03-10 18:33:28 +00:00
print '</td>' ;
2017-10-06 00:42:32 +00:00
}
2019-03-10 18:33:28 +00:00
print '</table>' ;
2020-05-21 07:35:30 +00:00
} else {
2017-10-06 00:42:32 +00:00
// Edit text language file
//print $langs->trans("UseAsciiDocFormat").'<br>';
2019-11-13 18:37:08 +00:00
$fullpathoffile = dol_buildpath ( $file , 0 );
2017-10-06 00:42:32 +00:00
$content = file_get_contents ( $fullpathoffile );
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
print '<input type="hidden" name="module" value="' . $module . '">' ;
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' );
2023-12-04 12:46:42 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'text' ));
2017-10-06 00:42:32 +00:00
print '<br>' ;
print '<center>' ;
2020-11-19 19:23:38 +00:00
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
2019-10-24 12:56:43 +00:00
print ' ' ;
2020-11-23 14:12:52 +00:00
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
2019-10-24 12:56:43 +00:00
print '</center>' ;
print '</form>' ;
}
}
2021-02-26 17:26:44 +00:00
if ( $tab == 'objects' ) {
2022-04-12 13:51:46 +00:00
print '<!-- tab=objects -->' . " \n " ;
2017-10-06 00:42:32 +00:00
$head3 = array ();
2020-01-30 00:48:28 +00:00
$h = 0 ;
2017-10-06 00:42:32 +00:00
// Dir for module
$dir = $dirread . '/' . $modulelowercase . '/class' ;
2020-01-30 00:48:28 +00:00
$head3 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=objects&module=' . $module . ( $forceddirread ? '@' . $dirread : '' ) . '&tabobj=newobject' ;
2019-11-01 14:53:57 +00:00
$head3 [ $h ][ 1 ] = '<span class="valignmiddle text-plus-circle">' . $langs -> trans ( " NewObjectInModulebuilder " ) . '</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>' ;
2017-10-06 00:42:32 +00:00
$head3 [ $h ][ 2 ] = 'newobject' ;
$h ++ ;
// Scan for object class files
$listofobject = dol_dir_list ( $dir , 'files' , 0 , '\.class\.php$' );
2019-11-13 18:37:08 +00:00
$firstobjectname = '' ;
2021-02-26 17:26:44 +00:00
foreach ( $listofobject as $fileobj ) {
if ( preg_match ( '/^api_/' , $fileobj [ 'name' ])) {
continue ;
}
if ( preg_match ( '/^actions_/' , $fileobj [ 'name' ])) {
continue ;
}
2017-10-06 00:42:32 +00:00
2019-11-13 18:37:08 +00:00
$tmpcontent = file_get_contents ( $fileobj [ 'fullname' ]);
2021-02-26 17:26:44 +00:00
if ( preg_match ( '/class\s+([^\s]*)\s+extends\s+CommonObject/ims' , $tmpcontent , $reg )) {
2017-10-06 00:42:32 +00:00
//$objectname = preg_replace('/\.txt$/', '', $fileobj['name']);
$objectname = $reg [ 1 ];
2021-02-26 17:26:44 +00:00
if ( empty ( $firstobjectname )) {
$firstobjectname = $objectname ;
}
2023-06-01 21:42:57 +00:00
$pictoname = 'generic' ;
if ( preg_match ( '/\$picto\s*=\s*["\']([^"\']+)["\']/' , $tmpcontent , $reg )) {
$pictoname = $reg [ 1 ];
}
2017-10-06 00:42:32 +00:00
2019-11-13 18:37:08 +00:00
$head3 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=objects&module=' . $module . ( $forceddirread ? '@' . $dirread : '' ) . '&tabobj=' . $objectname ;
2023-07-31 19:58:47 +00:00
$head3 [ $h ][ 1 ] = img_picto ( '' , $pictoname , 'class="pictofixedwidth valignmiddle"' ) . $objectname ;
2017-10-06 00:42:32 +00:00
$head3 [ $h ][ 2 ] = $objectname ;
$h ++ ;
}
}
2022-05-18 19:54:38 +00:00
if ( $h > 1 ) {
$head3 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=objects&module=' . $module . ( $forceddirread ? '@' . $dirread : '' ) . '&tabobj=deleteobject' ;
2023-06-09 13:02:46 +00:00
$head3 [ $h ][ 1 ] = img_picto ( '' , 'delete' , 'class="pictofixedwidth"' ) . $langs -> trans ( " DangerZone " );
2022-05-18 19:54:38 +00:00
$head3 [ $h ][ 2 ] = 'deleteobject' ;
$h ++ ;
}
2017-10-06 00:42:32 +00:00
// If tabobj was not defined, then we check if there is one obj. If yes, we force on it, if no, we will show tab to create new objects.
2021-02-26 17:26:44 +00:00
if ( $tabobj == 'newobjectifnoobj' ) {
if ( $firstobjectname ) {
$tabobj = $firstobjectname ;
} else {
$tabobj = 'newobject' ;
}
2017-10-06 00:42:32 +00:00
}
2023-06-01 21:42:57 +00:00
print dol_get_fiche_head ( $head3 , $tabobj , '' , - 1 , '' , 0 , '' , '' , 0 , 'forobjectsuffix' ); // Level 3
2017-10-06 00:42:32 +00:00
2023-07-28 17:41:25 +00:00
2021-02-26 17:26:44 +00:00
if ( $tabobj == 'newobject' ) {
2017-10-06 00:42:32 +00:00
// New object tab
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="action" value="initobject">' ;
print '<input type="hidden" name="tab" value="objects">' ;
print '<input type="hidden" name="module" value="' . dol_escape_htmltag ( $module ) . '">' ;
NEW: ModuleBuilder - selectable object tabs (+ fixes for multi-object generation) (#38570)
* NEW : add ModuleBuilder object-tabs map and filter helpers
Add getModuleBuilderObjectTabs() (source-of-truth map of optional object
tabs) and filterEnabledTabs() (sanitizes user-requested tab keys against the
map). Covered by ModuleBuilderLibTest.
Next: add BEGIN/END markers around tab flags and blocks in template lib (Task 2)
* NEW : wrap object tab flags and blocks with MODULEBUILDER markers
Surround each optional tab flag declaration (TABFLAG) and each prepareHead tab
block (TAB) with BEGIN/END MODULEBUILDER comment markers, so the generator can
purge a whole tab atomically while keeping $h and $head intact. Card tab is
not wrapped (always generated).
Next: add tab selection checkboxes to the newobject form in modulebuilder/index.php (Task 3)
* NEW : add object tab selection checkboxes to newobject form
Render one checkbox per optional tab (contact, note, document, agenda) in the
ModuleBuilder newobject form, all checked by default and reflecting posted
state on redisplay.
Next: handle enabledtab in initobject — exclude files, purge blocks, hardcode flags (Task 4)
* NEW : apply object tab selection during object generation
Excludes page files of unselected tabs, purges their prepareHead flag and
block via MODULEBUILDER markers, and hardcodes the show flag to 1 for selected
tabs. Emits a best-effort warning when regenerating an existing object.
Next: add language keys EnabledTabsForObject(Help) + WarningTabSelectionOnRegeneration (Task 5)
* NEW : add language keys for object tab selection
Next: add ChangeLog entry (Task 6)
* DOC : changelog entry for ModuleBuilder selectable object tabs
* FIX : purge agenda card widget when agenda tab is excluded
Audit finding: myobject_card.php hardcodes a 'SeeAll' link to myobject_agenda.php
in an event widget. When the agenda tab is excluded the page is not generated,
leaving a latent dead link if the widget is enabled. Wrap the widget with
MODULEBUILDER TAB AGENDA markers and purge it from the generated card when the
agenda tab is not selected.
Next: functional verification (step 5 of dev workflow)
* FIX : check file operation results when applying object tab selection
PR review: align with the nogeneratelines pattern by checking the return of
removePatternFromFile/dolReplaceInFile and raising $error + dol_syslog with the
failing tab/file context, instead of ignoring silent write failures during
object generation. Add PR reference to the changelog entry.
* FIX : do not abort object generation when nogeneratelines targets a missing file
The nogeneratelines handler purges the MODULEBUILDER LINES block from class,
API and card files. When API generation is disabled the api_<module>.class.php
file does not exist, so removePatternFromFile returns false and $error was
incremented, which skipped the whole success path (name substitution,
rebuildObjectClass, $tabobj assignment). Generated classes kept the literal
'class MyObject', so dolGetListOfObjectClasses listed every object as MyObject.
Guard each purge with file_exists so a missing optional file is skipped.
* FIX : keep module descriptor out of the blanket name substitution
The 'substitute all module php files' pass applied the object/module name map
to every .php file including the module descriptor. That rewrote the persistent
/* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */ marker placeholders to the
first object name, so generating a second object could no longer find them
(checkExistComment returned -1, 'comments not found for section Menus' warning)
and its menu entries were not inserted. Skip the descriptor in that loop: its
module name is already resolved by initmodule and its object entries are added
by the dedicated menu/permission blocks.
* FIX : preserve MODULEBUILDER markers when substituting the module descriptor
The previous commit only skipped the descriptor in the secondary substitution
pass, but the primary pass (over $filetogenerate, which includes the descriptor)
still rewrote its persistent /* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */
markers to the first object name. Those markers cannot simply be excluded from
substitution because the descriptor also has functional MYOBJECT/MYMODULE tokens
(e.g. the MYMODULE_MYOBJECT_ADDON numbering constant) that must be resolved.
Add dolReplaceInFilePreservingModuleBuilderMarkers(): it hides every MODULEBUILDER
marker behind a sentinel, applies the substitution, then restores the markers
verbatim. Use it for the descriptor in the primary pass; the descriptor stays
excluded from the secondary pass. Generating a second object now finds the
markers (checkExistComment) and inserts its menu entries without warning.
Verified by CLI: markers preserved across two successive objects, while content
(rights, exports, addon constant) is correctly substituted.
* FIX : silence phan on the new ModuleBuilder test and typed closure
CI phan (diff-only) flagged the freshly added test file: PhanUndeclaredExtendedClass
(\CommonClassTest) and PhanUndeclaredMethod (assertSame), like the sibling
NamingContractTest. Add the same @phan-file-suppress block (plus
PhanTypeMismatchArgumentProbablyReal for the non-array guard test case). Also
type the preg_replace_callback parameter (array $matches) to clear
PhanPluginUnknownClosureParamType. phpstan is already green; no phpstan
annotations added.
* FIX : drop closure in marker-preserving substitution to satisfy phan
phan's PhanPluginUnknownArrayClosureParamType wanted key/value types on the
preg_replace_callback closure parameter. Replace the callback with preg_match_all
plus a str_replace loop over the unique markers: same behaviour, no closure,
no plugin warning.
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-09 17:04:00 +00:00
// Tabs selected by default = all optional tabs; reflect posted state on redisplay
$enabledtabsdefault = GETPOSTISSET ( 'enabledtab' ) ? GETPOST ( 'enabledtab' , 'array' ) : array_keys ( getModuleBuilderObjectTabs ());
2019-03-10 18:33:28 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " EnterNameOfObjectDesc " ) . '</span><br><br>' ;
2017-10-06 00:42:32 +00:00
2022-09-27 11:37:38 +00:00
print '<div class="tagtable">' ;
print '<div class="tagtr"><div class="tagtd">' ;
print '<span class="opacitymedium">' . $langs -> trans ( " ObjectKey " ) . '</span> ' ;
print '</div><div class="tagtd">' ;
2026-04-04 10:54:03 +00:00
print '<input type="text" name="objectname" maxlength="64" value="' . dol_escape_htmltag ( GETPOSTISSET ( 'objectname' ) ? GETPOST ( 'objectname' , 'alpha' ) : $modulename ) . '" required autofocus>' ;
2023-10-13 13:42:15 +00:00
print $form -> textwithpicto ( '' , $langs -> trans ( " Example " ) . ': MyObject, ACamelCaseName, ...' );
2022-09-27 11:37:38 +00:00
print '</div></div>' ;
print '<div class="tagtr"><div class="tagtd">' ;
print '<span class="opacitymedium">' . $langs -> trans ( " Picto " ) . '</span> ' ;
print '</div><div class="tagtd">' ;
2024-10-28 10:42:35 +00:00
print '<input type="text" name="idpicto" value="fa-file" placeholder="' . dol_escape_htmltag ( $langs -> trans ( " Picto " )) . '">' ;
2025-05-05 12:54:35 +00:00
2025-11-12 14:03:31 +00:00
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\'' );
2025-05-05 12:54:35 +00:00
print '<span class="opacitymedium small">' ;
print ' ' ;
2025-06-14 13:06:01 +00:00
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' , '' , '' );
2025-05-05 12:54:35 +00:00
print '</span>' ;
2022-09-27 11:37:38 +00:00
print '</div></div>' ;
print '<div class="tagtr"><div class="tagtd">' ;
print '<span class="opacitymedium">' . $langs -> trans ( " DefinePropertiesFromExistingTable " ) . '</span> ' ;
print '</div><div class="tagtd">' ;
print '<input type="text" name="initfromtablename" value="' . GETPOST ( 'initfromtablename' ) . '" placeholder="' . $langs -> trans ( " TableName " ) . '">' ;
print $form -> textwithpicto ( '' , $langs -> trans ( " DefinePropertiesFromExistingTableDesc " ) . '<br>' . $langs -> trans ( " DefinePropertiesFromExistingTableDesc2 " ));
print '</div></div>' ;
print '</div>' ;
print '<br>' ;
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>' ;
2021-11-07 12:51:31 +00:00
print '<input type="checkbox" name="includedocgeneration" id="includedocgeneration" value="includedocgeneration"> <label for="includedocgeneration">' . $form -> textwithpicto ( $langs -> trans ( " IncludeDocGeneration " ), $langs -> trans ( " IncludeDocGenerationHelp " )) . '</label><br>' ;
2023-02-03 10:01:06 +00:00
print '<input type="checkbox" name="generatepermissions" id="generatepermissions" value="generatepermissions"> <label for="generatepermissions">' . $form -> textwithpicto ( $langs -> trans ( " GeneratePermissions " ), $langs -> trans ( " GeneratePermissionsHelp " )) . '</label><br>' ;
2026-05-18 14:13:35 +00:00
print '<input type="checkbox" name="nogeneratelines" id="nogeneratelines" value="nogeneratelines"> <label for="nogeneratelines">' . $form -> textwithpicto ( $langs -> trans ( " NoGenerateLines " ), $langs -> trans ( " NoGenerateLinesHelp " )) . '</label><br>' ;
NEW: ModuleBuilder - selectable object tabs (+ fixes for multi-object generation) (#38570)
* NEW : add ModuleBuilder object-tabs map and filter helpers
Add getModuleBuilderObjectTabs() (source-of-truth map of optional object
tabs) and filterEnabledTabs() (sanitizes user-requested tab keys against the
map). Covered by ModuleBuilderLibTest.
Next: add BEGIN/END markers around tab flags and blocks in template lib (Task 2)
* NEW : wrap object tab flags and blocks with MODULEBUILDER markers
Surround each optional tab flag declaration (TABFLAG) and each prepareHead tab
block (TAB) with BEGIN/END MODULEBUILDER comment markers, so the generator can
purge a whole tab atomically while keeping $h and $head intact. Card tab is
not wrapped (always generated).
Next: add tab selection checkboxes to the newobject form in modulebuilder/index.php (Task 3)
* NEW : add object tab selection checkboxes to newobject form
Render one checkbox per optional tab (contact, note, document, agenda) in the
ModuleBuilder newobject form, all checked by default and reflecting posted
state on redisplay.
Next: handle enabledtab in initobject — exclude files, purge blocks, hardcode flags (Task 4)
* NEW : apply object tab selection during object generation
Excludes page files of unselected tabs, purges their prepareHead flag and
block via MODULEBUILDER markers, and hardcodes the show flag to 1 for selected
tabs. Emits a best-effort warning when regenerating an existing object.
Next: add language keys EnabledTabsForObject(Help) + WarningTabSelectionOnRegeneration (Task 5)
* NEW : add language keys for object tab selection
Next: add ChangeLog entry (Task 6)
* DOC : changelog entry for ModuleBuilder selectable object tabs
* FIX : purge agenda card widget when agenda tab is excluded
Audit finding: myobject_card.php hardcodes a 'SeeAll' link to myobject_agenda.php
in an event widget. When the agenda tab is excluded the page is not generated,
leaving a latent dead link if the widget is enabled. Wrap the widget with
MODULEBUILDER TAB AGENDA markers and purge it from the generated card when the
agenda tab is not selected.
Next: functional verification (step 5 of dev workflow)
* FIX : check file operation results when applying object tab selection
PR review: align with the nogeneratelines pattern by checking the return of
removePatternFromFile/dolReplaceInFile and raising $error + dol_syslog with the
failing tab/file context, instead of ignoring silent write failures during
object generation. Add PR reference to the changelog entry.
* FIX : do not abort object generation when nogeneratelines targets a missing file
The nogeneratelines handler purges the MODULEBUILDER LINES block from class,
API and card files. When API generation is disabled the api_<module>.class.php
file does not exist, so removePatternFromFile returns false and $error was
incremented, which skipped the whole success path (name substitution,
rebuildObjectClass, $tabobj assignment). Generated classes kept the literal
'class MyObject', so dolGetListOfObjectClasses listed every object as MyObject.
Guard each purge with file_exists so a missing optional file is skipped.
* FIX : keep module descriptor out of the blanket name substitution
The 'substitute all module php files' pass applied the object/module name map
to every .php file including the module descriptor. That rewrote the persistent
/* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */ marker placeholders to the
first object name, so generating a second object could no longer find them
(checkExistComment returned -1, 'comments not found for section Menus' warning)
and its menu entries were not inserted. Skip the descriptor in that loop: its
module name is already resolved by initmodule and its object entries are added
by the dedicated menu/permission blocks.
* FIX : preserve MODULEBUILDER markers when substituting the module descriptor
The previous commit only skipped the descriptor in the secondary substitution
pass, but the primary pass (over $filetogenerate, which includes the descriptor)
still rewrote its persistent /* ... MODULEBUILDER TOPMENU/LEFTMENU MYOBJECT */
markers to the first object name. Those markers cannot simply be excluded from
substitution because the descriptor also has functional MYOBJECT/MYMODULE tokens
(e.g. the MYMODULE_MYOBJECT_ADDON numbering constant) that must be resolved.
Add dolReplaceInFilePreservingModuleBuilderMarkers(): it hides every MODULEBUILDER
marker behind a sentinel, applies the substitution, then restores the markers
verbatim. Use it for the descriptor in the primary pass; the descriptor stays
excluded from the secondary pass. Generating a second object now finds the
markers (checkExistComment) and inserts its menu entries without warning.
Verified by CLI: markers preserved across two successive objects, while content
(rights, exports, addon constant) is correctly substituted.
* FIX : silence phan on the new ModuleBuilder test and typed closure
CI phan (diff-only) flagged the freshly added test file: PhanUndeclaredExtendedClass
(\CommonClassTest) and PhanUndeclaredMethod (assertSame), like the sibling
NamingContractTest. Add the same @phan-file-suppress block (plus
PhanTypeMismatchArgumentProbablyReal for the non-array guard test case). Also
type the preg_replace_callback parameter (array $matches) to clear
PhanPluginUnknownClosureParamType. phpstan is already green; no phpstan
annotations added.
* FIX : drop closure in marker-preserving substitution to satisfy phan
phan's PhanPluginUnknownArrayClosureParamType wanted key/value types on the
preg_replace_callback closure parameter. Replace the callback with preg_match_all
plus a str_replace loop over the unique markers: same behaviour, no closure,
no plugin warning.
---------
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-06-09 17:04:00 +00:00
print '<br><span class="opacitymedium">' . $form -> textwithpicto ( $langs -> trans ( " EnabledTabsForObject " ), $langs -> trans ( " EnabledTabsForObjectHelp " )) . '</span><br>' ;
foreach ( getModuleBuilderObjectTabs () as $tabkey => $tabinfo ) {
$checked = in_array ( $tabkey , $enabledtabsdefault , true ) ? ' checked' : '' ;
print '<input type="checkbox" name="enabledtab[]" id="enabledtab_' . $tabkey . '" value="' . dol_escape_htmltag ( $tabkey ) . '"' . $checked . '> ' ;
print '<label for="enabledtab_' . $tabkey . '">' . dol_escape_htmltag ( $langs -> trans ( $tabinfo [ 'label' ])) . '</label> ' ;
}
print '<br>' ;
2018-03-13 19:23:59 +00:00
print '<br>' ;
2022-09-27 11:37:38 +00:00
print '<input type="submit" class="button small" name="create" value="' . dol_escape_htmltag ( $langs -> trans ( " GenerateCode " )) . '"' . ( $dirins ? '' : ' disabled="disabled"' ) . '>' ;
2018-03-13 19:23:59 +00:00
print '<br>' ;
print '<br>' ;
2022-09-27 11:37:38 +00:00
/*
print '<br>' ;
2022-05-01 13:05:25 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " or " ) . '</span>' ;
2018-03-13 19:23:59 +00:00
print '<br>' ;
print '<br>' ;
//print '<input type="checkbox" name="initfromtablecheck"> ';
print $langs -> trans ( " InitStructureFromExistingTable " );
print '<input type="text" name="initfromtablename" value="" placeholder="' . $langs -> trans ( " TableName " ) . '">' ;
2022-09-07 13:50:40 +00:00
print '<input type="submit" class="button smallpaddingimp" name="createtablearray" value="' . dol_escape_htmltag ( $langs -> trans ( " GenerateCode " )) . '"' . ( $dirins ? '' : ' disabled="disabled"' ) . '>' ;
2018-03-13 19:23:59 +00:00
print '<br>' ;
2022-09-27 11:37:38 +00:00
*/
2018-03-13 19:23:59 +00:00
2017-10-06 00:42:32 +00:00
print '</form>' ;
2023-07-27 23:19:03 +00:00
} elseif ( $tabobj == 'createproperty' ) {
2023-12-04 12:46:42 +00:00
$attributesUnique = array (
2023-07-28 17:41:25 +00:00
'proplabel' => $form -> textwithpicto ( $langs -> trans ( " Label " ), $langs -> trans ( " YouCanUseTranslationKey " )),
2023-10-13 18:07:39 +00:00
'propname' => $form -> textwithpicto ( $langs -> trans ( " Code " ), $langs -> trans ( " PropertyDesc " ), 1 , 'help' , 'extracss' , 0 , 3 , 'propertyhelp' ),
2023-07-28 17:41:25 +00:00
'proptype' => $form -> textwithpicto ( $langs -> trans ( " Type " ), $langs -> trans ( " TypeOfFieldsHelpIntro " ) . '<br><br>' . $langs -> trans ( " TypeOfFieldsHelp " ), 1 , 'help' , 'extracss' , 0 , 3 , 'typehelp' ),
'proparrayofkeyval' => $form -> textwithpicto ( $langs -> trans ( " ArrayOfKeyValues " ), $langs -> trans ( " ArrayOfKeyValuesDesc " )),
'propnotnull' => $form -> textwithpicto ( $langs -> trans ( " NotNull " ), $langs -> trans ( " NotNullDesc " )),
'propdefault' => $langs -> trans ( " DefaultValue " ),
'propindex' => $langs -> trans ( " DatabaseIndex " ),
'propforeignkey' => $form -> textwithpicto ( $langs -> trans ( " ForeignKey " ), $langs -> trans ( " ForeignKeyDesc " ), 1 , 'help' , 'extracss' , 0 , 3 , 'foreignkeyhelp' ),
'propposition' => $langs -> trans ( " Position " ),
'propenabled' => $form -> textwithpicto ( $langs -> trans ( " Enabled " ), $langs -> trans ( " EnabledDesc " ), 1 , 'help' , 'extracss' , 0 , 3 , 'enabledhelp' ),
'propvisible' => $form -> textwithpicto ( $langs -> trans ( " Visibility " ), $langs -> trans ( " VisibleDesc " ) . '<br><br>' . $langs -> trans ( " ItCanBeAnExpression " ), 1 , 'help' , 'extracss' , 0 , 3 , 'visiblehelp' ),
'propnoteditable' => $langs -> trans ( " NotEditable " ),
2023-10-13 18:07:39 +00:00
//'propalwayseditable' => $langs->trans("AlwaysEditable"),
2023-07-28 17:41:25 +00:00
'propsearchall' => $form -> textwithpicto ( $langs -> trans ( " SearchAll " ), $langs -> trans ( " SearchAllDesc " )),
'propisameasure' => $form -> textwithpicto ( $langs -> trans ( " IsAMeasure " ), $langs -> trans ( " IsAMeasureDesc " )),
'propcss' => $langs -> trans ( " CSSClass " ),
'propcssview' => $langs -> trans ( " CSSViewClass " ),
'propcsslist' => $langs -> trans ( " CSSListClass " ),
'prophelp' => $langs -> trans ( " KeyForTooltip " ),
'propshowoncombobox' => $langs -> trans ( " ShowOnCombobox " ),
2023-10-13 18:07:39 +00:00
//'propvalidate' => $form->textwithpicto($langs->trans("Validate"), $langs->trans("ValidateModBuilderDesc")),
2023-07-28 17:41:25 +00:00
'propcomment' => $langs -> trans ( " Comment " ),
);
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '?tab=objects&module=' . urlencode ( $module ) . '&tabobj=createproperty&obj=' . urlencode ( GETPOST ( 'obj' )) . '" method="POST">' ;
2023-07-27 23:19:03 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="action" value="addproperty">' ;
print '<input type="hidden" name="tab" value="objects">' ;
print '<input type="hidden" name="module" value="' . dol_escape_htmltag ( $module ) . '">' ;
2023-07-28 17:41:25 +00:00
print '<input type="hidden" name="obj" value="' . dol_escape_htmltag ( GETPOST ( 'obj' )) . '">' ;
print '<table class="border centpercent tableforfieldcreate">' . " \n " ;
$counter = 0 ;
foreach ( $attributesUnique as $key => $attribute ) {
if ( $counter % 2 === 0 ) {
print '<tr>' ;
}
if ( $key == 'propname' || $key == 'proplabel' ) {
2023-10-09 14:46:47 +00:00
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>' ;
2023-07-28 17:41:25 +00:00
} elseif ( $key == 'proptype' ) {
2023-10-14 14:23:28 +00:00
print '<td class="titlefieldcreate fieldrequired">' . $attribute . '</td><td class="valuefieldcreate maxwidth50">' ;
2025-08-06 12:37:01 +00:00
print '<input class="maxwidth200" name="' . $key . '" id="' . $key . '" list="datalist' . $key . '" type="text" value="' . dol_escape_htmltag ( GETPOST ( $key , 'alpha' )) . '">' ;
2023-10-14 14:23:28 +00:00
//print '<div id="suggestions"></div>';
print '<datalist id="datalist' . $key . '">' ;
print '<option>varchar(128)</option>' ;
print '<option>email</option>' ;
print '<option>phone</option>' ;
print '<option>ip</option>' ;
print '<option>url</option>' ;
print '<option>password</option>' ;
print '<option>text</option>' ;
print '<option>html</option>' ;
print '<option>date</option>' ;
print '<option>datetime</option>' ;
print '<option>integer</option>' ;
2024-10-04 16:37:41 +00:00
print '<option>stars(5)</option>' ;
2023-10-14 14:23:28 +00:00
print '<option>double(28,4)</option>' ;
print '<option>real</option>' ;
print '<option>integer:ClassName:RelativePath/To/ClassFile.class.php[:1[:FILTER]]</option>' ;
// Combo with list of fields
/*
if ( empty ( $formadmin )) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formadmin.class.php' ;
$formadmin = new FormAdmin ( $db );
}
print $formadmin -> selectTypeOfFields ( $key , GETPOST ( $key , 'alpha' ));
*/
print '</datalist>' ;
print '</td>' ;
2023-12-13 11:46:23 +00:00
//} elseif ($key == 'propvalidate') {
2023-10-13 18:07:39 +00:00
// print '<td class="titlefieldcreate">'.$attribute.'</td><td class="valuefieldcreate maxwidth50"><input type="number" step="1" min="0" max="1" class="text maxwidth100" value="'.dol_escape_htmltag(GETPOST($key, 'alpha')).'"></td>';
} elseif ( $key == 'propvisible' ) {
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>' ;
} elseif ( $key == 'propenabled' ) {
2023-10-13 22:47:25 +00:00
//$default = "isModEnabled('".strtolower($module)."')";
$default = 1 ;
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>' ;
2023-10-13 18:07:39 +00:00
} elseif ( $key == 'proparrayofkeyval' ) {
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>' ;
2023-07-28 17:41:25 +00:00
} else {
2023-10-13 18:07:39 +00:00
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>' ;
2023-07-28 17:41:25 +00:00
}
$counter ++ ;
if ( $counter % 2 === 0 ) {
print '</tr>' ;
}
}
if ( $counter % 2 !== 0 ) {
while ( $counter % 2 !== 0 ) {
print '<td></td>' ;
$counter ++ ;
}
print '</tr>' ;
}
print '</table><br>' . " \n " ;
print '<div class="center">' ;
print '<input type="submit" class="button button-save" name="add" value="' . dol_escape_htmltag ( $langs -> trans ( 'Create' )) . '">' ;
print '<input type="button" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( 'Cancel' )) . '" onclick="goBack()">' ;
print '</div>' ;
2017-10-06 00:42:32 +00:00
print '</form>' ;
2023-07-28 17:41:25 +00:00
// javascript
2023-09-27 10:53:58 +00:00
print ' < script >
2023-07-28 17:41:25 +00:00
function goBack () {
var url = " '. $_SERVER["PHP_SELF"] .'?tab=objects&module='.urlencode( $module ).' " ;
window . location . href = url ;
}
$ ( document ) . ready ( function () {
2023-10-13 18:07:39 +00:00
$ ( " #proplabel " ) . on ( " keyup " , function () {
console . log ( " key up on label " );
s = cleanString ( $ ( " #proplabel " ) . val ());
$ ( " #propname " ) . val ( s );
});
function cleanString ( stringtoclean )
{
// allow "a-z", "A-Z", "0-9" and "_"
stringtoclean = stringtoclean . replace ( / [ ^ a - z0 - 9_ ] +/ ig , " " );
stringtoclean = stringtoclean . toLowerCase ();
if ( ! isNaN ( stringtoclean )) {
return " "
}
while ( stringtoclean . length > 1 && ! isNaN ( stringtoclean . charAt ( 0 )) ){
stringtoclean = stringtoclean . substr ( 1 )
}
if ( stringtoclean . length > 28 ) {
stringtoclean = stringtoclean . substring ( 0 , 27 );
}
2023-10-14 14:23:28 +00:00
return stringtoclean ;
2023-10-13 18:07:39 +00:00
}
2023-08-01 10:30:36 +00:00
}); ' ;
2023-07-28 17:41:25 +00:00
print '</script>' ;
2020-05-21 07:35:30 +00:00
} elseif ( $tabobj == 'deleteobject' ) {
2017-10-06 00:42:32 +00:00
// Delete object tab
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="action" value="confirm_deleteobject">' ;
print '<input type="hidden" name="tab" value="objects">' ;
2023-10-13 13:42:15 +00:00
print '<input type="hidden" name="tabobj" value="deleteobject">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="module" value="' . dol_escape_htmltag ( $module ) . '">' ;
print $langs -> trans ( " EnterNameOfObjectToDeleteDesc " ) . '<br><br>' ;
2026-04-27 01:32:54 +00:00
print '<input type="text" class="valignmiddle" name="objectname" value="" placeholder="' . dol_escape_htmltag ( $langs -> trans ( " ObjectKey " )) . '" autofocus>' ;
2020-12-27 15:53:15 +00:00
print '<input type="submit" class="button smallpaddingimp" name="delete" value="' . dol_escape_htmltag ( $langs -> trans ( " Delete " )) . '"' . ( $dirins ? '' : ' disabled="disabled"' ) . '>' ;
2017-10-06 00:42:32 +00:00
print '</form>' ;
2020-05-21 07:35:30 +00:00
} else {
2020-05-20 22:02:33 +00:00
// tabobj = module
2021-02-26 17:26:44 +00:00
if ( $action == 'deleteproperty' ) {
2020-04-05 00:44:59 +00:00
$formconfirm = $form -> formconfirm (
2019-01-27 10:55:16 +00:00
$_SERVER [ " PHP_SELF " ] . '?propertykey=' . urlencode ( GETPOST ( 'propertykey' , 'alpha' )) . '&objectname=' . urlencode ( $objectname ) . '&tab=' . urlencode ( $tab ) . '&module=' . urlencode ( $module ) . '&tabobj=' . urlencode ( $tabobj ),
2021-02-26 17:26:44 +00:00
$langs -> trans ( 'Delete' ),
$langs -> trans ( 'ConfirmDeleteProperty' , GETPOST ( 'propertykey' , 'alpha' )),
'confirm_deleteproperty' ,
'' ,
0 ,
1
);
2017-10-06 00:42:32 +00:00
// Print form confirm
print $formconfirm ;
}
2023-12-04 12:46:42 +00:00
if ( $action != 'editfile' || empty ( $file )) {
2017-10-06 00:42:32 +00:00
try {
2018-11-05 14:31:41 +00:00
//$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
2017-10-06 00:42:32 +00:00
$pathtoclass = strtolower ( $module ) . '/class/' . strtolower ( $tabobj ) . '.class.php' ;
2017-11-05 17:15:59 +00:00
$pathtoapi = strtolower ( $module ) . '/class/api_' . strtolower ( $module ) . '.class.php' ;
2017-10-06 00:42:32 +00:00
$pathtoagenda = strtolower ( $module ) . '/' . strtolower ( $tabobj ) . '_agenda.php' ;
$pathtocard = strtolower ( $module ) . '/' . strtolower ( $tabobj ) . '_card.php' ;
$pathtodocument = strtolower ( $module ) . '/' . strtolower ( $tabobj ) . '_document.php' ;
$pathtolist = strtolower ( $module ) . '/' . strtolower ( $tabobj ) . '_list.php' ;
$pathtonote = strtolower ( $module ) . '/' . strtolower ( $tabobj ) . '_note.php' ;
2020-12-25 10:01:19 +00:00
$pathtocontact = strtolower ( $module ) . '/' . strtolower ( $tabobj ) . '_contact.php' ;
2019-05-19 14:21:11 +00:00
$pathtophpunit = strtolower ( $module ) . '/test/phpunit/' . strtolower ( $tabobj ) . 'Test.php' ;
2022-07-15 12:31:00 +00:00
// Try to load object class file
clearstatcache ( true );
if ( function_exists ( 'opcache_invalidate' )) {
opcache_invalidate ( $dirread . '/' . $pathtoclass , true ); // remove the include cache hell !
}
if ( empty ( $forceddirread ) && empty ( $dirread )) {
$result = dol_include_once ( $pathtoclass );
$stringofinclude = " dol_include_once( " . $pathtoclass . " ) " ;
} else {
2024-09-05 16:10:24 +00:00
$result = include_once $dirread . '/' . $pathtoclass ;
2022-07-15 12:31:00 +00:00
$stringofinclude = " @include_once " . $dirread . '/' . $pathtoclass ;
}
2024-09-05 16:10:24 +00:00
2022-07-15 12:31:00 +00:00
if ( class_exists ( $tabobj )) {
try {
2022-09-27 11:37:38 +00:00
$tmpobject = @ new $tabobj ( $db );
2022-07-15 12:31:00 +00:00
} catch ( Exception $e ) {
dol_syslog ( 'Failed to load Constructor of class: ' . $e -> getMessage (), LOG_WARNING );
}
} else {
print '<span class="warning">' . $langs -> trans ( 'Failed to find the class ' . $tabobj . ' despite the ' . $stringofinclude ) . '</span><br><br>' ;
}
// Define path for sql file
$pathtosql = strtolower ( $module ) . '/sql/llx_' . strtolower ( $module ) . '_' . strtolower ( $tabobj ) . '-' . strtolower ( $module ) . '.sql' ;
$result = dol_buildpath ( $pathtosql );
if ( ! dol_is_file ( $result )) {
$pathtosql = strtolower ( $module ) . '/sql/llx_' . strtolower ( $module ) . '_' . strtolower ( $tabobj ) . '.sql' ;
$result = dol_buildpath ( $pathtosql );
if ( ! dol_is_file ( $result )) {
$pathtosql = 'install/mysql/tables/llx_' . strtolower ( $module ) . '_' . strtolower ( $tabobj ) . '-' . strtolower ( $module ) . '.sql' ;
$result = dol_buildpath ( $pathtosql );
if ( ! dol_is_file ( $result )) {
$pathtosql = 'install/mysql/tables/llx_' . strtolower ( $module ) . '-' . strtolower ( $module ) . '.sql' ;
$result = dol_buildpath ( $pathtosql );
if ( ! dol_is_file ( $result )) {
$pathtosql = 'install/mysql/tables/llx_' . strtolower ( $module ) . '.sql' ;
$pathtosqlextra = 'install/mysql/tables/llx_' . strtolower ( $module ) . '_extrafields.sql' ;
$result = dol_buildpath ( $pathtosql );
} else {
$pathtosqlextra = 'install/mysql/tables/llx_' . strtolower ( $module ) . '_extrafields-' . strtolower ( $module ) . '.sql' ;
}
} else {
$pathtosqlextra = 'install/mysql/tables/llx_' . strtolower ( $module ) . '_' . strtolower ( $tabobj ) . '_extrafields-' . strtolower ( $module ) . '.sql' ;
}
} else {
$pathtosqlextra = strtolower ( $module ) . '/sql/llx_' . strtolower ( $module ) . '_' . strtolower ( $tabobj ) . '_extrafields.sql' ;
}
} else {
$pathtosqlextra = strtolower ( $module ) . '/sql/llx_' . strtolower ( $module ) . '_' . strtolower ( $tabobj ) . '_extrafields-' . strtolower ( $module ) . '.sql' ;
}
$pathtosqlroot = preg_replace ( '/\/llx_.*$/' , '' , $pathtosql );
$pathtosqlkey = preg_replace ( '/\.sql$/' , '.key.sql' , $pathtosql );
$pathtosqlextrakey = preg_replace ( '/\.sql$/' , '.key.sql' , $pathtosqlextra );
2018-12-22 17:22:12 +00:00
$pathtolib = strtolower ( $module ) . '/lib/' . strtolower ( $module ) . '.lib.php' ;
$pathtoobjlib = strtolower ( $module ) . '/lib/' . strtolower ( $module ) . '_' . strtolower ( $tabobj ) . '.lib.php' ;
2023-06-01 21:42:57 +00:00
2024-08-17 17:32:52 +00:00
$tmpobject = $tmpobject ? ? null ; // @phan-suppress-current-line PhanPluginDuplicateExpressionAssignmentOperation
2023-06-01 21:42:57 +00:00
if ( is_object ( $tmpobject ) && property_exists ( $tmpobject , 'picto' )) {
$pathtopicto = $tmpobject -> picto ;
$realpathtopicto = '' ;
} else {
$pathtopicto = strtolower ( $module ) . '/img/object_' . strtolower ( $tabobj ) . '.png' ;
$realpathtopicto = $dirread . '/' . $pathtopicto ;
}
2017-10-06 00:42:32 +00:00
2022-05-17 12:55:38 +00:00
//var_dump($pathtoclass);
//var_dump($dirread);
2020-08-06 13:55:04 +00:00
$realpathtoclass = $dirread . '/' . $pathtoclass ;
$realpathtoapi = $dirread . '/' . $pathtoapi ;
$realpathtoagenda = $dirread . '/' . $pathtoagenda ;
$realpathtocard = $dirread . '/' . $pathtocard ;
$realpathtodocument = $dirread . '/' . $pathtodocument ;
$realpathtolist = $dirread . '/' . $pathtolist ;
$realpathtonote = $dirread . '/' . $pathtonote ;
2020-12-25 10:01:19 +00:00
$realpathtocontact = $dirread . '/' . $pathtocontact ;
2020-08-06 13:55:04 +00:00
$realpathtophpunit = $dirread . '/' . $pathtophpunit ;
$realpathtosql = $dirread . '/' . $pathtosql ;
$realpathtosqlextra = $dirread . '/' . $pathtosqlextra ;
$realpathtosqlkey = $dirread . '/' . $pathtosqlkey ;
$realpathtosqlextrakey = $dirread . '/' . $pathtosqlextrakey ;
$realpathtolib = $dirread . '/' . $pathtolib ;
$realpathtoobjlib = $dirread . '/' . $pathtoobjlib ;
2017-10-06 00:42:32 +00:00
2021-02-26 17:26:44 +00:00
if ( empty ( $realpathtoapi )) { // For compatibility with some old modules
2019-05-21 14:16:19 +00:00
$pathtoapi = strtolower ( $module ) . '/class/api_' . strtolower ( $module ) . 's.class.php' ;
2020-08-06 13:55:04 +00:00
$realpathtoapi = $dirread . '/' . $pathtoapi ;
2019-05-21 14:16:19 +00:00
}
2022-03-11 09:55:28 +00:00
$urloflist = dol_buildpath ( '/' . $pathtolist , 1 );
$urlofcard = dol_buildpath ( '/' . $pathtocard , 1 );
2019-05-21 14:16:19 +00:00
2023-03-01 15:40:01 +00:00
$objs = array ();
2022-07-15 12:31:00 +00:00
2025-08-05 00:44:52 +00:00
// Image
$htmltooltip = '' ;
if ( $realpathtopicto && dol_is_file ( $realpathtopicto )) {
$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>' ;
$htmltooltip .= '<br>' ;
} elseif ( ! empty ( $tmpobject )) {
$htmltooltip .= '<span class="fa fa-file-image-o"></span> ' . $langs -> trans ( " Image " ) . ' : ' . img_picto ( '' , $tmpobject -> picto , 'class="pictofixedwidth valignmiddle"' ) . $tmpobject -> picto ;
$htmltooltip .= '<br>' ;
}
$htmltooltip .= '<span class="fa fa-file-image-o"></span> ' . $langs -> trans ( " IsExtraFieldManaged " ) . ' : ' . yn ( empty ( $tmpobject -> isextrafieldmanaged ) ? 0 : 1 , 1 , 2 );
$htmltooltip .= '<br>' ;
$htmltooltip .= '<span class="fa fa-file-image-o"></span> ' . $langs -> trans ( " IsMultiEntityManaged " ) . ' : ' . yn ( empty ( $tmpobject -> ismultientitymanaged ) ? 0 : 1 , 1 , 2 );
$htmltooltip .= '<br>' ;
2022-09-27 11:37:38 +00:00
print '<!-- section for object -->' ;
2021-05-05 17:13:40 +00:00
print '<div class="fichehalfleft smallxxx">' ;
2022-05-01 13:05:25 +00:00
// Main DAO class file
2024-10-28 10:42:35 +00:00
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>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2025-08-05 00:44:52 +00:00
print $form -> textwithpicto ( '' , $htmltooltip , 1 , 'help' , 'valignmiddle' , 1 );
2022-09-27 11:37:38 +00:00
print '<br>' ;
2022-04-12 13:26:21 +00:00
// API file
2017-10-06 00:42:32 +00:00
print '<br>' ;
2024-10-28 10:42:35 +00:00
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>' ;
2023-03-07 15:20:36 +00:00
if ( dol_is_file ( $realpathtoapi )) {
$file = file_get_contents ( $realpathtoapi );
if ( preg_match ( '/var ' . $tabobj . '\s+([^\s]*)\s/ims' , $file , $objs )) {
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>' ;
print ' ' ;
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>' ;
2023-09-09 10:44:38 +00:00
print $form -> textwithpicto ( '' , $langs -> trans ( " InfoForApiFile " ), 1 , 'warning' );
2023-03-07 15:20:36 +00:00
print ' ' ;
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
// Comparing to null (phan considers $modulelowercase can be null here)
2025-02-05 21:59:37 +00:00
if ( ! isModEnabled ( $modulelowercase )) { // If module is not activated
2023-03-07 15:20:36 +00:00
print '<a href="#" class="classfortooltip" target="apiexplorer" title="' . $langs -> trans ( " ModuleMustBeEnabled " , $module ) . '"><strike>' . $langs -> trans ( " ApiExplorer " ) . '</strike></a>' ;
} else {
print '<a href="' . DOL_URL_ROOT . '/api/index.php/explorer/" target="apiexplorer">' . $langs -> trans ( " ApiExplorer " ) . '</a>' ;
}
2021-02-26 17:26:44 +00:00
} else {
2024-03-14 15:39:12 +00:00
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>' ;
2021-02-26 17:26:44 +00:00
}
2020-05-21 07:35:30 +00:00
} else {
2022-10-12 14:17:25 +00:00
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>' ;
2019-05-02 10:03:14 +00:00
}
2019-05-19 14:21:11 +00:00
// PHPUnit
2017-10-06 00:42:32 +00:00
print '<br>' ;
2024-10-28 10:42:35 +00:00
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>' ;
2020-12-27 15:53:15 +00:00
if ( dol_is_file ( $realpathtophpunit )) {
2022-10-12 14:17:25 +00:00
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>' ;
2020-04-05 00:44:59 +00:00
print ' ' ;
2022-10-12 14:17:25 +00:00
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>' ;
2020-05-21 07:35:30 +00:00
} else {
2022-10-12 14:17:25 +00:00
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>' ;
2019-05-19 14:21:11 +00:00
}
2017-10-06 00:42:32 +00:00
print '<br>' ;
print '<br>' ;
2024-10-28 10:42:35 +00:00
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>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2017-10-06 00:42:32 +00:00
print '<br>' ;
2024-10-28 10:42:35 +00:00
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>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2018-12-22 17:22:12 +00:00
print '<br>' ;
2017-10-06 00:42:32 +00:00
print '<br>' ;
2024-10-28 10:42:35 +00:00
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>' ;
2022-10-12 14:17:25 +00:00
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>' ;
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>' ;
2017-10-06 00:42:32 +00:00
//print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
print '<br>' ;
2024-10-28 10:42:35 +00:00
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>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2019-10-24 08:54:25 +00:00
//print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
print '<br>' ;
2025-08-05 00:44:52 +00:00
if ( ! empty ( $tmpobject -> isextrafieldmanaged )) {
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>' ;
if ( dol_is_file ( $realpathtosqlextra ) && dol_is_file ( $realpathtosqlextrakey )) {
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>' ;
print ' ' ;
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>' ;
print ' ' ;
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>' ;
} else {
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>' ;
}
//print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
print '<br>' ;
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>' ;
if ( dol_is_file ( $realpathtosqlextra ) && dol_is_file ( $realpathtosqlextrakey )) {
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>' ;
print ' ' ;
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>' ;
} else {
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>' ;
}
print '<br>' ;
2019-08-28 11:04:22 +00:00
}
2017-10-06 00:42:32 +00:00
print '</div>' ;
2021-05-05 17:13:40 +00:00
print '<div class="fichehalfleft smallxxxx">' ;
2024-10-28 10:42:35 +00:00
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>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2017-10-06 00:42:32 +00:00
print '<br>' ;
2024-10-28 10:42:35 +00:00
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>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2017-10-06 00:42:32 +00:00
print '<br>' ;
2022-05-01 13:05:25 +00:00
// Page contact
2024-10-28 10:42:35 +00:00
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>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2020-12-27 15:53:15 +00:00
if ( dol_is_file ( $realpathtocontact )) {
2019-08-28 11:04:22 +00:00
print ' ' ;
2022-10-12 14:17:25 +00:00
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>' ;
2022-05-01 13:05:25 +00:00
} else {
2022-10-12 14:17:25 +00:00
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>' ;
2019-05-21 14:16:19 +00:00
}
2017-10-06 00:42:32 +00:00
print '<br>' ;
2022-05-01 13:05:25 +00:00
// Page document
2024-10-28 10:42:35 +00:00
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>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2020-12-27 15:53:15 +00:00
if ( dol_is_file ( $realpathtodocument )) {
2019-08-28 11:04:22 +00:00
print ' ' ;
2022-10-12 14:17:25 +00:00
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>' ;
2022-05-01 13:05:25 +00:00
} else {
2022-10-12 14:17:25 +00:00
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>' ;
2019-05-21 14:16:19 +00:00
}
2017-10-06 00:42:32 +00:00
print '<br>' ;
2022-05-01 13:05:25 +00:00
// Page notes
2024-10-28 10:42:35 +00:00
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>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2020-12-27 15:53:15 +00:00
if ( dol_is_file ( $realpathtonote )) {
2019-08-28 11:04:22 +00:00
print ' ' ;
2022-10-12 14:17:25 +00:00
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>' ;
2022-05-01 13:05:25 +00:00
} else {
2022-10-12 14:17:25 +00:00
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>' ;
2019-05-21 14:16:19 +00:00
}
2017-10-06 00:42:32 +00:00
print '<br>' ;
2022-05-01 13:05:25 +00:00
// Page agenda
2024-10-28 10:42:35 +00:00
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>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2020-12-27 15:53:15 +00:00
if ( dol_is_file ( $realpathtoagenda )) {
2020-12-25 10:01:19 +00:00
print ' ' ;
2022-10-12 14:17:25 +00:00
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>' ;
2022-05-01 13:05:25 +00:00
} else {
2022-10-12 14:17:25 +00:00
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>' ;
2020-12-25 10:01:19 +00:00
}
print '<br>' ;
2017-10-06 00:42:32 +00:00
print '<br>' ;
print '</div>' ;
print '<br><br><br>' ;
2022-09-27 11:37:38 +00:00
if ( ! empty ( $tmpobject )) {
2017-10-06 00:42:32 +00:00
$reflector = new ReflectionClass ( $tabobj );
2019-11-13 18:37:08 +00:00
$reflectorproperties = $reflector -> getProperties (); // Can also use get_object_vars
$reflectorpropdefault = $reflector -> getDefaultProperties (); // Can also use get_object_vars
2017-10-06 00:42:32 +00:00
//$propstat = $reflector->getStaticProperties();
2017-10-31 22:10:29 +00:00
//var_dump($reflectorpropdefault);
2017-10-06 00:42:32 +00:00
2020-05-31 20:59:33 +00:00
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2019-03-11 14:58:37 +00:00
print '<input type="hidden" name="action" value="addproperty">' ;
print '<input type="hidden" name="tab" value="objects">' ;
2022-07-15 12:37:35 +00:00
print '<input type="hidden" name="page_y" value="">' ;
2019-11-13 18:37:08 +00:00
print '<input type="hidden" name="module" value="' . dol_escape_htmltag ( $module . ( $forceddirread ? '@' . $dirread : '' )) . '">' ;
2019-03-11 14:58:37 +00:00
print '<input type="hidden" name="tabobj" value="' . dol_escape_htmltag ( $tabobj ) . '">' ;
2018-01-15 16:38:15 +00:00
2020-12-27 15:53:15 +00:00
print '<input class="button smallpaddingimp" type="submit" name="regenerateclasssql" value="' . $langs -> trans ( " RegenerateClassAndSql " ) . '">' ;
2024-10-07 20:54:51 +00:00
print '<br><br class="clearboth">' ;
print '<br class="clearboth">' ;
2018-01-15 16:38:15 +00:00
2023-07-27 23:19:03 +00:00
$mod = strtolower ( $module );
$obj = strtolower ( $tabobj );
2023-07-28 17:41:25 +00:00
$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 ));
2024-03-15 11:50:06 +00:00
$nbOfProperties = count ( $reflectorpropdefault [ 'fields' ]);
2023-07-27 23:19:03 +00:00
2024-10-07 20:54:51 +00:00
print_barre_liste ( $langs -> trans ( " ObjectProperties " ), 0 , $_SERVER [ " PHP_SELF " ], '' , '' , '' , '' , 0 , $nbOfProperties , '' , 0 , $newproperty , 'margintoponly' , 0 , 0 , 0 , 1 );
2017-10-06 00:42:32 +00:00
2023-07-27 23:19:03 +00:00
//var_dump($reflectorpropdefault);exit;
2019-11-01 16:54:17 +00:00
print '<!-- Table with properties of object -->' . " \n " ;
2017-10-06 00:42:32 +00:00
print '<div class="div-table-responsive">' ;
2021-05-05 01:08:34 +00:00
print '<table class="noborder small">' ;
2017-10-06 00:42:32 +00:00
print '<tr class="liste_titre">' ;
2025-08-05 01:00:35 +00:00
if ( ! empty ( $conf -> main_checkbox_left_column )) {
print '<th class="tdstickyright tdstickyghostwhite"></th>' ;
}
2023-10-09 14:46:47 +00:00
print '<th class="tdsticky tdstickygray">' ;
2022-10-12 17:40:21 +00:00
$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>' ;
print $form -> textwithpicto ( $langs -> trans ( " Code " ), $htmltext , 1 , 'help' , 'extracss' , 0 , 3 , 'propertyhelp' );
2018-06-30 12:35:33 +00:00
print '</th>' ;
print '<th>' ;
2017-10-06 00:42:32 +00:00
print $form -> textwithpicto ( $langs -> trans ( " Label " ), $langs -> trans ( " YouCanUseTranslationKey " ));
2018-06-30 12:35:33 +00:00
print '</th>' ;
2022-10-12 17:40:21 +00:00
print '<th>' . $form -> textwithpicto ( $langs -> trans ( " Type " ), $langs -> trans ( " TypeOfFieldsHelpIntro " ) . '<br><br>' . $langs -> trans ( " TypeOfFieldsHelp " ), 1 , 'help' , 'extracss' , 0 , 3 , 'typehelp' ) . '</th>' ;
2018-06-30 12:35:33 +00:00
print '<th>' . $form -> textwithpicto ( $langs -> trans ( " ArrayOfKeyValues " ), $langs -> trans ( " ArrayOfKeyValuesDesc " )) . '</th>' ;
print '<th class="center">' . $form -> textwithpicto ( $langs -> trans ( " NotNull " ), $langs -> trans ( " NotNullDesc " )) . '</th>' ;
print '<th class="center">' . $langs -> trans ( " DefaultValue " ) . '</th>' ;
print '<th class="center">' . $langs -> trans ( " DatabaseIndex " ) . '</th>' ;
2022-10-12 17:57:25 +00:00
print '<th class="center">' . $form -> textwithpicto ( $langs -> trans ( " ForeignKey " ), $langs -> trans ( " ForeignKeyDesc " ), 1 , 'help' , 'extracss' , 0 , 3 , 'foreignkeyhelp' ) . '</th>' ;
2018-06-30 12:35:33 +00:00
print '<th class="right">' . $langs -> trans ( " Position " ) . '</th>' ;
2022-10-12 17:40:21 +00:00
print '<th class="center">' . $form -> textwithpicto ( $langs -> trans ( " Enabled " ), $langs -> trans ( " EnabledDesc " ), 1 , 'help' , 'extracss' , 0 , 3 , 'enabledhelp' ) . '</th>' ;
print '<th class="center">' . $form -> textwithpicto ( $langs -> trans ( " Visibility " ), $langs -> trans ( " VisibleDesc " ) . '<br><br>' . $langs -> trans ( " ItCanBeAnExpression " ), 1 , 'help' , 'extracss' , 0 , 3 , 'visiblehelp' ) . '</th>' ;
2019-11-01 16:54:17 +00:00
print '<th class="center">' . $langs -> trans ( " NotEditable " ) . '</th>' ;
2023-10-13 18:07:39 +00:00
//print '<th class="center">'.$langs->trans("AlwaysEditable").'</th>';
2018-06-30 12:35:33 +00:00
print '<th class="center">' . $form -> textwithpicto ( $langs -> trans ( " SearchAll " ), $langs -> trans ( " SearchAllDesc " )) . '</th>' ;
2019-11-01 16:54:17 +00:00
print '<th class="center">' . $form -> textwithpicto ( $langs -> trans ( " IsAMeasure " ), $langs -> trans ( " IsAMeasureDesc " )) . '</th>' ;
print '<th class="center">' . $langs -> trans ( " CSSClass " ) . '</th>' ;
2020-09-22 07:42:44 +00:00
print '<th class="center">' . $langs -> trans ( " CSSViewClass " ) . '</th>' ;
2021-04-06 16:18:07 +00:00
print '<th class="center">' . $langs -> trans ( " CSSListClass " ) . '</th>' ;
2021-05-04 23:48:21 +00:00
print '<th>' . $langs -> trans ( " KeyForTooltip " ) . '</th>' ;
2019-11-01 16:54:17 +00:00
print '<th class="center">' . $langs -> trans ( " ShowOnCombobox " ) . '</th>' ;
//print '<th class="center">'.$langs->trans("Disabled").'</th>';
2021-07-11 12:05:26 +00:00
print '<th>' . $form -> textwithpicto ( $langs -> trans ( " Validate " ), $langs -> trans ( " ValidateModBuilderDesc " )) . '</th>' ;
2018-06-30 12:35:33 +00:00
print '<th>' . $langs -> trans ( " Comment " ) . '</th>' ;
2025-08-05 01:00:35 +00:00
if ( empty ( $conf -> main_checkbox_left_column )) {
print '<th class="tdstickyright tdstickyghostwhite"></th>' ;
}
2017-10-06 00:42:32 +00:00
print '</tr>' ;
2022-09-27 11:37:38 +00:00
// We must use $reflectorpropdefault['fields'] to get list of fields because $tmpobject->fields may have been
2017-10-31 22:10:29 +00:00
// modified during the constructor and we want value into head of class before constructor is called.
2022-09-27 11:37:38 +00:00
//$properties = dol_sort_array($tmpobject->fields, 'position');
2017-10-31 22:10:29 +00:00
$properties = dol_sort_array ( $reflectorpropdefault [ 'fields' ], 'position' );
2021-02-26 17:26:44 +00:00
if ( ! empty ( $properties )) {
2020-04-03 13:14:59 +00:00
// List of existing properties
2021-02-26 17:26:44 +00:00
foreach ( $properties as $propkey => $propval ) {
2017-10-06 00:42:32 +00:00
/* If from Reflection
2017-12-11 12:50:26 +00:00
if ( $propval -> class == $tabobj )
{
$propname = $propval -> getName ();
$comment = $propval -> getDocComment ();
2022-09-27 11:37:38 +00:00
$type = gettype ( $tmpobject -> $propname );
2017-12-11 12:50:26 +00:00
$default = $propdefault [ $propname ];
// Discard generic properties
if ( in_array ( $propname , array ( 'element' , 'childtables' , 'table_element' , 'table_element_line' , 'class_element_line' , 'ismultientitymanaged' ))) continue ;
// Keep or not lines
if ( in_array ( $propname , array ( 'fk_element' , 'lines' ))) continue ;
} */
2017-09-23 13:12:25 +00:00
2020-01-30 00:48:28 +00:00
$propname = $propkey ;
$proplabel = $propval [ 'label' ];
$proptype = $propval [ 'type' ];
2023-12-04 12:46:42 +00:00
$proparrayofkeyval = ! empty ( $propval [ 'arrayofkeyval' ]) ? $propval [ 'arrayofkeyval' ] : '' ;
2022-11-26 23:44:05 +00:00
$propnotnull = ! empty ( $propval [ 'notnull' ]) ? $propval [ 'notnull' ] : '0' ;
2023-12-04 12:46:42 +00:00
$propdefault = ! empty ( $propval [ 'default' ]) ? $propval [ 'default' ] : '' ;
$propindex = ! empty ( $propval [ 'index' ]) ? $propval [ 'index' ] : '' ;
$propforeignkey = ! empty ( $propval [ 'foreignkey' ]) ? $propval [ 'foreignkey' ] : '' ;
2020-01-30 00:48:28 +00:00
$propposition = $propval [ 'position' ];
$propenabled = $propval [ 'enabled' ];
$propvisible = $propval [ 'visible' ];
2023-12-04 12:46:42 +00:00
$propnoteditable = ! empty ( $propval [ 'noteditable' ]) ? $propval [ 'noteditable' ] : 0 ;
2023-10-13 18:07:39 +00:00
//$propalwayseditable = !empty($propval['alwayseditable'])?$propval['alwayseditable']:0;
2023-12-04 12:46:42 +00:00
$propsearchall = ! empty ( $propval [ 'searchall' ]) ? $propval [ 'searchall' ] : 0 ;
$propisameasure = ! empty ( $propval [ 'isameasure' ]) ? $propval [ 'isameasure' ] : 0 ;
$propcss = ! empty ( $propval [ 'css' ]) ? $propval [ 'css' ] : '' ;
$propcssview = ! empty ( $propval [ 'cssview' ]) ? $propval [ 'cssview' ] : '' ;
$propcsslist = ! empty ( $propval [ 'csslist' ]) ? $propval [ 'csslist' ] : '' ;
$prophelp = ! empty ( $propval [ 'help' ]) ? $propval [ 'help' ] : '' ;
$propshowoncombobox = ! empty ( $propval [ 'showoncombobox' ]) ? $propval [ 'showoncombobox' ] : 0 ;
2019-11-01 16:54:17 +00:00
//$propdisabled=$propval['disabled'];
2023-12-04 12:46:42 +00:00
$propvalidate = ! empty ( $propval [ 'validate' ]) ? $propval [ 'validate' ] : 0 ;
$propcomment = ! empty ( $propval [ 'comment' ]) ? $propval [ 'comment' ] : '' ;
2017-10-06 00:42:32 +00:00
2023-10-13 18:07:39 +00:00
print '<!-- line for object property -->' . " \n " ;
2017-10-06 00:42:32 +00:00
print '<tr class="oddeven">' ;
2025-08-05 01:00:35 +00:00
if ( ! empty ( $conf -> main_checkbox_left_column )) {
if ( $action == 'editproperty' && $propname == $propertykey ) {
print '<td class="center minwidth75 tdstickyright tdstickyghostwhite">' ;
print '<input class="reposition button smallpaddingimp" type="submit" name="edit" value="' . $langs -> trans ( " Save " ) . '">' ;
print '<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="' . $langs -> trans ( " Cancel " ) . '">' ;
print '</td>' ;
} else {
print '<td class="center minwidth75 tdstickyright tdstickyghostwhite">' ;
if ( $propname != 'rowid' ) {
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>' ;
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>' ;
}
print '</td>' ;
}
}
2022-03-11 16:04:23 +00:00
print '<td class="tdsticky tdstickygray">' ;
2020-09-22 07:42:44 +00:00
print dol_escape_htmltag ( $propname );
2017-10-06 00:42:32 +00:00
print '</td>' ;
2021-04-09 07:19:52 +00:00
if ( $action == 'editproperty' && $propname == $propertykey ) {
2023-10-30 16:23:22 +00:00
print '<td>' ;
2021-04-09 09:20:26 +00:00
print '<input type="hidden" name="propname" value="' . dol_escape_htmltag ( $propname ) . '">' ;
2023-10-30 16:23:22 +00:00
print '<input name="proplabel" class="maxwidth125" value="' . dol_escape_htmltag ( $proplabel ) . '">' ;
print '</td>' ;
print '<td class="tdoverflowmax150">' ;
2025-08-06 12:37:01 +00:00
print '<input name="proptype" id="proptype" class="maxwidth125" value="' . dol_escape_htmltag ( $proptype ) . '" list="datalistproptype"></input>' ;
2025-08-04 22:45:00 +00:00
// Use the samedatalist than for create
2025-08-06 12:37:01 +00:00
print '<datalist id="datalistproptype">' ;
2025-08-04 22:45:00 +00:00
print '<option>varchar(128)</option>' ;
print '<option>email</option>' ;
print '<option>phone</option>' ;
print '<option>ip</option>' ;
print '<option>url</option>' ;
print '<option>password</option>' ;
print '<option>text</option>' ;
print '<option>html</option>' ;
print '<option>date</option>' ;
print '<option>datetime</option>' ;
print '<option>integer</option>' ;
print '<option>stars(5)</option>' ;
print '<option>double(28,4)</option>' ;
print '<option>real</option>' ;
print '<option>integer:ClassName:RelativePath/To/ClassFile.class.php[:1[:FILTER]]</option>' ;
// Combo with list of fields
/*
if ( empty ( $formadmin )) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formadmin.class.php' ;
$formadmin = new FormAdmin ( $db );
}
print $formadmin -> selectTypeOfFields ( $key , GETPOST ( $key , 'alpha' ));
*/
print '</datalist>' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
print '<td class="tdoverflowmax200">' ;
2023-10-13 18:07:39 +00:00
print '<textarea name="proparrayofkeyval">' ;
2021-05-04 23:48:21 +00:00
if ( isset ( $proparrayofkeyval )) {
2022-10-12 17:57:25 +00:00
if ( is_array ( $proparrayofkeyval ) || $proparrayofkeyval != '' ) {
print dol_escape_htmltag ( json_encode ( $proparrayofkeyval , JSON_UNESCAPED_UNICODE ));
}
2021-05-04 23:48:21 +00:00
}
2023-10-13 18:07:39 +00:00
print '</textarea>' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
print '<td>' ;
2021-05-04 23:48:21 +00:00
print '<input class="center width50" name="propnotnull" value="' . dol_escape_htmltag ( $propnotnull ) . '">' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
print '<td>' ;
2021-05-04 23:48:21 +00:00
print '<input class="maxwidth50" name="propdefault" value="' . dol_escape_htmltag ( $propdefault ) . '">' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
2021-05-04 23:48:21 +00:00
print '<td class="center">' ;
print '<input class="center maxwidth50" name="propindex" value="' . dol_escape_htmltag ( $propindex ) . '">' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
print '<td>' ;
2022-10-12 17:57:25 +00:00
print '<input class="center maxwidth100" name="propforeignkey" value="' . dol_escape_htmltag ( $propforeignkey ) . '">' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
print '<td>' ;
2021-05-04 23:48:21 +00:00
print '<input class="right width50" name="propposition" value="' . dol_escape_htmltag ( $propposition ) . '">' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
print '<td>' ;
2023-10-13 18:07:39 +00:00
print '<input class="center width75" name="propenabled" value="' . dol_escape_htmltag ( $propenabled ) . '">' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
print '<td>' ;
2023-10-13 18:07:39 +00:00
print '<input class="center width75" name="propvisible" value="' . dol_escape_htmltag ( $propvisible ) . '">' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
print '<td>' ;
2023-10-13 18:07:39 +00:00
print '<input class="center width50" name="propnoteditable" size="2" value="' . dol_escape_htmltag ( $propnoteditable ) . '">' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
2023-10-13 18:07:39 +00:00
/* print '<td>' ;
2022-09-26 23:05:22 +00:00
print '<input class="center" name="propalwayseditable" size="2" value="' . dol_escape_htmltag ( $propalwayseditable ) . '">' ;
2023-10-13 18:07:39 +00:00
print '</td>' ; */
2022-09-26 23:05:22 +00:00
print '<td>' ;
2023-10-13 18:07:39 +00:00
print '<input class="center width50" name="propsearchall" value="' . dol_escape_htmltag ( $propsearchall ) . '">' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
print '<td>' ;
2023-10-13 18:07:39 +00:00
print '<input class="center width50" name="propisameasure" value="' . dol_escape_htmltag ( $propisameasure ) . '">' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
print '<td>' ;
2021-05-04 23:48:21 +00:00
print '<input class="center maxwidth50" name="propcss" value="' . dol_escape_htmltag ( $propcss ) . '">' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
print '<td>' ;
2021-05-04 23:48:21 +00:00
print '<input class="center maxwidth50" name="propcssview" value="' . dol_escape_htmltag ( $propcssview ) . '">' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
print '<td>' ;
2021-05-04 23:48:21 +00:00
print '<input class="center maxwidth50" name="propcsslist" value="' . dol_escape_htmltag ( $propcsslist ) . '">' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
print '<td>' ;
2021-05-04 23:48:21 +00:00
print '<input class="maxwidth100" name="prophelp" value="' . dol_escape_htmltag ( $prophelp ) . '">' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
print '<td>' ;
2021-05-04 23:48:21 +00:00
print '<input class="center maxwidth50" name="propshowoncombobox" value="' . dol_escape_htmltag ( $propshowoncombobox ) . '">' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
print '<td>' ;
2021-07-11 12:05:26 +00:00
print '<input type="number" step="1" min="0" max="1" class="text maxwidth100" name="propvalidate" value="' . dol_escape_htmltag ( $propvalidate ) . '">' ;
print '</td>' ;
print '<td>' ;
2021-05-04 23:48:21 +00:00
print '<input class="maxwidth100" name="propcomment" value="' . dol_escape_htmltag ( $propcomment ) . '">' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
2025-08-05 01:00:35 +00:00
if ( empty ( $conf -> main_checkbox_left_column )) {
print '<td class="center minwidth75 tdstickyright tdstickyghostwhite">' ;
print '<input class="reposition button smallpaddingimp" type="submit" name="edit" value="' . $langs -> trans ( " Save " ) . '">' ;
print '<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="' . $langs -> trans ( " Cancel " ) . '">' ;
print '</td>' ;
}
2021-04-09 07:19:52 +00:00
} else {
2023-10-30 16:23:22 +00:00
print '<td class="tdoverflowmax200" title="' . dol_escape_htmltag ( $proplabel ) . '">' ;
print dol_escape_htmltag ( $proplabel );
print '</td>' ;
2021-04-09 07:19:52 +00:00
print '<td class="tdoverflowmax200">' ;
2023-09-19 17:25:24 +00:00
$pictoType = '' ;
2023-09-20 01:14:48 +00:00
$matches = array ();
if ( preg_match ( '/^varchar/' , $proptype , $matches )) {
$pictoType = 'varchar' ;
} elseif ( preg_match ( '/^integer:/' , $proptype , $matches )) {
$pictoType = 'link' ;
} elseif ( strpos ( $proptype , 'integer' ) === 0 ) {
2023-09-19 17:25:24 +00:00
$pictoType = substr ( $proptype , 0 , 3 );
2023-09-20 01:14:48 +00:00
} elseif ( strpos ( $proptype , 'timestamp' ) === 0 ) {
2023-09-19 17:25:24 +00:00
$pictoType = 'datetime' ;
2023-09-20 01:14:48 +00:00
} elseif ( strpos ( $proptype , 'real' ) === 0 ) {
2023-09-19 17:25:24 +00:00
$pictoType = 'double' ;
2024-10-04 16:37:41 +00:00
} elseif ( strpos ( $proptype , 'stars' ) === 0 ) {
$pictoType = 'stars' ;
2023-09-19 17:25:24 +00:00
}
2023-12-04 12:46:42 +00:00
print ( ! empty ( $pictoType ) ? getPictoForType ( $pictoType ) : getPictoForType ( $proptype )) . '<span title="' . dol_escape_htmltag ( $proptype ) . '">' . dol_escape_htmltag ( $proptype ) . '</span>' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
print '<td class="tdoverflowmax200">' ;
if ( $proparrayofkeyval ) {
2022-03-10 20:31:09 +00:00
print '<span title="' . dol_escape_htmltag ( json_encode ( $proparrayofkeyval , JSON_UNESCAPED_UNICODE )) . '">' ;
print dol_escape_htmltag ( json_encode ( $proparrayofkeyval , JSON_UNESCAPED_UNICODE ));
2021-04-09 07:19:52 +00:00
print '</span>' ;
}
print '</td>' ;
print '<td class="center">' ;
print dol_escape_htmltag ( $propnotnull );
print '</td>' ;
print '<td>' ;
print dol_escape_htmltag ( $propdefault );
print '</td>' ;
print '<td class="center">' ;
print $propindex ? '1' : '' ;
print '</td>' ;
print '<td class="center">' ;
print $propforeignkey ? dol_escape_htmltag ( $propforeignkey ) : '' ;
print '</td>' ;
print '<td class="right">' ;
print dol_escape_htmltag ( $propposition );
print '</td>' ;
2022-10-12 17:57:25 +00:00
print '<td class="center tdoverflowmax100" title="' . ( $propnoteditable ? dol_escape_htmltag ( $propnoteditable ) : '' ) . '">' ;
2021-04-09 07:19:52 +00:00
print $propenabled ? dol_escape_htmltag ( $propenabled ) : '' ;
print '</td>' ;
2022-10-12 17:57:25 +00:00
// Visibility
print '<td class="center tdoverflowmax100" title="' . ( $propvisible ? dol_escape_htmltag ( $propvisible ) : '0' ) . '">' ;
2021-04-09 07:19:52 +00:00
print $propvisible ? dol_escape_htmltag ( $propvisible ) : '0' ;
print '</td>' ;
2022-10-12 17:57:25 +00:00
// Readonly
print '<td class="center tdoverflowmax100" title="' . ( $propnoteditable ? dol_escape_htmltag ( $propnoteditable ) : '' ) . '">' ;
2021-04-09 07:19:52 +00:00
print $propnoteditable ? dol_escape_htmltag ( $propnoteditable ) : '' ;
print '</td>' ;
2023-10-13 18:07:39 +00:00
/* print '<td class="center">' ;
2022-09-26 23:05:22 +00:00
print $propalwayseditable ? dol_escape_htmltag ( $propalwayseditable ) : '' ;
2023-10-13 18:07:39 +00:00
print '</td>' ; */
2022-09-26 23:05:22 +00:00
print '<td class="center">' ;
2021-04-09 07:19:52 +00:00
print $propsearchall ? '1' : '' ;
print '</td>' ;
print '<td class="center">' ;
print $propisameasure ? dol_escape_htmltag ( $propisameasure ) : '' ;
print '</td>' ;
2022-10-12 17:57:25 +00:00
print '<td class="center tdoverflowmax100" title="' . ( $propcss ? dol_escape_htmltag ( $propcss ) : '' ) . '">' ;
2021-04-09 07:19:52 +00:00
print $propcss ? dol_escape_htmltag ( $propcss ) : '' ;
print '</td>' ;
2022-10-12 17:57:25 +00:00
print '<td class="center tdoverflowmax100" title="' . ( $propcssview ? dol_escape_htmltag ( $propcssview ) : '' ) . '">' ;
2021-04-09 07:19:52 +00:00
print $propcssview ? dol_escape_htmltag ( $propcssview ) : '' ;
print '</td>' ;
2022-10-12 17:57:25 +00:00
print '<td class="center tdoverflowmax100" title="' . ( $propcsslist ? dol_escape_htmltag ( $propcsslist ) : '' ) . '">' ;
2021-04-09 07:19:52 +00:00
print $propcsslist ? dol_escape_htmltag ( $propcsslist ) : '' ;
print '</td>' ;
2022-10-12 17:57:25 +00:00
// Key for tooltop
print '<td class="tdoverflowmax150" title="' . ( $prophelp ? dol_escape_htmltag ( $prophelp ) : '' ) . '">' ;
2021-04-09 07:19:52 +00:00
print $prophelp ? dol_escape_htmltag ( $prophelp ) : '' ;
print '</td>' ;
print '<td class="center">' ;
print $propshowoncombobox ? dol_escape_htmltag ( $propshowoncombobox ) : '' ;
print '</td>' ;
/* print '<td class="center">' ;
print $propdisabled ? $propdisabled : '' ;
print '</td>' ; */
2021-07-11 12:05:26 +00:00
print '<td class="center">' ;
print $propvalidate ? dol_escape_htmltag ( $propvalidate ) : '' ;
print '</td>' ;
2021-04-09 07:19:52 +00:00
print '<td class="tdoverflowmax200">' ;
print '<span title="' . dol_escape_htmltag ( $propcomment ) . '">' ;
print dol_escape_htmltag ( $propcomment );
2020-09-22 07:42:44 +00:00
print '</span>' ;
2021-04-09 07:19:52 +00:00
print '</td>' ;
2025-08-05 01:00:35 +00:00
if ( empty ( $conf -> main_checkbox_left_column )) {
print '<td class="center minwidth75 tdstickyright tdstickyghostwhite">' ;
if ( $propname != 'rowid' ) {
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>' ;
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>' ;
}
print '</td>' ;
2021-04-09 07:19:52 +00:00
}
2017-10-06 00:42:32 +00:00
}
print '</tr>' ;
}
2020-05-21 07:35:30 +00:00
} else {
2021-02-26 17:26:44 +00:00
if ( $tab == 'specifications' ) {
if ( $action != 'editfile' || empty ( $file )) {
2020-04-05 00:44:59 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " SpecDefDesc " ) . '</span><br>' ;
print '<br>' ;
$specs = dol_dir_list ( dol_buildpath ( $modulelowercase . '/doc' , 0 ), 'files' , 1 , '(\.md|\.asciidoc)$' , array ( '\/temp\/' ));
2021-02-26 17:26:44 +00:00
foreach ( $specs as $spec ) {
2020-04-05 00:44:59 +00:00
$pathtofile = $modulelowercase . '/doc/' . $spec [ 'relativename' ];
$format = 'asciidoc' ;
2021-02-26 17:26:44 +00:00
if ( preg_match ( '/\.md$/i' , $spec [ 'name' ])) {
$format = 'markdown' ;
}
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " SpecificationFile " ) . ' : <strong class="wordbreak">' . $pathtofile . '</strong>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2020-04-05 00:44:59 +00:00
print '<br>' ;
}
2020-05-21 07:35:30 +00:00
} else {
2020-04-05 00:44:59 +00:00
// Use MD or asciidoc
//print $langs->trans("UseAsciiDocFormat").'<br>';
$fullpathoffile = dol_buildpath ( $file , 0 );
$content = file_get_contents ( $fullpathoffile );
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
print '<input type="hidden" name="module" value="' . $module . '">' ;
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' );
2023-12-04 12:46:42 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'html' ));
2020-04-05 00:44:59 +00:00
print '<br>' ;
print '<center>' ;
2020-11-19 19:23:38 +00:00
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
2020-04-05 00:44:59 +00:00
print ' ' ;
2020-11-23 14:12:52 +00:00
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
2020-04-05 00:44:59 +00:00
print '</center>' ;
print '</form>' ;
}
}
2026-04-10 07:39:48 +00:00
$langs -> load ( " errors " );
print '<tr><td><span class="warning">' . $langs -> trans ( 'ErrorModuleBuilderNoFieldProperty' ) . '</warning></td></tr>' ;
2017-10-06 00:42:32 +00:00
}
print '</table>' ;
2017-09-23 13:12:25 +00:00
print '</div>' ;
2017-10-06 00:42:32 +00:00
print '</form>' ;
2020-05-21 07:35:30 +00:00
} else {
2026-04-10 07:39:48 +00:00
$langs -> load ( " errors " );
print '<span class="warning">' . $langs -> trans ( 'ErrorModuleBuilderFailedToInit' , $tabobj , ( string ) $db ) . '</warning>' ;
2017-10-06 00:42:32 +00:00
}
2021-02-26 17:26:44 +00:00
} catch ( Exception $e ) {
2024-09-05 16:10:24 +00:00
print 'ee' ;
2017-10-06 00:42:32 +00:00
print $e -> getMessage ();
2024-09-05 16:10:24 +00:00
print 'ff' ;
2017-10-06 00:42:32 +00:00
}
2020-05-21 07:35:30 +00:00
} else {
2021-02-26 17:26:44 +00:00
if ( empty ( $forceddirread )) {
2019-11-13 18:37:08 +00:00
$fullpathoffile = dol_buildpath ( $file , 0 );
2020-05-21 07:35:30 +00:00
} else {
2019-11-13 18:37:08 +00:00
$fullpathoffile = $dirread . '/' . $file ;
2017-10-06 00:42:32 +00:00
}
$content = file_get_contents ( $fullpathoffile );
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
print '<input type="hidden" name="tabobj" value="' . dol_escape_htmltag ( $tabobj ) . '">' ;
2019-11-13 18:37:08 +00:00
print '<input type="hidden" name="module" value="' . $module . ( $forceddirread ? '@' . $dirread : '' ) . '">' ;
2017-10-06 00:42:32 +00:00
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' );
2023-12-04 12:46:42 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'html' ));
2017-10-06 00:42:32 +00:00
print '<br>' ;
print '<center>' ;
2020-11-19 19:23:38 +00:00
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
2017-10-06 00:42:32 +00:00
print ' ' ;
2020-11-23 14:12:52 +00:00
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
2017-10-06 00:42:32 +00:00
print '</center>' ;
print '</form>' ;
}
}
2020-10-27 17:19:31 +00:00
print dol_get_fiche_end (); // Level 3
2017-10-06 00:42:32 +00:00
}
2022-05-18 19:54:38 +00:00
if ( $tab == 'dictionaries' ) {
print '<!-- tab=dictionaries -->' . " \n " ;
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
$dicts = $moduleobj -> dictionaries ;
2023-08-10 08:04:17 +00:00
if ( $action == 'deletedict' ) {
$formconfirm = $form -> formconfirm (
2024-03-08 01:52:06 +00:00
$_SERVER [ " PHP_SELF " ] . '?dictionnarykey=' . urlencode (( string ) ( GETPOSTINT ( 'dictionnarykey' ))) . '&tab=' . urlencode (( string ) ( $tab )) . '&module=' . urlencode (( string ) ( $module )),
2023-08-10 08:04:17 +00:00
$langs -> trans ( 'Delete' ),
$langs -> trans ( 'Confirm Delete Dictionnary' , GETPOST ( 'dictionnarykey' , 'alpha' )),
'confirm_deletedictionary' ,
'' ,
0 ,
1
);
print $formconfirm ;
}
2022-05-18 19:54:38 +00:00
if ( $action != 'editfile' || empty ( $file )) {
print '<span class="opacitymedium">' ;
$htmlhelp = $langs -> trans ( " DictionariesDefDescTooltip " , '{s1}' );
$htmlhelp = str_replace ( '{s1}' , '<a target="adminbis" class="nofocusvisible" href="' . DOL_URL_ROOT . '/admin/dict.php">' . $langs -> trans ( 'Setup' ) . ' - ' . $langs -> trans ( 'Dictionaries' ) . '</a>' , $htmlhelp );
print $form -> textwithpicto ( $langs -> trans ( " DictionariesDefDesc " ), $htmlhelp , 1 , 'help' , '' , 0 , 2 , 'helpondesc' ) . '<br>' ;
print '</span>' ;
print '<br>' ;
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " DescriptorFile " ) . ' : <strong class="wordbreak">' . $pathtofile . '</strong>' ;
2024-05-01 16:04:18 +00:00
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>' ;
2022-05-18 19:54:38 +00:00
print '<br>' ;
if ( is_array ( $dicts ) && ! empty ( $dicts )) {
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " LanguageFile " ) . ' :</span> ' ;
2022-05-18 19:54:38 +00:00
print '<strong class="wordbreak">' . $dicts [ 'langs' ] . '</strong>' ;
print '<br>' ;
}
2024-10-28 10:42:35 +00:00
print '<br>' ;
2022-05-18 19:54:38 +00:00
$head3 = array ();
$h = 0 ;
// Dir for module
//$dir = $dirread.'/'.$modulelowercase.'/class';
$head3 [ $h ][ 0 ] = $_SERVER [ " PHP_SELF " ] . '?tab=dictionaries&module=' . $module . ( $forceddirread ? '@' . $dirread : '' ) . '&tabdic=newdictionary' ;
$head3 [ $h ][ 1 ] = '<span class="valignmiddle text-plus-circle">' . $langs -> trans ( " NewDictionary " ) . '</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span>' ;
$head3 [ $h ][ 2 ] = 'newdictionary' ;
$h ++ ;
// Scan for object class files
//$listofobject = dol_dir_list($dir, 'files', 0, '\.class\.php$');
$firstdicname = '' ;
2023-09-08 10:11:52 +00:00
// if (!empty($dicts['tabname'])) {
// foreach ($dicts['tabname'] as $key => $dic) {
// $dicname = $dic;
// $diclabel = $dicts['tablib'][$key];
// if (empty($firstdicname)) {
// $firstdicname = $dicname;
// }
// $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabdic='.$dicname;
// $head3[$h][1] = $diclabel;
// $head3[$h][2] = $dicname;
// $h++;
// }
// }
// if ($h > 1) {
// $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabdic=deletedictionary';
// $head3[$h][1] = $langs->trans("DangerZone");
// $head3[$h][2] = 'deletedictionary';
// $h++;
// }
2022-05-18 19:54:38 +00:00
// If tabobj was not defined, then we check if there is one obj. If yes, we force on it, if no, we will show tab to create new objects.
2023-09-08 10:11:52 +00:00
// if ($tabdic == 'newdicifnodic') {
// if ($firstdicname) {
// $tabdic = $firstdicname;
// } else {
// $tabdic = 'newdictionary';
// }
// }
//print dol_get_fiche_head($head3, $tabdic, '', -1, ''); // Level 3
2022-05-18 19:54:38 +00:00
2023-08-10 08:41:58 +00:00
$newdict = dolGetButtonTitle ( $langs -> trans ( 'NewDictionary' ), '' , 'fa fa-plus-circle' , DOL_URL_ROOT . '/modulebuilder/index.php?tab=dictionaries&module=' . urlencode ( $module ) . '&tabdic=newdictionary' );
2024-11-07 16:31:40 +00:00
print_barre_liste ( $langs -> trans ( " ListOfDictionariesEntries " ), 0 , $_SERVER [ " PHP_SELF " ], '' , '' , '' , '' , 0 , '' , '' , 0 , $newdict , '' , 0 , 0 , 0 , 1 );
2022-05-18 19:54:38 +00:00
2023-09-08 10:11:52 +00:00
if ( $tabdic != 'newdictionary' ) {
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="action" value="addDictionary">' ;
print '<input type="hidden" name="tab" value="dictionaries">' ;
print '<input type="hidden" name="module" value="' . dol_escape_htmltag ( $module ) . '">' ;
print '<input type="hidden" name="tabdic" value="' . dol_escape_htmltag ( $tabdic ) . '">' ;
print '<div class="div-table-responsive">' ;
print '<table class="noborder">' ;
print '<tr class="liste_titre">' ;
print_liste_field_titre ( " # " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder , 'thsticky thstickygrey ' );
print_liste_field_titre ( " Table " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " Label " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " SQL " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " SQLSort " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " FieldsView " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " FieldsEdit " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " FieldsInsert " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " Rowid " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " Condition " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
print " </tr> \n " ;
if ( ! empty ( $dicts ) && is_array ( $dicts ) && ! empty ( $dicts [ 'tabname' ]) && is_array ( $dicts [ 'tabname' ])) {
$i = 0 ;
$maxi = count ( $dicts [ 'tabname' ]);
while ( $i < $maxi ) {
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
if ( $action == 'editdict' && $i == GETPOSTINT ( 'dictionnarykey' ) - 1 ) {
2023-09-08 10:11:52 +00:00
print '<tr class="oddeven">' ;
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="tab" value="dictionaries">' ;
print '<input type="hidden" name="module" value="' . dol_escape_htmltag ( $module ) . '">' ;
print '<input type="hidden" name="action" value="updatedictionary">' ;
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
print '<input type="hidden" name="dictionnarykey" value="' . ( $i + 1 ) . '">' ;
2023-09-08 10:11:52 +00:00
print '<td class="tdsticky tdstickygray">' ;
2023-12-04 12:46:42 +00:00
print ( $i + 1 );
2023-09-08 10:11:52 +00:00
print '</td>' ;
print '<td>' ;
print '<input type="text" name="tabname" value="' . $dicts [ 'tabname' ][ $i ] . '" readonly class="tdstickygray">' ;
print '</td>' ;
print '<td>' ;
print '<input type="text" name="tablib" value="' . $dicts [ 'tablib' ][ $i ] . '">' ;
print '</td>' ;
print '<td>' ;
print '<input type="text" name="tabsql" value="' . $dicts [ 'tabsql' ][ $i ] . '" readonly class="tdstickygray">' ;
print '</td>' ;
print '<td>' ;
print '<select name="tabsqlsort">' ;
print '<option value="' . dol_escape_htmltag ( $dicts [ 'tabsqlsort' ][ $i ]) . '">' . $dicts [ 'tabsqlsort' ][ $i ] . '</option>' ;
print '</select>' ;
print '</td>' ;
2022-05-18 19:54:38 +00:00
2023-09-08 10:11:52 +00:00
print '<td><select name="tabfield" >' ;
print '<option value="' . dol_escape_htmltag ( $dicts [ 'tabfield' ][ $i ]) . '">' . $dicts [ 'tabfield' ][ $i ] . '</option>' ;
print '</select></td>' ;
2022-05-18 19:54:38 +00:00
2023-09-08 10:11:52 +00:00
print '<td><select name="tabfieldvalue" >' ;
print '<option value="' . dol_escape_htmltag ( $dicts [ 'tabfieldvalue' ][ $i ]) . '">' . $dicts [ 'tabfieldvalue' ][ $i ] . '</option>' ;
print '</select></td>' ;
2022-05-18 19:54:38 +00:00
2023-09-08 10:11:52 +00:00
print '<td><select name="tabfieldinsert" >' ;
print '<option value="' . dol_escape_htmltag ( $dicts [ 'tabfieldinsert' ][ $i ]) . '">' . $dicts [ 'tabfieldinsert' ][ $i ] . '</option>' ;
print '</select></td>' ;
2022-05-18 19:54:38 +00:00
2023-09-08 10:11:52 +00:00
print '<td>' ;
print '<input type="text" name="tabrowid" value="' . dol_escape_htmltag ( $dicts [ 'tabrowid' ][ $i ]) . '" readonly class="tdstickygray">' ;
print '</td>' ;
2022-05-18 19:54:38 +00:00
2023-09-08 10:11:52 +00:00
print '<td>' ;
print '<input type="text" name="tabcond" value="' . dol_escape_htmltag (( empty ( $dicts [ 'tabcond' ][ $i ]) ? 'disabled' : 'enabled' )) . '" readonly class="tdstickygray">' ;
print '</td>' ;
2022-05-18 19:54:38 +00:00
2023-10-09 14:46:47 +00:00
print '<td class="center minwidth75 tdstickyright tdstickyghostwhite">' ;
2023-09-08 10:11:52 +00:00
print '<input id ="updatedict" class="reposition button smallpaddingimp" type="submit" name="updatedict" value="' . $langs -> trans ( " Modify " ) . '"/>' ;
print '<br>' ;
print '<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="' . $langs -> trans ( " Cancel " ) . '"/>' ;
print '</td>' ;
2023-08-10 08:04:17 +00:00
2023-09-08 10:11:52 +00:00
print '</form>' ;
print '</tr>' ;
} else {
print '<tr class="oddeven">' ;
2023-08-10 08:04:17 +00:00
2023-09-08 10:11:52 +00:00
print '<td class="tdsticky tdstickygray">' ;
2023-12-04 12:46:42 +00:00
print ( $i + 1 );
2023-09-08 10:11:52 +00:00
print '</td>' ;
2023-08-10 08:04:17 +00:00
2023-09-08 10:11:52 +00:00
print '<td>' ;
print $dicts [ 'tabname' ][ $i ];
print '</td>' ;
2023-08-10 08:04:17 +00:00
2023-09-08 10:11:52 +00:00
print '<td>' ;
print $dicts [ 'tablib' ][ $i ];
print '</td>' ;
2022-05-18 19:54:38 +00:00
2023-09-08 10:11:52 +00:00
print '<td>' ;
print $dicts [ 'tabsql' ][ $i ];
print '</td>' ;
2022-05-18 19:54:38 +00:00
2023-09-08 10:11:52 +00:00
print '<td>' ;
print $dicts [ 'tabsqlsort' ][ $i ];
print '</td>' ;
2022-05-18 19:54:38 +00:00
2023-09-08 10:11:52 +00:00
print '<td>' ;
print $dicts [ 'tabfield' ][ $i ];
print '</td>' ;
2023-08-10 08:04:17 +00:00
2023-09-08 10:11:52 +00:00
print '<td>' ;
print $dicts [ 'tabfieldvalue' ][ $i ];
print '</td>' ;
2023-08-10 08:04:17 +00:00
2023-09-08 10:11:52 +00:00
print '<td>' ;
print $dicts [ 'tabfieldinsert' ][ $i ];
print '</td>' ;
2023-08-10 08:04:17 +00:00
2023-09-08 10:11:52 +00:00
print '<td >' ;
print $dicts [ 'tabrowid' ][ $i ];
print '</td>' ;
2023-08-10 08:04:17 +00:00
2023-09-08 10:11:52 +00:00
print '<td >' ;
print $dicts [ 'tabcond' ][ $i ];
print '</td>' ;
2023-08-10 08:04:17 +00:00
2023-10-09 14:46:47 +00:00
print '<td class="center minwidth75 tdstickyright tdstickyghostwhite">' ;
2024-03-08 01:52:06 +00:00
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>' ;
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>' ;
2023-09-08 10:11:52 +00:00
print '</td>' ;
2023-08-10 08:04:17 +00:00
2023-09-08 10:11:52 +00:00
print '</tr>' ;
}
$i ++ ;
2023-08-10 08:04:17 +00:00
}
2023-09-08 10:11:52 +00:00
} else {
2024-01-25 11:57:19 +00:00
print '<tr><td colspan="11"><span class="opacitymedium">' . $langs -> trans ( " None " ) . '</span></td></tr>' ;
2022-05-18 19:54:38 +00:00
}
2023-09-08 10:11:52 +00:00
print '</table>' ;
print '</div>' ;
2022-05-18 19:54:38 +00:00
2023-09-08 10:11:52 +00:00
print '</form>' ;
}
2022-05-18 19:54:38 +00:00
if ( $tabdic == 'newdictionary' ) {
// New dic tab
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="action" value="initdic">' ;
print '<input type="hidden" name="tab" value="dictionaries">' ;
2023-09-08 10:11:52 +00:00
print '<input type="hidden" name="tabdic" value="' . $tabdic . '">' ;
2022-05-18 19:54:38 +00:00
print '<input type="hidden" name="module" value="' . dol_escape_htmltag ( $module ) . '">' ;
print '<span class="opacitymedium">' . $langs -> trans ( " EnterNameOfDictionaryDesc " ) . '</span><br><br>' ;
2024-03-26 12:22:58 +00:00
print dol_get_fiche_head ();
2023-09-08 10:11:52 +00:00
print '<table class="border centpercent">' ;
print '<tbody>' ;
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>' ;
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>' ;
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>' ;
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>' ;
print '<tr><td class="titlefieldcreate">' . $langs -> trans ( " FieldsView " ) . '</td><td><input type="text" name="field" value="' . dol_escape_htmltag ( GETPOST ( 'field' , 'alpha' )) . '"></td></tr>' ;
print '<tr><td class="titlefieldcreate">' . $langs -> trans ( " FieldsEdit " ) . '</td><td><input type="text" name="fieldvalue" value="' . dol_escape_htmltag ( GETPOST ( 'fieldvalue' , 'alpha' )) . '"></td></tr>' ;
print '<tr><td class="titlefieldcreate">' . $langs -> trans ( " FieldsInsert " ) . '</td><td><input type="text" name="fieldinsert" value="' . dol_escape_htmltag ( GETPOST ( 'fieldinsert' , 'alpha' )) . '"></td></tr>' ;
print '<tr><td class="titlefieldcreate">' . $langs -> trans ( " Rowid " ) . '</td><td><input type="text" name="rowid" value="' . dol_escape_htmltag ( GETPOST ( 'rowid' , 'alpha' )) . '"></td></tr>' ;
print '<tr></tr>' ;
print '</tbody></table>' ;
print '<input type="submit" class="button" name="create" value="' . dol_escape_htmltag ( $langs -> trans ( " GenerateCode " )) . '"' . ( $dirins ? '' : ' disabled="disabled"' ) . '>' ;
print '<input id="cancel" type="submit" class="button" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
print dol_get_fiche_end ();
print '</form>' ;
print ' < script >
$ ( document ) . ready ( function () {
$ ( " input[name= \ 'dicname \ '] " ) . on ( " blur " , function () {
if ( $ ( this ) . val () . length > 0 ) {
$ ( " input[name= \ 'label \ '] " ) . val ( $ ( this ) . val ());
$ ( " input[name= \ 'sql \ '] " ) . val ( " SELECT f.rowid as rowid, f.code, f.label, f.active FROM llx_c_ " + $ ( this ) . val () + " as f " );
$ ( " input[name= \ 'sqlsort \ '] " ) . val ( " label ASC " );
$ ( " input[name= \ 'field \ '] " ) . val ( " code,label " );
$ ( " input[name= \ 'fieldvalue \ '] " ) . val ( " code,label " );
$ ( " input[name= \ 'fieldinsert \ '] " ) . val ( " code,label " );
$ ( " input[name= \ 'rowid \ '] " ) . val ( " rowid " );
} else {
$ ( " input[name= \ 'label \ '] " ) . val ( " " );
$ ( " input[name= \ 'sql \ '] " ) . val ( " " );
$ ( " input[name= \ 'sqlsort \ '] " ) . val ( " " );
$ ( " input[name= \ 'field \ '] " ) . val ( " " );
$ ( " input[name= \ 'fieldvalue \ '] " ) . val ( " " );
$ ( " input[name= \ 'fieldinsert \ '] " ) . val ( " " );
$ ( " input[name= \ 'rowid \ '] " ) . val ( " " );
}
});
$ ( " input[id= \ 'cancel \ '] " ) . click ( function () {
window . history . back ();
});
});
</ script > ' ;
2023-12-13 11:46:23 +00:00
/* print '<br>' ;
print '<br>' ;
print '<br>' ;
print '<span class="opacitymedium">' . $langs -> trans ( " or " ) . '</span>' ;
print '<br>' ;
print '<br>' ;
//print '<input type="checkbox" name="initfromtablecheck"> ';
print $langs -> trans ( " InitStructureFromExistingTable " );
print '<input type="text" name="initfromtablename" value="" placeholder="' . $langs -> trans ( " TableName " ) . '">' ;
print '<input type="submit" class="button smallpaddingimp" name="createtablearray" value="' . dol_escape_htmltag ( $langs -> trans ( " GenerateCode " )) . '"' . ( $dirins ? '' : ' disabled="disabled"' ) . '>' ;
print '<br>' ;
*/
2022-05-18 19:54:38 +00:00
} elseif ( $tabdic == 'deletedictionary' ) {
// Delete dic tab
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2023-08-09 10:42:37 +00:00
print '<input type="hidden" name="action" value="confirm_deletedictionary">' ;
2022-05-18 19:54:38 +00:00
print '<input type="hidden" name="tab" value="dictionaries">' ;
print '<input type="hidden" name="module" value="' . dol_escape_htmltag ( $module ) . '">' ;
2023-08-09 10:42:37 +00:00
print $langs -> trans ( " EnterNameOfDictionnaryToDeleteDesc " ) . '<br><br>' ;
2022-05-18 19:54:38 +00:00
2023-08-09 10:42:37 +00:00
print '<input type="text" name="dicname" value="' . dol_escape_htmltag ( $modulename ) . '" placeholder="' . dol_escape_htmltag ( $langs -> trans ( " DicKey " )) . '">' ;
2022-05-18 19:54:38 +00:00
print '<input type="submit" class="button smallpaddingimp" name="delete" value="' . dol_escape_htmltag ( $langs -> trans ( " Delete " )) . '"' . ( $dirins ? '' : ' disabled="disabled"' ) . '>' ;
print '</form>' ;
}
print dol_get_fiche_end ();
} else {
$fullpathoffile = dol_buildpath ( $file , 0 );
$content = file_get_contents ( $fullpathoffile );
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
print '<input type="hidden" name="module" value="' . $module . '">' ;
2024-08-15 14:57:02 +00:00
$posCursor = ( empty ( $find )) ? array () : array ( 'find' => $find );
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' , 0 , $posCursor );
2023-12-04 12:46:42 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'html' ));
2022-05-18 19:54:38 +00:00
print '<br>' ;
print '<center>' ;
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
print ' ' ;
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
print '</center>' ;
print '</form>' ;
}
}
2021-02-26 17:26:44 +00:00
if ( $tab == 'menus' ) {
2022-04-12 13:51:46 +00:00
print '<!-- tab=menus -->' . " \n " ;
2018-10-31 14:04:01 +00:00
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
2023-02-10 17:02:25 +00:00
$dirins = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrootpath' ];
$destdir = $dirins . '/' . strtolower ( $module );
2023-05-23 15:37:52 +00:00
$listofobject = dol_dir_list ( $destdir . '/class' , 'files' , 0 , '\.class\.php$' );
2024-01-12 19:40:34 +00:00
$objects = dolGetListOfObjectClasses ( $destdir );
2023-03-07 15:07:10 +00:00
2023-05-23 15:37:52 +00:00
$leftmenus = array ();
2017-10-06 00:42:32 +00:00
2019-09-07 12:49:48 +00:00
$menus = $moduleobj -> menu ;
2017-10-06 00:42:32 +00:00
2023-07-17 16:31:00 +00:00
$permissions = $moduleobj -> rights ;
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
$crud = array ( 'read' => 'CRUDRead' , 'write' => 'CRUDCreateWrite' , 'delete' => 'Delete' );
2023-07-17 16:31:00 +00:00
2023-07-18 10:24:16 +00:00
//grouped permissions
$groupedRights = array ();
foreach ( $permissions as $right ) {
$key = $right [ 4 ];
if ( ! isset ( $groupedRights [ $key ])) {
$groupedRights [ $key ] = array ();
}
$groupedRights [ $key ][] = $right ;
}
2023-12-04 12:46:42 +00:00
$groupedRights_json = json_encode ( $groupedRights );
2023-07-18 10:24:16 +00:00
2023-03-13 14:16:06 +00:00
if ( $action == 'deletemenu' ) {
2023-12-04 12:46:42 +00:00
$formconfirms = $form -> formconfirm (
2024-03-08 01:52:06 +00:00
$_SERVER [ " PHP_SELF " ] . '?menukey=' . urlencode (( string ) ( GETPOSTINT ( 'menukey' ))) . '&tab=' . urlencode (( string ) ( $tab )) . '&module=' . urlencode (( string ) ( $module )),
2023-12-04 12:46:42 +00:00
$langs -> trans ( 'Delete' ),
Fix: GETPOST(...,'int') to GETPOSTINT(...) (#28448)
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: Update spelling exceptions
* Qual: Ignore Phan Notice
2024-02-27 13:05:53 +00:00
( $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' ))),
2023-12-04 12:46:42 +00:00
'confirm_deletemenu' ,
'' ,
0 ,
1
);
2023-03-13 14:16:06 +00:00
print $formconfirms ;
}
2021-02-26 17:26:44 +00:00
if ( $action != 'editfile' || empty ( $file )) {
2020-04-05 00:44:59 +00:00
print '<span class="opacitymedium">' ;
2021-08-28 11:56:59 +00:00
$htmlhelp = $langs -> trans ( " MenusDefDescTooltip " , '{s1}' );
$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 );
2020-04-05 00:44:59 +00:00
print $form -> textwithpicto ( $langs -> trans ( " MenusDefDesc " ), $htmlhelp , 1 , 'help' , '' , 0 , 2 , 'helpondesc' ) . '<br>' ;
print '</span>' ;
2017-10-06 00:42:32 +00:00
print '<br>' ;
2024-11-08 14:59:16 +00:00
// Links to editable files
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " DescriptorFile " ) . ' : <strong class="wordbreak">' . $pathtofile . '</strong>' ;
2024-05-01 16:04:18 +00:00
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>' ;
2017-10-06 00:42:32 +00:00
print '<br>' ;
2024-11-08 14:59:16 +00:00
// Search all files of modules mentioned by menu
$listODifferentUrlsInMenu = array ();
foreach ( $menus as $obj ) {
2024-11-10 10:16:23 +00:00
if ( preg_match ( '/^\/' . preg_quote ( strtolower ( $module ), '/' ) . '\//' , $obj [ 'url' ]) && ! empty ( $pathoffile )) {
2024-11-08 14:59:16 +00:00
if ( ! empty ( $listODifferentUrlsInMenu [ $pathoffile ])) { // Test to avoid to show same file twice.
continue ;
}
$pathtofile = $obj [ 'url' ];
$listODifferentUrlsInMenu [ $pathoffile ] = $pathtofile ;
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " PageLinkedByAMenuEntry " ) . ' : <strong class="wordbreak">' . $pathtofile . '</strong>' ;
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>' ;
print '<br>' ;
}
}
2017-10-06 00:42:32 +00:00
print '<br>' ;
2017-11-19 15:26:39 +00:00
print load_fiche_titre ( $langs -> trans ( " ListOfMenusEntries " ), '' , '' );
2017-10-06 00:42:32 +00:00
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2023-05-23 15:37:52 +00:00
print '<input type="hidden" name="action" value="addmenu">' ;
print '<input type="hidden" name="tab" value="menus">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="module" value="' . dol_escape_htmltag ( $module ) . '">' ;
print '<input type="hidden" name="tabobj" value="' . dol_escape_htmltag ( $tabobj ) . '">' ;
2019-09-07 12:49:48 +00:00
print '<div class="div-table-responsive">' ;
2021-05-10 19:28:11 +00:00
print '<table class="noborder small">' ;
2019-09-07 12:49:48 +00:00
2023-10-29 16:36:00 +00:00
$htmltextenabled = '<u>' . $langs -> trans ( " Examples " ) . ':</u><br>' ;
$htmltextenabled .= '1 <span class="opacitymedium">(module always enabled)</span><br>' ;
$htmltextenabled .= '0 <span class="opacitymedium">(module always disabled)</span><br>' ;
$htmltextenabled .= 'isModEnabled(\'' . dol_escape_htmltag ( strtolower ( $module )) . '\') <span class="opacitymedium">(enabled when module is enabled)</span>' ;
$htmltextperms = '<u>' . $langs -> trans ( " Examples " ) . ':</u><br>' ;
$htmltextperms .= '1 <span class="opacitymedium">(access always allowed)</span><br>' ;
$htmltextperms .= '$user->hasright(\'' . dol_escape_htmltag ( strtolower ( $module )) . '\', \'myobject\', \'read\') <span class="opacitymedium">(access allowed if user has permission module->object->read)</span>' ;
2019-09-07 12:49:48 +00:00
print '<tr class="liste_titre">' ;
2023-10-29 15:44:41 +00:00
print_liste_field_titre ( " # " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder , 'center tdsticky tdstickygray ' );
2022-09-07 13:50:40 +00:00
print_liste_field_titre ( " Position " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
2023-02-10 17:02:25 +00:00
print_liste_field_titre ( " Title " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder , 'center' );
2023-10-29 16:36:00 +00:00
print_liste_field_titre ( " LinkToParentMenu " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder , 'minwidth100 ' );
2019-09-08 19:28:17 +00:00
print_liste_field_titre ( " mainmenu " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " leftmenu " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
2022-09-07 13:50:40 +00:00
print_liste_field_titre ( " URL " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder , '' , $langs -> transnoentitiesnoconv ( 'DetailUrl' ));
2019-09-08 19:28:17 +00:00
print_liste_field_titre ( " LanguageFile " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
2022-03-11 15:21:28 +00:00
print_liste_field_titre ( " Position " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder , 'right ' );
2023-10-29 16:36:00 +00:00
print_liste_field_titre ( " Enabled " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder , 'center ' , $langs -> trans ( 'DetailEnabled' ) . '<br><br>' . $htmltextenabled );
print_liste_field_titre ( " Rights " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder , '' , $langs -> trans ( 'DetailRight' ) . '<br><br>' . $htmltextperms );
2022-09-07 13:50:40 +00:00
print_liste_field_titre ( " Target " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder , '' , $langs -> trans ( 'DetailTarget' ));
2023-10-29 16:36:00 +00:00
print_liste_field_titre ( " MenuForUsers " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder , 'center minwidth100 ' , $langs -> trans ( 'DetailUser' ));
2023-05-23 15:37:52 +00:00
print_liste_field_titre ( " " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder , 'center ' , $langs -> trans ( '' ));
2019-09-07 12:49:48 +00:00
print " </tr> \n " ;
2023-10-29 15:44:41 +00:00
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
$r = count ( $menus ) + 1 ;
2023-02-10 17:02:25 +00:00
// for adding menu on module
print '<tr>' ;
2023-10-29 15:44:41 +00:00
print '<td class="center tdsticky tdstickygray"><input type="hidden" readonly class="center maxwidth50" name="propenabled" value="#"></td>' ;
2023-02-10 17:02:25 +00:00
print '<td class="center">' ;
2023-10-09 14:46:47 +00:00
print '<select class="maxwidth50" name="type">' ;
2023-02-10 17:02:25 +00:00
print '<option value="">' . $langs -> trans ( " ........ " ) . '</option><option value="' . dol_escape_htmltag ( " left " ) . '">left</option><option value="' . dol_escape_htmltag ( " top " ) . '">top</option>' ;
print '</select></td>' ;
2023-05-23 15:37:52 +00:00
print '<td class="left"><input type="text" class="left maxwidth100" name="titre" value="' . dol_escape_htmltag ( GETPOST ( 'titre' , 'alpha' )) . '"></td>' ;
print '<td class="left">' ;
print '<select name="fk_menu">' ;
2023-02-10 17:02:25 +00:00
print '<option value="">' . $langs -> trans ( " ........ " ) . '</option>' ;
2023-05-23 15:37:52 +00:00
foreach ( $menus as $obj ) {
if ( $obj [ 'type' ] == 'left' && ! empty ( $obj [ 'leftmenu' ])) {
print " <option value= " . strtolower ( $obj [ 'leftmenu' ]) . " > " . $obj [ 'leftmenu' ] . " </option> " ;
}
2023-02-10 17:02:25 +00:00
}
print '</select>' ;
print '</td>' ;
2023-10-09 14:46:47 +00:00
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>' ;
print '<td class="center"><input id="leftmenu" type="text" class="left maxwidth50" name="leftmenu" value="' . dol_escape_htmltag ( GETPOST ( 'leftmenu' , 'alpha' )) . '"></td>' ;
2023-10-29 16:36:00 +00:00
// URL
print '<td class="left"><input id="url" type="text" class="left maxwidth100" name="url" value="' . dol_escape_htmltag ( GETPOST ( 'url' , 'alpha' )) . '"></td>' ;
2023-10-09 14:46:47 +00:00
print '<td class="left"><input type="text" class="left maxwidth75" name="langs" value="' . strtolower ( $module ) . '@' . strtolower ( $module ) . '" readonly></td>' ;
// Position
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
print '<td class="center"><input type="text" class="center maxwidth50 tdstickygray" name="position" value="' . ( 1000 + $r ) . '" readonly></td>' ;
2023-10-09 14:46:47 +00:00
// Enabled
2023-05-23 15:37:52 +00:00
print '<td class="center">' ;
2023-10-09 14:46:47 +00:00
print '<input type="enabled" class="maxwidth125" value="' . dol_escape_htmltag ( GETPOSTISSET ( 'enabled' ) ? GETPOST ( 'enabled' ) : 'isModEnabled(\'' . $module . '\')' ) . '">' ;
/*
print '<select class="maxwidth" name="enabled">' ;
2023-05-23 15:37:52 +00:00
print '<option value="1" selected>' . $langs -> trans ( " Show " ) . '</option>' ;
print '<option value="0">' . $langs -> trans ( " Hide " ) . '</option>' ;
print '</select>' ;
2023-10-09 14:46:47 +00:00
*/
2023-05-23 15:37:52 +00:00
print '</td>' ;
2023-10-09 14:46:47 +00:00
// Perms
2023-07-18 10:24:16 +00:00
print '<td class="left">' ;
2023-10-09 14:46:47 +00:00
print '<select class="maxwidth" name="objects" id="objects">' ;
2023-07-18 10:24:16 +00:00
print '<option value=""></option>' ;
2023-10-13 13:15:51 +00:00
if ( is_array ( $objects )) {
foreach ( $objects as $value ) {
print '<option value="' . strtolower ( $value ) . '">' . dol_escape_htmltag ( strtolower ( $value )) . '</option>' ;
}
2023-07-17 16:31:00 +00:00
}
2023-05-23 15:37:52 +00:00
print '</select>' ;
2023-10-09 14:46:47 +00:00
print '<select class="maxwidth hideobject" name="perms" id="perms">' ;
2023-05-23 15:37:52 +00:00
print '</select>' ;
print '</td>' ;
2023-02-10 17:02:25 +00:00
print '<td class="center"><input type="text" class="center maxwidth50" name="target" value="' . dol_escape_htmltag ( GETPOST ( 'target' , 'alpha' )) . '"></td>' ;
2023-10-09 14:46:47 +00:00
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>' ;
2023-02-10 17:02:25 +00:00
2023-10-09 14:46:47 +00:00
print '<td class="center minwidth75 tdstickyright tdstickyghostwhite">' ;
2023-02-10 17:02:25 +00:00
print '<input type="submit" class="button" name="add" value="' . $langs -> trans ( " Add " ) . '">' ;
print '</td>' ;
print '</tr>' ;
2023-05-23 15:37:52 +00:00
// end form for add menu
2023-10-09 14:46:47 +00:00
//var_dump($menus);
2023-10-29 15:44:41 +00:00
// Loop on each menu entry
2021-02-26 17:26:44 +00:00
if ( count ( $menus )) {
2022-04-12 13:51:46 +00:00
$i = 0 ;
2021-02-26 17:26:44 +00:00
foreach ( $menus as $menu ) {
2022-04-12 13:51:46 +00:00
$i ++ ;
2023-05-23 15:37:52 +00:00
//for get parent in menu
$string = dol_escape_htmltag ( $menu [ 'fk_menu' ]);
$value = substr ( $string , strpos ( $string , 'fk_leftmenu=' ) + strlen ( 'fk_leftmenu=' ));
2022-04-12 13:51:46 +00:00
2023-02-10 17:02:25 +00:00
$propFk_menu = ! empty ( $menu [ 'fk_menu' ]) ? $menu [ 'fk_menu' ] : GETPOST ( 'fk_menu' );
$propTitre = ! empty ( $menu [ 'titre' ]) ? $menu [ 'titre' ] : GETPOST ( 'titre' );
2023-05-23 15:37:52 +00:00
$propMainmenu = ! empty ( $menu [ 'mainmenu' ]) ? $menu [ 'mainmenu' ] : GETPOST ( 'mainmenu' );
2023-02-10 17:02:25 +00:00
$propLeftmenu = ! empty ( $menu [ 'leftmenu' ]) ? $menu [ 'leftmenu' ] : GETPOST ( 'leftmenu' );
$propUrl = ! empty ( $menu [ 'url' ]) ? $menu [ 'url' ] : GETPOST ( 'url' , 'alpha' );
2023-12-04 12:46:42 +00:00
$propPerms = ! empty ( $menu [ 'perms' ]) ? $menu [ 'perms' ] : GETPOST ( 'perms' );
2023-02-10 17:02:25 +00:00
$propUser = ! empty ( $menu [ 'user' ]) ? $menu [ 'user' ] : GETPOST ( 'user' );
$propTarget = ! empty ( $menu [ 'target' ]) ? $menu [ 'target' ] : GETPOST ( 'target' );
2023-07-19 11:12:39 +00:00
$propEnabled = ! empty ( $menu [ 'enabled' ]) ? $menu [ 'enabled' ] : GETPOST ( 'enabled' );
2023-07-17 16:31:00 +00:00
2023-10-09 14:46:47 +00:00
$objPerms = ( empty ( $arguments [ 1 ]) ? '' : trim ( $arguments [ 1 ]));
$valPerms = ( empty ( $arguments [ 2 ]) ? '' : trim ( $arguments [ 2 ]));
//$tabobject = ''; // We can't know what is $tabobject in most cases
2023-07-17 16:31:00 +00:00
Fix: GETPOST(...,'int') to GETPOSTINT(...) (#28448)
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: Update spelling exceptions
* Qual: Ignore Phan Notice
2024-02-27 13:05:53 +00:00
if ( $action == 'editmenu' && GETPOSTINT ( 'menukey' ) == $i ) {
2023-07-17 16:31:00 +00:00
//var_dump($propPerms);exit;
2023-02-10 17:02:25 +00:00
print '<tr class="oddeven">' ;
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2023-10-29 15:44:41 +00:00
print '<input type="hidden" name="action" value="update_menu">' ;
2023-02-10 17:02:25 +00:00
print '<input type="hidden" name="tab" value="menus">' ;
print '<input type="hidden" name="module" value="' . dol_escape_htmltag ( $module ) . '">' ;
2023-10-29 16:36:00 +00:00
print '<input type="hidden" name="menukey" value="' . $i . '"/>' ;
2023-10-09 14:46:47 +00:00
//print '<input type="hidden" name="tabobject" value="'.dol_escape_htmltag($tabobject).'">';
2023-02-10 17:02:25 +00:00
print '<td class="tdsticky tdstickygray">' ;
print $i ;
print '</td>' ;
2023-10-29 16:36:00 +00:00
// Position (top, left)
2023-02-10 17:02:25 +00:00
print ' < td class = " center " >
< select class = " center maxwidth50 " name = " type " >
< option value = " '.dol_escape_htmltag( $menu['type'] ).' " >
'.dol_escape_htmltag($menu[' type ']).'
</ option > ' ;
2023-12-04 12:46:42 +00:00
print '<option value="' . ( $menu [ 'type' ] == 'left' ? 'top' : 'left' ) . '">' ;
2023-02-10 17:02:25 +00:00
if ( $menu [ 'type' ] == 'left' ) {
print 'top' ;
} else {
print 'left' ;
}
2023-05-23 15:37:52 +00:00
print '</option></select></td>' ;
2023-10-29 16:36:00 +00:00
// Title
print '<td><input type="text" class="left maxwidth100" name="titre" value="' . dol_escape_htmltag ( $propTitre ) . '"></td>' ;
// Parent menu
print '<td>' ;
/* print '<select name="fk_menu" class="left maxwidth">' ;
2023-05-23 15:37:52 +00:00
print '<option value="' . dol_escape_htmltag ( $propFk_menu ) . '">' . dol_escape_htmltag ( $value ) . '</option>' ;
foreach ( $menus as $obj ) {
if ( $obj [ 'type' ] == 'left' && $obj [ 'leftmenu' ] != $value && $obj [ 'leftmenu' ] != $menu [ 'leftmenu' ]) {
print " <option value= " . strtolower ( $obj [ 'leftmenu' ]) . " > " . $obj [ 'leftmenu' ] . " </option> " ;
}
}
2023-10-29 16:36:00 +00:00
print '</select>' ; */
print '<input type="text" name="fk_menu" class="maxwidth150" value="' . dol_escape_htmltag ( $propFk_menu ) . '">' ;
2023-05-23 15:37:52 +00:00
print '</td>' ;
2023-10-29 16:36:00 +00:00
print '<td><input type="text" class="left maxwidth50" name="mainmenu" value="' . dol_escape_htmltag ( $propMainmenu ) . '" readonly></td>' ;
print '<td><input type="text" class="left maxwidth50" name="leftmenu" value="' . dol_escape_htmltag ( $propLeftmenu ) . '" readonly></td>' ;
// URL
print '<td><input type="text" class="left maxwidth250" name="url" value="' . dol_escape_htmltag ( $propUrl ) . '"></td>' ;
print '<td><input type="text" class="left maxwidth50" name="langs" value="' . strtolower ( $module ) . '@' . strtolower ( $module ) . '" readonly></td>' ;
2023-10-09 14:46:47 +00:00
// Position
print '<td class="center"><input type="text" class="center maxwidth50 tdstickygray" name="position" value="' . ( $menu [ 'position' ]) . '" readonly></td>' ;
// Enabled
print '<td class="nowraponall">' ;
2023-10-29 15:44:41 +00:00
print '<input type="text" class="maxwidth125" name="enabled" value="' . dol_escape_htmltag ( $propEnabled != '' ? $propEnabled : " isModEnabled(' " . dol_escape_htmltag ( $module ) . " ') " ) . '">' ;
2023-10-09 14:46:47 +00:00
$htmltext = '<u>' . $langs -> trans ( " Examples " ) . ':</u><br>' ;
$htmltext .= '1 <span class="opacitymedium">(always enabled)</span><br>' ;
$htmltext .= '0 <span class="opacitymedium">(always disabled)</span><br>' ;
$htmltext .= 'isModEnabled(\'' . dol_escape_htmltag ( $module ) . '\') <span class="opacitymedium">(enabled when module is enabled)</span><br>' ;
print $form -> textwithpicto ( '' , $htmltext );
/*
print '<select class="maxwidth50" name="enabledselect">' ;
print '<option value="1">1 (always enabled)</option>' ;
print '<option value="0">0 (always disabled)</option>' ;
print '<option value="isModEnabled(\'' . dol_escape_htmltag ( $module ) . '\')" >isModEnabled(\'' . dol_escape_htmltag ( $module ) . '\')</option>' ;
2023-05-23 15:37:52 +00:00
print '</select>' ;
2023-10-09 14:46:47 +00:00
*/
2023-05-23 15:37:52 +00:00
print '</td>' ;
2023-10-09 14:46:47 +00:00
// Permissions
2023-10-29 16:36:00 +00:00
print '<td class="nowraponall">' ;
2023-10-09 14:46:47 +00:00
print '<input type="text" name="perms" value="' . dol_escape_htmltag ( $propPerms ) . '">' ;
/*
2023-07-19 09:57:13 +00:00
if ( ! empty ( $objPerms )) {
print '<input type="hidden" name="objects" value="' . $objPerms . '" />' ;
2023-10-09 14:46:47 +00:00
print '<select class="center maxwidth50" name="perms">' ;
if ( ! empty ( $valPerms )) {
print '<option selected value="' . dol_escape_htmltag ( $valPerms ) . '">' . dol_escape_htmltag ( $langs -> trans ( $crud [ $valPerms ])) . '</option>' ;
foreach ( $crud as $key => $val ) {
if ( $valPerms != $key ) {
print '<option value="' . dol_escape_htmltag ( $key ) . '">' . dol_escape_htmltag ( $langs -> trans ( $val )) . '</option>' ;
}
2023-07-19 09:57:13 +00:00
}
2023-07-17 16:31:00 +00:00
}
2023-07-19 09:57:13 +00:00
print '</select>' ;
2023-05-23 15:37:52 +00:00
} else {
2023-10-09 14:46:47 +00:00
print '<select class="center maxwidth50" name="objects">' ;
2023-07-19 09:57:13 +00:00
print '<option></option>' ;
foreach ( $objects as $obj ) {
print '<option value="' . dol_escape_htmltag ( strtolower ( $obj )) . '">' . dol_escape_htmltag ( $obj ) . '</option>' ;
}
print '</select>' ;
2023-10-09 14:46:47 +00:00
print '<select class="center maxwidth50" name="perms">' ;
2023-07-19 09:57:13 +00:00
foreach ( $crud as $key => $val ) {
print '<option value="' . dol_escape_htmltag ( $key ) . '">' . dol_escape_htmltag ( $key ) . '</option>' ;
}
print '</select>' ;
2023-10-09 14:46:47 +00:00
} */
2023-05-23 15:37:52 +00:00
print '</td>' ;
2023-10-29 15:44:41 +00:00
// Target
2023-02-10 17:02:25 +00:00
print '<td class="center"><input type="text" class="center maxwidth50" name="target" value="' . dol_escape_htmltag ( $propTarget ) . '"></td>' ;
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>' ;
2023-10-09 14:46:47 +00:00
print '<td class="center minwidth75 tdstickyright tdstickyghostwhite maxwidth75">' ;
2023-02-10 17:02:25 +00:00
print '<input class="reposition button smallpaddingimp" type="submit" name="edit" value="' . $langs -> trans ( " Modify " ) . '">' ;
print '<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="' . $langs -> trans ( " Cancel " ) . '">' ;
print '</td>' ;
print '</form>' ;
print '</tr>' ;
2022-09-07 13:50:40 +00:00
} else {
2023-02-10 17:02:25 +00:00
print '<tr class="oddeven">' ;
print '<td class="tdsticky tdstickygray">' ;
print $i ;
print '</td>' ;
2023-10-29 16:36:00 +00:00
print '<td class="center">' ;
2023-02-10 17:02:25 +00:00
print dol_escape_htmltag ( $menu [ 'type' ]);
print '</td>' ;
2023-10-29 16:36:00 +00:00
// Title
2023-02-10 17:02:25 +00:00
print '<td>' ;
2023-05-23 15:37:52 +00:00
print dol_escape_htmltag ( $menu [ 'titre' ]);
2023-02-10 17:02:25 +00:00
print '</td>' ;
2023-10-29 16:36:00 +00:00
// Parent menu
print '<td class="tdoverflowmax100" title="' . dol_escape_htmltag ( $menu [ 'fk_menu' ]) . '">' ;
print dol_escape_htmltag ( $menu [ 'fk_menu' ]);
2023-02-10 17:02:25 +00:00
print '</td>' ;
print '<td>' ;
print dol_escape_htmltag ( $menu [ 'mainmenu' ]);
print '</td>' ;
print '<td>' ;
print dol_escape_htmltag ( $menu [ 'leftmenu' ]);
print '</td>' ;
2023-10-29 16:36:00 +00:00
print '<td class="tdoverflowmax250" title="' . dol_escape_htmltag ( $menu [ 'url' ]) . '">' ;
2023-02-10 17:02:25 +00:00
print dol_escape_htmltag ( $menu [ 'url' ]);
print '</td>' ;
print '<td>' ;
print dol_escape_htmltag ( $menu [ 'langs' ]);
print '</td>' ;
2023-10-09 14:46:47 +00:00
// Position
2023-02-10 17:02:25 +00:00
print '<td class="center">' ;
2024-11-04 22:53:20 +00:00
print dol_escape_htmltag (( string ) $menu [ 'position' ]);
2023-02-10 17:02:25 +00:00
print '</td>' ;
2023-10-09 14:46:47 +00:00
// Enabled
2023-10-29 15:44:41 +00:00
print '<td class="tdoverflowmax200" title="' . dol_escape_htmltag ( $menu [ 'enabled' ]) . '">' ;
2023-10-09 14:46:47 +00:00
print dol_escape_htmltag ( $menu [ 'enabled' ]);
2023-02-10 17:02:25 +00:00
print '</td>' ;
2023-10-09 14:46:47 +00:00
// Perms
2023-10-29 15:44:41 +00:00
print '<td class="tdoverflowmax200" title="' . dol_escape_htmltag ( $menu [ 'perms' ]) . '">' ;
print dol_escape_htmltag ( $langs -> trans ( $menu [ 'perms' ]));
2023-02-10 17:02:25 +00:00
print '</td>' ;
2023-10-29 15:44:41 +00:00
// Target
2023-02-10 17:02:25 +00:00
print '<td class="center tdoverflowmax200" title="' . dol_escape_htmltag ( $menu [ 'target' ]) . '">' ;
print dol_escape_htmltag ( $menu [ 'target' ]);
print '</td>' ;
print '<td class="center">' ;
if ( $menu [ 'user' ] == 2 ) {
print $langs -> trans ( " AllMenus " );
} elseif ( $menu [ 'user' ] == 0 ) {
print $langs -> trans ( 'Internal' );
} elseif ( $menu [ 'user' ] == 1 ) {
print $langs -> trans ( 'External' );
} else {
print $menu [ 'user' ]; // should not happen
}
print '</td>' ;
2023-10-09 14:46:47 +00:00
print '<td class="center minwidth75 tdstickyright tdstickyghostwhite">' ;
2023-05-23 15:37:52 +00:00
if ( $menu [ 'titre' ] != 'Module' . $module . 'Name' ) {
2024-03-08 01:52:06 +00:00
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>' ;
2024-04-18 00:21:42 +00:00
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>' ;
2023-02-10 17:02:25 +00:00
}
print '</td>' ;
2022-09-07 13:50:40 +00:00
}
2019-09-09 09:23:53 +00:00
print '</tr>' ;
}
2020-05-21 07:35:30 +00:00
} else {
2024-01-25 12:50:01 +00:00
print '<tr><td colspan="14"><span class="opacitymedium">' . $langs -> trans ( " None " ) . '</span></td></tr>' ;
2019-09-09 09:23:53 +00:00
}
2017-12-11 12:50:26 +00:00
2019-09-09 09:23:53 +00:00
print '</table>' ;
print '</div>' ;
print '</form>' ;
2023-10-29 15:44:41 +00:00
2023-07-18 10:24:16 +00:00
print ' < script >
$ ( document ) . ready ( function () {
2023-07-19 10:43:11 +00:00
//for fill in auto url
$ ( " #leftmenu " ) . on ( " input " , function () {
var inputLeftMenu = $ ( " #leftmenu " ) . val ();
2023-10-29 15:44:41 +00:00
if ( inputLeftMenu !== \ ' \ ' ) {
var url = \ '' . dol_escape_js ( strtolower ( $module )) . ' \ ' + inputLeftMenu + \ ' . php\ ' ;
2023-07-19 11:12:39 +00:00
$ ( " #url " ) . val ( url );
} else {
$ ( " #url " ) . val ( " " );
}
2023-07-19 10:43:11 +00:00
});
2023-07-18 10:24:16 +00:00
var groupedRights = ' . $groupedRights_json . ' ;
var objectsSelect = $ ( " select[id= \ 'objects \ '] " );
var permsSelect = $ ( " select[id= \ 'perms \ '] " );
2023-09-08 19:34:54 +00:00
2023-07-18 10:24:16 +00:00
objectsSelect . change ( function () {
var selectedObject = $ ( this ) . val ();
2023-09-08 19:34:54 +00:00
2023-07-18 10:24:16 +00:00
permsSelect . empty ();
2023-09-08 19:34:54 +00:00
2023-07-18 10:24:16 +00:00
var rights = groupedRights [ selectedObject ];
2023-09-08 19:34:54 +00:00
2023-07-18 10:24:16 +00:00
if ( rights ) {
for ( var i = 0 ; i < rights . length ; i ++ ) {
var right = rights [ i ];
var option = $ ( " <option></option> " ) . attr ( " value " , right [ 5 ]) . text ( right [ 5 ]);
permsSelect . append ( option );
}
} else {
var option = $ ( " <option></option> " ) . attr ( " value " , " read " ) . text ( " read " );
permsSelect . append ( option );
}
2023-09-08 19:34:54 +00:00
2023-07-18 10:24:16 +00:00
if ( selectedObject !== " " && selectedObject !== null && rights ) {
permsSelect . show ();
} else {
permsSelect . hide ();
}
if ( objectsSelect . val () === " " || objectsSelect . val () === null ) {
permsSelect . hide ();
}
});
});
2023-10-29 15:44:41 +00:00
</ script > ' ;
2023-07-19 10:43:11 +00:00
2023-12-13 11:46:23 +00:00
// display permissions for each object
2020-05-21 07:35:30 +00:00
} else {
2019-11-13 18:37:08 +00:00
$fullpathoffile = dol_buildpath ( $file , 0 );
2017-06-10 21:50:02 +00:00
2017-10-06 00:42:32 +00:00
$content = file_get_contents ( $fullpathoffile );
2017-06-10 21:50:02 +00:00
2017-10-06 00:42:32 +00:00
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
print '<input type="hidden" name="module" value="' . $module . '">' ;
2017-09-22 23:24:31 +00:00
2024-08-15 14:57:02 +00:00
$posCursor = ( empty ( $find )) ? array () : array ( 'find' => $find );
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' , 0 , $posCursor );
2023-12-04 12:46:42 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'html' ));
2017-10-06 00:42:32 +00:00
print '<br>' ;
print '<center>' ;
2020-11-19 19:23:38 +00:00
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
2017-10-06 00:42:32 +00:00
print ' ' ;
2020-11-23 14:12:52 +00:00
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
2017-10-06 00:42:32 +00:00
print '</center>' ;
2017-09-22 23:24:31 +00:00
2017-10-06 00:42:32 +00:00
print '</form>' ;
}
}
2017-09-22 23:24:31 +00:00
2021-02-26 17:26:44 +00:00
if ( $tab == 'permissions' ) {
2022-04-12 13:51:46 +00:00
print '<!-- tab=permissions -->' . " \n " ;
2018-10-31 14:04:01 +00:00
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
2017-09-22 23:24:31 +00:00
2019-09-07 12:49:48 +00:00
$perms = $moduleobj -> rights ;
2017-09-22 23:24:31 +00:00
2023-03-07 15:07:10 +00:00
// Get list of existing objects
2023-02-03 13:33:33 +00:00
$dir = $dirread . '/' . $modulelowercase . '/class' ;
$listofobject = dol_dir_list ( $dir , 'files' , 0 , '\.class\.php$' );
$objects = array ( 'myobject' );
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
$reg = array ();
2023-02-03 13:33:33 +00:00
foreach ( $listofobject as $fileobj ) {
$tmpcontent = file_get_contents ( $fileobj [ 'fullname' ]);
if ( preg_match ( '/class\s+([^\s]*)\s+extends\s+CommonObject/ims' , $tmpcontent , $reg )) {
2023-03-07 15:07:10 +00:00
$objects [ $fileobj [ 'fullname' ]] = $reg [ 1 ];
2023-02-03 13:33:33 +00:00
}
}
2023-03-07 15:07:10 +00:00
2023-02-03 13:33:33 +00:00
// declared select list for actions and labels permissions
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
$crud = array ( 'read' => 'CRUDRead' , 'write' => 'CRUDCreateWrite' , 'delete' => 'Delete' );
2023-03-07 14:51:27 +00:00
$labels = array ( " Read objects of " . $module , " Create/Update objects of " . $module , " Delete objects of " . $module );
2023-02-03 13:33:33 +00:00
$action = GETPOST ( 'action' , 'alpha' );
if ( $action == 'deleteright' ) {
$formconfirm = $form -> formconfirm (
2024-03-08 01:52:06 +00:00
$_SERVER [ " PHP_SELF " ] . '?permskey=' . urlencode (( string ) ( GETPOSTINT ( 'permskey' ))) . '&tab=' . urlencode (( string ) ( $tab )) . '&module=' . urlencode (( string ) ( $module )) . '&tabobj=' . urlencode (( string ) ( $tabobj )),
2023-02-03 13:33:33 +00:00
$langs -> trans ( 'Delete' ),
$langs -> trans ( 'Confirm Delete Right' , GETPOST ( 'permskey' , 'alpha' )),
'confirm_deleteright' ,
'' ,
0 ,
1
);
print $formconfirm ;
}
2021-02-26 17:26:44 +00:00
if ( $action != 'editfile' || empty ( $file )) {
2023-07-31 20:40:17 +00:00
print '<!-- Tab to manage permissions -->' . " \n " ;
2020-04-05 00:44:59 +00:00
print '<span class="opacitymedium">' ;
2026-04-27 02:55:29 +00:00
$htmlhelp = $langs -> trans ( " PermissionsDefDescTooltip " );
//$htmlhelp = $langs->trans("PermissionsDefDescTooltip", '{s1}');
//$htmlhelp = str_replace('{s1}', '<a target="adminbis" class="nofocusvisible" href="'.DOL_URL_ROOT.'/admin/perms.php">'.$langs->trans('DefaultRights').'</a>', $htmlhelp);
2020-04-05 00:44:59 +00:00
print $form -> textwithpicto ( $langs -> trans ( " PermissionsDefDesc " ), $htmlhelp , 1 , 'help' , '' , 0 , 2 , 'helpondesc' ) . '<br>' ;
print '</span>' ;
2017-10-06 00:42:32 +00:00
print '<br>' ;
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " DescriptorFile " ) . ' : <strong class="wordbreak">' . $pathtofile . '</strong>' ;
2024-05-01 16:04:18 +00:00
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>' ;
2017-10-06 00:42:32 +00:00
print '<br>' ;
print '<br>' ;
print load_fiche_titre ( $langs -> trans ( " ListOfPermissionsDefined " ), '' , '' );
2023-10-13 14:38:51 +00:00
print '<!-- form to add permissions -->' . " \n " ;
2017-10-06 00:42:32 +00:00
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2023-02-21 12:10:13 +00:00
print '<input type="hidden" name="action" value="addright">' ;
print '<input type="hidden" name="tab" value="permissions">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="module" value="' . dol_escape_htmltag ( $module ) . '">' ;
print '<input type="hidden" name="tabobj" value="' . dol_escape_htmltag ( $tabobj ) . '">' ;
2017-09-22 23:24:31 +00:00
2019-09-07 12:49:48 +00:00
print '<div class="div-table-responsive">' ;
print '<table class="noborder">' ;
2017-12-11 12:50:26 +00:00
2019-09-07 12:49:48 +00:00
print '<tr class="liste_titre">' ;
2023-02-03 13:33:33 +00:00
print_liste_field_titre ( " ID " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder , " center " );
2023-06-12 12:16:09 +00:00
print_liste_field_titre ( " Object " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder , " center " );
2023-07-31 20:40:17 +00:00
print_liste_field_titre ( " CRUD " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder , " center " );
2023-06-12 12:16:09 +00:00
print_liste_field_titre ( " Label " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder , " center " );
2023-02-03 13:33:33 +00:00
print_liste_field_titre ( " " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder , " center " );
2019-09-07 12:49:48 +00:00
print " </tr> \n " ;
2017-12-11 12:50:26 +00:00
2023-02-03 13:33:33 +00:00
//form for add new right
2023-03-07 14:51:27 +00:00
print '<tr class="small">' ;
2023-07-31 20:40:17 +00:00
print '<td><input type="hidden" readonly name="id" class="width75" value="0"></td>' ;
2023-02-03 13:33:33 +00:00
2023-07-31 20:40:17 +00:00
print '<td><select class="minwidth100" name="permissionObj" id="permissionObj">' ;
2023-02-03 13:33:33 +00:00
print '<option value=""></option>' ;
foreach ( $objects as $obj ) {
if ( $obj != 'myobject' ) {
print '<option value="' . $obj . '">' . $obj . '</option>' ;
}
}
print '</select></td>' ;
2023-10-13 14:38:51 +00:00
print '<td><select class="maxwidth75" name="crud" id="crud">' ;
2023-07-31 20:40:17 +00:00
print '<option value=""></option>' ;
foreach ( $crud as $key => $val ) {
print '<option value="' . $key . '">' . $langs -> trans ( $val ) . '</option>' ;
}
print '</td>' ;
2023-06-12 12:16:09 +00:00
print '<td >' ;
2023-07-31 20:40:17 +00:00
print '<input type="text" name="label" id="label" class="minwidth200">' ;
2023-02-03 13:33:33 +00:00
print '</td>' ;
2023-10-09 14:46:47 +00:00
print '<td class="center minwidth75 tdstickyright tdstickyghostwhite">' ;
2023-02-03 13:33:33 +00:00
print '<input type="submit" class="button" name="add" value="' . $langs -> trans ( " Add " ) . '">' ;
print '</td>' ;
print '</tr>' ;
2021-02-26 17:26:44 +00:00
if ( count ( $perms )) {
2023-02-03 13:33:33 +00:00
$i = 0 ;
2021-02-26 17:26:44 +00:00
foreach ( $perms as $perm ) {
2023-02-03 13:33:33 +00:00
$i ++ ;
2023-06-12 12:16:09 +00:00
// section for editing right
Fix: GETPOST(...,'int') to GETPOSTINT(...) (#28448)
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: Update spelling exceptions
* Qual: Ignore Phan Notice
2024-02-27 13:05:53 +00:00
if ( $action == 'edit_right' && $perm [ 0 ] == GETPOSTINT ( 'permskey' )) {
2023-06-12 12:16:09 +00:00
print '<tr class="oddeven">' ;
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST" name="modifPerms">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="tab" value="permissions">' ;
print '<input type="hidden" name="module" value="' . dol_escape_htmltag ( $module ) . '">' ;
print '<input type="hidden" name="tabobj" value="' . dol_escape_htmltag ( $tabobj ) . '">' ;
print '<input type="hidden" name="action" value="update_right">' ;
print '<input type="hidden" name="counter" value="' . $i . '">' ;
print '<input type="hidden" name="permskey" value="' . $perm [ 0 ] . '">' ;
print '<td class="tdsticky tdstickygray">' ;
print '<input class="width75" type="text" readonly value="' . dol_escape_htmltag ( $perm [ 0 ]) . '"/>' ;
print '</td>' ;
print '<td>' ;
print '<select name="crud">' ;
print '<option value="' . dol_escape_htmltag ( $perm [ 5 ]) . '">' . $langs -> trans ( $perm [ 5 ]) . '</option>' ;
Qual: Enable detection of deprecated modulename & GETPOST(...,'int') (#28457)
* Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
# Qual: Enable detection of deprecated modulename & GETPOST(...,'int')
Enable phan rules to verify deprecated modulename usage and GETPOST(...,'int')
usage in the code.
* Qual: Try type hint on to help avoid notification
* Qual: Accept 3 parameters for GETPOST to GETPOSTINT conversion
* Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
# Qual: Convert GETPOST(...,'int',VALUE) to GETPOSTINT(...,VALUE)
Following the update to the fixer to also convert GETPOST... with 3 parameters.
The files are now converted.
2024-02-28 22:25:16 +00:00
foreach ( $crud as $i => $x ) {
2023-06-12 12:16:09 +00:00
if ( $perm [ 5 ] != $i ) {
print '<option value="' . $i . '">' . $langs -> trans ( ucfirst ( $x )) . '</option>' ;
2023-02-03 13:33:33 +00:00
}
2023-06-12 12:16:09 +00:00
}
print '</select>' ;
print '</td>' ;
2023-02-03 13:33:33 +00:00
2023-06-12 12:16:09 +00:00
print '<td><select name="permissionObj" >' ;
print '<option value="' . dol_escape_htmltag ( $perm [ 4 ]) . '">' . ucfirst ( $perm [ 4 ]) . '</option>' ;
print '</select></td>' ;
2023-02-03 13:33:33 +00:00
2023-06-12 12:16:09 +00:00
print '<td>' ;
print '<input type="text" name="label" value="' . dol_escape_htmltag ( $perm [ 1 ]) . '">' ;
print '</td>' ;
2023-10-09 14:46:47 +00:00
print '<td class="center minwidth75 tdstickyright tdstickyghostwhite">' ;
2023-06-12 12:16:09 +00:00
print '<input id ="modifyPerm" class="reposition button smallpaddingimp" type="submit" name="modifyright" value="' . $langs -> trans ( " Modify " ) . '"/>' ;
print '<br>' ;
print '<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="' . $langs -> trans ( " Cancel " ) . '"/>' ;
print '</td>' ;
print '</form>' ;
print '</tr>' ;
} else {
2023-07-31 20:40:17 +00:00
// $perm can be module->object->crud or module->crud
2023-06-12 12:16:09 +00:00
print '<tr class="oddeven">' ;
2023-02-03 13:33:33 +00:00
2023-06-12 12:16:09 +00:00
print '<td>' ;
print dol_escape_htmltag ( $perm [ 0 ]);
print '</td>' ;
2023-02-03 13:33:33 +00:00
2023-06-12 12:16:09 +00:00
print '<td>' ;
2023-07-31 20:40:17 +00:00
if ( in_array ( $perm [ 5 ], array ( 'lire' , 'read' , 'creer' , 'write' , 'effacer' , 'delete' ))) {
print dol_escape_htmltag ( ucfirst ( $perm [ 4 ]));
} else {
print '' ; // No particular object
}
2023-06-12 12:16:09 +00:00
print '</td>' ;
2023-02-03 13:33:33 +00:00
2023-06-12 12:16:09 +00:00
print '<td>' ;
2023-07-31 20:40:17 +00:00
if ( in_array ( $perm [ 5 ], array ( 'lire' , 'read' , 'creer' , 'write' , 'effacer' , 'delete' ))) {
print ucfirst ( $langs -> trans ( $perm [ 5 ]));
} else {
print ucfirst ( $langs -> trans ( $perm [ 4 ]));
}
2023-06-12 12:16:09 +00:00
print '</td>' ;
2023-02-03 13:33:33 +00:00
2023-06-12 12:16:09 +00:00
print '<td>' ;
print $langs -> trans ( $perm [ 1 ]);
print '</td>' ;
2023-02-03 13:33:33 +00:00
2023-10-09 14:46:47 +00:00
print '<td class="center minwidth75 tdstickyright tdstickyghostwhite">' ;
2023-06-12 12:16:09 +00:00
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>' ;
2024-03-08 01:52:06 +00:00
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>' ;
2023-02-03 13:33:33 +00:00
2023-06-12 12:16:09 +00:00
print '</td>' ;
2023-02-21 15:01:03 +00:00
2023-06-12 12:16:09 +00:00
print '</tr>' ;
2023-02-03 13:33:33 +00:00
}
2019-09-09 09:23:53 +00:00
}
2020-05-21 07:35:30 +00:00
} else {
2023-03-07 14:51:27 +00:00
print '<tr><td colspan="5"><span class="opacitymedium">' . $langs -> trans ( " None " ) . '</span></td></tr>' ;
2019-09-07 12:49:48 +00:00
}
2017-12-11 12:50:26 +00:00
2019-09-07 12:49:48 +00:00
print '</table>' ;
print '</div>' ;
2017-12-11 12:50:26 +00:00
2019-09-07 12:49:48 +00:00
print '</form>' ;
2023-06-12 12:16:09 +00:00
print ' < script >
function updateInputField () {
value1 = $ ( " #crud " ) . val ();
value2 = $ ( " #permissionObj " ) . val ();
2023-07-31 19:58:47 +00:00
2026-06-28 07:42:08 +00:00
// Check if both selections are made
2023-10-13 14:38:51 +00:00
if ( value1 && value2 ) {
2023-06-12 12:16:09 +00:00
switch ( value1 . toLowerCase ()){
case " read " :
$ ( " #label " ) . val ( " Read " + value2 + " object of '.ucfirst( $module ).' " )
break ;
case " write " :
$ ( " #label " ) . val ( " Create/Update " + value2 + " object of '.ucfirst( $module ).' " )
break ;
case " delete " :
$ ( " #label " ) . val ( " Delete " + value2 + " object of '.ucfirst( $module ).' " )
break ;
default :
$ ( " #label " ) . val ( " " )
}
}
}
2023-07-31 19:58:47 +00:00
2023-10-13 14:38:51 +00:00
$ ( " #crud, #permissionObj " ) . change ( function (){
console . log ( " We change selection " );
updateInputField ();
});
2023-06-12 12:16:09 +00:00
</ script > ' ;
2020-05-21 07:35:30 +00:00
} else {
2019-11-13 18:37:08 +00:00
$fullpathoffile = dol_buildpath ( $file , 0 );
2017-09-22 23:24:31 +00:00
2017-10-06 00:42:32 +00:00
$content = file_get_contents ( $fullpathoffile );
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
print '<input type="hidden" name="module" value="' . $module . '">' ;
2024-08-15 14:57:02 +00:00
$posCursor = ( empty ( $find )) ? array () : array ( 'find' => $find );
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' , 0 , $posCursor );
2023-12-04 12:46:42 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'html' ));
2017-10-06 00:42:32 +00:00
print '<br>' ;
print '<center>' ;
2020-11-19 19:23:38 +00:00
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
2017-10-06 00:42:32 +00:00
print ' ' ;
2020-11-23 14:12:52 +00:00
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
2017-10-06 00:42:32 +00:00
print '</center>' ;
print '</form>' ;
}
}
2017-06-10 21:50:02 +00:00
2021-02-26 17:26:44 +00:00
if ( $tab == 'hooks' ) {
2022-04-12 13:51:46 +00:00
print '<!-- tab=hooks -->' . " \n " ;
2021-02-26 17:26:44 +00:00
if ( $action != 'editfile' || empty ( $file )) {
2020-04-05 00:44:59 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " HooksDefDesc " ) . '</span><br>' ;
2017-09-23 10:59:49 +00:00
print '<br>' ;
2020-05-05 19:27:40 +00:00
print '<table>' ;
2019-03-10 18:33:28 +00:00
2018-10-31 14:04:01 +00:00
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
2020-05-05 19:27:40 +00:00
print '<tr><td>' ;
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " DescriptorFile " ) . ' : <strong class="wordbreak">' . $pathtofile . '</strong>' ;
2019-03-10 18:33:28 +00:00
print '</td><td>' ;
2024-05-01 16:04:18 +00:00
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>' ;
2019-03-10 18:33:28 +00:00
print '</td></tr>' ;
2017-09-23 10:59:49 +00:00
2019-03-10 18:33:28 +00:00
print '<tr><td>' ;
2017-10-06 00:42:32 +00:00
$pathtohook = strtolower ( $module ) . '/class/actions_' . strtolower ( $module ) . '.class.php' ;
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " HooksFile " ) . ' : ' ;
2021-02-26 17:26:44 +00:00
if ( dol_is_file ( $dirins . '/' . $pathtohook )) {
2022-05-18 19:54:38 +00:00
print '<strong class="wordbreak">' . $pathtohook . '</strong>' ;
2020-05-05 19:27:40 +00:00
print '</td>' ;
2022-10-12 14:17:25 +00:00
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> ' ;
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>' ;
2020-05-21 07:35:30 +00:00
} else {
2020-04-05 00:44:59 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " FileNotYetGenerated " ) . '</span>' ;
2024-10-28 10:42:35 +00:00
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>' ;
2020-05-05 19:27:40 +00:00
print '<td></td>' ;
2019-03-10 18:33:28 +00:00
}
print '</tr>' ;
2020-05-21 07:35:30 +00:00
} else {
2019-11-13 18:37:08 +00:00
$fullpathoffile = dol_buildpath ( $file , 0 );
2017-10-06 00:42:32 +00:00
$content = file_get_contents ( $fullpathoffile );
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
print '<input type="hidden" name="module" value="' . $module . '">' ;
2024-08-15 14:57:02 +00:00
$posCursor = ( empty ( $find )) ? array () : array ( 'find' => $find );
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' , 0 , $posCursor );
2023-12-04 12:46:42 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'html' ));
2017-10-06 00:42:32 +00:00
print '<br>' ;
print '<center>' ;
2020-11-19 19:23:38 +00:00
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
2017-10-06 00:42:32 +00:00
print ' ' ;
2020-11-23 14:12:52 +00:00
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
2017-10-06 00:42:32 +00:00
print '</center>' ;
print '</form>' ;
2017-07-16 10:07:59 +00:00
}
2017-10-06 00:42:32 +00:00
}
2017-06-14 09:44:12 +00:00
2021-02-26 17:26:44 +00:00
if ( $tab == 'triggers' ) {
2022-04-12 13:51:46 +00:00
print '<!-- tab=triggers -->' . " \n " ;
2017-10-06 00:42:32 +00:00
require_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php' ;
2017-06-10 21:50:02 +00:00
2017-05-28 12:43:17 +00:00
$interfaces = new Interfaces ( $db );
$triggers = $interfaces -> getTriggersList ( array ( '/' . strtolower ( $module ) . '/core/triggers' ));
2017-06-10 21:50:02 +00:00
2021-02-26 17:26:44 +00:00
if ( $action != 'editfile' || empty ( $file )) {
2020-04-05 00:44:59 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " TriggerDefDesc " ) . '</span><br>' ;
2017-09-23 10:59:49 +00:00
print '<br>' ;
2019-03-10 18:33:28 +00:00
print '<table>' ;
2020-05-05 19:27:40 +00:00
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
print '<tr><td>' ;
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " DescriptorFile " ) . ' : <strong class="wordbreak">' . $pathtofile . '</strong>' ;
2020-05-05 19:27:40 +00:00
print '</td><td>' ;
2024-05-01 16:04:18 +00:00
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>' ;
2020-05-05 19:27:40 +00:00
print '</td></tr>' ;
2021-02-26 17:26:44 +00:00
if ( ! empty ( $triggers )) {
foreach ( $triggers as $trigger ) {
2017-10-06 00:42:32 +00:00
$pathtofile = $trigger [ 'relpath' ];
2019-03-10 18:33:28 +00:00
print '<tr><td>' ;
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " TriggersFile " ) . ' : <strong class="wordbreak">' . $pathtofile . '</strong>' ;
2022-10-12 14:17:25 +00:00
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>' ;
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>' ;
2020-04-05 00:44:59 +00:00
print '</tr>' ;
2017-10-06 00:42:32 +00:00
}
2020-05-21 07:35:30 +00:00
} else {
2020-04-05 00:44:59 +00:00
print '<tr><td>' ;
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " TriggersFile " );
2021-11-07 15:04:37 +00:00
print ' : <span class="opacitymedium">' . $langs -> trans ( " FileNotYetGenerated " ) . '</span>' ;
2024-10-28 13:41:34 +00:00
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>' ;
2020-05-05 19:27:40 +00:00
print '<td></td>' ;
2019-03-10 18:33:28 +00:00
print '</tr>' ;
2017-08-26 13:22:13 +00:00
}
2020-05-05 19:27:40 +00:00
2019-03-10 18:33:28 +00:00
print '</table>' ;
2020-05-21 07:35:30 +00:00
} else {
2019-11-13 18:37:08 +00:00
$fullpathoffile = dol_buildpath ( $file , 0 );
2017-10-06 00:42:32 +00:00
$content = file_get_contents ( $fullpathoffile );
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
print '<input type="hidden" name="module" value="' . $module . '">' ;
2024-08-15 14:57:02 +00:00
$posCursor = ( empty ( $find )) ? array () : array ( 'find' => $find );
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' , 0 , $posCursor );
2023-12-04 12:46:42 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'html' ));
2019-10-24 09:41:36 +00:00
print '<br>' ;
print '<center>' ;
2020-11-19 19:23:38 +00:00
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
2019-10-24 09:41:36 +00:00
print ' ' ;
2020-11-23 14:12:52 +00:00
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
2019-10-24 09:41:36 +00:00
print '</center>' ;
print '</form>' ;
}
}
2021-02-26 17:26:44 +00:00
if ( $tab == 'css' ) {
2022-04-12 13:51:46 +00:00
print '<!-- tab=css -->' . " \n " ;
2021-02-26 17:26:44 +00:00
if ( $action != 'editfile' || empty ( $file )) {
2019-10-24 09:41:36 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " CSSDesc " ) . '</span><br>' ;
print '<br>' ;
print '<table>' ;
print '<tr><td>' ;
$pathtohook = strtolower ( $module ) . '/css/' . strtolower ( $module ) . '.css.php' ;
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " CSSFile " ) . ' : ' ;
2021-02-26 17:26:44 +00:00
if ( dol_is_file ( $dirins . '/' . $pathtohook )) {
2022-05-18 19:54:38 +00:00
print '<strong class="wordbreak">' . $pathtohook . '</strong>' ;
2022-10-12 14:17:25 +00:00
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>' ;
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>' ;
2020-05-21 07:35:30 +00:00
} else {
2019-10-24 09:41:36 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " FileNotYetGenerated " ) . '</span>' ;
2024-10-28 13:41:34 +00:00
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>' ;
2019-10-24 09:41:36 +00:00
}
print '</tr>' ;
2020-05-21 07:35:30 +00:00
} else {
2020-01-30 00:48:28 +00:00
$fullpathoffile = dol_buildpath ( $file , 0 );
2019-10-24 09:41:36 +00:00
$content = file_get_contents ( $fullpathoffile );
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2019-10-24 09:41:36 +00:00
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
print '<input type="hidden" name="module" value="' . $module . '">' ;
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' );
2023-12-04 12:46:42 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'html' ));
2019-10-24 09:41:36 +00:00
print '<br>' ;
print '<center>' ;
2020-11-19 19:23:38 +00:00
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
2019-10-24 09:41:36 +00:00
print ' ' ;
2020-11-23 14:12:52 +00:00
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
2019-10-24 09:41:36 +00:00
print '</center>' ;
print '</form>' ;
}
}
2021-02-26 17:26:44 +00:00
if ( $tab == 'js' ) {
2022-04-12 13:51:46 +00:00
print '<!-- tab=js -->' . " \n " ;
2021-02-26 17:26:44 +00:00
if ( $action != 'editfile' || empty ( $file )) {
2019-10-24 09:41:36 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " JSDesc " ) . '</span><br>' ;
print '<br>' ;
print '<table>' ;
print '<tr><td>' ;
$pathtohook = strtolower ( $module ) . '/js/' . strtolower ( $module ) . '.js.php' ;
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " JSFile " ) . ' : ' ;
2021-02-26 17:26:44 +00:00
if ( dol_is_file ( $dirins . '/' . $pathtohook )) {
2022-05-18 19:54:38 +00:00
print '<strong class="wordbreak">' . $pathtohook . '</strong>' ;
2022-10-12 14:17:25 +00:00
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>' ;
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>' ;
2020-05-21 07:35:30 +00:00
} else {
2019-10-24 09:41:36 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " FileNotYetGenerated " ) . '</span>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2019-10-24 09:41:36 +00:00
}
print '</tr>' ;
2020-05-21 07:35:30 +00:00
} else {
2020-01-30 00:48:28 +00:00
$fullpathoffile = dol_buildpath ( $file , 0 );
2019-10-24 09:41:36 +00:00
$content = file_get_contents ( $fullpathoffile );
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2019-10-24 09:41:36 +00:00
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
print '<input type="hidden" name="module" value="' . $module . '">' ;
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' );
2023-12-04 12:46:42 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'html' ));
2017-10-06 00:42:32 +00:00
print '<br>' ;
print '<center>' ;
2020-11-19 19:23:38 +00:00
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
2017-10-06 00:42:32 +00:00
print ' ' ;
2020-11-23 14:12:52 +00:00
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
2017-10-06 00:42:32 +00:00
print '</center>' ;
print '</form>' ;
2017-07-08 13:43:36 +00:00
}
2017-10-06 00:42:32 +00:00
}
2017-05-28 12:43:17 +00:00
2021-02-26 17:26:44 +00:00
if ( $tab == 'widgets' ) {
2022-04-12 13:51:46 +00:00
print '<!-- tab=widgets -->' . " \n " ;
2017-10-06 00:42:32 +00:00
require_once DOL_DOCUMENT_ROOT . '/core/boxes/modules_boxes.php' ;
2017-07-16 10:07:59 +00:00
$widgets = ModeleBoxes :: getWidgetsList ( array ( '/' . strtolower ( $module ) . '/core/boxes' ));
2021-02-26 17:26:44 +00:00
if ( $action != 'editfile' || empty ( $file )) {
2020-04-05 00:44:59 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " WidgetDesc " ) . '</span><br>' ;
print '<br>' ;
2019-03-10 18:33:28 +00:00
2020-04-05 00:44:59 +00:00
print '<table>' ;
2021-02-26 17:26:44 +00:00
if ( ! empty ( $widgets )) {
foreach ( $widgets as $widget ) {
2017-10-06 00:42:32 +00:00
$pathtofile = $widget [ 'relpath' ];
2024-10-28 10:42:35 +00:00
print '<tr><td><span class="fa fa-file"></span> ' . $langs -> trans ( " WidgetFile " ) . ' : <strong class="wordbreak">' . $pathtofile . '</strong>' ;
2022-10-12 14:17:25 +00:00
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>' ;
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>' ;
2019-03-10 18:33:28 +00:00
print '</tr>' ;
2017-10-06 00:42:32 +00:00
}
2020-05-21 07:35:30 +00:00
} else {
2024-10-28 10:42:35 +00:00
print '<tr><td><span class="fa fa-file"></span> ' . $langs -> trans ( " WidgetFile " ) . ' : <span class="opacitymedium">' . $langs -> trans ( " NoWidget " ) . '</span>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2020-04-05 00:44:59 +00:00
print '</td></tr>' ;
2017-10-06 00:42:32 +00:00
}
2019-03-10 18:33:28 +00:00
print '</table>' ;
2020-05-21 07:35:30 +00:00
} else {
2019-11-13 18:37:08 +00:00
$fullpathoffile = dol_buildpath ( $file , 0 );
2017-10-06 00:42:32 +00:00
$content = file_get_contents ( $fullpathoffile );
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
2024-01-10 13:52:12 +00:00
print '<input type="hidden" name="module" value="' . $module . '">' ;
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' );
2024-01-10 13:52:12 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'html' ));
print '<br>' ;
print '<center>' ;
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
print ' ' ;
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
print '</center>' ;
print '</form>' ;
}
}
if ( $tab == 'emailings' ) {
print '<!-- tab=emailings -->' . " \n " ;
require_once DOL_DOCUMENT_ROOT . '/core/modules/mailings/modules_mailings.php' ;
2024-01-11 01:47:42 +00:00
$emailingselectors = MailingTargets :: getEmailingSelectorsList ( array ( '/' . strtolower ( $module ) . '/core/modules/mailings' ));
2024-01-10 13:52:12 +00:00
if ( $action != 'editfile' || empty ( $file )) {
print '<span class="opacitymedium">' . $langs -> trans ( " EmailingSelectorDesc " ) . '</span><br>' ;
print '<br>' ;
print '<table>' ;
if ( ! empty ( $emailingselectors )) {
foreach ( $emailingselectors as $emailingselector ) {
$pathtofile = $emailingselector [ 'relpath' ];
2024-10-28 10:42:35 +00:00
print '<tr><td><span class="fa fa-file"></span> ' . $langs -> trans ( " EmailingSelectorFile " ) . ' : <strong class="wordbreak">' . $pathtofile . '</strong>' ;
2024-01-10 13:52:12 +00:00
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>' ;
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>' ;
print '</tr>' ;
}
} else {
2024-10-28 10:42:35 +00:00
print '<tr><td><span class="fa fa-file"></span> ' . $langs -> trans ( " EmailingSelectorFile " ) . ' : <span class="opacitymedium">' . $langs -> trans ( " NoEmailingSelector " ) . '</span>' ;
2024-01-10 13:52:12 +00:00
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>' ;
print '</td></tr>' ;
}
print '</table>' ;
} else {
$fullpathoffile = dol_buildpath ( $file , 0 );
$content = file_get_contents ( $fullpathoffile );
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
2021-04-06 16:51:43 +00:00
print '<input type="hidden" name="module" value="' . $module . '">' ;
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' );
2023-12-04 12:46:42 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'html' ));
2021-04-06 16:51:43 +00:00
print '<br>' ;
print '<center>' ;
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
print ' ' ;
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
print '</center>' ;
print '</form>' ;
}
}
if ( $tab == 'exportimport' ) {
2022-04-12 13:51:46 +00:00
print '<!-- tab=exportimport -->' . " \n " ;
2021-04-06 16:51:43 +00:00
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
$exportlist = $moduleobj -> export_label ;
$importlist = $moduleobj -> import_label ;
if ( $action != 'editfile' || empty ( $file )) {
print '<span class="opacitymedium">' . $langs -> transnoentities ( 'ImportExportProfiles' ) . '</span><br>' ;
print '<br>' ;
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " DescriptorFile " ) . ' (' . $langs -> trans ( " ExportsArea " ) . ') : <strong class="wordbreak">' . $pathtofile . '</strong>' ;
2024-05-01 16:04:18 +00:00
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>' ;
print '<br>' ;
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " DescriptorFile " ) . ' (' . $langs -> trans ( " ImportArea " ) . ') : <strong class="wordbreak">' . $pathtofile . '</strong>' ;
2024-05-01 16:04:18 +00:00
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>' ;
2021-04-06 16:51:43 +00:00
print '<br>' ;
} else {
$fullpathoffile = dol_buildpath ( $file , 0 );
$content = file_get_contents ( $fullpathoffile );
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="module" value="' . $module . '">' ;
2024-08-15 14:57:02 +00:00
$posCursor = ( empty ( $find )) ? array () : array ( 'find' => $find );
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' , 0 , $posCursor );
2023-12-04 12:46:42 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'html' ));
2017-10-06 00:42:32 +00:00
print '<br>' ;
print '<center>' ;
2020-11-19 19:23:38 +00:00
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
2017-10-06 00:42:32 +00:00
print ' ' ;
2020-11-23 14:12:52 +00:00
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
2017-10-06 00:42:32 +00:00
print '</center>' ;
print '</form>' ;
2017-07-16 10:07:59 +00:00
}
2017-10-06 00:42:32 +00:00
}
2017-06-14 09:44:12 +00:00
2021-02-26 17:26:44 +00:00
if ( $tab == 'cli' ) {
2022-04-12 13:51:46 +00:00
print '<!-- tab=cli -->' . " \n " ;
2020-04-05 00:44:59 +00:00
$clifiles = array ();
$i = 0 ;
$dircli = array ( '/' . strtolower ( $module ) . '/scripts' );
2021-02-26 17:26:44 +00:00
foreach ( $dircli as $reldir ) {
2020-04-05 00:44:59 +00:00
$dir = dol_buildpath ( $reldir , 0 );
$newdir = dol_osencode ( $dir );
// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php at each call)
2021-02-26 17:26:44 +00:00
if ( ! is_dir ( $newdir )) {
continue ;
}
2020-04-05 00:44:59 +00:00
$handle = opendir ( $newdir );
2023-08-12 11:43:33 +00:00
2021-02-26 17:26:44 +00:00
if ( is_resource ( $handle )) {
while (( $tmpfile = readdir ( $handle )) !== false ) {
2023-08-12 11:43:33 +00:00
if ( is_readable ( $newdir . '/' . $tmpfile ) && preg_match ( '/^(.+)\.php/' , $tmpfile , $reg )) {
2021-02-26 17:26:44 +00:00
if ( preg_match ( '/\.back$/' , $tmpfile )) {
continue ;
}
2020-04-05 00:44:59 +00:00
$clifiles [ $i ][ 'relpath' ] = preg_replace ( '/^\//' , '' , $reldir ) . '/' . $tmpfile ;
$i ++ ;
}
}
closedir ( $handle );
}
}
2021-02-26 17:26:44 +00:00
if ( $action != 'editfile' || empty ( $file )) {
2020-04-05 00:44:59 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " CLIDesc " ) . '</span><br>' ;
print '<br>' ;
print '<table>' ;
2021-02-26 17:26:44 +00:00
if ( ! empty ( $clifiles )) {
foreach ( $clifiles as $clifile ) {
2020-04-05 00:44:59 +00:00
$pathtofile = $clifile [ 'relpath' ];
2024-10-28 10:42:35 +00:00
print '<tr><td><span class="fa fa-file"></span> ' . $langs -> trans ( " CLIFile " ) . ' : <strong class="wordbreak">' . $pathtofile . '</strong>' ;
2022-10-12 14:17:25 +00:00
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>' ;
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>' ;
2020-04-05 00:44:59 +00:00
print '</tr>' ;
}
2020-05-21 07:35:30 +00:00
} else {
2024-10-28 10:42:35 +00:00
print '<tr><td><span class="fa fa-file"></span> ' . $langs -> trans ( " CLIFile " ) . ' : <span class="opacitymedium">' . $langs -> trans ( " FileNotYetGenerated " ) . '</span>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2020-04-05 00:44:59 +00:00
print '</td></tr>' ;
}
print '</table>' ;
2020-05-21 07:35:30 +00:00
} else {
2020-04-05 00:44:59 +00:00
$fullpathoffile = dol_buildpath ( $file , 0 );
$content = file_get_contents ( $fullpathoffile );
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
print '<input type="hidden" name="module" value="' . $module . '">' ;
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' );
2023-12-04 12:46:42 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'html' ));
2020-04-05 00:44:59 +00:00
print '<br>' ;
print '<center>' ;
2020-11-19 19:23:38 +00:00
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
2020-04-05 00:44:59 +00:00
print ' ' ;
2020-11-23 14:12:52 +00:00
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
2020-04-05 00:44:59 +00:00
print '</center>' ;
print '</form>' ;
}
2019-03-10 18:33:28 +00:00
}
2021-02-26 17:26:44 +00:00
if ( $tab == 'cron' ) {
2022-04-12 13:51:46 +00:00
print '<!-- tab=cron -->' . " \n " ;
2018-10-31 14:04:01 +00:00
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
2017-07-26 08:11:39 +00:00
2017-10-06 00:42:32 +00:00
$cronjobs = $moduleobj -> cronjobs ;
2017-07-26 08:11:39 +00:00
2021-02-26 17:26:44 +00:00
if ( $action != 'editfile' || empty ( $file )) {
2021-08-28 11:56:59 +00:00
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>' ;
2017-10-06 00:42:32 +00:00
print '<br>' ;
2017-07-26 08:11:39 +00:00
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " DescriptorFile " ) . ' : <strong class="wordbreak">' . $pathtofile . '</strong>' ;
2024-05-01 16:04:18 +00:00
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>' ;
2017-10-06 00:42:32 +00:00
print '<br>' ;
2017-07-26 08:11:39 +00:00
2017-10-06 00:42:32 +00:00
print '<br>' ;
print load_fiche_titre ( $langs -> trans ( " CronJobProfiles " ), '' , '' );
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="action" value="addproperty">' ;
print '<input type="hidden" name="tab" value="objects">' ;
print '<input type="hidden" name="module" value="' . dol_escape_htmltag ( $module ) . '">' ;
print '<input type="hidden" name="tabobj" value="' . dol_escape_htmltag ( $tabobj ) . '">' ;
print '<div class="div-table-responsive">' ;
print '<table class="noborder">' ;
print '<tr class="liste_titre">' ;
2019-01-27 10:55:16 +00:00
print_liste_field_titre ( " CronLabel " , $_SERVER [ " PHP_SELF " ], " " , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " CronTask " , '' , '' , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " CronFrequency " , '' , " " , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " StatusAtInstall " , $_SERVER [ " PHP_SELF " ], " " , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " Comment " , $_SERVER [ " PHP_SELF " ], " " , " " , $param , '' , $sortfield , $sortorder );
2017-10-06 00:42:32 +00:00
print " </tr> \n " ;
2021-02-26 17:26:44 +00:00
if ( count ( $cronjobs )) {
foreach ( $cronjobs as $cron ) {
2017-10-06 00:42:32 +00:00
print '<tr class="oddeven">' ;
print '<td>' ;
print $cron [ 'label' ];
print '</td>' ;
print '<td>' ;
2025-02-05 21:59:37 +00:00
$texttoshow = '' ;
2021-02-26 17:26:44 +00:00
if ( $cron [ 'jobtype' ] == 'method' ) {
2019-11-13 18:37:08 +00:00
$text = $langs -> trans ( " CronClass " );
$texttoshow = $langs -> trans ( 'CronModule' ) . ': ' . $module . '<br>' ;
$texttoshow .= $langs -> trans ( 'CronClass' ) . ': ' . $cron [ 'class' ] . '<br>' ;
$texttoshow .= $langs -> trans ( 'CronObject' ) . ': ' . $cron [ 'objectname' ] . '<br>' ;
$texttoshow .= $langs -> trans ( 'CronMethod' ) . ': ' . $cron [ 'method' ];
$texttoshow .= '<br>' . $langs -> trans ( 'CronArgs' ) . ': ' . $cron [ 'parameters' ];
$texttoshow .= '<br>' . $langs -> trans ( 'Comment' ) . ': ' . $langs -> trans ( $cron [ 'comment' ]);
2021-02-26 17:26:44 +00:00
} elseif ( $cron [ 'jobtype' ] == 'command' ) {
2019-11-13 18:37:08 +00:00
$text = $langs -> trans ( 'CronCommand' );
$texttoshow = $langs -> trans ( 'CronCommand' ) . ': ' . dol_trunc ( $cron [ 'command' ]);
$texttoshow .= '<br>' . $langs -> trans ( 'CronArgs' ) . ': ' . $cron [ 'parameters' ];
$texttoshow .= '<br>' . $langs -> trans ( 'Comment' ) . ': ' . $langs -> trans ( $cron [ 'comment' ]);
2017-10-06 00:42:32 +00:00
}
print $form -> textwithpicto ( $text , $texttoshow , 1 );
print '</td>' ;
print '<td>' ;
2021-02-26 17:26:44 +00:00
if ( $cron [ 'unitfrequency' ] == " 60 " ) {
print $langs -> trans ( 'CronEach' ) . " " . ( $cron [ 'frequency' ]) . " " . $langs -> trans ( 'Minutes' );
}
if ( $cron [ 'unitfrequency' ] == " 3600 " ) {
print $langs -> trans ( 'CronEach' ) . " " . ( $cron [ 'frequency' ]) . " " . $langs -> trans ( 'Hours' );
}
if ( $cron [ 'unitfrequency' ] == " 86400 " ) {
print $langs -> trans ( 'CronEach' ) . " " . ( $cron [ 'frequency' ]) . " " . $langs -> trans ( 'Days' );
}
if ( $cron [ 'unitfrequency' ] == " 604800 " ) {
print $langs -> trans ( 'CronEach' ) . " " . ( $cron [ 'frequency' ]) . " " . $langs -> trans ( 'Weeks' );
}
2017-10-06 00:42:32 +00:00
print '</td>' ;
print '<td>' ;
print $cron [ 'status' ];
print '</td>' ;
print '<td>' ;
2021-02-26 17:26:44 +00:00
if ( ! empty ( $cron [ 'comment' ])) {
print $cron [ 'comment' ];
}
2017-10-06 00:42:32 +00:00
print '</td>' ;
print '</tr>' ;
}
2020-05-21 07:35:30 +00:00
} else {
2021-10-04 02:14:31 +00:00
print '<tr><td colspan="5"><span class="opacitymedium">' . $langs -> trans ( " None " ) . '</span></td></tr>' ;
2017-10-06 00:42:32 +00:00
}
2017-07-26 08:11:39 +00:00
2017-10-06 00:42:32 +00:00
print '</table>' ;
print '</div>' ;
2017-07-26 08:11:39 +00:00
2017-10-06 00:42:32 +00:00
print '</form>' ;
2020-05-21 07:35:30 +00:00
} else {
2019-11-13 18:37:08 +00:00
$fullpathoffile = dol_buildpath ( $file , 0 );
2017-07-26 08:11:39 +00:00
2017-10-06 00:42:32 +00:00
$content = file_get_contents ( $fullpathoffile );
2017-07-26 08:11:39 +00:00
2017-10-06 00:42:32 +00:00
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
print '<input type="hidden" name="module" value="' . $module . '">' ;
2017-08-27 11:28:37 +00:00
2024-08-15 14:57:02 +00:00
$posCursor = ( empty ( $find )) ? array () : array ( 'find' => $find );
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' , 0 , $posCursor );
2023-12-04 12:46:42 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'html' ));
2017-10-06 00:42:32 +00:00
print '<br>' ;
print '<center>' ;
2020-11-19 19:23:38 +00:00
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
2017-10-06 00:42:32 +00:00
print ' ' ;
2020-11-23 14:12:52 +00:00
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
2017-10-06 00:42:32 +00:00
print '</center>' ;
2017-08-27 11:28:37 +00:00
2017-10-06 00:42:32 +00:00
print '</form>' ;
}
}
2017-08-27 11:28:37 +00:00
2021-02-26 17:26:44 +00:00
if ( $tab == 'specifications' ) {
2022-04-12 13:51:46 +00:00
print '<!-- tab=specifications -->' . " \n " ;
2020-04-05 00:44:59 +00:00
$specs = dol_dir_list ( dol_buildpath ( $modulelowercase . '/doc' , 0 ), 'files' , 1 , '(\.md|\.asciidoc)$' , array ( '\/temp\/' ));
2021-02-26 17:26:44 +00:00
if ( $action != 'editfile' || empty ( $file )) {
2020-04-05 00:44:59 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " SpecDefDesc " ) . '</span><br>' ;
print '<br>' ;
print '<table>' ;
2021-02-26 17:26:44 +00:00
if ( is_array ( $specs ) && ! empty ( $specs )) {
foreach ( $specs as $spec ) {
2020-04-05 00:44:59 +00:00
$pathtofile = $modulelowercase . '/doc/' . $spec [ 'relativename' ];
$format = 'asciidoc' ;
2021-02-26 17:26:44 +00:00
if ( preg_match ( '/\.md$/i' , $spec [ 'name' ])) {
$format = 'markdown' ;
}
2020-04-05 00:44:59 +00:00
print '<tr><td>' ;
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " SpecificationFile " ) . ' : <strong class="wordbreak">' . $pathtofile . '</strong>' ;
2022-10-12 14:17:25 +00:00
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>' ;
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>' ;
2020-04-05 00:44:59 +00:00
print '</tr>' ;
}
2020-05-21 07:35:30 +00:00
} else {
2020-04-05 00:44:59 +00:00
print '<tr><td>' ;
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " SpecificationFile " ) . ' : <span class="opacitymedium">' . $langs -> trans ( " FileNotYetGenerated " ) . '</span>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2020-04-05 00:44:59 +00:00
print '</tr>' ;
}
print '</table>' ;
2020-05-21 07:35:30 +00:00
} else {
2020-04-05 00:44:59 +00:00
// Use MD or asciidoc
//print $langs->trans("UseAsciiDocFormat").'<br>';
$fullpathoffile = dol_buildpath ( $file , 0 );
$content = file_get_contents ( $fullpathoffile );
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
print '<input type="hidden" name="module" value="' . $module . '">' ;
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' );
2023-12-04 12:46:42 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'html' ));
2020-04-05 00:44:59 +00:00
print '<br>' ;
print '<center>' ;
2020-11-19 19:23:38 +00:00
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
2020-04-05 00:44:59 +00:00
print ' ' ;
2020-11-23 14:12:52 +00:00
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
2020-04-05 00:44:59 +00:00
print '</center>' ;
print '</form>' ;
}
print '<br><br><br>' ;
$FILENAMEDOC = $modulelowercase . '.html' ;
$FILENAMEDOCPDF = $modulelowercase . '.pdf' ;
$outputfiledoc = dol_buildpath ( $modulelowercase , 0 ) . '/doc/' . $FILENAMEDOC ;
$outputfiledocurl = dol_buildpath ( $modulelowercase , 1 ) . '/doc/' . $FILENAMEDOC ;
2022-03-11 15:21:28 +00:00
$outputfiledocrel = $modulelowercase . '/doc/' . $FILENAMEDOC ;
2020-04-05 00:44:59 +00:00
$outputfiledocpdf = dol_buildpath ( $modulelowercase , 0 ) . '/doc/' . $FILENAMEDOCPDF ;
$outputfiledocurlpdf = dol_buildpath ( $modulelowercase , 1 ) . '/doc/' . $FILENAMEDOCPDF ;
2022-03-11 15:21:28 +00:00
$outputfiledocrelpdf = $modulelowercase . '/doc/' . $FILENAMEDOCPDF ;
2020-04-05 00:44:59 +00:00
// HTML
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " PathToModuleDocumentation " , " HTML " ) . ' : ' ;
2021-02-26 17:26:44 +00:00
if ( ! dol_is_file ( $outputfiledoc )) {
print '<span class="opacitymedium">' . $langs -> trans ( " FileNotYetGenerated " ) . '</span>' ;
} else {
2020-04-05 00:44:59 +00:00
print '<strong>' ;
2021-11-22 01:35:55 +00:00
print '<a href="' . $outputfiledocurl . '" target="_blank" rel="noopener noreferrer">' ;
2020-04-05 00:44:59 +00:00
print $outputfiledoc ;
print '</a>' ;
print '</strong>' ;
2021-05-10 19:28:11 +00:00
print ' <span class="opacitymedium">(' . $langs -> trans ( " GeneratedOn " ) . ' ' . dol_print_date ( dol_filemtime ( $outputfiledoc ), 'dayhour' ) . ')</span>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2020-04-05 00:44:59 +00:00
}
print '</strong><br>' ;
// PDF
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " PathToModuleDocumentation " , " PDF " ) . ' : ' ;
2021-02-26 17:26:44 +00:00
if ( ! dol_is_file ( $outputfiledocpdf )) {
print '<span class="opacitymedium">' . $langs -> trans ( " FileNotYetGenerated " ) . '</span>' ;
} else {
2020-04-05 00:44:59 +00:00
print '<strong>' ;
2021-11-22 01:35:55 +00:00
print '<a href="' . $outputfiledocurlpdf . '" target="_blank" rel="noopener noreferrer">' ;
2020-04-05 00:44:59 +00:00
print $outputfiledocpdf ;
print '</a>' ;
print '</strong>' ;
2021-05-10 19:28:11 +00:00
print ' <span class="opacitymedium">(' . $langs -> trans ( " GeneratedOn " ) . ' ' . dol_print_date ( dol_filemtime ( $outputfiledocpdf ), 'dayhour' ) . ')</span>' ;
2023-01-12 11:47:57 +00:00
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>' ;
2020-04-05 00:44:59 +00:00
}
print '</strong><br>' ;
print '<br>' ;
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST" name="generatedoc">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="action" value="generatedoc">' ;
print '<input type="hidden" name="tab" value="' . dol_escape_htmltag ( $tab ) . '">' ;
print '<input type="hidden" name="module" value="' . dol_escape_htmltag ( $module ) . '">' ;
print '<input type="submit" class="button" name="generatedoc" value="' . $langs -> trans ( " BuildDocumentation " ) . '"' ;
2021-02-26 17:26:44 +00:00
if ( ! is_array ( $specs ) || empty ( $specs )) {
print ' disabled="disabled"' ;
}
2020-04-05 00:44:59 +00:00
print '>' ;
print '</form>' ;
2019-03-10 18:33:28 +00:00
}
2021-02-26 17:26:44 +00:00
if ( $tab == 'buildpackage' ) {
2022-04-12 13:51:46 +00:00
print '<!-- tab=buildpackage -->' . " \n " ;
2020-04-05 00:44:59 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " BuildPackageDesc " ) . '</span>' ;
print '<br>' ;
2019-05-02 10:03:14 +00:00
2021-02-26 17:26:44 +00:00
if ( ! class_exists ( 'ZipArchive' ) && ! defined ( 'ODTPHP_PATHTOPCLZIP' )) {
2017-10-06 00:42:32 +00:00
print img_warning () . ' ' . $langs -> trans ( " ErrNoZipEngine " );
print '<br>' ;
}
2017-08-27 11:28:37 +00:00
2020-01-30 00:48:28 +00:00
$modulelowercase = strtolower ( $module );
2017-08-27 11:28:37 +00:00
2017-10-06 00:42:32 +00:00
// Zip file to build
2020-01-30 00:48:28 +00:00
$FILENAMEZIP = '' ;
2017-08-27 11:28:37 +00:00
2017-10-06 00:42:32 +00:00
// Load module
2018-10-31 14:04:01 +00:00
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
dol_include_once ( $pathtofile );
2020-01-30 00:48:28 +00:00
$class = 'mod' . $module ;
2024-08-18 16:16:08 +00:00
$moduleobj = null ;
2021-02-26 17:26:44 +00:00
if ( class_exists ( $class )) {
2017-10-06 00:42:32 +00:00
try {
$moduleobj = new $class ( $db );
2024-11-11 13:48:18 +00:00
'@phan-var-force DolibarrModules $moduleobj' ;
2024-11-04 22:53:20 +00:00
/** @var DolibarrModules $moduleobj */
2020-05-21 07:35:30 +00:00
} catch ( Exception $e ) {
2017-10-06 00:42:32 +00:00
$error ++ ;
2021-05-02 10:15:31 +00:00
dol_print_error ( $db , $e -> getMessage ());
2017-10-06 00:42:32 +00:00
}
2024-11-11 13:48:18 +00:00
}
if ( $moduleobj === null ) {
2017-10-06 00:42:32 +00:00
$error ++ ;
$langs -> load ( " errors " );
2021-05-02 10:15:31 +00:00
dol_print_error ( $db , $langs -> trans ( " ErrorFailedToLoadModuleDescriptorForXXX " , $module ));
2017-10-06 00:42:32 +00:00
exit ;
}
2017-09-22 23:24:31 +00:00
2026-05-10 23:26:15 +00:00
$outputfilezip = null ;
2019-11-13 18:37:08 +00:00
$arrayversion = explode ( '.' , $moduleobj -> version , 3 );
2021-02-26 17:26:44 +00:00
if ( count ( $arrayversion )) {
2022-10-12 14:17:25 +00:00
$FILENAMEZIP = " module_ " . $modulelowercase . '-' . $arrayversion [ 0 ] . ( empty ( $arrayversion [ 1 ]) ? '.0' : '.' . $arrayversion [ 1 ]) . ( empty ( $arrayversion [ 2 ]) ? '' : " . " . $arrayversion [ 2 ]) . " .zip " ;
2017-10-06 00:42:32 +00:00
$outputfilezip = dol_buildpath ( $modulelowercase , 0 ) . '/bin/' . $FILENAMEZIP ;
}
print '<br>' ;
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " PathToModulePackage " ) . ' : ' ;
2025-02-05 21:59:37 +00:00
if ( $outputfilezip === null || ! dol_is_file ( $outputfilezip )) {
2021-02-26 17:26:44 +00:00
print '<span class="opacitymedium">' . $langs -> trans ( " FileNotYetGenerated " ) . '</span>' ;
} else {
2017-10-06 00:42:32 +00:00
$relativepath = $modulelowercase . '/bin/' . $FILENAMEZIP ;
print '<strong><a href="' . DOL_URL_ROOT . '/document.php?modulepart=packages&file=' . urlencode ( $relativepath ) . '">' . $outputfilezip . '</a></strong>' ;
2021-05-10 19:28:11 +00:00
print ' <span class="opacitymedium">(' . $langs -> trans ( " GeneratedOn " ) . ' ' . dol_print_date ( dol_filemtime ( $outputfilezip ), 'dayhour' ) . ')</span>' ;
2022-10-12 14:17:25 +00:00
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>' ;
2017-10-06 00:42:32 +00:00
}
2022-03-11 15:21:28 +00:00
print '</strong>' ;
print '<br>' ;
2017-10-06 00:42:32 +00:00
print '<br>' ;
2019-03-11 14:58:37 +00:00
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST" name="generatepackage">' ;
2019-12-18 22:12:31 +00:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2017-10-06 00:42:32 +00:00
print '<input type="hidden" name="action" value="generatepackage">' ;
print '<input type="hidden" name="tab" value="' . dol_escape_htmltag ( $tab ) . '">' ;
print '<input type="hidden" name="module" value="' . dol_escape_htmltag ( $module ) . '">' ;
print '<input type="submit" class="button" name="generatepackage" value="' . $langs -> trans ( " BuildPackage " ) . '">' ;
print '</form>' ;
}
2022-04-12 09:11:26 +00:00
if ( $tab == 'tabs' ) {
$pathtofile = $listofmodules [ strtolower ( $module )][ 'moduledescriptorrelpath' ];
$tabs = $moduleobj -> tabs ;
if ( $action != 'editfile' || empty ( $file )) {
print '<span class="opacitymedium">' ;
$htmlhelp = $langs -> trans ( " TabsDefDescTooltip " , '{s1}' );
$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 );
print $form -> textwithpicto ( $langs -> trans ( " TabsDefDesc " ), $htmlhelp , 1 , 'help' , '' , 0 , 2 , 'helpondesc' ) . '<br>' ;
print '</span>' ;
print '<br>' ;
2024-10-28 10:42:35 +00:00
print '<span class="fa fa-file"></span> ' . $langs -> trans ( " DescriptorFile " ) . ' : <strong>' . $pathtofile . '</strong>' ;
2024-05-01 16:04:18 +00:00
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>' ;
2022-04-12 09:11:26 +00:00
print '<br>' ;
print '<br>' ;
print load_fiche_titre ( $langs -> trans ( " ListOfTabsEntries " ), '' , '' );
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="action" value="addproperty">' ;
print '<input type="hidden" name="tab" value="objects">' ;
print '<input type="hidden" name="module" value="' . dol_escape_htmltag ( $module ) . '">' ;
print '<input type="hidden" name="tabobj" value="' . dol_escape_htmltag ( $tabobj ) . '">' ;
print '<div class="div-table-responsive">' ;
print '<table class="noborder small">' ;
print '<tr class="liste_titre">' ;
print_liste_field_titre ( " ObjectType " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " Tab " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " Title " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " LangFile " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " Condition " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
print_liste_field_titre ( " Path " , $_SERVER [ " PHP_SELF " ], '' , " " , $param , '' , $sortfield , $sortorder );
print " </tr> \n " ;
if ( count ( $tabs )) {
foreach ( $tabs as $tab ) {
$parts = explode ( ':' , $tab [ 'data' ]);
$objectType = $parts [ 0 ];
$tabName = $parts [ 1 ];
$tabTitle = isset ( $parts [ 2 ]) ? $parts [ 2 ] : '' ;
$langFile = isset ( $parts [ 3 ]) ? $parts [ 3 ] : '' ;
$condition = isset ( $parts [ 4 ]) ? $parts [ 4 ] : '' ;
$path = isset ( $parts [ 5 ]) ? $parts [ 5 ] : '' ;
2022-04-12 09:15:40 +00:00
// If we want to remove the tab, then the format is 'objecttype:tabname:optionalcondition'
2022-04-12 09:11:26 +00:00
// See: https://wiki.dolibarr.org/index.php?title=Tabs_system#To_remove_an_existing_tab
if ( $tabName [ 0 ] === '-' ) {
$tabTitle = '' ;
$condition = isset ( $parts [ 2 ]) ? $parts [ 2 ] : '' ;
}
print '<tr class="oddeven">' ;
print '<td>' ;
print dol_escape_htmltag ( $parts [ 0 ]);
print '</td>' ;
print '<td>' ;
2022-04-12 09:17:24 +00:00
if ( $tabName [ 0 ] === " + " ) {
2022-04-12 09:11:26 +00:00
print '<span class="badge badge-status4 badge-status">' . dol_escape_htmltag ( $tabName ) . '</span>' ;
2022-04-12 09:17:24 +00:00
} else {
2022-04-12 09:11:26 +00:00
print '<span class="badge badge-status8 badge-status">' . dol_escape_htmltag ( $tabName ) . '</span>' ;
2022-04-12 09:17:24 +00:00
}
2022-04-12 09:11:26 +00:00
print '</td>' ;
print '<td>' ;
print dol_escape_htmltag ( $tabTitle );
print '</td>' ;
print '<td>' ;
print dol_escape_htmltag ( $langFile );
print '</td>' ;
print '<td>' ;
print dol_escape_htmltag ( $condition );
print '</td>' ;
print '<td>' ;
print dol_escape_htmltag ( $path );
print '</td>' ;
print '</tr>' ;
}
} else {
2023-07-31 20:40:17 +00:00
print '<tr><td colspan="5"><span class="opacitymedium">' . $langs -> trans ( " None " ) . '</span></td></tr>' ;
2022-04-12 09:11:26 +00:00
}
print '</table>' ;
print '</div>' ;
print '</form>' ;
} else {
$fullpathoffile = dol_buildpath ( $file , 0 );
$content = file_get_contents ( $fullpathoffile );
// New module
print '<form action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="action" value="savefile">' ;
print '<input type="hidden" name="file" value="' . dol_escape_htmltag ( $file ) . '">' ;
print '<input type="hidden" name="tab" value="' . $tab . '">' ;
print '<input type="hidden" name="module" value="' . $module . '">' ;
2024-08-15 14:57:02 +00:00
$posCursor = ( empty ( $find )) ? array () : array ( 'find' => $find );
2024-08-01 08:52:53 +00:00
$doleditor = new DolEditor ( 'editfilecontent' , $content , '' , 300 , 'Full' , 'In' , true , false , 'ace' , 0 , '99%' , 0 , $posCursor );
2023-12-04 12:46:42 +00:00
print $doleditor -> Create ( 1 , '' , false , $langs -> trans ( " File " ) . ' : ' . $file , ( GETPOST ( 'format' , 'aZ09' ) ? GETPOST ( 'format' , 'aZ09' ) : 'html' ));
2022-04-12 09:11:26 +00:00
print '<br>' ;
print '<center>' ;
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="' . dol_escape_htmltag ( $langs -> trans ( " Save " )) . '">' ;
print ' ' ;
print '<input type="submit" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag ( $langs -> trans ( " Cancel " )) . '">' ;
print '</center>' ;
print '</form>' ;
}
}
2021-02-26 17:26:44 +00:00
if ( $tab != 'description' ) {
2020-10-27 17:19:31 +00:00
print dol_get_fiche_end ();
2017-10-06 00:42:32 +00:00
}
}
2017-05-08 21:55:46 +00:00
}
2020-10-27 17:19:31 +00:00
print dol_get_fiche_end (); // End modules
2017-05-08 21:55:46 +00:00
2023-10-29 15:44:41 +00:00
2018-08-14 07:55:58 +00:00
// End of page
2017-03-29 19:36:50 +00:00
llxFooter ();
$db -> close ();