Refactor order and order item management: add cache invalidation, improve object change tracking, and enhance asArray conversion with caching and expiration support.

This commit is contained in:
Jepp9350
2025-06-26 08:55:58 +02:00
parent 0e90c80ee1
commit 5b88ef9dc3
5 changed files with 172 additions and 49 deletions
+3 -2
View File
@@ -41,7 +41,7 @@ class ordersRoute
// Log the incident
(new logs_o())->add('orders', 'global', 1, $user->id, 'LIST_ORDERS', 'Successfully listed orders');
// Create economic_module_orders object
$economic_module_orders = new economic_module_orders();
//$economic_module_orders = new economic_module_orders();
$orders = new orders_o();
if (!$restrict_only_own) {
$department_ids = $user->getGroup()->getDepartments();
@@ -216,7 +216,8 @@ class ordersRoute
if (isset($data['created_at'])) {
$order->created_at->set($data['created_at']);
}
// If the department ID is set, validate it
// Void any cached key for the order
$order->objectChanged();
// Log the incident
(new logs_o())->add('orders', $order->department_id->value(), 1, $user->id, 'EDIT_ORDER', 'Successfully updated an order (ID: ' . $data['id'] . ')');
// Return a success message