|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Login form |
|
|
* Login form |
|
|
*/ |
|
|
*/ |
|
|
class CommandeAutoForm extends Model { |
|
|
|
|
|
|
|
|
class CommandeAutoForm extends Model |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
public $id; |
|
|
public $id; |
|
|
public $id_user; |
|
|
public $id_user; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @inheritdoc |
|
|
* @inheritdoc |
|
|
*/ |
|
|
*/ |
|
|
public function rules() { |
|
|
|
|
|
|
|
|
public function rules() |
|
|
|
|
|
{ |
|
|
return [ |
|
|
return [ |
|
|
[['id_etablissement', 'periodicite_semaine', 'id_point_vente'], 'integer'], |
|
|
[['id_etablissement', 'periodicite_semaine', 'id_point_vente'], 'integer'], |
|
|
[['date_debut', 'date_fin'], 'date', 'format' => 'php:d/m/Y'], |
|
|
[['date_debut', 'date_fin'], 'date', 'format' => 'php:d/m/Y'], |
|
|
|
|
|
|
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function attributeLabels() { |
|
|
|
|
|
|
|
|
public function attributeLabels() |
|
|
|
|
|
{ |
|
|
return [ |
|
|
return [ |
|
|
'id' => 'ID', |
|
|
'id' => 'ID', |
|
|
'id_user' => 'Utilisateur', |
|
|
'id_user' => 'Utilisateur', |
|
|
|
|
|
|
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function save() { |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Enregistre la CommandeAuto. |
|
|
|
|
|
* |
|
|
|
|
|
* @return boolean |
|
|
|
|
|
*/ |
|
|
|
|
|
public function save() |
|
|
|
|
|
{ |
|
|
if ($this->id) { |
|
|
if ($this->id) { |
|
|
$commandeauto = CommandeAuto::findOne($this->id); |
|
|
$commandeauto = CommandeAuto::findOne($this->id); |
|
|
} else { |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
$commandeauto = new CommandeAuto; |
|
|
$commandeauto = new CommandeAuto; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$commandeauto->username = $this->username; |
|
|
$commandeauto->username = $this->username; |
|
|
$commandeauto->id_etablissement = $this->id_etablissement; |
|
|
$commandeauto->id_etablissement = $this->id_etablissement; |
|
|
$commandeauto->id_point_vente = $this->id_point_vente; |
|
|
$commandeauto->id_point_vente = $this->id_point_vente; |
|
|
$commandeauto->date_debut = date('Y-m-d', strtotime(str_replace('/', '-', $this->date_debut))); |
|
|
|
|
|
|
|
|
$commandeauto->date_debut = date( |
|
|
|
|
|
'Y-m-d', |
|
|
|
|
|
strtotime(str_replace('/', '-', $this->date_debut) |
|
|
|
|
|
)); |
|
|
if (strlen($this->date_fin)) { |
|
|
if (strlen($this->date_fin)) { |
|
|
$commandeauto->date_fin = date('Y-m-d', strtotime(str_replace('/', '-', $this->date_fin))); |
|
|
|
|
|
|
|
|
$commandeauto->date_fin = date( |
|
|
|
|
|
'Y-m-d', |
|
|
|
|
|
strtotime(str_replace('/', '-', $this->date_fin) |
|
|
|
|
|
)); |
|
|
} |
|
|
} |
|
|
$commandeauto->lundi = $this->lundi; |
|
|
$commandeauto->lundi = $this->lundi; |
|
|
$commandeauto->mardi = $this->mardi; |
|
|
$commandeauto->mardi = $this->mardi; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|