Add call to get ongoing job order count. #632
This commit is contained in:
parent
9c31a573c6
commit
a8eaad2a82
1 changed files with 28 additions and 2 deletions
|
|
@ -3556,8 +3556,6 @@ class APIController extends Controller implements LoggedController
|
||||||
|
|
||||||
$ongoing_jos = $this->getOngoingJobOrders($cust);
|
$ongoing_jos = $this->getOngoingJobOrders($cust);
|
||||||
|
|
||||||
error_log('ongoing jos ' . count($ongoing_jos));
|
|
||||||
|
|
||||||
// initialize data
|
// initialize data
|
||||||
$jo_data = [];
|
$jo_data = [];
|
||||||
foreach ($ongoing_jos as $jo)
|
foreach ($ongoing_jos as $jo)
|
||||||
|
|
@ -3574,6 +3572,34 @@ class APIController extends Controller implements LoggedController
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getOngoingJobOrderCount(Request $req)
|
||||||
|
{
|
||||||
|
$required_params = [];
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
$res = $this->checkParamsAndKey($req, $em, $required_params);
|
||||||
|
if ($res->isError())
|
||||||
|
return $res->getReturnResponse();
|
||||||
|
|
||||||
|
// get customer
|
||||||
|
$cust = $this->session->getCustomer();
|
||||||
|
if ($cust == null)
|
||||||
|
{
|
||||||
|
$res->setError(true)
|
||||||
|
->setErrorMessage('No customer information found');
|
||||||
|
return $res->getReturnResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
$ongoing_jos = $this->getOngoingJobOrders($cust);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'ongoing_job_order_count' => count($ongoing_jos),
|
||||||
|
];
|
||||||
|
|
||||||
|
$res->setData($data);
|
||||||
|
|
||||||
|
return $res->getReturnResponse();
|
||||||
|
}
|
||||||
|
|
||||||
protected function updateWarranty($res, $em, $rt, $trans, $req, $serial, $inv_filename = null, $wcard_filename = null,
|
protected function updateWarranty($res, $em, $rt, $trans, $req, $serial, $inv_filename = null, $wcard_filename = null,
|
||||||
$logger, $log_data, $user_id, $action, $source)
|
$logger, $log_data, $user_id, $action, $source)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue