1
0
mirror of synced 2024-11-25 14:56:09 +03:00

rm option settings

This commit is contained in:
Grisha Pomadchin 2014-01-24 17:57:49 +04:00
parent 3f7cc6b963
commit 7fd2c09059
5 changed files with 6 additions and 129 deletions

View File

@ -261,16 +261,10 @@ class intaro_intarocrm extends CModule {
); );
//form delivery services ids arr //form delivery services ids arr
$deliveryServicesArr = array();
if ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()) { if ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()) {
do { do {
//auto delivery types //auto delivery types
$deliveryTypesArr[$arDeliveryServicesList['SID']] = htmlspecialchars(trim($_POST['delivery-type-' . $arDeliveryServicesList['SID']])); $deliveryTypesArr[$arDeliveryServicesList['SID']] = htmlspecialchars(trim($_POST['delivery-type-' . $arDeliveryServicesList['SID']]));
foreach($arDeliveryServicesList['PROFILES'] as $id => $profile) {
if(!$profile['TITLE']) continue; // services without name ?
$deliveryServicesArr[$arDeliveryServicesList['SID']][$id] = htmlspecialchars(trim($_POST['delivery-service-' . $arDeliveryServicesList['SID'] . '-' . $id]));
}
$arResult['bitrixDeliveryServicesList'][] = $arDeliveryServicesList;
} while ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()); } while ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch());
} }
@ -325,7 +319,6 @@ class intaro_intarocrm extends CModule {
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_TYPES_ARR, serialize($orderTypesArr)); COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_TYPES_ARR, serialize($orderTypesArr));
COption::SetOptionString($this->MODULE_ID, $this->CRM_DELIVERY_TYPES_ARR, serialize($deliveryTypesArr)); COption::SetOptionString($this->MODULE_ID, $this->CRM_DELIVERY_TYPES_ARR, serialize($deliveryTypesArr));
COption::SetOptionString($this->MODULE_ID, $this->CRM_DELIVERY_TYPES_ARR, serialize($deliveryServicesArr));
COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT_TYPES, serialize($paymentTypesArr)); COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT_TYPES, serialize($paymentTypesArr));
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));
@ -355,43 +348,6 @@ class intaro_intarocrm extends CModule {
$input['delivery-type-' . $bitrixDeliveryType['ID']] .= '</select>'; $input['delivery-type-' . $bitrixDeliveryType['ID']] .= '</select>';
} }
foreach ($arResult['bitrixDeliveryServicesList'] as $bitrixDeliveryService) {
foreach($bitrixDeliveryService['PROFILES'] as $id => $profile) {
if(!$profile['TITLE']) continue;
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id] =
'<select name="delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id . '" class="typeselect">';
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id] .= '<option value=""></option>';
foreach ($arResult['deliveryTypesList'] as $deliveryType) {
if(empty($deliveryType['deliveryServices'])) continue;
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id].=
'<optgroup label="' . $APPLICATION->ConvertCharset($deliveryType['name'], 'utf-8', SITE_CHARSET) . '">';
foreach ($deliveryType['deliveryServices'] as $ds) {
if(!isset($arResult['deliveryServicesList'][$ds])) continue;
if ($deliveryServicesArr[$bitrixDeliveryService['SID']][$id] == $arResult['deliveryServicesList'][$ds]['code']) {
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id] .=
'<option value="' . $arResult['deliveryServicesList'][$ds]['code'] . '" selected>';
} else {
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id] .=
'<option value="' . $arResult['deliveryServicesList'][$ds]['code'] . '">';
}
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id] .=
$APPLICATION->ConvertCharset($arResult['deliveryServicesList'][$ds]['name'], 'utf-8', SITE_CHARSET);
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id] .= '</option>';
}
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id] .= '</optgroup>';
}
$input['delivery-service-' . $bitrixDeliveryService['SID'] . '-' . $id] .= '</select>';
}
}
foreach ($arResult['bitrixPaymentTypesList'] as $bitrixPaymentType) { foreach ($arResult['bitrixPaymentTypesList'] as $bitrixPaymentType) {
$input['payment-type-' . $bitrixPaymentType['ID']] = $input['payment-type-' . $bitrixPaymentType['ID']] =
'<select name="payment-type-' . $bitrixPaymentType['ID'] . '" class="typeselect">'; '<select name="payment-type-' . $bitrixPaymentType['ID'] . '" class="typeselect">';
@ -490,6 +446,8 @@ class intaro_intarocrm extends CModule {
$input['order-type-' . $bitrixOrderType['ID']] .= '</select>'; $input['order-type-' . $bitrixOrderType['ID']] .= '</select>';
} }
$APPLICATION->RestartBuffer(); $APPLICATION->RestartBuffer();
header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET); header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
die(json_encode(array("success" => true, "result" => $input))); die(json_encode(array("success" => true, "result" => $input)));
@ -593,7 +551,6 @@ class intaro_intarocrm extends CModule {
if ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()) { if ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()) {
do { do {
$arResult['bitrixDeliveryTypesList'][] = array('ID' => $arDeliveryServicesList['SID'], 'NAME' => $arDeliveryServicesList['NAME']); $arResult['bitrixDeliveryTypesList'][] = array('ID' => $arDeliveryServicesList['SID'], 'NAME' => $arDeliveryServicesList['NAME']);
$arResult['bitrixDeliveryServicesList'][] = $arDeliveryServicesList;
} while ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()); } while ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch());
} }
@ -699,7 +656,6 @@ class intaro_intarocrm extends CModule {
//form delivery types / services ids arr //form delivery types / services ids arr
$deliveryTypesArr = array(); $deliveryTypesArr = array();
$deliveryServicesArr = array();
if (htmlspecialchars(trim($_POST['delivery-types-export'])) == 'false') { if (htmlspecialchars(trim($_POST['delivery-types-export'])) == 'false') {
if ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch()) { if ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch()) {
@ -712,11 +668,6 @@ class intaro_intarocrm extends CModule {
do { do {
//auto delivery types //auto delivery types
$deliveryTypesArr[$arDeliveryServicesList['SID']] = htmlspecialchars(trim($_POST['delivery-type-' . $arDeliveryServicesList['SID']])); $deliveryTypesArr[$arDeliveryServicesList['SID']] = htmlspecialchars(trim($_POST['delivery-type-' . $arDeliveryServicesList['SID']]));
foreach($arDeliveryServicesList['PROFILES'] as $id => $profile) {
if(!$profile['TITLE']) continue; // services without name ?
$deliveryServicesArr[$arDeliveryServicesList['SID']][$id] = htmlspecialchars(trim($_POST['delivery-service-' . $arDeliveryServicesList['SID'] . '-' . $id]));
}
$arResult['bitrixDeliveryServicesList'][] = $arDeliveryServicesList;
} while ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()); } while ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch());
} }
} elseif (htmlspecialchars(trim($_POST['delivery-types-export'])) == 'true') { } elseif (htmlspecialchars(trim($_POST['delivery-types-export'])) == 'true') {
@ -778,11 +729,10 @@ class intaro_intarocrm extends CModule {
} }
foreach($arDeliveryServicesList['PROFILES'] as $id => $profile) { foreach($arDeliveryServicesList['PROFILES'] as $id => $profile) {
$deliveryServicesArr[$arDeliveryServicesList['SID']][$id] = $id;
// send to crm // send to crm
$this->INTARO_CRM_API->deliveryServiceEdit(ICrmOrderActions::clearArr(array( $this->INTARO_CRM_API->deliveryServiceEdit(ICrmOrderActions::clearArr(array(
'code' => $id, 'code' => $arDeliveryServicesList['SID'] . '-' . $id,
'name' => ICrmOrderActions::toJSON($profile['TITLE']), 'name' => ICrmOrderActions::toJSON($profile['TITLE']),
'deliveryType' => $arDeliveryServicesList['SID'] 'deliveryType' => $arDeliveryServicesList['SID']
))); )));

View File

@ -94,15 +94,10 @@ $defaultPayment = array(
}); });
$('input[name="delivery-types-export"]').click(function() { $('input[name="delivery-types-export"]').click(function() {
if($(this).val() === 'true') { if($(this).val() === 'true')
$('tr.delivery-types').hide('slow'); $('tr.delivery-types').hide('slow');
$('tr[name="delivery-services"]').hide('slow'); else if($(this).val() === 'false')
$('tr.delivery-services').hide('slow');
} else if($(this).val() === 'false') {
$('tr.delivery-types').show('slow'); $('tr.delivery-types').show('slow');
$('tr[name="delivery-services"]').show('slow');
$('tr.delivery-services').show('slow');
}
}); });
}); });
</script> </script>
@ -161,34 +156,6 @@ $defaultPayment = array(
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<tr name="delivery-services" class="heading" style="display: none;">
<td colspan="2"><b><?php echo GetMessage('DELIVERY_SERVICES_LIST'); ?></b></td>
</tr>
<?php foreach($arResult['bitrixDeliveryServicesList'] as $bitrixDeliveryService): ?>
<?php foreach($bitrixDeliveryService['PROFILES'] as $id => $profile): if(!$profile['TITLE']) continue; ?>
<tr class="delivery-services" style="display: none;">
<td width="50%" class="adm-detail-content-cell-l" name="<?php echo $bitrixDeliveryService['SID'] . '-' . $id; ?>">
<?php echo '<b>[' . $bitrixDeliveryService['NAME'] . ']</b>: ' . $profile['TITLE']; ?>
</td>
<td width="50%" class="adm-detail-content-cell-r">
<select name="delivery-service-<?php echo $bitrixDeliveryService['SID'] . '-' . $id; ?>" class="typeselect">
<option value=""></option>
<?php foreach($arResult['deliveryTypesList'] as $deliveryType): if(!empty($deliveryType['deliveryServices'])) : ?>
<optgroup label="<?php echo $APPLICATION->ConvertCharset($deliveryType['name'], 'utf-8', SITE_CHARSET); ?>">
<?php foreach($deliveryType['deliveryServices'] as $ds): ?>
<?php if(isset($arResult['deliveryServicesList'][$ds])): ?>
<option value="<?php echo $arResult['deliveryServicesList'][$ds]['code']; ?>" <?php if ($optionsDelivServices[$bitrixDeliveryService['SID']][$id] == $arResult['deliveryServicesList'][$ds]['code']) echo 'selected'; ?>>
<?php echo $APPLICATION->ConvertCharset($arResult['deliveryServicesList'][$ds]['name'], 'utf-8', SITE_CHARSET); ?>
</option>
<?php endif; ?>
<?php endforeach; ?>
</optgroup>
<?php endif; endforeach; ?>
</select>
</td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
<tr class="heading"> <tr class="heading">
<td colspan="2"><b><?php echo GetMessage('PAYMENT_TYPES_LIST'); ?></b></td> <td colspan="2"><b><?php echo GetMessage('PAYMENT_TYPES_LIST'); ?></b></td>
</tr> </tr>

View File

@ -3,7 +3,6 @@ $MESS ['STEP_NAME'] = 'Шаг 2';
$MESS ['MOD_NEXT_STEP'] = 'Следующий шаг'; $MESS ['MOD_NEXT_STEP'] = 'Следующий шаг';
$MESS ['MOD_PREV_STEP'] = 'Предыдущий шаг'; $MESS ['MOD_PREV_STEP'] = 'Предыдущий шаг';
$MESS ['DELIVERY_TYPES_LIST'] = 'Способы доставки'; $MESS ['DELIVERY_TYPES_LIST'] = 'Способы доставки';
$MESS ['DELIVERY_SERVICES_LIST'] = 'Автоматизированные службы доставок';
$MESS ['PAYMENT_TYPES_LIST'] = 'Способы оплаты'; $MESS ['PAYMENT_TYPES_LIST'] = 'Способы оплаты';
$MESS ['PAYMENT_STATUS_LIST'] = 'Статусы'; $MESS ['PAYMENT_STATUS_LIST'] = 'Статусы';
$MESS ['ORDER_TYPES_LIST'] = 'Типы заказа'; $MESS ['ORDER_TYPES_LIST'] = 'Типы заказа';

View File

@ -53,5 +53,3 @@ $MESS ['ADDRESS_SHORT'] = 'Краткий адрес';
$MESS ['ADDRESS_FULL'] = 'Детальный адрес'; $MESS ['ADDRESS_FULL'] = 'Детальный адрес';
$MESS ['ORDER_TYPE_INFO'] = 'Тип заказа:'; $MESS ['ORDER_TYPE_INFO'] = 'Тип заказа:';
$MESS ['DELIVERY_SERVICES_LIST'] = 'Автоматизированные службы доставок';

View File

@ -176,16 +176,10 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
); );
//form delivery services ids arr //form delivery services ids arr
$deliveryServicesArr = array();
if ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()) { if ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()) {
do { do {
//auto delivery types //auto delivery types
$deliveryTypesArr[$arDeliveryServicesList['SID']] = htmlspecialchars(trim($_POST['delivery-type-' . $arDeliveryServicesList['SID']])); $deliveryTypesArr[$arDeliveryServicesList['SID']] = htmlspecialchars(trim($_POST['delivery-type-' . $arDeliveryServicesList['SID']]));
foreach($arDeliveryServicesList['PROFILES'] as $id => $profile) {
if(!$profile['TITLE']) continue; // services without name ?
$deliveryServicesArr[$arDeliveryServicesList['SID']][$id] = htmlspecialchars(trim($_POST['delivery-service-' . $arDeliveryServicesList['SID'] . '-' . $id]));
}
$arResult['bitrixDeliveryServicesList'][] = $arDeliveryServicesList;
} while ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()); } while ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch());
} }
@ -269,7 +263,6 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
COption::SetOptionString($mid, $CRM_ORDER_TYPES_ARR, serialize($orderTypesArr)); COption::SetOptionString($mid, $CRM_ORDER_TYPES_ARR, serialize($orderTypesArr));
COption::SetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, serialize($deliveryTypesArr)); COption::SetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, serialize($deliveryTypesArr));
COption::SetOptionString($mid, $CRM_DELIVERY_SERVICES_ARR, serialize($deliveryServicesArr));
COption::SetOptionString($mid, $CRM_PAYMENT_TYPES, serialize($paymentTypesArr)); COption::SetOptionString($mid, $CRM_PAYMENT_TYPES, serialize($paymentTypesArr));
COption::SetOptionString($mid, $CRM_PAYMENT_STATUSES, serialize($paymentStatusesArr)); COption::SetOptionString($mid, $CRM_PAYMENT_STATUSES, serialize($paymentStatusesArr));
COption::SetOptionString($mid, $CRM_PAYMENT, serialize($paymentArr)); COption::SetOptionString($mid, $CRM_PAYMENT, serialize($paymentArr));
@ -357,7 +350,6 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
if ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()) { if ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()) {
do { do {
$arResult['bitrixDeliveryTypesList'][] = array('ID' => $arDeliveryServicesList['SID'], 'NAME' => $arDeliveryServicesList['NAME']); $arResult['bitrixDeliveryTypesList'][] = array('ID' => $arDeliveryServicesList['SID'], 'NAME' => $arDeliveryServicesList['NAME']);
$arResult['bitrixDeliveryServicesList'][] = $arDeliveryServicesList;
} while ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch()); } while ($arDeliveryServicesList = $dbDeliveryServicesList->Fetch());
} }
@ -414,7 +406,6 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
//saved cat params //saved cat params
$optionsOrderTypes = unserialize(COption::GetOptionString($mid, $CRM_ORDER_TYPES_ARR, 0)); $optionsOrderTypes = unserialize(COption::GetOptionString($mid, $CRM_ORDER_TYPES_ARR, 0));
$optionsDelivTypes = unserialize(COption::GetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, 0)); $optionsDelivTypes = unserialize(COption::GetOptionString($mid, $CRM_DELIVERY_TYPES_ARR, 0));
$optionsDelivServices = unserialize(COption::GetOptionString($mid, $CRM_DELIVERY_SERVICES_ARR, 0));
$optionsPayTypes = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT_TYPES, 0)); $optionsPayTypes = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT_TYPES, 0));
$optionsPayStatuses = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT_STATUSES, 0)); // --statuses $optionsPayStatuses = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT_STATUSES, 0)); // --statuses
$optionsPayment = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT, 0)); $optionsPayment = unserialize(COption::GetOptionString($mid, $CRM_PAYMENT, 0));
@ -518,34 +509,6 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<tr class="heading">
<td colspan="2"><b><?php echo GetMessage('DELIVERY_SERVICES_LIST'); ?></b></td>
</tr>
<?php foreach($arResult['bitrixDeliveryServicesList'] as $bitrixDeliveryService): ?>
<?php foreach($bitrixDeliveryService['PROFILES'] as $id => $profile): if(!$profile['TITLE']) continue; ?>
<tr>
<td width="50%" class="adm-detail-content-cell-l" name="<?php echo $bitrixDeliveryService['SID'] . '-' . $id; ?>">
<?php echo '<b>[' . $bitrixDeliveryService['NAME'] . ']</b>: ' . $profile['TITLE']; ?>
</td>
<td width="50%" class="adm-detail-content-cell-r">
<select name="delivery-service-<?php echo $bitrixDeliveryService['SID'] . '-' . $id; ?>" class="typeselect">
<option value=""></option>
<?php foreach($arResult['deliveryTypesList'] as $deliveryType): if(!empty($deliveryType['deliveryServices'])) : ?>
<optgroup label="<?php echo $APPLICATION->ConvertCharset($deliveryType['name'], 'utf-8', SITE_CHARSET); ?>">
<?php foreach($deliveryType['deliveryServices'] as $ds): ?>
<?php if(isset($arResult['deliveryServicesList'][$ds])): ?>
<option value="<?php echo $arResult['deliveryServicesList'][$ds]['code']; ?>" <?php if ($optionsDelivServices[$bitrixDeliveryService['SID']][$id] == $arResult['deliveryServicesList'][$ds]['code']) echo 'selected'; ?>>
<?php echo $APPLICATION->ConvertCharset($arResult['deliveryServicesList'][$ds]['name'], 'utf-8', SITE_CHARSET); ?>
</option>
<?php endif; ?>
<?php endforeach; ?>
</optgroup>
<?php endif; endforeach; ?>
</select>
</td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
<tr class="heading"> <tr class="heading">
<td colspan="2"><b><?php echo GetMessage('PAYMENT_TYPES_LIST'); ?></b></td> <td colspan="2"><b><?php echo GetMessage('PAYMENT_TYPES_LIST'); ?></b></td>
</tr> </tr>