diff options
Diffstat (limited to 'src/model/Prestations.php')
-rw-r--r-- | src/model/Prestations.php | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/model/Prestations.php b/src/model/Prestations.php index 54ad4b7..8591e83 100644 --- a/src/model/Prestations.php +++ b/src/model/Prestations.php | |||
@@ -28,13 +28,19 @@ class Prestations extends Model | |||
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 | 31 | public function getIDsByIdClient() // obtenir une entrée avec son ID_client, comportement différent si le type est connu |
32 | { | 32 | { |
33 | $IDs = $this->execQuery('SELECT id FROM ' . $this->table . ' WHERE id_client = ' . $this->ID_client)->fetchAll(); | 33 | $sql = 'SELECT id FROM ' . $this->table . ' WHERE id_client = ' . $this->ID_client; |
34 | // changer le tableau de tableaux en tableau simple | 34 | if($this->type_presta != '') |
35 | for($i = 0; $i < count($IDs); $i++) | ||
36 | { | 35 | { |
37 | $IDs[$i] = $IDs[$i]['ID']; | 36 | $sql .= " AND type_presta = '" . $this->type_presta . "'"; |
37 | } | ||
38 | $data = $this->execQuery($sql)->fetchAll(); // tableau de tableaux | ||
39 | |||
40 | $IDs = []; // si $IDs reste vide, ne pas être de type NULL | ||
41 | for($i = 0; $i < count($data); $i++) | ||
42 | { | ||
43 | $IDs[$i] = $data[$i]['ID']; // tableau simple | ||
38 | } | 44 | } |
39 | return($IDs); | 45 | return($IDs); |
40 | } | 46 | } |
@@ -152,7 +158,7 @@ class Prestations extends Model | |||
152 | } | 158 | } |
153 | } | 159 | } |
154 | 160 | ||
155 | class CodePresta extends Prestations | 161 | //~ class CodePresta extends Prestations |
156 | { | 162 | //~ { |
157 | protected $numero_presta; | 163 | //~ protected $numero_presta; |
158 | } | 164 | //~ } |