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

Merge branch 'master' into DmitreyZl-patct

This commit is contained in:
DmitreyZl 2020-09-01 11:03:21 +03:00
commit 46d116b3b1

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,16 +726,9 @@ class RetailCrmHistory
$order['delivery']['address'][$key] = trim($order['delivery']['address'][$key]);
if(!empty($order['delivery']['address'][$key])){
$parameters = array();
$locPoint = explode('.', $order['delivery']['address'][$key]);
$locComma = explode(',', $order['delivery']['address'][$key]);
if (count($locPoint) == 1) {
$parameters['filter']['PHRASE'] = RCrmActions::fromJSON(trim($locPoint[0]));
} elseif (count($locPoint) == 2) {
$parameters['filter']['PHRASE'] = RCrmActions::fromJSON(trim($locPoint[1]));
} elseif (count($locComma) == 1){
$parameters['filter']['PHRASE'] = RCrmActions::fromJSON(trim($locComma[0]));
} elseif (count($locComma) == 2){
$parameters['filter']['PHRASE'] = RCrmActions::fromJSON(trim($locComma[1]));
$loc = self::orderParsLocationDelivery($order['delivery']['address'][$key]);
if (!empty($loc)) {
$parameters['filter']['PHRASE'] = $loc;
} else {
RCrmActions::eventLog(
'RetailCrmHistory::orderHistory',