1
0
Fork 0
mirror of synced 2025-04-20 01:21:01 +00:00

Update RetailCrmHistory_v5.php

This commit is contained in:
DmitreyZl 2020-09-01 10:29:11 +03:00 committed by GitHub
parent ecb845546d
commit 593e5c058b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -189,7 +189,20 @@ class RetailCrmHistory
$historyFilter['sinceId'] = $end['id'];
}
}
public static function orderParsLocationDelivery($adress)
{
$loc = $adress.replace('.', '');
$loc = $loc.replace(',', '');
$loc = $loc.replace('/', '');
$loc = $loc.split();
if (count($loc) == 1 && !empty($loc[0])) {
return RCrmActions::fromJSON(trim($loc[0]));
} elseif (count($loc) == 2 && !empty($loc[1])) {
return RCrmActions::fromJSON(trim($loc[1]));
} else{
return [];
}
}
public static function orderHistory()
{
global $USER;
@ -713,11 +726,9 @@ class RetailCrmHistory
$order['delivery']['address'][$key] = trim($order['delivery']['address'][$key]);
if(!empty($order['delivery']['address'][$key])){
$parameters = array();
$loc = explode('.', $order['delivery']['address'][$key]);
if (count($loc) == 1) {
$parameters['filter']['PHRASE'] = RCrmActions::fromJSON(trim($loc[0]));
} elseif (count($loc) == 2) {
$parameters['filter']['PHRASE'] = RCrmActions::fromJSON(trim($loc[1]));
$loc = self::orderParsLocationDelivery($order['delivery']['address'][$key]);
if (!empty($loc)) {
$parameters['filter']['PHRASE'] = $loc;
} else {
RCrmActions::eventLog(
'RetailCrmHistory::orderHistory',