diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index a079a1d0cc9..eb215259415 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -1854,12 +1854,6 @@ parameters: count: 2 path: ../../../htdocs/api/class/api_documents.class.php - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 1 - path: ../../../htdocs/api/class/api_documents.class.php - - message: '#^Variable \$disablevirusscan in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index b3c557845f8..1a334eff40c 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1193,7 +1193,7 @@ class BookKeeping extends CommonObject // Manage filter if (is_array($filter)) { // deprecated, use $filter = USF syntax - dol_syslog("You are using a deprecated use of fetchAll. filter parameter mus be an USF string now.", LOG_WARNING); + dol_syslog("You are using a deprecated use of fetchAll. filter parameter must be an USF string now.", LOG_WARNING); $sqlwhere = array(); if (count($filter) > 0) { foreach ($filter as $key => $value) { diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index fa3573ae087..663b9d04d3f 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013-2022 Open-DSI - * Copyright (C) 2013-2024 Alexandre Spangaro + * Copyright (C) 2013-2025 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2017-2025 Frédéric France @@ -673,7 +673,7 @@ if (!$error && $action == 'writebookkeeping' && $user->hasRight('accounting', 'b $accountingaccountpayment->fetch(0, getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'), true); $accountingaccountexpensereport = new AccountingAccount($db); - $accountingaccountexpensereport->fetch(0, $conf->global->ACCOUNTING_ACCOUNT_EXPENSEREPORT, true); + $accountingaccountexpensereport->fetch(0, getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT'), true); $accountingaccountsuspense = new AccountingAccount($db); $accountingaccountsuspense->fetch(0, getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE'), true); diff --git a/htdocs/core/class/commonincoterm.class.php b/htdocs/core/class/commonincoterm.class.php index 35aad528570..97e10e0724e 100644 --- a/htdocs/core/class/commonincoterm.class.php +++ b/htdocs/core/class/commonincoterm.class.php @@ -91,6 +91,8 @@ trait CommonIncoterm */ public function getIncotermsForPDF() { + global $langs; + $sql = "SELECT code FROM ".$this->db->prefix()."c_incoterms WHERE rowid = ".(int) $this->fk_incoterms; $resql = $this->db->query($sql); if ($resql) { @@ -98,7 +100,7 @@ trait CommonIncoterm if ($num > 0) { $res = $this->db->fetch_object($resql); if ($res) { - return 'Incoterm : '.$res->code.' - '.$this->location_incoterms; + return $langs->trans("IncotermLabel").': '.$res->code.' - '.$this->location_incoterms; } else { return $res; } diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 1d0110bc8ac..09017e310b3 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -332,7 +332,7 @@ class ConferenceOrBooth extends ActionComm // Manage filter if (is_array($filter)) { // deprecated, use $filter = USF syntax - dol_syslog("You are using a deprecated use of fetchAll. filter parameter mus be an USF string now.", LOG_WARNING); + dol_syslog("You are using a deprecated use of fetchAll. filter parameter must be an USF string now.", LOG_WARNING); $sqlwhere = array(); if (count($filter) > 0) { foreach ($filter as $key => $value) { diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 9b25b5cd546..c13ff500b44 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -476,7 +476,7 @@ class ConferenceOrBoothAttendee extends CommonObject // Manage filter if (is_array($filter)) { // deprecated, use $filter = USF syntax - dol_syslog("You are using a deprecated use of fetchAll. filter parameter mus be an USF string now.", LOG_WARNING); + dol_syslog("You are using a deprecated use of fetchAll. filter parameter must be an USF string now.", LOG_WARNING); $sqlwhere = array(); if (count($filter) > 0) { foreach ($filter as $key => $value) { diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index b393e095dad..f60be35d0b3 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -79,7 +79,7 @@ if (!$user->hasRight('takepos', 'run')) { top_htmlhead('', '', 1); -if ((string) $place != '') { +if ((string) $place != '' && !empty($_SESSION["takeposterminal"])) { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture"; $sql .= " WHERE ref = '(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'"; $sql .= " AND entity IN (".getEntity('invoice').")"; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index ff614aeeea6..518f2418bc6 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -590,21 +590,25 @@ class User extends CommonObject $sql .= " LEFT JOIN ".$this->db->prefix()."c_departements as d ON u.fk_state = d.rowid"; $sql .= " LEFT JOIN ".$this->db->prefix()."establishment as s ON u.fk_establishment = s.rowid"; - if ($entity < 0) { - if ((!isModEnabled('multicompany') || !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) && (!empty($user->entity))) { - $sql .= " WHERE u.entity IN (0, ".((int) $conf->entity).")"; - } else { - $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database - } + if ($id > 0) { + $sql .= " WHERE u.rowid = ".((int) $id); } else { - // The fetch was forced on an entity - if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) { - $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database + if ($entity < 0) { + if ((! isModEnabled('multicompany') || ! getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) && (! empty($user->entity))) { + $sql .= " WHERE u.entity IN (0, " . ((int) $conf->entity) . ")"; + } else { + $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database + } } else { - if ($entity != '' && $entity == 0) { // If $entity = 0 - $sql .= " WHERE u.entity = 0"; - } else { // if $entity is -1 or > 0 - $sql .= " WHERE u.entity IN (0, ".((int) ($entity > 0 ? $entity : $conf->entity)).")"; + // The fetch was forced on an entity + if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) { + $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database + } else { + if ($entity != '' && $entity == 0) { // If $entity = 0 + $sql .= " WHERE u.entity = 0"; + } else { // if $entity is -1 or > 0 + $sql .= " WHERE u.entity IN (0, " . ((int) ($entity > 0 ? $entity : $conf->entity)) . ")"; + } } } } @@ -622,9 +626,8 @@ class User extends CommonObject $sql .= ")"; } elseif ($fk_socpeople > 0) { $sql .= " AND u.fk_socpeople = ".((int) $fk_socpeople); - } else { - $sql .= " AND u.rowid = ".((int) $id); } + $sql .= " ORDER BY u.entity ASC"; // Avoid random result when there is 2 login in 2 different entities if ($sid) {