ID_presta = $ID_presta; $this->table = $table; // deux tables séparées devis et factures } // setters //~ public function setID() -> dans le trait ModelChildren public function setIDPresta(int $value) { $this->ID_presta = $value; return($this); } public function setValiditedevis(string $value) { $this->validite_devis = $value; return($this); } public function setSignatureDevis(string $value) { $this->signature_devis = $value; return($this); } public function setTaches(string $value) { $this->taches = $value; return($this); } public function setMachine(string $value) { $this->machine = $value; return($this); } public function setOS(string $value) { $this->OS = $value; return($this); } public function setDonnees(string $value) { $this->donnees = $value; return($this); } public function setClesLicences(string $value) { $this->cles_licences = $value; return($this); } public function setTemps(string $value) { $this->temps = $value; return($this); } public function setTotalMainDOeuvre($value) { $value = str_replace(',', '.', $value); $this->total_main_d_oeuvre = (float) $value; // float "nettoie" tous les caractères après le dernier chiffre trouvé (ex: 50€ => 50, abc => 0) return($this); } public function setPieces(string $value) { $this->pieces = $value; return($this); } public function setTotalPieces($value) { $value = str_replace(',', '.', $value); $this->total_pieces = (float) $value; return($this); } public function setDeplacement($value) { $value = str_replace(',', '.', $value); $this->deplacement = (float) $value; return($this); } public function setTotalHT($value) { $value = str_replace(',', '.', $value); $this->total_HT = (float) $value; return($this); } //~ public function newRow(array $input) //~ { //~ if($this->table === 'devis') // comme la table 'factures' avec deux champs en plus //~ { //~ $this->hydrate(['ID' => $input[0], 'ID_presta' => $input[1], 'taches' => $input[2], 'machine' => $input[3], 'OS' => $input[4], 'donnees' => $input[5], 'cles_licences' => $input[6], 'total_main_d_oeuvre' => $input[7], 'pieces' => $input[8], 'total_pieces' => $input[9], 'deplacement' => $input[10], 'total_HT' => $input[11]], //~ ['validite_devis' => $input[12], 'signature_devis' => $input[13]]); //~ $this->hydrate(['validite_devis' => $quotations_input[0], 'signature_devis' => $quotations_input[1]]); //~ } //~ elseif($this->table === 'factures') //~ { //~ $this->hydrate(['ID' => $input[0], 'ID_presta' => $input[1], 'taches' => $input[2], 'machine' => $input[3], 'OS' => $input[4], 'donnees' => $input[5], 'cles_licences' => $input[6], 'total_main_d_oeuvre' => $input[7], 'pieces' => $input[8], 'total_pieces' => $input[9], 'deplacement' => $input[10], 'total_HT' => $input[11]]); //~ } //~ $this->hydrate(['ID' => $input[0], 'ID_presta' => $input[1], 'taches' => $input[2], 'machine' => $input[3], 'OS' => $input[4], 'donnees' => $input[5], 'cles_licences' => $input[6], 'total_main_d_oeuvre' => $input[7], 'pieces' => $input[8], 'total_pieces' => $input[9], 'deplacement' => $input[10], 'total_HT' => $input[11]]); //~ $this->create(); //~ $this->ID_devis_facture = $this->db->lastInsertId(); // méthode de PDO //~ } }