Add support for invoicing period retrieval and enhanced filtering options for wash subscription transactions
This commit is contained in:
@@ -443,7 +443,7 @@ class orders_o extends db
|
||||
* Get the wash subscription transactions for a customer
|
||||
* @throws Exception If something goes wrong
|
||||
*/
|
||||
public function getWashSubscriptionTransactions(int $customer_number): array
|
||||
public function getWashSubscriptionTransactions(int $customer_number, bool $asArray = true, ?string $dateFrom = null, ?string $dateTo = null): array
|
||||
{
|
||||
return self::listObjectsWithPagination(
|
||||
1,
|
||||
@@ -453,12 +453,18 @@ class orders_o extends db
|
||||
'customer_id' => $customer_number,
|
||||
'deleted_at' => null,
|
||||
'cashier_id' => (new collected_order_invoices_o())->economic_wash_subscription_user_id,
|
||||
...(!empty($dateFrom) ? ['created_at-date_from' => $dateFrom] : []),
|
||||
...(!empty($dateTo) ? ['created_at-date_to' => $dateTo] : []),
|
||||
],
|
||||
[
|
||||
'id' => 'DESC',
|
||||
],
|
||||
function ($object) {
|
||||
return (new orders_o())->select($object['id'])->asArray();
|
||||
function ($object) use ($asArray) {
|
||||
$res = (new orders_o())->select($object['id']);
|
||||
if ($asArray) {
|
||||
return $res->asArray();
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user