1
0
mirror of synced 2024-11-22 21:36:10 +03:00

+multiship

This commit is contained in:
Grisha Pomadchin 2014-05-22 17:48:44 +04:00
parent 7f952813be
commit 3a738a5d00

View File

@ -15,6 +15,9 @@ class ICrmOrderActions
protected static $CRM_ORDER_PROPS = 'order_props'; protected static $CRM_ORDER_PROPS = 'order_props';
protected static $CRM_ORDER_FAILED_IDS = 'order_failed_ids'; protected static $CRM_ORDER_FAILED_IDS = 'order_failed_ids';
protected static $CRM_ORDER_HISTORY_DATE = 'order_history_date'; protected static $CRM_ORDER_HISTORY_DATE = 'order_history_date';
protected static $CRM_MULTISHIP_INTEGRATION_CODE = 'multiship';
protected static $MUTLISHIP_DELIVERY_TYPE = 'mlsp';
protected static $MULTISHIP_MODULE_VER = 'multiship.v2';
const CANCEL_PROPERTY_CODE = 'INTAROCRM_IS_CANCELED'; const CANCEL_PROPERTY_CODE = 'INTAROCRM_IS_CANCELED';
@ -950,6 +953,16 @@ class ICrmOrderActions
$resultDeliveryTypeId = $resultDeliveryTypeId . ':' . $deliveryServiceCode[1]; $resultDeliveryTypeId = $resultDeliveryTypeId . ':' . $deliveryServiceCode[1];
} }
if(isset($order['delivery']) && $order['delivery'] && isset($order['delivery']['integrationCode']) &&
$order['delivery']['integrationCode'] == self::$CRM_MULTISHIP_INTEGRATION_CODE &&
isset($order['delivery']['data']) && $order['delivery']['data']) {
if(CModule::IncludeModule(self::$MULTISHIP_MODULE_VER)) {
$data = json_decode($order['delivery']['data'], true);
if(isset($data['ms_id']) && $data['ms_id'])
$resultDeliveryTypeId = $resultDeliveryTypeId . ':' . $data['ms_id'];
}
}
// orderUpdate // orderUpdate
$arFields = self::clearArr(array( $arFields = self::clearArr(array(
'PRICE_DELIVERY' => $order['deliveryCost'], 'PRICE_DELIVERY' => $order['deliveryCost'],
@ -1263,6 +1276,14 @@ class ICrmOrderActions
'address' => $resOrderDeliveryAddress 'address' => $resOrderDeliveryAddress
); );
if($arParams['optionsDelivTypes'][$resultDeliveryTypeId] == self::$MUTLISHIP_DELIVERY_TYPE) {
if(CModule::IncludeModule(self::$MULTISHIP_MODULE_VER)) {
$multishipArr = DBOrdersMlsp::GetByOI($arFields['ID']);
$delivery['data'] = json_encode(array('ms_id' => $multishipArr['MULTISHIP_ID']));
$delivery['integrationCode'] = 'multiship';
}
}
$resOrder = array( $resOrder = array(
'number' => $arFields['ACCOUNT_NUMBER'], 'number' => $arFields['ACCOUNT_NUMBER'],
'phone' => $resOrder['phone'], 'phone' => $resOrder['phone'],