From 5ddebcd95f7243befb89fdf17a447b0f0fca2814 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Mon, 4 Mar 2024 22:45:57 -0500 Subject: [PATCH] Add saving of facilitated hub data when reassigning hub. Fix display of dropdown for facilitated hubs. #792 --- .../JobOrderHandler/ResqJobOrderHandler.php | 22 +++++++++++++++++++ templates/job-order/form.html.twig | 16 ++++++++++---- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/Service/JobOrderHandler/ResqJobOrderHandler.php b/src/Service/JobOrderHandler/ResqJobOrderHandler.php index ed10c764..175a80ea 100644 --- a/src/Service/JobOrderHandler/ResqJobOrderHandler.php +++ b/src/Service/JobOrderHandler/ResqJobOrderHandler.php @@ -1604,6 +1604,26 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface $error_array['cust_location'] = 'Invalid customer location'; } + // check facilitated type + $fac_type = $req->request->get('facilitated_type'); + if (!empty($fac_type)) + { + if (!FacilitatedType::validate($fac_type)) + $fac_type = null; + } + else + $fac_type = null; + + // check facilitated by + $fac_by_id = $req->request->get('facilitated_by'); + $fac_by = null; + if (!empty($fac_by_id)) + { + $fac_by = $em->getRepository(Hub::class)->find($fac_by_id); + if (empty($fac_by)) + $fac_by = null; + } + // get previously assigned hub, if any $old_hub = $obj->getHub(); @@ -1664,6 +1684,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface ->setOwnershipType($owner_type) ->setCustomerLocation($cust_location) ->setInventoryCount($req->request->get('hub_inv_count', 0)) + ->setFacilitatedType($fac_type) + ->setFacilitatedBy($fac_by) ->clearRider(); if ($user != null) diff --git a/templates/job-order/form.html.twig b/templates/job-order/form.html.twig index d0d7e834..2c3e1a09 100644 --- a/templates/job-order/form.html.twig +++ b/templates/job-order/form.html.twig @@ -827,20 +827,28 @@
- +
- +