diff --git a/intaro.intarocrm/classes/general/ICrmOrderActions.php b/intaro.intarocrm/classes/general/ICrmOrderActions.php index 0c7245b1..3da2f92b 100755 --- a/intaro.intarocrm/classes/general/ICrmOrderActions.php +++ b/intaro.intarocrm/classes/general/ICrmOrderActions.php @@ -40,11 +40,11 @@ class ICrmOrderActions * Mass order uploading, without repeating; always returns true, but writes error log * @return boolean */ - public static function uploadOrders($steps = false, $pSize = 500) { + public static function uploadOrders($steps = false, $pSize = 50) { //COption::SetOptionString(self::$MODULE_ID, self::$CRM_ORDER_LAST_ID, 0); // -- for test - if (!CModule::IncludeModule('iblock')) { + if (!CModule::IncludeModule("iblock")) { //handle err self::eventLog('ICrmOrderActions::uploadOrders', 'iblock', 'module not found'); return true; @@ -163,7 +163,7 @@ class ICrmOrderActions return true; //all ok! } - + /** * * w+ event in bitrix log @@ -303,7 +303,8 @@ class ICrmOrderActions $items[] = array( 'price' => $p['PRICE'], 'purchasePrice' => $pr, - 'discount' => $p['DISCOUNT_VALUE'], + 'discount' => $p['DISCOUNT_PRICE'], + 'discountPercent' => $p['DISCOUNT_VALUE'], 'quantity' => $p['QUANTITY'], 'productId' => $p['PRODUCT_ID'], 'productName' => self::toJSON($p['NAME']) diff --git a/intaro.intarocrm/include.php b/intaro.intarocrm/include.php index 6623ad4b..0851bb33 100755 --- a/intaro.intarocrm/include.php +++ b/intaro.intarocrm/include.php @@ -2,8 +2,8 @@ CModule::AddAutoloadClasses( 'intaro.intarocrm', // module name array ( - 'IntaroCrm\RestApi' => 'classes/general/RestApi.php', - 'ICrmOrderActions' => 'classes/general/ICrmOrderActions.php', - 'ICrmOrderEvent' => 'classes/general/events/ICrmOrderEvent.php' + 'IntaroCrm\RestApi' => 'classes/general/RestApi.php', + 'ICrmOrderActions' => 'classes/general/ICrmOrderActions.php', + 'ICrmOrderEvent' => 'classes/general/events/ICrmOrderEvent.php' ) ); \ No newline at end of file diff --git a/intaro.intarocrm/install/index.php b/intaro.intarocrm/install/index.php index c09bfc81..4e5cc2a5 100755 --- a/intaro.intarocrm/install/index.php +++ b/intaro.intarocrm/install/index.php @@ -63,13 +63,41 @@ class intaro_intarocrm extends CModule $step = intval($_REQUEST['step']); if ($step <= 1) { + if(!CModule::IncludeModule("sale")) { + $arResult['errCode'] = 'ERR_SALE'; + } + + if(!CModule::IncludeModule("iblock")) { + $arResult['errCode'] = 'ERR_IBLOCK'; + } + + if(!CModule::IncludeModule("catalog")) { + $arResult['errCode'] = 'ERR_CATALOG'; + } + $APPLICATION->IncludeAdminFile( GetMessage('MODULE_INSTALL_TITLE'), $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step1.php' ); } else if ($step == 2) { if(!CModule::IncludeModule("sale")) { - //handler + $arResult['errCode'] = 'ERR_SALE'; + } + + if(!CModule::IncludeModule("iblock")) { + $arResult['errCode'] = 'ERR_IBLOCK'; + } + + if(!CModule::IncludeModule("catalog")) { + $arResult['errCode'] = 'ERR_CATALOG'; + } + + if(isset($arResult['errCode']) && $arResult['errCode']) { + $APPLICATION->IncludeAdminFile( + GetMessage('MODULE_INSTALL_TITLE'), + $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step1.php' + ); + return; } $api_host = htmlspecialchars(trim($_POST[$this->CRM_API_HOST_OPTION])); @@ -191,7 +219,7 @@ class intaro_intarocrm extends CModule $arResult['bitrixPaymentStatusesList'][] = array( 'ID' => 'Y', - 'NAME' => 'Отменен' + 'NAME' => GetMessage('CANCELED') ); $APPLICATION->IncludeAdminFile( @@ -219,7 +247,7 @@ class intaro_intarocrm extends CModule else $finish = (int) $_POST['finish']; - $percent = 100 - $countLeft * 100 / $countAll; + $percent = 100 - round(($countLeft * 100 / $countAll), 1); if(!$countLeft) $finish = 1; diff --git a/intaro.intarocrm/install/step1.php b/intaro.intarocrm/install/step1.php index e3e88e6f..f1aad63d 100755 --- a/intaro.intarocrm/install/step1.php +++ b/intaro.intarocrm/install/step1.php @@ -1,6 +1,9 @@ - + + if(isset($arResult['errCode']) && $arResult['errCode']) + echo CAdminMessage::ShowMessage(GetMessage($arResult['errCode'])); +?>