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