*/ | */ | ||||
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() |
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; |
'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()); ?> |
'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" | |||||
]; | ]; | ||||
} | } | ||||
<?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'); | |||||
} | |||||
} |