|
|
@@ -46,7 +46,8 @@ use common\models\CommandeAutoProduit; |
|
|
|
/** |
|
|
|
* Login form |
|
|
|
*/ |
|
|
|
class CommandeAutoForm extends Model { |
|
|
|
class CommandeAutoForm extends Model |
|
|
|
{ |
|
|
|
|
|
|
|
public $id; |
|
|
|
public $id_user; |
|
|
@@ -69,7 +70,8 @@ class CommandeAutoForm extends Model { |
|
|
|
/** |
|
|
|
* @inheritdoc |
|
|
|
*/ |
|
|
|
public function rules() { |
|
|
|
public function rules() |
|
|
|
{ |
|
|
|
return [ |
|
|
|
[['id_etablissement', 'periodicite_semaine', 'id_point_vente'], 'integer'], |
|
|
|
[['date_debut', 'date_fin'], 'date', 'format' => 'php:d/m/Y'], |
|
|
@@ -84,7 +86,8 @@ class CommandeAutoForm extends Model { |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
public function attributeLabels() { |
|
|
|
public function attributeLabels() |
|
|
|
{ |
|
|
|
return [ |
|
|
|
'id' => 'ID', |
|
|
|
'id_user' => 'Utilisateur', |
|
|
@@ -105,10 +108,17 @@ class CommandeAutoForm extends Model { |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
public function save() { |
|
|
|
/** |
|
|
|
* Enregistre la CommandeAuto. |
|
|
|
* |
|
|
|
* @return boolean |
|
|
|
*/ |
|
|
|
public function save() |
|
|
|
{ |
|
|
|
if ($this->id) { |
|
|
|
$commandeauto = CommandeAuto::findOne($this->id); |
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
$commandeauto = new CommandeAuto; |
|
|
|
} |
|
|
|
|
|
|
@@ -117,9 +127,15 @@ class CommandeAutoForm extends Model { |
|
|
|
$commandeauto->username = $this->username; |
|
|
|
$commandeauto->id_etablissement = $this->id_etablissement; |
|
|
|
$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)) { |
|
|
|
$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->mardi = $this->mardi; |
|
|
@@ -149,7 +165,6 @@ class CommandeAutoForm extends Model { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
|