Resolve "Car club final changes" #1534

Merged
korina.cordero merged 5 commits from 609-car-club-final-changes into master-fix 2021-08-09 06:59:31 +00:00
2 changed files with 43 additions and 1 deletions
Showing only changes of commit 6f5c88dbdb - Show all commits

View file

@ -98,9 +98,12 @@ class ImportCarClubCustomerHubCommand extends Command
// get first customer that matches any of the numbers
$customer = $this->findCustomerByNumbers($valid_contact_numbers);
// if no customer found, log to output info
// if no customer found, create one
if ($customer == null)
{
error_log('Creating customer...');
// TODO: create customer
// add info to output array
return $this->setOutputInfo($fields, 'NOT ADDED', 'No customer found', '');
}

View file

@ -446,6 +446,29 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
}
}
// check service type if new battery
// check if new JO
if (($stype == ServiceType::BATTERY_REPLACEMENT_NEW) &&
($flag_new_jo))
{
// check if customer has customer tag promo
if (($customer->getCustomerTag('TAG_CAR_CLUB_OFFICER_PROMO')) ||
($customer->getCustomerTag('TAG_CAR_CLUB_MEMBER_PROMO')))
{
// if has customer tag, customer has not availed of promo, get the hub where customer is pre-registered
$car_club_hub = $customer->getCarClubCustomerHub();
if ($car_club_hub != null)
{
// assign hub, change the jo status
$hub = $car_club_hub->getHub();
$jo->setHub($hub)
->setStatus(JOStatus::RIDER_ASSIGN);
}
}
}
// call service to generate job order and invoice
$invoice_items = $req->request->get('invoice_items', []);
$promo_id = $req->request->get('invoice_promo');
@ -484,6 +507,22 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
}
$em->persist($event);
// check if JOStatus is rider assign
if ($jo->getStatus() == JOStatus::RIDER_ASSIGN)
{
$rider_assign_event = new JOEvent();
$rider_assign_event->setDateHappen(new DateTime())
->setTypeID(JOEventType::HUB_ASSIGN)
->setJobOrder($jo);
if ($user != null)
{
$rider_assign_event->setUser($user);
}
$em->persist($rider_assign_event);
}
$em->flush();
}
}