瀏覽代碼

[Administration] Paramètres > paiement en ligne : montant minimum éditable dans les paramètres #159

refactoring
Guillaume Bourgeois 2 年之前
父節點
當前提交
5c24bf4ad5
共有 5 個文件被更改,包括 47 次插入4 次删除
  1. +3
    -0
      backend/views/producer/update.php
  2. +16
    -2
      common/models/Producer.php
  3. +26
    -0
      console/migrations/m221115_085843_producer_add_option_online_payment_minimum_amount.php
  4. +1
    -1
      producer/models/CreditForm.php
  5. +1
    -1
      producer/views/credit/add.php

+ 3
- 0
backend/views/producer/update.php 查看文件

@@ -380,6 +380,9 @@ $this->addBreadcrumb($this->getTitle());
0 => 'Non',
1 => 'Oui',
], []); ?>
<?= $form->field($model, 'option_online_payment_minimum_amount')
->hint('Valeur par défaut si non défini : '.Producer::ONLINE_PAYMENT_MINIMUM_AMOUNT_DEFAULT.' €')
->textInput(); ?>
<?= $form->field($model, 'option_stripe_mode_test')->dropDownList([
0 => 'Non',
1 => 'Oui'

+ 16
- 2
common/models/Producer.php 查看文件

@@ -118,6 +118,8 @@ class Producer extends ActiveRecordCommon

var $secret_key_payplug;

const ONLINE_PAYMENT_MINIMUM_AMOUNT_DEFAULT = 25;

/**
* @inheritdoc
*/
@@ -160,7 +162,8 @@ class Producer extends ActiveRecordCommon
'order_deadline_sunday',
'id_tax_rate_default',
'document_quotation_duration',
'option_dashboard_number_distributions'
'option_dashboard_number_distributions',
'option_online_payment_minimum_amount'
],
'integer'
],
@@ -397,7 +400,8 @@ class Producer extends ActiveRecordCommon
'option_export_evoliz' => 'Activer l\'export vers Evoliz',
'latest_version_opendistrib' => 'Dernière version d\'Opendistrib',
'option_csv_separator' => 'Séparateur de colonnes (CSV)',
'option_display_message_new_opendistrib_version' => 'Afficher les messages de mise à jour du logiciel Opendistrib'
'option_display_message_new_opendistrib_version' => 'Afficher les messages de mise à jour du logiciel Opendistrib',
'option_online_payment_minimum_amount' => 'Paiement en ligne : montant minimum'
];
}

@@ -987,5 +991,15 @@ class Producer extends ActiveRecordCommon
$this->latest_version_opendistrib = array_values($versionsArray)[0];
$this->save();
}

public function getOnlinePaymentMinimumAmount()
{
$onlinePaymentMinimumAmount = self::getConfig('option_online_payment_minimum_amount');
if(!$onlinePaymentMinimumAmount) {
$onlinePaymentMinimumAmount = self::ONLINE_PAYMENT_MINIMUM_AMOUNT_DEFAULT;
}

return $onlinePaymentMinimumAmount;
}
}

+ 26
- 0
console/migrations/m221115_085843_producer_add_option_online_payment_minimum_amount.php 查看文件

@@ -0,0 +1,26 @@
<?php

use yii\db\Migration;
use yii\db\Schema;

/**
* Class m221115_085843_producer_add_option_online_payment_minimum_amount
*/
class m221115_085843_producer_add_option_online_payment_minimum_amount extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('producer', 'option_online_payment_minimum_amount', Schema::TYPE_INTEGER);
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('producer', 'option_online_payment_minimum_amount');
}
}

+ 1
- 1
producer/models/CreditForm.php 查看文件

@@ -53,7 +53,7 @@ class CreditForm extends Model
{
return [
[['amount'], 'required'],
[['amount'], 'double', 'min' => 25],
[['amount'], 'double', 'min' => Producer::getOnlinePaymentMinimumAmount()],
];
}


+ 1
- 1
producer/views/credit/add.php 查看文件

@@ -62,7 +62,7 @@ $this->addButton(
'template' => '{label}<div class="input-group input-group-lg">{input}<span class="input-group-addon"><span class="glyphicon glyphicon-euro"></span></span></div>{hint}',
])
->label('Quel montant souhaitez-vous créditer ?')
->hint('Montant minimum : 25 €'); ?>
->hint('Montant minimum : '.Producer::getOnlinePaymentMinimumAmount().' €'); ?>

<div class="form-group">
<?= Html::submitButton('<span class="glyphicon glyphicon-lock"></span> Payer', ['class' => 'btn btn-primary']

Loading…
取消
儲存