public function getEtat() | 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_commande = strtotime($this->date) ; | ||||
$date_today = strtotime(date('Y-m-d')); | $date_today = strtotime(date('Y-m-d')); |
return $this->getFacture(date('Y-m', strtotime('-1 month'))) ; | 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)) | 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) | if($etablissement) | ||||
{ | { | ||||
return $etablissement->$config ; | return $etablissement->$config ; |