Optional payment sum exchange (#223)

Closes #219
This commit is contained in:
RenCurs 2021-01-29 14:37:56 +03:00 committed by GitHub
parent 7cdab05aa2
commit 08df9043fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 65 additions and 3 deletions

View File

@ -330,9 +330,10 @@ class ControllerExtensionModuleRetailcrm extends Controller
'entry_code', 'entry_code',
'entry_status', 'entry_status',
'text_retailcrm_discount', 'text_retailcrm_discount',
'text_label_retailcrm_discount', 'text_retailcrm_label_discount',
'label_retailcrm_discount', 'default_retailcrm_label_discount',
'default_label_retailcrm_discount' 'sum_payment',
'text_sum_payment'
); );
$_data = &$data; $_data = &$data;

View File

@ -83,6 +83,8 @@ $_['text_retailcrm_discount'] = 'RetailCRM discount';
$_['text_retailcrm_label_discount'] = 'Label of RetailCRM discount in section total of order'; $_['text_retailcrm_label_discount'] = 'Label of RetailCRM discount in section total of order';
$_['default_retailcrm_label_discount'] = 'Discount in RetailCRM'; $_['default_retailcrm_label_discount'] = 'Discount in RetailCRM';
$_['sum_payment'] = 'Sum payment';
$_['text_sum_payment'] = 'Do not upload the sum payment to RetailCRM';
$_['article'] = 'Article'; $_['article'] = 'Article';
$_['color'] = 'Color'; $_['color'] = 'Color';

View File

@ -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'; $_['text_retailcrm_label_discount'] = 'Etiqueta de descuento de RetailCRM en la sección total del pedido';
$_['default_retailcrm_label_discount'] = 'Descuento en RetailCRM'; $_['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'; $_['article'] = 'Artículo';
$_['color'] = 'Color'; $_['color'] = 'Color';
$_['weight'] = 'Peso'; $_['weight'] = 'Peso';

View File

@ -83,6 +83,9 @@ $_['text_retailcrm_discount'] = 'Скидка RetailCRM';
$_['text_retailcrm_label_discount'] = 'Подпись для скидки, установленной в RetailCRM, в итоговой секции заказа'; $_['text_retailcrm_label_discount'] = 'Подпись для скидки, установленной в RetailCRM, в итоговой секции заказа';
$_['default_retailcrm_label_discount'] = 'Скидка в RetailCRM'; $_['default_retailcrm_label_discount'] = 'Скидка в RetailCRM';
$_['sum_payment'] = 'Сумма платежа';
$_['text_sum_payment'] = 'Не передавать сумму платежа в RetailCRM';
$_['article'] = 'Артикул'; $_['article'] = 'Артикул';
$_['color'] = 'Цвет'; $_['color'] = 'Цвет';
$_['weight'] = 'Вес'; $_['weight'] = 'Вес';

View File

@ -222,6 +222,26 @@
</div> </div>
</div> </div>
</fieldset> </fieldset>
<fieldset>
<legend><?php echo $sum_payment; ?></legend>
<div class="form-group">
<label class="col-sm-2 control-label" for="retailcrm_sum_payment"><?php echo $text_sum_payment?></label>
<div class="col-sm-10">
<label class="radio-inline">
<input type="radio" name="retailcrm_sum_payment" value="1" <?php if (isset($saved_settings['retailcrm_sum_payment']) &&
$saved_settings['retailcrm_sum_payment'] == 1) :
echo 'checked'; endif;?> />
<?php echo $text_yes; ?>
</label>
<label class="radio-inline">
<input type="radio" name="retailcrm_sum_payment" value="0" <?php if (!isset($saved_settings['retailcrm_sum_payment']) ||
$saved_settings['retailcrm_sum_payment'] == 0) :
echo 'checked'; endif;?> />
<?php echo $text_no; ?>
</label>
</div>
</div>
</fieldset>
</div> </div>
<div class="tab-pane" id="tab-references"> <div class="tab-pane" id="tab-references">
<fieldset> <fieldset>

View File

@ -229,6 +229,28 @@
</div> </div>
</div> </div>
</fieldset> </fieldset>
<fieldset>
<legend>{{ sum_payment }}</legend>
<div class="form-group">
<label class="col-sm-2 control-label" for="module_retailcrm_sum_payment">{{ text_sum_payment }}</label>
<div class="col-sm-10">
<label class="control-label radio-inline">
<input type="radio" name="module_retailcrm_sum_payment" value="1"
{% if saved_settings.module_retailcrm_sum_payment is defined and saved_settings.module_retailcrm_sum_payment == 1 %}
checked
{% endif %} >
{{ text_yes }}
</label>
<label class="control-label radio-inline">
<input type="radio" name="module_retailcrm_sum_payment" value="0"
{% if saved_settings.module_retailcrm_sum_payment is not defined or saved_settings.module_retailcrm_sum_payment == 0 %}
checked
{% endif %} >
{{ text_no }}
</label>
</div>
</div>
</fieldset>
</div> </div>
<div class="tab-pane" id="tab-references"> <div class="tab-pane" id="tab-references">
<fieldset> <fieldset>

View File

@ -293,6 +293,12 @@ class ModelExtensionRetailcrmOrder extends Model {
'amount' => $totals['total'] 'amount' => $totals['total']
); );
if (isset($this->settings[$this->moduleTitle . '_sum_payment']) &&
$this->settings[$this->moduleTitle . '_sum_payment'] == 1
) {
unset($payment['amount']);
}
if (!$create) { if (!$create) {
$payment['order'] = array( $payment['order'] = array(
'externalId' => $order_id 'externalId' => $order_id

View File

@ -113,6 +113,11 @@ class RetailcrmOrderConverter {
'amount' => $this->getTotal('total') 'amount' => $this->getTotal('total')
); );
if ($this->settingsManager->getSetting('sum_payment') &&
$this->settingsManager->getSetting('sum_payment') == 1) {
unset($payment['amount']);
}
if (!empty($payment_type)) { if (!empty($payment_type)) {
$payment['type'] = $payment_type; $payment['type'] = $payment_type;
} }