diff --git a/CHANGELOG.md b/CHANGELOG.md index bd46315b9e..b1b64f5f0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] + +### Fixed + +- Order detail price and discount updates are now restricted to items of the current order + ## [2.12.10] - 2026-09-11 ### Fixed diff --git a/front/order.form.php b/front/order.form.php index 9da80460ad..445c137e52 100644 --- a/front/order.form.php +++ b/front/order.form.php @@ -456,8 +456,17 @@ Html::back(); } elseif (isset($_POST["update_detail_item"])) { $pluginOrderOrder->check($_POST["plugin_order_orders_id"], UPDATE); + $orders_id = (int) $_POST["plugin_order_orders_id"]; + if (isset($_POST['detail_price_taxfree'])) { foreach ($_POST['detail_price_taxfree'] as $item_id => $price) { + if ( + !$pluginOrderOrder_Item->getFromDB($item_id) + || !$pluginOrderOrder_Item->belongsToOrder($orders_id) + ) { + continue; + } + $pluginOrderOrder_Item->updatePrice_taxfree([ 'item_id' => $item_id, 'price_taxfree' => $price, @@ -467,6 +476,13 @@ if (isset($_POST['detail_discount'])) { foreach ($_POST['detail_discount'] as $item_id => $discount) { + if ( + !$pluginOrderOrder_Item->getFromDB($item_id) + || !$pluginOrderOrder_Item->belongsToOrder($orders_id) + ) { + continue; + } + $pluginOrderOrder_Item->updateDiscount([ 'item_id' => $item_id, 'discount' => $discount,