From 6f4cc3afffde36a13618458ffda72e6104624f36 Mon Sep 17 00:00:00 2001 From: polo Date: Wed, 30 Aug 2023 12:20:39 +0200 Subject: =?UTF-8?q?section=20client=20=C3=A0=20part,=20section=20modif=20e?= =?UTF-8?q?n=20cours,=20bug=20dans=20Dates,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/Prestations.php | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'src/model/Prestations.php') diff --git a/src/model/Prestations.php b/src/model/Prestations.php index 22865df..fe09133 100644 --- a/src/model/Prestations.php +++ b/src/model/Prestations.php @@ -11,8 +11,6 @@ class Prestations extends Model protected $type_presta = ''; protected $mode_paiement = ''; protected $commentaires = ''; - - //~ use ModelChildren; public function __construct(int $ID_client) { @@ -29,6 +27,16 @@ class Prestations extends Model { return $this->ID_client; } + public function getIDsByIdClient() // obtenir une entrée avec son ID_client + { + $IDs = $this->execQuery('SELECT id FROM ' . $this->table . ' WHERE id_client = ' . $this->ID_client)->fetchAll(); + // changer le tableau de tableaux en tableau simple + for($i = 0; $i < count($IDs); $i++) + { + $IDs[$i] = $IDs[$i]['ID']; + } + return($IDs); + } public function getCodePresta(): string { return $this->code_presta; @@ -41,6 +49,18 @@ class Prestations extends Model { return $this->type_presta; } + public function getAllWithWindowFields(): array // différent de Model::getAll() qui retourne get_object_vars($this) + { + $code_presta_tableau = explode('-', $this->code_presta); + $Date = new Dates($this->date); + + return [ + "Numéro prestation:" => end($code_presta_tableau), // dernière case + "Date:" => $Date->getDate(), + "Type de Presta:" => $this->type_presta, + "Mode de paiement:" => $this->mode_paiement, + "Commentaires:" => $this->commentaires]; + } // setters //~ public function setID() -> dans le trait ModelChildren @@ -81,7 +101,7 @@ class Prestations extends Model return $this; } - // code client = année-mois-jour-codeclient-combientièmefois + // code client = année-mois-jour-codeclient-typedepresta-combientièmefois public function makeCodePresta(Dates $Date, string $code_client) { // on récupère un tableau contenant toutes les prestations d'un client tous types confondus (devis, facture, cesu, location, enregistrement sans vente) -- cgit v1.2.3