1
0
Fork 0
mirror of synced 2025-04-04 14:23:33 +03:00
Добавлена опция в настройках модуля для получения трек номера.
Добавлена запись трек номера в доставку.
This commit is contained in:
Ivan Chaplygin 2023-10-24 16:08:48 +03:00
parent 693031012d
commit 492c20a1c4
6 changed files with 42 additions and 0 deletions

View file

@ -1180,6 +1180,15 @@ class RetailCrmHistory
if ($orderCrm) {
self::deliveryUpdate($newOrder, $optionsDelivTypes, $orderCrm['order']);
}
if (isset($order['delivery']['service']['trackNumber'])
&& RetailcrmConfigProvider::getTrackNumberStatus() === 'Y'
) {
$newOrder->setField(
'TRACKING_NUMBER',
$order['delivery']['service']['trackNumber']
);
}
}
if ($itemUpdate === true && $newOrder->getField('CANCELED') !== 'Y') {

View file

@ -112,3 +112,5 @@ $MESS ['DEACTIVATE_MODULE'] = 'Deactivate the module';
$MESS ['WRONG_CREDENTIALS'] = 'Enter the address and authorization key of the CRM system';
$MESS ['Wrong "apiKey" value.'] = 'Invalid authorization key';
$MESS ['ORDER_TRACK_NUMBER'] = 'Receive track number';

View file

@ -171,3 +171,5 @@ $MESS ['DEACTIVATE_MODULE'] = 'Деактивировать модуль';
$MESS ['WRONG_CREDENTIALS'] = 'Введите адрес и ключ авторизации CRM системы';
$MESS ['Wrong "apiKey" value.'] = 'Недействительный ключ авторизации';
$MESS ['ORDER_TRACK_NUMBER'] = 'Получать трек-номер';

View file

@ -1159,4 +1159,14 @@ class ConfigProvider
{
return COption::GetOptionString(Constants::MODULE_ID, Constants::SITES_AVAILABLE, null);
}
public static function getTrackNumberStatus()
{
return static::getOption(Constants::DISPLAY_TRACK_NUMBER_DELIVERY);
}
public static function setTrackNumberStatus($trackNumberStatus)
{
static::setOption(Constants::DISPLAY_TRACK_NUMBER_DELIVERY, $trackNumberStatus);
}
}

View file

@ -104,4 +104,6 @@ class Constants
['EVENT_NAME' => 'OnSaleComponentOrderResultPrepared', 'FROM_MODULE' => 'sale'],
];
public const SITES_AVAILABLE = 'sites_available';
public const DISPLAY_TRACK_NUMBER_DELIVERY = 'receive_track_number_delivery';
}

View file

@ -40,6 +40,7 @@ $CRM_CONTRAGENT_TYPE = 'contragent_type';
$CRM_SITES_LIST = 'sites_list';
$CRM_ORDER_NUMBERS = 'order_numbers';
$CRM_ORDER_VAT = 'order_vat';
$CRM_ORDER_TRACK_NUMBER = 'receive_track_number_delivery';
$CRM_CANSEL_ORDER = 'cansel_order';
$CRM_INVENTORIES_UPLOAD = 'inventories_upload';
$CRM_STORES = 'stores';
@ -814,6 +815,12 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
$CRM_ORDER_VAT,
htmlspecialchars(trim($_POST['order-vat'])) ?: 'N'
);
COption::SetOptionString(
$mid,
$CRM_ORDER_TRACK_NUMBER,
htmlspecialchars(trim($_POST['track-number'])) ?: 'N'
);
COption::SetOptionString(
$mid,
$CRM_COUPON_FIELD,
@ -1027,6 +1034,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
$optionsCustomFields = unserialize(COption::GetOptionString($mid, $CRM_CUSTOM_FIELDS, 0));
$optionsOrderNumbers = COption::GetOptionString($mid, $CRM_ORDER_NUMBERS, 0);
$optionsOrderVat = COption::GetOptionString($mid, $CRM_ORDER_VAT, 0);
$optionsOrderTrackNumber = COption::GetOptionString($mid, $CRM_ORDER_TRACK_NUMBER, 0);
$canselOrderArr = unserialize(COption::GetOptionString($mid, $CRM_CANSEL_ORDER, 0));
$sendPickupPointAddress = COption::GetOptionString($mid, Constants::CRM_SEND_PICKUP_POINT_ADDRESS, 'N');
@ -2247,6 +2255,15 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
</b>
</td>
</tr>
<tr>
<td colspan="2" class="option-head option-other-top option-other-bottom">
<b>
<label><input class="addr" type="checkbox" name="track-number" value="Y" <?php if ($optionsOrderTrackNumber === 'Y') {
echo "checked";
} ?>> <?php echo GetMessage('ORDER_TRACK_NUMBER'); ?></label>
</b>
</td>
</tr>
<tr>
<td colspan="2" class="option-head option-other-top option-other-bottom">
<b>