From 24146d89c5c790fc6bf28225a460468b1e2fa525 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 1 Oct 2025 19:54:50 +0200 Subject: [PATCH 1/4] FIX #35568 (#35569) * FIX #35568 * FIX clear "thirdparty" object before or during the fetch --------- Co-authored-by: Laurent Destailleur --- htdocs/core/actions_massactions.inc.php | 3 ++- htdocs/fourn/class/fournisseur.commande.class.php | 3 +++ htdocs/fourn/class/fournisseur.facture.class.php | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 9c71e3414c8..cefe13171e1 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1146,6 +1146,7 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) { $objecttmp = new $objectclass($db); $nbok = 0; foreach ($toselect as $toselectid) { + $objecttmp->thirdparty = null; // Clear if another value was already set by fetch_thirdparty $result = $objecttmp->fetch($toselectid); if ($result > 0) { $outputlangs = $langs; @@ -1160,7 +1161,7 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) { if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && isset($objecttmp->default_lang)) { $newlang = $objecttmp->default_lang; // for thirdparty } - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && empty($objecttmp->thirdparty)) { //load lang from thirdparty + if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && empty($objecttmp->thirdparty)) { //load lang from thirdparty $objecttmp->fetch_thirdparty(); $newlang = $objecttmp->thirdparty->default_lang; // for proposal, order, invoice, ... } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 15bad54c10d..ee155e7ad3d 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -427,7 +427,10 @@ class CommandeFournisseur extends CommonOrder $this->ref = $obj->ref; $this->ref_supplier = $obj->ref_supplier; + $this->socid = $obj->fk_soc; + $this->thirdparty = null; // Clear if another value was already set by fetch_thirdparty + $this->fourn_id = $obj->fk_soc; $this->statut = $obj->fk_statut; $this->status = $obj->fk_statut; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index a64b1a8893d..5e4181e2559 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1006,6 +1006,7 @@ class FactureFournisseur extends CommonInvoice $this->extraparams = isset($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : array(); $this->socid = $obj->socid; + $this->thirdparty = null; // Clear if another value was already set by fetch_thirdparty $this->socnom = $obj->socnom; // Retrieve all extrafield From ffe07999cf98fafc197ee333a432d933ba145e72 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 2 Oct 2025 02:39:29 +0200 Subject: [PATCH 2/4] FIX: pgsql: error when calculating depreciations (#34213) * FIX: pgsql: error when calculating depreciations * FIX: asset deprectiation: optimize sql * FIX: travis --- htdocs/asset/class/asset.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 876600fe448..29616b60d48 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -928,12 +928,13 @@ class Asset extends CommonObject } // Delete old lines - $sql = "DELETE " . MAIN_DB_PREFIX . "asset_depreciation FROM " . MAIN_DB_PREFIX . "asset_depreciation"; - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab ON ab.doc_type = 'asset' AND ab.fk_docdet = " . MAIN_DB_PREFIX . "asset_depreciation.rowid"; - $sql .= " WHERE " . MAIN_DB_PREFIX . "asset_depreciation.fk_asset = " . (int) $this->id; - $sql .= " AND " . MAIN_DB_PREFIX . "asset_depreciation.depreciation_mode = '" . $this->db->escape($mode_key) . "'"; - $sql .= " AND ab.fk_docdet IS NULL"; - if ($last_depreciation_date !== "") $sql .= " AND " . MAIN_DB_PREFIX . "asset_depreciation.ref != ''"; + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "asset_depreciation"; + $sql .= " WHERE fk_asset = " . (int) $this->id; + $sql .= " AND depreciation_mode = '" . $this->db->escape($mode_key) . "'"; + $sql .= " AND NOT EXISTS (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset' AND fk_docdet = " . MAIN_DB_PREFIX . "asset_depreciation.rowid)"; + if ($last_depreciation_date !== "") { + $sql .= " AND ref != ''"; + } $resql = $this->db->query($sql); if (!$resql) { $this->errors[] = $langs->trans('AssetErrorClearDepreciationLines') . ': ' . $this->db->lasterror(); From 1525b9c85e13c43a5e767936efa17f31ef405515 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Thu, 2 Oct 2025 03:17:57 +0200 Subject: [PATCH 3/4] Rename label --- .github/workflows/pr-18.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 5898b157a2c..f13993e8a20 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -48,4 +48,4 @@ jobs: gh pr edit "${{env.url}}" --add-reviewer rycks gh pr edit "${{env.url}}" --add-reviewer lvessiller-opendsi #gh pr edit "${{env.url}}" --add-reviewer eldy - gh pr edit "${{env.url}}" --add-label "Assigned to v18 maintenance Team" + gh pr edit "${{env.url}}" --add-label "Issue for v18 maintenance Team" From b1d57a6bd1a1c5d86cfc6ca33ec0c13c1481cd53 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 2 Oct 2025 15:36:47 +0200 Subject: [PATCH 4/4] FIX sql syntax error (#35588) --- htdocs/core/class/html.formmail.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index c54bdab2949..ae25899b67b 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -627,7 +627,7 @@ class FormMail extends Form // Add also email aliases from the c_email_senderprofile table $sql = "SELECT rowid, label, email FROM ".$this->db->prefix()."c_email_senderprofile"; - $sql .= " WHERE active = 1 AND (private = 0 OR private = ".((int) $user->id).") AND entity in getEntity('c_email_senderprofile')"; + $sql .= " WHERE active = 1 AND (private = 0 OR private = ".((int) $user->id).") AND entity IN (".getEntity('c_email_senderprofile').")"; $sql .= " ORDER BY position"; $resql = $this->db->query($sql); if ($resql) {