1
0
mirror of synced 2024-11-29 08:46:09 +03:00

api changes fix

This commit is contained in:
Grisha Pomadchin 2013-10-31 10:49:20 +04:00
parent 45c180c40e
commit 7cdda7aa11
2 changed files with 19 additions and 17 deletions

View File

@ -311,20 +311,20 @@ class ICrmOrderActions
if(!isset($order['externalId']) && !$order['externalId']) { if(!isset($order['externalId']) && !$order['externalId']) {
// we dont need new orders without any customers // we dont need new orders without any customers (can check only for externalId)
if(!isset($order['customer']) && !$order['customer']) if(!isset($order['customer']['externalId']) && !$order['customer']['externalId'])
continue; continue;
// new order // new order
$newOrderFields = array( $newOrderFields = array(
'LID' => $defaultSiteId, //<----! 'LID' => $defaultSiteId,
'PERSON_TYPE_ID' => $optionsOrderTypes[$order['orderType']], // <------! 'PERSON_TYPE_ID' => $optionsOrderTypes[$order['orderType']],
'PAYED' => 'N', 'PAYED' => 'N',
'CANCELED' => 'N', 'CANCELED' => 'N',
'STATUS_ID' => 'N', 'STATUS_ID' => 'N',
'PRICE' => 0, 'PRICE' => 0,
'CURRENCY' => 'RUB', 'CURRENCY' => 'RUB',
'USER_ID' => $order['customer'], // <--------! 'USER_ID' => $order['customer']['externalId'],
'PAY_SYSTEM_ID' => 0, 'PAY_SYSTEM_ID' => 0,
'PRICE_DELIVERY' => 0, 'PRICE_DELIVERY' => 0,
'DELIVERY_ID' => 0, 'DELIVERY_ID' => 0,
@ -356,9 +356,11 @@ class ICrmOrderActions
if(!$arFields || empty($arFields)) if(!$arFields || empty($arFields))
continue; continue;
$userId = $arFields['USER_ID'];
if(isset($order['customer']) && $order['customer']) $userId = $order['customer'];
$LID = $arFields['LID']; $LID = $arFields['LID'];
$userId = $arFields['USER_ID'];
if(isset($order['customer']['externalId']) && $order['customer']['externalId'])
$userId = $order['customer']['externalId'];
$rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID'])); $rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID']));
@ -415,17 +417,17 @@ class ICrmOrderActions
switch ($ar['CODE']) { switch ($ar['CODE']) {
case $optionsOrderProps[$arFields['PERSON_TYPE_ID']]['fio']: case $optionsOrderProps[$arFields['PERSON_TYPE_ID']]['fio']:
if (isset($order['firstName'])) if (isset($order['firstName']))
$contactName['firstName'] = self::fromJSON($order['firstName']); $contactName['firstName'] = self::fromJSON($order['firstName']);
if (isset($order['lastName'])) if (isset($order['lastName']))
$contactName['lastName'] = self::fromJSON($order['lastName']); $contactName['lastName'] = self::fromJSON($order['lastName']);
if (isset($order['patronymic'])) if (isset($order['patronymic']))
$contactName['patronymic'] = self::fromJSON($order['patronymic']); $contactName['patronymic'] = self::fromJSON($order['patronymic']);
if (!isset($contactName) || empty($contactName)) if (!isset($contactName) || empty($contactName))
break; break;
CSaleOrderPropsValue::Update($ar['ID'], array('VALUE' => implode(" ", $contactName))); CSaleOrderPropsValue::Update($ar['ID'], array('VALUE' => implode(" ", $contactName)));
break; break;
case $optionsOrderProps[$arFields['PERSON_TYPE_ID']]['phone']: if (isset($order['phone'])) case $optionsOrderProps[$arFields['PERSON_TYPE_ID']]['phone']: if (isset($order['phone']))
CSaleOrderPropsValue::Update($ar['ID'], array('VALUE' => self::fromJSON($order['phone']))); CSaleOrderPropsValue::Update($ar['ID'], array('VALUE' => self::fromJSON($order['phone'])));

View File

@ -1,5 +1,5 @@
<? <?
$arModuleVersion = array( $arModuleVersion = array(
"VERSION" => "0.4.3", "VERSION" => "0.4.3",
"VERSION_DATE" => "2013-10-30 16:04:00", "VERSION_DATE" => "2013-10-31 10:47:00",
); );