1
0
mirror of synced 2024-12-01 17:56:07 +03:00

fix custom order type funcs

This commit is contained in:
Grisha Pomadchin 2014-02-12 11:06:32 +04:00
parent 1df0d65827
commit 663431dc19

View File

@ -375,14 +375,32 @@ class ICrmOrderActions
// pushing existing orders // pushing existing orders
foreach ($orderHistory as $order) { foreach ($orderHistory as $order) {
if(!isset($order['externalId']) || !$order['externalId']) {
// custom orderType functunion // custom orderType functunion
if(function_exists('intarocrm_get_order_type') && function_exists('intarocrm_set_order_type')) { if(function_exists('intarocrm_set_order_type')) {
$orderType = intarocrm_set_order_type($order); $orderType = intarocrm_set_order_type($order);
if($orderType) if($orderType)
$optionsOrderTypes[$order['orderType']] = $orderType; $optionsOrderTypes[$order['orderType']] = $orderType;
} else {
$dbOrderTypesList = CSalePersonType::GetList(
array(
"SORT" => "ASC",
"NAME" => "ASC"
),
array(
"ACTIVE" => "Y",
),
false,
false,
array()
);
if(!isset($order['externalId']) || !$order['externalId']) { if ($arOrderTypesList = $dbOrderTypesList->Fetch())
$optionsOrderTypes[$order['orderType']] = $arOrderTypesList['ID'];
}
}
// we dont need new orders without any customers (can check only for externalId) // we dont need new orders without any customers (can check only for externalId)
if(!isset($order['customer']['externalId']) && !$order['customer']['externalId']) { if(!isset($order['customer']['externalId']) && !$order['customer']['externalId']) {
@ -472,10 +490,28 @@ class ICrmOrderActions
if(isset($order['externalId']) && $order['externalId']) { if(isset($order['externalId']) && $order['externalId']) {
// custom orderType functunion // custom orderType functunion
if(function_exists('intarocrm_get_order_type') && function_exists('intarocrm_set_order_type')) { if(function_exists('intarocrm_set_order_type')) {
$orderType = intarocrm_set_order_type($order); $orderType = intarocrm_set_order_type($order);
if($orderType) if($orderType)
$optionsOrderTypes[$order['orderType']] = $orderType; $optionsOrderTypes[$order['orderType']] = $orderType;
else {
$dbOrderTypesList = CSalePersonType::GetList(
array(
"SORT" => "ASC",
"NAME" => "ASC"
),
array(
"ACTIVE" => "Y",
),
false,
false,
array()
);
if ($arOrderTypesList = $dbOrderTypesList->Fetch())
$optionsOrderTypes[$order['orderType']] = $arOrderTypesList['ID'];
}
} }
$arFields = CSaleOrder::GetById($order['externalId']); $arFields = CSaleOrder::GetById($order['externalId']);
@ -1120,7 +1156,7 @@ class ICrmOrderActions
} }
// custom orderType functunion // custom orderType functunion
if(function_exists('intarocrm_get_order_type') && function_exists('intarocrm_set_order_type')) { if(function_exists('intarocrm_get_order_type')) {
$orderType = intarocrm_get_order_type($arFields); $orderType = intarocrm_get_order_type($arFields);
if($orderType) if($orderType)
$resOrder['orderType'] = $orderType; $resOrder['orderType'] = $orderType;