From 822bc59c6c0ca22146499f01925f628f981950b9 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Sun, 18 Jun 2023 23:40:09 -0400 Subject: [PATCH] Set taxable for invoice criteria when app requests a job order. #744 --- src/Controller/APIController.php | 3 +++ src/Service/InvoiceManager.php | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index 05f50243..d7b2a8fd 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -2865,6 +2865,9 @@ class APIController extends Controller implements LoggedController $icrit = new InvoiceCriteria(); $icrit->setServiceType($stype); + // set taxable + $icrit->setIsTaxable(true); + // check promo $promo_id = $req->request->get('promo_id'); if (!empty($promo_id)) diff --git a/src/Service/InvoiceManager.php b/src/Service/InvoiceManager.php index 90b092c3..b2f87ad4 100644 --- a/src/Service/InvoiceManager.php +++ b/src/Service/InvoiceManager.php @@ -94,6 +94,8 @@ class InvoiceManager implements InvoiceGeneratorInterface ->setCustomerVehicle($jo->getCustomerVehicle()); // set if taxable + // NOTE: ideally, this should be a parameter when calling generateInvoiceCriteria. But that + // would mean adding it as a parameter to the call, impacting all calls $criteria->setIsTaxable(); $ierror = $this->validatePromo($criteria, $promo_id); @@ -152,11 +154,12 @@ class InvoiceManager implements InvoiceGeneratorInterface } // this is called by JobOrderController when JS script generateInvoice is called + // this is also called by the APIController from newRequestJobOrder // this is also called by generateInvoiceCriteria public function generateInvoice($criteria) { // no need to validate since generateDraftInvoice was called before this was called - // generate the invoice + // generate the invoice and from APIController, the fields were validated // check which rules to apply $rules = $this->check($criteria);