Bläddra i källkod

[Administration] Utilisateurs > formulaire crédit : possibilité de choisir si le champs "Prévenir l'utilisateur" est coché par défaut #1413

feature/souke
Guillaume Bourgeois 1 år sedan
förälder
incheckning
f85fa9ce4c
5 ändrade filer med 36 tillägg och 1 borttagningar
  1. +3
    -0
      backend/controllers/UserController.php
  2. +1
    -0
      backend/models/CreditForm.php
  3. +3
    -0
      backend/views/producer/update.php
  4. +3
    -1
      common/logic/Producer/Producer/Model/Producer.php
  5. +26
    -0
      console/migrations/m231110_073749_add_column_producer_option_check_by_default_prevent_user_credit.php

+ 3
- 0
backend/controllers/UserController.php Visa fil

@@ -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()

+ 1
- 0
backend/models/CreditForm.php Visa fil

@@ -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;

+ 3
- 0
backend/views/producer/update.php Visa fil

@@ -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()); ?>

+ 3
- 1
common/logic/Producer/Producer/Model/Producer.php Visa fil

@@ -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"
];
}


+ 26
- 0
console/migrations/m231110_073749_add_column_producer_option_check_by_default_prevent_user_credit.php Visa fil

@@ -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');
}
}

Laddar…
Avbryt
Spara