@@ -384,6 +384,7 @@ class UserController extends BackendController | |||
*/ | |||
public function actionCredit(int $id) | |||
{ | |||
$producerModule = $this->getProducerModule(); | |||
$userModule = $this->getUserModule(); | |||
$paymentModule = $this->getPaymentModule(); | |||
$userProducerModule = $this->getUserProducerModule(); | |||
@@ -393,6 +394,8 @@ class UserController extends BackendController | |||
if ($userProducer) { | |||
$creditForm = new CreditForm(); | |||
$creditForm->send_mail = $producerModule->getSolver()->getConfig('option_check_by_default_prevent_user_credit'); | |||
if ($creditForm->load(\Yii::$app->request->post()) && $creditForm->validate()) { | |||
$paymentModule->getManager() |
@@ -40,6 +40,7 @@ namespace backend\models; | |||
use common\helpers\GlobalParam; | |||
use common\logic\Payment\Module\PaymentModule; | |||
use common\logic\Producer\Producer\Module\ProducerModule; | |||
use common\logic\User\User\Module\UserModule; | |||
use common\logic\User\UserProducer\Module\UserProducerModule; | |||
use yii\base\Model; |
@@ -347,6 +347,9 @@ $this->addBreadcrumb($this->getTitle()); | |||
'template' => '{label}<div class="input-group">{input}<span class="input-group-addon"><span class="glyphicon glyphicon-euro"></span></span></div>{hint}', | |||
])->hint('Limite de crédit que l\'utilisateur ne pourra pas dépasser. Laisser vide pour permettre un crédit négatif et infini.'); ?> | |||
<?= $form->field($model, 'option_check_by_default_prevent_user_credit') | |||
->dropDownList(Dropdown::noYesChoices()); ?> | |||
<h4>Paiement en ligne</h4> | |||
<?= $form->field($model, 'online_payment') | |||
->dropDownList(Dropdown::noYesChoices()); ?> |
@@ -279,7 +279,8 @@ class Producer extends ActiveRecordCommon | |||
'option_billing_permanent_transfer', | |||
'option_export_display_column_delivery_note', | |||
'option_invoice_only_based_on_delivery_notes', | |||
'option_document_display_price_unit_reference' | |||
'option_document_display_price_unit_reference', | |||
'option_check_by_default_prevent_user_credit' | |||
], | |||
'boolean' | |||
], | |||
@@ -456,6 +457,7 @@ class Producer extends ActiveRecordCommon | |||
'export_shopping_cart_labels_number_per_column' => "Étiquettes (PDF) : nombre d'étiquettes par colonne", | |||
'option_document_display_price_unit_reference' => "Afficher les prix au kilogramme", | |||
'id_user_group_default' => "Groupe utilisateur par défaut attribué à l'inscription", | |||
'option_check_by_default_prevent_user_credit' => "Par défaut, prévenir l'utilisateur quand on crédite son compte" | |||
]; | |||
} | |||
@@ -0,0 +1,26 @@ | |||
<?php | |||
use yii\db\Migration; | |||
use yii\db\Schema; | |||
/** | |||
* Class m231110_073749_add_column_producer_option_check_by_default_prevent_user_credit | |||
*/ | |||
class m231110_073749_add_column_producer_option_check_by_default_prevent_user_credit extends Migration | |||
{ | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function safeUp() | |||
{ | |||
$this->addColumn('producer', 'option_check_by_default_prevent_user_credit', Schema::TYPE_BOOLEAN.' DEFAULT 1'); | |||
} | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function safeDown() | |||
{ | |||
$this->dropColumn('producer', 'option_check_by_default_prevent_user_credit'); | |||
} | |||
} |