Flag job orders associated with job orders as emergency orders #799
This commit is contained in:
parent
beb1a63577
commit
7f1b35ad29
8 changed files with 45 additions and 3 deletions
|
|
@ -1057,6 +1057,9 @@ class APIController extends Controller implements LoggedController
|
|||
$hub_criteria = new HubCriteria();
|
||||
$hub_criteria->setPoint($jo->getCoordinates());
|
||||
|
||||
// set subscription flag
|
||||
$hub_criteria->setSubscription($jo->getSubscription() !== null);
|
||||
|
||||
// get distance limit for mobile from env
|
||||
$dotenv = new Dotenv();
|
||||
$dotenv->loadEnv(__DIR__.'/../../.env');
|
||||
|
|
@ -3002,6 +3005,9 @@ class APIController extends Controller implements LoggedController
|
|||
$hub_criteria = new HubCriteria();
|
||||
$hub_criteria->setPoint($jo->getCoordinates());
|
||||
|
||||
// set subscription flag
|
||||
$hub_criteria->setSubscription($jo->getSubscription() !== null);
|
||||
|
||||
// get distance limit for mobile from env
|
||||
// get value of hub_filter_enable from env
|
||||
$dotenv = new Dotenv();
|
||||
|
|
|
|||
|
|
@ -757,7 +757,8 @@ class JobOrderController extends ApiController
|
|||
->setJoOrigin($jo->getSource())
|
||||
->setCustomerClass($cust->getCustomerClassification())
|
||||
->setOrderDate($jo->getDateCreate())
|
||||
->setServiceType($jo->getServiceType());
|
||||
->setServiceType($jo->getServiceType())
|
||||
->setSubscription($jo->getSubscription() !== null);
|
||||
|
||||
// get distance limit for mobile from env
|
||||
// get value of hub_filter_enable from env
|
||||
|
|
@ -1201,6 +1202,9 @@ class JobOrderController extends ApiController
|
|||
$hub_criteria = new HubCriteria();
|
||||
$hub_criteria->setPoint($jo->getCoordinates());
|
||||
|
||||
// set subscription flag
|
||||
$hub_criteria->setSubscription($jo->getSubscription() !== null);
|
||||
|
||||
// get distance limit for mobile from env
|
||||
$limit_distance = $_ENV['CUST_DISTANCE_LIMIT'];
|
||||
|
||||
|
|
|
|||
|
|
@ -192,6 +192,9 @@ class JobOrderController extends ApiController
|
|||
$hub_criteria = new HubCriteria();
|
||||
$hub_criteria->setPoint($jo->getCoordinates());
|
||||
|
||||
// set subscription flag
|
||||
$hub_criteria->setSubscription($jo->getSubscription() !== null);
|
||||
|
||||
// get distance limit for mobile from env
|
||||
// get value of hub_filter_enable from env
|
||||
$dotenv = new Dotenv();
|
||||
|
|
|
|||
|
|
@ -23,8 +23,9 @@ class HubCriteria
|
|||
protected $customer_id; // customer id
|
||||
protected $customer_class; // customer class
|
||||
protected $order_date; // date JO was created
|
||||
protected $service_type; // service type of JO
|
||||
protected $jo_origin; // origin of JO
|
||||
protected $service_type; // service type of JO
|
||||
protected $jo_origin; // origin of JO
|
||||
protected $flag_subscription; // flag if subscription or not
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
|
@ -45,6 +46,7 @@ class HubCriteria
|
|||
$this->order_date = new DateTime();
|
||||
$this->service_type = null;
|
||||
$this->jo_origin = null;
|
||||
$this->flag_subscription = false;
|
||||
}
|
||||
|
||||
public function setPoint(Point $point)
|
||||
|
|
@ -235,5 +237,16 @@ class HubCriteria
|
|||
{
|
||||
return $this->jo_origin;
|
||||
}
|
||||
|
||||
public function setSubscription($flag_subscription = true)
|
||||
{
|
||||
$this->flag_subscription = $flag_subscription;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isSubscription()
|
||||
{
|
||||
return $this->flag_subscription;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class JoTypeHubFilter extends BaseHubFilter implements HubFilterInterface
|
|||
public function getRequestedParams() : array
|
||||
{
|
||||
return [
|
||||
'flag_subscription',
|
||||
'flag_emergency',
|
||||
'jo_type',
|
||||
];
|
||||
|
|
@ -21,6 +22,9 @@ class JoTypeHubFilter extends BaseHubFilter implements HubFilterInterface
|
|||
{
|
||||
if ($params['flag_emergency'])
|
||||
return $hubs;
|
||||
|
||||
if ($params['flag_subscription'])
|
||||
return $hubs;
|
||||
|
||||
if (empty($params['jo_type']))
|
||||
return $hubs;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class PaymentMethodHubFilter extends BaseHubFilter implements HubFilterInterface
|
|||
public function getRequestedParams() : array
|
||||
{
|
||||
return [
|
||||
'flag_subscription',
|
||||
'flag_emergency',
|
||||
'payment_method',
|
||||
];
|
||||
|
|
@ -22,6 +23,9 @@ class PaymentMethodHubFilter extends BaseHubFilter implements HubFilterInterface
|
|||
if ($params['flag_emergency'])
|
||||
return $hubs;
|
||||
|
||||
if ($params['flag_subscription'])
|
||||
return $hubs;
|
||||
|
||||
if (empty($params['payment_method']))
|
||||
return $hubs;
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ class HubSelector
|
|||
$jo_origin = $criteria->getJoOrigin();
|
||||
$customer_id = $criteria->getCustomerId();
|
||||
$customer_class = $criteria->getCustomerClass();
|
||||
$flag_subscription = $criteria->isSubscription();
|
||||
|
||||
// needed for JORejection records and SMS notifs
|
||||
$order_date = $criteria->getOrderDate();
|
||||
|
|
@ -95,6 +96,7 @@ class HubSelector
|
|||
'payment_method' => $payment_method,
|
||||
'flag_riders_check' => $flag_riders_check,
|
||||
'flag_round_robin' => $flag_round_robin,
|
||||
'flag_subscription' => $flag_subscription,
|
||||
];
|
||||
|
||||
// loop through all enabled filters
|
||||
|
|
|
|||
|
|
@ -2576,6 +2576,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$long = $obj->getCoordinates()->getLongitude();
|
||||
$lat = $obj->getCoordinates()->getLatitude();
|
||||
|
||||
// set subscription flag
|
||||
$hub_criteria->setSubscription($obj->getSubscription() !== null);
|
||||
|
||||
// set result limit and location and date_time
|
||||
$hub_criteria->setPoint($obj->getCoordinates())
|
||||
->setDateTime($obj->getDateSchedule())
|
||||
|
|
@ -2953,6 +2956,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$long = $obj->getCoordinates()->getLongitude();
|
||||
$lat = $obj->getCoordinates()->getLatitude();
|
||||
|
||||
// set subscription flag
|
||||
$hub_criteria->setSubscription($obj->getSubscription() !== null);
|
||||
|
||||
$hub_criteria->setPoint($obj->getCoordinates())
|
||||
->setDateTime($obj->getDateSchedule())
|
||||
->setLimitResults(50);
|
||||
|
|
|
|||
Loading…
Reference in a new issue