Browse Source

Merge branch 'dev'

master
Guillaume Bourgeois 5 years ago
parent
commit
9fe05deae5
6 changed files with 22 additions and 11 deletions
  1. +2
    -2
      common/config/params.php
  2. +1
    -1
      common/models/Producer.php
  3. +16
    -0
      console/migrations/m190305_104710_producer_siret_non_requis.php
  4. +2
    -1
      frontend/controllers/SiteController.php
  5. +1
    -6
      frontend/models/SignupForm.php
  6. +0
    -1
      frontend/views/site/signup.php

+ 2
- 2
common/config/params.php View File

*/ */


return [ return [
'adminEmail' => 'contact@laboiteapain.net',
'supportEmail' => 'contact@laboiteapain.net',
'adminEmail' => 'contact@opendistrib.net',
'supportEmail' => 'contact@opendistrib.net',
'user.passwordResetTokenExpire' => 3600, 'user.passwordResetTokenExpire' => 3600,
]; ];

+ 1
- 1
common/models/Producer.php View File

public function rules() public function rules()
{ {
return [ return [
[['name', 'siret', 'order_deadline', 'order_delay','type'], 'required'],
[['name', 'order_deadline', 'order_delay','type'], 'required'],
[['order_deadline', 'order_delay'], 'integer'], [['order_deadline', 'order_delay'], 'integer'],
['order_deadline', 'in', 'range' => [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]], ['order_deadline', 'in', 'range' => [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]],
['order_delay', 'in', 'range' => [1, 2, 3, 4, 5, 6, 7]], ['order_delay', 'in', 'range' => [1, 2, 3, 4, 5, 6, 7]],

+ 16
- 0
console/migrations/m190305_104710_producer_siret_non_requis.php View File

<?php

use yii\db\Migration;
use yii\db\mysql\Schema;

class m190305_104710_producer_siret_non_requis extends Migration {

public function up() {
$this->alterColumn('producer', 'siret', Schema::TYPE_STRING.' DEFAULT NULL') ;
}

public function down() {
$this->alterColumn('producer', 'siret', Schema::TYPE_STRING.' NOT NULL') ;
}

}

+ 2
- 1
frontend/controllers/SiteController.php View File

{ {
$model = new SignupForm(); $model = new SignupForm();
if ($model->load(Yii::$app->request->post())) { if ($model->load(Yii::$app->request->post())) {
if ($user = $model->signup()) {
$user = $model->signup() ;
if ($user) {
if (Yii::$app->getUser()->login($user)) { if (Yii::$app->getUser()->login($user)) {
if($model->option_user_producer == 'producer') { if($model->option_user_producer == 'producer') {
$this->redirect(Yii::$app->urlManagerBackend->createAbsoluteUrl(['site/index'])); $this->redirect(Yii::$app->urlManagerBackend->createAbsoluteUrl(['site/index']));

+ 1
- 6
frontend/models/SignupForm.php View File

return $('#option-producer').prop('checked') ; return $('#option-producer').prop('checked') ;
}"], }"],
['siret', 'string'], ['siret', 'string'],
['siret', 'required', 'message' => 'Champs obligatoire', 'when' => function($model) {
return $model->option_user_producer == 'producer';
}, 'whenClient' => "function (attribute, value) {
return $('#option-producer').prop('checked') ;
}"],
['siret', function($attribute, $params) { ['siret', function($attribute, $params) {


$siret = $this->$attribute; $siret = $this->$attribute;
'lastname' => 'Nom', 'lastname' => 'Nom',
'phone' => 'Téléphone', 'phone' => 'Téléphone',
'is_producer' => "Je suis professionnel et souhaite mettre en place un système de réservation dans mon établissement", 'is_producer' => "Je suis professionnel et souhaite mettre en place un système de réservation dans mon établissement",
'name_producer' => 'Nom du producteur',
'name_producer' => 'Nom de votre structure',
'siret' => 'Numéro SIRET', 'siret' => 'Numéro SIRET',
'postcode' => 'Code postal', 'postcode' => 'Code postal',
'city' => 'Commune', 'city' => 'Commune',

+ 0
- 1
frontend/views/site/signup.php View File

<div id="fields-producer"> <div id="fields-producer">
<?= $form->field($model, 'name_producer') ?> <?= $form->field($model, 'name_producer') ?>
<?= $form->field($model, 'type')->textInput(['placeholder' => 'Boulangerie, brasserie, ferme ...']); ?> <?= $form->field($model, 'type')->textInput(['placeholder' => 'Boulangerie, brasserie, ferme ...']); ?>
<?= $form->field($model, 'siret') ?>
<?= $form->field($model, 'postcode') ?> <?= $form->field($model, 'postcode') ?>
<?= $form->field($model, 'city') ?> <?= $form->field($model, 'city') ?>
<?= $form->field($model, 'free_price',[ <?= $form->field($model, 'free_price',[

Loading…
Cancel
Save