From 12d768772ff6a319e59bea74884f1e0873cb7e41 Mon Sep 17 00:00:00 2001 From: Grisha Pomadchin Date: Wed, 24 Jul 2013 17:32:39 +0400 Subject: [PATCH] api err statuses fix; --- .../classes/general/ICrmOrderActions.php | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/intaro.intarocrm/classes/general/ICrmOrderActions.php b/intaro.intarocrm/classes/general/ICrmOrderActions.php index 3c55302b..80746eab 100755 --- a/intaro.intarocrm/classes/general/ICrmOrderActions.php +++ b/intaro.intarocrm/classes/general/ICrmOrderActions.php @@ -84,15 +84,12 @@ class ICrmOrderActions $orders = $api->orderUpload($resOrders); // error pushing orders - if (($api->getStatusCode() != 200) || ($api->getStatusCode() != 460)) { + if ($api->getStatusCode() != 200) { //handle err self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError()); - return false; // in pack mode return errors - } - // if some orders not uploaded - if ($api->getStatusCode() == 460) { - self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError()); + if ($api->getStatusCode() != 460) // some orders were sent + return false; // in pack mode return errors } } } else { // package mode (by default runs after install) @@ -115,15 +112,12 @@ class ICrmOrderActions $orders = $api->orderUpload($resOrders); // error pushing orders - if (($api->getStatusCode() != 200) || ($api->getStatusCode() != 460)) { + if ($api->getStatusCode() != 200) { //handle err self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError()); - return false; // in pack mode return errors - } - - // if some orders not uploaded - if($api->getStatusCode() == 460) { - self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError()); + + if($api->getStatusCode() != 460) // some orders were sent + return false; // in pack mode return errors } COption::SetOptionString(self::$MODULE_ID, self::$CRM_ORDER_LAST_ID, $lastOrderId); @@ -136,15 +130,12 @@ class ICrmOrderActions $orders = $api->orderUpload($resOrders); // error pushing orders - if (($api->getStatusCode() != 200) || ($api->getStatusCode() != 460)) { + if ($api->getStatusCode() != 200) { //handle err self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError()); - return false; // in pack mode return errors - } - // if some orders not uploaded - if ($api->getStatusCode() == 460) { - self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError()); + if ($api->getStatusCode() != 460) // some orders were sent + return false; // in pack mode return errors } } }