Fix saving issue for JOEvent. #340

This commit is contained in:
Korina Cordero 2020-02-14 01:47:08 +00:00
parent d07adc606b
commit 034ae108e0

View file

@ -2539,6 +2539,19 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
// validated, no error. save the job order // validated, no error. save the job order
$em->persist($jo); $em->persist($jo);
// the event
$event = new JOEvent();
$event->setDateHappen(new DateTime())
->setTypeID(JOEventType::CREATE)
->setJobOrder($jo);
if ($user != null)
{
$event->setUser($user);
}
$em->persist($event);
// save to customer vehicle battery record // save to customer vehicle battery record
$this->updateVehicleBattery($jo); $this->updateVehicleBattery($jo);
@ -2547,7 +2560,6 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
$cust_vehicle->setWarrantyCode($req->request->get('warranty_code')); $cust_vehicle->setWarrantyCode($req->request->get('warranty_code'));
$em->persist($cust_vehicle); $em->persist($cust_vehicle);
$em->flush();
// create the warranty if new battery only // create the warranty if new battery only
if ($this->checkIfNewBattery($jo)) if ($this->checkIfNewBattery($jo))
@ -2589,18 +2601,6 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface
} }
} }
// the event
$event = new JOEvent();
$event->setDateHappen(new DateTime())
->setTypeID(JOEventType::CREATE)
->setJobOrder($jo);
if ($user != null)
{
$event->setUser($user);
}
$em->persist($event);
$em->flush(); $em->flush();
} }
} }