Browse Source

Adaptations backend/point-sale

refactoring
Guillaume Bourgeois 5 years ago
parent
commit
6d37d1bab5
21 changed files with 96 additions and 61 deletions
  1. +8
    -8
      backend/controllers/OrderController.php
  2. +20
    -20
      backend/controllers/PointSaleController.php
  3. +1
    -1
      backend/controllers/SubscriptionController.php
  4. +1
    -1
      backend/views/order/report.php
  5. +3
    -3
      backend/views/point-sale/_form.php
  6. +1
    -1
      backend/views/point-sale/index.php
  7. +1
    -1
      backend/views/point-sale/update.php
  8. +1
    -1
      backend/views/product/_form.php
  9. +1
    -1
      backend/views/subscription/_form.php
  10. +1
    -1
      backend/views/subscription/index.php
  11. +7
    -7
      backend/web/js/lechatdesnoisettes.js
  12. +1
    -1
      common/models/Distribution.php
  13. +3
    -3
      common/models/PointSale.php
  14. +1
    -1
      common/models/PointSaleDistribution.php
  15. +2
    -2
      common/models/Product.php
  16. +2
    -2
      common/models/Subscription.php
  17. +4
    -4
      common/models/SubscriptionForm.php
  18. +2
    -2
      common/models/User.php
  19. +20
    -0
      console/migrations/m181226_131915_rename_columns_saturday_point_sale.php
  20. +15
    -0
      console/migrations/m181226_133031_rename_saturday_user.php
  21. +1
    -1
      producer/views/order/_form.php

+ 8
- 8
backend/controllers/OrderController.php View File

$dateWednesday = date('Y-m-d',strtotime('Wednesday',$start)) ; $dateWednesday = date('Y-m-d',strtotime('Wednesday',$start)) ;
$dateThursday = date('Y-m-d',strtotime('Thursday',$start)) ; $dateThursday = date('Y-m-d',strtotime('Thursday',$start)) ;
$dateFriday = date('Y-m-d',strtotime('Friday',$start)) ; $dateFriday = date('Y-m-d',strtotime('Friday',$start)) ;
$dateSaterday = date('Y-m-d',strtotime('Saturday',$start)) ;
$dateSaturday = date('Y-m-d',strtotime('Saturday',$start)) ;
$dateSunday = date('Y-m-d',strtotime('Sunday',$start)) ; $dateSunday = date('Y-m-d',strtotime('Sunday',$start)) ;
$weekDistribution = Distribution::find() $weekDistribution = Distribution::find()
['date' => $dateWednesday], ['date' => $dateWednesday],
['date' => $dateThursday], ['date' => $dateThursday],
['date' => $dateFriday], ['date' => $dateFriday],
['date' => $dateSaterday],
['date' => $dateSaturday],
['date' => $dateSunday], ['date' => $dateSunday],
]) ])
->one(); ->one();
$filename = 'export_' . $date . '_global'; $filename = 'export_' . $date . '_global';


$dayWeek = date('w', strtotime($date)); $dayWeek = date('w', strtotime($date));
$dayWeekArray = [0 => 'sunday', 1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saterday'];
$dayWeekArray = [0 => 'sunday', 1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saturday'];
$fieldsHoursPointSale = 'infos_' . $dayWeekArray[$dayWeek]; $fieldsHoursPointSale = 'infos_' . $dayWeekArray[$dayWeek];


// par point de vente // par point de vente
} }


$dayWeek = date('w', strtotime($date)); $dayWeek = date('w', strtotime($date));
$dayWeekArray = [0 => 'sunday', 1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saterday'];
$dayWeekArray = [0 => 'sunday', 1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saturday'];
$fieldHoursPointSale = 'infos_' . $dayWeekArray[$dayWeek]; $fieldHoursPointSale = 'infos_' . $dayWeekArray[$dayWeek];




$dateWednesday = date('Y-m-d',strtotime('Wednesday',$start)) ; $dateWednesday = date('Y-m-d',strtotime('Wednesday',$start)) ;
$dateThursday = date('Y-m-d',strtotime('Thursday',$start)) ; $dateThursday = date('Y-m-d',strtotime('Thursday',$start)) ;
$dateFriday = date('Y-m-d',strtotime('Friday',$start)) ; $dateFriday = date('Y-m-d',strtotime('Friday',$start)) ;
$dateSaterday = date('Y-m-d',strtotime('Saturday',$start)) ;
$dateSaturday = date('Y-m-d',strtotime('Saturday',$start)) ;
$dateSunday = date('Y-m-d',strtotime('Sunday',$start)) ; $dateSunday = date('Y-m-d',strtotime('Sunday',$start)) ;
$pointsSaleArray = PointSale::searchAll() ; $pointsSaleArray = PointSale::searchAll() ;
$activeWednesday = false ; $activeWednesday = false ;
$activeThursday = false ; $activeThursday = false ;
$activeFriday = false ; $activeFriday = false ;
$activeSaterday = false ;
$activeSaturday = false ;
$activeSunday = false ; $activeSunday = false ;
foreach($pointsSaleArray as $pointSale) { foreach($pointsSaleArray as $pointSale) {
if($pointSale->delivery_wednesday) $activeWednesday = true ; if($pointSale->delivery_wednesday) $activeWednesday = true ;
if($pointSale->delivery_thursday) $activeThursday = true ; if($pointSale->delivery_thursday) $activeThursday = true ;
if($pointSale->delivery_friday) $activeFriday = true ; if($pointSale->delivery_friday) $activeFriday = true ;
if($pointSale->delivery_saterday) $activeSaterday = true ;
if($pointSale->delivery_saturday) $activeSaturday = true ;
if($pointSale->delivery_sunday) $activeSunday = true ; if($pointSale->delivery_sunday) $activeSunday = true ;
} }
if($activeWednesday || !$active) $this->actionChangeState($activeWednesday, $active, false) ; if($activeWednesday || !$active) $this->actionChangeState($activeWednesday, $active, false) ;
if($activeThursday || !$active) $this->actionChangeState($activeThursday, $active, false) ; if($activeThursday || !$active) $this->actionChangeState($activeThursday, $active, false) ;
if($activeFriday || !$active) $this->actionChangeState($activeFriday, $active, false) ; if($activeFriday || !$active) $this->actionChangeState($activeFriday, $active, false) ;
if($activeSaterday || !$active) $this->actionChangeState($activeSaterday, $active, false) ;
if($activeSaturday || !$active) $this->actionChangeState($activeSaturday, $active, false) ;
if($activeSunday || !$active) $this->actionChangeState($activeSunday, $active, false) ; if($activeSunday || !$active) $this->actionChangeState($activeSunday, $active, false) ;


$this->redirect(['index', 'date' => $date]); $this->redirect(['index', 'date' => $date]);

backend/controllers/PointVenteController.php → backend/controllers/PointSaleController.php View File

/** /**
* PointVenteController implements the CRUD actions for PointVente model. * PointVenteController implements the CRUD actions for PointVente model.
*/ */
class PointVenteController extends BackendController
class PointSaleController extends BackendController
{ {


public function behaviors() public function behaviors()
public function actionIndex() public function actionIndex()
{ {
$dataProvider = new ActiveDataProvider([ $dataProvider = new ActiveDataProvider([
'query' => PointVente::find()->where(['id_etablissement' => Yii::$app->user->identity->id_etablissement])
'query' => PointSale::find()->where(['id_producer' => Producer::getId()])
]); ]);


return $this->render('index', [ return $this->render('index', [
'dataProvider' => $dataProvider,
'dataProvider' => $dataProvider,
]); ]);
} }


*/ */
public function actionCreate() public function actionCreate()
{ {
$model = new PointVente();
$model = new PointSale();


if ($model->load(Yii::$app->request->post()) && $model->save()) { if ($model->load(Yii::$app->request->post()) && $model->save()) {
$model->gestionPointFabrication();
$model->gestionAccesRestreint();
$model->processPointProduction();
$model->processRestrictedAccess();
return $this->redirect(['index']); return $this->redirect(['index']);
} else { } else {
return $this->render('update', array_merge($this->initForm(), [ return $this->render('update', array_merge($this->initForm(), [
'model' => $model,
'model' => $model,
])); ]));
} }
} }
*/ */
public function actionUpdate($id) public function actionUpdate($id)
{ {
$model = PointVente::find()
->with('pointVenteUser')
$model = PointSale::find()
->with('userPointSale')
->where(['id' => $id]) ->where(['id' => $id])
->one(); ->one();


foreach ($model->pointVenteUser as $u) {
$model->users[] = $u->id_user;
$model->users_commentaire[$u->id_user] = $u->commentaire;
foreach ($model->userPointSale as $userPointSale) {
$model->users[] = $userPointSale->id_user;
$model->users_comment[$userPointSale->id_user] = $userPointSale->comment;
} }


if ($model->load(Yii::$app->request->post()) && $model->save()) { if ($model->load(Yii::$app->request->post()) && $model->save()) {
$model->gestionPointFabrication();
$model->gestionAccesRestreint();
$model->processPointProduction();
$model->processRestrictedAccess();
return $this->redirect(['index']); return $this->redirect(['index']);
} else { } else {
return $this->render('update', array_merge($this->initForm($id), [ return $this->render('update', array_merge($this->initForm($id), [
'model' => $model,
'model' => $model,
])); ]));
} }
} }
public function initForm($id = 0) public function initForm($id = 0)
{ {
$users = User::findBy() $users = User::findBy()
->orderBy('name ASC')
->all();
->orderBy('name ASC')
->all();
return [ return [
'users' => $users 'users' => $users
]; ];
public function actionDelete($id) public function actionDelete($id)
{ {
$this->findModel($id)->delete(); $this->findModel($id)->delete();
PointVenteUser::deleteAll(['id_point_vente' => $id]);
ProductionPointVente::deleteAll(['id_point_vente' => $id]) ;
UserPointSale::deleteAll(['id_point_sale' => $id]);
PointSaleDistribution::deleteAll(['id_point_sale' => $id]) ;
return $this->redirect(['index']); return $this->redirect(['index']);
} }


*/ */
protected function findModel($id) protected function findModel($id)
{ {
if (($model = PointVente::findOne($id)) !== null) {
if (($model = PointSale::findOne($id)) !== null) {
return $model; return $model;
} else { } else {
throw new NotFoundHttpException('The requested page does not exist.'); throw new NotFoundHttpException('The requested page does not exist.');

+ 1
- 1
backend/controllers/SubscriptionController.php View File

$model->wednesday = $subscription->wednesday; $model->wednesday = $subscription->wednesday;
$model->thursday = $subscription->thursday; $model->thursday = $subscription->thursday;
$model->friday = $subscription->friday; $model->friday = $subscription->friday;
$model->saterday = $subscription->saterday;
$model->saturday = $subscription->saturday;
$model->sunday = $subscription->sunday; $model->sunday = $subscription->sunday;
$model->auto_payment = $subscription->auto_payment; $model->auto_payment = $subscription->auto_payment;
$model->week_frequency = $subscription->week_frequency; $model->week_frequency = $subscription->week_frequency;

+ 1
- 1
backend/views/order/report.php View File

use common\models\Order ; use common\models\Order ;


$dayWeek = date('w', strtotime($date)); $dayWeek = date('w', strtotime($date));
$dayWeekArray = [0 => 'sunday', 1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saterday'];
$dayWeekArray = [0 => 'sunday', 1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saturday'];
$fieldInfosPointSale = 'infos_' . $dayWeekArray[$dayWeek]; $fieldInfosPointSale = 'infos_' . $dayWeekArray[$dayWeek];


$html = '' ; $html = '' ;

+ 3
- 3
backend/views/point-sale/_form.php View File



<div class="col-md-8"> <div class="col-md-8">
<?= $form->field($model, 'nom')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'locality')->textInput(['maxlength' => 255]) ?> <?= $form->field($model, 'locality')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'address')->textarea(['rows' => 6]) ?> <?= $form->field($model, 'address')->textarea(['rows' => 6]) ?>


<?= $form->field($model, 'delivery_wednesday')->checkbox() ?> <?= $form->field($model, 'delivery_wednesday')->checkbox() ?>
<?= $form->field($model, 'delivery_thursday')->checkbox() ?> <?= $form->field($model, 'delivery_thursday')->checkbox() ?>
<?= $form->field($model, 'delivery_friday')->checkbox() ?> <?= $form->field($model, 'delivery_friday')->checkbox() ?>
<?= $form->field($model, 'delivery_saterday')->checkbox() ?>
<?= $form->field($model, 'delivery_saturday')->checkbox() ?>
<?= $form->field($model, 'delivery_sunday')->checkbox() ?> <?= $form->field($model, 'delivery_sunday')->checkbox() ?>
</div> </div>
<div class="clr"></div> <div class="clr"></div>
<?= $form->field($model, 'infos_wednesday')->textarea(['rows' => 3]) ?> <?= $form->field($model, 'infos_wednesday')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'infos_thursday')->textarea(['rows' => 3]) ?> <?= $form->field($model, 'infos_thursday')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'infos_friday')->textarea(['rows' => 3]) ?> <?= $form->field($model, 'infos_friday')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'infos_saterday')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'infos_saturday')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'infos_sunday')->textarea(['rows' => 3]) ?> <?= $form->field($model, 'infos_sunday')->textarea(['rows' => 3]) ?>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">

+ 1
- 1
backend/views/point-sale/index.php View File

'attribute' => 'point_production', 'attribute' => 'point_production',
'format' => 'raw', 'format' => 'raw',
'value' => function($model) { 'value' => function($model) {
if($model->point_fabrication)
if($model->point_production)
{ {
return '<span class="label label-success">Oui</span>' ; return '<span class="label label-success">Oui</span>' ;
} }

+ 1
- 1
backend/views/point-sale/update.php View File



$this->title = 'Modifier un point de vente'; $this->title = 'Modifier un point de vente';
$this->params['breadcrumbs'][] = ['label' => 'Points de vente', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => 'Points de vente', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => Html::encode($model->nom), 'url' => ['update', 'id' => $model->id]];
$this->params['breadcrumbs'][] = ['label' => Html::encode($model->name), 'url' => ['update', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Modifier'; $this->params['breadcrumbs'][] = 'Modifier';
?> ?>
<div class="point-sale-update"> <div class="point-sale-update">

+ 1
- 1
backend/views/product/_form.php View File

<?= $form->field($model, 'wednesday')->checkbox() ?> <?= $form->field($model, 'wednesday')->checkbox() ?>
<?= $form->field($model, 'thursday')->checkbox() ?> <?= $form->field($model, 'thursday')->checkbox() ?>
<?= $form->field($model, 'friday')->checkbox() ?> <?= $form->field($model, 'friday')->checkbox() ?>
<?= $form->field($model, 'saterday')->checkbox() ?>
<?= $form->field($model, 'saturday')->checkbox() ?>
<?= $form->field($model, 'sunday')->checkbox() ?> <?= $form->field($model, 'sunday')->checkbox() ?>
</div> </div>
<div class="clr"></div> <div class="clr"></div>

+ 1
- 1
backend/views/subscription/_form.php View File

<?= $form->field($model, 'wednesday')->checkbox() ?> <?= $form->field($model, 'wednesday')->checkbox() ?>
<?= $form->field($model, 'thursday')->checkbox() ?> <?= $form->field($model, 'thursday')->checkbox() ?>
<?= $form->field($model, 'friday')->checkbox() ?> <?= $form->field($model, 'friday')->checkbox() ?>
<?= $form->field($model, 'saterday')->checkbox() ?>
<?= $form->field($model, 'saturday')->checkbox() ?>
<?= $form->field($model, 'sunday')->checkbox() ?> <?= $form->field($model, 'sunday')->checkbox() ?>
</div> </div>
<div class="clr"></div> <div class="clr"></div>

+ 1
- 1
backend/views/subscription/index.php View File

$html .= 'jeudi, ' ; $html .= 'jeudi, ' ;
if($model->friday) if($model->friday)
$html .= 'vendredi, ' ; $html .= 'vendredi, ' ;
if($model->saterday)
if($model->saturday)
$html .= 'samedi, ' ; $html .= 'samedi, ' ;
if($model->sunday) if($model->sunday)
$html .= 'dimanche, ' ; $html .= 'dimanche, ' ;

+ 7
- 7
backend/web/js/lechatdesnoisettes.js View File



function chat_points_vente_acces() { function chat_points_vente_acces() {
// affichage du bloc acces restreint // affichage du bloc acces restreint
$('#pointvente-acces_restreint').change(function() {
$('#pointsale-restricted_access').change(function() {
chat_points_vente_acces_event() ; chat_points_vente_acces_event() ;
}) ; }) ;
chat_points_vente_acces_event() ; chat_points_vente_acces_event() ;
// affichage du champs commentaire // affichage du champs commentaire
$('#pointvente-users input[type=checkbox]').change(function() {
$('#pointsale-users input[type=checkbox]').change(function() {
chat_points_vente_commentaire_event() ; chat_points_vente_commentaire_event() ;
}) ; }) ;
chat_points_vente_commentaire_event() ; chat_points_vente_commentaire_event() ;
} }


function chat_points_vente_commentaire_event() { function chat_points_vente_commentaire_event() {
$('#pointvente-users input[type=checkbox]').each(function() {
$('#pointsale-users input[type=checkbox]').each(function() {
if($(this).prop('checked')) { if($(this).prop('checked')) {
$(this).parent().find('.commentaire').fadeIn() ; $(this).parent().find('.commentaire').fadeIn() ;
} }
} }


function chat_points_vente_acces_event() { function chat_points_vente_acces_event() {
if($('#pointvente-acces_restreint').prop('checked')) {
$('#pointvente-users').fadeIn() ;
if($('#pointsale-restricted_access').prop('checked')) {
$('#pointsale-users').fadeIn() ;
} }
else { else {
$('#pointvente-users').hide() ;
$('#pointsale-users').hide() ;
} }
} }


function chat_select_etablissement() { function chat_select_etablissement() {
$('select[name="select_etablissement"]').change(function() {
$('select[name="select_producer"]').change(function() {
window.location.href = UrlManager.getBaseUrlAbsolute()+'/site/change-producer?id='+$(this).val() ; window.location.href = UrlManager.getBaseUrlAbsolute()+'/site/change-producer?id='+$(this).val() ;
}) ; }) ;
} }

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

if ($product->active && $dayDistribution == 5 && $product->friday) { if ($product->active && $dayDistribution == 5 && $product->friday) {
$productDistribution->active = 1; $productDistribution->active = 1;
} }
if ($product->active && $dayDistribution == 6 && $product->saterday) {
if ($product->active && $dayDistribution == 6 && $product->saturday) {
$productDistribution->active = 1; $productDistribution->active = 1;
} }
if ($product->active && $dayDistribution == 7 && $product->sunday) { if ($product->active && $dayDistribution == 7 && $product->sunday) {

+ 3
- 3
common/models/PointSale.php View File

[['name', 'code'], 'string', 'max' => 255], [['name', 'code'], 'string', 'max' => 255],
[['address', 'locality', 'infos_monday', 'infos_tuesday', [['address', 'locality', 'infos_monday', 'infos_tuesday',
'infos_wednesday', 'infos_thursday', 'infos_friday', 'infos_wednesday', 'infos_thursday', 'infos_friday',
'infos_saterday', 'infos_sunday'], 'string'],
'infos_saturday', 'infos_sunday'], 'string'],
[['point_production', 'credit', 'delivery_monday', 'delivery_tuesday', [['point_production', 'credit', 'delivery_monday', 'delivery_tuesday',
'delivery_wednesday', 'delivery_thursday', 'delivery_friday', 'delivery_wednesday', 'delivery_thursday', 'delivery_friday',
'delivery_saterday', 'delivery_sunday'], 'boolean'],
'delivery_saturday', 'delivery_sunday'], 'boolean'],
['point_production', 'default', 'value' => 0], ['point_production', 'default', 'value' => 0],
['id_producer', 'integer'], ['id_producer', 'integer'],
['id_producer', 'required'], ['id_producer', 'required'],
if($this->delivery_wednesday) $str .= 'mercredi, ' ; if($this->delivery_wednesday) $str .= 'mercredi, ' ;
if($this->delivery_thursday) $str .= 'jeudi, ' ; if($this->delivery_thursday) $str .= 'jeudi, ' ;
if($this->delivery_friday) $str .= 'vendredi, ' ; if($this->delivery_friday) $str .= 'vendredi, ' ;
if($this->delivery_saterday) $str .= 'samedi, ' ;
if($this->delivery_saturday) $str .= 'samedi, ' ;
if($this->delivery_sunday) $str .= 'dimanche, ' ; if($this->delivery_sunday) $str .= 'dimanche, ' ;


if(strlen($str)) { if(strlen($str)) {

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

($day == 3 && $pointSaleDistribution->pointSale->delivery_wednesday) || ($day == 3 && $pointSaleDistribution->pointSale->delivery_wednesday) ||
($day == 4 && $pointSaleDistribution->pointSale->delivery_thursday) || ($day == 4 && $pointSaleDistribution->pointSale->delivery_thursday) ||
($day == 5 && $pointSaleDistribution->pointSale->delivery_friday) || ($day == 5 && $pointSaleDistribution->pointSale->delivery_friday) ||
($day == 6 && $pointSaleDistribution->pointSale->delivery_saterday) ||
($day == 6 && $pointSaleDistribution->pointSale->delivery_saturday) ||
($day == 7 && $pointSaleDistribution->pointSale->delivery_sunday) || ($day == 7 && $pointSaleDistribution->pointSale->delivery_sunday) ||
$pointSaleDistribution->pointSale->point_production $pointSaleDistribution->pointSale->point_production
)) { )) {

+ 2
- 2
common/models/Product.php View File

return [ return [
[['name', 'id_producer'], 'required'], [['name', 'id_producer'], 'required'],
[['active', 'order', 'quantity_max', 'id_producer'], 'integer'], [['active', 'order', 'quantity_max', 'id_producer'], 'integer'],
[['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saterday', 'sunday', 'unavailable'], 'boolean'],
[['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday', 'unavailable'], 'boolean'],
[['price', 'weight'], 'number'], [['price', 'weight'], 'number'],
[[ 'photo'], 'file'], [[ 'photo'], 'file'],
[['name', 'description', 'photo'], 'string', 'max' => 255], [['name', 'description', 'photo'], 'string', 'max' => 255],
'wednesday' => 'Mercredi', 'wednesday' => 'Mercredi',
'thursday' => 'Jeudi', 'thursday' => 'Jeudi',
'friday' => 'Vendredi', 'friday' => 'Vendredi',
'saterday' => 'Samedi',
'saturday' => 'Samedi',
'sunday' => 'Dimanche', 'sunday' => 'Dimanche',
'order' => 'Ordre', 'order' => 'Ordre',
'quantity_max' => 'Quantité max par défaut', 'quantity_max' => 'Quantité max par défaut',

+ 2
- 2
common/models/Subscription.php View File

return [ return [
[['id_producer', 'id_point_sale'], 'required'], [['id_producer', 'id_point_sale'], 'required'],
[['id_user', 'id_producer', 'id_point_sale', 'monday', 'tuesday', [['id_user', 'id_producer', 'id_point_sale', 'monday', 'tuesday',
'wednesday', 'thursday', 'friday', 'saterday', 'sunday', 'week_frequency'], 'integer'],
'wednesday', 'thursday', 'friday', 'saturday', 'sunday', 'week_frequency'], 'integer'],
[['auto_payment'], 'boolean'], [['auto_payment'], 'boolean'],
[['date_begin', 'date_end', 'username'], 'safe'], [['date_begin', 'date_end', 'username'], 'safe'],
]; ];
'wednesday' => 'Mercredi', 'wednesday' => 'Mercredi',
'thursday' => 'Jeudi', 'thursday' => 'Jeudi',
'friday' => 'Vendredi', 'friday' => 'Vendredi',
'saterday' => 'Samedi',
'saturday' => 'Samedi',
'sunday' => 'Dimanche', 'sunday' => 'Dimanche',
'week_frequency' => 'Périodicité', 'week_frequency' => 'Périodicité',
'auto_payment' => 'Paiement automatique' 'auto_payment' => 'Paiement automatique'

+ 4
- 4
common/models/SubscriptionForm.php View File

public $wednesday; public $wednesday;
public $thursday; public $thursday;
public $friday; public $friday;
public $saterday;
public $saturday;
public $sunday; public $sunday;
public $week_frequency; public $week_frequency;
public $products; public $products;
return [ return [
[['id_producer', 'week_frequency', 'id_point_sale'], 'integer'], [['id_producer', 'week_frequency', 'id_point_sale'], 'integer'],
[['date_begin', 'date_end'], 'date', 'format' => 'php:d/m/Y'], [['date_begin', 'date_end'], 'date', 'format' => 'php:d/m/Y'],
[['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saterday', 'sunday', 'auto_payment'], 'boolean'],
[['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday', 'auto_payment'], 'boolean'],
[['id_point_sale', 'id_producer', 'date_begin'], 'required', 'message' => 'Champs obligatoire'], [['id_point_sale', 'id_producer', 'date_begin'], 'required', 'message' => 'Champs obligatoire'],
[['products', 'id_user', 'username'], 'safe'], [['products', 'id_user', 'username'], 'safe'],
['id_user', function ($attribute, $params) { ['id_user', function ($attribute, $params) {
'wednesday' => 'Mercredi', 'wednesday' => 'Mercredi',
'thursday' => 'Jeudi', 'thursday' => 'Jeudi',
'friday' => 'Vendredi', 'friday' => 'Vendredi',
'saterday' => 'Samedi',
'saturday' => 'Samedi',
'sunday' => 'Dimanche', 'sunday' => 'Dimanche',
'week_frequency' => 'Périodicité (semaines)', 'week_frequency' => 'Périodicité (semaines)',
'username' => 'Nom d\'utilisateur', 'username' => 'Nom d\'utilisateur',
$subscription->wednesday = $this->wednesday; $subscription->wednesday = $this->wednesday;
$subscription->thursday = $this->thursday; $subscription->thursday = $this->thursday;
$subscription->friday = $this->friday; $subscription->friday = $this->friday;
$subscription->saterday = $this->saterday;
$subscription->saturday = $this->saturday;
$subscription->sunday = $this->sunday; $subscription->sunday = $this->sunday;
$subscription->week_frequency = $this->week_frequency; $subscription->week_frequency = $this->week_frequency;
$subscription->auto_payment = $this->auto_payment; $subscription->auto_payment = $this->auto_payment;

+ 2
- 2
common/models/User.php View File

public function rules() public function rules()
{ {
return [ return [
[['no_mail', 'mail_distribution_monday', 'mail_distribution_tuesday', 'mail_distribution_wednesday', 'mail_distribution_thursday', 'mail_distribution_friday', 'mail_distribution_saterday', 'mail_distribution_sunday'], 'boolean'],
[['no_mail', 'mail_distribution_monday', 'mail_distribution_tuesday', 'mail_distribution_wednesday', 'mail_distribution_thursday', 'mail_distribution_friday', 'mail_distribution_saturday', 'mail_distribution_sunday'], 'boolean'],
[['lastname', 'name', 'phone', 'address'], 'string'], [['lastname', 'name', 'phone', 'address'], 'string'],
[['lastname', 'name'], 'required', 'message' => 'Ce champs ne peut être vide'], [['lastname', 'name'], 'required', 'message' => 'Ce champs ne peut être vide'],
['email', 'email', 'message' => 'Cette adresse email n\'est pas valide'], ['email', 'email', 'message' => 'Cette adresse email n\'est pas valide'],
'mail_distribution_wednesday' => 'Mercredi', 'mail_distribution_wednesday' => 'Mercredi',
'mail_distribution_thursday' => 'Jeudi', 'mail_distribution_thursday' => 'Jeudi',
'mail_distribution_friday' => 'Vendredi', 'mail_distribution_friday' => 'Vendredi',
'mail_distribution_saterday' => 'Samedi',
'mail_distribution_saturday' => 'Samedi',
'mail_distribution_sunday' => 'Dimanche', 'mail_distribution_sunday' => 'Dimanche',
'password_old' => 'Ancien mot de passe', 'password_old' => 'Ancien mot de passe',
'password_new' => 'Nouveau mot de passe', 'password_new' => 'Nouveau mot de passe',

+ 20
- 0
console/migrations/m181226_131915_rename_columns_saturday_point_sale.php View File

<?php

use yii\db\Migration;

class m181226_131915_rename_columns_saturday_point_sale extends Migration {

public function up() {
$this->renameColumn('point_sale', 'delivery_saterday', 'delivery_saturday') ;
$this->renameColumn('point_sale', 'infos_saterday', 'infos_saturday') ;
$this->renameColumn('subscription', 'saterday', 'saturday') ;
$this->renameColumn('product', 'saterday', 'saturday') ;
}

public function down() {
$this->renameColumn('point_sale', 'delivery_saturday', 'delivery_saterday') ;
$this->renameColumn('point_sale', 'infos_saturday', 'infos_saterday') ;
$this->renameColumn('subscription', 'saturday', 'saterday') ;
$this->renameColumn('product', 'saturday', 'saterday') ;
}
}

+ 15
- 0
console/migrations/m181226_133031_rename_saturday_user.php View File

<?php

use yii\db\Migration;

class m181226_133031_rename_saturday_user extends Migration {

public function up() {
$this->renameColumn('user', 'mail_distribution_saterday', 'mail_distribution_saturday');
}

public function down() {
$this->renameColumn('user', 'mail_distribution_saturday', 'mail_distribution_saterday');
}

}

+ 1
- 1
producer/views/order/_form.php View File

'<div class="jour jour-3">' . $pointSale->getStrInfos('wednesday') . '</div>' . '<div class="jour jour-3">' . $pointSale->getStrInfos('wednesday') . '</div>' .
'<div class="jour jour-4">' . $pointSale->getStrInfos('thursday') . '</div>' . '<div class="jour jour-4">' . $pointSale->getStrInfos('thursday') . '</div>' .
'<div class="jour jour-5">' . $pointSale->getStrInfos('friday') . '</div>' . '<div class="jour jour-5">' . $pointSale->getStrInfos('friday') . '</div>' .
'<div class="jour jour-6">' . $pointSale->getStrInfos('saterday') . '</div>' .
'<div class="jour jour-6">' . $pointSale->getStrInfos('saturday') . '</div>' .
'<div class="jour jour-0">' . $pointSale->getStrInfos('sunday') . '</div>' . '<div class="jour jour-0">' . $pointSale->getStrInfos('sunday') . '</div>' .
'</div>' ; '</div>' ;
} }

Loading…
Cancel
Save