Browse Source

[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 year ago
parent
commit
f85fa9ce4c
5 changed files with 36 additions and 1 deletions
  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 View File

*/ */
public function actionCredit(int $id) public function actionCredit(int $id)
{ {
$producerModule = $this->getProducerModule();
$userModule = $this->getUserModule(); $userModule = $this->getUserModule();
$paymentModule = $this->getPaymentModule(); $paymentModule = $this->getPaymentModule();
$userProducerModule = $this->getUserProducerModule(); $userProducerModule = $this->getUserProducerModule();


if ($userProducer) { if ($userProducer) {
$creditForm = new CreditForm(); $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()) { if ($creditForm->load(\Yii::$app->request->post()) && $creditForm->validate()) {


$paymentModule->getManager() $paymentModule->getManager()

+ 1
- 0
backend/models/CreditForm.php View File



use common\helpers\GlobalParam; use common\helpers\GlobalParam;
use common\logic\Payment\Module\PaymentModule; use common\logic\Payment\Module\PaymentModule;
use common\logic\Producer\Producer\Module\ProducerModule;
use common\logic\User\User\Module\UserModule; use common\logic\User\User\Module\UserModule;
use common\logic\User\UserProducer\Module\UserProducerModule; use common\logic\User\UserProducer\Module\UserProducerModule;
use yii\base\Model; use yii\base\Model;

+ 3
- 0
backend/views/producer/update.php View File

'template' => '{label}<div class="input-group">{input}<span class="input-group-addon"><span class="glyphicon glyphicon-euro"></span></span></div>{hint}', '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.'); ?> ])->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> <h4>Paiement en ligne</h4>
<?= $form->field($model, 'online_payment') <?= $form->field($model, 'online_payment')
->dropDownList(Dropdown::noYesChoices()); ?> ->dropDownList(Dropdown::noYesChoices()); ?>

+ 3
- 1
common/logic/Producer/Producer/Model/Producer.php View File

'option_billing_permanent_transfer', 'option_billing_permanent_transfer',
'option_export_display_column_delivery_note', 'option_export_display_column_delivery_note',
'option_invoice_only_based_on_delivery_notes', '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' 'boolean'
], ],
'export_shopping_cart_labels_number_per_column' => "Étiquettes (PDF) : nombre d'étiquettes par colonne", '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", 'option_document_display_price_unit_reference' => "Afficher les prix au kilogramme",
'id_user_group_default' => "Groupe utilisateur par défaut attribué à l'inscription", '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 View File

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

Loading…
Cancel
Save