From b9c74de6d12ef40ab4baf67303ab22a10fcd5b32 Mon Sep 17 00:00:00 2001 From: polo Date: Sat, 25 Feb 2023 17:30:20 +0100 Subject: =?UTF-8?q?document=20locations,=20correction=20de=20pas=20mal=20d?= =?UTF-8?q?e=20probl=C3=A8mes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/Locations.php | 5 ++--- src/model/Model.php | 6 +++--- src/model/Prestations.php | 2 +- src/model/StructTablesDB.php | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src/model') diff --git a/src/model/Locations.php b/src/model/Locations.php index 8ebf757..149c1f1 100644 --- a/src/model/Locations.php +++ b/src/model/Locations.php @@ -54,10 +54,9 @@ class Locations extends Model $this->etat_des_lieux_fin = $value; return($this); } - public function setDureeLocation($value) + public function setDureeLocation(string $value) { - $value = str_replace(',', '.', $value); - $this->duree_location = (float) $value; + $this->duree_location = $value; return($this); } public function setLoyerMensuel($value) diff --git a/src/model/Model.php b/src/model/Model.php index 6a7907c..9039aa6 100644 --- a/src/model/Model.php +++ b/src/model/Model.php @@ -7,11 +7,11 @@ abstract class Model extends DB protected $table; // <= enfant //static protected $tableStructure; - public function __construct() // à surcharger - { + //~ public function __construct() // à surcharger + //~ { //~ $this->table = strtolower(__CLASS__); //~ echo "TABLE = " . $this->table . "\n"; - } + //~ } // getters public function getTable(): string diff --git a/src/model/Prestations.php b/src/model/Prestations.php index ddd785b..2011dbe 100644 --- a/src/model/Prestations.php +++ b/src/model/Prestations.php @@ -95,7 +95,7 @@ class Prestations extends Model // on récupère un tableau contenant toutes les prestations d'un client tous types confondus (devis, facture, cesu, location, enregistrement sans vente) $combientieme_fois = count($this->find(['ID_client' => $this->ID_client])) + 1; - $array_code = [$Date->getYear(), $Date->getMonth(), $Date->getDay(), $code_client, $combientieme_fois]; + $array_code = [$Date->getYear(), $Date->getMonth(), $Date->getDay(), $code_client, $this->type_presta, $combientieme_fois]; $this->code_presta = implode('-', $array_code); } } diff --git a/src/model/StructTablesDB.php b/src/model/StructTablesDB.php index 32ae92d..b1e3c7a 100644 --- a/src/model/StructTablesDB.php +++ b/src/model/StructTablesDB.php @@ -14,7 +14,7 @@ class StructTablesDB 'devis' => ['ID' => 'INTEGER', 'ID_presta' => 'INTEGER', 'taches' => 'TEXT', 'total_main_d_oeuvre' => 'REAL', 'pieces' => 'TEXT', 'total_pieces' => 'REAL', 'deplacement' => 'REAL', 'total_HT' => 'REAL', 'delai_livraison' => 'TEXT', 'validite_devis' => 'TEXT', 'signature_devis' => 'TEXT'], 'factures' => ['ID' => 'INTEGER', 'ID_presta' => 'INTEGER', 'taches' => 'TEXT', 'machine' => 'TEXT', 'OS' => 'TEXT', 'donnees' => 'TEXT', 'cles_licences' => 'TEXT', 'total_main_d_oeuvre' => 'REAL', 'pieces' => 'TEXT', 'total_pieces' => 'REAL', 'deplacement' => 'REAL', 'total_HT' => 'REAL'], 'cesu' => ['ID' => 'INTEGER', 'ID_presta' => 'INTEGER', 'taches' => 'TEXT', 'duree_travail' => 'TEXT', 'salaire' => 'REAL'], - 'locations' => ['ID' => 'INTEGER', 'ID_presta' => 'INTEGER', 'designation' => 'TEXT', 'modele_description' => 'TEXT', 'valeur' => 'REAL', 'etat_des_lieux_debut' => 'TEXT', 'etat_des_lieux_fin' => 'TEXT', 'duree_location' => 'INTEGER', 'loyer_mensuel' => 'REAL', 'loyers_payes' => 'INTEGER', 'caution' => 'INTEGER'] + 'locations' => ['ID' => 'INTEGER', 'ID_presta' => 'INTEGER', 'designation' => 'TEXT', 'modele_description' => 'TEXT', 'valeur' => 'REAL', 'etat_des_lieux_debut' => 'TEXT', 'etat_des_lieux_fin' => 'TEXT', 'duree_location' => 'TEXT', 'loyer_mensuel' => 'REAL', 'loyers_payes' => 'INTEGER', 'caution' => 'INTEGER'] ]; // les types de variables de sqlite sont peu nombreux et autorisent un typage automatique -- cgit v1.2.3