Move JO id and customer id to HubCriteria. #594
This commit is contained in:
parent
b39872e4e0
commit
2ce291a7fd
4 changed files with 43 additions and 5 deletions
|
|
@ -1046,8 +1046,10 @@ class APIController extends Controller implements LoggedController
|
|||
// get customer id. No JO id at this point
|
||||
$customer_id = $cust->getID();
|
||||
|
||||
$hub_criteria->setCustomerId($customer_id);
|
||||
|
||||
// find nearest hubs
|
||||
$nearest_hubs = $hub_select->find($hub_criteria, null, $customer_id);
|
||||
$nearest_hubs = $hub_select->find($hub_criteria);
|
||||
|
||||
if (!empty($nearest_hubs))
|
||||
{
|
||||
|
|
@ -2775,8 +2777,10 @@ class APIController extends Controller implements LoggedController
|
|||
// get customer id. No JO id at this point
|
||||
$customer_id = $cust->getID();
|
||||
|
||||
$hub_criteria->setCustomerId($customer_id);
|
||||
|
||||
// find nearest hubs
|
||||
$nearest_hubs = $hub_select->find($hub_criteria, null, $customer_id);
|
||||
$nearest_hubs = $hub_select->find($hub_criteria);
|
||||
|
||||
if (!empty($nearest_hubs))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ class HubCriteria
|
|||
protected $payment_method; // payment method of JO
|
||||
protected $flag_emergency; // flag if emergency or not
|
||||
protected $flag_round_robin; // flag if we use round robin or not
|
||||
protected $jo_id; // JO id. This is null if called from mobile API
|
||||
protected $customer_id; // customer id
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
|
@ -31,6 +33,8 @@ class HubCriteria
|
|||
$this->payment_method = '';
|
||||
$flag_emergency = false;
|
||||
$flag_round_robin = false;
|
||||
$jo_id = null;
|
||||
$customer_id = null;
|
||||
}
|
||||
|
||||
public function setPoint(Point $point)
|
||||
|
|
@ -145,5 +149,27 @@ class HubCriteria
|
|||
return $this->flag_round_robin;
|
||||
}
|
||||
|
||||
public function setJobOrderId($jo_id)
|
||||
{
|
||||
$this->jo_id = $jo_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getJobOrderId()
|
||||
{
|
||||
return $this->jo_id;
|
||||
}
|
||||
|
||||
public function setCustomerId($customer_id)
|
||||
{
|
||||
$this->customer_id = $customer_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustomerId()
|
||||
{
|
||||
return $this->customer_id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class HubSelector
|
|||
$this->rt = $rt;
|
||||
}
|
||||
|
||||
public function find(HubCriteria $criteria, $jo_id, $customer_id)
|
||||
public function find(HubCriteria $criteria)
|
||||
{
|
||||
$point = $criteria->getPoint();
|
||||
$limit_results = $criteria->getLimitResults();
|
||||
|
|
@ -51,6 +51,8 @@ class HubSelector
|
|||
$payment_method = $criteria->getPaymentMethod();
|
||||
$flag_emergency = $criteria->isEmergency();
|
||||
$flag_round_robin = $criteria->isRoundRobin();
|
||||
$jo_id = $criteria->getJobOrderId();
|
||||
$customer_id = $criteria->getCustomerId();
|
||||
|
||||
$results = [];
|
||||
|
||||
|
|
|
|||
|
|
@ -2000,7 +2000,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$jo_id = $obj->getID();
|
||||
$customer_id = $obj->getCustomer()->getID();
|
||||
|
||||
$hubs = $hub_selector->find($hub_criteria, $jo_id, $customer_id);
|
||||
$hub_criteria->setJobOrderId($jo_id)
|
||||
->setCustomerId($customer_id);
|
||||
|
||||
$hubs = $hub_selector->find($hub_criteria);
|
||||
|
||||
$params['hubs'] = [];
|
||||
|
||||
|
|
@ -2301,7 +2304,10 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
$jo_id = $obj->getID();
|
||||
$customer_id = $obj->getCustomer()->getID();
|
||||
|
||||
$hubs = $hub_selector->find($hub_criteria, $jo_id, $customer_id);
|
||||
$hub_criteria->setJobOrderId($jo_id)
|
||||
->setCustomerId($customer_id);
|
||||
|
||||
$hubs = $hub_selector->find($hub_criteria);
|
||||
|
||||
$params['status_cancelled'] = JOStatus::CANCELLED;
|
||||
$params['hubs'] = [];
|
||||
|
|
|
|||
Loading…
Reference in a new issue