Add unit tests for self-serve invoice billing logic, refactor minute-based billing calculations, and improve error handling for billable minutes adjustments.

This commit is contained in:
Jeppe Bundgaard
2026-03-26 21:09:21 +01:00
parent b42a1a69a0
commit 0dc1581eb4
5 changed files with 192 additions and 18 deletions
+2 -1
View File
@@ -161,7 +161,7 @@ class order_items_o extends db
}
}
public function addItemToOrder(int $order_id, int $product_id, int $cashier_id, int $quantity, $related_item_id = null, $notes = null, $forcePrice = null): void
public function addItemToOrder(int $order_id, int $product_id, int $cashier_id, int $quantity, $related_item_id = null, $notes = null, $forcePrice = null): order_items_o
{
global $db, $response;
try {
@@ -199,6 +199,7 @@ class order_items_o extends db
}
// Invalidate the order cache
$order->objectChanged();
return (new order_items_o())->select($this->id);
} catch (Exception $e) {
$response->error($e->getMessage());