소스 검색

Inscription des producteurs : siret non obligatoire

dev
부모
커밋
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',[

Loading…
취소
저장