summaryrefslogtreecommitdiff
path: root/src/model/Prestations.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/Prestations.php')
-rw-r--r--src/model/Prestations.php28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/model/Prestations.php b/src/model/Prestations.php
index 1666018..3a415be 100644
--- a/src/model/Prestations.php
+++ b/src/model/Prestations.php
@@ -4,8 +4,8 @@
4class Prestations extends Model 4class Prestations extends Model
5{ 5{
6 // lecture des données ou hydratation 6 // lecture des données ou hydratation
7 protected $ID; // auto-incrémentée 7 protected $id; // auto-incrémentée
8 protected $ID_client = 0; 8 protected $id_client = 0;
9 protected $code_presta = ''; 9 protected $code_presta = '';
10 protected $date = 0; // timestamp unix 10 protected $date = 0; // timestamp unix
11 protected $type_presta = ''; 11 protected $type_presta = '';
@@ -13,24 +13,24 @@ class Prestations extends Model
13 protected $commentaires = ''; 13 protected $commentaires = '';
14 //protected $numero_presta = 0; 14 //protected $numero_presta = 0;
15 15
16 public function __construct(int $ID_client) 16 public function __construct(int $id_client)
17 { 17 {
18 $this->ID_client = $ID_client; 18 $this->id_client = $id_client;
19 $this->table = strtolower(__CLASS__); // prestations 19 $this->table = strtolower(__CLASS__); // prestations
20 } 20 }
21 21
22 // getters 22 // getters
23 public function getID(): int 23 public function getId(): int
24 { 24 {
25 return $this->ID; 25 return $this->id;
26 } 26 }
27 public function getIDClient(): int 27 public function getIdClient(): int
28 { 28 {
29 return $this->ID_client; 29 return $this->id_client;
30 } 30 }
31 public function getIDsByIdClient() // obtenir une entrée avec son ID_client, comportement différent si le type est connu 31 public function getIdsByIdClient() // obtenir une entrée avec son id_client, comportement différent si le type est connu
32 { 32 {
33 $sql = 'SELECT id FROM ' . $this->table . ' WHERE id_client = ' . $this->ID_client; 33 $sql = 'SELECT id FROM ' . $this->table . ' WHERE id_client = ' . $this->id_client;
34 if($this->type_presta != '') 34 if($this->type_presta != '')
35 { 35 {
36 $sql .= " AND type_presta = '" . $this->type_presta . "'"; 36 $sql .= " AND type_presta = '" . $this->type_presta . "'";
@@ -40,7 +40,7 @@ class Prestations extends Model
40 $IDs = []; // si $IDs reste vide, ne pas être de type NULL 40 $IDs = []; // si $IDs reste vide, ne pas être de type NULL
41 for($i = 0; $i < count($data); $i++) 41 for($i = 0; $i < count($data); $i++)
42 { 42 {
43 $IDs[$i] = $data[$i]['ID']; // tableau simple 43 $IDs[$i] = $data[$i]['id']; // tableau simple
44 } 44 }
45 return($IDs); 45 return($IDs);
46 } 46 }
@@ -92,9 +92,9 @@ class Prestations extends Model
92 } 92 }
93 93
94 // setters 94 // setters
95 public function setIDClient(int $value) 95 public function setIdClient(int $value)
96 { 96 {
97 $this->ID_client = $value; 97 $this->id_client = $value;
98 return $this; 98 return $this;
99 } 99 }
100 //~ public function setCombientiemeFois(int $value) 100 //~ public function setCombientiemeFois(int $value)
@@ -152,7 +152,7 @@ class Prestations extends Model
152 { 152 {
153 // on récupère un tableau contenant toutes les prestations d'un client tous types confondus (devis, facture, cesu, location, enregistrement sans vente) 153 // on récupère un tableau contenant toutes les prestations d'un client tous types confondus (devis, facture, cesu, location, enregistrement sans vente)
154 // inconvénient: il peut y avoir plusieurs prestations avec le même numéro au compteur, à améliorer 154 // inconvénient: il peut y avoir plusieurs prestations avec le même numéro au compteur, à améliorer
155 $combientieme_fois = count($this->find(['ID_client' => $this->ID_client])) + 1; 155 $combientieme_fois = count($this->find(['id_client' => $this->id_client])) + 1;
156 156
157 $array_code = [$Date->getYear(), $Date->getMonth(), $Date->getDay(), $code_client, $this->type_presta, $combientieme_fois]; 157 $array_code = [$Date->getYear(), $Date->getMonth(), $Date->getDay(), $code_client, $this->type_presta, $combientieme_fois];
158 $this->code_presta = implode('-', $array_code); 158 $this->code_presta = implode('-', $array_code);