From dedfb58a2883ecb7489014ab3c89af0cb086176d Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Thu, 5 Dec 2024 01:48:39 -0500 Subject: [PATCH] Fix issue of sealant and coolant fee not displaying in open edit form. #811 --- src/Controller/JobOrderController.php | 6 +++++- src/Service/InvoiceManager.php | 8 ++++++++ templates/job-order/form.html.twig | 17 +++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/Controller/JobOrderController.php b/src/Controller/JobOrderController.php index 29ef66d5..c159e2ad 100644 --- a/src/Controller/JobOrderController.php +++ b/src/Controller/JobOrderController.php @@ -754,6 +754,8 @@ class JobOrderController extends Controller $promo_id = $req->request->get('promo'); $cvid = $req->request->get('cvid'); $service_charges = $req->request->get('service_charges', []); + $flag_coolant = $req->request->get('flag_coolant', false); + $flag_sealant = $req->request->get('flag_sealant', false); // coordinates // need to check if lng and lat are set @@ -784,7 +786,9 @@ class JobOrderController extends Controller ->setCustomerVehicle($cv) ->setIsTaxable() ->setSource(TransactionOrigin::CALL) - ->setPriceTier($price_tier); + ->setPriceTier($price_tier) + ->setHasCoolant($flag_coolant) + ->setHasSealant($flag_sealant); /* // if it's a jumpstart or troubleshoot only, we know what to charge already diff --git a/src/Service/InvoiceManager.php b/src/Service/InvoiceManager.php index da8770cc..a2901f52 100644 --- a/src/Service/InvoiceManager.php +++ b/src/Service/InvoiceManager.php @@ -69,6 +69,14 @@ class InvoiceManager implements InvoiceGeneratorInterface ->setCustomerVehicle($jo->getCustomerVehicle()) ->setPriceTier($price_tier); + if (($jo->getServiceType() == ServiceType::OVERHEAT_ASSISTANCE) && + ($jo->hasCoolant())) + $criteria->setHasCoolant(true); + + if (($jo->getServiceType() == ServiceType::TIRE_REPAIR) && + ($jo->hasSealant())) + $criteria->setHasSealant(true); + // 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 diff --git a/templates/job-order/form.html.twig b/templates/job-order/form.html.twig index 3b8a6a37..15b40716 100644 --- a/templates/job-order/form.html.twig +++ b/templates/job-order/form.html.twig @@ -1207,6 +1207,8 @@