diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index 88abdfa578e..49d373b1417 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -267,6 +267,18 @@ PHP JQUERYFILETREE: +PHP Mobile_DETECT: +------------------ +Remplacer: + +array $headers = null, + +par + +$headers = null, + + + PHP RESTLER: ------------ diff --git a/dev/translation/ignore_translation_keys.lst b/dev/translation/ignore_translation_keys.lst index f1f33bb9f1c..c90c79768cb 100644 --- a/dev/translation/ignore_translation_keys.lst +++ b/dev/translation/ignore_translation_keys.lst @@ -939,7 +939,6 @@ Don ECM EmptyMessageNotAllowedError ErrorInputRequired -ErrorLDAPFunctionsAreDisabledOnThisPHP ErrorUpdating Extra FailedToConnectToSFTPAfterSSHAuthentication @@ -1014,7 +1013,6 @@ TicketMessageMailSignatureText TicketSetupPage Timeline Transfer -TryAnotherConnectionMode UndefinedKey UnknownType UpdateMember diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index e62180d6e12..0670e703a4c 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -27,11 +27,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -39,6 +34,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; // Load translation files required by the page $langs->loadLangs(array('accountancy', 'admin', 'bills', 'compta', 'salaries')); @@ -467,7 +466,7 @@ if ($resql) { $obj = $db->fetch_object($resqlchart); if ($obj) { $labeltoshow = $obj->country_code.' - '.$obj->pcg_version.' - '.$obj->label; - $htmltoshow = picto_from_langcode($obj->country_code).' '.$obj->country_code.' - '.$obj->pcg_version.' - '.$obj->label; + $htmltoshow = picto_from_langcode($obj->country_code).' '.$obj->country_code.' - '.$obj->pcg_version.' - '.$obj->label.''; print ''; diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 49e773712bf..402308189dd 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -32,13 +32,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -47,6 +40,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; // Load translation files required by the page $langs->loadLangs(array("compta", "bills", "admin", "accountancy", "other")); @@ -660,7 +659,7 @@ print ''; print '

'; // Accountancy Numbering model -$dirmodels = array_merge(array('/'), $conf->modules_parts['models']); +$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); print '
'; print ''; diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 5ced2f9185b..1614dbb9528 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -565,7 +565,7 @@ if ($resql) { $moreforfilter = ''; if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) { $formcategory = new FormCategory($db); - $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, $searchCategoryProductList, 'minwidth300', $searchCategoryProductList ? $searchCategoryProductList : 0); + $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, $searchCategoryProductList, 'minwidth300', $searchCategoryProductList ? $searchCategoryProductOperator : 0); } // Show/hide child products. Hidden by default diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index dc65a7cf877..be49eefe6c0 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -889,12 +889,12 @@ class Lettering extends BookKeeping while ($obj = $this->db->fetch_object($resql)) { $current_document_ids[$obj->fk_doc] = $obj->fk_doc; - $link_key = $linked_info['prefix'] . $obj->fk_link; + $link_key = (string) $linked_info['prefix'] . (string) $obj->fk_link; $element_by_link[$link_key][$obj->fk_doc] = $obj->fk_doc; - $link_by_element[$obj->fk_doc][$link_key] = $link_key; + $link_by_element[(int) $obj->fk_doc][$link_key] = $link_key; if ($is_fk_link_is_also_fk_doc) { $element_by_link[$link_key][$obj->fk_link] = $obj->fk_link; - $link_by_element[$obj->fk_link][$link_key] = $link_key; + $link_by_element[(int) $obj->fk_link][$link_key] = $link_key; } } $this->db->free($resql); @@ -910,11 +910,11 @@ class Lettering extends BookKeeping /** * Get element ids grouped by link or element in common * - * @param array> $link_by_element List of payment ids by link key + * @param array> $link_by_element List of payment ids by link key * @param array> $element_by_link List of element ids by link key - * @param string $link_key Link key (used for recursive function) - * @param array $current_group Current group (used for recursive function) - * @return array> List of element ids grouped by link or element in common + * @param string $link_key Link key (used for recursive function) + * @param array $current_group Current group (used for recursive function) + * @return array> List of element ids grouped by link or element in common */ public function getGroupElements(&$link_by_element, &$element_by_link, $link_key = '', &$current_group = array()) { diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index c8be735f06e..d3fb55002da 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -35,10 +35,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -48,6 +44,9 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; * * @var array $_Avery_Labels */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; // Load translation files required by the page $langs->loadLangs(array("admin", "members")); @@ -302,7 +301,7 @@ $head = member_admin_prepare_head(); print dol_get_fiche_head($head, 'general', $langs->trans("Members"), -1, 'user'); -$dirModMember = array_merge(array('/core/modules/member/'), $conf->modules_parts['member']); +$dirModMember = array_merge(array('/core/modules/member/'), (array) $conf->modules_parts['member']); foreach ($conf->modules_parts['models'] as $mo) { //Add more models $dirModMember[] = $mo.'core/modules/member/'; diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 3bfe4918ea3..376f94033da 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -357,12 +357,12 @@ class FormAccounting extends Form /** * Return list of accounts with label by chart of accounts * - * @param string $selectid Preselected id of accounting accounts (depends on $select_in) + * @param int|string $selectid Preselected id of accounting accounts (depends on $select_in) * @param string $htmlname Name of HTML field id. If name start with '.', it is name of HTML css class, so several component with same name in different forms can be used. * @param int|string $showempty 1=Add an empty field, 2=Add an empty field+'None' field * @param array> $event Event options - * @param int $select_in 0=selectid value is a aa.rowid (default) or 1=selectid is aa.account_number - * @param int $select_out Set value returned by select. 0=rowid (default), 1=account_number + * @param int|string $select_in 0=selectid value is a aa.rowid (default) or 1=selectid is aa.account_number + * @param int|string $select_out Set value returned by select. 0=rowid (default), 1=account_number * @param string $morecss More css non HTML object * @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache. * @param '1'|'0'|'' $active Filter on status active or not: '0', '1' or '' for no filter @@ -378,13 +378,15 @@ class FormAccounting extends Form $selected = ''; $options = []; + $selectid = (string) $selectid; + if ($showempty == 2) { $options['0'] = '--- '.$langs->trans("None").' ---'; } if ($usecache && !empty($this->options_cache[$usecache])) { $options += $this->options_cache[$usecache]; - $selected = $selectid; + $selected = (string) $selectid; } else { $trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', 50); @@ -453,8 +455,8 @@ class FormAccounting extends Form $select_value_out = $obj->account_number; } - if ($selectid != '' && $selectid == $select_value_in) { - $selected = $select_value_out; + if ($selectid != '' && $selectid == (string) $select_value_in) { + $selected = (string) $select_value_out; } $options[$select_value_out] = array( diff --git a/htdocs/includes/mobiledetect/mobiledetectlib/Mobile_Detect.php b/htdocs/includes/mobiledetect/mobiledetectlib/Mobile_Detect.php index d76cb5a7902..ff47fbb0606 100644 --- a/htdocs/includes/mobiledetect/mobiledetectlib/Mobile_Detect.php +++ b/htdocs/includes/mobiledetect/mobiledetectlib/Mobile_Detect.php @@ -886,7 +886,7 @@ class Mobile_Detect * from the $headers array instead. */ public function __construct( - array $headers = null, + $headers = null, $userAgent = null ) { $this->setHttpHeaders($headers); diff --git a/htdocs/install/mysql/migration/22.0.0-23.0.0.sql b/htdocs/install/mysql/migration/22.0.0-23.0.0.sql index 2ead5f8a235..9662ef958a6 100644 --- a/htdocs/install/mysql/migration/22.0.0-23.0.0.sql +++ b/htdocs/install/mysql/migration/22.0.0-23.0.0.sql @@ -421,4 +421,8 @@ UPDATE llx_c_socialnetworks SET icon = 'fa-mastodon' WHERE icon = '' AND code = INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'PGK', '[75]', 1, 'Papua New Guinea Kina'); +INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 1, 'PCG25-DEV', 'The developed accountancy french plan 2025', 1); + +INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 4, 'PCG08-PYME-CAT', 'The PYME accountancy spanish plan in catalan language', 1); + -- end of migration diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 419aaa15447..e6b74e2d5bd 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -375,6 +375,7 @@ ErrorBlockLogNeedObject=The unalterbale log object needs object to be set ErrorBadParameterWhenCallingCreateOfBlockedLog=Bad parameter when calling create of blocked log ErrorMaxDecimalsShownTooLowComparedToUnitOrTotal=Value for 'Max. decimals for prices shown on screen' (%s) must be equal to or greater than both 'Max. decimals for unit prices' (%s) and 'Max. decimals for total prices' (%s). This is required to prevent rounding inconsistencies on documents. ErrorOnlyDraftStatusCanBeDeletedInMassAction=Only elements in draft status can be deleted in mass action +ErrorLDAPFunctionsAreDisabledOnThisPHP=LDAP functions are disabled on this PHP. # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 4fdd82681a2..e6d721aac8a 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -385,6 +385,7 @@ FillExtrafieldWithAi=Fill extrafield with AI content ExtrafieldFiller=Extrafield filler OurProductSelection=The product to discover NoSupportedModulesHaveBeenActivated=The reporting tool can generate dynamic reports for some modules only. There is no supported module enabled yet. +TryAnotherConnectionMode=Try another connection mode # Bookmarks BehaviourOnClick = Behavior when a bookmark URL is selected BookmarkTargetNewWindowShort = New tab diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index ef33afc0279..b5e35a82996 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -424,8 +424,9 @@ $sql .= ", s.status as status"; $sql .= ", GREATEST(sp.tms, spef.tms) as date_modification, sp.statut as cstatus"; $sql .= ", sp.rowid as cid, sp.canvas as ccanvas, sp.email as cemail, sp.firstname, sp.lastname"; $sql .= ", sp.address as caddress, sp.phone as cphone"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."socpeople as sp"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople_extrafields as spef ON spef.fk_object=sp.rowid"; +$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; +$sql .= " INNER JOIN ".MAIN_DB_PREFIX."socpeople as sp ON sp.fk_soc = s.rowid AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople_extrafields as spef ON spef.fk_object = sp.rowid"; if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); } @@ -433,8 +434,7 @@ if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } -$sql .= " WHERE s.entity IN (".getEntity('societe').") AND sp.fk_soc = s.rowid"; -$sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact +$sql .= " WHERE s.entity IN (".getEntity('societe').") "; if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 6be33910476..627ec4c9b75 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -469,15 +469,19 @@ class SecurityTest extends CommonClassTest $tmpvar = preg_match('/not supported/', $tmp['curl_error_msg']); $this->assertEquals(1, $tmpvar, "Did not find the /not supported/ in getURLContent error message. We should."); - $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page - $tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow - print __METHOD__." url=".$url."\n"; - $this->assertEquals(301, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Test getURLContent '.$url.' - Should GET url 301 response'); + $DISABLEREMOTEACCESSTODOLIBARRFR = 1; - $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page - $tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200 - print __METHOD__." url=".$url."\n"; - $this->assertEquals(200, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 with a follow -> 200 but we get '.(empty($tmp['http_code']) ? 0 : $tmp['http_code'])); + if (empty($DISABLEREMOTEACCESSTODOLIBARRFR)) { + $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page + $tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow + print __METHOD__." url=".$url."\n"; + $this->assertEquals(301, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Test getURLContent '.$url.' - Should GET url 301 response'); + + $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page + $tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200 + print __METHOD__." url=".$url."\n"; + $this->assertEquals(200, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 with a follow -> 200 but we get '.(empty($tmp['http_code']) ? 0 : $tmp['http_code'])); + } $url = 'http://localhost'; $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL