1
0
mirror of synced 2025-01-31 07:11:42 +03:00

cancel status fix

This commit is contained in:
Grisha Pomadchin 2013-10-29 19:16:32 +04:00
parent 24ff76ee0d
commit 6603923d53
4 changed files with 34 additions and 35 deletions

View File

@ -676,7 +676,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');
@ -803,9 +803,9 @@ class ICrmOrderActions
$p['DISCOUNT_PRICE'] = null;
$items[] = array(
'initialPrice' => (double) $p['PRICE'] + (double) $p['DISCOUNT_PRICE'],
'initialPrice' => (double) $p['PRICE'] + (double) $p['DISCOUNT_PRICE'],
'purchasePrice' => $pr,
'discount' => $p['DISCOUNT_PRICE'],
'discount' => $p['DISCOUNT_PRICE'],
'discountPercent' => $p['DISCOUNT_VALUE'],
'quantity' => $p['QUANTITY'],
'productId' => $p['PRODUCT_ID'],
@ -814,7 +814,7 @@ class ICrmOrderActions
}
if($arFields['CANCELED'] == 'Y')
$arFields['STATUS_ID'] = $arFields['CANCELED'];
$arFields['STATUS_ID'] = $arFields['CANCELED'].$arFields['CANCELED'];
$createdAt = new \DateTime($arFields['DATE_INSERT']);
$createdAt = $createdAt->format('Y-m-d H:i:s');

View File

@ -122,6 +122,7 @@ class ICrmOrderEvent {
$arOrder = CSaleOrder::GetById($ID);
if (is_array($arFields) && !empty($arFields)) {
$arFieldsNew = array(
'USER_ID' => $arOrder['USER_ID'],
'ID' => $ID,
@ -185,7 +186,7 @@ class ICrmOrderEvent {
$order = array(
'externalId' => (int) $ID,
'status' => $optionsPayStatuses[$cancel],
'status' => $optionsPayStatuses[$cancel.$cancel],
'statusComment' => ICrmOrderActions::toJSON($reason)
);

View File

@ -2,8 +2,8 @@
/**
* Module Install/Uninstall script
* Module name: intaro.intarocrm
* Class name: intaro_intarocrm
* Module name: intaro.intarocrm
* Class name: intaro_intarocrm
*/
global $MESS;
IncludeModuleLangFile(__FILE__);
@ -34,7 +34,6 @@ class intaro_intarocrm extends CModule {
var $CRM_ORDER_PROPS = 'order_props';
var $CRM_ORDER_DISCHARGE = 'order_discharge';
var $CRM_ORDER_FAILED_IDS = 'order_failed_ids';
var $CRM_ORDER_HISTORY_DATE = 'order_history_date';
var $INSTALL_PATH;
function intaro_intarocrm() {
@ -278,7 +277,7 @@ class intaro_intarocrm extends CModule {
);
//form payment statuses ids arr
$paymentStatusesArr['Y'] = htmlspecialchars(trim($_POST['payment-status-Y']));
$paymentStatusesArr['YY'] = htmlspecialchars(trim($_POST['payment-status-YY']));
if ($arPaymentStatusesList = $dbPaymentStatusesList->Fetch()) {
do {
$arResult['bitrixPaymentStatusesList'][] = $arPaymentStatusesList;
@ -287,7 +286,7 @@ class intaro_intarocrm extends CModule {
}
$arResult['bitrixPaymentStatusesList'][] = array(
'ID' => 'Y',
'ID' => 'YY',
'NAME' => GetMessage('CANCELED')
);
@ -441,6 +440,7 @@ class intaro_intarocrm extends CModule {
// form correct url
$api_host = parse_url($api_host);
if($api_host['scheme'] != 'https') $api_host['scheme'] = 'https';
$api_host = $api_host['scheme'] . '://' . $api_host['host'];
if (!$api_host || !$api_key) {
@ -545,7 +545,7 @@ class intaro_intarocrm extends CModule {
}
$arResult['bitrixPaymentStatusesList'][] = array(
'ID' => 'Y',
'ID' => 'YY',
'NAME' => GetMessage('CANCELED')
);
@ -676,7 +676,7 @@ class intaro_intarocrm extends CModule {
);
//form payment statuses ids arr
$paymentStatusesArr['Y'] = htmlspecialchars(trim($_POST['payment-status-Y']));
$paymentStatusesArr['YY'] = htmlspecialchars(trim($_POST['payment-status-YY']));
if ($arPaymentStatusesList = $dbPaymentStatusesList->Fetch()) {
do {
@ -703,7 +703,6 @@ class intaro_intarocrm extends CModule {
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0);
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_DISCHARGE, 0);
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_FAILED_IDS, serialize(array()));
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_HISTORY_DATE, date('Y-m-d H:i:s'));
$APPLICATION->IncludeAdminFile(
GetMessage('MODULE_INSTALL_TITLE'),
@ -915,15 +914,15 @@ class intaro_intarocrm extends CModule {
}
$ar = $this->GetProfileSetupVars($iblocks, $propertiesProduct, $propertiesSKU, $filename);
$PROFILE_ID = CCatalogExport::Add(array(
"LAST_USE" => false,
"FILE_NAME" => $this->INTARO_CRM_EXPORT,
"NAME" => $profileName,
"LAST_USE" => false,
"FILE_NAME" => $this->INTARO_CRM_EXPORT,
"NAME" => $profileName,
"DEFAULT_PROFILE" => "N",
"IN_MENU" => "N",
"IN_AGENT" => "N",
"IN_CRON" => "N",
"NEED_EDIT" => "N",
"SETUP_VARS" => $ar
"IN_MENU" => "N",
"IN_AGENT" => "N",
"IN_CRON" => "N",
"NEED_EDIT" => "N",
"SETUP_VARS" => $ar
));
if (intval($PROFILE_ID) <= 0) {
$arResult['errCode'] = 'ERR_IBLOCK';
@ -936,7 +935,7 @@ class intaro_intarocrm extends CModule {
$dateAgent->add($intAgent);
CAgent::AddAgent(
"CCatalogExport::PreGenerateExport(" . $PROFILE_ID . ");", "catalog", "N", 86400, $dateAgent->format('d.m.Y H:i:s'), // date of first check
"Y", // агент активен
"Y", // àãåíò àêòèâåí
$dateAgent->format('d.m.Y H:i:s'), // date of first start
30
);
@ -1008,7 +1007,7 @@ class intaro_intarocrm extends CModule {
CAgent::AddAgent(
"ICrmOrderActions::uploadOrdersAgent();", $this->MODULE_ID, "N", 600, // interval - 10 mins
$dateAgent->format('d.m.Y H:i:s'), // date of first check
"Y", // агент активен
"Y", // àãåíò àêòèâåí
$dateAgent->format('d.m.Y H:i:s'), // date of first start
30
);
@ -1019,7 +1018,7 @@ class intaro_intarocrm extends CModule {
"N",
600, // interval - 10 mins
$dateAgent->format('d.m.Y H:i:s'), // date of first check
"Y", // агент активен
"Y", // àãåíò àêòèâåí
$dateAgent->format('d.m.Y H:i:s'), // date of first start
30
);
@ -1053,7 +1052,6 @@ class intaro_intarocrm extends CModule {
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_PROPS);
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_DISCHARGE);
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_FAILED_IDS);
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_HISTORY_DATE);
UnRegisterModuleDependences("sale", "OnSalePayOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSalePayOrder");
UnRegisterModuleDependences("sale", "OnSaleCancelOrder", $this->MODULE_ID, "ICrmOrderEvent", "onSaleCancelOrder");

View File

@ -116,7 +116,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
COption::SetOptionString($mid, 'api_key', $api_key);
}
}
//bitrix orderTypesList -- personTypes
$dbOrderTypesList = CSalePersonType::GetList(
array(
@ -140,7 +140,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$orderTypesList[] = $arOrderTypesList;
} while ($arOrderTypesList = $dbOrderTypesList->Fetch());
}
//bitrix deliveryTypesList
$dbDeliveryTypesList = CSaleDelivery::GetList(
array(
@ -162,7 +162,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$deliveryTypesArr[$arDeliveryTypesList['ID']] = htmlspecialchars(trim($_POST['delivery-type-' . $arDeliveryTypesList['ID']]));
} while ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch());
}
//bitrix paymentTypesList
$dbPaymentTypesList = CSalePaySystem::GetList(
array(
@ -195,7 +195,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
);
//form payment statuses ids arr
$paymentStatusesArr['Y'] = htmlspecialchars(trim($_POST['payment-status-Y']));
$paymentStatusesArr['YY'] = htmlspecialchars(trim($_POST['payment-status-YY']));
if ($arPaymentStatusesList = $dbPaymentStatusesList->Fetch()) {
do {
$paymentStatusesArr[$arPaymentStatusesList['ID']] = htmlspecialchars(trim($_POST['payment-status-' . $arPaymentStatusesList['ID']]));
@ -350,7 +350,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
} while ($arPaymentStatusesList = $dbPaymentStatusesList->Fetch());
}
$arResult['bitrixPaymentStatusesList'][] = array(
'ID' => 'Y',
'ID' => 'YY',
'NAME' => GetMessage('CANCELED')
);
@ -457,7 +457,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<?php foreach($arResult['bitrixDeliveryTypesList'] as $bitrixDeliveryType): ?>
<tr>
<td width="50%" class="adm-detail-content-cell-l" name="<?php echo $bitrixDeliveryType['ID']; ?>">
<?php echo $bitrixDeliveryType['NAME']; ?>
<?php echo $bitrixDeliveryType['NAME']; ?>
</td>
<td width="50%" class="adm-detail-content-cell-r">
<select name="delivery-type-<?php echo $bitrixDeliveryType['ID']; ?>" class="typeselect">
@ -544,9 +544,9 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<tr>
<td width="50%" class="adm-detail-content-cell-l" name="<?php echo $bitrixOrderType['ID']; ?>">
<?php echo $bitrixOrderType['NAME']; ?>
</td>
<td width="50%" class="adm-detail-content-cell-r">
<select name="order-type-<?php echo $bitrixOrderType['ID']; ?>" class="typeselect">
</td>
<td width="50%" class="adm-detail-content-cell-r">
<select name="order-type-<?php echo $bitrixOrderType['ID']; ?>" class="typeselect">
<option value=""></option>
<?php foreach($arResult['orderTypesList'] as $orderType): ?>
<option value="<?php echo $orderType['code']; ?>" <?php if ($optionsOrderTypes[$bitrixOrderType['ID']] == $orderType['code']) echo 'selected'; ?>>
@ -583,7 +583,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<?php endif; ?>
<tr <?php if ($countProps > 4) echo 'class="address-detail-' . $bitrixOrderType['ID'] . '"'; if(($countProps > 4) && (count($optionsOrderProps[$bitrixOrderType['ID']]) < 6)) echo 'style="display:none;"';?>>
<td width="50%" class="adm-detail-content-cell-l" name="<?php echo $orderProp['ID']; ?>">
<?php echo $orderProp['NAME']; ?>
<?php echo $orderProp['NAME']; ?>
</td>
<td width="50%" class="adm-detail-content-cell-r">
<select name="order-prop-<?php echo $orderProp['ID'] . '-' . $bitrixOrderType['ID']; ?>" class="typeselect">