Fix the response when no latest jo. #632

This commit is contained in:
Korina Cordero 2021-11-22 08:10:12 +00:00
parent 65c0ad1c56
commit 1030b1934e

View file

@ -3823,9 +3823,12 @@ class APIController extends Controller implements LoggedController
// get the latest job order for customer
$latest_jo = $em->getRepository(JobOrder::class)->findOneBy(['customer' => $cust], ['id' => 'DESC']);
$jo_data = [];
$jo_data = null;
if ($latest_jo != null)
{
// TODO: clean the response up to just return what is needed
$jo_data = $this->generateJobOrderData($req, $latest_jo, $rt);
}
$data = [
'latest_job_order' => $jo_data,