From edd56da1f8915b395fb3b33a4a6411615f8fdbdf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Aug 2024 16:31:53 +0200 Subject: [PATCH 001/152] Fix to force to get a token with the refresh token --- .../modules/oauth/google_oauthcallback.php | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index 1949caeadd9cd..2b6d484c51ace 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -151,10 +151,11 @@ exit(); } + if (!GETPOST('code')) { dol_syslog("Page is called without the 'code' parameter defined"); - // If we enter this page without 'code' parameter, it means we click on the link from login page and we want to get the redirect + // If we enter this page without 'code' parameter, it means we click on the link from login page ($forlogin is set) or from setup page and we want to get the redirect // to the OAuth provider login page. $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl; $_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider; @@ -164,14 +165,16 @@ // No need to save more data in sessions. We have several info into $_SESSION['datafromloginform'], saved when form is posted with a click // on "Login with Google" with param actionlogin=login and beforeoauthloginredirect=google, by the functions_googleoauth.php. + // Set approval_prompt. Note: A refresh token will be provided only if prompt is done. if ($forlogin) { - // Set approval_prompt $approval_prompt = getDolGlobalString('OAUTH_GOOGLE_FORCE_PROMPT_ON_LOGIN', 'auto'); // Can be 'force' $apiService->setApprouvalPrompt($approval_prompt); + } else { + $apiService->setApprouvalPrompt('force'); } // This may create record into oauth_state before the header redirect. - // Creation of record with state in this tables depend on the Provider used (see its constructor). + // Creation of record with state, create record or just update column state of table llx_oauth_token (and create/update entry in llx_oauth_state) depending on the Provider used (see its constructor). if ($state) { $url = $apiService->getAuthorizationUri(array('state' => $state)); } else { @@ -209,7 +212,9 @@ } } - // we go on oauth provider authorization page + //var_dump($url);exit; + + // we go on oauth provider authorization page, we will then go back on this page but into the other branch of the if (!GETPOST('code')) header('Location: '.$url); exit(); } else { @@ -233,9 +238,13 @@ $db->begin(); // This requests the token from the received OAuth code (call of the https://oauth2.googleapis.com/token endpoint) - // Result is stored into object managed by class DoliStorage into includes/OAuth/Common/Storage/DoliStorage.php, so into table llx_oauth_token + // Result is stored into object managed by class DoliStorage into includes/OAuth/Common/Storage/DoliStorage.php and into database table llx_oauth_token $token = $apiService->requestAccessToken(GETPOST('code'), $state); + // The refresh token is inside the object token if the prompt was forced only. + //$refreshtoken = $token->getRefreshToken(); + //var_dump($refreshtoken); + // Note: The extraparams has the 'id_token' than contains a lot of information about the user. $extraparams = $token->getExtraParams(); $jwt = explode('.', $extraparams['id_token']); @@ -305,8 +314,8 @@ $tmparray = (empty($_SESSION['datafromloginform']) ? array() : $_SESSION['datafromloginform']); $entitytosearchuser = (isset($tmparray['entity']) ? $tmparray['entity'] : -1); - // Delete the token - $storage->clearToken('Google'); + // Delete the old token + $storage->clearToken('Google'); // Delete the token called ("Google-".$storage->keyforprovider) $tmpuser = new User($db); $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, 0, 1); // Load user. Can load with email_oauth2. From 4a9d039d0e43a51d6118487a0a357e1288c3fcd5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Aug 2024 17:05:13 +0200 Subject: [PATCH 002/152] NEW enhance the OAUTH2 token manager. Can refresh a token from page. --- htdocs/admin/oauthlogintokens.php | 127 ++++++++++++++++++++++-------- htdocs/langs/en_US/oauth.lang | 13 ++- 2 files changed, 104 insertions(+), 36 deletions(-) diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index 164c858ac2d5b..47c76a3a9283e 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; use OAuth\Common\Storage\DoliStorage; +use OAuth\Common\Consumer\Credentials; $supportedoauth2array = getSupportedOauth2Array(); @@ -114,6 +115,66 @@ $action = ''; } +// Test a refresh of a token using the refresh token +if ($action == 'refreshtoken' && $user->admin) { + $keyforprovider = GETPOST('keyforprovider'); + $OAUTH_SERVICENAME = GETPOST('service'); + + // Show value of token + $tokenobj = null; + // Load OAUth libraries + require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; + // Dolibarr storage + $storage = new DoliStorage($db, $conf, $keyforprovider); + try { + // $OAUTH_SERVICENAME is for example 'Google-keyforprovider' + print ''."\n"; + $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + $expire = ($tokenobj->getEndOfLife() !== -9002 && $tokenobj->getEndOfLife() !== -9001 && time() > ($tokenobj->getEndOfLife() - 30)); + // We have to save the refresh token because Google give it only once + $refreshtoken = $tokenobj->getRefreshToken(); + print ''; + + //print $tokenobj->getExtraParams()['id_token'].'
'; + //print $tokenobj->getAccessToken().'
'; + //print $tokenobj->getRefreshToken().'
'; + + + //var_dump($expire); + + // We do the refresh even if not expired, this is the goal of action. + $credentials = new Credentials( + getDolGlobalString('OAUTH_'.strtoupper($OAUTH_SERVICENAME).'_ID'), + getDolGlobalString('OAUTH_'.strtoupper($OAUTH_SERVICENAME).'_SECRET'), + getDolGlobalString('OAUTH_'.strtoupper($OAUTH_SERVICENAME).'_URLAUTHORIZE') + ); + $serviceFactory = new \OAuth\ServiceFactory(); + $oauthname = explode('-', $OAUTH_SERVICENAME); + // ex service is Google-Emails we need only the first part Google + $apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, array()); + + if ($apiService instanceof OAuth\OAuth2\Service\AbstractService || $apiService instanceof OAuth\OAuth1\Service\AbstractService) { + // ServiceInterface does not provide refreshAccessToekn, AbstractService does + $tokenobj = $apiService->refreshAccessToken($tokenobj); + $tokenobj->setRefreshToken($refreshtoken); // Restore the refresh token + $storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj); + + if ($expire) { + setEventMessages($langs->trans("OldTokenWasExpiredItHasBeenRefresh"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("OldTokenWasNotExpiredButItHasBeenRefresh"), null, 'mesgs'); + } + } else { + dol_print_error($db, 'apiService is not a correct OAUTH2 Abstract service'); + } + + $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + } catch (Exception $e) { + // Return an error if token not found + print $e->getMessage(); + } +} + /* * View @@ -188,6 +249,8 @@ } $state = $shortscope; // TODO USe a better state + $urltorefresh = $_SERVER["PHP_SELF"].'?action=refreshtoken&token='.newToken(); + // Define $urltorenew, $urltodelete, $urltocheckperms if ($keyforsupportedoauth2array == 'OAUTH_GITHUB_NAME') { // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service). @@ -217,6 +280,9 @@ if ($urltorenew) { $urltorenew .= '&keyforprovider='.urlencode($keyforprovider); } + if ($urltorefresh) { + $urltorefresh .= '&keyforprovider='.urlencode($keyforprovider).'&service='.urlencode($OAUTH_SERVICENAME); + } if ($urltodelete) { $urltodelete .= '&keyforprovider='.urlencode($keyforprovider); } @@ -334,50 +400,61 @@ if (is_object($tokenobj)) { //test on $storage->hasAccessToken($OAUTH_SERVICENAME) ? if ($urltodelete) { - print ''.$langs->trans('DeleteAccess').'
'; + print ''.$langs->trans('DeleteAccess').''; } else { - print ''.$langs->trans('GoOnTokenProviderToDeleteToken').'
'; + print ''.$langs->trans('GoOnTokenProviderToDeleteToken').''; } } // Request remote token if ($urltorenew) { - print ''.$langs->trans('GetAccess').''; - print $form->textwithpicto('', $langs->trans('RequestAccess')); - print '
'; + print ''.$langs->trans('GetAccess').''; + } + // Request remote token + if ($urltorefresh && $refreshtoken) { + print ''.$langs->trans('RefreshToken').''; } + // Check remote access if ($urltocheckperms) { - print '
'.$langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME).': '.$urltocheckperms.''; + print '
'.$langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME).': '.$urltocheckperms.''; } } print ''; print ''; - print ''; - print ''; - //var_dump($key); - print $langs->trans("TokenRawValue").''; - print ''; if (is_object($tokenobj)) { - print '
'."\n"; - } - print ''; - print ''."\n"; + print ''; + print ''; + //var_dump($key); + print $langs->trans("TokenRawValue").''; + print ''; + if (is_object($tokenobj)) { + print '
'."\n"; + } + print ''; + print ''."\n"; - if (is_object($tokenobj)) { print ''; print ''; //var_dump($key); print $langs->trans("AccessToken").''; print ''; $tokentoshow = $tokenobj->getAccessToken(); - print ''.showValueWithClipboardCPButton($tokentoshow, 1, dol_trunc($tokentoshow, 32)).'
'; + print ''.showValueWithClipboardCPButton($tokentoshow, 1, dol_trunc($tokentoshow, 32)).''; //print 'Refresh: '.$tokenobj->getRefreshToken().'
'; //print 'EndOfLife: '.$tokenobj->getEndOfLife().'
'; //var_dump($tokenobj->getExtraParams()); /*print '
Extra:
';*/ + + print '   -   '; + print $langs->trans("ExpirationDate").': '; + print ''; + print $expiredat; + + print $expire ? ' ('.$langs->trans("TokenExpired").')' : ' ('.$langs->trans("TokenNotExpired").')'; + print ''; print ''."\n"; @@ -391,22 +468,6 @@ print ''.showValueWithClipboardCPButton($refreshtoken, 1, dol_trunc($refreshtoken, 32)).''; print ''; print ''; - - // Token expired - print ''; - print ''; - //var_dump($key); - print $langs->trans("TOKEN_EXPIRED"); - print ''; - print ''; - print yn($expire); - - print '   -   '; - print $langs->trans("TOKEN_EXPIRE_AT").': '; - print ''; - print $expiredat; - print ''; - print ''; } print ''; diff --git a/htdocs/langs/en_US/oauth.lang b/htdocs/langs/en_US/oauth.lang index 9c681bd23bb62..21565246fe270 100644 --- a/htdocs/langs/en_US/oauth.lang +++ b/htdocs/langs/en_US/oauth.lang @@ -9,9 +9,9 @@ HasAccessToken=A token was generated and saved into local database NewTokenStored=Token received and saved ToCheckDeleteTokenOnProvider=Click here to check/delete authorization saved by %s OAuth provider TokenDeleted=Token deleted -GetAccess=Click here to get a token +GetAccess=Get new Token RequestAccess=Click here to request/renew access and receive a new token -DeleteAccess=Click here to delete the token +DeleteAccess=Delete Token RedirectURL=Redirect URL UseTheFollowingUrlAsRedirectURI=Use the following URL as the Redirect URL when creating your credentials with your OAuth provider ListOfSupportedOauthProviders=Add your OAuth2 token providers. Then, go on your OAuth provider admin page to create/get an OAuth ID and Secret and save them here. Once done, switch on the other tab to generate your token. @@ -40,5 +40,12 @@ AOAuthEntryForThisProviderAndLabelAlreadyHasAKey=An OAuth entry for this provide URLOfServiceForAuthorization=URL provided by OAuth service for authentication Scopes=Permissions (Scopes) ScopeUndefined=Permissions (Scopes) undefined (see previous tab) -TokenRawValue=Token (Raw value) +TokenRawValue=Full Token (object) AccessToken=Access Token +TokenExpired=Expired +TokenNotExpired=Not expired +ExpirationDate=Expiration date +RefreshToken=Refresh token +RefreshTokenHelp=Use the Refresh Token to get a new Access Token +OldTokenWasExpiredItHasBeenRefresh=Old token was expired, it has been refreshed +OldTokenWasNotExpiredButItHasBeenRefresh=Old token was not expired but it has been refreshed From 56d4a30bdfee921b73fe81028c492a696e9120b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Aug 2024 17:05:29 +0200 Subject: [PATCH 003/152] Code comment --- htdocs/core/class/CMailFile.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index e263c282dc372..0d912d1496daf 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1139,13 +1139,14 @@ public function sendfile() $oauthname = explode('-', $OAUTH_SERVICENAME); // ex service is Google-Emails we need only the first part Google $apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, array()); - // We have to save the token because Google give it only once + + // We have to save the refresh token because Google give it only once $refreshtoken = $tokenobj->getRefreshToken(); if ($apiService instanceof OAuth\OAuth2\Service\AbstractService || $apiService instanceof OAuth\OAuth1\Service\AbstractService) { // ServiceInterface does not provide refreshAccessToekn, AbstractService does $tokenobj = $apiService->refreshAccessToken($tokenobj); - $tokenobj->setRefreshToken($refreshtoken); + $tokenobj->setRefreshToken($refreshtoken); // Restore the refresh token $storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj); } From 3789332f40212c9a97b5e4f1b42a025ca6089da1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Aug 2024 16:31:53 +0200 Subject: [PATCH 004/152] Fix to force to get a token with the refresh token --- .../modules/oauth/google_oauthcallback.php | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index 1949caeadd9cd..2b6d484c51ace 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -151,10 +151,11 @@ exit(); } + if (!GETPOST('code')) { dol_syslog("Page is called without the 'code' parameter defined"); - // If we enter this page without 'code' parameter, it means we click on the link from login page and we want to get the redirect + // If we enter this page without 'code' parameter, it means we click on the link from login page ($forlogin is set) or from setup page and we want to get the redirect // to the OAuth provider login page. $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl; $_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider; @@ -164,14 +165,16 @@ // No need to save more data in sessions. We have several info into $_SESSION['datafromloginform'], saved when form is posted with a click // on "Login with Google" with param actionlogin=login and beforeoauthloginredirect=google, by the functions_googleoauth.php. + // Set approval_prompt. Note: A refresh token will be provided only if prompt is done. if ($forlogin) { - // Set approval_prompt $approval_prompt = getDolGlobalString('OAUTH_GOOGLE_FORCE_PROMPT_ON_LOGIN', 'auto'); // Can be 'force' $apiService->setApprouvalPrompt($approval_prompt); + } else { + $apiService->setApprouvalPrompt('force'); } // This may create record into oauth_state before the header redirect. - // Creation of record with state in this tables depend on the Provider used (see its constructor). + // Creation of record with state, create record or just update column state of table llx_oauth_token (and create/update entry in llx_oauth_state) depending on the Provider used (see its constructor). if ($state) { $url = $apiService->getAuthorizationUri(array('state' => $state)); } else { @@ -209,7 +212,9 @@ } } - // we go on oauth provider authorization page + //var_dump($url);exit; + + // we go on oauth provider authorization page, we will then go back on this page but into the other branch of the if (!GETPOST('code')) header('Location: '.$url); exit(); } else { @@ -233,9 +238,13 @@ $db->begin(); // This requests the token from the received OAuth code (call of the https://oauth2.googleapis.com/token endpoint) - // Result is stored into object managed by class DoliStorage into includes/OAuth/Common/Storage/DoliStorage.php, so into table llx_oauth_token + // Result is stored into object managed by class DoliStorage into includes/OAuth/Common/Storage/DoliStorage.php and into database table llx_oauth_token $token = $apiService->requestAccessToken(GETPOST('code'), $state); + // The refresh token is inside the object token if the prompt was forced only. + //$refreshtoken = $token->getRefreshToken(); + //var_dump($refreshtoken); + // Note: The extraparams has the 'id_token' than contains a lot of information about the user. $extraparams = $token->getExtraParams(); $jwt = explode('.', $extraparams['id_token']); @@ -305,8 +314,8 @@ $tmparray = (empty($_SESSION['datafromloginform']) ? array() : $_SESSION['datafromloginform']); $entitytosearchuser = (isset($tmparray['entity']) ? $tmparray['entity'] : -1); - // Delete the token - $storage->clearToken('Google'); + // Delete the old token + $storage->clearToken('Google'); // Delete the token called ("Google-".$storage->keyforprovider) $tmpuser = new User($db); $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, 0, 1); // Load user. Can load with email_oauth2. From f002fb4ed132ab5eeabe3b161b31eb8e1009fc4f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 10:36:43 +0200 Subject: [PATCH 005/152] Use the non deprecated function loadRights instead of getrights --- htdocs/api/class/api_access.class.php | 2 +- htdocs/api/class/api_login.class.php | 2 +- htdocs/core/lib/ws.lib.php | 2 +- htdocs/core/modules/DolibarrModules.class.php | 2 +- htdocs/dav/fileserver.php | 2 +- htdocs/ecm/search.php | 2 +- htdocs/expensereport/class/expensereport.class.php | 2 +- htdocs/expensereport/list.php | 2 +- htdocs/fourn/commande/index.php | 2 +- htdocs/holiday/list.php | 2 +- htdocs/imports/emptyexample.php | 2 +- htdocs/main.inc.php | 2 +- htdocs/modulebuilder/template/css/mymodule.css.php | 4 +--- htdocs/modulebuilder/template/scripts/mymodule.php | 2 +- .../template/test/phpunit/MyObjectTest.php | 2 +- htdocs/public/agenda/agendaexport.php | 4 ++-- htdocs/public/cron/cron_run_jobs_by_url.php | 4 ++-- htdocs/public/stripe/ipn.php | 2 +- htdocs/theme/eldy/style.css.php | 2 +- htdocs/theme/md/style.css.php | 2 +- htdocs/user/agenda.php | 2 +- htdocs/user/agenda_extsites.php | 2 +- htdocs/user/bank.php | 2 +- htdocs/user/card.php | 2 +- htdocs/user/class/user.class.php | 5 +++-- htdocs/user/clicktodial.php | 2 +- htdocs/user/document.php | 2 +- htdocs/user/group/card.php | 2 +- htdocs/user/group/ldap.php | 2 +- htdocs/user/group/perms.php | 6 +++--- htdocs/user/ldap.php | 2 +- htdocs/user/messaging.php | 2 +- htdocs/user/note.php | 2 +- htdocs/user/notify/card.php | 4 ++-- htdocs/user/param_ihm.php | 2 +- htdocs/user/perms.php | 10 +++++----- htdocs/user/virtualcard.php | 2 +- htdocs/webservices/server_actioncomm.php | 4 ++-- htdocs/webservices/server_category.php | 2 +- htdocs/webservices/server_contact.php | 2 +- htdocs/webservices/server_invoice.php | 4 ++-- htdocs/webservices/server_order.php | 4 ++-- htdocs/webservices/server_other.php | 2 +- htdocs/webservices/server_productorservice.php | 4 ++-- htdocs/webservices/server_project.php | 4 ++-- htdocs/webservices/server_supplier_invoice.php | 2 +- htdocs/webservices/server_thirdparty.php | 4 ++-- htdocs/webservices/server_user.php | 6 +++--- 48 files changed, 67 insertions(+), 68 deletions(-) diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index fb074a8b32d42..1355261d0ef17 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -200,7 +200,7 @@ public function __isAllowed() } // User seems valid - $fuser->getrights(); + $fuser->loadRights(); // Set the property $user to the $user of API static::$user = $fuser; diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index 77f337743fc30..810c0829952d8 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -144,7 +144,7 @@ public function index($login, $password, $entity = '', $reset = 0) // Renew the hash if (empty($tmpuser->api_key) || $reset) { - $tmpuser->getrights(); + $tmpuser->loadRights(); if (!$tmpuser->hasRight('user', 'self', 'creer')) { if (empty($tmpuser->api_key)) { throw new RestException(403, 'No API token set for this user and user need write permission on itself to reset its API token'); diff --git a/htdocs/core/lib/ws.lib.php b/htdocs/core/lib/ws.lib.php index f2f39b2eddf4b..2efffff73af25 100644 --- a/htdocs/core/lib/ws.lib.php +++ b/htdocs/core/lib/ws.lib.php @@ -72,7 +72,7 @@ function check_authentication($authentication, &$error, &$errorcode, &$errorlabe // Validation of login if (!$error) { - $fuser->getrights(); // Load permission of user + $fuser->loadRights(); // Load permission of user // Authentication mode if (empty($dolibarr_main_authentication)) { diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 88232c594f0c6..8bc05ad4a545c 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2019,7 +2019,7 @@ public function insert_permissions($reinitadminperms = 0, $force_entity = null, if (!empty($reinitadminperms) && !empty($user->admin)) { // Reload permission for current user if defined // We reload permissions $user->clearrights(); - $user->getrights(); + $user->loadRights(); } } $this->db->free($resql); diff --git a/htdocs/dav/fileserver.php b/htdocs/dav/fileserver.php index 6911838834e2d..756639438f627 100644 --- a/htdocs/dav/fileserver.php +++ b/htdocs/dav/fileserver.php @@ -58,7 +58,7 @@ $user = new User($db); if (isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_USER'] != '') { $user->fetch(0, $_SERVER['PHP_AUTH_USER']); - $user->getrights(); + $user->loadRights(); } // Load translation files required by the page diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index 202ea14afb741..2910d7a418441 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -40,7 +40,7 @@ $result = restrictedArea($user, 'ecm', ''); // Load permissions -$user->getrights('ecm'); +$user->loadRights('ecm'); // Get parameters $socid = GETPOSTINT('socid'); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 57b80393617f4..8cec82fcb6d90 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2743,7 +2743,7 @@ public function computeTotalKm($fk_cat, $qty, $tva) $currentUser = new User($db); $currentUser->fetch($this->fk_user); - $currentUser->getrights('expensereport'); + $currentUser->loadRights('expensereport'); //Clean $qty = (float) price2num($qty); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index a66ee7c4b161f..3e5ca842ec8ef 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -271,7 +271,7 @@ if ($id > 0) { // Charge utilisateur edite $fuser->fetch($id, '', '', 1); - $fuser->getrights(); + $fuser->loadRights(); $user_id = $fuser->id; $search_user = $user_id; diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index ee6ca36224a7d..91d50316771f3 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -256,7 +256,7 @@ $userstatic = new User($db); $userstatic->id = $obj->rowid; - $userstatic->getrights('fournisseur'); + $userstatic->loadRights('fournisseur'); if ($userstatic->hasRight('fournisseur', 'commande', 'approuver')) { print ''; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 6baf24ccb2462..16aad58d970c2 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -253,7 +253,7 @@ if ($id > 0) { // Charge utilisateur edite $fuser->fetch($id, '', '', 1); - $fuser->getrights(); + $fuser->loadRights(); $user_id = $fuser->id; $search_employee = $user_id; diff --git a/htdocs/imports/emptyexample.php b/htdocs/imports/emptyexample.php index ec84e98e7145e..7f72904e13d06 100644 --- a/htdocs/imports/emptyexample.php +++ b/htdocs/imports/emptyexample.php @@ -79,7 +79,7 @@ function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = // Check exportkey if (empty($datatoimport)) { - $user->getrights(); + $user->loadRights(); llxHeader(); print '
Bad value for datatoimport.
'; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 399cb9030f147..a26222d051c9e 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1471,7 +1471,7 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type, $stopcode = 1) } // Load permissions - $user->getrights(); + $user->loadRights(); } dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"].' - action='.GETPOST('action', 'aZ09').', massaction='.GETPOST('massaction', 'aZ09').(defined('NOTOKENRENEWAL') ? ' NOTOKENRENEWAL='.constant('NOTOKENRENEWAL') : ''), LOG_NOTICE); diff --git a/htdocs/modulebuilder/template/css/mymodule.css.php b/htdocs/modulebuilder/template/css/mymodule.css.php index d805158c1145d..f243960eceeac 100644 --- a/htdocs/modulebuilder/template/css/mymodule.css.php +++ b/htdocs/modulebuilder/template/css/mymodule.css.php @@ -81,7 +81,7 @@ // Load user to have $user->conf loaded (not done by default here because of NOLOGIN constant defined) and load permission if we need to use them in CSS /*if (empty($user->id) && !empty($_SESSION['dol_login'])) { $user->fetch('',$_SESSION['dol_login']); - $user->getrights(); + $user->loadRights(); }*/ @@ -107,5 +107,3 @@ .myclasscss { /* ... */ } - - diff --git a/htdocs/modulebuilder/template/scripts/mymodule.php b/htdocs/modulebuilder/template/scripts/mymodule.php index 9bb5d54cfa506..1f59f3a602c17 100644 --- a/htdocs/modulebuilder/template/scripts/mymodule.php +++ b/htdocs/modulebuilder/template/scripts/mymodule.php @@ -105,7 +105,7 @@ dol_print_error(null, $user->error); exit; } -$user->getrights(); +$user->loadRights(); $hookmanager->initHooks(array('cli')); diff --git a/htdocs/modulebuilder/template/test/phpunit/MyObjectTest.php b/htdocs/modulebuilder/template/test/phpunit/MyObjectTest.php index 89b2e3db55466..97861ddf147b6 100644 --- a/htdocs/modulebuilder/template/test/phpunit/MyObjectTest.php +++ b/htdocs/modulebuilder/template/test/phpunit/MyObjectTest.php @@ -34,7 +34,7 @@ if (empty($user->id)) { print "Load permissions for admin user nb 1\n"; $user->fetch(1); - $user->getrights(); + $user->loadRights(); } $conf->global->MAIN_DISABLE_ALL_MAILS = 1; diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index 284dfd6091ea7..718c97e03edab 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -162,7 +162,7 @@ function llxFooterVierge() // Check config if (!getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY')) { - $user->getrights(); + $user->loadRights(); top_httphead(); @@ -189,7 +189,7 @@ function llxFooterVierge() } elseif (empty($reshook)) { // Check exportkey if (!GETPOST("exportkey") || getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY') != GETPOST("exportkey")) { - $user->getrights(); + $user->loadRights(); top_httphead(); diff --git a/htdocs/public/cron/cron_run_jobs_by_url.php b/htdocs/public/cron/cron_run_jobs_by_url.php index 3185f7bfa558e..86c0cc7629957 100644 --- a/htdocs/public/cron/cron_run_jobs_by_url.php +++ b/htdocs/public/cron/cron_run_jobs_by_url.php @@ -118,7 +118,7 @@ exit; } } -$user->getrights(); +$user->loadRights(); $id = GETPOST('id', 'alpha'); // We accept non numeric id. We will filter later. @@ -180,7 +180,7 @@ exit(-1); } } - $user->getrights(); + $user->loadRights(); } } diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 787a1474904a3..b7cec54d44caf 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -93,7 +93,7 @@ // We set the user to use for all ipn actions in Dolibarr $user = new User($db); $user->fetch(getDolGlobalString('STRIPE_USER_ACCOUNT_FOR_ACTIONS')); - $user->getrights(); + $user->loadRights(); } else { httponly_accessforbidden('Error: Setup of module Stripe not complete for mode '.dol_escape_htmltag($service).'. The STRIPE_USER_ACCOUNT_FOR_ACTIONS is not defined.', 400, 1); } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 33266aeaad855..7b65ab171b65c 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -69,7 +69,7 @@ // and permission, so we can later calculate number of top menu ($nbtopmenuentries) according to user profile. if (empty($user->id) && !empty($_SESSION['dol_login'])) { $user->fetch('', $_SESSION['dol_login'], '', 1); - $user->getrights(); + $user->loadRights(); // Reload menu now we have the good user (and we need the good menu to have ->showmenu('topnb') correct. $menumanager = new MenuManager($db, empty($user->socid) ? 0 : 1); diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8b7eac9d3e26c..8e8d4083dd931 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -71,7 +71,7 @@ // and permission, so we can later calculate number of top menu ($nbtopmenuentries) according to user profile. if (empty($user->id) && !empty($_SESSION['dol_login'])) { $user->fetch('', $_SESSION['dol_login'], '', 1); - $user->getrights(); + $user->loadRights(); //$user->loadPersonalConf(); // Reload menu now we have the good user (and we need the good menu to have ->showmenu('topnb') correct. diff --git a/htdocs/user/agenda.php b/htdocs/user/agenda.php index 5b8cf4ffe56bd..41f128cd68e55 100644 --- a/htdocs/user/agenda.php +++ b/htdocs/user/agenda.php @@ -72,7 +72,7 @@ $object = new User($db); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref, '', 1); - $object->getrights(); + $object->loadRights(); } // Security check diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php index c3fc53bea3f71..9c435ca8485fc 100644 --- a/htdocs/user/agenda_extsites.php +++ b/htdocs/user/agenda_extsites.php @@ -59,7 +59,7 @@ $object = new User($db); $object->fetch($id, '', '', 1); -$object->getrights(); +$object->loadRights(); // Security check $socid = 0; diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 1a667909ad55b..d6d857f0f27ea 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -71,7 +71,7 @@ $object = new User($db); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref, '', 1); - $object->getrights(); + $object->loadRights(); } $account = new UserBankAccount($db); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index a17d32c5f582d..b0d64602e214d 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1437,7 +1437,7 @@ // Check if user has rights if (!getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) { - $object->getrights(); + $object->loadRights(); if (empty($object->nb_rights) && $object->statut != 0 && empty($object->admin)) { setEventMessages($langs->trans('UserHasNoPermissions'), null, 'warnings'); } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 1f2374dffdf60..df1d2e782f0a3 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1299,7 +1299,7 @@ public function loadRights($moduletag = '', $forcereload = 0) $sql .= " ".$this->db->prefix()."usergroup_user as gu,"; $sql .= " ".$this->db->prefix()."rights_def as r"; $sql .= " WHERE r.id = gr.fk_id"; - // @FIXME Very strange business rules. Must be alays the same than into user->getrights() user/perms.php and user/group/perms.php + // @FIXME Very strange business rules. Must be always the same than into user->loadRights() user/perms.php and user/group/perms.php if (getDolGlobalString('MULTICOMPANY_BACKWARD_COMPATIBILITY')) { if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) { $sql .= " AND gu.entity IN (0,".$conf->entity.")"; @@ -1443,11 +1443,12 @@ public function loadRights($moduletag = '', $forcereload = 0) /** * Load permissions granted to a user->id into object user->rights - * TODO Remove this method. It has a name conflict with getRights() in CommonObject. + * TODO Remove this method. It has a name conflict with getRights() in CommonObject and was replaced in v20 with loadRights() * * @param string $moduletag Limit permission for a particular module ('' by default means load all permissions) * @param int $forcereload Force reload of permissions even if they were already loaded (ignore cache) * @return void + * @deprecated * * @see clearrights(), delrights(), addrights(), hasRight() * @phpstan-ignore-next-line diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 0b67de7d1978d..6b540e1f40733 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -81,7 +81,7 @@ if ($id > 0) { $object = new User($db); $object->fetch($id, '', '', 1); - $object->getrights(); + $object->loadRights(); $object->fetch_clicktodial(); $person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname; diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 668890e0c91ea..06b51074c9549 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -102,7 +102,7 @@ $object = new User($db); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref, '', 1); - $object->getrights(); + $object->loadRights(); //$upload_dir = $conf->user->multidir_output[$object->entity] . "/" . $object->id ; // For users, the upload_dir is always $conf->user->entity for the moment $upload_dir = $conf->user->dir_output."/".$object->id; diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 51386fc3a0724..22a6db65cdb4b 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -68,7 +68,7 @@ // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. -$object->getrights(); +$object->loadRights(); // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('groupcard', 'globalcard')); diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php index 2bb9b4b2fac45..7149862bb15fe 100644 --- a/htdocs/user/group/ldap.php +++ b/htdocs/user/group/ldap.php @@ -44,7 +44,7 @@ $object = new UserGroup($db); $object->fetch($id, '', true); -$object->getrights(); +$object->loadRights(); // Users/Groups management only in master entity if transverse mode if (isModEnabled('multicompany') && $conf->entity > 1 && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) { diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 58c254d2717f2..8166525316b21 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -74,7 +74,7 @@ $object = new UserGroup($db); $object->fetch($id); -$object->getrights(); +$object->loadRights(); $entity = $conf->entity; @@ -106,7 +106,7 @@ } $user->clearrights(); - $user->getrights(); + $user->loadRights(); } if ($action == 'delrights' && $caneditperms) { @@ -122,7 +122,7 @@ } $user->clearrights(); - $user->getrights(); + $user->loadRights(); } } diff --git a/htdocs/user/ldap.php b/htdocs/user/ldap.php index 45549a292486e..a40826c632f51 100644 --- a/htdocs/user/ldap.php +++ b/htdocs/user/ldap.php @@ -47,7 +47,7 @@ $object = new User($db); $object->fetch($id, '', '', 1); -$object->getrights(); +$object->loadRights(); // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $hookmanager->initHooks(array('usercard', 'userldap', 'globalcard')); diff --git a/htdocs/user/messaging.php b/htdocs/user/messaging.php index eabf89a25b3f8..713c7f83b343e 100644 --- a/htdocs/user/messaging.php +++ b/htdocs/user/messaging.php @@ -80,7 +80,7 @@ if ($result <= 0) { accessforbidden('User not found'); } - $object->getrights(); + $object->loadRights(); } // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context diff --git a/htdocs/user/note.php b/htdocs/user/note.php index 4fe5dd7e8de49..c6db1416a7b02 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -42,7 +42,7 @@ $object = new User($db); $object->fetch($id, '', '', 1); -$object->getrights(); +$object->loadRights(); // If user is not user read and no permission to read other users, we stop if (($object->id != $user->id) && (!$user->hasRight("user", "user", "read"))) { diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index f0027bc3b2e97..c0e20fb88932e 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -69,7 +69,7 @@ $object = new User($db); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref, '', 1); - $object->getrights(); + $object->loadRights(); } $permissiontoadd = (($object->id == $user->id) || ($user->hasRight('user', 'user', 'lire'))); @@ -141,7 +141,7 @@ $object = new User($db); $result = $object->fetch($id, '', '', 1); -$object->getrights(); +$object->loadRights(); $title = $langs->trans("ThirdParty").' - '.$langs->trans("Notification"); if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) { diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index b401d90863f15..e97beefcde0bf 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -69,7 +69,7 @@ // Charge utilisateur edite $object = new User($db); $object->fetch($id, '', '', 1); -$object->getrights(); +$object->loadRights(); // Liste des zone de recherche permanentes supportees /* deprecated diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index d553851236a2c..03d63465a01dc 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -81,7 +81,7 @@ $object = new User($db); $object->fetch($id, '', '', 1); -$object->getrights(); +$object->loadRights(); $entity = $conf->entity; @@ -111,12 +111,12 @@ // If we are changing our own permissions, we reload permissions and menu if ($object->id == $user->id) { $user->clearrights(); - $user->getrights(); + $user->loadRights(); $menumanager->loadMenu(); } $object->clearrights(); - $object->getrights(); + $object->loadRights(); } if ($action == 'delrights' && $caneditperms && $confirm == 'yes') { @@ -130,12 +130,12 @@ // If we are changing our own permissions, we reload permissions and menu if ($object->id == $user->id) { $user->clearrights(); - $user->getrights(); + $user->loadRights(); $menumanager->loadMenu(); } $object->clearrights(); - $object->getrights(); + $object->loadRights(); } } diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index b519b6d67bf26..d2d180ba5a24b 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -44,7 +44,7 @@ $object = new User($db); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref, '', 1); - $object->getrights(); + $object->loadRights(); } // Security check diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index b1666442c0181..d17e6682ebecf 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -297,7 +297,7 @@ function getActionComm($authentication, $id) } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('agenda', 'allactions', 'read')) { $actioncomm = new ActionComm($db); @@ -393,7 +393,7 @@ function getListActionCommType($authentication) $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('agenda', 'myactions', 'read')) { $cactioncomm = new CActionComm($db); diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index ee681c18c738f..b584b88c09194 100644 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -231,7 +231,7 @@ function getCategory($authentication, $id) } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); $nbmax = 10; if ($fuser->hasRight('categorie', 'lire')) { diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index d632ec121b7fd..c9f74cc8f5883 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -289,7 +289,7 @@ function getContact($authentication, $id, $ref_ext) } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); $contact = new Contact($db); $result = $contact->fetch($id, null, $ref_ext); diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index bb4d104c18d04..aa25ba56d18fe 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -330,7 +330,7 @@ function getInvoice($authentication, $id = 0, $ref = '', $ref_ext = '') } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('facture', 'lire')) { $invoice = new Facture($db); @@ -698,7 +698,7 @@ function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = '' ////////////////////// if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('commande', 'lire')) { $order = new Commande($db); diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 8c75b40dfacd8..b73d2bef2fff5 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -407,7 +407,7 @@ function getOrder($authentication, $id = 0, $ref = '', $ref_ext = '') } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('commande', 'lire')) { $order = new Commande($db); @@ -831,7 +831,7 @@ function validOrder($authentication, $id = 0, $id_warehouse = 0) $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('commande', 'lire')) { $order = new Commande($db); diff --git a/htdocs/webservices/server_other.php b/htdocs/webservices/server_other.php index 6fe3799c25385..4d23b21c1a669 100644 --- a/htdocs/webservices/server_other.php +++ b/htdocs/webservices/server_other.php @@ -243,7 +243,7 @@ function getDocument($authentication, $modulepart, $file, $refname = '') } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); // Suppression de la chaine de character ../ dans $original_file $original_file = str_replace("../", "/", $original_file); diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 3d5ce1d17a2d1..443dc4ee53fd9 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -392,7 +392,7 @@ function getProductOrService($authentication, $id = 0, $ref = '', $ref_ext = '', $langcode = ($lang ? $lang : (!getDolGlobalString('MAIN_LANG_DEFAULT') ? 'auto' : $conf->global->MAIN_LANG_DEFAULT)); $langs->setDefaultLang($langcode); - $fuser->getrights(); + $fuser->loadRights(); $nbmax = 10; if ($fuser->hasRight('produit', 'lire') || $fuser->hasRight('service', 'lire')) { @@ -1029,7 +1029,7 @@ function getProductsForCategory($authentication, $id, $lang = '') $langcode = ($lang ? $lang : (!getDolGlobalString('MAIN_LANG_DEFAULT') ? 'auto' : $conf->global->MAIN_LANG_DEFAULT)); $langs->setDefaultLang($langcode); - $fuser->getrights(); + $fuser->loadRights(); $nbmax = 10; if ($fuser->hasRight('produit', 'lire')) { diff --git a/htdocs/webservices/server_project.php b/htdocs/webservices/server_project.php index d254fa870f206..5e731ece5ce2a 100644 --- a/htdocs/webservices/server_project.php +++ b/htdocs/webservices/server_project.php @@ -281,7 +281,7 @@ function createProject($authentication, $project) if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('projet', 'creer')) { $newobject = new Project($db); @@ -376,7 +376,7 @@ function getProject($authentication, $id = '', $ref = '') } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('projet', 'lire')) { $project = new Project($db); diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index 77442df3f0385..482dbb7420643 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -267,7 +267,7 @@ function getSupplierInvoice($authentication, $id = 0, $ref = '', $ref_ext = '') } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('fournisseur', 'facture', 'lire')) { $invoice = new FactureFournisseur($db); diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index d53ee73ac9d3e..83e2acffa769f 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -339,7 +339,7 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '', $bar } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('societe', 'lire')) { $thirdparty = new Societe($db); @@ -845,7 +845,7 @@ function deleteThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') dol_syslog("Function: deleteThirdParty 1"); if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('societe', 'lire') && $fuser->hasRight('societe', 'supprimer')) { $thirdparty = new Societe($db); diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 1ffc7458d736a..fd6a4e96f14f6 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -354,7 +354,7 @@ function getUser($authentication, $id, $ref = '', $ref_ext = '') } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('user', 'user', 'lire') || ($fuser->hasRight('user', 'self', 'creer') && $id && $id == $fuser->id) @@ -517,7 +517,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('societe', 'creer')) { $thirdparty = new Societe($db); @@ -716,7 +716,7 @@ function setUserPassword($authentication, $shortuser) } if (!$error) { - $fuser->getrights(); + $fuser->loadRights(); if ($fuser->hasRight('user', 'user', 'password') || $fuser->hasRight('user', 'self', 'password')) { $userstat = new User($db); From 5727dadfdd2da425ed86114e0e280b4d50614b54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 10:55:53 +0200 Subject: [PATCH 006/152] Fix condition to get permission --- htdocs/user/class/user.class.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 92b3f4c38e628..c0f0b8fc13e96 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1241,11 +1241,11 @@ public function loadRights($moduletag = '', $forcereload = 0) // on old version, we use entity defined into table r only $sql .= " AND r.entity IN (0,".(isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') ? "1," : "").$conf->entity.")"; } else { - // On table r=rights_def, the unique key is (id, entity) because id is hard coded into module descriptor and insert during module activation. + // On table r=rights_def, the unique key is (id, entity) because id is hard coded into module descriptor and inserted during module activation. // So we must include the filter on entity on both table r. and ur. $sql .= " AND r.entity = ".((int) $conf->entity)." AND ur.entity = ".((int) $conf->entity); } - $sql .= " AND ur.fk_user= ".((int) $this->id); + $sql .= " AND ur.fk_user = ".((int) $this->id); $sql .= " AND r.perms IS NOT NULL"; if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled @@ -1275,12 +1275,12 @@ public function loadRights($moduletag = '', $forcereload = 0) if (!isset($this->rights->$module->$perms) || !is_object($this->rights->$module->$perms)) { $this->rights->$module->$perms = new stdClass(); } - if (empty($this->rights->$module->$perms->$subperms)) { + if (empty($this->rights->$module->$perms->$subperms)) { // if not already counted $this->nb_rights++; } $this->rights->$module->$perms->$subperms = 1; } else { - if (empty($this->rights->$module->$perms)) { + if (empty($this->rights->$module->$perms)) { // if not already counted $this->nb_rights++; } $this->rights->$module->$perms = 1; @@ -1318,6 +1318,9 @@ public function loadRights($moduletag = '', $forcereload = 0) $sql .= " AND gr.fk_usergroup = gu.fk_usergroup"; $sql .= " AND gu.fk_user = ".((int) $this->id); $sql .= " AND r.perms IS NOT NULL"; + if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { + $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled + } if ($moduletag) { $sql .= " AND r.module = '".$this->db->escape($moduletag)."'"; } @@ -1343,16 +1346,16 @@ public function loadRights($moduletag = '', $forcereload = 0) if (!isset($this->rights->$module->$perms) || !is_object($this->rights->$module->$perms)) { $this->rights->$module->$perms = new stdClass(); } - if (empty($this->rights->$module->$perms->$subperms)) { // already counted + if (empty($this->rights->$module->$perms->$subperms)) { // if not already counted $this->nb_rights++; } $this->rights->$module->$perms->$subperms = 1; } else { - if (empty($this->rights->$module->$perms)) { // already counted - $this->nb_rights++; - } // if we have already define a subperm like this $this->rights->$module->level1->level2 with llx_user_rights, we don't want override level1 because the level2 can be not define on user group if (!isset($this->rights->$module->$perms) || !is_object($this->rights->$module->$perms)) { + if (empty($this->rights->$module->$perms)) { // if not already counted + $this->nb_rights++; + } $this->rights->$module->$perms = 1; } } From 6558c69ac7ba0308fde7d2a529a4377c2a065c2b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 11:17:14 +0200 Subject: [PATCH 007/152] Doc --- htdocs/user/class/user.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index c0f0b8fc13e96..e266212b5ab9a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1238,7 +1238,10 @@ public function loadRights($moduletag = '', $forcereload = 0) $sql .= " ".$this->db->prefix()."rights_def as r"; $sql .= " WHERE r.id = ur.fk_id"; if (getDolGlobalString('MULTICOMPANY_BACKWARD_COMPATIBILITY')) { - // on old version, we use entity defined into table r only + // On old version, we used entity defined into table r only + // @FIXME Test on MULTICOMPANY_BACKWARD_COMPATIBILITY is a very strange business rules because the select should be always the + // same than into user->loadRights() in user/perms.php and user/group/perms.php + // We should never use and remove this case. $sql .= " AND r.entity IN (0,".(isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') ? "1," : "").$conf->entity.")"; } else { // On table r=rights_def, the unique key is (id, entity) because id is hard coded into module descriptor and inserted during module activation. @@ -1299,8 +1302,10 @@ public function loadRights($moduletag = '', $forcereload = 0) $sql .= " ".$this->db->prefix()."usergroup_user as gu,"; $sql .= " ".$this->db->prefix()."rights_def as r"; $sql .= " WHERE r.id = gr.fk_id"; - // @FIXME Very strange business rules. Must be alays the same than into user->getrights() user/perms.php and user/group/perms.php if (getDolGlobalString('MULTICOMPANY_BACKWARD_COMPATIBILITY')) { + // @FIXME Test on MULTICOMPANY_BACKWARD_COMPATIBILITY is a very strange business rules because the select should be always the + // same than into user->loadRights() in user/perms.php and user/group/perms.php + // We should never use and remove this case. if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) { $sql .= " AND gu.entity IN (0,".$conf->entity.")"; } else { From 12e65797246ad6e0326fc8b248bff3842221c974 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 13:52:04 +0200 Subject: [PATCH 008/152] FIX fatal error --- htdocs/core/actions_addupdatedelete.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index b06ba8834e951..39ad76ff8eecc 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -178,7 +178,7 @@ // Special field $model_pdf = GETPOST('model'); - if (!empty($model_pdf) && property_exists($this, 'model_pdf')) { + if (!empty($model_pdf) && property_exists($object, 'model_pdf')) { $object->model_pdf = $model_pdf; } From fc2bf8134f1e28bc5129ebea99a0106f4b344a16 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 13:52:04 +0200 Subject: [PATCH 009/152] FIX fatal error --- htdocs/core/actions_addupdatedelete.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 45e630799b8ce..ba22c8990e9fd 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -178,7 +178,7 @@ // Special field $model_pdf = GETPOST('model'); - if (!empty($model_pdf) && property_exists($this, 'model_pdf')) { + if (!empty($model_pdf) && property_exists($object, 'model_pdf')) { $object->model_pdf = $model_pdf; } From 16c1c016173e9e3a7482dcff3c350ab0c77ebb65 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 14:07:43 +0200 Subject: [PATCH 010/152] Debug v20 - Fix roworder of stocktransfer --- htdocs/core/ajax/row.php | 8 +++++++- .../stocktransfer/stocktransfer_card.php | 20 ++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php index 274750b50d13b..625ffc62a8d99 100644 --- a/htdocs/core/ajax/row.php +++ b/htdocs/core/ajax/row.php @@ -57,6 +57,7 @@ $table_element_line = GETPOST('table_element_line', 'aZ09', 3); $fk_element = GETPOST('fk_element', 'aZ09', 3); $element_id = GETPOSTINT('element_id', 3); +$action = 'edit'; // Security check @@ -120,6 +121,8 @@ $perm = 1; } elseif ($table_element_line == 'contratdet' && $fk_element == 'fk_contrat' && $user->hasRight('contrat', 'creer')) { $perm = 1; + } elseif ($table_element_line == 'stocktransfer_stocktransferline' && $fk_element == 'fk_stocktransfer' && $user->hasRight('stocktransfer', 'stocktransfer', 'write')) { + $perm = 1; } else { $tmparray = explode('_', $table_element_line); $tmpmodule = $tmparray[0]; @@ -128,6 +131,7 @@ $perm = 1; } } + // Overwrite $perm by hook $parameters = array('roworder' => &$roworder, 'table_element_line' => &$table_element_line, 'fk_element' => &$fk_element, 'element_id' => &$element_id, 'perm' => &$perm); $row = new GenericObject($db); $row->table_element_line = $table_element_line; @@ -137,12 +141,14 @@ if ($reshook > 0) { $perm = $hookmanager->resArray['perm']; } + if (! $perm) { // We should not be here. If we are not allowed to reorder rows, feature should not be visible on script. // If we are here, it is a hack attempt, so we report a warning. print 'Bad permission to modify position of lines for object in table '.$table_element_line; dol_syslog('Bad permission to modify position of lines for object in table='.$table_element_line.', fk_element='.$fk_element, LOG_WARNING); - accessforbidden('Bad permission to modify position of lines for object in table '.$table_element_line); + //accessforbidden('Bad permission to modify position of lines for object in table '.$table_element_line); + httponly_accessforbidden('Bad permission to modify position of lines for object in table '.$table_element_line); } $rowordertab = explode(',', $roworder); diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php index 837e8bc5eedca..b40ec3b1d5cab 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php @@ -844,21 +844,24 @@ print ''; } - print ''; - + // Warehouse source + print ''; if ($action === 'editline' && $line->id == $lineid) { print $formproduct->selectWarehouses($line->fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200'); } else { print $warehousestatics->getNomUrl(1); } print ''; - print ''; + + // Warehouse target + print ''; if ($action === 'editline' && $line->id == $lineid) { print $formproduct->selectWarehouses($line->fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200'); } else { print $warehousestatict->getNomUrl(1); } print ''; + if ($action === 'editline' && $line->id == $lineid) { print ''; } else { @@ -877,9 +880,11 @@ print ''; print price($line->pmp, 0, '', 1, -1, -1, $conf->currency); print ''; + print ''; print price($line->pmp * $line->qty, 0, '', 1, -1, -1, $conf->currency); print ''; + if (empty($object->status) && $permissiontoadd) { if ($action === 'editline' && $line->id == $lineid) { //print ''; @@ -967,14 +972,14 @@ } } - // On vide le tableau pour qu'il se charge tout seul lors de l'appel à la fonction select_warehouses + // We clean array. It is filled automatically when calling function select_warehouses $formproduct->cache_warehouses = array(); // In warehouse print ''; print $formproduct->selectWarehouses(empty($fk_warehouse_source) ? $object->fk_warehouse_source : $fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource); print ''; - // On vide le tableau pour qu'il se charge tout seul lors de l'appel à la fonction select_warehouses + // We clean array. It is filled automatically when calling function select_warehouses $formproduct->cache_warehouses = array(); // Out warehouse print ''; @@ -983,18 +988,23 @@ // Qty print ''; + // PMP print ''; if (getDolGlobalInt('PRODUCT_USE_UNITS')) { // Unité print ''; } + // PMP * Qty print ''; + // Button to add line print ''; + // Grad and drop lines print ''; + print ''; } From f4d841c807bd2fb6e1f684425db3601b35b9e4b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 14:07:43 +0200 Subject: [PATCH 011/152] Debug v20 - Fix roworder of stocktransfer --- htdocs/core/ajax/row.php | 8 +++++++- .../stocktransfer/stocktransfer_card.php | 20 ++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php index 274750b50d13b..625ffc62a8d99 100644 --- a/htdocs/core/ajax/row.php +++ b/htdocs/core/ajax/row.php @@ -57,6 +57,7 @@ $table_element_line = GETPOST('table_element_line', 'aZ09', 3); $fk_element = GETPOST('fk_element', 'aZ09', 3); $element_id = GETPOSTINT('element_id', 3); +$action = 'edit'; // Security check @@ -120,6 +121,8 @@ $perm = 1; } elseif ($table_element_line == 'contratdet' && $fk_element == 'fk_contrat' && $user->hasRight('contrat', 'creer')) { $perm = 1; + } elseif ($table_element_line == 'stocktransfer_stocktransferline' && $fk_element == 'fk_stocktransfer' && $user->hasRight('stocktransfer', 'stocktransfer', 'write')) { + $perm = 1; } else { $tmparray = explode('_', $table_element_line); $tmpmodule = $tmparray[0]; @@ -128,6 +131,7 @@ $perm = 1; } } + // Overwrite $perm by hook $parameters = array('roworder' => &$roworder, 'table_element_line' => &$table_element_line, 'fk_element' => &$fk_element, 'element_id' => &$element_id, 'perm' => &$perm); $row = new GenericObject($db); $row->table_element_line = $table_element_line; @@ -137,12 +141,14 @@ if ($reshook > 0) { $perm = $hookmanager->resArray['perm']; } + if (! $perm) { // We should not be here. If we are not allowed to reorder rows, feature should not be visible on script. // If we are here, it is a hack attempt, so we report a warning. print 'Bad permission to modify position of lines for object in table '.$table_element_line; dol_syslog('Bad permission to modify position of lines for object in table='.$table_element_line.', fk_element='.$fk_element, LOG_WARNING); - accessforbidden('Bad permission to modify position of lines for object in table '.$table_element_line); + //accessforbidden('Bad permission to modify position of lines for object in table '.$table_element_line); + httponly_accessforbidden('Bad permission to modify position of lines for object in table '.$table_element_line); } $rowordertab = explode(',', $roworder); diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php index 15ccc7da44851..c4e285b550333 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php @@ -844,21 +844,24 @@ print ''; } - print ''; - + // Warehouse source + print ''; if ($action === 'editline' && $line->id == $lineid) { print $formproduct->selectWarehouses($line->fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200'); } else { print $warehousestatics->getNomUrl(1); } print ''; - print ''; + + // Warehouse target + print ''; if ($action === 'editline' && $line->id == $lineid) { print $formproduct->selectWarehouses($line->fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200'); } else { print $warehousestatict->getNomUrl(1); } print ''; + if ($action === 'editline' && $line->id == $lineid) { print ''; } else { @@ -877,9 +880,11 @@ print ''; print price($line->pmp, 0, '', 1, -1, -1, $conf->currency); print ''; + print ''; print price($line->pmp * $line->qty, 0, '', 1, -1, -1, $conf->currency); print ''; + if (empty($object->status) && $permissiontoadd) { if ($action === 'editline' && $line->id == $lineid) { //print ''; @@ -967,14 +972,14 @@ } } - // On vide le tableau pour qu'il se charge tout seul lors de l'appel à la fonction select_warehouses + // We clean array. It is filled automatically when calling function select_warehouses $formproduct->cache_warehouses = array(); // In warehouse print ''; print $formproduct->selectWarehouses(empty($fk_warehouse_source) ? $object->fk_warehouse_source : $fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource); print ''; - // On vide le tableau pour qu'il se charge tout seul lors de l'appel à la fonction select_warehouses + // We clean array. It is filled automatically when calling function select_warehouses $formproduct->cache_warehouses = array(); // Out warehouse print ''; @@ -983,18 +988,23 @@ // Qty print ''; + // PMP print ''; if (getDolGlobalInt('PRODUCT_USE_UNITS')) { // Unité print ''; } + // PMP * Qty print ''; + // Button to add line print ''; + // Grad and drop lines print ''; + print ''; } From 3d7d901f80feef4143c50688de279876b1d7ff22 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 14:19:19 +0200 Subject: [PATCH 012/152] Debug look and feel v20 --- .../stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php | 2 +- htdocs/product/stock/stocktransfer/stocktransfer_card.php | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/product/stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php b/htdocs/product/stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php index 939b2bc0b136b..af8444991edd6 100644 --- a/htdocs/product/stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php +++ b/htdocs/product/stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php @@ -38,7 +38,7 @@ function stocktransferPrepareHead($object) $head = array(); $head[$h][0] = dol_buildpath("/product/stock/stocktransfer/stocktransfer_card.php", 1).'?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("StockTransfer"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php index b40ec3b1d5cab..ecb64197c7ed1 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php @@ -782,8 +782,6 @@ $param = ''; - $conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE = true; // Full display needed to see all column title details - print ''; print getTitleFieldOfList($langs->trans('ProductRef'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'tagtd maxwidthonsmartphone '); if (isModEnabled('productbatch')) { From a41d9daa21b18c11ab055e3605c3a12ddd4a9942 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 14:35:42 +0200 Subject: [PATCH 013/152] Debug v20 --- .../stocktransfer/doc/pdf_eagle.modules.php | 19 ++-- .../doc/pdf_eagle_proforma.modules.php | 92 ++++++++++--------- 2 files changed, 58 insertions(+), 53 deletions(-) diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php index 82e331db31a4a..d58971275aabe 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php @@ -120,7 +120,7 @@ public function __construct(DoliDB $db) // Get source company $this->emetteur = $mysoc; - if (!$this->emetteur->country_code) { + if (empty($this->emetteur->country_code)) { $this->emetteur->country_code = substr($langs->defaultlang, -2); } @@ -192,7 +192,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $outputlangs->charset_output = 'ISO-8859-1'; } - // Load traductions files required by page + // Load translation files required by page $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch", "stocks", "stocktransfer@stocktransfer")); global $outputlangsbis; @@ -264,7 +264,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } if ($conf->stocktransfer->dir_output) { - // Definition de $dir et $file + // Definition of $dir and $file if ($object->specimen) { $dir = $conf->stocktransfer->dir_output; $file = $dir."/SPECIMEN.pdf"; @@ -325,10 +325,10 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); - $pdf->SetSubject($outputlangs->transnoentities("Shipment")); + $pdf->SetSubject($outputlangs->transnoentities("StockTransfer")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("StockTransfer")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); } @@ -755,7 +755,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede return 0; } } else { - $this->error = $langs->transnoentities("ErrorConstantNotDefined", "EXP_OUTPUTDIR"); + $this->error = $langs->transnoentities("ErrorConstantNotDefined", "STOCKTRANSFER_OUTPUTDIR"); return 0; } } @@ -1010,14 +1010,15 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) // phpcs:enable global $conf, $langs; - $langs->load("orders"); + // Load traductions files required by page + $outputlangs->loadLangs(array("main", "bills", "propal", "orders", "companies")); $default_font_size = pdf_getPDFFontSize($outputlangs); pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); // Show Draft Watermark - if ($object->statut == 0 && (getDolGlobalString('SHIPPING_DRAFT_WATERMARK'))) { + if ($object->statut == 0 && (getDolGlobalString('STOCKTRANSFER_DRAFT_WATERMARK'))) { pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->SHIPPING_DRAFT_WATERMARK); } @@ -1272,6 +1273,6 @@ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { // phpcs:enable $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0); - return pdf_pagefoot($pdf, $outputlangs, 'SHIPPING_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); + return pdf_pagefoot($pdf, $outputlangs, 'STOCKTRANSFER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php index 24ceb7b885568..7e9b3ce310750 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -86,7 +86,7 @@ public function __construct($db) global $langs, $mysoc; // Translations - $langs->loadLangs(array("main", "bills", "products")); + $langs->loadLangs(array("main", "bills", "products", "stocks")); $this->db = $db; $this->name = $langs->trans("StockTransferSheetProforma"); @@ -158,14 +158,15 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $outputlangs->charset_output = 'ISO-8859-1'; } - // Load translation files required by the page - $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries")); + // Load translation files required by page + $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch", "stocks", "stocktransfer@stocktransfer")); + global $outputlangsbis; + $outputlangsbis = null; if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && $outputlangs->defaultlang != getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) { - global $outputlangsbis; $outputlangsbis = new Translate('', $conf); $outputlangsbis->setDefaultLang(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')); - $outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries")); + $outputlangsbis->loadLangs(array("main", "bills", "orders", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch")); } $nblines = is_array($object->lines) ? count($object->lines) : 0; @@ -178,7 +179,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Loop on each lines to detect if there is at least one image to show $realpatharray = array(); $this->atleastonephoto = false; - if (getDolGlobalString('MAIN_GENERATE_ORDERS_WITH_PICTURE')) { + if (getDolGlobalString('MAIN_GENERATE_STOCKTRANSFER_WITH_PICTURE')) { $objphoto = new Product($this->db); for ($i = 0; $i < $nblines; $i++) { @@ -261,14 +262,18 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede global $action; $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + // Set nblines with the new facture lines content after hook + $nblines = is_array($object->lines) ? count($object->lines) : 0; + // Create pdf instance $pdf = pdf_getInstance($this->format); - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $default_font_size = pdf_getPDFFontSize($outputlangs); $pdf->SetAutoPageBreak(1, 0); $heightforinfotot = 40; // Height reserved to output the info and total part $heightforfreetext = getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin) + $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) { $pdf->setPrintHeader(false); @@ -276,7 +281,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { + if (!getDolGlobalString('MAIN_DISABLE_FPDI') && getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); } @@ -286,10 +291,10 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(128, 128, 128); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); - $pdf->SetSubject($outputlangs->transnoentities("PdfOrderTitle")); + $pdf->SetSubject($outputlangs->transnoentities("StockTransferProFormat")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfOrderTitle").($object->thirdparty ? " ".$outputlangs->convToOutputCharset($object->thirdparty->name) : '')); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("StockTransfer")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); } @@ -324,7 +329,8 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $tab_height = 130; // Incoterm - if ($conf->incoterm->enabled) { + $height_incoterms = 0; + if (isModEnabled('incoterm')) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) { $tab_top -= 2; @@ -339,6 +345,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1); $tab_top = $nexY + 6; + $height_incoterms += 4; } } @@ -562,8 +569,8 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); + $pageposafter = $pdf->getPage(); $posyafter = $pdf->GetY(); if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text @@ -682,6 +689,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $tvaligne = $object->lines[$i]->total_tva; } + /* $localtax1ligne = $object->lines[$i]->total_localtax1; $localtax2ligne = $object->lines[$i]->total_localtax2; $localtax1_rate = $object->lines[$i]->localtax1_tx; @@ -689,11 +697,6 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $localtax1_type = $object->lines[$i]->localtax1_type; $localtax2_type = $object->lines[$i]->localtax2_type; - // TODO remise_percent is an obsolete field for object parent - /*if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100; - if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; - if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;*/ - $vatrate = (string) $object->lines[$i]->tva_tx; // Retrieve type from database for backward compatibility with old records @@ -727,6 +730,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $this->tva[$vatrate] = 0; } $this->tva[$vatrate] += $tvaligne; + */ // Add line if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) { @@ -781,14 +785,10 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; - // Affiche zone infos - // ! No paiement information for this model ! - //$posy = $this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs); - - // Affiche zone totaux + // Display total area $posy = $this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); - // Pied de page + // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { $pdf->AliasNbPages(); @@ -1178,7 +1178,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); // Show Draft Watermark - if ($object->statut == 0 && getDolGlobalString('COMMANDE_DRAFT_WATERMARK')) { + if ($object->statut == 0 && getDolGlobalString('STOCKTRANSFER_DRAFT_WATERMARK')) { pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', getDolGlobalString('COMMANDE_DRAFT_WATERMARK')); } @@ -1188,7 +1188,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek $w = 110; $posy = $this->marge_haute; - $posx = $this->page_largeur - $this->marge_droite - 100; + $posx = $this->page_largeur - $this->marge_droite - $w; $pdf->SetXY($this->marge_gauche, $posy); @@ -1219,21 +1219,18 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek } } - $pdf->SetFont('', 'B', $default_font_size + 3); - $pdf->SetXY($posx, $posy); - $pdf->SetTextColor(0, 0, 60); - $title = $outputlangs->transnoentities($titlekey); - $pdf->MultiCell($w, 3, $title, '', 'R'); + $pdf->SetDrawColor(128, 128, 128); - $pdf->SetFont('', 'B', $default_font_size); + $posx = $this->page_largeur - $w - $this->marge_droite; + $posy = $this->marge_haute; - $posy += 5; + $pdf->SetFont('', 'B', $default_font_size + 2); $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R'); + $title = $outputlangs->transnoentities("StockTransferSheet").' '.$object->ref; + $pdf->MultiCell($w, 4, $title, '', 'R'); - $posy += 1; - $pdf->SetFont('', '', $default_font_size - 1); + $pdf->SetFont('', '', $default_font_size + 1); // Date prévue depart if (!empty($object->date_prevue_depart)) { @@ -1267,6 +1264,13 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateReelleArrivee")." : ".dol_print_date($object->date_reelle_arrivee, "day", false, $outputlangs, true), '', 'R'); } + if (!empty($object->thirdparty->code_client)) { + $posy += 4; + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); + } + if ($object->ref_client) { $posy += 5; $pdf->SetXY($posx, $posy); @@ -1369,7 +1373,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posx, $posy - 5); - $pdf->MultiCell(66, 5, $outputlangs->transnoentities("Sender").":", 0, 'L'); + $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Sender").":", 0, 'L'); $pdf->SetXY($posx, $posy); $pdf->SetFillColor(230, 230, 230); $pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1); @@ -1414,8 +1418,8 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek // Show recipient $widthrecbox = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 92 : 100; if ($this->page_largeur < 210) { - $widthrecbox = 84; - } // To work with US executive format + $widthrecbox = 84; // To work with US executive format + } $posy = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 40 : 42; $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) { @@ -1452,17 +1456,17 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek /** * Show footer of page. Need this->emetteur object * - * @param TCPDF $pdf PDF - * @param Object $object Object to show - * @param Translate $outputlangs Object lang for output - * @param int $hidefreetext 1=Hide free text - * @return int Return height of bottom margin including footer text + * @param TCPDF $pdf PDF + * @param StockTransfer $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return int Return height of bottom margin including footer text */ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { // phpcs:enable $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0); - return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); + return pdf_pagefoot($pdf, $outputlangs, 'STOCKTRANSFER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } From bc9afff591f86e19380eedbd2ee898391faea970 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 14:19:19 +0200 Subject: [PATCH 014/152] Debug look and feel v20 --- .../stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php | 2 +- htdocs/product/stock/stocktransfer/stocktransfer_card.php | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/product/stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php b/htdocs/product/stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php index 939b2bc0b136b..af8444991edd6 100644 --- a/htdocs/product/stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php +++ b/htdocs/product/stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php @@ -38,7 +38,7 @@ function stocktransferPrepareHead($object) $head = array(); $head[$h][0] = dol_buildpath("/product/stock/stocktransfer/stocktransfer_card.php", 1).'?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("StockTransfer"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php index c4e285b550333..d71bb56640d68 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php @@ -782,8 +782,6 @@ $param = ''; - $conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE = true; // Full display needed to see all column title details - print ''; print getTitleFieldOfList($langs->trans('ProductRef'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'tagtd maxwidthonsmartphone '); if (isModEnabled('productbatch')) { From cd17e88a5045dbbd3700e101fb382f2fe188c94a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 14:35:42 +0200 Subject: [PATCH 015/152] Debug v20 --- .../stocktransfer/doc/pdf_eagle.modules.php | 19 ++-- .../doc/pdf_eagle_proforma.modules.php | 92 ++++++++++--------- 2 files changed, 58 insertions(+), 53 deletions(-) diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php index e06b579cbf3bf..e9369f252754b 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php @@ -120,7 +120,7 @@ public function __construct(DoliDB $db) // Get source company $this->emetteur = $mysoc; - if (!$this->emetteur->country_code) { + if (empty($this->emetteur->country_code)) { $this->emetteur->country_code = substr($langs->defaultlang, -2); } @@ -192,7 +192,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $outputlangs->charset_output = 'ISO-8859-1'; } - // Load traductions files required by page + // Load translation files required by page $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch", "stocks", "stocktransfer@stocktransfer")); global $outputlangsbis; @@ -264,7 +264,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } if ($conf->stocktransfer->dir_output) { - // Definition de $dir et $file + // Definition of $dir and $file if ($object->specimen) { $dir = $conf->stocktransfer->dir_output; $file = $dir."/SPECIMEN.pdf"; @@ -325,10 +325,10 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); - $pdf->SetSubject($outputlangs->transnoentities("Shipment")); + $pdf->SetSubject($outputlangs->transnoentities("StockTransfer")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment")); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("StockTransfer")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); } @@ -755,7 +755,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede return 0; } } else { - $this->error = $langs->transnoentities("ErrorConstantNotDefined", "EXP_OUTPUTDIR"); + $this->error = $langs->transnoentities("ErrorConstantNotDefined", "STOCKTRANSFER_OUTPUTDIR"); return 0; } } @@ -1010,14 +1010,15 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) // phpcs:enable global $conf, $langs; - $langs->load("orders"); + // Load traductions files required by page + $outputlangs->loadLangs(array("main", "bills", "propal", "orders", "companies")); $default_font_size = pdf_getPDFFontSize($outputlangs); pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); // Show Draft Watermark - if ($object->statut == 0 && (getDolGlobalString('SHIPPING_DRAFT_WATERMARK'))) { + if ($object->statut == 0 && (getDolGlobalString('STOCKTRANSFER_DRAFT_WATERMARK'))) { pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->SHIPPING_DRAFT_WATERMARK); } @@ -1272,6 +1273,6 @@ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { // phpcs:enable $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0); - return pdf_pagefoot($pdf, $outputlangs, 'SHIPPING_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); + return pdf_pagefoot($pdf, $outputlangs, 'STOCKTRANSFER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } } diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php index 561b85ff9c02e..5ce8211bb03b6 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -86,7 +86,7 @@ public function __construct($db) global $langs, $mysoc; // Translations - $langs->loadLangs(array("main", "bills", "products")); + $langs->loadLangs(array("main", "bills", "products", "stocks")); $this->db = $db; $this->name = $langs->trans("StockTransferSheetProforma"); @@ -158,14 +158,15 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $outputlangs->charset_output = 'ISO-8859-1'; } - // Load translation files required by the page - $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries")); + // Load translation files required by page + $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch", "stocks", "stocktransfer@stocktransfer")); + global $outputlangsbis; + $outputlangsbis = null; if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && $outputlangs->defaultlang != getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) { - global $outputlangsbis; $outputlangsbis = new Translate('', $conf); $outputlangsbis->setDefaultLang(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')); - $outputlangsbis->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries")); + $outputlangsbis->loadLangs(array("main", "bills", "orders", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch")); } $nblines = is_array($object->lines) ? count($object->lines) : 0; @@ -178,7 +179,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede // Loop on each lines to detect if there is at least one image to show $realpatharray = array(); $this->atleastonephoto = false; - if (getDolGlobalString('MAIN_GENERATE_ORDERS_WITH_PICTURE')) { + if (getDolGlobalString('MAIN_GENERATE_STOCKTRANSFER_WITH_PICTURE')) { $objphoto = new Product($this->db); for ($i = 0; $i < $nblines; $i++) { @@ -261,14 +262,18 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede global $action; $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + // Set nblines with the new facture lines content after hook + $nblines = is_array($object->lines) ? count($object->lines) : 0; + // Create pdf instance $pdf = pdf_getInstance($this->format); - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $default_font_size = pdf_getPDFFontSize($outputlangs); $pdf->SetAutoPageBreak(1, 0); $heightforinfotot = 40; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin) + $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) { $pdf->setPrintHeader(false); @@ -276,7 +281,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { + if (!getDolGlobalString('MAIN_DISABLE_FPDI') && getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); } @@ -286,10 +291,10 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(128, 128, 128); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); - $pdf->SetSubject($outputlangs->transnoentities("PdfOrderTitle")); + $pdf->SetSubject($outputlangs->transnoentities("StockTransferProFormat")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfOrderTitle").($object->thirdparty ? " ".$outputlangs->convToOutputCharset($object->thirdparty->name) : '')); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("StockTransfer")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); } @@ -324,7 +329,8 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $tab_height = 130; // Incoterm - if ($conf->incoterm->enabled) { + $height_incoterms = 0; + if (isModEnabled('incoterm')) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) { $tab_top -= 2; @@ -339,6 +345,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1); $tab_top = $nexY + 6; + $height_incoterms += 4; } } @@ -562,8 +569,8 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); + $pageposafter = $pdf->getPage(); $posyafter = $pdf->GetY(); if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text @@ -682,6 +689,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $tvaligne = $object->lines[$i]->total_tva; } + /* $localtax1ligne = $object->lines[$i]->total_localtax1; $localtax2ligne = $object->lines[$i]->total_localtax2; $localtax1_rate = $object->lines[$i]->localtax1_tx; @@ -689,11 +697,6 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $localtax1_type = $object->lines[$i]->localtax1_type; $localtax2_type = $object->lines[$i]->localtax2_type; - // TODO remise_percent is an obsolete field for object parent - /*if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100; - if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; - if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;*/ - $vatrate = (string) $object->lines[$i]->tva_tx; // Retrieve type from database for backward compatibility with old records @@ -727,6 +730,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $this->tva[$vatrate] = 0; } $this->tva[$vatrate] += $tvaligne; + */ // Add line if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) { @@ -781,14 +785,10 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; - // Affiche zone infos - // ! No paiement information for this model ! - //$posy = $this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs); - - // Affiche zone totaux + // Display total area $posy = $this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); - // Pied de page + // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) { $pdf->AliasNbPages(); @@ -1178,7 +1178,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); // Show Draft Watermark - if ($object->statut == 0 && getDolGlobalString('COMMANDE_DRAFT_WATERMARK')) { + if ($object->statut == 0 && getDolGlobalString('STOCKTRANSFER_DRAFT_WATERMARK')) { pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', getDolGlobalString('COMMANDE_DRAFT_WATERMARK')); } @@ -1188,7 +1188,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek $w = 110; $posy = $this->marge_haute; - $posx = $this->page_largeur - $this->marge_droite - 100; + $posx = $this->page_largeur - $this->marge_droite - $w; $pdf->SetXY($this->marge_gauche, $posy); @@ -1219,21 +1219,18 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek } } - $pdf->SetFont('', 'B', $default_font_size + 3); - $pdf->SetXY($posx, $posy); - $pdf->SetTextColor(0, 0, 60); - $title = $outputlangs->transnoentities($titlekey); - $pdf->MultiCell($w, 3, $title, '', 'R'); + $pdf->SetDrawColor(128, 128, 128); - $pdf->SetFont('', 'B', $default_font_size); + $posx = $this->page_largeur - $w - $this->marge_droite; + $posy = $this->marge_haute; - $posy += 5; + $pdf->SetFont('', 'B', $default_font_size + 2); $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R'); + $title = $outputlangs->transnoentities("StockTransferSheet").' '.$object->ref; + $pdf->MultiCell($w, 4, $title, '', 'R'); - $posy += 1; - $pdf->SetFont('', '', $default_font_size - 1); + $pdf->SetFont('', '', $default_font_size + 1); // Date prévue depart if (!empty($object->date_prevue_depart)) { @@ -1267,6 +1264,13 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateReelleArrivee")." : ".dol_print_date($object->date_reelle_arrivee, "day", false, $outputlangs, true), '', 'R'); } + if (!empty($object->thirdparty->code_client)) { + $posy += 4; + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); + } + if ($object->ref_client) { $posy += 5; $pdf->SetXY($posx, $posy); @@ -1369,7 +1373,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posx, $posy - 5); - $pdf->MultiCell(66, 5, $outputlangs->transnoentities("Sender").":", 0, 'L'); + $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Sender").":", 0, 'L'); $pdf->SetXY($posx, $posy); $pdf->SetFillColor(230, 230, 230); $pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1); @@ -1414,8 +1418,8 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek // Show recipient $widthrecbox = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 92 : 100; if ($this->page_largeur < 210) { - $widthrecbox = 84; - } // To work with US executive format + $widthrecbox = 84; // To work with US executive format + } $posy = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 40 : 42; $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) { @@ -1452,17 +1456,17 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlek /** * Show footer of page. Need this->emetteur object * - * @param TCPDF $pdf PDF - * @param Object $object Object to show - * @param Translate $outputlangs Object lang for output - * @param int $hidefreetext 1=Hide free text - * @return int Return height of bottom margin including footer text + * @param TCPDF $pdf PDF + * @param StockTransfer $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return int Return height of bottom margin including footer text */ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { // phpcs:enable $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0); - return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); + return pdf_pagefoot($pdf, $outputlangs, 'STOCKTRANSFER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); } From 033f0aa0a7f23165579f6af2a8e5b51e69e90e98 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 14:52:34 +0200 Subject: [PATCH 016/152] Fix translations --- .../modules/stocktransfer/doc/pdf_eagle_proforma.modules.php | 2 +- htdocs/langs/en_US/website.lang | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php index 7e9b3ce310750..ac6ecb6b3f25a 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -291,7 +291,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(128, 128, 128); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); - $pdf->SetSubject($outputlangs->transnoentities("StockTransferProFormat")); + $pdf->SetSubject($outputlangs->transnoentities("StockTransferSheetProforma")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("StockTransfer")); diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 33c4d523e2f10..e3468f8189a4e 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -271,7 +271,8 @@ totalTaxIncl=Total (tax incl.) clickToClose=Click to close sidebarCategories=Categories noSubCat=NoSubCat -specialPromo=Specials promotions +specialPromo=Promotions +allSpecials=All promotions newProducts=New products allNewProducts= All new products view=View: From 63f43ad61e350b49d2114d98f7b383da0dd93b5d Mon Sep 17 00:00:00 2001 From: Hasanuzzaman Sattar Date: Fri, 2 Aug 2024 18:23:39 +0530 Subject: [PATCH 017/152] Fix for issue #30531 (#30532) * issue#30513 * FIX#30531 --- htdocs/accountancy/admin/card.php | 6 +++--- htdocs/install/mysql/tables/llx_menu.key.sql | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 59a412fa3a4b6..c15274948eb5c 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -305,15 +305,15 @@ // Account number print ''.$langs->trans("AccountNumber").''; - print ''; + print ''; // Label print ''.$langs->trans("Label").''; - print ''; + print ''; // Label short print ''.$langs->trans("LabelToShow").''; - print ''; + print ''; // Account parent print ''.$langs->trans("Accountparent").''; diff --git a/htdocs/install/mysql/tables/llx_menu.key.sql b/htdocs/install/mysql/tables/llx_menu.key.sql index 4de7b3217e7dc..bf7caf6d346c1 100644 --- a/htdocs/install/mysql/tables/llx_menu.key.sql +++ b/htdocs/install/mysql/tables/llx_menu.key.sql @@ -22,4 +22,4 @@ ALTER TABLE llx_menu ADD INDEX idx_menu_menuhandler_type (menu_handler, type); -- Error SQL DB_ERROR_1170 BLOB/TEXT column 'url' used in key specification without a key length, so we removed completely the unique key --- ALTER TABLE llx_menu ADD UNIQUE INDEX idx_menu_uk_menu (menu_handler, fk_menu, position, entity, url); +-- ALTER TABLE llx_menu ADD UNIQUE INDEX idx_menu_uk_menu (menu_handler, fk_menu, position, entity, url); \ No newline at end of file From 50b0243f0efc34b316e63c2cddc7887e4538881d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 15:00:45 +0200 Subject: [PATCH 018/152] Default selected value --- htdocs/expensereport/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index aa2627af406f2..79c2704dfa0dc 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -167,7 +167,7 @@ 'd.date_valid' => array('label' => $langs->trans("DateValidation"), 'checked' => 1), 'd.date_approve' => array('label' => $langs->trans("DateApprove"), 'checked' => 1), 'd.total_ht' => array('label' => $langs->trans("AmountHT"), 'checked' => 1), - 'd.total_vat' => array('label' => $langs->trans("AmountVAT"), 'checked' => 1), + 'd.total_vat' => array('label' => $langs->trans("AmountVAT"), 'checked' => -1), 'd.total_ttc' => array('label' => $langs->trans("AmountTTC"), 'checked' => 1), 'd.date_create' => array('label' => $langs->trans("DateCreation"), 'checked' => 0, 'position' => 500), 'd.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => 0, 'position' => 500), From 2fc0b5d3cf29e3e2b8c8db9536134b8589b6e12c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 15:00:48 +0200 Subject: [PATCH 019/152] Default selected value From d59568e73b5fa7ae03b1f7ba84f3203280d86d07 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 15:32:54 +0200 Subject: [PATCH 020/152] Trans --- htdocs/langs/en_US/ecm.lang | 10 +++++----- htdocs/theme/eldy/global.inc.php | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/langs/en_US/ecm.lang b/htdocs/langs/en_US/ecm.lang index 5ba4fbe5dc4c6..14b8229687c4b 100644 --- a/htdocs/langs/en_US/ecm.lang +++ b/htdocs/langs/en_US/ecm.lang @@ -2,10 +2,10 @@ ECMNbOfDocs=No. of documents in directory ECMSection=Directory ECMSectionManual=Manual directory -ECMSectionAuto=Automatic directory -ECMSectionsManual=Private manual tree -ECMSectionsAuto=Private automatic tree -ECMSectionsMedias=Public medias tree +ECMSectionAuto=Object directory +ECMSectionsManual=Manual directories +ECMSectionsAuto=Object directories +ECMSectionsMedias=Public medias directories ECMSections=Directories ECMRoot=ECM Root ECMNewSection=New directory @@ -19,7 +19,7 @@ ECMArea=DMS/ECM area ECMAreaDesc=The DMS/ECM (Document Management System / Electronic Content Management) area allows you to save, share and search quickly all kind of documents in Dolibarr. ECMAreaDesc2a=* Manual directories can be used to save documents with a free organization of the tree structure. ECMAreaDesc2b=* Automatic directories are filled automatically when adding documents from the page of an element. -ECMAreaDesc3=* Public directories are files into the subdirectory /medias of the documents directory, readable by everybody with no need to be logged and no need to have the file shared explicitly. It is used to store image files for the emailing or website module for example. +ECMAreaDesc3=* Public directories are files into the subdirectory /medias of the documents directory, readable by everybody on internet with no need to be logged and no need to have the file shared explicitly. It is used to store image files for the emailing or website module for example. ECMSectionWasRemoved=Directory %s has been deleted. ECMSectionWasCreated=Directory %s has been created. ECMSearchByKeywords=Search by keywords diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index a068454cd1dae..bfbe053e67ce2 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1241,7 +1241,7 @@ font-size: 1em; } .listofinvoicetype { - height: 28px; + height: 2.2em; vertical-align: middle; } .divsocialnetwork:not(:last-child) { @@ -2046,7 +2046,7 @@ height: 40px !important; } div.tabBar .listofinvoicetype table tr, div.tabBar .listofinvoicetype table tr td { - height: 28px !important; + height: 2.2em !important; } @@ -4018,7 +4018,7 @@ .border tbody tr, .bordernooddeven tbody tr, .border tbody tr td, .bordernooddeven tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col, tr.liste_titre.box_titre td table td, .bordernooddeven tr td { - height: 28px; + height: 2.2em; } div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar .table-val-border-col { @@ -4611,7 +4611,7 @@ font-family: ; font-weight: ; vertical-align: middle; - height: 28px; + height: 2.2em; } tr.liste_titre th a, th.liste_titre a, tr.liste_titre td a, td.liste_titre a, form.liste_titre div a, div.liste_titre a { text-shadow: none !important; @@ -5701,7 +5701,7 @@ /* display: inline-block; */ padding-: 10px; vertical-align: middle; - line-height: 28px; + line-height: 2.2em; } .websiteselectionsection { font-size: 0.85em; @@ -6203,7 +6203,7 @@ right: 0; bottom: 0; background-color: #ebebeb; - height: 28px; + height: 2.2em; line-height: 2.2em; } .ace_status-indicator { @@ -6720,7 +6720,7 @@ color: #FFF !important; } .select2-container .select2-selection--multiple { - min-height: 28px !important; + min-height: 2.2em !important; } .tableforfield .select2-container .select2-selection--single { height: 25px; @@ -7035,7 +7035,7 @@ padding: 0; vertical-align: middle; min-height: unset; - height: 28px !important; + height: 2.2em !important; opacity: 0; /* width: 1px !important; */ } @@ -7621,7 +7621,7 @@ /* ============================================================================== */ .ticketpublictable td { - height: 28px; + height: 2.2em; } .ticketpublicarea { From eabfc6606f978f5df0460af7d10440c724e8eec7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 16:16:56 +0200 Subject: [PATCH 021/152] Try to fix phpstan warning --- htdocs/core/class/commonobject.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 57e06f3550d4f..f8011cb40716c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8579,10 +8579,10 @@ public function getFieldError($fieldKey) /** * Return validation test result for a field * - * @param array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> $fields Array of properties of field to show - * @param string $fieldKey Key of attribute - * @param string $fieldValue value of attribute - * @return bool return false if fail true on success, see $this->error for error message + * @param array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}?> $fields Array of properties of field to show + * @param string $fieldKey Key of attribute + * @param string $fieldValue Value of attribute + * @return bool Return false if fail true on success, see $this->error for error message */ public function validateField($fields, $fieldKey, $fieldValue) { From d967409f8649eecc5a50457189b992f0d265f8b7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 16:36:30 +0200 Subject: [PATCH 022/152] css look and feel v21 --- htdocs/core/class/extrafields.class.php | 2 +- htdocs/core/tpl/extrafields_list_search_input.tpl.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 10 +++++----- htdocs/theme/md/style.css.php | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6812463071312..2ae7c0bf35145 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1235,7 +1235,7 @@ public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $ } $out = ''; } else { - $out = $form->selectyesno($keyprefix.$key.$keysuffix, $value, 1, false, 1); + $out = $form->selectyesno($keyprefix.$key.$keysuffix, $value, 1, false, 1, 1, 'width75 yesno'); } $out .= ''; // A hidden field ending with "_boolean" that is always set to 1. } elseif ($type == 'price') { diff --git a/htdocs/core/tpl/extrafields_list_search_input.tpl.php b/htdocs/core/tpl/extrafields_list_search_input.tpl.php index ad282d70a4393..d9c860a050fbb 100644 --- a/htdocs/core/tpl/extrafields_list_search_input.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_input.tpl.php @@ -44,14 +44,14 @@ $morecss = ''; $preselectedvalues = (empty($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]); // Here $preselectedvalues can be an array('start'=>int, 'end'=>int) or an int - echo $extrafields->showInputField($key, $preselectedvalues, '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1); + print $extrafields->showInputField($key, $preselectedvalues, '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1); } else { // for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid') $morecss = ''; if (in_array($typeofextrafield, array('link', 'sellist', 'text', 'html'))) { $morecss = 'maxwidth200'; } - echo $extrafields->showInputField($key, (!isset($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]), '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1); + print $extrafields->showInputField($key, (!isset($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]), '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1); } print ''; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index bfbe053e67ce2..654b520b99149 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -407,7 +407,7 @@ margin-top: 5px; } textarea { - border-radius: 0; + border-radius: 3px; border-top: solid 1px var(--inputbordercolor); border-left: solid 1px var(--inputbordercolor); border-right: solid 1px var(--inputbordercolor); @@ -7043,15 +7043,15 @@ @media only screen and (min-width: 768px) { /* CSS to have the dropdown boxes larger that the input search area */ - .select2-container.select2-container--open:not(.graphtype) .select2-dropdown.ui-dialog { + .select2-container.select2-container--open:not(.graphtype):not(.yesno) .select2-dropdown.ui-dialog { min-width: 230px !important; } - .select2-container.select2-container--open:not(.graphtype) .select2-dropdown--below:not(.onrightofpage), - .select2-container.select2-container--open:not(.graphtype) .select2-dropdown--above:not(.onrightofpage) { + .select2-container.select2-container--open:not(.graphtype):not(.yesno) .select2-dropdown--below:not(.onrightofpage), + .select2-container.select2-container--open:not(.graphtype):not(.yesno) .select2-dropdown--above:not(.onrightofpage) { min-width: 230px !important; } .onrightofpage span.select2-dropdown.ui-dialog.select2-dropdown--below, - .onrightofpage span.select2-dropdown.ui-dialog.select2-dropdown--above{ + .onrightofpage span.select2-dropdown.ui-dialog.select2-dropdown--above { min-width: 140px !important; } .combolargeelem.select2-container.select2-container--open .select2-dropdown.ui-dialog { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8e8d4083dd931..caf4a6905797b 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -6953,11 +6953,11 @@ @media only screen and (min-width: 767px) { /* CSS to have the dropdown boxes larger that the input search area */ - .select2-container.select2-container--open:not(.graphtype) .select2-dropdown.ui-dialog { + .select2-container.select2-container--open:not(.graphtype):not(.yesno) .select2-dropdown.ui-dialog { min-width: 240px !important; } - .select2-container.select2-container--open:not(.graphtype) .select2-dropdown--below:not(.onrightofpage), - .select2-container.select2-container--open:not(.graphtype) .select2-dropdown--above:not(.onrightofpage) { + .select2-container.select2-container--open:not(.graphtype):not(.yesno) .select2-dropdown--below:not(.onrightofpage), + .select2-container.select2-container--open:not(.graphtype):not(.yesno) .select2-dropdown--above:not(.onrightofpage) { min-width: 240px !important; } .onrightofpage span.select2-dropdown.ui-dialog.select2-dropdown--below, From dd61bff4dadaaaac06b68430986d4874ee95a27b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 16:39:29 +0200 Subject: [PATCH 023/152] Code simpler --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ef6e0ddf11cb8..1acddf5470451 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -13383,7 +13383,7 @@ function forgeSQLFromUniversalSearchCriteria($filter, &$errorstr = '', $noand = // Test the filter syntax $t = preg_replace_callback('/'.$regexstring.'/i', 'dolForgeDummyCriteriaCallback', $filter); - $t = str_replace(array('and','or','AND','OR',' '), '', $t); // Remove the only strings allowed between each () criteria + $t = str_ireplace(array('and', 'or', ' '), '', $t); // Remove the only strings allowed between each () criteria // If the string result contains something else than '()', the syntax was wrong if (preg_match('/[^\(\)]/', $t)) { From a7c7317d97b75d8dad0d34c91c67dc154ce0c06e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 16:48:01 +0200 Subject: [PATCH 024/152] Fix regression --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1acddf5470451..b1e0ac3375b65 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -13628,7 +13628,7 @@ function dolForgeCriteriaCallback($matches) } else { if (strtoupper($tmpescaped) == 'NULL') { $tmpescaped = 'NULL'; - } elseif (is_numeric((string) $tmpescaped)) { + } elseif (ctype_digit((string) $tmpescaped)) { // if only 0-9 chars, no . $tmpescaped = (int) $tmpescaped; } else { $tmpescaped = (float) $tmpescaped; From b138957cfb8377e8241695b2e9769f0707ba3824 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 16:51:31 +0200 Subject: [PATCH 025/152] Try to fix phpstan --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f8011cb40716c..c38201101ab27 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8579,7 +8579,7 @@ public function getFieldError($fieldKey) /** * Return validation test result for a field * - * @param array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}?> $fields Array of properties of field to show + * @param array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> $fields Array of properties of field to show * @param string $fieldKey Key of attribute * @param string $fieldValue Value of attribute * @return bool Return false if fail true on success, see $this->error for error message From 2f415cafcd960604a4b8a26174eb5a89f4e11f68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Aug 2024 17:06:07 +0200 Subject: [PATCH 026/152] Try to fix phan warning --- htdocs/core/lib/functions.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b1e0ac3375b65..0935d471b9f35 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6940,7 +6940,7 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round * @param Societe $thirdparty_buyer Object of buying third party * @param Societe $thirdparty_seller Object of selling third party ($mysoc if not defined) * @param int $vatnpr If vat rate is NPR or not - * @return int<0,0>|string 0 if not found, localtax rate if found + * @return int<0,0>|string 0 if not found, localtax rate if found (Can be '20', '-19:-15:-9') * @see get_default_tva() */ function get_localtax($vatrate, $local, $thirdparty_buyer = null, $thirdparty_seller = null, $vatnpr = 0) @@ -7020,7 +7020,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer = null, $thirdparty_se } } else { // i am the seller if (!isOnlyOneLocalTax($local)) { // TODO If seller is me, why not always returning this, even if there is only one locatax vat. - return $conf->global->MAIN_INFO_VALUE_LOCALTAX1; + return getDolGlobalString('MAIN_INFO_VALUE_LOCALTAX1'); } } } @@ -7034,7 +7034,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer = null, $thirdparty_se if (in_array($mysoc->country_code, array('ES'))) { return $thirdparty_buyer->localtax2_value; } else { - return $conf->global->MAIN_INFO_VALUE_LOCALTAX2; + return getDolGlobalString('MAIN_INFO_VALUE_LOCALTAX2'); } } } @@ -7204,7 +7204,7 @@ function getTaxesFromId($vatrate, $buyer = null, $seller = null, $firstparamisid * @param Societe $buyer Company object * @param Societe $seller Company object * @param int<0,1> $firstparamisid 1 if first param is ID into table instead of Rate+code (use this if you can) - * @return array{}|array{0:string,1:float,2:string,3:string}|array{0:string,1:float,2:string,3:float,4:string,5:string} array(localtax_type1(1-6 or 0 if not found), rate localtax1, localtax_type2, rate localtax2, accountancycodecust, accountancycodesupp) + * @return array{}|array{0:string,1:int|string,2:string,3:string}|array{0:string,1:int|string,2:string,3:int|string,4:string,5:string} array(localtax_type1('1-6' or '0' if not found), rate localtax1, localtax_type2, rate localtax2, accountancycodecust, accountancycodesupp) * @see getTaxesFromId() */ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid = 0) From 49808847b91b7afb2262572f545a9fab7873a4c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Aug 2024 13:27:19 +0200 Subject: [PATCH 027/152] Ignore phpstan false positive --- htdocs/core/lib/functions2.lib.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 48e8ec902e2e4..7e47eb7c23393 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2246,7 +2246,7 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '') /** - * Clean corrupted tree (orphelins linked to a not existing parent), record linked to themself and child-parent loop + * Clean corrupted database tree (orphelins linked to a not existing parent), record linked to themself, and also child-parent loop * * @param DoliDB $db Database handler * @param string $tabletocleantree Table to clean @@ -2309,6 +2309,7 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent) $listofidtoclean[$cursor] = $id; break; } + // @phpstan-ignore-next-line PHPStan thinks this line is never reached $cursor = $listofparentid[$cursor]; } @@ -2317,8 +2318,8 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent) } } - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree; - $sql .= " SET ".$fieldfkparent." = 0"; + $sql = "UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tabletocleantree); + $sql .= " SET ".$db->sanitize($fieldfkparent)." = 0"; $sql .= " WHERE rowid IN (".$db->sanitize(implode(',', $listofidtoclean)).")"; // So we update only records detected wrong $resql = $db->query($sql); if ($resql) { @@ -2334,9 +2335,9 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent) //else dol_print_error($db); // Check and clean orphelins - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabletocleantree; - $sql .= " SET ".$fieldfkparent." = 0"; - $sql .= " WHERE ".$fieldfkparent." NOT IN (".$db->sanitize(implode(',', $listofid), 1).")"; // So we update only records linked to a non existing parent + $sql = "UPDATE ".MAIN_DB_PREFIX.$db->sanitize($tabletocleantree); + $sql .= " SET ".$db->sanitize($fieldfkparent)." = 0"; + $sql .= " WHERE ".$db->sanitize($fieldfkparent)." NOT IN (".$db->sanitize(implode(',', $listofid), 1).")"; // So we update only records linked to a non existing parent $resql = $db->query($sql); if ($resql) { $nb = $db->affected_rows($sql); From d1f1c0aa57346391e43e85cbcbba667acc77bdcc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Aug 2024 13:44:38 +0200 Subject: [PATCH 028/152] Clean code - Fix phpstan warning --- htdocs/admin/stocktransfer.php | 11 ++--------- htdocs/admin/workstation.php | 11 ++--------- htdocs/core/modules/modAi.class.php | 3 --- htdocs/core/modules/modEventOrganization.class.php | 3 --- htdocs/core/modules/modKnowledgeManagement.class.php | 3 --- htdocs/core/modules/modPartnership.class.php | 3 --- htdocs/core/modules/modRecruitment.class.php | 3 --- htdocs/core/modules/modWorkstation.class.php | 3 --- .../template/core/modules/modMyModule.class.php | 5 +---- 9 files changed, 5 insertions(+), 40 deletions(-) diff --git a/htdocs/admin/stocktransfer.php b/htdocs/admin/stocktransfer.php index 13f894bc72870..e8573c8e860bf 100644 --- a/htdocs/admin/stocktransfer.php +++ b/htdocs/admin/stocktransfer.php @@ -237,13 +237,8 @@ $myTmpObjects[$moduledir] = array('includerefgeneration' => 1, 'includedocgeneration' => 1, 'class' => 'StockTransfer'); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'MyObject') { - continue; - } if ($myTmpObjectArray['includerefgeneration']) { - /* - * Orders Numbering model - */ + // Orders Numbering model $setupnotempty++; print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', ''); @@ -349,9 +344,7 @@ } if ($myTmpObjectArray['includedocgeneration']) { - /* - * Document templates generators - */ + // Document templates generators $setupnotempty++; $type = strtolower($myTmpObjectKey); diff --git a/htdocs/admin/workstation.php b/htdocs/admin/workstation.php index e40a5d1ddfb0a..6be43435b2307 100644 --- a/htdocs/admin/workstation.php +++ b/htdocs/admin/workstation.php @@ -227,13 +227,8 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'MyObject') { - continue; - } if ($myTmpObjectArray['includerefgeneration']) { - /* - * Orders Numbering model - */ + // Orders Numbering model $setupnotempty++; print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', ''); @@ -340,9 +335,7 @@ } if ($myTmpObjectArray['includedocgeneration']) { - /* - * Document templates generators - */ + // Document templates generators $setupnotempty++; $type = strtolower($myTmpObjectKey); diff --git a/htdocs/core/modules/modAi.class.php b/htdocs/core/modules/modAi.class.php index 4aa1f0cce755d..2bf7230a12d7e 100644 --- a/htdocs/core/modules/modAi.class.php +++ b/htdocs/core/modules/modAi.class.php @@ -379,9 +379,6 @@ public function init($options = '') $myTmpObjects['Availabilities'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); // foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - // if ($myTmpObjectKey == 'Availabilities') { - // continue; - // } // if ($myTmpObjectArray['includerefgeneration']) { // $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_availabilitiess.odt'; // $dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir; diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index 4f59e7bdbe5bf..e4be0d8b18f00 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -445,9 +445,6 @@ public function init($options = '') $myTmpObjects['ConferenceOrBooth'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'ConferenceOrBooth') { - continue; - } if ($myTmpObjectArray['includerefgeneration']) { $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/eventorganization/template_conferenceorbooths.odt'; $dirodt = DOL_DATA_ROOT.'/doctemplates/eventorganization'; diff --git a/htdocs/core/modules/modKnowledgeManagement.class.php b/htdocs/core/modules/modKnowledgeManagement.class.php index 80dd7b5fe9a93..92a1da8e8d0af 100644 --- a/htdocs/core/modules/modKnowledgeManagement.class.php +++ b/htdocs/core/modules/modKnowledgeManagement.class.php @@ -447,9 +447,6 @@ public function init($options = '') $myTmpObjects['KnowledgeRecord'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'KnowledgeRecord') { - continue; - } if ($myTmpObjectArray['includerefgeneration']) { $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/knowledgemanagement/template_knowledgerecords.odt'; $dirodt = DOL_DATA_ROOT.'/doctemplates/knowledgemanagement'; diff --git a/htdocs/core/modules/modPartnership.class.php b/htdocs/core/modules/modPartnership.class.php index e99045d05fc00..099cce8a574e3 100644 --- a/htdocs/core/modules/modPartnership.class.php +++ b/htdocs/core/modules/modPartnership.class.php @@ -463,9 +463,6 @@ public function init($options = '') $myTmpObjects['Partnership'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'Partnership') { - continue; - } if ($myTmpObjectArray['includerefgeneration']) { $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_partnerships.odt'; $dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir; diff --git a/htdocs/core/modules/modRecruitment.class.php b/htdocs/core/modules/modRecruitment.class.php index 89e26d587e29f..5bc9fe4516bd6 100644 --- a/htdocs/core/modules/modRecruitment.class.php +++ b/htdocs/core/modules/modRecruitment.class.php @@ -417,9 +417,6 @@ public function init($options = '') $myTmpObjects['RecruitmentJobPosition'] = array('includerefgeneration' => 1, 'includedocgeneration' => 1); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'MyObject') { - continue; - } if ($myTmpObjectArray['includedocgeneration']) { $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_recruitmentjobposition.odt'; $dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir; diff --git a/htdocs/core/modules/modWorkstation.class.php b/htdocs/core/modules/modWorkstation.class.php index cc656a9c03db9..2f5a184640883 100644 --- a/htdocs/core/modules/modWorkstation.class.php +++ b/htdocs/core/modules/modWorkstation.class.php @@ -394,9 +394,6 @@ public function init($options = '') $myTmpObjects['Workstation'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'Workstation') { - continue; - } if ($myTmpObjectArray['includerefgeneration']) { $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/workstation/template_workstations.odt'; $dirodt = DOL_DATA_ROOT.'/doctemplates/workstation'; diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index bbae6a5688a6b..bc694dfe711aa 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -41,7 +41,7 @@ class modMyModule extends DolibarrModules */ public function __construct($db) { - global $langs, $conf; + global $conf; $this->db = $db; @@ -492,9 +492,6 @@ public function init($options = '') $myTmpObjects['MyObject'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'MyObject') { - continue; - } if ($myTmpObjectArray['includerefgeneration']) { $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_myobjects.odt'; $dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir; From ed968b0e91afd0e85994337ea35855aae960a22e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Aug 2024 13:51:03 +0200 Subject: [PATCH 029/152] Try to fix phpstan warning --- htdocs/core/class/menu.class.php | 2 +- htdocs/core/menus/standard/eldy_menu.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/menu.class.php b/htdocs/core/class/menu.class.php index 90299401453f3..be4bf7f298dce 100644 --- a/htdocs/core/class/menu.class.php +++ b/htdocs/core/class/menu.class.php @@ -32,7 +32,7 @@ class Menu /** * List of menu items * - * @var array,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,id:string,idsel:string,classname:string,prefix:string}> + * @var array,target:string,mainmenu:string,leftmenu:string,position:int,level?:int,id:string,idsel:string,classname:string,prefix?:string}> */ public $liste; diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 40cb9f0d427fb..0e52117957347 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -274,7 +274,7 @@ public function showmenu($mode, $moredata = null) */ $lastlevel2 = array(); - foreach ($submenu->liste as $key2 => $val2) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' + foreach ($submenu->liste as $key2 => $val2) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu','prefix'] $showmenu = true; if (getDolGlobalString('MAIN_MENU_HIDE_UNAUTHORIZED') && empty($val2['enabled'])) { $showmenu = false; From fc63159c30014758d68711c8812a8661d7caaacc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Aug 2024 13:57:03 +0200 Subject: [PATCH 030/152] Fix phan warnings --- htdocs/accountancy/bookkeeping/list.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 4e2b285669a74..b0710e6e109b4 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1212,8 +1212,10 @@ } // Document ref - $modulepart = ''; + $modulepart = ''; // may be used by include*.tpl.php if (!empty($arrayfields['t.doc_ref']['checked'])) { + $objectstatic = null; + if ($line->doc_type === 'customer_invoice') { $langs->loadLangs(array('bills')); @@ -1270,11 +1272,11 @@ $labeltoshow = ''; $labeltoshowalt = ''; $classforlabel = ''; - if ($line->doc_type === 'customer_invoice' || $line->doc_type === 'supplier_invoice' || $line->doc_type === 'expense_report') { + if (($line->doc_type === 'customer_invoice' || $line->doc_type === 'supplier_invoice' || $line->doc_type === 'expense_report') && is_object($objectstatic)) { $labeltoshow .= $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); $labeltoshow .= $documentlink; $labeltoshowalt .= $objectstatic->ref; - } elseif ($line->doc_type === 'bank') { + } elseif ($line->doc_type === 'bank' && is_object($objectstatic)) { $labeltoshow .= $objectstatic->getNomUrl(1); $labeltoshowalt .= $objectstatic->ref; $bank_ref = strstr($line->doc_ref, '-'); From 49f40b58feb760636e572cef8fc4f9818e45c1bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Aug 2024 14:02:09 +0200 Subject: [PATCH 031/152] Removed some warning (not priority) --- dev/tools/phan/config_extended.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dev/tools/phan/config_extended.php b/dev/tools/phan/config_extended.php index 0920a7f7ecceb..94346c93296f5 100644 --- a/dev/tools/phan/config_extended.php +++ b/dev/tools/phan/config_extended.php @@ -94,6 +94,9 @@ 'PhanPluginRedundantAssignmentInGlobalScope', // Not essential, a lot of false warning 'PhanPluginRedundantAssignment', // Not essential, useless 'PhanPluginDuplicateCatchStatementBody', // Requires PHP7.1 - 50+ occurrences + + 'PhanPluginUnknownArrayMethodParamType', // this option costs more time to be supported than it solves time + 'PhanPluginUnknownArrayMethodReturnType', // this option costs more time to be supported than it solves time ]; return $config; From d787d801cf30795cc6a5f61f04c390dc0291dfdd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Aug 2024 14:34:44 +0200 Subject: [PATCH 032/152] css --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0935d471b9f35..e7f3be411ed26 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2615,7 +2615,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab } if ($displaytab == 0) { - $out .= img_picto($title, $picto, '', $pictoisfullpath, 0, 0, '', 'imgTabTitle paddingright').' '; + $out .= img_picto($title, $picto, '', $pictoisfullpath, 0, 0, '', 'imgTabTitle paddingright marginrightonlyshort'); } $out .= $links[$i][1]; From 35293e75c8a3852d2d95f735b540e2bc79753dff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Aug 2024 15:01:24 +0200 Subject: [PATCH 033/152] Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 20.0 --- htdocs/core/multicompany_page.php | 9 ++++++--- htdocs/theme/eldy/global.inc.php | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/core/multicompany_page.php b/htdocs/core/multicompany_page.php index a047ef7496836..203313deabec8 100644 --- a/htdocs/core/multicompany_page.php +++ b/htdocs/core/multicompany_page.php @@ -58,6 +58,9 @@ $right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right'); $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left'); +if (!isModEnabled('multicompany')) { + httponly_accessforbidden('No multicompany module enabled'); +} /* @@ -113,15 +116,15 @@ $listofentities = array(); } - $multicompanyList .= '
    '; + $multicompanyList .= '
      '; foreach ($listofentities as $entityid => $entitycursor) { $url = DOL_URL_ROOT.'/core/multicompany_page.php?action=switchentity&token='.newToken().'&entity='.((int) $entityid).($backtourl ? '&backtourl='.urlencode($backtourl) : ''); $multicompanyList .= '
    • '; - $multicompanyList .= ''; + $multicompanyList .= ''; $multicompanyList .= img_picto('', 'entity', 'class="pictofixedwidth"'); $multicompanyList .= dol_escape_htmltag($entitycursor); if ($conf->entity == $entityid) { - $multicompanyList .= ' ('.$langs->trans("Currently").')'; + $multicompanyList .= ' '.img_picto($langs->trans("Currently"), 'tick').''; } $multicompanyList .= ''; $multicompanyList .= '
    • '; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 8f99b911fba3b..f01c76f2821be 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1024,12 +1024,18 @@ .paddingtop { padding-top: 4px; } +.paddingtopimp { + padding-top: 4px !important; +} .paddingtop2 { padding-top: 2px; } .paddingbottom { padding-bottom: 4px; } +.paddingbottomimp { + padding-bottom: 4px !important; +} .paddingbottom2 { padding-bottom: 2px; } From d7140a8cdc1573237af25a1d01a3ed721394a3d6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Aug 2024 17:06:51 +0200 Subject: [PATCH 034/152] Fix missing profid 6 to 10 --- htdocs/main.inc.php | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 91758cb05cdcf..55ef7eebb0648 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2505,23 +2505,29 @@ function top_menu_user($hideloginname = 0, $urllogout = '') $dropdownBody .= '
      '; $dropdownBody .= '
      '.$langs->trans("Company").': '.dol_escape_htmltag($mysoc->name).''; - if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') { - $dropdownBody .= '
      '.$langs->transcountry("ProfId1", $mysoc->country_code).': '.dol_print_profids(getDolGlobalString("MAIN_INFO_SIREN"), 1).''; - } - if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') { - $dropdownBody .= '
      '.$langs->transcountry("ProfId2", $mysoc->country_code).': '.dol_print_profids(getDolGlobalString("MAIN_INFO_SIRET"), 2).''; - } - if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') { - $dropdownBody .= '
      '.$langs->transcountry("ProfId3", $mysoc->country_code).': '.dol_print_profids(getDolGlobalString("MAIN_INFO_APE"), 3).''; - } - if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') { - $dropdownBody .= '
      '.$langs->transcountry("ProfId4", $mysoc->country_code).': '.dol_print_profids(getDolGlobalString("MAIN_INFO_RCS"), 4).''; - } - if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') { - $dropdownBody .= '
      '.$langs->transcountry("ProfId5", $mysoc->country_code).': '.dol_print_profids(getDolGlobalString("MAIN_INFO_PROFID5"), 5).''; - } - if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') { - $dropdownBody .= '
      '.$langs->transcountry("ProfId6", $mysoc->country_code).': '.dol_print_profids(getDolGlobalString("MAIN_INFO_PROFID6"), 6).''; + $idprofcursor = 0; + while ($idprofcursor < 10) { + $idprofcursor++; + $constkeyforprofid = 'MAIN_INFO_PROFID'.$idprofcursor; + if ($idprofcursor == 1) { + $constkeyforprofid = 'MAIN_INFO_SIREN'; + } + if ($idprofcursor == 2) { + $constkeyforprofid = 'MAIN_INFO_SIRET'; + } + if ($idprofcursor == 3) { + $constkeyforprofid = 'MAIN_INFO_APE'; + } + if ($idprofcursor == 4) { + $constkeyforprofid = 'MAIN_INFO_RCS'; + } + $showprofid = (($idprofcursor <= 6) && $langs->transcountry("ProfId".$idprofcursor, $mysoc->country_code) != '-'); + if ($idprofcursor > 6 && getDolGlobalString($constkeyforprofid)) { + $showprofid = true; + } + if ($showprofid) { + $dropdownBody .= '
      '.$langs->transcountry("ProfId".$idprofcursor, $mysoc->country_code).': '.dol_print_profids(getDolGlobalString($constkeyforprofid), 1).''; + } } $dropdownBody .= '
      '.$langs->trans("VATIntraShort").': '.dol_print_profids(getDolGlobalString("MAIN_INFO_TVAINTRA"), 'VAT').''; $dropdownBody .= '
      '.$langs->trans("Country").': '.($mysoc->country_code ? $langs->trans("Country".$mysoc->country_code) : '').''; From 8e7ab422e3ff8aaccd2beae482f34f2f42b821f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Aug 2024 18:50:24 +0200 Subject: [PATCH 035/152] Fix info --- .../modules/facture/doc/doc_generic_invoice_odt.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 2b4496820f2e6..8e0fba186b67b 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -75,8 +75,8 @@ public function __construct($db) $this->option_logo = 1; // Display logo $this->option_tva = 0; // Manage the vat option FACTURE_TVAOPTION - $this->option_modereg = 0; // Display payment mode - $this->option_condreg = 0; // Display payment terms + $this->option_modereg = 1; // Display payment mode + $this->option_condreg = 1; // Display payment terms $this->option_multilang = 1; // Available in several languages $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes From affe8cebaf43b2c8a184e2e208755989ab2977cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Aug 2024 13:29:05 +0200 Subject: [PATCH 036/152] css --- htdocs/theme/eldy/global.inc.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index f01c76f2821be..e3132478f8941 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -8423,11 +8423,6 @@ } - div.fichehalfright { - margin-top: 30px; - } - - .underbanner.underbanner-before-box { border-bottom: none; } From 37a46a9282e0d5b1c28a2e995c141d1e238e4dbb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Aug 2024 13:36:42 +0200 Subject: [PATCH 037/152] Clean css --- htdocs/theme/eldy/global.inc.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 9c703f310327c..6cd923844424a 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2197,8 +2197,12 @@ /* ============================================================================== */ #id-container { - display: table; /* DOL_XXX Empeche fonctionnement correct du scroll horizontal sur tableau, avec datatable ou CSS */ - table-layout: fixed; + width: 100%; + + display: table; /* DOL_XXX Empeche fonctionnement correct du scroll horizontal sur tableau, avec datatable ou CSS */ + + /* table-layout: fixed; */ + } #id-right, #id-left { display: table-cell; /* DOL_XXX Empeche fonctionnement correct du scroll horizontal sur tableau, avec datatable ou CSS */ @@ -2386,6 +2390,8 @@ .user-header { height: auto !important; color: var(--colortextbackhmenu); } #id-container { + display: table; /* DOL_XXX Empeche fonctionnement correct du scroll horizontal sur tableau, avec datatable ou CSS */ + table-layout: fixed; width: 100%; } .side-nav { @@ -3459,7 +3465,6 @@ padding: 0px; padding-bottom: 0px; padding-top: 1px; - width: px; } .vmenu { @@ -8474,11 +8479,6 @@ } - div.fichehalfright { - margin-top: 30px; - } - - .underbanner.underbanner-before-box { border-bottom: none; } From e3d3bad08024cbf5797898d6db21b5c6c944f021 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 4 Aug 2024 18:47:22 +0200 Subject: [PATCH 038/152] =?UTF-8?q?Fix:=20=F0=9F=9B=9FFix=20getrights=20us?= =?UTF-8?q?age=20&=20Update=20the=20documentation=20to=20suggest=20to=20us?= =?UTF-8?q?e=20loadRights=20(#30543)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Qual: Update the documentation to suggest to use loadRights # Qual: Update the documentation to suggest to use loadRights Given the pending issues, update the documention regarding getrights to point to loadRights. * Fix: call loadRights on User (not getRights) --- htdocs/core/customreports.php | 2 +- htdocs/user/class/api_users.class.php | 8 ++++---- htdocs/user/class/user.class.php | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 75ee1126897cc..2dc993e9c50b4 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -80,7 +80,7 @@ // $search_measures, $search_xaxis or $search_yaxis may have been defined by the parent. if (empty($user) || empty($user->id)) { - print 'Page is called as an include but $user and its permission loaded with getrights() are not defined. We stop here.'; + print 'Page is called as an include but $user and its permission loaded with loadRights() are not defined. We stop here.'; exit(-1); } if (empty($object)) { diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index c391f57aa5560..ccd0198f17bb4 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -168,7 +168,7 @@ public function get($id, $includepermissions = 0) } if ($includepermissions) { - $this->useraccount->getRights(); + $this->useraccount->loadRights(); } return $this->_cleanObjectDatas($this->useraccount); @@ -207,7 +207,7 @@ public function getByLogin($login, $includepermissions = 0) } if ($includepermissions) { - $this->useraccount->getRights(); + $this->useraccount->loadRights(); } return $this->_cleanObjectDatas($this->useraccount); @@ -246,7 +246,7 @@ public function getByEmail($email, $includepermissions = 0) } if ($includepermissions) { - $this->useraccount->getRights(); + $this->useraccount->loadRights(); } return $this->_cleanObjectDatas($this->useraccount); @@ -281,7 +281,7 @@ public function getInfo($includepermissions = 0) } if ($includepermissions) { - $this->useraccount->getRights(); + $this->useraccount->loadRights(); } $usergroup = new UserGroup($this->db); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 2544dc25883a4..bf587fb05891c 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -435,7 +435,7 @@ public function __construct($db) /** * Load a user from database with its id or ref (login). - * This function does not load permissions, only user properties. Use getrights() for this just after the fetch. + * This function does not load permissions, only user properties. Use loadRights() for this just after the fetch. * * @param int $id If defined, id to used for search * @param string $login If defined, login to used for search @@ -767,7 +767,7 @@ public function loadDefaultValues() * @param string $permlevel1 Permission level1 (Example: 'read', 'write', 'delete') * @param string $permlevel2 Permission level2 * @return int 1 if user has permission, 0 if not. - * @see clearrights(), delrights(), getrights(), hasRight() + * @see clearrights(), delrights(), loadRights(), hasRight() */ public function hasRight($module, $permlevel1, $permlevel2 = '') { @@ -922,7 +922,7 @@ public function hasRight($module, $permlevel1, $permlevel2 = '') * @param int $entity Entity to use * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @return int > 0 if OK, < 0 if KO - * @see clearrights(), delrights(), getrights(), hasRight() + * @see clearrights(), delrights(), loadRights(), hasRight() */ public function addrights($rid, $allmodule = '', $allperms = '', $entity = 0, $notrigger = 0) { @@ -1065,7 +1065,7 @@ public function addrights($rid, $allmodule = '', $allperms = '', $entity = 0, $n * @param int|string $entity Entity to use. Example: '1', or '0,1', or '2,3' * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @return int > 0 if OK, < 0 if OK - * @see clearrights(), addrights(), getrights(), hasRight() + * @see clearrights(), addrights(), loadRights(), hasRight() */ public function delrights($rid, $allmodule = '', $allperms = '', $entity = 0, $notrigger = 0) { @@ -1183,7 +1183,7 @@ public function delrights($rid, $allmodule = '', $allperms = '', $entity = 0, $n * Clear all permissions array of user * * @return void - * @see getrights(), hasRight() + * @see loadRights(), hasRight() */ public function clearrights() { @@ -1456,7 +1456,7 @@ public function loadRights($moduletag = '', $forcereload = 0) * @param string $moduletag Limit permission for a particular module ('' by default means load all permissions) * @param int $forcereload Force reload of permissions even if they were already loaded (ignore cache) * @return void - * @deprecated + * @deprecated Use getRights * * @see clearrights(), delrights(), addrights(), hasRight() * @phpstan-ignore-next-line From 650fa5ef1d90c8bddf8ed3e77570bfb60c0f38e0 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Wed, 7 Aug 2024 00:09:27 +0200 Subject: [PATCH 039/152] fix: add missing fetch_optionals() call on OrderLine fetch method (#30560) --- htdocs/commande/class/commande.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 9a3319c813848..c820acd6e6c4f 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4376,6 +4376,8 @@ public function fetch($rowid) $this->multicurrency_total_tva = $objp->multicurrency_total_tva; $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; + $this->fetch_optionals(); + $this->db->free($result); return 1; From 9fe4cdcebba40bde3b46ea04f8666069fe788457 Mon Sep 17 00:00:00 2001 From: Jonathan Botquin <99287239+Jonathanbtq@users.noreply.github.com> Date: Wed, 7 Aug 2024 00:11:04 +0200 Subject: [PATCH 040/152] Fix duplicate toselect list.php (#30555) --- htdocs/product/stock/list.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 9a6a9c95819b5..2d5d0aabb1492 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -46,7 +46,6 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'stocklist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') -$toselect = GETPOST('toselect', 'array'); $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); From 6532d27248f85213f32fa2598fc71766c1e616c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Aug 2024 00:23:03 +0200 Subject: [PATCH 041/152] Fix trans --- .../modules/stocktransfer/doc/pdf_eagle_proforma.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php index 5ce8211bb03b6..9b26dccc74f1f 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -291,7 +291,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetDrawColor(128, 128, 128); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); - $pdf->SetSubject($outputlangs->transnoentities("StockTransferProFormat")); + $pdf->SetSubject($outputlangs->transnoentities("StockTransferSheetProforma")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("StockTransfer")); From da4f002be21144efc3d3afa51b28d76c9360369d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Aug 2024 00:37:46 +0200 Subject: [PATCH 042/152] Fix vat rate update intakepos to use a float --- htdocs/takepos/invoice.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 70321b5085011..fa94abf58f347 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -927,12 +927,20 @@ function fail($message) $datapriceofproduct = $prod->getSellPrice($mysoc, $customer, 0); $price_min = $datapriceofproduct['price_min']; $usercanproductignorepricemin = ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('produit', 'ignore_price_min_advance')) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS')); - $pu_ht = price2num($number / (1 + ($line->tva_tx / 100)), 'MU'); - //Check min price + + $vatratecleaned = $line->tva_tx; + $reg = array(); + if (preg_match('/^(.*)\s*\((.*)\)$/', (string) $line->tva_tx, $reg)) { // If vat is "xx (yy)" + $vatratecleaned = trim($reg[1]); + //$vatratecode = $reg[2]; + } + + $pu_ht = price2num($number / (1 + ((float) $vatratecleaned / 100)), 'MU'); + // Check min price if ($usercanproductignorepricemin && (!empty($price_min) && (price2num($pu_ht) * (1 - price2num($line->remise_percent) / 100) < price2num($price_min)))) { $langs->load("products"); dol_htmloutput_errors($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency))); - //echo $langs->trans("CantBeLessThanMinPrice"); + // echo $langs->trans("CantBeLessThanMinPrice"); } else { $permissiontoupdateline = ($user->hasRight('takepos', 'editlines') && ($user->hasRight('takepos', 'editorderedlines') || $line->special_code != "4")); if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { From 120353d539f2fc5ffa3776674f382f7d136570a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= <121813548+altairis-benjamin@users.noreply.github.com> Date: Wed, 7 Aug 2024 00:42:53 +0200 Subject: [PATCH 043/152] NEW: automatically change status on answering a ticket (#30556) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ADD: menu entry for status selection * ADD selectarray * NEW: automatically change status on answering a ticket --------- Co-authored-by: Benjamin Falière --- htdocs/admin/ticket.php | 42 ++++++++++++++++++++++++---- htdocs/langs/en_US/ticket.lang | 2 ++ htdocs/langs/fr_FR/ticket.lang | 2 ++ htdocs/ticket/class/ticket.class.php | 12 +++++--- 4 files changed, 48 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 44e8f5e9f3d90..6feb51bc90e6d 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -1,10 +1,11 @@ - * Copyright (C) 2016 Christophe Battarel - * Copyright (C) 2022-2023 Udo Tamm - * Copyright (C) 2023 Alexandre Spangaro - * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2013-2018 Jean-François FERRY + * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2022-2023 Udo Tamm + * Copyright (C) 2023 Alexandre Spangaro + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 Benjamin Falière * * 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 @@ -53,6 +54,17 @@ $error = 0; $reg = array(); +// Initiate status list +$statuslist = array( + Ticket::STATUS_IN_PROGRESS => $langs->trans("InProgress"), + Ticket::STATUS_NOT_READ => $langs->trans("NotRead"), + Ticket::STATUS_READ => $langs->trans("Read"), + Ticket::STATUS_ASSIGNED => $langs->trans("Assigned"), + Ticket::STATUS_NEED_MORE_INFO => $langs->trans("NeedMoreInformationShort"), + Ticket::STATUS_WAITING => $langs->trans("Waiting"), + Ticket::STATUS_CLOSED => $langs->trans("SolvedClosed") +); + /* * Actions */ @@ -161,6 +173,13 @@ } } + $param_status = GETPOST('TICKET_SET_STATUS_ON_ANSWER'); + $res = dolibarr_set_const($db, 'TICKET_SET_STATUS_ON_ANSWER', $param_status, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + $param_delay_first_response = GETPOSTINT('delay_first_response'); $res = dolibarr_set_const($db, 'TICKET_DELAY_BEFORE_FIRST_RESPONSE', $param_delay_first_response, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { @@ -579,6 +598,17 @@ print ''; print ''; +// Automatically define status on answering a ticket +print ''.$langs->trans("TicketAutoChangeStatusOnAnswer").''; +print ''; +print $formcategory->selectarray("TICKET_SET_STATUS_ON_ANSWER", $statuslist, getDolGlobalString('TICKET_SET_STATUS_ON_ANSWER')); +print ''; +print ''; +print $formcategory->textwithpicto('', $langs->trans("TicketAutoChangeStatusOnAnswerHelp"), 1, 'help'); +print ''; +print ''; + + if (isModEnabled('product')) { $htmlname = "product_category_id"; print ''.$langs->trans("TicketChooseProductCategory").''; diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index e0ae9f0812769..4931a6f528090 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -114,6 +114,8 @@ TicketsActivatePublicInterface=Activate public interface TicketsActivatePublicInterfaceHelp=Public interface allow any visitors to create tickets. TicketsAutoAssignTicket=Automatically assign the user who created the ticket TicketsAutoAssignTicketHelp=When creating a ticket, the user can be automatically assigned to the ticket. +TicketAutoChangeStatusOnAnswer=Automatically assign a status when answering a ticket +TicketAutoChangeStatusOnAnswerHelp=When user answers to a ticket, the status will automatically be applied to the ticket TicketNumberingModules=Tickets numbering module TicketsModelModule=Document templates for tickets TicketNotifyTiersAtCreation=Notify third party at creation diff --git a/htdocs/langs/fr_FR/ticket.lang b/htdocs/langs/fr_FR/ticket.lang index f1d415ae618d8..0853448efe405 100644 --- a/htdocs/langs/fr_FR/ticket.lang +++ b/htdocs/langs/fr_FR/ticket.lang @@ -114,6 +114,8 @@ TicketsActivatePublicInterface=Activer l'interface publique TicketsActivatePublicInterfaceHelp=L'interface publique permet à tous les visiteurs de créer des tickets. TicketsAutoAssignTicket=Affecter automatiquement l'utilisateur qui a créé le ticket TicketsAutoAssignTicketHelp=Lors de la création d'un ticket, l'utilisateur peut être automatiquement affecté au ticket. +TicketAutoChangeStatusOnAnswer=Lors de la réponse à un ticket, automatiquement lui assigner un statut +TicketAutoChangeStatusOnAnswerHelp=Lorsque l'utilisateur répond au ticket, le statut défini sera automatiquement assigné au ticket TicketNumberingModules=Module de numérotation des tickets TicketsModelModule=Modèles de documents pour les tickets TicketNotifyTiersAtCreation=Notifier le tiers à la création diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index fa6eefcde5c1d..4c8df0366369e 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2020 Laurent Destailleur * Copyright (C) 2023 Charlene Benke - * Copyright (C) 2023 Benjamin Falière + * Copyright (C) 2023-2024 Benjamin Falière * Copyright (C) 2024 William Mead * Copyright (C) 2024 MDW * @@ -2988,11 +2988,15 @@ public function newMessage($user, &$action, $private = 1, $public_area = 0) // Set status back to "In progress" if not set yet, but only if internal user and not a private message // Or set status to "In progress" if the client has answered and if the ticket has started // So we are sure to leave the STATUS_DRAFT, STATUS_NEED_INFO. - if (($object->status < self::STATUS_IN_PROGRESS && !$user->socid && !$private) || - ($object->status > self::STATUS_IN_PROGRESS && $public_area) - ) { + // Except if TICKET_SET_STATUS_ON_ANSWER has been defined + if ((getDolGlobalInt('TICKET_SET_STATUS_ON_ANSWER', -1) < 0 + && ($object->status < self::STATUS_IN_PROGRESS && !$user->socid && !$private)) + || ($object->status > self::STATUS_IN_PROGRESS && $public_area)) { $object->setStatut($object::STATUS_IN_PROGRESS); + } elseif (getDolGlobalInt('TICKET_SET_STATUS_ON_ANSWER', -1) >= 0 && empty($user->socid) && empty($private)) { + $object->setStatut(getDolGlobalInt('TICKET_SET_STATUS_ON_ANSWER')); } + return 1; } else { setEventMessages($object->error, $object->errors, 'errors'); From 3684d0e21a4295e9e2643451084d825dd2be789e Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Wed, 7 Aug 2024 00:50:08 +0200 Subject: [PATCH 044/152] FIX show and download attached files on ticket card (#30554) --- htdocs/core/class/html.formfile.class.php | 13 ++++++++++++- htdocs/ticket/document.php | 7 +++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index cbb60582b1510..e885811388a1b 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1356,6 +1356,12 @@ public function list_of_documents($filearray, $object, $modulepart, $param = '', $i = 0; $nboflines = 0; $lastrowid = 0; + $parametersByDefault = array( + 'modulepart'=> $modulepart, + 'relativepath'=> $relativepath, + 'permtoedit' => $permtoeditline, + 'permonobject' => $permonobject, + ); foreach ($filearray as $key => $file) { // filearray must be only files here if ($file['name'] != '.' && $file['name'] != '..' && !preg_match('/\.meta$/i', $file['name'])) { if (array_key_exists('rowid', $filearray[$key]) && $filearray[$key]['rowid'] > 0) { @@ -1363,8 +1369,13 @@ public function list_of_documents($filearray, $object, $modulepart, $param = '', } //var_dump($filearray[$key]); - // Note: for supplier invoice, $modulepart may be already 'facture_fournisseur' and $relativepath may be already '6/1/SI2210-0013/' + // get specific parameters from file attributes if set or get default ones + $modulepart = ($file['modulepart'] ?? $parametersByDefault['modulepart']); + $relativepath = ($file['relativepath'] ?? $parametersByDefault['relativepath']); + $permtoeditline = ($file['permtoedit'] ?? $parametersByDefault['permtoedit']); + $permonobject = ($file['permonobject'] ?? $parametersByDefault['permonobject']); + // Note: for supplier invoice, $modulepart may be already 'facture_fournisseur' and $relativepath may be already '6/1/SI2210-0013/' if (empty($relativepath) || empty($modulepart)) { $filepath = $file['level1name'].'/'.$file['name']; } else { diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index ffecc4e919788..ef812d808c440 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -222,6 +222,13 @@ $upload_msg_dir = $conf->agenda->dir_output.'/'.$db->fetch_row($resql)[0]; $file_msg = dol_dir_list($upload_msg_dir, "files", 0, '', '\.meta$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1); if (count($file_msg)) { + // add specific module part and user rights for delete + foreach ($file_msg as $key => $file) { + $file_msg[$key]['modulepart'] = 'actions'; + $file_msg[$key]['relativepath'] = $file['level1name'].'/'; // directory without file name + $file_msg[$key]['permtoedit'] = 0; + $file_msg[$key]['permonobject'] = 0; + } $file_msg_array = array_merge($file_msg, $file_msg_array); } } From 7cde5adec814085405b8772f513492b8585479fb Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Wed, 7 Aug 2024 00:53:16 +0200 Subject: [PATCH 045/152] FIX fatal error on loading pictures in attached documents of an event (#30553) --- htdocs/comm/action/class/actioncomm.class.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index df388d7b5fa05..4f21d2f676568 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -841,9 +841,6 @@ public function fetch($id, $ref = '', $ref_ext = '', $email_msgid = '', $loadres $this->type_color = $obj->type_color; $this->type_picto = $obj->type_picto; $this->type = $obj->type_type; - /*$transcode = $langs->trans("Action".$obj->type_code); - $this->type = (($transcode != "Action".$obj->type_code) ? $transcode : $obj->type_label); */ - $transcode = $langs->trans("Action".$obj->type_code.'Short'); $this->code = $obj->code; $this->label = $obj->label; From 42994ba76a6c59e939791fbd44e3679fe2062f1b Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 7 Aug 2024 01:05:07 +0200 Subject: [PATCH 046/152] Fix: Accept that user can be null (#30552) User can be null when `define('NOREQUIREUSER', true);`. (Seen when generating modulebuilder page from CLI script). --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e7f3be411ed26..13d60b8ebd995 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8738,11 +8738,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray = array(); - if ((empty($exclude) || !in_array('user', $exclude)) && (empty($include) || in_array('user', $include))) { + if ((empty($exclude) || !in_array('user', $exclude)) && (empty($include) || in_array('user', $include)) && $user instanceof User) { // Add SIGNATURE into substitutionarray first, so, when we will make the substitution, // this will include signature content first and then replace var found into content of signature //var_dump($onlykey); - $emailsendersignature = $user->signature; // dy default, we use the signature of current user. We must complete substitution with signature in c_email_senderprofile of array after calling getCommonSubstitutionArray() + $emailsendersignature = $user->signature; // By default, we use the signature of current user. We must complete substitution with signature in c_email_senderprofile of array after calling getCommonSubstitutionArray() $usersignature = $user->signature; $substitutionarray = array_merge($substitutionarray, array( '__SENDEREMAIL_SIGNATURE__' => (string) ((!getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? ($onlykey == 2 ? dol_trunc('SignatureFromTheSelectedSenderProfile', 30) : $emailsendersignature) : ''), From 782f968eb728a91ef1252f631366ecc7506a3a96 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 7 Aug 2024 01:10:12 +0200 Subject: [PATCH 047/152] Qual: Phan: Exclude htdocs/core/mymodule seen in cti.dolibarr.org (#30551) # Qual: Phan: Exclude htdocs/core/mymodule seen in cti.dolibarr.org `htdocs/core/mymodule` has notices on https://cti.dolibarr.org but it is not seen in git. It would be a good idea to generate a module and include it in the static analysis on cti, but `htdocs/core/mymodule` is not up-to-date. If such a generation is done, a better name could be used. For instance `generatedmymoduleforcti`. --- dev/tools/phan/config.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index f141bf80af3b2..1db32638f6baa 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -317,6 +317,8 @@ //'exclude_file_regex' => '@^vendor/.*/(tests?|Tests?)/@', 'exclude_file_regex' => '@^(' // @phpstan-ignore-line .'dummy' // @phpstan-ignore-line + // mymodule seen in cti, but not in git. + .'|htdocs/core/mymodule/.*' // @phpstan-ignore-line .'|htdocs/.*/canvas/.*/tpl/.*.tpl.php' // @phpstan-ignore-line .'|htdocs/modulebuilder/template/.*' // @phpstan-ignore-line // Included as stub (better analysis) @@ -346,9 +348,9 @@ '/^sanitizeVal$/' => [1, $sanitizeRegex,"UnknownSanitizeType"], '/^checkVal$/' => [1, $sanitizeRegex,"UnknownCheckValSanitizeType"], '/^\\\\ExtraFields::addExtraField$/' => [2, $extraFieldTypeRegex,"UnknownExtrafieldTypeBack"], - '/^dol_now$/' => [0, '{^(?:auto|gmt|tz(?:server|ref|user(?:rel)?))$}',"InvalidDolNowArgument"], // '', 0, 1 match bool and int values + '/^dol_now$/' => [0, '{^(?:auto|gmt|tz(?:server|ref|user(?:rel)?))$}',"InvalidDolNowArgument"], '/^dol_mktime$/' => [6, '{^(?:|0|1|auto|gmt|tz(?:server|ref|user(?:rel)?|,[+a-zA-Z-/]+))$}',"InvalidDolMktimeArgument"], // '', 0, 1 match bool and int values - '/^dol_print_date$/' => [2, '{^(?:|0|1|auto|gmt|tz(?:server|user(?:rel)?))$}',"InvalidDolMktimeArgument"], + '/^dol_print_date$/' => [2, '{^(?:|0|1|auto|gmt|tz(?:server|user(?:rel)?))$}',"InvalidDolMktimeArgument"], // '', 0, 1 match bool and int values '/^GETPOSTFLOAT$/' => [1, '{^(?:|M[UTS]|C[UT]|\d+)$}',"InvalidGetPostFloatRounding"], '/^price2num$/' => [1, '{^(?:|M[UTS]|C[UT]|\d+)$}',"InvalidPrice2NumRounding"], ], From d6948077b223d7c57e49f67bc5250c5ef254a48c Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 7 Aug 2024 01:20:43 +0200 Subject: [PATCH 048/152] Qual: Fix spelling/update .pre-commit configuration (versions) (#30546) * Qual: Update pre-commit configuration * Qual: Update spelling * Ignore use of deprecated constant --- .pre-commit-config.yaml | 10 +- ChangeLog | 14 +- .../codespell/codespell-lines-ignore.txt | 169 +----------------- dev/tools/dolibarr-mysql2pgsql.pl | 2 +- dev/tools/dolibarr-postgres2mysql.php | 9 +- .../accountancy/bookkeeping/listbyaccount.php | 4 +- .../class/accountingaccount.class.php | 2 +- htdocs/adherents/class/adherent.class.php | 4 +- .../adherents/class/adherent_type.class.php | 9 +- htdocs/adherents/class/subscription.class.php | 4 +- htdocs/bom/class/bom.class.php | 2 +- .../action/class/api_agendaevents.class.php | 3 +- htdocs/comm/card.php | 9 +- htdocs/comm/propal/class/propal.class.php | 4 +- htdocs/commande/class/commande.class.php | 8 +- htdocs/compta/bank/class/account.class.php | 8 +- .../bank/class/paymentvarious.class.php | 4 +- .../cashcontrol/class/cashcontrol.class.php | 4 +- .../deplacement/class/deplacement.class.php | 5 +- .../facture/class/facture-rec.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 6 +- .../compta/localtax/class/localtax.class.php | 6 +- htdocs/compta/localtax/quadri_detail.php | 2 +- .../cheque/class/remisecheque.class.php | 6 +- .../compta/paiement/class/paiement.class.php | 6 +- .../class/bonprelevement.class.php | 4 +- .../sociales/class/chargesociales.class.php | 2 +- .../class/paymentsocialcontribution.class.php | 4 +- htdocs/compta/stats/index.php | 5 +- htdocs/compta/tva/class/tva.class.php | 4 +- htdocs/contrat/class/contrat.class.php | 6 +- htdocs/core/ajax/objectonoff.php | 3 +- htdocs/core/class/commoninvoice.class.php | 4 +- htdocs/core/class/commonorder.class.php | 15 +- htdocs/core/class/extrafields.class.php | 4 +- htdocs/core/class/fiscalyear.class.php | 2 +- htdocs/core/class/html.formcompany.class.php | 10 +- htdocs/core/class/utils.class.php | 4 +- htdocs/core/db/Database.interface.php | 2 +- htdocs/core/db/DoliDB.class.php | 2 +- htdocs/core/db/pgsql.class.php | 2 +- htdocs/core/db/sqlite3.class.php | 2 +- htdocs/core/get_menudiv.php | 13 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/lib/price.lib.php | 2 +- htdocs/core/menus/standard/auguria_menu.php | 4 +- htdocs/core/menus/standard/eldy_menu.php | 4 +- .../modules/mailings/contacts1.modules.php | 5 +- .../core/modules/mailings/fraise.modules.php | 7 +- .../core/modules/mailings/pomme.modules.php | 5 +- .../modules/mailings/xinputfile.modules.php | 5 +- .../modules/mailings/xinputuser.modules.php | 5 +- .../class/DataCollector/DolPhpCollector.php | 2 +- htdocs/debugbar/class/TraceableDB.php | 2 +- htdocs/delivery/class/delivery.class.php | 2 +- htdocs/don/class/don.class.php | 4 +- htdocs/don/class/paymentdonation.class.php | 5 +- htdocs/ecm/class/ecmdirectory.class.php | 5 +- htdocs/expedition/class/expedition.class.php | 4 +- .../class/expensereport.class.php | 2 +- .../class/paymentexpensereport.class.php | 4 +- htdocs/fichinter/class/fichinter.class.php | 4 +- htdocs/fichinter/class/fichinterrec.class.php | 4 +- htdocs/fourn/card.php | 9 +- .../class/fournisseur.commande.class.php | 4 +- .../class/fournisseur.facture-rec.class.php | 2 +- .../fourn/class/fournisseur.facture.class.php | 4 +- htdocs/fourn/class/paiementfourn.class.php | 4 +- htdocs/holiday/class/holiday.class.php | 4 +- htdocs/hrm/class/evaluation.class.php | 2 +- htdocs/hrm/class/job.class.php | 2 +- htdocs/hrm/class/position.class.php | 2 +- htdocs/hrm/class/skill.class.php | 2 +- htdocs/install/upgrade2.php | 16 +- .../class/knowledgerecord.class.php | 2 +- htdocs/loan/class/loan.class.php | 5 +- htdocs/loan/class/paymentloan.class.php | 2 +- .../mailing_mymodule_selector1.modules.php | 5 +- htdocs/mrp/class/mo.class.php | 2 +- htdocs/product/class/product.class.php | 2 +- htdocs/product/popuprop.php | 2 +- htdocs/product/stock/class/entrepot.class.php | 2 +- htdocs/projet/class/project.class.php | 2 +- htdocs/projet/class/task.class.php | 4 +- htdocs/reception/class/reception.class.php | 4 +- .../class/recruitmentcandidature.class.php | 2 +- .../class/recruitmentjobposition.class.php | 2 +- htdocs/salaries/class/paymentsalary.class.php | 8 +- htdocs/salaries/class/salary.class.php | 4 +- htdocs/societe/class/societe.class.php | 2 +- htdocs/stripe/ajax/ajax.php | 9 +- .../class/supplier_proposal.class.php | 4 +- htdocs/theme/eldy/global.inc.php | 4 +- htdocs/theme/md/style.css.php | 138 +++++++------- htdocs/ticket/class/ticket.class.php | 4 +- htdocs/user/class/user.class.php | 2 +- htdocs/user/class/usergroup.class.php | 2 +- .../class/html.formwebportal.class.php | 4 +- .../class/webportalinvoice.class.php | 4 +- .../webportal/class/webportalmember.class.php | 2 +- .../webportal/class/webportalorder.class.php | 4 +- scripts/bank/export-bank-receipts.php | 3 +- .../email_expire_services_to_customers.php | 3 +- ...ail_expire_services_to_representatives.php | 3 +- .../email_unpaid_invoices_to_customers.php | 3 +- ...ail_unpaid_invoices_to_representatives.php | 3 +- 106 files changed, 319 insertions(+), 441 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 328005d7a4d9c..45eb0d85dc76c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ exclude: (?x)^( htdocs/includes/ckeditor/.*|(\.[^/]*/.*))$ repos: # Several miscellaneous checks and fix (on yaml files, end of files fix) - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: # This hook tests the name of the branch and return an error if the name is # 'develop' or an official version 'x.y' @@ -177,7 +177,7 @@ repos: # Check format of yaml files - repo: https://github.com/adrienverge/yamllint.git - rev: v1.33.0 + rev: v1.35.1 hooks: - id: yamllint args: @@ -187,7 +187,7 @@ repos: # Execute codespell to fix typo errors (setup of codespell into dev/tools/codespell/) - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell # Due to a current limitation of configuration files, @@ -230,14 +230,14 @@ repos: # Check some shell scripts - repo: https://github.com/shellcheck-py/shellcheck-py - rev: v0.9.0.6 + rev: v0.10.0.1 hooks: - id: shellcheck args: [-W, "100"] # Check sql file syntax - repo: https://github.com/sqlfluff/sqlfluff - rev: 3.0.4 + rev: 3.1.0 hooks: - id: sqlfluff-lint stages: [pre-commit, manual] # manual needed for ci diff --git a/ChangeLog b/ChangeLog index 5c321be8fb197..76ec155ed5051 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1643,7 +1643,7 @@ NEW: Add link to create an element from the category page NEW: add margin infos to takepos invoice lines NEW: Add max size send for "backup and link to mail" option NEW: Add method httponly_accessforbidden() -NEW: Add more advices into the Setup security page +NEW: Add more advice into the Setup security page NEW: Add new global variable for keeping the previous signature information on proposal (case of reopening a proposal) NEW: Add objectLink on shipment NEW: Add option --force on CLI cron_run_jobs.php @@ -3061,8 +3061,8 @@ NEW: add option in Workflow module to set a shipment as closed for Admins -NEW: Add a security center page with all information and advices related to the security of your instance -NEW: Add a performance center page with all information and advices related to the performance of your instance +NEW: Add a security center page with all information and advice related to the security of your instance +NEW: Add a performance center page with all information and advice related to the performance of your instance Modules NEW: Module Recruitment is now stable @@ -7080,7 +7080,7 @@ NEW: Add index and constraints keys on supplier proposal detail table NEW: Add phpunit to check the engine is defined into sql create files. NEW: Add project and Hook to Loan NEW: Add REST API to push a file. -NEW: Allow extrafields list select to be dependands on other standard list and not only other extrafields list +NEW: Allow extrafields list select to be dependent on other standard list and not only other extrafields list NEW: Architecture to manage search criteria persistence (using save_lastsearch_values=1 on exit links and restore_lastsearch_values=1 in entry links) NEW: data files are now also parsed by phpunit for sql syntax NEW: Hook to allow inserting custom product head #6001 @@ -8104,7 +8104,7 @@ NEW: The clicktodial module is now able to provide link "tel:" on phone numbers. NEW: The conditional IF into ODT templates works also on not defined var so we can show data only if defined. Close #3819 NEW: The free text in PDF footers can now be a HTML content. So the WYSIWYG editor is on by default to edit it into module setup. NEW: The thirdparties tabs, the contacts tabs and the members tabs are now presented using a new "top banner", saving space and using a same way to show address, status and navigation arrows. -NEW: Thumbs for statistics on main page are fully clicable (not only link inside the thumb) +NEW: Thumbs for statistics on main page are fully clickable (not only link inside the thumb) NEW: Translate extrafield's labels. NEW: Use new select2 component for juridical status, country and state selection. NEW: When creating order, proposal or invoice from thirdparty card, the project is asked during creation. A link to create project if it does not exists is also available. @@ -8703,7 +8703,7 @@ NEW: [ task #851 ] Add a new field: Commercial name NEW: [ task #977 ] New option to manage product unit Migrated code from GPCSolutions/dolibarr:3.2-units branch and adapted for 3.8 with some improvements NEW: The line where mouse is over can be highlight with option THEME_ELDY_USE_HOVER (on by default) NEW: The notification module accept keyword __SUPERVISOR__ to send notification to supervisor of user. -NEW: Thumbs for statistics on main page are fully clicable (not only link inside the thumb) +NEW: Thumbs for statistics on main page are fully clickable (not only link inside the thumb) NEW: Title of page project contains project ref and label NEW: update skeleton and class builder NEW: Use new select2 component for juridical status, country and state selection. @@ -9854,7 +9854,7 @@ For users: prices, radio). - New: [ task #798 ] Add range limit date on product/services as it is done on order and invoice. -- New: [ task #814 ] Add extrafield feature for projects ands tasks. +- New: [ task #814 ] Add extrafield feature for projects and tasks. - New: [ task #770 ] Add ODT document generation for Projects module. - New: [ task #741 ] Add intervention box. - New: [ task #826 ] Optional increase stock when deleting an invoice already validated. diff --git a/dev/tools/codespell/codespell-lines-ignore.txt b/dev/tools/codespell/codespell-lines-ignore.txt index c04c6d0446d19..e2acab0de5389 100644 --- a/dev/tools/codespell/codespell-lines-ignore.txt +++ b/dev/tools/codespell/codespell-lines-ignore.txt @@ -1,12 +1,6 @@ - || !empty($dates) && empty($datee) && $loanSchedule->datep >= $dates && $loanSchedule->datep <= dol_now() - || empty($dates) && !empty($datee) && $loanSchedule->datep <= $datee $objMod->dictionaries = $objMod->{"dictionnaries"}; // For backward compatibility - if (($loanSchedule->datep >= $dates && $loanSchedule->datep <= $datee) // dates filter is defined - $datee = $langs->trans("Unknown"); - $datee = dol_print_date($objectligne->date_end, 'day', false, $outputlangs, true); - $txt .= $outputlangs->transnoentities("DateStartPlannedShort")." : ".$datei." - ".$outputlangs->transnoentities("DateEndPlanned")." : ".$datee.''; if (empty($objMod->dictionaries) && !empty($objMod->{"dictionnaries"})) { - print 'id.'">'; + print 'id.'&token='.newToken().'">'; $object->date_ech = $object->periode; $object->periode = $object->date_ech; $reponsesadd = str_split($obj->reponses); @@ -16,182 +10,97 @@ // $object->periode = dol_get_last_day(year of $object->date_ech - 1m, month or $object->date_ech -1m) //$pice = ''; //$typea = ($objp->typea == 'birth') ? $picb : $pice; - print ''; - $date = $overview[0]->udate; + print ''; $dateemail = dol_stringtotime((string) $overview[0]->udate, 'gmt'); - $dateb = $this->db->jdate($data[$j]->datea); - $link->datea = $this->db->jdate($obj->datea); $object->periode = $newdateperiod; - $out .= dol_print_date($file->datea, 'dayhour'); $pice = ''; - $taskstatic->date_end = $this->db->jdate($objp->datee); - $tmp = $element->getSumOfAmount($idofelementuser ? $elementuser : '', $dates, $datee); - $tmpprojtime = $element->getSumOfAmount($idofelementuser ? $elementuser : '', $dates, $datee); // $element is a task. $elementuser may be empty $typea = ($data[$j]->typea == 'birth') ? $picb : $pice; - //var_dump("$key, $tablename, $datefieldname, $dates, $datee"); GETPOSTINT("mouvement"), dol_syslog("msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." from=".$overview[0]->from." to=".$overview[0]->to." subject=".$overview[0]->subject); - if ((empty($dates) && empty($datee)) || (intval($dates) <= $element->datestart && intval($datee) >= $element->dateend)) { jQuery("#mouvement option").removeAttr("selected").change(); jQuery("#mouvement option[value=0]").attr("selected","selected").trigger("change"); jQuery("#mouvement option[value=1]").attr("selected","selected").trigger("change"); jQuery("#mouvement").trigger("change"); - print ''; - $TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow)); - $TFirstDay[reset($TWeek)] = 1; $action = 'transfert'; - $addform .= ''; $date_liv = dol_mktime(GETPOST('rehour'), GETPOST('remin'), GETPOST('resec'), GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); $newfiletmp = preg_replace('/\.od(s|t)/i', '', $newfile); $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); $object->period = dol_time_plus_duree($object->periode, 1, 'm'); $object->periode = dol_time_plus_duree($object->periode, 1, 'm'); - $project_static->date_end = $this->db->jdate($obj->datee); - $projectstatic->date_end = $db->jdate($objp->datee); - $ret = projectLinesPerMonth($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $TWeek); - $taskstatic->datee = $lines[$i]->date_end; // deprecated $this->category->childs[] = $this->_cleanObjectDatas($cat); - $this->date_approbation = $this->db->jdate($obj->datea); - $this->date_approval = $this->db->jdate($obj->datea); - $this->date_approve = $this->db->jdate($obj->datea); - $this->datea = $this->db->jdate($obj->datea); - $this->datee = $this->db->jdate($obj->datee); $this->periode = $this->db->jdate($obj->period); $tmp = array('id_users' => $obj->id_users, 'nom' => $obj->name, 'reponses' => $obj->reponses); $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.od(s|t)$', '', 'name', SORT_ASC, 0, 1); // Disable hook for the moment //si les reponses ne concerne pas la colonne effacée, on concatenate GETPOST("mouvement", 'alpha'), GETPOSTINT("mouvement"), - foreach ($TWeek as $weekIndex => $weekNb) { - if (count($arrayfields) > 0 && !empty($arrayfields['t.datee']['checked'])) { if (jQuery("#mouvement").val() == \'0\') jQuery("#unitprice").removeAttr("disabled"); - print ''.$langs->trans("TransferStock").''; - print ''.dol_print_date($link->datea, "dayhour", "tzuser").''; + print ''.$langs->trans("TransferStock").''; $action = 'transfert'; $date_com = dol_mktime(GETPOSTINT('rehour'), GETPOSTINT('remin'), GETPOSTINT('resec'), GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); $date_next_execution = (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1); $date_next_execution = dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear); - $datee = dol_get_last_day(GETPOSTINT('yeartoexport'), GETPOSTINT('monthtoexport') ? GETPOSTINT('monthtoexport') : 12); $datesubscription = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); $ensemblereponses = $obj->reponses; $field = preg_replace('/(:[!<>=\s]+:|:in:|:notin:|:like:|:notlike:).*$/', '', $tmpcrit); // the name of the field $newcrit = preg_replace('/(:[!<>=\s]+:|:in:|:notin:|:like:|:notlike:)/', '', $tmpcrit); - $object->datee = $datee; $object->periode = $dateperiod; $return .= '
      '.$langs->trans("Payement").' : '.$this->type_payment.''; - $sortfield = "datea"; - $sql = "SELECT p.rowid as id, p.entity, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount"; $sql .= " '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.date_ech as date, t.periode as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens"; - $sql .= " , datee = ".(!empty($obj->datee) ? "'".$this->db->escape($obj->datee)."'" : "null"); - $sql .= " AND (".$datefieldname." <= '".$this->db->idate($datee)."' OR ".$datefieldname." IS NULL)"; - $sql .= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter, 1, false)).")"; - $sql .= " AND date_creation BETWEEN '".$db->idate($dates)."' AND '".$db->idate($datee)."'"; - $sql .= " AND er.datee >= '".$this->db->idate($date)."'"; - $sql .= " ORDER BY pt.datee ASC, pt.dateo ASC"; - $sql .= " t.datec, t.dateo, t.datee, t.tms,"; - $sql .= " t.dateo, t.datee, t.planned_workload, t.rang,"; - $sql .= ", datee = ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); - $sql .= "SELECT u.rowid, u.firstname, u.lastname, u.dateemployment as datea, date_format(u.dateemployment, '%d') as daya, 'employment' as typea, u.email, u.statut as status"; - $sql = "SELECT pt.rowid, pt.ref, pt.fk_projet, pt.fk_task_parent, pt.datec, pt.dateo, pt.datee, pt.datev, pt.label, pt.description, pt.duration_effective, pt.planned_workload, pt.progress"; - $sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth as datea, date_format(u.birth, '%d') as daya, 'birth' as typea, u.email, u.statut as status"; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses, date_creation)'; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses, ip, date_creation)'; $sql = 'SELECT s.reponses'; $sql2 .= " SET reponses = '".$db->escape($newcar)."'"; - $taskstatic->datee = $db->jdate($obj->date_end); $this->category->childs = array(); - $this->datea = dol_now(); $tmpcrit = preg_replace('/^.*(:[!<>=\s]+:|:in:|:notin:|:like:|:notlike:)/', '\1', $tmpcrit); // the condition after the name of the field - 'datee' => $date_end, // mise a jour des reponses utilisateurs dans la base - if (!empty($arrayfields['t.datee']['checked'])) { if ($user->hasRight('stock', 'mouvement', 'lire')) { if (empty($reyear) || empty($remonth) || empty($reday)) { jQuery("#mouvement").change(function() { preg_match('/:([!<>=\s]+|in|notin|like|notlike):/', $tmpcrit, $reg); print $form->selectDate($object->periode, 'period', 0, 0, 0, 'charge', 1); - print ''.$langs->trans("TransferStock").''; + print ''.$langs->trans("TransferStock").''; print ''.$langs->trans("ClinkOnALinkOfColumn", $langs->transnoentitiesnoconv("Referers")).''; print ''.dol_print_date($db->jdate($obj->periode), 'day').''; print ''.$langs->trans("AddIn").''; print dol_print_date($object->periode, "day"); - $TWeek[$week_number] = $week_number; + "sme", $action = 'transfert'; $cle_rib = strtolower(checkES($rib, $CCC)); $date_com = dol_mktime(GETPOST('rehour'), GETPOST('remin'), GETPOST('resec'), GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); $date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1); + $date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOSTINT('remonth') ? dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')) : -1); $datefrom = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); $datesubscription = dol_mktime(0, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); - $datetouse = ($this->date_end > 0) ? $this->date_end : ((isset($this->datee) && $this->datee > 0) ? $this->datee : 0); - $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field : 'fk_projet'); $ensemblereponses = $obj->reponses; $head[$h][1] = $langs->trans("Referers"); $head[$tab][1] = $langs->trans("Referers"); $out .= "".$langs->trans("Referer").": ".(isset($_SERVER["HTTP_REFERER"]) ? dol_htmlentities($_SERVER["HTTP_REFERER"], ENT_COMPAT) : '')."
      \n"; $reday = GETPOSTINT('reday'); - $sql = "SELECT p.rowid as id, p.entity, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_modification, p.budget_amount"; - $sql = 'SELECT p.rowid as id, p.entity, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_modification, p.budget_amount'; $sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; $sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; - $sql .= " VALUES (".$conf->entity.", '".$this->db->idate($this->datea)."'"; - $sql .= " datee=".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null').","; - $sql .= " f.date_approval as datea,"; - $sql .= " f.date_approve as datea,"; - $sql .= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,"; - $sql .= " t.datee as date_end,"; - $sql .= " t.dateo as date_start, t.datee as date_end"; - $sql .= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang,"; - $sql .= " tms, dateo as date_start, datee as date_end, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut as status, fk_opp_status, opp_percent,"; $sql .= ", '".$this->db->idate($this->periode)."'"; $sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode as period, cs.import_key"; - $sql .= ", datea = '".$this->db->idate(dol_now())."'"; - $sql .= ", datee"; $sql .= ", periode='".$this->db->idate($this->periode)."'"; - $sql = "INSERT INTO ".$this->db->prefix()."links (entity, datea, url, label, objecttype, objectid)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, fk_user, date_creation)"; - $sql = "SELECT SUM(duree) as total_duration, min(date) as dateo, max(date) as datee "; $sql = "SELECT id_users, nom as name, id_sondage, reponses"; $sql = "SELECT id_users, nom as name, reponses"; - $sql = "SELECT p.rowid, p.fk_statut as status, p.fk_opp_status, p.datee as datee"; - $sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM ".$this->db->prefix()."links"; - $sql = 'SELECT c.rowid, date_creation as datec, tms as datem, date_valid as date_validation, date_approve as datea, date_approve2 as datea2,'; $test = ""; // Same $test = '/javas:cript/google.com'; $this->periode = $this->date_creation + 3600 * 24 * 30; $title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('Referers'); $title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('Referers'); $title = $langs->transnoentities("Balance")." - ".$langs->transnoentities("AllTime"); - 'datee' => $datee - 'datee' =>array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>1, 'visible'=>1, 'position'=>35), - 'datee' =>array('type'=>'date', 'label'=>'Datee', 'enabled'=>1, 'visible'=>-1, 'position'=>90), - ,'datee'=>array('type'=>'date') // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire - echo dol_print_date($rule->datee, 'day'); - foreach ($TWeek as $weekNb) { if (!empty($arrayfields['cs.periode']['checked'])) { - if (!empty($arrayfields['p.datee']['checked'])) { - if ($datee > 0) { if ($newamount == 0 || empty($this->date_ech) || (empty($this->period) && empty($this->periode))) { if ($user->hasRight('stock', 'mouvement', 'creer')) { if (GETPOSTISSET("reday") && GETPOSTISSET("remonth") && GETPOSTISSET("reyear")) { - if (count($arrayfields) > 0 && !empty($arrayfields['t.datee']['checked'])) { - if (empty($datee)) { if (empty($reyear) || empty($remonth) || empty($reday)) { - if (empty($this->datea)) { - if (in_array('01', $TWeek) && in_array('52', $TWeek) && $weekNb == '01') { - print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0); - print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', 0, 0, 0, '', 1, 0); - print $object->datee ? dol_print_date($object->datee, 'daytext') : ' '; print ''; print ''.$langs->trans("AddIn").''; - print ''.$langs->trans("Datee").''; - print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "t.datee", '', $param, '', $sortfield, $sortorder, 'center '); - * @param string $datee End date (ex 23:59:59) * @param float|string $selectedrate Force preselected vat rate. Can be '8.5' or '8.5 (NOO)' for example. Use '' for no forcing. - $TWeek = array(); $date = $obj->periode; - $datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); - $datee = dol_stringtotime($dateerfc); $datepaid = dol_mktime(12, 0, 0, GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); $datepaid = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); $datepaye = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); @@ -201,55 +110,31 @@ $head[$h][1] = $langs->trans('Referers'); $inj += preg_match('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)[a-z]*\s*=/i', $tmpval); $inj += preg_match('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)[a-z]*\s*=/i', $val); - $morewherefilterarray[] = " t.datee <= '".$db->idate($search_date_end_end)."'"; - $morewherefilterarray[] = " t.datee >= '".$db->idate($search_date_end_start)."'"; $opensurveysondage->mail_admin = $_SESSION['adresse']; $pdf->SetXY($savx, $savy); - $projectstatic->datee = $db->jdate($obj->projectdatee); $reday = GETPOST('reday'); $savy = $pdf->getY(); $somethingshown = $formactions->showactions($object, 'mouvement', 0, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for product $sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; $sql .= " AND cs.periode <= '".$db->idate($search_date_limit_end)."'"; $sql .= " AND cs.periode >= '".$db->idate($search_date_limit_start)."'"; - $sql .= " AND p.datee <= '".$db->idate($search_date_end_end)."'"; - $sql .= " AND p.datee >= '".$db->idate($search_date_end_start)."'"; - $sql .= " AND t.datee <= '".$db->idate($search_datelimit_end)."'"; - $sql .= " AND t.datee >= '".$db->idate($search_datelimit_start)."'"; - $sql .= " GROUP BY p.ref, p.title, p.rowid, p.fk_statut, p.fk_opp_status, p.public, p.dateo, p.datee, t.label, t.rowid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee"; - $sql .= " GROUP BY p.rowid, p.ref, p.title, p.fk_statut, p.datee, p.fk_opp_status, p.public, p.fk_user_creat,"; $sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; - $sql .= " ORDER BY t.dateo DESC, t.rowid DESC, t.datee DESC"; $sql .= " SET reponses = '".$db->escape($nouveauchoix)."'"; $sql .= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode as period, cs.date_ech, cs.amount as total,"; - $sql .= " t.datec, t.dateo, t.datee, t.tms,"; - $sql .= " t.label, t.rowid as taskid, t.planned_workload, t.duration_effective, t.progress, t.dateo as date_start, t.datee as date_end, SUM(tasktime.element_duration) as timespent"; - $sql = "SELECT p.ref, p.title, p.rowid as projectid, p.fk_statut as status, p.fk_opp_status as opp_status, p.public, p.dateo as projdate_start, p.datee as projdate_end,"; $sql.= " ".MAIN_DB_PREFIX."notify_def as nd,"; $sql.= " AND nd.fk_action = ad.rowid"; $sql.= " WHERE u.rowid = nd.fk_user"; $sql.= " nd.rowid, ad.code, ad.label"; - $sql2 .= " p.dateo, p.datee,"; - $sql2 .= " s.logo, s.email, s.entity, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_percent, p.opp_amount, p.dateo, p.datee"; $title = $langs->trans('Batch')." ".$shortlabel." - ".$langs->trans('Referers'); - $totalforvisibletasks = projectLinesPerMonth($j, $firstdaytoshow, $usertoprocess, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $isavailable, 0, $TWeek); $value = preg_replace('/([a-z\.]+)\s*([!<>=]+|in|notin|like|notlike)\s*/', '\1:\2:', $value); // Clean string 'x < 10' into 'x:<:10' so we can then explode on space to get all AND tests to do 'cs.periode' => array('label' => "PeriodEndDate", 'checked' => 1, 'position' => 50), - 't.datee'=>array('label'=>"Deadline", 'checked'=>1, 'position'=>101), - 't.datee'=>array('label'=>"Deadline", 'checked'=>1, 'position'=>5), // Ligne de la periode d'analyse du rapport // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire - //$datee=$now - //$dates=dol_time_plus_duree($datee, -1, 'y'); TaskItem(pID, pName, pStart, pEnd, pColor, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGantt)

      - foreach ($TWeek as $weekNb) { - foreach ($TWeek as $week_number) { - if (!empty($arrayfields['t.datee']['checked'])) { if ($action == "transfert") { if ($object->id > 0 && $action == 'addin') { if (GETPOST('reday')) { if (GETPOSTINT("reyear") && GETPOSTINT("remonth") && GETPOSTINT("reday")) { - print $form->selectDate($datee, 'datee', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); print ''; print ''."\n"; print ''.$langs->trans("NbOfMembers").' ('.$langs->trans("AllTime").')'; print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "cs.periode", "", $param, '', $sortfield, $sortorder, 'center '); select#date_startday, select#date_startmonth, select#date_endday, select#date_endmonth, select#reday, select#remonth select#date_startday, select#date_startmonth, select#date_endday, select#date_endmonth, select#reday, select#remonth, - print ''; - print ''.$langs->trans("TransferStock").''; - print ''.$langs->trans("TransferStock").''; - print 'id.'&token='.newToken().'">'; - print ''.$langs->trans("TransferStock").''; diff --git a/dev/tools/dolibarr-mysql2pgsql.pl b/dev/tools/dolibarr-mysql2pgsql.pl index 17dda3cb48b23..5e7d87d1234f5 100755 --- a/dev/tools/dolibarr-mysql2pgsql.pl +++ b/dev/tools/dolibarr-mysql2pgsql.pl @@ -157,7 +157,7 @@ print OUT "\\c ". $1; next; } - if ($create_sql ne "") { # we are inside create table statement so lets process datatypes + if ($create_sql ne "") { # we are inside create table statement so let's process datatypes if (/\);/i) { # end of create table sequence $create_sql =~ s/,$//g; # strip last , inside create table diff --git a/dev/tools/dolibarr-postgres2mysql.php b/dev/tools/dolibarr-postgres2mysql.php index 9b7bed014f777..85beb64f0ed45 100644 --- a/dev/tools/dolibarr-postgres2mysql.php +++ b/dev/tools/dolibarr-postgres2mysql.php @@ -3,6 +3,7 @@ /* * Copyright (C) 2005-2011 James Grant Lightbox Technologies Inc. * Copyright (C) 2020 Laurent Destailleur + * Copyright (C) 2024 MDW * * 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 @@ -419,7 +420,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) // in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string'), but could also be (number, E'string'); so we can't search for the previous ' // ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character - // at a time, and that's just stupid, so lets just hope this doesn't appear anywhere in the actual data + // at a time, and that's just stupid, so let's just hope this doesn't appear anywhere in the actual data $after = str_replace(" (E'", " ('", $after); $after = str_replace(", E'", ", '", $after); @@ -439,7 +440,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) // in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string') // ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character - // at a time, and that's just stupid, so lets just hope this doesn't appear anywhere in the actual data + // at a time, and that's just stupid, so let's just hope this doesn't appear anywhere in the actual data $after = str_replace(" (E'", " ('", $after); $after = str_replace(", E'", ", '", $after); @@ -457,7 +458,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) // in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string') // ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character - // at a time, and that's just stupid, so lets just hope this doesn't appear anywhere in the actual data + // at a time, and that's just stupid, so let's just hope this doesn't appear anywhere in the actual data // after the first line, we only need to check for it in the middle, not at the beginning of an insert (because the beginning will be on the first line) // $after=str_replace(" (E'","' ('",$after); @@ -497,7 +498,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) $reg2 = array(); if (preg_match('/ALTER TABLE ([^\s]+)/', $pkey, $reg2)) { if (empty($arrayofprimaryalreadyintabledef[$reg2[1]])) { - // looks like we have a single line PRIMARY KEY definition, lets go ahead and add it + // looks like we have a single line PRIMARY KEY definition, let's go ahead and add it $output .= str_replace("\n", "", $pkey); // the postgres and mysql syntax for this is (at least, in the example im looking at) // identical, so we can just add it as is. diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 7f9d5a12b5292..1fff4a6a80291 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -1032,7 +1032,7 @@ $totalarray['val'] = array(); $totalarray['val']['totaldebit'] = 0; $totalarray['val']['totalcredit'] = 0; -$totalarray['val']['totalbalance']=0; +$totalarray['val']['totalbalance'] = 0; while ($i < min($num, $limit)) { $line = $object->lines[$i]; @@ -1283,7 +1283,7 @@ // Label operation if (!empty($arrayfields['t.label_operation']['checked'])) { - // Affiche un lien vers la facture client/fournisseur + // Show a link to the customer/supplier invoice $doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref); if (strlen(length_accounta($line->subledger_account)) == 0) { print ''.dol_escape_htmltag($line->label_operation).''; diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 25e9b0ca80d11..329b2986fe603 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -466,7 +466,7 @@ public function delete($user, $notrigger = 0) } /** - * Return clicable name (with picto eventually) + * Return clickable name (with picto eventually) * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withlabel 0=No label, 1=Include label of account diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 7eb943244d427..05ffa3c1311ca 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2291,7 +2291,7 @@ public function getTooltipContentArray($params) } /** - * Return clicable name (with picto eventually) + * Return clickable name (with picto eventually) * * @param int $withpictoimg 0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small, -4=???) * @param int $maxlen length max label @@ -3251,7 +3251,7 @@ public function sendReminderForExpiredSubscription($daysbeforeendlist = '10') } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) * @param array $arraydata Array of data diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 605c9b248e66d..3909b4a5e038c 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2018-2019 Thibault Foucart * Copyright (C) 2021 Waël Almoman * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -699,9 +700,9 @@ public function getTooltipContentArray($params) if (isset($this->duration)) { $datas['duration'] = '
      '.$langs->trans("Duration").': '.$this->duration_value; if ($this->duration_value > 1) { - $dur = array("i"=>$langs->trans("Minutes"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); + $dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years")); } elseif ($this->duration_value > 0) { - $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); + $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year")); } $datas['duration'] .= " " . (!empty($this->duration_unit) && isset($dur[$this->duration_unit]) ? $langs->trans($dur[$this->duration_unit]) : ''); } @@ -710,7 +711,7 @@ public function getTooltipContentArray($params) } /** - * Return clicable name (with picto eventually) + * Return clickable name (with picto eventually) * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $maxlen length max label @@ -970,7 +971,7 @@ public function getMailOnExclude() /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) * @param array $arraydata Array of data diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 2012f7c839d6e..676c82818efa5 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -420,7 +420,7 @@ public function delete($user, $notrigger = 0) /** - * Return clicable name (with picto eventually) + * Return clickable name (with picto eventually) * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $notooltip 1=Disable tooltip @@ -536,7 +536,7 @@ public function info($id) } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) * @param array $arraydata Array of data diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index b7eaba7420955..fd65e1300f3da 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1622,7 +1622,7 @@ public function getParentBomTreeRecursive(&$TParentBom, $bom_id = 0, $level = 1) } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) * @param array $arraydata Array of data diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 68283a0f3a3e5..53ae07106674a 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2016 Laurent Destailleur + * Copyright (C) 2024 MDW * * 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 @@ -350,7 +351,7 @@ protected function _cleanObjectDatas($object) // phpcs:enable $object = parent::_cleanObjectDatas($object); - unset($object->note); // alreaydy into note_private + unset($object->note); // already in note_private or note_public unset($object->usermod); unset($object->libelle); unset($object->context); diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 7d3d2fce5143d..15f6b6204ce42 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -11,6 +11,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2020 Open-Dsi * Copyright (C) 2022 Anthony Berton + * Copyright (C) 2024 MDW * * 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 @@ -618,7 +619,7 @@ } // Other attributes - $parameters = array('socid'=>$object->id); + $parameters = array('socid' => $object->id); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; // Sales representative @@ -697,7 +698,7 @@ // Nbre max d'elements des petites listes $MAXLIST = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT'); - // Lien recap + // Link summary/status board $boxstat .= '
      '; $boxstat .= ''; $boxstat .= '\n"; print '\n"; //print '\n"; print '\n"; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index b424f61832e7b..eda779bcd5b95 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3723,7 +3723,7 @@ public function getTooltipContentArray($params) } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param int $withpicto Add picto into link * @param string $option Where point the link ('expedition', 'document', ...) @@ -3938,7 +3938,7 @@ public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) * @param array $arraydata Array of data diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 937ecbb5582cc..011827440fbfe 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -390,17 +390,17 @@ class Commande extends CommonOrder /* * Signed by sender */ - CONST STATUS_SIGNED_SENDER = 1; + const STATUS_SIGNED_SENDER = 1; /* * Signed by receiver */ - CONST STATUS_SIGNED_RECEIVER = 2; + const STATUS_SIGNED_RECEIVER = 2; /* * Signed by all */ - CONST STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract) + const STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract) /** @@ -3815,7 +3815,7 @@ public function getTooltipContentArray($params) } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param int $withpicto Add picto into link * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index b25dcf6001b43..16139ea4ea162 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -557,12 +557,12 @@ public function get_url($fk_bank = 0, $url_id = 0, $type = '') $num = $this->db->num_rows($result); while ($i < $num) { $obj = $this->db->fetch_object($result); - // Anciens liens (pour compatibilite) + // Old links (for compatibility) $lines[$i][0] = $obj->url; $lines[$i][1] = $obj->url_id; $lines[$i][2] = $obj->label; $lines[$i][3] = $obj->type; - // Nouveaux liens + // New links $lines[$i]['url'] = $obj->url; $lines[$i]['url_id'] = $obj->url_id; $lines[$i]['label'] = $obj->label; @@ -1515,7 +1515,7 @@ public function getTooltipContentArray($params) } /** - * Return clicable name (with picto eventually) + * Return clickable name (with picto eventually) * * @param int $withpicto Include picto into link * @param string $mode ''=Link to card, 'transactions'=Link to transactions card @@ -1950,7 +1950,7 @@ public static function replaceThirdparty($dbs, $origin_id, $dest_id) } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) * @param array $arraydata Array of data diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 177b64dcccd38..e7606bee7bf9e 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -680,7 +680,7 @@ public function LibStatut($status, $mode = 0) /** - * Send name clicable (with possibly the picto) + * Send name clickable (with possibly the picto) * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param string $option link option @@ -819,7 +819,7 @@ public function getVentilExportCompta() } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) * @param array $arraydata Array of data diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index 9621224c0c4c2..13697229c7fa7 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -370,7 +370,7 @@ public function LibStatut($status, $mode = 0) } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param int $withpicto Add picto into link * @param string $option On what the link point to ('nolink', ...) @@ -448,7 +448,7 @@ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) * @param array $arraydata Array of data diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 2195f0b5a3ea3..8501dcc132282 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -362,14 +363,14 @@ public function LibStatut($status, $mode = 0) $this->labelStatusShort[self::STATUS_REFUNDED] = $langs->transnoentitiesnoconv('Refunded'); } - $status_logo = array(0 => 'status0', 1=>'status4', 2 => 'status1', 4 => 'status6', 5 => 'status4', 6 => 'status6', 99 => 'status5'); + $status_logo = array(0 => 'status0', 1 => 'status4', 2 => 'status1', 4 => 'status6', 5 => 'status4', 6 => 'status6', 99 => 'status5'); $statusType = $status_logo[$status]; return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } /** - * Return clicable name (with picto eventually) + * Return clickable name (with picto eventually) * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @return string Chaine avec URL diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 5f7273fd6ef86..e624bb2d52c43 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1432,7 +1432,7 @@ public function createRecurringInvoices($restrictioninvoiceid = 0, $forcevalidat } /** - * Return clicable name (with picto eventually) + * Return clickable name (with picto eventually) * * @param int $withpicto Add picto into link * @param string $option Where point the link diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 2985c0f75bb4a..176e74c49d120 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1968,7 +1968,7 @@ public function getTooltipContentArray($params) } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param int $withpicto Add picto into link * @param string $option Where point the link @@ -2861,7 +2861,7 @@ public function delete($user, $notrigger = 0, $idwarehouse = -1) // Delete invoice line $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.((int) $rowid); - if ($this->db->query($sqlef) && $this->db->query($sql) && $this->delete_linked_contact() >= 0 ) { + if ($this->db->query($sqlef) && $this->db->query($sql) && $this->delete_linked_contact() >= 0) { $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.((int) $rowid); $resql = $this->db->query($sql); @@ -5985,7 +5985,7 @@ public function willBeLastOfSameType($allow_validated_drafts = false) } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) * @param array $arraydata Array of data diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index e49c317a53edd..41a9ff3001185 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -545,7 +545,7 @@ public function addPayment($user) $ok = 0; } - // Mise a jour liens + // Update the links $result = $acc->add_url_line($bank_line_id, $this->id, DOL_URL_ROOT.'/compta/localtax/card.php?id=', "(VATPayment)", "payment_vat"); if ($result < 0) { $this->error = $acc->error; @@ -598,7 +598,7 @@ public function update_fk_bank($id) * Returns clickable name * * @param int $withpicto 0=Link, 1=Picto into link, 2=Picto - * @param string $option Sur quoi pointe le lien + * @param string $option What the link points to * @return string Chaine avec URL */ public function getNomUrl($withpicto = 0, $option = '') @@ -653,7 +653,7 @@ public function LibStatut($status, $mode = 0) } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) * @param array $arraydata Array of data diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index 6644378a926b4..7e65f5a61c6ed 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -505,7 +505,7 @@ print ''; } - if (count($x_coll) == 0) { // Show a total ine if nothing shown + if (count($x_coll) == 0) { // Show a total line if nothing shown print ''; print ''; print ''; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 70274fd13c360..837358ee7e16f 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -896,10 +896,10 @@ public function initAsSpecimen($option = '') } /** - * Return clicable name (with picto eventually) + * Return clickable name (with picto eventually) * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param string $option Sur quoi pointe le lien + * @param string $option Indicate where the link points to * @param int $notooltip 1=Disable tooltip * @param string $morecss Add more css on link * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking @@ -996,7 +996,7 @@ public function LibStatut($status, $mode = 0) } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) * @param array $arraydata Array of data diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 5b60317e5db51..3ecb65e120aa6 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -891,7 +891,7 @@ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Mise a jour du lien entre le paiement et la ligne generee dans llx_bank + * Update the link between the Payment and the line generated in llx_bank * * @param int $id_bank Id compte bancaire * @return int Return integer <0 if KO, >0 if OK @@ -1282,10 +1282,10 @@ public function initAsSpecimen($option = '') /** - * Return clicable name (with picto eventually) + * Return clickable name (with picto eventually) * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param string $option Sur quoi pointe le lien + * @param string $option What the link points to * @param string $mode 'withlistofinvoices'=Include list of invoices into tooltip * @param int $notooltip 1=Disable tooltip * @param string $morecss Add more CSS diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index e8770f12f0ea0..f44546192ec68 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -2213,7 +2213,7 @@ public function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $XML_DEBITOR .= ' ' . $CrLf; $XML_DEBITOR .= ' ' . $CrLf; $XML_DEBITOR .= ' ' . $CrLf; - if (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0) { + if (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0) { $XML_DEBITOR .= ' ' . $row_bic . '' . $CrLf; } $XML_DEBITOR .= ' ' . $CrLf; @@ -2771,7 +2771,7 @@ public function load_board($user, $mode) } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) * @param array $arraydata Array of data diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 1a5cbbd740d41..410e19fd95026 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -755,7 +755,7 @@ public function initAsSpecimen() } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) * @param array $arraydata Array of data diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 9d0f05c69ea3f..8e5e8fc3da81e 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -674,7 +674,7 @@ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Mise a jour du lien entre le paiement de charge et la ligne dans llx_bank generee + * Update the link between the Payment and the line generated in llx_bank * * @param int $id_bank Id if bank * @return int >0 if OK, <=0 if KO @@ -759,7 +759,7 @@ public function LibStatut($status, $mode = 0) } /** - * Return clicable name (with picto eventually) + * Return clickable name (with picto eventually) * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $maxlen Longueur max libelle diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index ff93f20f336b1..86ef3612af139 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -5,6 +5,7 @@ * Copyright (C) 2017 Olivier Geffroy * Copyright (C) 2018-2020 Frédéric France * Copyright (C) 2024 Benjamin B. + * Copyright (C) 2024 MDW * * 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 @@ -677,8 +678,8 @@ print '
      '; @@ -926,7 +927,7 @@ * Latest orders */ if (isModEnabled('order') && $user->hasRight('commande', 'lire')) { - $param =""; + $param = ""; $sql = "SELECT s.nom, s.rowid"; $sql .= ", c.rowid as cid, c.entity, c.fk_projet, c.total_ht"; @@ -1237,7 +1238,7 @@ print $late; print "'; - print dol_trunc(strtolower(get_class($object)) == strtolower(Client::class) ? $objp->refcus : $objp->refsup, 12); + print dol_trunc(strtolower(get_class($object)) == strtolower(Client::class) ? $objp->refcus : $objp->refsup, 12); print "'.dol_print_date($db->jdate($objp->dc), 'day')."'.dol_print_date($db->jdate($objp->dcon), 'day')."
       '.$langs->trans("Total").':
      '; - // Factures non reglees - // Y a bug ici. Il faut prendre le reste a payer et non le total des factures non reglees ! + // Unpaid invoices + // There is a bug here. We need to use the remaining to pay and not the total of unpaid invoices! $sql = "SELECT f.ref, f.rowid, s.nom, s.rowid as socid, f.total_ttc, sum(pf.amount) as am"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f left join ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture"; diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 113f3970e76db..dc5fa89221fa9 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -723,7 +723,7 @@ public function update_fk_bank($id_bank) } /** - * Send name clicable (with possibly the picto) + * Send name clickable (with possibly the picto) * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param string $option link option @@ -915,7 +915,7 @@ public function LibStatut($status, $mode = 0, $alreadypaid = -1) } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) * @param array $arraydata Array of data diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index f779a866aaefc..0704774bae049 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2060,7 +2060,7 @@ public function getTooltipContentArray($params) } /** - * Return clicable name (with picto eventually) + * Return clickable name (with picto eventually) * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $maxlength Max length of ref @@ -2889,7 +2889,7 @@ public static function contractCmpDate($a, $b) } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) * @param array $arraydata Array of data @@ -3233,7 +3233,7 @@ public function getTooltipContentArray($params) } /** - * Return clicable name (with picto eventually) for ContratLigne + * Return clickable name (with picto eventually) for ContratLigne * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $maxlength Max length diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index b1a4d7c824ac7..f4b328cfa7231 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * 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 @@ -77,7 +78,7 @@ // We check permission. // Check is done on $user->rights->element->create or $user->rights->element->subelement->create (because $action = 'set') -if (preg_match('/statu[st]$/', $field) || ($field == 'evenunsubscribe' && $object->table_element == 'mailing')) { +if (preg_match('/stat[u][st]$/', $field) || ($field == 'evenunsubscribe' && $object->table_element == 'mailing')) { restrictedArea($user, $object->module, $object, $object->table_element, $usesublevelpermission); } elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products restrictedArea($user, 'produit|service', $object, 'product&product', '', '', 'rowid'); diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 430c477e89a35..9db27df35a12c 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -177,7 +177,7 @@ abstract class CommonInvoice extends CommonObject /** * Proforma invoice. - * @deprectad Remove this. A "proforma invoice" is an order with a look of invoice, not an invoice ! + * @deprecated Remove this. A "proforma invoice" is an order with a look of invoice, not an invoice ! */ const TYPE_PROFORMA = 4; @@ -676,7 +676,7 @@ public function getLibType($withbadge = 0) } elseif ($this->type == CommonInvoice::TYPE_DEPOSIT) { $labellong = "InvoiceDeposit"; $labelshort = "Deposit"; - } elseif ($this->type == CommonInvoice::TYPE_PROFORMA) { + } elseif ($this->type == CommonInvoice::TYPE_PROFORMA) { // @phan-suppress-current-line PhanDeprecatedClassConstant $labellong = "InvoiceProForma"; // Not used. $labelshort = "ProForma"; } elseif ($this->type == CommonInvoice::TYPE_SITUATION) { diff --git a/htdocs/core/class/commonorder.class.php b/htdocs/core/class/commonorder.class.php index 110a67c5e1c91..c8dbda9c9bfb3 100644 --- a/htdocs/core/class/commonorder.class.php +++ b/htdocs/core/class/commonorder.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -35,7 +36,7 @@ abstract class CommonOrder extends CommonObject /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) * @param array $arraydata Array of data @@ -72,7 +73,7 @@ public function getKanbanView($option = '', $arraydata = null) return $return; } - /** return nb of fines of order where products or services that can be buyed + /** return nb of fines of order where products or services that can be bought * * @param boolean $ignoreFree Ignore free lines * @return int number of products or services on buy in a command @@ -84,10 +85,12 @@ public function getNbLinesProductOrServiceOnBuy($ignoreFree = false) $return = 0; foreach ($this->lines as $line) { if (empty($line->fk_product) && !$ignoreFree) { - $return ++; + $return++; } elseif ((int) $line->fk_product > 0) { if ($product->fetch($line->fk_product) > 0) { - if ($product->status_buy) $return ++; + if ($product->status_buy) { + $return++; + } } } } @@ -143,13 +146,13 @@ abstract class CommonOrderLine extends CommonObjectLine * Boolean that indicates whether the product is available for sale '1' or not '0' * @var int */ - public $product_tosell=0; + public $product_tosell = 0; /** * Boolean that indicates whether the product is available for purchase '1' or not '0' * @var int */ - public $product_tobuy=0; + public $product_tobuy = 0; /** * Product description diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 2ae7c0bf35145..bc19b00d074c5 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1914,7 +1914,7 @@ public function showOutputField($key, $value, $moreparam = '', $extrafieldsobjec $resql = $this->db->query($sql); if ($resql) { if ($filter_categorie === false) { - $value = ''; // value was used, so now we reste it to use it to build final output + $value = ''; // value was used, so now we reset it to use it to build final output $obj = $this->db->fetch_object($resql); @@ -2024,7 +2024,7 @@ public function showOutputField($key, $value, $moreparam = '', $extrafieldsobjec $resql = $this->db->query($sql); if ($resql) { if ($filter_categorie === false) { - $value = ''; // value was used, so now we reste it to use it to build final output + $value = ''; // value was used, so now we reset it to use it to build final output $toprint = array(); while ($obj = $this->db->fetch_object($resql)) { // Several field into label (eq table:code|label:rowid) diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index 947ea1874a921..267abf6a7985d 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -301,7 +301,7 @@ public function getTooltipContentArray($params) } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param int $withpicto Add picto into link * @param int $notooltip 1=Disable tooltip diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index b6a506e4e8082..e1da5b7a5a449 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2017 Rui Strecht * Copyright (C) 2020 Open-Dsi * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -388,7 +389,7 @@ public function select_state($selected = 0, $country_codeid = 0, $htmlname = 'st public function select_state_ajax($parent_field_id = 'country_id', $selected = 0, $country_codeid = 0, $htmlname = 'state_id', $morecss = 'maxwidth200onsmartphone minwidth300') { $html = ' "reset()", - "span" => "style='font-size: 150%;'", - "text" => "C", - "class" => "poscolorblue" +"function" => "reset()", +"span" => "style='font-size: 150%;'", +"text" => "C", +"class" => "poscolorblue" ), array( - "function" => "parent.$.colorbox.close();", - "span" => "id='printtext' style='font-weight: bold; font-size: 18pt;'", - "text" => "X", - "class" => "poscolordelete" +"function" => "parent.$.colorbox.close();", +"span" => "id='printtext' style='font-weight: bold; font-size: 18pt;'", +"text" => "X", +"class" => "poscolordelete" ), ); $numpad = getDolGlobalString('TAKEPOS_NUMPAD'); @@ -709,7 +710,7 @@ function ValidateSumup() { } print ''; - $i = $i + 1; + $i += 1; } if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && getDolGlobalString('STRIPE_CARD_PRESENT')) { diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 8d9edd31f70a3..e667a8b2215a3 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -5,6 +5,7 @@ * Copyright (C) 2018 Andreu Bisquerra * Copyright (C) 2019 Josep Lluís Amador * Copyright (C) 2021 Nicolas ZABOURI + * Copyright (C) 2024 MDW * * 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 @@ -228,22 +229,22 @@ } ?> lines as $line) { if (!array_key_exists($line->tva_tx, $vat_groups)) { $vat_groups[$line->tva_tx] = 0; } $vat_groups[$line->tva_tx] += $line->total_tva; } - // Loop on each VAT group + // Loop on each VAT group foreach ($vat_groups as $key => $val) { ?> multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount; //print "xx ".$row->multicurrency_amount." - ".$row->amount." - ".$amount_payment." - ".$object->multicurrency_tx; if ((!isModEnabled('multicurrency') || $object->multicurrency_tx == 1) && $row->code == "LIQ" && $row->pos_change > 0) { - $amount_payment = $amount_payment + $row->pos_change; // Show amount with excess received if it's cash payment + $amount_payment += $row->pos_change; // Show amount with excess received if it's cash payment $currency = $conf->currency; } else { // We do not show change if payment into a different currency because not yet supported diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 7b65ab171b65c..72ffc505dea3b 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -288,18 +288,18 @@ $maxwidthloginblock = 180; if (getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE') == 1 || !empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) { $disableimages = 1; - $maxwidthloginblock = $maxwidthloginblock + 50; + $maxwidthloginblock += 50; $minwidthtmenu = 0; } if (getDolGlobalString('MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN')) { - $maxwidthloginblock = $maxwidthloginblock + 55; + $maxwidthloginblock += 55; } if (getDolGlobalString('MAIN_USE_TOP_MENU_SEARCH_DROPDOWN')) { - $maxwidthloginblock = $maxwidthloginblock + 55; + $maxwidthloginblock += 55; } if (!empty($conf->bookmark->enabled)) { - $maxwidthloginblock = $maxwidthloginblock + 55; + $maxwidthloginblock += 55; } diff --git a/htdocs/variants/tpl/productattributevalueline_view.tpl.php b/htdocs/variants/tpl/productattributevalueline_view.tpl.php index c8203f211da3a..5dc81dd2dc70e 100644 --- a/htdocs/variants/tpl/productattributevalueline_view.tpl.php +++ b/htdocs/variants/tpl/productattributevalueline_view.tpl.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -57,7 +58,8 @@ ref ?> - + write) && $action != 'selectlines') { print ''; - $coldisplay = $coldisplay + 3; + $coldisplay += 3; } if ($action == 'selectlines') { ?> From a8d3586d4bff5263dc1cd7412427320be563c78e Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Wed, 7 Aug 2024 02:58:05 +0200 Subject: [PATCH 055/152] FIX api call Get Notifications to make output more in line with what post notifications expects as input. This also removes duplicated fields (#30539) Co-authored-by: Jon Bendtsen --- htdocs/societe/class/api_thirdparties.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 6fcd0af3d6e9c..1ee873e7af4a2 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1131,7 +1131,7 @@ public function getCompanyNotification($id) * We select all the records that match the socid */ - $sql = "SELECT rowid as id, fk_action, fk_action as event, fk_soc, fk_soc as socid, fk_contact, fk_contact as target, type, datec, tms"; + $sql = "SELECT rowid as id, fk_action as event, fk_soc as socid, fk_contact as contact_id, type, datec, tms"; $sql .= " FROM ".MAIN_DB_PREFIX."notify_def"; if ($id) { $sql .= " WHERE fk_soc = ".((int) $id); @@ -1157,7 +1157,7 @@ public function getCompanyNotification($id) throw new RestException(404, 'No notifications found'); } - $fields = array('id', 'socid', 'fk_soc', 'fk_action', 'event', 'fk_contact', 'target', 'datec', 'tms', 'type'); + $fields = array('id', 'socid', 'event', 'contact_id', 'datec', 'tms', 'type'); $returnNotifications = array(); From 7fe990e972f2e879e408759ad44ad06234325343 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Wed, 7 Aug 2024 02:58:05 +0200 Subject: [PATCH 056/152] FIX api call Get Notifications to make output more in line with what post notifications expects as input. This also removes duplicated fields (#30539) Co-authored-by: Jon Bendtsen --- htdocs/societe/class/api_thirdparties.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 9ca9619090182..15614c538a214 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1110,7 +1110,7 @@ public function getCompanyNotification($id) * We select all the records that match the socid */ - $sql = "SELECT rowid as id, fk_action, fk_action as event, fk_soc, fk_soc as socid, fk_contact, fk_contact as target, type, datec, tms"; + $sql = "SELECT rowid as id, fk_action as event, fk_soc as socid, fk_contact as contact_id, type, datec, tms"; $sql .= " FROM ".MAIN_DB_PREFIX."notify_def"; if ($id) { $sql .= " WHERE fk_soc = ".((int) $id); @@ -1136,7 +1136,7 @@ public function getCompanyNotification($id) throw new RestException(404, 'No notifications found'); } - $fields = array('id', 'socid', 'fk_soc', 'fk_action', 'event', 'fk_contact', 'target', 'datec', 'tms', 'type'); + $fields = array('id', 'socid', 'event', 'contact_id', 'datec', 'tms', 'type'); $returnNotifications = array(); From 227bca1867a0283a79da7eddd8ba779b2932294f Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Wed, 7 Aug 2024 03:00:51 +0200 Subject: [PATCH 057/152] NEW API /setup endpoint for getting action triggers (#30538) * New API /setup endpoint for getting action triggers. This makes it easier to know which ID number to specify to enable PROPAL_VALIDATE notifications * introducing page and limit, also because phan was complaining --------- Co-authored-by: Jon Bendtsen --- htdocs/api/class/api_setup.class.php | 66 ++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 5b1eba9519ee8..20852515aecae 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -51,6 +51,72 @@ public function __construct() $this->db = $db; } + /** + * Get the list of Action Triggers. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Number of items per page + * @param int $page Page number {@min 0} + * @param string $elementtype Type of element ('adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...) + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'SO-%')" + * @return array List of extra fields + * + * @url GET actiontriggers + * + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of action triggers + */ + public function getListOfActionTriggers($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $elementtype = '', $sqlfilters = '') + { + $list = array(); + + if ($elementtype == 'thirdparty') { + $elementtype = 'societe'; + } + if ($elementtype == 'contact') { + $elementtype = 'socpeople'; + } + + $sql = "SELECT t.rowid as id, t.elementtype, t.code, t.contexts, t.label, t.description, t.rang"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_action_trigger as t"; + if (!empty($elementtype)) { + $sql .= " WHERE t.elementtype = '".$this->db->escape($elementtype)."'"; + } + // Add sql filters + if ($sqlfilters) { + $errormessage = ''; + $sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage); + if ($errormessage) { + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); + } + } + + $sql .= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + if ($result) { + $num = $this->db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + for ($i = 0; $i < $min; $i++) { + $list[] = $this->db->fetch_object($result); + } + } else { + throw new RestException(503, 'Error when retrieving list of action triggers : '.$this->db->lasterror()); + } + + return $list; + } + /** * Get the list of ordering methods. * From 45ed4caeb2d829c0556bd4a387517f9ff218e38c Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 7 Aug 2024 03:05:02 +0200 Subject: [PATCH 058/152] Qual: Enable Phan Simplify rule and fix notices (#30537) * Qual: Phan - Enable Simplyfy expression * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Update functions2.lib.php --------- Co-authored-by: Laurent Destailleur --- dev/tools/phan/config.php | 2 +- .../class/accountancyimport.class.php | 3 +- htdocs/adherents/admin/member.php | 2 +- htdocs/admin/pdf.php | 3 +- htdocs/api/admin/index.php | 5 ++- htdocs/api/class/api.class.php | 2 +- htdocs/asset/class/asset.class.php | 2 +- htdocs/bom/class/bom.class.php | 2 +- htdocs/bookcal/class/availabilities.class.php | 2 +- htdocs/bookcal/class/calendar.class.php | 2 +- htdocs/comm/propal/list.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/commande/list.php | 2 +- htdocs/commande/list_det.php | 2 +- htdocs/compta/ajaxpayment.php | 2 +- htdocs/compta/facture/list.php | 2 +- htdocs/compta/stats/cabyprodserv.php | 7 +-- htdocs/compta/stats/casoc.php | 3 +- .../stats/supplier_turnover_by_prodserv.php | 3 +- .../stats/supplier_turnover_by_thirdparty.php | 3 +- htdocs/compta/tva/quadri_detail.php | 2 +- htdocs/core/class/extrafields.class.php | 12 ++--- htdocs/core/class/html.formfile.class.php | 4 +- htdocs/core/class/ldap.class.php | 2 +- htdocs/core/class/timespent.class.php | 2 +- .../connectors/php/connector.lib.php | 2 +- htdocs/core/lib/accounting.lib.php | 2 +- htdocs/core/lib/company.lib.php | 2 +- htdocs/core/lib/functions2.lib.php | 14 +++--- htdocs/core/lib/security2.lib.php | 6 +-- htdocs/core/login/functions_ldap.php | 2 +- .../commande/doc/pdf_einstein.modules.php | 2 +- .../commande/doc/pdf_eratosthene.modules.php | 8 ++-- .../modules/facture/doc/pdf_crabe.modules.php | 2 +- .../facture/doc/pdf_octopus.modules.php | 2 +- .../facture/doc/pdf_sponge.modules.php | 6 +-- .../modules/propale/doc/pdf_azur.modules.php | 2 +- .../modules/propale/doc/pdf_cyan.modules.php | 6 +-- .../doc/pdf_aurore.modules.php | 2 +- htdocs/core/tpl/bloc_showhide.tpl.php | 5 ++- .../class/emailcollector.class.php | 44 +++++++++---------- .../class/conferenceorboothattendee.class.php | 2 +- htdocs/fichinter/class/fichinter.class.php | 2 +- .../class/fournisseur.commande.class.php | 2 +- htdocs/fourn/class/paiementfourn.class.php | 8 ++-- htdocs/holiday/class/holiday.class.php | 2 +- htdocs/hrm/class/evaluation.class.php | 2 +- htdocs/hrm/class/evaluationdet.class.php | 2 +- htdocs/hrm/class/job.class.php | 2 +- htdocs/hrm/class/position.class.php | 2 +- htdocs/hrm/class/skill.class.php | 2 +- htdocs/hrm/class/skilldet.class.php | 2 +- htdocs/hrm/class/skillrank.class.php | 2 +- .../class/knowledgerecord.class.php | 2 +- htdocs/main.inc.php | 14 +++--- htdocs/mrp/class/mo.class.php | 4 +- htdocs/opensurvey/lib/opensurvey.lib.php | 2 +- htdocs/opensurvey/results.php | 21 ++++----- htdocs/opensurvey/wizard/choix_autre.php | 2 +- htdocs/opensurvey/wizard/choix_date.php | 2 +- .../partnership/class/partnership.class.php | 2 +- .../class/partnershiputils.class.php | 2 +- htdocs/paypal/lib/paypalfunctions.lib.php | 3 +- htdocs/product/admin/product.php | 2 +- .../product/class/html.formproduct.class.php | 5 ++- .../class/productfournisseurprice.class.php | 2 +- .../product/stock/class/productlot.class.php | 4 +- .../class/stocktransfer.class.php | 2 +- .../class/stocktransferline.class.php | 6 +-- htdocs/projet/class/task.class.php | 2 +- htdocs/public/company/new.php | 2 +- htdocs/public/members/new.php | 2 +- htdocs/public/opensurvey/studs.php | 15 ++++--- htdocs/public/ticket/create_ticket.php | 3 +- .../public/webportal/webportal.main.inc.php | 4 +- .../class/recruitmentcandidature.class.php | 2 +- .../class/recruitmentjobposition.class.php | 2 +- htdocs/societe/admin/societe.php | 8 ++-- htdocs/societe/class/societe.class.php | 14 +++--- htdocs/takepos/index.php | 2 +- htdocs/user/passwordforgotten.php | 3 +- htdocs/webhook/class/target.class.php | 6 +-- .../class/html.formcardwebportal.class.php | 2 +- .../class/html.formwebportal.class.php | 6 +-- .../workstation/class/workstation.class.php | 2 +- 85 files changed, 188 insertions(+), 174 deletions(-) diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 1db32638f6baa..7d5e244a8cf98 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -386,7 +386,7 @@ 'UnknownElementTypePlugin', 'WhitespacePlugin', //'RemoveDebugStatementPlugin', // Reports echo, print, ... - //'SimplifyExpressionPlugin', + 'SimplifyExpressionPlugin', //'StrictComparisonPlugin', // Expects === 'SuspiciousParamOrderPlugin', 'UnsafeCodePlugin', diff --git a/htdocs/accountancy/class/accountancyimport.class.php b/htdocs/accountancy/class/accountancyimport.class.php index 36f26b27f0d35..7cba6c8bfb7a3 100644 --- a/htdocs/accountancy/class/accountancyimport.class.php +++ b/htdocs/accountancy/class/accountancyimport.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2017-2019 Frédéric France * Copyright (C) 2017 André Schild * Copyright (C) 2020 Guillaume Alexandre + * Copyright (C) 2024 MDW * * 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 @@ -179,7 +180,7 @@ public function computePieceNum(&$arrayrecord, $listfields, $record_key) } // at least one record value has changed, so we search for the next piece number from database or increment it - if ($atLeastOneLastRecordChanged === true) { + if ($atLeastOneLastRecordChanged) { $lastPieceNum = 0; if (empty($conf->cache['accounting']['nextPieceNum'])) { // get last piece number from database diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index fdd46b9f0f40f..f8c95fca83be4 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -302,7 +302,7 @@ print img_picto($langs->trans("Activated"), 'switch_on'); print "\n"; } else { - $disabled = (isModEnabled('multicompany') && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? true : false); + $disabled = isModEnabled('multicompany') && ((is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity)); print ''; print ''; -$production_mode = (!getDolGlobalString('API_PRODUCTION_MODE') ? false : true); +$production_mode = !(!getDolGlobalString('API_PRODUCTION_MODE')); if ($production_mode) { print ''; print ''; -$disable_compression = (!getDolGlobalString('API_DISABLE_COMPRESSION') ? false : true); +$disable_compression = !(!getDolGlobalString('API_DISABLE_COMPRESSION')); if ($disable_compression) { print '
      trans("VAT").' '.vatrate($key, 1); + echo $langs->trans("VAT").' '.vatrate($key, 1); } ?> currency)."\n"; + echo price($val, 1, '', 1, - 1, - 1, $conf->currency)."\n"; } ?>
      value ?>value ?> '; @@ -97,7 +99,7 @@ } } else { print ''; if (!$disabled) { print ''; diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 0548636e5deda..0ee86f731cdc1 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -5,6 +5,7 @@ * Copyright (C) 2012-2107 Juanjo Menent * Copyright (C) 2019 Ferran Marcet * Copyright (C) 2021-2022 Anthony Berton + * Copyright (C) 2024 MDW * * 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 @@ -266,7 +267,7 @@ print ''.$form->textwithpicto($langs->trans("PDFDesc"), $s)."
      \n"; print "
      \n"; -$noCountryCode = (empty($mysoc->country_code) ? true : false); +$noCountryCode = empty($mysoc->country_code); print '
      '; print ''; diff --git a/htdocs/api/admin/index.php b/htdocs/api/admin/index.php index 51b2f692cf1f0..83c20b7711683 100644 --- a/htdocs/api/admin/index.php +++ b/htdocs/api/admin/index.php @@ -4,6 +4,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012-2018 Regis Houssin * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2024 MDW * * 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 @@ -116,7 +117,7 @@ print '
      '.$langs->trans("ApiProductionMode").''; print img_picto($langs->trans("Activated"), 'switch_on'); @@ -131,7 +132,7 @@ print '
      '.$langs->trans("API_DISABLE_COMPRESSION").''; print img_picto($langs->trans("Activated"), 'switch_on'); diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index cd3f86d23fd2d..e516ed44ba280 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -55,7 +55,7 @@ public function __construct($db, $cachedir = '', $refreshCache = false) Defaults::$cacheDirectory = $cachedir; $this->db = $db; - $production_mode = (!getDolGlobalString('API_PRODUCTION_MODE') ? false : true); + $production_mode = !(!getDolGlobalString('API_PRODUCTION_MODE')); $this->r = new Restler($production_mode, $refreshCache); $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 6d602cd652339..c01109033345a 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -1542,7 +1542,7 @@ public function getNextNumRef() $mybool = ((bool) @include_once $dir.$file) || $mybool; } - if ($mybool === false) { + if (!$mybool) { dol_print_error(null, "Failed to include file ".$file); return ''; } diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 6e9d1e50f04be..fa8b244c594e8 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -866,7 +866,7 @@ public function getNextNumRef($prod) $mybool = ((bool) @include_once $dir.$file) || $mybool; } - if ($mybool === false) { + if (!$mybool) { dol_print_error(null, "Failed to include file ".$file); return ''; } diff --git a/htdocs/bookcal/class/availabilities.class.php b/htdocs/bookcal/class/availabilities.class.php index 355485b9e9fec..51c915659bed7 100644 --- a/htdocs/bookcal/class/availabilities.class.php +++ b/htdocs/bookcal/class/availabilities.class.php @@ -969,7 +969,7 @@ public function getNextNumRef() $mybool = ((bool) @include_once $dir.$file) || $mybool; } - if ($mybool === false) { + if (!$mybool) { dol_print_error(null, "Failed to include file ".$file); return ''; } diff --git a/htdocs/bookcal/class/calendar.class.php b/htdocs/bookcal/class/calendar.class.php index 09c6287b6b540..77aa627635356 100644 --- a/htdocs/bookcal/class/calendar.class.php +++ b/htdocs/bookcal/class/calendar.class.php @@ -960,7 +960,7 @@ public function getNextNumRef() $mybool = ((bool) @include_once $dir.$file) || $mybool; } - if ($mybool === false) { + if (!$mybool) { dol_print_error(null, "Failed to include file ".$file); return ''; } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 629c00ef799a7..2dccb456e9e40 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1783,7 +1783,7 @@ } $marginInfo = array(); - if ($with_margin_info === true) { + if ($with_margin_info) { $objectstatic->fetch_lines(); $marginInfo = $formmargin->getMarginInfosArray($objectstatic); $total_ht += $obj->total_ht; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 9e2603cffc476..d379b09297c36 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -443,7 +443,7 @@ public function getNextNumRef($soc) $mybool = ((bool) @include_once $dir.$file) || $mybool; } - if ($mybool === false) { + if (!$mybool) { dol_print_error(null, "Failed to include file ".$file); return ''; } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 8239bdc3edb3a..5bed3199e07af 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2149,7 +2149,7 @@ $projectstatic->title = $obj->project_label; $marginInfo = array(); - if ($with_margin_info === true) { + if ($with_margin_info) { $generic_commande->fetch_lines(); $marginInfo = $formmargin->getMarginInfosArray($generic_commande); $total_ht += $obj->total_ht; diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 2abf61b537a15..9e29e536b9d68 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -1547,7 +1547,7 @@ $projectstatic->title = $obj->project_label; $marginInfo = array(); - if ($with_margin_info === true) { + if ($with_margin_info) { $generic_commande->fetch_lines(); $marginInfo = $formmargin->getMarginInfosArray($generic_commande); $total_ht += $obj->total_ht; diff --git a/htdocs/compta/ajaxpayment.php b/htdocs/compta/ajaxpayment.php index 849e13a5ed88e..da4a4053bcaf8 100644 --- a/htdocs/compta/ajaxpayment.php +++ b/htdocs/compta/ajaxpayment.php @@ -119,7 +119,7 @@ $toJsonArray['amount_'.$currentInvId] = price2num($currentAmount); // Param will exist only if an img has been clicked } -$toJsonArray['makeRed'] = ($totalRemaining < price2num($result) || price2num($result) < 0) ? true : false; +$toJsonArray['makeRed'] = ($totalRemaining < price2num($result) || price2num($result) < 0); $toJsonArray['result'] = price($result); // Return value to user format $toJsonArray['resultnum'] = price2num($result); // Return value to numeric format diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 0196004840c20..0b2437affae95 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -2031,7 +2031,7 @@ $facturestatic->totalpaid = $paiement; $marginInfo = array(); - if ($with_margin_info === true) { + if ($with_margin_info) { $facturestatic->fetch_lines(); $marginInfo = $formmargin->getMarginInfosArray($facturestatic); $total_ht += $obj->total_ht; diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index c84458b532fc8..133f83ece7193 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -5,6 +5,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Alexandre Spangaro * Copyright (C) 2024 Charlene Benke + * Copyright (C) 2024 MDW * * 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 @@ -212,7 +213,7 @@ if (!empty($typent_id)) { $tableparams['typent_id'] = $typent_id; } -$tableparams['subcat'] = ($subcat === true) ? 'yes' : ''; +$tableparams['subcat'] = $subcat ? 'yes' : ''; // Adding common parameters $allparams = array_merge($commonparams, $headerparams, $tableparams); @@ -306,7 +307,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= ",".MAIN_DB_PREFIX."facturedet as l"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid"; - if ($typent_id >0) { + if ($typent_id > 0) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc ON (soc.rowid = f.fk_soc)"; } $parameters = array(); @@ -401,7 +402,7 @@ $sql .= " AND f.fk_soc = ".((int) $selected_soc); } - if ($typent_id >0) { + if ($typent_id > 0) { $sql .= " AND soc.fk_typent = ".((int) $typent_id); } diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index dbcd10c0cc253..75f8e8ec7092f 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -7,6 +7,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2018 Frédéric France * Copyright (C) 2022 Alexandre Spangaro + * Copyright (C) 2024 MDW * * 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 @@ -190,7 +191,7 @@ $tableparams['search_zip'] = $search_zip; $tableparams['search_town'] = $search_town; $tableparams['search_country'] = $search_country; -$tableparams['subcat'] = ($subcat === true) ? 'yes' : ''; +$tableparams['subcat'] = $subcat ? 'yes' : ''; // Adding common parameters $allparams = array_merge($commonparams, $headerparams, $tableparams); diff --git a/htdocs/compta/stats/supplier_turnover_by_prodserv.php b/htdocs/compta/stats/supplier_turnover_by_prodserv.php index 94c9b1d2a7a19..844258bd4928e 100644 --- a/htdocs/compta/stats/supplier_turnover_by_prodserv.php +++ b/htdocs/compta/stats/supplier_turnover_by_prodserv.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * 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 @@ -182,7 +183,7 @@ if (!empty($selected_type)) { $tableparams['search_type'] = $selected_type; } -$tableparams['subcat'] = ($subcat === true) ? 'yes' : ''; +$tableparams['subcat'] = $subcat ? 'yes' : ''; // Adding common parameters $allparams = array_merge($commonparams, $headerparams, $tableparams); diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php index 367666b06925a..67429cff39ae5 100644 --- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php +++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php @@ -1,6 +1,7 @@ * Copyright (C) 2023 Ferran Marcet + * Copyright (C) 2024 MDW * * 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 @@ -161,7 +162,7 @@ $tableparams['search_zip'] = $search_zip; $tableparams['search_town'] = $search_town; $tableparams['search_country'] = $search_country; -$tableparams['subcat'] = ($subcat === true) ? 'yes' : ''; +$tableparams['subcat'] = $subcat ? 'yes' : ''; // Adding common parameters $allparams = array_merge($commonparams, $headerparams, $tableparams); diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 9d4c63c0e7503..432301e20d598 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -47,7 +47,7 @@ // Load translation files required by the page $langs->loadLangs(array("other", "compta", "banks", "bills", "companies", "product", "trips", "admin")); -$refresh = (GETPOSTISSET('submit') || GETPOSTISSET('vat_rate_show') || GETPOSTISSET('invoice_type')) ? true : false; +$refresh = (GETPOSTISSET('submit') || GETPOSTISSET('vat_rate_show') || GETPOSTISSET('invoice_type')); $invoice_type = GETPOSTISSET('invoice_type') ? GETPOST('invoice_type', 'alpha') : ''; $vat_rate_show = GETPOSTISSET('vat_rate_show') ? GETPOST('vat_rate_show', 'alphanohtml') : -1; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index bffab498b3d38..d83543dabf9cd 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1356,7 +1356,7 @@ public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $ } } - if ($filter_categorie === false) { + if (!$filter_categorie) { $fields_label = explode('|', $InfoFieldList[1]); if (is_array($fields_label)) { $keyList .= ', '; @@ -1526,7 +1526,7 @@ public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $ } } - if ($filter_categorie === false) { + if (!$filter_categorie) { $fields_label = explode('|', $InfoFieldList[1]); if (is_array($fields_label)) { $keyList .= ', '; @@ -1913,7 +1913,7 @@ public function showOutputField($key, $value, $moreparam = '', $extrafieldsobjec dol_syslog(get_class($this).':showOutputField:$type=sellist', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - if ($filter_categorie === false) { + if (!$filter_categorie) { $value = ''; // value was used, so now we reset it to use it to build final output $obj = $this->db->fetch_object($resql); @@ -2023,7 +2023,7 @@ public function showOutputField($key, $value, $moreparam = '', $extrafieldsobjec dol_syslog(get_class($this).':showOutputField:$type=chkbxlst', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - if ($filter_categorie === false) { + if (!$filter_categorie) { $value = ''; // value was used, so now we reset it to use it to build final output $toprint = array(); while ($obj = $this->db->fetch_object($resql)) { @@ -2205,7 +2205,7 @@ public function showSeparator($key, $object, $colspan = 2, $display_type = 'card $expand_display = false; if (is_array($extrafield_param_list) && count($extrafield_param_list) > 0) { $extrafield_collapse_display_value = intval($extrafield_param_list[0]); - $expand_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) || GETPOSTINT('ignorecollapsesetup')) ? (empty($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) ? false : true) : ($extrafield_collapse_display_value == 2 ? false : true)); + $expand_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) || GETPOSTINT('ignorecollapsesetup')) ? (!empty($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key])) : !($extrafield_collapse_display_value == 2)); } $disabledcookiewrite = 0; if ($mode == 'create') { @@ -2239,7 +2239,7 @@ public function showSeparator($key, $object, $colspan = 2, $display_type = 'card $out .= ''."\n"; -llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', 0, 0, $morejs, '', 0, 0); +llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', 0, 0, $morejs, '', 0, 'mod-ecm page-index'); $head = ecm_prepare_dasboard_head(null); print dol_get_fiche_head($head, 'index', '', -1, ''); diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index ce1b824db58c1..ac7f129ccde5a 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -305,7 +305,7 @@ $moreheadjs .= 'var indicatorBlockUI = \''.DOL_URL_ROOT."/theme/".$conf->theme."/img/working.gif".'\';'."\n"; $moreheadjs .= ''."\n"; -llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', 0, 0, $morejs, '', 0, 0); +llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', 0, 0, $morejs, '', 0, 'mod-ecm page-index_auto'); // Add sections to manage diff --git a/htdocs/ecm/index_medias.php b/htdocs/ecm/index_medias.php index aec8bbbb5eb70..1414bc03c6eca 100644 --- a/htdocs/ecm/index_medias.php +++ b/htdocs/ecm/index_medias.php @@ -297,7 +297,7 @@ $moreheadjs .= 'var indicatorBlockUI = \''.DOL_URL_ROOT."/theme/".$conf->theme."/img/working.gif".'\';'."\n"; $moreheadjs .= ''."\n"; -llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', 0, 0, $morejs, '', 0, 0); +llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', 0, 0, $morejs, '', 0, 'mod-ecm page-index_medias'); $head = ecm_prepare_dasboard_head(null); print dol_get_fiche_head($head, 'index_medias', '', -1, ''); From 72dd5c2a9fc49d74d75dd47636489071c9b7b5f7 Mon Sep 17 00:00:00 2001 From: atm-lena <52402938+atm-lena@users.noreply.github.com> Date: Sat, 10 Aug 2024 23:47:13 +0200 Subject: [PATCH 075/152] llxHeader BodyCss IntracommReport (#30570) Co-authored-by: atm-lena --- htdocs/intracommreport/admin/intracommreport.php | 2 +- htdocs/intracommreport/card.php | 2 +- htdocs/intracommreport/list.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/intracommreport/admin/intracommreport.php b/htdocs/intracommreport/admin/intracommreport.php index 778cd7a94c493..26647326f022e 100644 --- a/htdocs/intracommreport/admin/intracommreport.php +++ b/htdocs/intracommreport/admin/intracommreport.php @@ -92,7 +92,7 @@ $form = new Form($db); $formother = new FormOther($db); -llxHeader('', $langs->trans("IntracommReportSetup")); +llxHeader('', $langs->trans("IntracommReportSetup"), '', '', 0, 0, '', '', '', 'mod-intracommreport page-admin_intracommreport'); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("IntracommReportSetup"), $linkback, 'title_setup'); diff --git a/htdocs/intracommreport/card.php b/htdocs/intracommreport/card.php index edd0dd5ab9e30..9a0ef534649fb 100644 --- a/htdocs/intracommreport/card.php +++ b/htdocs/intracommreport/card.php @@ -171,7 +171,7 @@ */ $title = $langs->trans("IntracommReportTitle"); -llxHeader("", $title); +llxHeader("", $title, '', '', 0, 0, '', '', '', 'mod-intracommreport page-card'); // Creation mode if ($action == 'create') { diff --git a/htdocs/intracommreport/list.php b/htdocs/intracommreport/list.php index aef3a5fbbeaf5..92c7e3b256c4d 100644 --- a/htdocs/intracommreport/list.php +++ b/htdocs/intracommreport/list.php @@ -317,7 +317,7 @@ // Output page // -------------------------------------------------------------------- -llxHeader('', $title, $helpurl, ''); +llxHeader('', $title, $helpurl, '', 0, 0, '', '', '', 'mod-intracommreport page-list'); // Displays product removal confirmation if (GETPOST('delreport')) { From 75115382cef2ede812e0ba4620347ac430cc4bbc Mon Sep 17 00:00:00 2001 From: atm-lena <52402938+atm-lena@users.noreply.github.com> Date: Sat, 10 Aug 2024 23:47:52 +0200 Subject: [PATCH 076/152] llxheader body css bookcal (#30569) Co-authored-by: atm-lena --- htdocs/bookcal/admin/availabilities_extrafields.php | 2 +- htdocs/bookcal/admin/calendar_extrafields.php | 2 +- htdocs/bookcal/admin/setup.php | 2 +- htdocs/bookcal/availabilities_agenda.php | 2 +- htdocs/bookcal/availabilities_card.php | 2 +- htdocs/bookcal/availabilities_contact.php | 2 +- htdocs/bookcal/availabilities_document.php | 2 +- htdocs/bookcal/availabilities_list.php | 2 +- htdocs/bookcal/availabilities_note.php | 2 +- htdocs/bookcal/bookcalindex.php | 2 +- htdocs/bookcal/booking_list.php | 2 +- htdocs/bookcal/calendar_agenda.php | 2 +- htdocs/bookcal/calendar_card.php | 2 +- htdocs/bookcal/calendar_contact.php | 2 +- htdocs/bookcal/calendar_document.php | 2 +- htdocs/bookcal/calendar_list.php | 2 +- htdocs/bookcal/calendar_note.php | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/bookcal/admin/availabilities_extrafields.php b/htdocs/bookcal/admin/availabilities_extrafields.php index 8241073f3fccc..10a9a4bcd37a2 100644 --- a/htdocs/bookcal/admin/availabilities_extrafields.php +++ b/htdocs/bookcal/admin/availabilities_extrafields.php @@ -67,7 +67,7 @@ $help_url = ''; $page_name = "BookCalSetup"; -llxHeader('', $langs->trans("BookCalSetup"), $help_url); +llxHeader('', $langs->trans("BookCalSetup"), $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_availabilities_extrafields'); $linkback = ''.$langs->trans("BackToModuleList").''; diff --git a/htdocs/bookcal/admin/calendar_extrafields.php b/htdocs/bookcal/admin/calendar_extrafields.php index 79eabea10c9d9..582997fe3d0c6 100644 --- a/htdocs/bookcal/admin/calendar_extrafields.php +++ b/htdocs/bookcal/admin/calendar_extrafields.php @@ -68,7 +68,7 @@ $help_url = ''; $page_name = "BookCalSetup"; -llxHeader('', $langs->trans("BookCalSetup"), $help_url); +llxHeader('', $langs->trans("BookCalSetup"), $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_calender_extrafields'); $linkback = ''.$langs->trans("BackToModuleList").''; diff --git a/htdocs/bookcal/admin/setup.php b/htdocs/bookcal/admin/setup.php index f67819497c386..421a72b13e310 100644 --- a/htdocs/bookcal/admin/setup.php +++ b/htdocs/bookcal/admin/setup.php @@ -163,7 +163,7 @@ $help_url = ''; $page_name = "BookCalSetup"; -llxHeader('', $langs->trans($page_name), $help_url); +llxHeader('', $langs->trans($page_name), $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-admin_setup'); // Subheader $linkback = ''.$langs->trans("BackToModuleList").''; diff --git a/htdocs/bookcal/availabilities_agenda.php b/htdocs/bookcal/availabilities_agenda.php index 082c2f936983d..4de8cdae28402 100644 --- a/htdocs/bookcal/availabilities_agenda.php +++ b/htdocs/bookcal/availabilities_agenda.php @@ -144,7 +144,7 @@ if ($object->id > 0) { $title = $langs->trans("Agenda"); $help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung'; - llxHeader('', $title, $help_url); + llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-card_availabilities_agenda'); if (!empty($conf->notification->enabled)) { $langs->load("mails"); diff --git a/htdocs/bookcal/availabilities_card.php b/htdocs/bookcal/availabilities_card.php index bcb42c44e1254..d3efc65056f75 100644 --- a/htdocs/bookcal/availabilities_card.php +++ b/htdocs/bookcal/availabilities_card.php @@ -223,7 +223,7 @@ $title = $langs->trans("Availabilities"); $help_url = ''; -llxHeader('', $title, $help_url); +llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-card_availabilities'); // Example : Adding jquery code // print '