From 4a87b0a2655fb86a2b78b92c5310b814c9b5a0e3 Mon Sep 17 00:00:00 2001 From: minimexat Date: Mon, 13 Jul 2026 16:47:49 +0200 Subject: [PATCH 1/4] FIX: #37711 add stock movement batch index (#39124) * FIX: #37711 add stock movement batch index * Update ChangeLog --------- Co-authored-by: f-hoedl Co-authored-by: Laurent Destailleur --- htdocs/install/mysql/migration/23.0.0-24.0.0.sql | 1 + htdocs/install/mysql/tables/llx_stock_mouvement.key.sql | 2 ++ 2 files changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/23.0.0-24.0.0.sql b/htdocs/install/mysql/migration/23.0.0-24.0.0.sql index bde3df09f05..c432a6ff5e5 100644 --- a/htdocs/install/mysql/migration/23.0.0-24.0.0.sql +++ b/htdocs/install/mysql/migration/23.0.0-24.0.0.sql @@ -50,6 +50,7 @@ ALTER TABLE llx_categorie_project_task DROP FOREIGN KEY fk_categorie_project_tas -- VPGSQL8.2 DROP INDEX idx_categorie_project_fk_task; ALTER TABLE llx_categorie_project_task ADD INDEX idx_categorie_project_fk_task (fk_project_task); ALTER TABLE llx_categorie_project_task ADD CONSTRAINT fk_categorie_project_task_rowid FOREIGN KEY (fk_project_task) REFERENCES llx_projet_task (rowid); +ALTER TABLE llx_stock_mouvement ADD INDEX idx_stock_mouvement_batch_entrepot_type_datem (batch, fk_entrepot, type_mouvement, datem); -- V24 migration ALTER TABLE llx_expensereport_det ADD COLUMN tcheck_file integer DEFAULT NULL after fk_ecm_files; diff --git a/htdocs/install/mysql/tables/llx_stock_mouvement.key.sql b/htdocs/install/mysql/tables/llx_stock_mouvement.key.sql index e19d85642c0..d3a5e9e2879 100644 --- a/htdocs/install/mysql/tables/llx_stock_mouvement.key.sql +++ b/htdocs/install/mysql/tables/llx_stock_mouvement.key.sql @@ -21,3 +21,5 @@ ALTER TABLE llx_stock_mouvement ADD INDEX idx_stock_mouvement_fk_product (fk_product); ALTER TABLE llx_stock_mouvement ADD INDEX idx_stock_mouvement_fk_entrepot (fk_entrepot); + +ALTER TABLE llx_stock_mouvement ADD INDEX idx_stock_mouvement_batch_entrepot_type_datem (batch, fk_entrepot, type_mouvement, datem); From 68c0415512dbe7fd2ae997cb8b700207dfe8a83c Mon Sep 17 00:00:00 2001 From: Nathan <130627685+nathanpixodeo@users.noreply.github.com> Date: Mon, 13 Jul 2026 21:49:55 +0700 Subject: [PATCH 2/4] fix: delete takepos supplement lines with parent (#39094) Co-authored-by: Laurent Destailleur --- htdocs/takepos/invoice.php | 61 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 512a0a5a14d..539f78bddf3 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -126,6 +126,57 @@ function fail($message) die($message); } +/** + * Delete an invoice line and the TakePOS supplement lines attached to it. + * + * @param Facture $invoice Invoice object + * @param int $lineid Line id to delete + * @return int Return integer <0 if KO, >0 if OK + */ +function takeposDeleteLineWithChildren($invoice, $lineid) +{ + $lineid = (int) $lineid; + if ($lineid <= 0) { + return 0; + } + + $childrenbyparent = array(); + if (is_array($invoice->lines)) { + foreach ($invoice->lines as $line) { + $parentid = (int) $line->fk_parent_line; + if ($parentid > 0) { + $childrenbyparent[$parentid][] = (int) $line->id; + } + } + } + + $linestodelete = array(); + $stack = array($lineid); + while (!empty($stack)) { + $currentlineid = array_pop($stack); + if (in_array($currentlineid, $linestodelete, true)) { + continue; + } + + $linestodelete[] = $currentlineid; + if (!empty($childrenbyparent[$currentlineid])) { + foreach ($childrenbyparent[$currentlineid] as $childlineid) { + $stack[] = $childlineid; + } + } + } + + // Delete supplements before their parent line so no orphan line remains visible on receipts. + foreach (array_reverse($linestodelete) as $deletelineid) { + $result = $invoice->deleteLine($deletelineid); + if ($result < 0) { + return $result; + } + } + + return 1; +} + $number = (float) GETPOST('number', 'alpha'); @@ -1016,7 +1067,10 @@ if (empty($reshook)) { $db->begin(); if ($idline > 0 && $placeid > 0) { // If invoice exists and a line is selected. - $invoice->deleteLine($idline); + $result = takeposDeleteLineWithChildren($invoice, $idline); + if ($result < 0) { + dol_htmloutput_errors($invoice->error, $invoice->errors, 1); + } $invoice->fetch($placeid); } elseif ($placeid > 0) { // If invoice exists but no line selected (delete from another device or with no line selected), proceed to delete the last line. $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facturedet where fk_facture = ".((int) $placeid)." ORDER BY rowid DESC"; @@ -1024,7 +1078,10 @@ if (empty($reshook)) { $obj = $db->fetch_object($resql); if ($obj) { $deletelineid = $obj->rowid; - $invoice->deleteLine($deletelineid); + $result = takeposDeleteLineWithChildren($invoice, $deletelineid); + if ($result < 0) { + dol_htmloutput_errors($invoice->error, $invoice->errors, 1); + } } $invoice->fetch($placeid); } From b2bba40457c4eb0225ac20f1fdbd19c6424a62ea Mon Sep 17 00:00:00 2001 From: Nathan <130627685+nathanpixodeo@users.noreply.github.com> Date: Mon, 13 Jul 2026 22:22:25 +0700 Subject: [PATCH 3/4] fix: save member extrafields from subscriptions tab (#39095) Co-authored-by: Laurent Destailleur --- htdocs/adherents/subscription.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index c3003137e3e..be9a5148b19 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -123,6 +123,11 @@ if ($id > 0 || !empty($ref)) { // Define variables to determine what the current user can do on the members $permissiontoaddmember = $user->hasRight('adherent', 'creer'); +$permissiontoeditextra = $permissiontoaddmember; +if (GETPOST('attribute', 'aZ09') && isset($extrafields->attributes[$object->table_element]['perms'][GETPOST('attribute', 'aZ09')])) { + // For action 'update_extras', is there a specific permission set for the attribute to update + $permissiontoeditextra = dol_eval((string) $extrafields->attributes[$object->table_element]['perms'][GETPOST('attribute', 'aZ09')]); +} // Security check $result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0); @@ -138,6 +143,28 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } +if (empty($reshook) && $action == 'update_extras' && $permissiontoeditextra) { + $error = 0; + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty + $attribute_name = GETPOST('attribute', 'aZ09'); + + // Fill array 'array_options' with data from update form + $ret = $extrafields->setOptionalsFromPost(null, $object, $attribute_name); + if ($ret < 0) { + $error++; + } + if (!$error) { + $result = $object->updateExtraField($attribute_name, 'MEMBER_MODIFY'); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + } + if ($error) { + $action = 'edit_extras'; + } +} + // Create third party from a member if (empty($reshook) && $action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->hasRight('societe', 'creer')) { if ($result > 0) { From 7c43affbdb8ec321ee0b417a32ef2c8d3dd19736 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 14 Jul 2026 00:43:23 +0200 Subject: [PATCH 4/4] fix: Remove extra closing parenthesis in user note permission check (#39150) Removed an extra closing parenthesis in the user note permission check to fix a syntax error. Also added a new copyright line for 2026 and updated the parameters array formatting for consistency. --- htdocs/user/note.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/user/note.php b/htdocs/user/note.php index ca623862a77..6985fe3724b 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2024-2026 Frédéric France + * Copyright (C) 2026 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 @@ -62,7 +63,7 @@ if (($object->id != $user->id) && (!$user->hasRight("user", "user", "read"))) { if ($object->id == $user->id) { $permissionnote = $user->hasRight("user", "self", "write"); // Used by the include of actions_setnotes.inc.php } else { - $permissionnote = $user->hasRight("user", "user", "write")); // Used by the include of actions_setnotes.inc.php + $permissionnote = $user->hasRight("user", "user", "write"); // Used by the include of actions_setnotes.inc.php } // Security check @@ -81,7 +82,7 @@ $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); /* * Actions */ -$parameters = array('id'=>$socid); +$parameters = array('id' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');