Add hub assignment for first time JO availing of car club promo. #609
This commit is contained in:
parent
6df384027e
commit
6f5c88dbdb
2 changed files with 43 additions and 1 deletions
|
|
@ -98,9 +98,12 @@ class ImportCarClubCustomerHubCommand extends Command
|
||||||
// get first customer that matches any of the numbers
|
// get first customer that matches any of the numbers
|
||||||
$customer = $this->findCustomerByNumbers($valid_contact_numbers);
|
$customer = $this->findCustomerByNumbers($valid_contact_numbers);
|
||||||
|
|
||||||
// if no customer found, log to output info
|
// if no customer found, create one
|
||||||
if ($customer == null)
|
if ($customer == null)
|
||||||
{
|
{
|
||||||
|
error_log('Creating customer...');
|
||||||
|
|
||||||
|
// TODO: create customer
|
||||||
// add info to output array
|
// add info to output array
|
||||||
return $this->setOutputInfo($fields, 'NOT ADDED', 'No customer found', '');
|
return $this->setOutputInfo($fields, 'NOT ADDED', 'No customer found', '');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
// call service to generate job order and invoice
|
||||||
$invoice_items = $req->request->get('invoice_items', []);
|
$invoice_items = $req->request->get('invoice_items', []);
|
||||||
$promo_id = $req->request->get('invoice_promo');
|
$promo_id = $req->request->get('invoice_promo');
|
||||||
|
|
@ -484,6 +507,22 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
$em->persist($event);
|
$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();
|
$em->flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue