1
0
mirror of synced 2024-11-25 23:06:08 +03:00

to v0.5.1

This commit is contained in:
Grisha Pomadchin 2013-11-28 15:08:07 +04:00
parent 531799b16a
commit 18906ce9ce
4 changed files with 42 additions and 9 deletions

View File

@ -258,8 +258,40 @@ class ICrmOrderActions
global $USER; global $USER;
if(!isset($USER) || !$USER) { // for agent; to add order User if(!isset($USER) || !$USER) { // for agent; to add order User
$USER = new CUser; $rsUser = CUser::GetByLogin('intarocrm');
$USER->Update(1, array());
if($arUser = $rsUser->Fetch()) {
$USER = new CUser;
$USER->Update($arUser['ID'], array());
} else {
$login = 'intarocrm';
$serverName = 0 < strlen(SITE_SERVER_NAME)? SITE_SERVER_NAME : 'server.com';
$email = $login . '@' . $server_name;
$userPassword = randString(10);
$user = new CUser;
$arFields = array(
"NAME" => $login,
"LAST_NAME" => $login,
"EMAIL" => $email,
"LOGIN" => $login,
"LID" => "ru",
"ACTIVE" => "Y",
"GROUP_ID" => array(2),
"PASSWORD" => $userPassword,
"CONFIRM_PASSWORD" => $userPassword
);
$id = $user->Add($arFields);
if (!$id) {
self::eventLog('ICrmOrderActions::orderHistory', 'USER', $user->LAST_ERROR);
return;
}
$USER = new CUser;
$USER->Update($id, array());
}
} }
if (!CModule::IncludeModule("iblock")) { if (!CModule::IncludeModule("iblock")) {
@ -553,7 +585,8 @@ class ICrmOrderActions
'PRODUCT_PROVIDER_CLASS' => $p['PRODUCT_PROVIDER_CLASS'], 'PRODUCT_PROVIDER_CLASS' => $p['PRODUCT_PROVIDER_CLASS'],
'DETAIL_PAGE_URL' => $p['DETAIL_PAGE_URL'], 'DETAIL_PAGE_URL' => $p['DETAIL_PAGE_URL'],
'CATALOG_XML_ID' => $p['CATALOG_XML_ID'], 'CATALOG_XML_ID' => $p['CATALOG_XML_ID'],
'PRODUCT_XML_ID' => $p['PRODUCT_XML_ID'] 'PRODUCT_XML_ID' => $p['PRODUCT_XML_ID'],
'CUSTOM_PRICE' => 'Y'
); );
if (isset($item['initialPrice']) && $item['initialPrice']) if (isset($item['initialPrice']) && $item['initialPrice'])
@ -573,7 +606,7 @@ class ICrmOrderActions
$arProduct['PRICE'] -= $arProduct['DISCOUNT_PRICE']; $arProduct['PRICE'] -= $arProduct['DISCOUNT_PRICE'];
if (isset($item['offer']['name']) && $item['offer']['name']) if (isset($item['offer']['name']) && $item['offer']['name'])
$arProduct['NAME'] = $item['offer']['name']; $arProduct['NAME'] = self::fromJSON($item['offer']['name']);
CSaleBasket::Add($arProduct); CSaleBasket::Add($arProduct);
continue; continue;
@ -600,7 +633,7 @@ class ICrmOrderActions
$arProduct['QUANTITY'] = $item['quantity']; $arProduct['QUANTITY'] = $item['quantity'];
if (isset($item['offer']['name']) && $item['offer']['name']) if (isset($item['offer']['name']) && $item['offer']['name'])
$arProduct['NAME'] = $item['offer']['name']; $arProduct['NAME'] = self::fromJSON($item['offer']['name']);
CSaleBasket::Update($p['ID'], $arProduct); CSaleBasket::Update($p['ID'], $arProduct);
CSaleBasket::DeleteAll($userId); CSaleBasket::DeleteAll($userId);

View File

@ -702,7 +702,7 @@ class intaro_intarocrm extends CModule {
COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT_STATUSES, serialize($paymentStatusesArr)); 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_PAYMENT, serialize($paymentArr));
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0); 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_DISCHARGE, 1);
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_FAILED_IDS, serialize(array())); 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')); COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_HISTORY_DATE, date('Y-m-d H:i:s'));

View File

@ -1,5 +1,5 @@
<? <?
$arModuleVersion = array( $arModuleVersion = array(
"VERSION" => "0.5.0", "VERSION" => "0.5.1",
"VERSION_DATE" => "2013-10-31 12:11:00", "VERSION_DATE" => "2013-11-27 13:03:00",
); );

View File

@ -503,7 +503,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
<select name="payment-status-<?php echo $bitrixPaymentStatus['ID']; ?>" class="typeselect"> <select name="payment-status-<?php echo $bitrixPaymentStatus['ID']; ?>" class="typeselect">
<option value=""></option> <option value=""></option>
<?php foreach($arResult['paymentGroupList'] as $orderStatusGroup): if(!empty($orderStatusGroup['statuses'])) : ?> <?php foreach($arResult['paymentGroupList'] as $orderStatusGroup): if(!empty($orderStatusGroup['statuses'])) : ?>
<optgroup label="<?php echo $orderStatusGroup['name']; ?>"> <optgroup label="<?php echo $APPLICATION->ConvertCharset($orderStatusGroup['name']); ?>">
<?php foreach($orderStatusGroup['statuses'] as $payment): ?> <?php foreach($orderStatusGroup['statuses'] as $payment): ?>
<?php if(isset($arResult['paymentList'][$payment])): ?> <?php if(isset($arResult['paymentList'][$payment])): ?>
<option value="<?php echo $arResult['paymentList'][$payment]['code']; ?>" <?php if ($optionsPayStatuses[$bitrixPaymentStatus['ID']] == $arResult['paymentList'][$payment]['code']) echo 'selected'; ?>> <option value="<?php echo $arResult['paymentList'][$payment]['code']; ?>" <?php if ($optionsPayStatuses[$bitrixPaymentStatus['ID']] == $arResult['paymentList'][$payment]['code']) echo 'selected'; ?>>