From f1018091656a8cff119c622eda78bd9a8f988f0a Mon Sep 17 00:00:00 2001 From: Grisha Pomadchin Date: Tue, 6 Aug 2013 15:02:11 +0400 Subject: [PATCH] Revert to 7fdddd5ed --- .../classes/general/ICrmOrderActions.php | 47 ++------ intaro.intarocrm/install/index.php | 29 ++--- intaro.intarocrm/install/version.php | 4 +- intaro.intarocrm/install/version.php~ | 5 - intaro.intarocrm/lang/ru/options.php | 22 +--- intaro.intarocrm/options.php | 101 +----------------- 6 files changed, 22 insertions(+), 186 deletions(-) delete mode 100755 intaro.intarocrm/install/version.php~ diff --git a/intaro.intarocrm/classes/general/ICrmOrderActions.php b/intaro.intarocrm/classes/general/ICrmOrderActions.php index 4ed06d3f..bc45cfdc 100755 --- a/intaro.intarocrm/classes/general/ICrmOrderActions.php +++ b/intaro.intarocrm/classes/general/ICrmOrderActions.php @@ -11,7 +11,6 @@ class ICrmOrderActions protected static $CRM_PAYMENT_STATUSES = 'pay_statuses_arr'; protected static $CRM_PAYMENT = 'payment_arr'; //order payment Y/N protected static $CRM_ORDER_LAST_ID = 'order_last_id'; - protected static $CRM_ORDER_PROPS = 'order_props'; /** * Mass order uploading, without repeating; always returns true, but writes error log @@ -55,7 +54,6 @@ class ICrmOrderActions $optionsPayTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_TYPES, 0)); $optionsPayStatuses = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_STATUSES, 0)); // --statuses $optionsPayment = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT, 0)); - $optionsOrderProps = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_PROPS, 0)); $api = new IntaroCrm\RestApi($api_host, $api_key); @@ -64,8 +62,7 @@ class ICrmOrderActions 'optionsDelivTypes' => $optionsDelivTypes, 'optionsPayTypes' => $optionsPayTypes, 'optionsPayStatuses' => $optionsPayStatuses, - 'optionsPayment' => $optionsPayment, - 'optionsOrderProps' => $optionsOrderProps + 'optionsPayment' => $optionsPayment ); // pack mode enable / disable @@ -186,7 +183,7 @@ class ICrmOrderActions if(!$api || empty($arParams)) { // add cond to check $arParams return false; } - + if (empty($arFields)) { //handle err self::eventLog('ICrmOrderActions::orderCreate', 'empty($arFields)', 'incorrect order'); @@ -252,50 +249,24 @@ class ICrmOrderActions $rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID'])); while ($ar = $rsOrderProps->Fetch()) { switch ($ar['CODE']) { - case $arParams['optionsOrderProps']['index']: $resOrderDeliveryAddress['index'] = self::toJSON($ar['VALUE']); + case 'ZIP': $resOrderDeliveryAddress['index'] = self::toJSON($ar['VALUE']); break; - case 'CITY': if (!isset($resOrderDeliveryAddress['city']) && !$resOrderDeliveryAddress['city']) - $resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']); // we check both locations & city for export + case 'CITY': $resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']); break; - case $arParams['optionsOrderProps']['text']: $resOrderDeliveryAddress['text'] = self::toJSON($ar['VALUE']); + case 'ADDRESS': $resOrderDeliveryAddress['text'] = self::toJSON($ar['VALUE']); break; - case 'LOCATION': if (!isset($resOrderDeliveryAddress['city']) && !$resOrderDeliveryAddress['city']) { + case 'LOCATION': if(!isset($resOrderDeliveryAddress['city']) && !$resOrderDeliveryAddress['city']) { $resOrderDeliveryAddress['city'] = CSaleLocation::GetByID($ar['VALUE']); $resOrderDeliveryAddress['city'] = self::toJSON($resOrderDeliveryAddress['city']['CITY_NAME_LANG']); } break; - case $arParams['optionsOrderProps']['fio']: $resOrder['contactName'] = explode(" ", self::toJSON($ar['VALUE'])); + case 'FIO': $resOrder['contactName'] = explode(" ", self::toJSON($ar['VALUE'])); break; - case $arParams['optionsOrderProps']['phone']: $resOrder['phone'] = $ar['VALUE']; + case 'PHONE': $resOrder['phone'] = $ar['VALUE']; break; - case $arParams['optionsOrderProps']['email']: $resOrder['email'] = $ar['VALUE']; + case 'EMAIL': $resOrder['email'] = $ar['VALUE']; break; } - - if (count($arParams['optionsOrderProps'] > 5)) { - switch ($ar['CODE']) { - case $arParams['optionsOrderProps']['country']: $resOrderDeliveryAddress['country'] = self::toJSON($ar['VALUE']); - break; - case $arParams['optionsOrderProps']['region']: $resOrderDeliveryAddress['region'] = self::toJSON($ar['VALUE']); - break; - case $arParams['optionsOrderProps']['city']: $resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']); - break; - case $arParams['optionsOrderProps']['street']: $resOrderDeliveryAddress['street'] = self::toJSON($ar['VALUE']); - break; - case $arParams['optionsOrderProps']['building']: $resOrderDeliveryAddress['building'] = self::toJSON($ar['VALUE']); - break; - case $arParams['optionsOrderProps']['flat']: $resOrderDeliveryAddress['flat'] = self::toJSON($ar['VALUE']); - break; - case $arParams['optionsOrderProps']['inercomcode']: $resOrderDeliveryAddress['intercomcode'] = self::toJSON($ar['VALUE']); - break; - case $arParams['optionsOrderProps']['floor']: $resOrderDeliveryAddress['floor'] = self::toJSON($ar['VALUE']); - break; - case $arParams['optionsOrderProps']['block']: $resOrderDeliveryAddress['block'] = self::toJSON($ar['VALUE']); - break; - case $arParams['optionsOrderProps']['house']: $resOrderDeliveryAddress['house'] = self::toJSON($ar['VALUE']); - break; - } - } } $items = array(); diff --git a/intaro.intarocrm/install/index.php b/intaro.intarocrm/install/index.php index 07e1f9c8..d470f618 100755 --- a/intaro.intarocrm/install/index.php +++ b/intaro.intarocrm/install/index.php @@ -30,7 +30,6 @@ class intaro_intarocrm extends CModule var $CRM_PAYMENT_STATUSES = 'pay_statuses_arr'; var $CRM_PAYMENT = 'payment_arr'; //order payment Y/N var $CRM_ORDER_LAST_ID = 'order_last_id'; - var $CRM_ORDER_PROPS = 'order_props'; var $INSTALL_PATH; @@ -255,8 +254,14 @@ class intaro_intarocrm extends CModule $percent = 100 - round(($countLeft * 100 / $countAll), 1); - if(!$countLeft) + if(!$countLeft) { + $api_host = COption::GetOptionString($mid, $this->CRM_API_HOST_OPTION, 0); + $api_key = COption::GetOptionString($mid, $this->CRM_API_KEY_OPTION, 0); + $this->INTARO_CRM_API = new \IntaroCrm\RestApi($api_host, $api_key); + $this->INTARO_CRM_API->statisticUpdate(); $finish = 1; + } + $APPLICATION->RestartBuffer(); header('Content-Type: application/x-javascript; charset='.LANG_CHARSET); @@ -358,15 +363,6 @@ class intaro_intarocrm extends CModule $paymentArr = array(); $paymentArr['Y'] = htmlspecialchars(trim($_POST['payment-Y'])); $paymentArr['N'] = htmlspecialchars(trim($_POST['payment-N'])); - - // orderProps assoc arr - $orderPropsArr = array( - 'fio' => 'FIO', - 'index' => 'ZIP', - 'text' => 'ADDRESS', - 'phone' => 'PHONE', - 'email' => 'EMAIL' - ); COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_TYPES_ARR, serialize($orderTypesArr)); COption::SetOptionString($this->MODULE_ID, $this->CRM_DELIVERY_TYPES_ARR, serialize($deliveryTypesArr)); @@ -374,7 +370,6 @@ class intaro_intarocrm extends CModule COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT_STATUSES, serialize($paymentStatusesArr)); COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT, serialize($paymentArr)); COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0); - COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_PROPS, serialize($orderPropsArr)); $APPLICATION->IncludeAdminFile( GetMessage('MODULE_INSTALL_TITLE'), @@ -402,12 +397,6 @@ class intaro_intarocrm extends CModule ); $this->CopyFiles(); - - //statistic update - $api_host = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_HOST_OPTION, 0); - $api_key = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_KEY_OPTION, 0); - $this->INTARO_CRM_API = new \IntaroCrm\RestApi($api_host, $api_key); - $this->INTARO_CRM_API->statisticUpdate(); $APPLICATION->IncludeAdminFile( GetMessage('MODULE_INSTALL_TITLE'), @@ -419,7 +408,7 @@ class intaro_intarocrm extends CModule function DoUninstall() { global $APPLICATION; - CAgent::RemoveAgent("ICrmOrderActions::uploadOrdersAgent();", $this->MODULE_ID); + CAgent::RemoveAgent("ICrmOrderActions::uploadOrdersAgent();", $this->MODULE_ID); COption::RemoveOption($this->MODULE_ID, $this->CRM_API_HOST_OPTION); COption::RemoveOption($this->MODULE_ID, $this->CRM_API_KEY_OPTION); @@ -453,4 +442,4 @@ class intaro_intarocrm extends CModule unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/intarocrm_run.php'); unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/intarocrm_setup.php'); } -} +} \ No newline at end of file diff --git a/intaro.intarocrm/install/version.php b/intaro.intarocrm/install/version.php index 3d42ade4..14200c58 100755 --- a/intaro.intarocrm/install/version.php +++ b/intaro.intarocrm/install/version.php @@ -1,5 +1,5 @@ '0.3.7', - 'VERSION_DATE' => '2013-08-06 13:13:00', + 'VERSION' => '0.3.6', + 'VERSION_DATE' => '2013-07-29 12:29:00', ); diff --git a/intaro.intarocrm/install/version.php~ b/intaro.intarocrm/install/version.php~ deleted file mode 100755 index b0b13837..00000000 --- a/intaro.intarocrm/install/version.php~ +++ /dev/null @@ -1,5 +0,0 @@ - '0.4.6', - 'VERSION_DATE' => '2013-07-25 15:35:00', -); diff --git a/intaro.intarocrm/lang/ru/options.php b/intaro.intarocrm/lang/ru/options.php index 4237d5cf..473cf341 100755 --- a/intaro.intarocrm/lang/ru/options.php +++ b/intaro.intarocrm/lang/ru/options.php @@ -1,7 +1,6 @@ 4) - break; - $orderPropsArr[$orderProp['ID']] = htmlspecialchars(trim($_POST['order-prop-' . $orderProp['ID']])); - $propsCount++; - } - COption::SetOptionString($mid, $CRM_ORDER_TYPES_ARR, serialize($orderTypesArr)); COption::SetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, serialize($deliveryTypesArr)); COption::SetOptionString($mid, $CRM_PAYMENT_TYPES, serialize($paymentTypesArr)); COption::SetOptionString($mid, $CRM_PAYMENT_STATUSES, serialize($paymentStatusesArr)); COption::SetOptionString($mid, $CRM_PAYMENT, serialize($paymentArr)); - COption::SetOptionString($mid, $CRM_ORDER_PROPS, serialize($orderPropsArr)); $uri .= '&ok=Y'; LocalRedirect($uri); @@ -278,26 +237,19 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) { 'NAME' => GetMessage('CANCELED') ); - $dbProp = CSaleOrderProps::GetList(array(), array()); - //bitrix pyament Y/N $arResult['bitrixPaymentList'][0]['NAME'] = GetMessage('PAYMENT_Y'); $arResult['bitrixPaymentList'][0]['ID'] = 'Y'; $arResult['bitrixPaymentList'][1]['NAME'] = GetMessage('PAYMENT_N'); $arResult['bitrixPaymentList'][1]['ID'] = 'N'; - while ($arProp = $dbProp->GetNext()) { - $arResult['arProp'][] = $arProp; - } - //saved cat params $optionsOrderTypes = unserialize(COption::GetOptionString($mid, $CRM_ORDER_TYPES_ARR, 0)); $optionsDelivTypes = unserialize(COption::GetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, 0)); $optionsPayTypes = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT_TYPES, 0)); $optionsPayStatuses = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT_STATUSES, 0)); // --statuses $optionsPayment = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT, 0)); - $optionsOrderProps = unserialize(COption::GetOptionString($mid, $CRM_ORDER_PROPS, 0)); - + $aTabs = array( array( "DIV" => "edit1", @@ -311,29 +263,10 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) { "ICON" => '', "TITLE" => GetMessage('ICRM_OPTIONS_CATALOG_CAPTION') ), - array( - "DIV" => "edit3", - "TAB" => GetMessage('ICRM_OPTIONS_ORDER_PROPS_TAB'), - "ICON" => '', - "TITLE" => GetMessage('ICRM_OPTIONS_ORDER_PROPS_CAPTION') - ), ); $tabControl = new CAdminTabControl("tabControl", $aTabs); $tabControl->Begin(); ?> -AddHeadString(''); ?> - -
-BeginNextTab(); ?> - - - - - - - - - - > - 5) echo "checked"; ?>> - - - - - 4) echo 'class="address-detail"'; if(($countProps > 4) && (count($optionsOrderProps) < 6)) echo 'style="display:none;"';?>> - - - - - - - - BeginNextTab(); ?> Buttons(); ?>