Browse Source

Correction : Etablissement::getConfig pas adapté quand l'utilisateur n'est pas un boulanger

prodstable
keun 7 years ago
parent
commit
f96db078de
2 changed files with 7 additions and 4 deletions
  1. +2
    -2
      common/models/Commande.php
  2. +5
    -2
      common/models/Etablissement.php

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

@@ -387,8 +387,8 @@ class Commande extends \yii\db\ActiveRecord
public function getEtat()
{
$delai_commande = Etablissement::getConfig('delai_commande') ;
$heure_limite = Etablissement::getConfig('heure_limite_commande') ;
$delai_commande = Etablissement::getConfig('delai_commande',$this->production->id_etablissement) ;
$heure_limite = Etablissement::getConfig('heure_limite_commande',$this->production->id_etablissement) ;
$date_commande = strtotime($this->date) ;
$date_today = strtotime(date('Y-m-d'));

+ 5
- 2
common/models/Etablissement.php View File

@@ -226,11 +226,14 @@ class Etablissement extends \yii\db\ActiveRecord
return $this->getFacture(date('Y-m', strtotime('-1 month'))) ;
}
public static function getConfig($config = '')
public static function getConfig($config = '', $id_etablissement = 0)
{
if(strlen($config))
{
$etablissement = self::findOne(Yii::$app->user->identity->id_etablissement) ;
if(!$id_etablissement)
$id_etablissement = Yii::$app->user->identity->id_etablissement ;
$etablissement = self::findOne($id_etablissement) ;
if($etablissement)
{
return $etablissement->$config ;

Loading…
Cancel
Save