ソースを参照

Inscription des producteurs : siret non obligatoire

refactoring
コミット
3206388779
6個のファイルの変更22行の追加11行の削除
  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 ファイルの表示

@@ -37,7 +37,7 @@ termes.
*/

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

+ 1
- 1
common/models/Producer.php ファイルの表示

@@ -98,7 +98,7 @@ class Producer extends ActiveRecordCommon
public function rules()
{
return [
[['name', 'siret', 'order_deadline', 'order_delay','type'], 'required'],
[['name', 'order_deadline', 'order_delay','type'], 'required'],
[['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_delay', 'in', 'range' => [1, 2, 3, 4, 5, 6, 7]],

+ 16
- 0
console/migrations/m190305_104710_producer_siret_non_requis.php ファイルの表示

@@ -0,0 +1,16 @@
<?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 ファイルの表示

@@ -251,7 +251,8 @@ class SiteController extends FrontendController
{
$model = new SignupForm();
if ($model->load(Yii::$app->request->post())) {
if ($user = $model->signup()) {
$user = $model->signup() ;
if ($user) {
if (Yii::$app->getUser()->login($user)) {
if($model->option_user_producer == 'producer') {
$this->redirect(Yii::$app->urlManagerBackend->createAbsoluteUrl(['site/index']));

+ 1
- 6
frontend/models/SignupForm.php ファイルの表示

@@ -115,11 +115,6 @@ class SignupForm extends Model
return $('#option-producer').prop('checked') ;
}"],
['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 = $this->$attribute;
@@ -197,7 +192,7 @@ class SignupForm extends Model
'lastname' => 'Nom',
'phone' => 'Téléphone',
'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',
'postcode' => 'Code postal',
'city' => 'Commune',

+ 0
- 1
frontend/views/site/signup.php ファイルの表示

@@ -76,7 +76,6 @@ $this->params['breadcrumbs'][] = $this->title;
<div id="fields-producer">
<?= $form->field($model, 'name_producer') ?>
<?= $form->field($model, 'type')->textInput(['placeholder' => 'Boulangerie, brasserie, ferme ...']); ?>
<?= $form->field($model, 'siret') ?>
<?= $form->field($model, 'postcode') ?>
<?= $form->field($model, 'city') ?>
<?= $form->field($model, 'free_price',[

読み込み中…
キャンセル
保存