Fix assign rider so cancelled job orders cannot be assigned #175
This commit is contained in:
parent
4b24454549
commit
1bd5c30875
2 changed files with 13 additions and 0 deletions
|
|
@ -1142,6 +1142,11 @@ class JobOrderController extends BaseController
|
||||||
if (empty($obj))
|
if (empty($obj))
|
||||||
throw $this->createNotFoundException('The item does not exist');
|
throw $this->createNotFoundException('The item does not exist');
|
||||||
|
|
||||||
|
// check if we can assign
|
||||||
|
if (!$obj->canAssign())
|
||||||
|
throw $this->createNotFoundException('Cannot assign rider to this job order.');
|
||||||
|
|
||||||
|
|
||||||
// check if lat and lng are provided
|
// check if lat and lng are provided
|
||||||
if (empty($req->request->get('coord_lng')) || empty($req->request->get('coord_lat'))) {
|
if (empty($req->request->get('coord_lng')) || empty($req->request->get('coord_lat'))) {
|
||||||
$error_array['coordinates'] = 'No map coordinates provided. Please click on a location on the map.';
|
$error_array['coordinates'] = 'No map coordinates provided. Please click on a location on the map.';
|
||||||
|
|
|
||||||
|
|
@ -734,4 +734,12 @@ class JobOrder
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function canAssign()
|
||||||
|
{
|
||||||
|
if ($this->status == JOStatus::ASSIGNED)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue