Add getOrderItemObjects and getProduct methods, and enhance Slack notifications in invoicing routes
- Introduce `getOrderItemObjects` in `orders_o` to retrieve item objects for an order. - Add `getProduct` in `order_items_o` for product retrieval by item. - Enhance Slack notification logic in invoicing routes for better error reporting and fixed pricing summaries. - Temporarily comment out permission checks in certain invoicing endpoints for debugging purposes.
This commit is contained in:
@@ -339,4 +339,12 @@ class order_items_o extends db
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getProduct(): products_o
|
||||
{
|
||||
return (new products_o())->select((int)$this->product_id->value());
|
||||
}
|
||||
}
|
||||
@@ -1549,4 +1549,21 @@ class orders_o extends db
|
||||
$row = $result->fetch_assoc();
|
||||
return (int)$row['wash_count'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @retuns order_items_o[]
|
||||
*/
|
||||
public function getOrderItemObjects(): array
|
||||
{
|
||||
self::requireSelected();
|
||||
$order_items = $this->getOrderItems((int)$this->id);
|
||||
$order_item_objects = [];
|
||||
foreach ( $order_items as $item ) {
|
||||
$order_item = new order_items_o();
|
||||
$order_item->select((int)$item['id']);
|
||||
$order_item_objects[] = $order_item;
|
||||
}
|
||||
return $order_item_objects;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user