fixes due to status and site
This commit is contained in:
parent
8f2d6befbc
commit
63d03327f3
@ -282,8 +282,10 @@ class ICrmOrderActions
|
||||
|
||||
$defaultSiteId = 0;
|
||||
$rsSites = CSite::GetList($by, $sort, array('DEF' => 'Y'));
|
||||
while ($ar = $rsSites->Fetch())
|
||||
while ($ar = $rsSites->Fetch()) {
|
||||
$defaultSiteId = $ar['LID'];
|
||||
break;
|
||||
}
|
||||
|
||||
$api_host = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_HOST_OPTION, 0);
|
||||
$api_key = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_KEY_OPTION, 0);
|
||||
|
@ -158,7 +158,7 @@ class ICrmOrderEvent {
|
||||
* @return boolean
|
||||
*/
|
||||
function onSaleCancelOrder($ID, $cancel, $reason) {
|
||||
if(!$ID || !$cancel || ($cancel != 'Y'))
|
||||
if(!$ID || !$cancel)
|
||||
return true;
|
||||
|
||||
if (!CModule::IncludeModule('iblock')) {
|
||||
@ -186,12 +186,24 @@ class ICrmOrderEvent {
|
||||
$optionsPayStatuses = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_STATUSES, 0)); // --statuses
|
||||
|
||||
$api = new IntaroCrm\RestApi($api_host, $api_key);
|
||||
|
||||
$order = array(
|
||||
'externalId' => (int) $ID,
|
||||
'status' => $optionsPayStatuses[$cancel.$cancel],
|
||||
'statusComment' => ICrmOrderActions::toJSON($reason)
|
||||
);
|
||||
|
||||
$order = array();
|
||||
|
||||
if($cancel == 'Y') {
|
||||
$order = array(
|
||||
'externalId' => (int) $ID,
|
||||
'status' => $optionsPayStatuses[$cancel.$cancel],
|
||||
'statusComment' => ICrmOrderActions::toJSON($reason)
|
||||
);
|
||||
} else if($cancel == 'N') {
|
||||
$arOrder = CSaleOrder::GetById((int) $ID);
|
||||
|
||||
$order = array(
|
||||
'externalId' => (int) $ID,
|
||||
'status' => $optionsPayStatuses[$arOrder['STATUS_ID']],
|
||||
'managerComment' => $arOrder['COMMENTS']
|
||||
);
|
||||
}
|
||||
|
||||
$api->orderEdit($order);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user