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