Resolve "Allow super admin to do rider assignment regardless of locking" #899

Merged
jankstudio merged 1 commit from 106-allow-super-admin-to-do-rider-assignment-regardless-of-locking into master 2018-04-26 20:21:40 +00:00

View file

@ -1024,6 +1024,14 @@ class JobOrderController extends BaseController
throw $this->createNotFoundException('The job order does not have an assigning status'); throw $this->createNotFoundException('The job order does not have an assigning status');
} }
// check if super user
$user = $this->getUser();
if ($user->isSuperAdmin())
{
// do nothing, just allow page to be accessed
}
else
{
// check if hub is assigned to current user // check if hub is assigned to current user
$user_hubs = $this->getUser()->getHubs(); $user_hubs = $this->getUser()->getHubs();
if (!in_array($obj->getHub()->getID(), $user_hubs)) if (!in_array($obj->getHub()->getID(), $user_hubs))
@ -1034,7 +1042,6 @@ class JobOrderController extends BaseController
// check if we are the assignor // check if we are the assignor
$assignor = $obj->getAssignedBy(); $assignor = $obj->getAssignedBy();
$user = $this->getUser();
if ($assignor != null && $assignor->getID() != $user->getID()) if ($assignor != null && $assignor->getID() != $user->getID())
{ {
@ -1045,6 +1052,7 @@ class JobOrderController extends BaseController
// make this user be the assignor // make this user be the assignor
$obj->setAssignedBy($user); $obj->setAssignedBy($user);
$em->flush(); $em->flush();
}
$em->getConnection()->commit(); $em->getConnection()->commit();
} }