@@ -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')); |
@@ -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 ; |