From 08df9043fa46bef1fa316c5db47fd99f225a2c10 Mon Sep 17 00:00:00 2001 From: RenCurs <34103666+RenCurs@users.noreply.github.com> Date: Fri, 29 Jan 2021 14:37:56 +0300 Subject: [PATCH] Optional payment sum exchange (#223) Closes #219 --- .../controller/extension/module/retailcrm.php | 7 +++--- .../en-gb/extension/module/retailcrm.php | 2 ++ .../es-es/extension/module/retailcrm.php | 3 +++ .../ru-ru/extension/module/retailcrm.php | 3 +++ .../template/extension/module/retailcrm.tpl | 20 +++++++++++++++++ .../template/extension/module/retailcrm.twig | 22 +++++++++++++++++++ .../model/extension/retailcrm/order.php | 6 +++++ .../lib/service/RetailcrmOrderConverter.php | 5 +++++ 8 files changed, 65 insertions(+), 3 deletions(-) diff --git a/src/upload/admin/controller/extension/module/retailcrm.php b/src/upload/admin/controller/extension/module/retailcrm.php index dbb3b4c..e8e62f7 100644 --- a/src/upload/admin/controller/extension/module/retailcrm.php +++ b/src/upload/admin/controller/extension/module/retailcrm.php @@ -330,9 +330,10 @@ class ControllerExtensionModuleRetailcrm extends Controller 'entry_code', 'entry_status', 'text_retailcrm_discount', - 'text_label_retailcrm_discount', - 'label_retailcrm_discount', - 'default_label_retailcrm_discount' + 'text_retailcrm_label_discount', + 'default_retailcrm_label_discount', + 'sum_payment', + 'text_sum_payment' ); $_data = &$data; diff --git a/src/upload/admin/language/en-gb/extension/module/retailcrm.php b/src/upload/admin/language/en-gb/extension/module/retailcrm.php index b2669d0..e8525b8 100644 --- a/src/upload/admin/language/en-gb/extension/module/retailcrm.php +++ b/src/upload/admin/language/en-gb/extension/module/retailcrm.php @@ -83,6 +83,8 @@ $_['text_retailcrm_discount'] = 'RetailCRM discount'; $_['text_retailcrm_label_discount'] = 'Label of RetailCRM discount in section total of order'; $_['default_retailcrm_label_discount'] = 'Discount in RetailCRM'; +$_['sum_payment'] = 'Sum payment'; +$_['text_sum_payment'] = 'Do not upload the sum payment to RetailCRM'; $_['article'] = 'Article'; $_['color'] = 'Color'; diff --git a/src/upload/admin/language/es-es/extension/module/retailcrm.php b/src/upload/admin/language/es-es/extension/module/retailcrm.php index 7710f94..063a636 100644 --- a/src/upload/admin/language/es-es/extension/module/retailcrm.php +++ b/src/upload/admin/language/es-es/extension/module/retailcrm.php @@ -83,6 +83,9 @@ $_['text_retailcrm_discount'] = 'RetailCRM descuento'; $_['text_retailcrm_label_discount'] = 'Etiqueta de descuento de RetailCRM en la sección total del pedido'; $_['default_retailcrm_label_discount'] = 'Descuento en RetailCRM'; +$_['sum_payment'] = 'Suma de pago'; +$_['text_sum_payment'] = 'No transferir suma de pago a RetailCRM'; + $_['article'] = 'Artículo'; $_['color'] = 'Color'; $_['weight'] = 'Peso'; diff --git a/src/upload/admin/language/ru-ru/extension/module/retailcrm.php b/src/upload/admin/language/ru-ru/extension/module/retailcrm.php index c50d7ff..aafdb8e 100644 --- a/src/upload/admin/language/ru-ru/extension/module/retailcrm.php +++ b/src/upload/admin/language/ru-ru/extension/module/retailcrm.php @@ -83,6 +83,9 @@ $_['text_retailcrm_discount'] = 'Скидка RetailCRM'; $_['text_retailcrm_label_discount'] = 'Подпись для скидки, установленной в RetailCRM, в итоговой секции заказа'; $_['default_retailcrm_label_discount'] = 'Скидка в RetailCRM'; +$_['sum_payment'] = 'Сумма платежа'; +$_['text_sum_payment'] = 'Не передавать сумму платежа в RetailCRM'; + $_['article'] = 'Артикул'; $_['color'] = 'Цвет'; $_['weight'] = 'Вес'; diff --git a/src/upload/admin/view/template/extension/module/retailcrm.tpl b/src/upload/admin/view/template/extension/module/retailcrm.tpl index ad866e4..0bf5580 100644 --- a/src/upload/admin/view/template/extension/module/retailcrm.tpl +++ b/src/upload/admin/view/template/extension/module/retailcrm.tpl @@ -222,6 +222,26 @@ +
+ +
+ +
+ + +
+
+
diff --git a/src/upload/admin/view/template/extension/module/retailcrm.twig b/src/upload/admin/view/template/extension/module/retailcrm.twig index af9d0e3..7f742ed 100644 --- a/src/upload/admin/view/template/extension/module/retailcrm.twig +++ b/src/upload/admin/view/template/extension/module/retailcrm.twig @@ -229,6 +229,28 @@
+
+ {{ sum_payment }} +
+ +
+ + +
+
+
diff --git a/src/upload/catalog/model/extension/retailcrm/order.php b/src/upload/catalog/model/extension/retailcrm/order.php index 790a203..93b313a 100644 --- a/src/upload/catalog/model/extension/retailcrm/order.php +++ b/src/upload/catalog/model/extension/retailcrm/order.php @@ -293,6 +293,12 @@ class ModelExtensionRetailcrmOrder extends Model { 'amount' => $totals['total'] ); + if (isset($this->settings[$this->moduleTitle . '_sum_payment']) && + $this->settings[$this->moduleTitle . '_sum_payment'] == 1 + ) { + unset($payment['amount']); + } + if (!$create) { $payment['order'] = array( 'externalId' => $order_id diff --git a/src/upload/system/library/retailcrm/lib/service/RetailcrmOrderConverter.php b/src/upload/system/library/retailcrm/lib/service/RetailcrmOrderConverter.php index 658bc7a..6d0d6ae 100644 --- a/src/upload/system/library/retailcrm/lib/service/RetailcrmOrderConverter.php +++ b/src/upload/system/library/retailcrm/lib/service/RetailcrmOrderConverter.php @@ -113,6 +113,11 @@ class RetailcrmOrderConverter { 'amount' => $this->getTotal('total') ); + if ($this->settingsManager->getSetting('sum_payment') && + $this->settingsManager->getSetting('sum_payment') == 1) { + unset($payment['amount']); + } + if (!empty($payment_type)) { $payment['type'] = $payment_type; }