Set default value for HubCriteria's date_time field. Set date_time to JO's date schedule when loading dispatch form. Include checking of hub's opening and closing hours when emergency. #611
This commit is contained in:
parent
31047deb4a
commit
ac7e26498b
3 changed files with 15 additions and 8 deletions
|
|
@ -27,7 +27,7 @@ class HubCriteria
|
||||||
$this->limit_results = 10;
|
$this->limit_results = 10;
|
||||||
$this->limit_distance = 500;
|
$this->limit_distance = 500;
|
||||||
$this->jo_type = '';
|
$this->jo_type = '';
|
||||||
$this->date_time = null;
|
$this->date_time = new DateTime();
|
||||||
$this->flag_inventory_check = false;
|
$this->flag_inventory_check = false;
|
||||||
$this->items = [];
|
$this->items = [];
|
||||||
$this->payment_method = '';
|
$this->payment_method = '';
|
||||||
|
|
|
||||||
|
|
@ -65,14 +65,14 @@ class HubSelector
|
||||||
|
|
||||||
error_log('closest hubs ' . json_encode($filtered_hubs));
|
error_log('closest hubs ' . json_encode($filtered_hubs));
|
||||||
|
|
||||||
|
// filter the first hub results for date and opening times
|
||||||
|
$hubs_date_time = $this->filterHubsByDateAndTime($filtered_hubs, $date_time, $jo_id, $customer_id);
|
||||||
|
$filtered_hubs = $hubs_date_time;
|
||||||
|
|
||||||
|
error_log('date_time hubs ' . json_encode($filtered_hubs));
|
||||||
|
|
||||||
if (!$flag_emergency)
|
if (!$flag_emergency)
|
||||||
{
|
{
|
||||||
// filter the first hub results for date and opening times
|
|
||||||
$hubs_date_time = $this->filterHubsByDateAndTime($filtered_hubs, $date_time, $jo_id, $customer_id);
|
|
||||||
$filtered_hubs = $hubs_date_time;
|
|
||||||
|
|
||||||
//error_log('date_time hubs ' . json_encode($filtered_hubs));
|
|
||||||
|
|
||||||
// filter jo types
|
// filter jo types
|
||||||
$hubs_jo_type = $this->filterHubsByJoType($filtered_hubs, $jo_type, $jo_id, $customer_id);
|
$hubs_jo_type = $this->filterHubsByJoType($filtered_hubs, $jo_type, $jo_id, $customer_id);
|
||||||
$filtered_hubs = $hubs_jo_type;
|
$filtered_hubs = $hubs_jo_type;
|
||||||
|
|
@ -167,6 +167,7 @@ class HubSelector
|
||||||
'db_distance' => $hub_data['db_distance'],
|
'db_distance' => $hub_data['db_distance'],
|
||||||
'distance' => $hub_data['distance'],
|
'distance' => $hub_data['distance'],
|
||||||
'duration' => $hub_data['duration'],
|
'duration' => $hub_data['duration'],
|
||||||
|
'jo_count' => 0,
|
||||||
];
|
];
|
||||||
else
|
else
|
||||||
$this->hub_filter_logger->logFilteredHub($hub, 'job_order_type', $jo_id, $customer_id);
|
$this->hub_filter_logger->logFilteredHub($hub, 'job_order_type', $jo_id, $customer_id);
|
||||||
|
|
@ -201,6 +202,7 @@ class HubSelector
|
||||||
'db_distance' => $hub_data['db_distance'],
|
'db_distance' => $hub_data['db_distance'],
|
||||||
'distance' => $hub_data['distance'],
|
'distance' => $hub_data['distance'],
|
||||||
'duration' => $hub_data['duration'],
|
'duration' => $hub_data['duration'],
|
||||||
|
'jo_count' => 0,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$flag_found_pmethod = true;
|
$flag_found_pmethod = true;
|
||||||
|
|
@ -248,6 +250,7 @@ class HubSelector
|
||||||
'db_distance' => $hub_data['db_distance'],
|
'db_distance' => $hub_data['db_distance'],
|
||||||
'distance' => $hub_data['distance'],
|
'distance' => $hub_data['distance'],
|
||||||
'duration' => $hub_data['duration'],
|
'duration' => $hub_data['duration'],
|
||||||
|
'jo_count' => 0,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -282,6 +285,7 @@ class HubSelector
|
||||||
'db_distance' => $hub_data['db_distance'],
|
'db_distance' => $hub_data['db_distance'],
|
||||||
'distance' => $hub_data['distance'],
|
'distance' => $hub_data['distance'],
|
||||||
'duration' => $hub_data['duration'],
|
'duration' => $hub_data['duration'],
|
||||||
|
'jo_count' => 0,
|
||||||
];
|
];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -309,6 +313,7 @@ class HubSelector
|
||||||
'db_distance' => $hub_data['db_distance'],
|
'db_distance' => $hub_data['db_distance'],
|
||||||
'distance' => $hub_data['distance'],
|
'distance' => $hub_data['distance'],
|
||||||
'duration' => $hub_data['duration'],
|
'duration' => $hub_data['duration'],
|
||||||
|
'jo_count' => 0,
|
||||||
];
|
];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2024,8 +2024,9 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$long = $obj->getCoordinates()->getLongitude();
|
$long = $obj->getCoordinates()->getLongitude();
|
||||||
$lat = $obj->getCoordinates()->getLatitude();
|
$lat = $obj->getCoordinates()->getLatitude();
|
||||||
|
|
||||||
// set result limit and location
|
// set result limit and location and date_time
|
||||||
$hub_criteria->setPoint($obj->getCoordinates())
|
$hub_criteria->setPoint($obj->getCoordinates())
|
||||||
|
->setDateTime($obj->getDateSchedule())
|
||||||
->setLimitResults(50);
|
->setLimitResults(50);
|
||||||
|
|
||||||
// check if hub filter is enabled. If not, use default values
|
// check if hub filter is enabled. If not, use default values
|
||||||
|
|
@ -2343,6 +2344,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
$lat = $obj->getCoordinates()->getLatitude();
|
$lat = $obj->getCoordinates()->getLatitude();
|
||||||
|
|
||||||
$hub_criteria->setPoint($obj->getCoordinates())
|
$hub_criteria->setPoint($obj->getCoordinates())
|
||||||
|
->setDateTime($obj->getDateSchedule())
|
||||||
->setLimitResults(50);
|
->setLimitResults(50);
|
||||||
|
|
||||||
if ($this->hub_geofence->isCovered($long, $lat))
|
if ($this->hub_geofence->isCovered($long, $lat))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue