summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2023-12-23 10:00:24 +0100
committerpolo <ordipolo@gmx.fr>2023-12-23 10:00:24 +0100
commita4d88fd1913758cc95b395eefcf5e9d730450382 (patch)
treea7ffe3ab2816d7562cc967b5b4ef7c974dd7a0e2
parent78439b6a178e238ab8fb73d25567a85df78d6681 (diff)
downloadAppliGestionPHP-a4d88fd1913758cc95b395eefcf5e9d730450382.zip
devis payant, créer devis depuis facture, changement dans getIDsByIdClient(), suppression dépendance paquet latex "ulem", (string) dans setTelephone()
-rw-r--r--data/dev.sqlitebin36864 -> 36864 bytes
-rw-r--r--src/dependances.php18
-rw-r--r--src/functions.php7
-rw-r--r--src/latex_templates/devis.php7
-rw-r--r--src/latex_templates/originaux_pas_toucher/devis.tex3
-rwxr-xr-xsrc/main.php9
-rw-r--r--src/main_loop.php5
-rw-r--r--src/model/Clients.php14
-rw-r--r--src/model/DevisFactures.php32
-rw-r--r--src/model/Model.php35
-rw-r--r--src/model/Prestations.php24
-rw-r--r--src/model/StructTablesDB.php2
-rw-r--r--src/sections/1_customer.php14
-rw-r--r--src/sections/2_service.php118
-rw-r--r--src/sections/3-1_windows.php2
-rw-r--r--src/sections/3_modify_data.php39
-rw-r--r--src/view/ZenitySetup.php31
17 files changed, 199 insertions, 161 deletions
diff --git a/data/dev.sqlite b/data/dev.sqlite
index 3762c69..b4f0774 100644
--- a/data/dev.sqlite
+++ b/data/dev.sqlite
Binary files differ
diff --git a/src/dependances.php b/src/dependances.php
index a3dd320..ab37b3a 100644
--- a/src/dependances.php
+++ b/src/dependances.php
@@ -1,19 +1,23 @@
1<?php 1<?php
2// src/dependances.php 2// src/dependances.php
3// Vérification des dépendances nécessaires au fonctionnement de ce programmes. 3// Vérification des dépendances nécessaires au fonctionnement de ce programme.
4 4
5// Environnement dans lequel ce programmes a été créé: 5// Environnement dans lequel ce programmes a été créé:
6// - système archlinux avec l'interpréteur bash 6// - système archlinux avec un bureau et l'interpréteur bash (sh non testé)
7// - PHP 8.1 + paquet php-sqlite 7// - PHP 8.1
8// - module pdo_sqlite activé dans le fichier php.ini 8// - paquet php-sqlite et module pdo_sqlite activé dans le php.ini
9// - sqlitebrowser (interface graphique pour sqlite)
10// - distribution LaTeX texlive
11// - zenity 9// - zenity
10// - sqlite 3
11// - sqlitebrowser (GUI pour sqlite)
12// - la distribution texlive et pdflatex
13
14// sqlitebrowser est optionnel mais vivement recommandé
15// si il manque, le programme ouvrira à la place un terminal permettant d'utiliser la version CLI de sqlite si celle-ci est disponible
12 16
13// zenity disponible 17// zenity disponible
14if(exec("zenity --version 2> /dev/null") === '') // commande qui n'ouvre pas de fenêtre, erreur si la chaine est vide parce que la sortie d'erreur va dans /dev/null 18if(exec("zenity --version 2> /dev/null") === '') // commande qui n'ouvre pas de fenêtre, erreur si la chaine est vide parce que la sortie d'erreur va dans /dev/null
15{ 19{
16 printf("Impossible de lancer zenity. Veuillez installer le paquet zenity\n"); 20 printf("Impossible de lancer zenity. Veuillez installer le paquet zenity.\nUn environnemet graphique est également nécéssaire.\n");
17 exit(); 21 exit();
18} 22}
19 23
diff --git a/src/functions.php b/src/functions.php
index 47961f2..9bb59d6 100644
--- a/src/functions.php
+++ b/src/functions.php
@@ -96,13 +96,14 @@ function searchCustomer(string $input, Clients $Client): array
96} 96}
97 97
98 98
99function getServices(Clients $Client) 99function getServices(Clients $Client, string $type = '')
100{ 100{
101 echo "debug: recherche d'une prestation\n"; 101 echo "debug: recherche d'une prestation\n";
102 102
103 // recherche dans la table 'prestations' avec 'ID_client' les ID des prestas 103 // on recherche les ID des prestas dans la table 'prestations' avec 'ID_client'
104 $Presta = new Prestations($Client->getID()); 104 $Presta = new Prestations($Client->getID());
105 $IDs = $Presta->getIDsByIdClient(); 105 $Presta->setTypePresta($type);
106 $IDs = $Presta->getIDsByIdClient(); // comportement différent si le type est connu
106 unset($Presta); 107 unset($Presta);
107 108
108 // mettres toutes les données dans un tableau 109 // mettres toutes les données dans un tableau
diff --git a/src/latex_templates/devis.php b/src/latex_templates/devis.php
index 1bf2f94..ba6b635 100644
--- a/src/latex_templates/devis.php
+++ b/src/latex_templates/devis.php
@@ -13,6 +13,10 @@ if($data['deplacement'] != 0)
13{ 13{
14 $data['deplacement'] = ((string) $data['deplacement']) . '€'; 14 $data['deplacement'] = ((string) $data['deplacement']) . '€';
15} 15}
16if($data['prix_devis'] != 0)
17{
18 $data['prix_devis'] = ((string) $data['prix_devis']) . '€';
19}
16if($data['total_HT'] != 0) 20if($data['total_HT'] != 0)
17{ 21{
18 $data['total_HT'] = ((string) $data['total_HT']) . '€'; 22 $data['total_HT'] = ((string) $data['total_HT']) . '€';
@@ -32,7 +36,6 @@ ob_start();
32\usepackage{xcolor} % texte en couleur 36\usepackage{xcolor} % texte en couleur
33\usepackage{tabularx} % dimensions des tableaux automatique 37\usepackage{tabularx} % dimensions des tableaux automatique
34\usepackage{tikz} % le rectangle 38\usepackage{tikz} % le rectangle
35\usepackage{ulem} % pour barrer
36 39
37\begin{document} 40\begin{document}
38 \setlength{\parindent}{0cm} % supprimer les alinéas 41 \setlength{\parindent}{0cm} % supprimer les alinéas
@@ -87,6 +90,8 @@ ob_start();
87 90
88 Déplacement : \textcolor{vert}{<?= $data['deplacement'] ?>} 91 Déplacement : \textcolor{vert}{<?= $data['deplacement'] ?>}
89 92
93 Devis Payant : \textcolor{vert}{<?= $data['prix_devis'] ?>}
94
90 Total HT : \textcolor{vert}{<?= $data['total_HT'] ?>} 95 Total HT : \textcolor{vert}{<?= $data['total_HT'] ?>}
91 96
92 \textit{(TVA non applicable, article 293B du code général des impôts)} 97 \textit{(TVA non applicable, article 293B du code général des impôts)}
diff --git a/src/latex_templates/originaux_pas_toucher/devis.tex b/src/latex_templates/originaux_pas_toucher/devis.tex
index fa8ca79..e069308 100644
--- a/src/latex_templates/originaux_pas_toucher/devis.tex
+++ b/src/latex_templates/originaux_pas_toucher/devis.tex
@@ -10,7 +10,6 @@
10\usepackage{xcolor} % texte en couleur 10\usepackage{xcolor} % texte en couleur
11\usepackage{tabularx} % dimensions des tableaux automatique 11\usepackage{tabularx} % dimensions des tableaux automatique
12\usepackage{tikz} % le rectangle 12\usepackage{tikz} % le rectangle
13\usepackage{ulem} % pour barrer
14 13
15\begin{document} 14\begin{document}
16 \setlength{\parindent}{0cm} % supprimer les alinéas 15 \setlength{\parindent}{0cm} % supprimer les alinéas
@@ -65,6 +64,8 @@
65 64
66 Déplacement : \textcolor{vert}{} 65 Déplacement : \textcolor{vert}{}
67 66
67 Devis Payant : \textcolor{vert}{}
68
68 Total HT : \textcolor{vert}{} 69 Total HT : \textcolor{vert}{}
69 70
70 \textit{(TVA non applicable, article 293B du code général des impôts)} 71 \textit{(TVA non applicable, article 293B du code général des impôts)}
diff --git a/src/main.php b/src/main.php
index d176b56..c5b1950 100755
--- a/src/main.php
+++ b/src/main.php
@@ -48,6 +48,9 @@ require('view/ZenitySetup.php'); // texte dans les fenêtres ET instanciation (u
48 48
49require('Latex.php'); // générer le code LaTeX 49require('Latex.php'); // générer le code LaTeX
50 50
51 51// boucle principale
52// action !! 52require('sections/1_customer.php');
53require('main_loop.php'); 53require('sections/2_service.php');
54require('sections/3_modify_data.php');
55require('sections/4_get_document.php');
56require('main_loop.php'); // action !!
diff --git a/src/main_loop.php b/src/main_loop.php
index f68c251..23f6235 100644
--- a/src/main_loop.php
+++ b/src/main_loop.php
@@ -3,11 +3,6 @@
3// 3//
4// -- BOUCLE PRINCIPALE -- 4// -- BOUCLE PRINCIPALE --
5 5
6require('sections/1_customer.php');
7require('sections/2_service.php');
8require('sections/3_modify_data.php');
9require('sections/4_get_document.php');
10
11$main_loop = true; 6$main_loop = true;
12$section = [0, null]; // [code de retour, éventuelles données] 7$section = [0, null]; // [code de retour, éventuelles données]
13 8
diff --git a/src/model/Clients.php b/src/model/Clients.php
index 524070a..a5cc276 100644
--- a/src/model/Clients.php
+++ b/src/model/Clients.php
@@ -102,17 +102,11 @@ class Clients extends Model
102 $this->ville = (string) $value; 102 $this->ville = (string) $value;
103 return $this; 103 return $this;
104 } 104 }
105 public function setTelephone($value) // chaine parce que zenity renvoie une chaine et parce qu'on garde le 0 au début 105 public function setTelephone($value)
106 { 106 {
107 if(is_numeric($value)) 107 // type string parce que
108 { 108 // zenity renvoie une chaine, on peut ainsi garder le 0 au début et avoir plusieurs numéros (séparés par virgule et espace)
109 $this->telephone = (string) $value; 109 $this->telephone = (string) $value;
110 }
111 else
112 {
113 $this->telephone = '';
114 echo 'debug: le champ "telephone" ne doit comporter que des nombres, aucun numéro ne sera utilisé' . "\n";
115 }
116 return $this; 110 return $this;
117 } 111 }
118 public function setCourriel($value) 112 public function setCourriel($value)
diff --git a/src/model/DevisFactures.php b/src/model/DevisFactures.php
index 259690b..7c31f13 100644
--- a/src/model/DevisFactures.php
+++ b/src/model/DevisFactures.php
@@ -17,6 +17,7 @@ class DevisFactures extends Model
17 protected $pieces; 17 protected $pieces;
18 protected $total_pieces; 18 protected $total_pieces;
19 protected $deplacement; 19 protected $deplacement;
20 protected $prix_devis;
20 protected $total_HT; 21 protected $total_HT;
21 protected $delai_livraison; 22 protected $delai_livraison;
22 protected $validite_devis; 23 protected $validite_devis;
@@ -26,6 +27,7 @@ class DevisFactures extends Model
26 { 27 {
27 $this->table = $table; // deux tables séparées devis et factures 28 $this->table = $table; // deux tables séparées devis et factures
28 } 29 }
30
29 public function getAllWithWindowFields(): array // différent de Model::getAll() qui retourne get_object_vars($this) 31 public function getAllWithWindowFields(): array // différent de Model::getAll() qui retourne get_object_vars($this)
30 { 32 {
31 $taches = ["Tâches:" => $this->taches]; 33 $taches = ["Tâches:" => $this->taches];
@@ -60,7 +62,8 @@ class DevisFactures extends Model
60 return []; 62 return [];
61 } 63 }
62 } 64 }
63 public function set(string $entry, string $input) 65
66 public function set(string $entry, string $input) // trouve la bonne méthode
64 { 67 {
65 switch($entry) 68 switch($entry)
66 { 69 {
@@ -91,6 +94,9 @@ class DevisFactures extends Model
91 case "Déplacement:": 94 case "Déplacement:":
92 $this->setDeplacement($input); 95 $this->setDeplacement($input);
93 break; 96 break;
97 case "Prix du devis:":
98 $this->setPrixDevis($input);
99 break;
94 case "Total HT:": 100 case "Total HT:":
95 $this->setTotalHT($input); 101 $this->setTotalHT($input);
96 break; 102 break;
@@ -142,11 +148,6 @@ class DevisFactures extends Model
142 $this->cles_licences = $value; 148 $this->cles_licences = $value;
143 return($this); 149 return($this);
144 } 150 }
145 //~ public function setTemps(string $value)
146 //~ {
147 //~ $this->temps = $value;
148 //~ return($this);
149 //~ }
150 public function setTotalMainDOeuvre($value) 151 public function setTotalMainDOeuvre($value)
151 { 152 {
152 $value = str_replace(',', '.', $value); 153 $value = str_replace(',', '.', $value);
@@ -176,6 +177,12 @@ class DevisFactures extends Model
176 $this->total_HT = (float) $value; 177 $this->total_HT = (float) $value;
177 return($this); 178 return($this);
178 } 179 }
180 public function setPrixDevis($value)
181 {
182 $value = str_replace(',', '.', $value);
183 $this->prix_devis = (float) $value;
184 return($this);
185 }
179 public function setDelaiLivraison(string $value) 186 public function setDelaiLivraison(string $value)
180 { 187 {
181 $this->delai_livraison = $value; 188 $this->delai_livraison = $value;
@@ -192,6 +199,19 @@ class DevisFactures extends Model
192 return($this); 199 return($this);
193 } 200 }
194 201
202 // création d'une facture à partir d'un devis
203 public function hydrateReceiptWithQuotation($ReceiptDetails)
204 {
205 $ReceiptDetails->hydrate([
206 'taches' => $this->taches,
207 'total_main_d_oeuvre' => $this->total_main_d_oeuvre,
208 'pieces' => $this->pieces,
209 'total_pieces' => $this->total_pieces,
210 'deplacement' => $this->deplacement,
211 'total_HT' => $this->total_HT
212 ]);
213 }
214
195 //~ public function newRow(array $input) 215 //~ public function newRow(array $input)
196 //~ { 216 //~ {
197 //~ if($this->table === 'devis') // comme la table 'factures' avec deux champs en plus 217 //~ if($this->table === 'devis') // comme la table 'factures' avec deux champs en plus
diff --git a/src/model/Model.php b/src/model/Model.php
index 07826af..d6597f0 100644
--- a/src/model/Model.php
+++ b/src/model/Model.php
@@ -37,6 +37,11 @@ abstract class Model extends DB
37 } 37 }
38 return $this; 38 return $this;
39 } 39 }
40 public function setTable(string $value)
41 {
42 $this->table = $value;
43 return($this);
44 }
40 45
41 public function hydrate(array $data): bool // $data = tableau associatif en entrée: nom_du_champ => valeur 46 public function hydrate(array $data): bool // $data = tableau associatif en entrée: nom_du_champ => valeur
42 { 47 {
@@ -60,6 +65,7 @@ abstract class Model extends DB
60 } 65 }
61 66
62 // cette fonction reçoit des données d'un tableau simple, permettant d'associer des champs de formulaires aux noms différents des champs de la BDD 67 // cette fonction reçoit des données d'un tableau simple, permettant d'associer des champs de formulaires aux noms différents des champs de la BDD
68 // méthode lancée par des objets de type enfants
63 function hydrateFromForm(string $data_string, Object $Presta = NULL): bool // quand l'objet est $Details, on hydrate aussi $Presta 69 function hydrateFromForm(string $data_string, Object $Presta = NULL): bool // quand l'objet est $Details, on hydrate aussi $Presta
64 { 70 {
65 //~ $tableSize = count(StructTablesDB::$structureOfTables[$this->getTable()]); // int 71 //~ $tableSize = count(StructTablesDB::$structureOfTables[$this->getTable()]); // int
@@ -84,18 +90,25 @@ abstract class Model extends DB
84 case 'prestations'; // inutilisé 90 case 'prestations'; // inutilisé
85 break; 91 break;
86 case 'devis'; 92 case 'devis';
87 //~ $check = $Presta->hydrate(['mode_paiement' => $data_array[6]]); 93 $check = $this->hydrate(['taches' => $data_array[0], 'total_main_d_oeuvre' => $data_array[1], 'pieces' => $data_array[2], 'total_pieces' => $data_array[3], 'deplacement' => $data_array[4], 'prix_devis' => $data_array[5], 'total_HT' => $data_array[6], 'delai_livraison' => $data_array[7], 'validite_devis' => $data_array[8]]);
88 //~ if($check)
89 //~ {
90 //~ $check = $this->hydrate(['taches' => $data_array[0], 'total_main_d_oeuvre' => $data_array[1], 'pieces' => $data_array[2], 'total_pieces' => $data_array[3], 'deplacement' => $data_array[4], 'total_HT' => $data_array[5], 'delai_livraison' => $data_array[7], 'validite_devis' => $data_array[8], 'signature_devis' => $data_array[9]]);
91 $check = $this->hydrate(['taches' => $data_array[0], 'total_main_d_oeuvre' => $data_array[1], 'pieces' => $data_array[2], 'total_pieces' => $data_array[3], 'deplacement' => $data_array[4], 'total_HT' => $data_array[5], 'delai_livraison' => $data_array[6], 'validite_devis' => $data_array[7]]);
92 //~ }
93 break; 94 break;
94 case 'factures'; 95 case 'factures';
95 $check = $Presta->hydrate(['mode_paiement' => $data_array[10]]); 96 if(count($data_array) === 11)
96 if($check) 97 {
98 $check = $Presta->hydrate(['mode_paiement' => $data_array[10]]);
99 if($check)
100 {
101 $check = $this->hydrate(['taches' => $data_array[0], 'machine' => $data_array[1], 'OS' => $data_array[2], 'donnees' => $data_array[3], 'cles_licences' => $data_array[4], 'total_main_d_oeuvre' => $data_array[5], 'pieces' => $data_array[6], 'total_pieces' => $data_array[7], 'deplacement' => $data_array[8], 'total_HT' => $data_array[9]]);
102 }
103 }
104 elseif(count($data_array) === 5)
97 { 105 {
98 $check = $this->hydrate(['taches' => $data_array[0], 'machine' => $data_array[1], 'OS' => $data_array[2], 'donnees' => $data_array[3], 'cles_licences' => $data_array[4], 'total_main_d_oeuvre' => $data_array[5], 'pieces' => $data_array[6], 'total_pieces' => $data_array[7], 'deplacement' => $data_array[8], 'total_HT' => $data_array[9]]); 106 $check = $this->hydrate(['machine' => $data_array[1], 'OS' => $data_array[2], 'donnees' => $data_array[3], 'cles_licences' => $data_array[4]]);
107 }
108 else
109 {
110 echo "debug: le tableau \$data_array n'a pas la taille attendue.\n";
111 return false;
99 } 112 }
100 break; 113 break;
101 case 'cesu'; 114 case 'cesu';
@@ -106,11 +119,7 @@ abstract class Model extends DB
106 } 119 }
107 break; 120 break;
108 case 'locations'; 121 case 'locations';
109 //~ $check = $Presta->hydrate(['mode_paiement' => $data_array[11]]);
110 //~ if($check)
111 //~ {
112 $check = $this->hydrate(['designation' => $data_array[0], 'modele_description' => $data_array[1], 'valeur' => $data_array[2], 'etat_des_lieux_debut' => $data_array[3], 'etat_des_lieux_fin' => $data_array[4], 'duree_location' => $data_array[5], 'loyer_mensuel' => $data_array[6], 'loyers_payes' => $data_array[7], 'caution' => $data_array[8]]); 122 $check = $this->hydrate(['designation' => $data_array[0], 'modele_description' => $data_array[1], 'valeur' => $data_array[2], 'etat_des_lieux_debut' => $data_array[3], 'etat_des_lieux_fin' => $data_array[4], 'duree_location' => $data_array[5], 'loyer_mensuel' => $data_array[6], 'loyers_payes' => $data_array[7], 'caution' => $data_array[8]]);
113 //~ }
114 break; 123 break;
115 default: // inutilisé 124 default: // inutilisé
116 echo "debug: table inconnue hydrateFromForm()"; 125 echo "debug: table inconnue hydrateFromForm()";
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
155class CodePresta extends Prestations 161//~ class CodePresta extends Prestations
156{ 162//~ {
157 protected $numero_presta; 163 //~ protected $numero_presta;
158} 164//~ }
diff --git a/src/model/StructTablesDB.php b/src/model/StructTablesDB.php
index 679adde..48bf8e5 100644
--- a/src/model/StructTablesDB.php
+++ b/src/model/StructTablesDB.php
@@ -11,7 +11,7 @@ class StructTablesDB
11 // les tables devis_factures, cesu et locations sont liées à la table prestations 11 // les tables devis_factures, cesu et locations sont liées à la table prestations
12 'clients' => ['ID' => 'INTEGER', 'prenom_nom' => 'TEXT', 'code_client' => 'TEXT', 'adresse' => 'TEXT', 'code_postal' => 'TEXT', 'ville' => 'TEXT', 'telephone' => 'TEXT', 'courriel' => 'TEXT', 'apropos' => 'TEXT', 'type' => 'TEXT DEFAULT prospect'], 12 'clients' => ['ID' => 'INTEGER', 'prenom_nom' => 'TEXT', 'code_client' => 'TEXT', 'adresse' => 'TEXT', 'code_postal' => 'TEXT', 'ville' => 'TEXT', 'telephone' => 'TEXT', 'courriel' => 'TEXT', 'apropos' => 'TEXT', 'type' => 'TEXT DEFAULT prospect'],
13 'prestations' => ['ID' => 'INTEGER', 'ID_client' => 'INTEGER', 'code_presta' => 'TEXT', 'date' => 'INTEGER', 'type_presta' => 'TEXT', 'mode_paiement' => 'TEXT', 'commentaires' => 'TEXT'], 13 'prestations' => ['ID' => 'INTEGER', 'ID_client' => 'INTEGER', 'code_presta' => 'TEXT', 'date' => 'INTEGER', 'type_presta' => 'TEXT', 'mode_paiement' => 'TEXT', 'commentaires' => 'TEXT'],
14 '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 DEFAULT non'], 14 'devis' => ['ID' => 'INTEGER', 'ID_presta' => 'INTEGER', 'taches' => 'TEXT', 'total_main_d_oeuvre' => 'REAL', 'pieces' => 'TEXT', 'total_pieces' => 'REAL', 'deplacement' => 'REAL', 'prix_devis' => 'REAL', 'total_HT' => 'REAL', 'delai_livraison' => 'TEXT', 'validite_devis' => 'TEXT', 'signature_devis' => 'TEXT DEFAULT non'],
15 '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'], 15 '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'],
16 'cesu' => ['ID' => 'INTEGER', 'ID_presta' => 'INTEGER', 'taches' => 'TEXT', 'duree_travail' => 'TEXT', 'salaire' => 'REAL'], 16 'cesu' => ['ID' => 'INTEGER', 'ID_presta' => 'INTEGER', 'taches' => 'TEXT', 'duree_travail' => 'TEXT', 'salaire' => 'REAL'],
17 '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'] 17 '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']
diff --git a/src/sections/1_customer.php b/src/sections/1_customer.php
index ca20d08..ae8067f 100644
--- a/src/sections/1_customer.php
+++ b/src/sections/1_customer.php
@@ -6,19 +6,19 @@
6function newCustomer(): array 6function newCustomer(): array
7{ 7{
8 // fenêtres 8 // fenêtres
9 $TypeDeClient = new ZenityList(ZenitySetup::$type_client_text, ZenitySetup::$type_client_entrees); 9 $TypeDeClient = new ZenityList(ZenitySetup::$type_client['text'], ZenitySetup::$type_client['entrees']);
10 //~ $NouveauClient = new ZenityForms(ZenitySetup::$nouveau_client_text, ZenitySetup::$nouveau_client_entrees); 10 //~ $NouveauClient = new ZenityForms(ZenitySetup::$nouveau_client_text, ZenitySetup::$nouveau_client_entrees);
11 $FinSection1 = new ZenityList(ZenitySetup::$fin_section_1_text, ZenitySetup::$fin_section_1_entrees); 11 $FinSection1 = new ZenityList(ZenitySetup::$fin_section_1['text'], ZenitySetup::$fin_section_1['entrees']);
12 12
13 // -- partie 1: client ou prospect? -- 13 // -- partie 1: client ou prospect? --
14 $Client = new Clients; 14 $Client = new Clients;
15 $choix_niv2 = exec($TypeDeClient->get()); 15 $choix_niv2 = exec($TypeDeClient->get());
16 if($choix_niv2 === ZenitySetup::$type_client_entrees[0]) 16 if($choix_niv2 === ZenitySetup::$type_client['entrees'][0])
17 { 17 {
18 echo "choix: " . $choix_niv2 . "\n"; 18 echo "choix: " . $choix_niv2 . "\n";
19 $Client->setType('client'); 19 $Client->setType('client');
20 } 20 }
21 elseif($choix_niv2 === ZenitySetup::$type_client_entrees[1]) 21 elseif($choix_niv2 === ZenitySetup::$type_client['entrees'][1])
22 { 22 {
23 echo "choix: " . $choix_niv2 . "\n"; 23 echo "choix: " . $choix_niv2 . "\n";
24 $Client->setType('prospect'); 24 $Client->setType('prospect');
@@ -33,15 +33,15 @@ function newCustomer(): array
33 { 33 {
34 // -- partie 3: on fait quoi maintenant -- 34 // -- partie 3: on fait quoi maintenant --
35 $choix_niv3 = exec($FinSection1->get()); 35 $choix_niv3 = exec($FinSection1->get());
36 if($choix_niv3 === ZenitySetup::$fin_section_1_entrees[0]) 36 if($choix_niv3 === ZenitySetup::$fin_section_1['entrees'][0])
37 { 37 {
38 return [2, $Client]; // section 2: newService() 38 return [2, $Client]; // section 2: newService()
39 } 39 }
40 elseif($choix_niv3 === ZenitySetup::$fin_section_1_entrees[1]) 40 elseif($choix_niv3 === ZenitySetup::$fin_section_1['entrees'][1])
41 { 41 {
42 return [3, $Client]; // section 3: modifyData() 42 return [3, $Client]; // section 3: modifyData()
43 } 43 }
44 elseif($choix_niv3 === ZenitySetup::$fin_section_1_entrees[2]) 44 elseif($choix_niv3 === ZenitySetup::$fin_section_1['entrees'][2])
45 { 45 {
46 return [1, null]; // relancer section 1: newCustomer() 46 return [1, null]; // relancer section 1: newCustomer()
47 } 47 }
diff --git a/src/sections/2_service.php b/src/sections/2_service.php
index 1d58606..9683ef9 100644
--- a/src/sections/2_service.php
+++ b/src/sections/2_service.php
@@ -8,13 +8,14 @@ function newService($Client): array // $Client est un Client ou null
8 // fenêtres 8 // fenêtres
9 $MenuEnregistrement = new ZenityList(ZenitySetup::$menu_enregistrement_text, ZenitySetup::$menu_enregistrement_entrees); 9 $MenuEnregistrement = new ZenityList(ZenitySetup::$menu_enregistrement_text, ZenitySetup::$menu_enregistrement_entrees);
10 $Calendrier = new ZenityCalendar(ZenitySetup::$calendar['section2']); 10 $Calendrier = new ZenityCalendar(ZenitySetup::$calendar['section2']);
11 $FormulaireDevis = new ZenityForms(ZenitySetup::$formulaire_text, ZenitySetup::$formulaire_devis_entrees); 11 $FormulaireDevis = new ZenityForms(ZenitySetup::$formulaire['text'], ZenitySetup::$formulaire['devis_entrees']);
12 $FormulaireFacture = new ZenityForms(ZenitySetup::$formulaire_text, ZenitySetup::$formulaire_facture_entrees); 12 $FormulaireFacture = new ZenityForms(ZenitySetup::$formulaire['text'], ZenitySetup::$formulaire['facture_entrees']);
13 $FormulaireCesu = new ZenityForms(ZenitySetup::$formulaire_text, ZenitySetup::$formulaire_cesu_entrees); 13 $FormulaireFactureReduit = new ZenityForms(ZenitySetup::$formulaire['text'], ZenitySetup::$formulaire['facture_entrees_reduit']);
14 $FormulaireLocation = new ZenityForms(ZenitySetup::$formulaire_text, ZenitySetup::$formulaire_location_entrees); 14 $FormulaireCesu = new ZenityForms(ZenitySetup::$formulaire['text'], ZenitySetup::$formulaire['cesu_entrees']);
15 $FormulaireLocation = new ZenityForms(ZenitySetup::$formulaire['text'], ZenitySetup::$formulaire['location_entrees']);
15 $CommentairePrestation = new ZenityEntry(ZenitySetup::$commentaire_prestation_text); 16 $CommentairePrestation = new ZenityEntry(ZenitySetup::$commentaire_prestation_text);
16 //$Recapitulatif = new ZenityList(ZenitySetup::$recapitulatif_text, ZenitySetup::$recapitulatif_entrees); // tableau à multiples colonnes 17 //$Recapitulatif = new ZenityList(ZenitySetup::$recapitulatif_text, ZenitySetup::$recapitulatif_entrees); // tableau à multiples colonnes
17 $FinSection2 = new ZenityList(ZenitySetup::$fin_section_2_text, ZenitySetup::$fin_section_2_entrees); 18 $FinSection2 = new ZenityList(ZenitySetup::$fin_section_2['text'], ZenitySetup::$fin_section_2['entrees']);
18 19
19 20
20 // -- partie 1: le client -- 21 // -- partie 1: le client --
@@ -57,44 +58,38 @@ function newService($Client): array // $Client est un Client ou null
57 case ZenitySetup::$menu_enregistrement_entrees[0]: // "Devis" 58 case ZenitySetup::$menu_enregistrement_entrees[0]: // "Devis"
58 $PrestaDetails = new DevisFactures('devis'); 59 $PrestaDetails = new DevisFactures('devis');
59 $Presta->setTypePresta('devis'); 60 $Presta->setTypePresta('devis');
60 $input = exec($FormulaireDevis->get()); 61 $answers = exec($FormulaireDevis->get());
61 break; 62 break;
62 case ZenitySetup::$menu_enregistrement_entrees[1]: // "Facture" 63 case ZenitySetup::$menu_enregistrement_entrees[1]: // "Facture"
64 $PrestaDetails = new DevisFactures('factures'); // attention! type "facture" mais table "factures"
65 $Presta->setTypePresta('facture');
66 $answers = exec($FormulaireFacture->get());
67 break;
68 case ZenitySetup::$menu_enregistrement_entrees[2]: // "Facture à partir d'un devis"
69 // recherche du devis
70 $Quotation = getServices($Client, 'devis'); // rechercher un devis, type 'devis' spécifié pour $Presta->getIDsByIdClient()
71 if(!is_object($Quotation) || get_class($Quotation) != 'Prestations' || $Quotation->getTypePresta() != 'devis')
72 {
73 echo "debug: annulation sélection client\n";
74 return [2, $Client]; // menu précédent
75 }
76 $QuotationDetails = new DevisFactures('devis');
77 // facture: objet vide et formulaire
63 $PrestaDetails = new DevisFactures('factures'); 78 $PrestaDetails = new DevisFactures('factures');
64 $Presta->setTypePresta('facture'); 79 $Presta->setTypePresta('facture');
65 $input =exec($FormulaireFacture->get()); 80 $answers = exec($FormulaireFactureReduit->get());
81 //$answers = '' + answers[0], answers[1], answers[2], answers[3], '', '', '', '', '', answers[4];
82 //var_dump($answers);
66 break; 83 break;
67
68 //~ case ZenitySetup::$menu_enregistrement_entrees[2]: // "Facture à partir d'un devis"
69 //~ $PrestaDetails = new DevisFactures('facture');
70 //~ $Presta->setTypePresta('facture');
71 // 1 choix d'un devis
72 //makeObjectService(); // liste les devis existants pour ce client
73 //
74 // 2 hydratation
75 //
76 // 3 préremplissage du formulaire
77 //$FormulaireFacture->set($Data)
78 //
79 // et plus loin:
80 // 4 édition de la facture
81 //$input = exec($FormulaireFacture->get());
82 //
83 // 5 hydratation avec les changements
84 //
85 //echo $FormulaireFacture->get() . "\n";
86 //~ $input = exec($FormulaireFacture->get());
87 //~ break;
88
89 case ZenitySetup::$menu_enregistrement_entrees[3]: // "CESU" 84 case ZenitySetup::$menu_enregistrement_entrees[3]: // "CESU"
90 $PrestaDetails = new CESU(); 85 $PrestaDetails = new CESU();
91 $Presta->setTypePresta('cesu'); 86 $Presta->setTypePresta('cesu');
92 $input = exec($FormulaireCesu->get()); 87 $answers = exec($FormulaireCesu->get());
93 break; 88 break;
94 case ZenitySetup::$menu_enregistrement_entrees[4]: // "Location" 89 case ZenitySetup::$menu_enregistrement_entrees[4]: // "Location"
95 $PrestaDetails = new Locations(); 90 $PrestaDetails = new Locations();
96 $Presta->setTypePresta('location'); 91 $Presta->setTypePresta('location');
97 $input = exec($FormulaireLocation->get()); 92 $answers = exec($FormulaireLocation->get());
98 break; 93 break;
99 case ZenitySetup::$menu_enregistrement_entrees[5]: // "Prestation non vendue" 94 case ZenitySetup::$menu_enregistrement_entrees[5]: // "Prestation non vendue"
100 $Presta->setTypePresta('non_vendue'); 95 $Presta->setTypePresta('non_vendue');
@@ -106,28 +101,12 @@ function newService($Client): array // $Client est un Client ou null
106 101
107 $Presta->makeCodePresta($Date, $Client->getCodeClient()); // d'un objet à l'autre 102 $Presta->makeCodePresta($Date, $Client->getCodeClient()); // d'un objet à l'autre
108 103
109 // hydratation ou saut étape 3/3 si presta non vendu
110 if($choix_niv2 != ZenitySetup::$menu_enregistrement_entrees[5])
111 {
112 if($input == '') // annulation
113 {
114 echo "debug: annulation lors de l'enregistrement des détails de la prestation\n";
115 return [0, null];
116 }
117 elseif(isset($PrestaDetails) && !$PrestaDetails->hydrateFromForm($input, $Presta)) // echec de l'hydratation
118 {
119 echo "debug: erreur de hydrateFromForm()\n"; // messages d'erreur à mettre ici ou dans hydrateFromForm()?
120 return [0, null];
121 }
122 unset($input);
123 }
124
125 // commentaire - étape 3/3 104 // commentaire - étape 3/3
126 $input = exec($CommentairePrestation->get()); 105 $comment = exec($CommentairePrestation->get());
127 if($input == '') 106 if($comment == '')
128 { 107 {
129 echo "debug: pas de commentaire saisi\n"; 108 echo "debug: pas de commentaire saisi\n";
130 // on n'interrompt pas le script et on enregistre dans tous les cas (annulatation, chaîne vide) 109 // on n'interrompt pas le script et on enregistre dans tous les cas (annulatation comprise)
131 } 110 }
132 // Cliquer sur annuler (ou appuyer sur échap) revient dont à valider avec une chaîne vide et enregistrer la prestation 111 // Cliquer sur annuler (ou appuyer sur échap) revient dont à valider avec une chaîne vide et enregistrer la prestation
133 // la commande 'echo $?' ($? est le code de sortie de la commande précédente) renvoit 1 si on annule avec la touche échap () 112 // la commande 'echo $?' ($? est le code de sortie de la commande précédente) renvoit 1 si on annule avec la touche échap ()
@@ -140,13 +119,39 @@ function newService($Client): array // $Client est un Client ou null
140 //~ echo "debug: annulation à la saisie d'un commentaire\n"; 119 //~ echo "debug: annulation à la saisie d'un commentaire\n";
141 //~ return 0; 120 //~ return 0;
142 //~ } 121 //~ }
143 $Presta->setCommentaires($input); 122 $Presta->setCommentaires($comment);
144 unset($input); 123
124 // hydratation d'une facture à partir d'un devis
125 if($choix_niv2 === ZenitySetup::$menu_enregistrement_entrees[2]) // cas: facture à partir d'un devis
126 {
127 // devis retrouvé ($Quotation est déjà hydraté)
128 $QuotationDetails->setIDPresta($Quotation->getID());
129 $QuotationDetails->hydrate($QuotationDetails->getDetailsByIdPresta());
130
131 // facture avec le devis
132 $QuotationDetails->hydrateReceiptWithQuotation($PrestaDetails);
133 }
134
135 // hydratation avec la saisie du formulaire
136 if($choix_niv2 != ZenitySetup::$menu_enregistrement_entrees[5]) // cas: tous les cas sauf presta non vendue
137 {
138 if($answers == '') // annulation
139 {
140 echo "debug: annulation lors de l'enregistrement des détails de la prestation\n";
141 return [0, null];
142 }
143 elseif(isset($PrestaDetails) && !$PrestaDetails->hydrateFromForm($answers, $Presta)) // echec de l'hydratation
144 {
145 echo "debug: erreur de hydrateFromForm()\n"; // messages d'erreur à mettre ici ou dans hydrateFromForm()?
146 return [0, null];
147 }
148 }
145 149
150 // mise à jour base de données
146 $Presta->create(); 151 $Presta->create();
147 $Presta->setID(); // sans paramètre, exécute un $this->db->lastInsertId() 152 $Presta->setID(); // sans paramètre, exécute un $this->db->lastInsertId()
148 153
149 if(isset($PrestaDetails)) // presta non vendue 154 if(isset($PrestaDetails)) // presta vendue
150 { 155 {
151 $PrestaDetails->setIDPresta($Presta->getID()); // d'un objet à l'autre 156 $PrestaDetails->setIDPresta($Presta->getID()); // d'un objet à l'autre
152 $PrestaDetails->create(); 157 $PrestaDetails->create();
@@ -210,18 +215,19 @@ function newService($Client): array // $Client est un Client ou null
210 //~ $imprimer_facture = exec('zenity --question --width=250 --title="Base de données mise à jour" --text="Imprimer la facture?"'); 215 //~ $imprimer_facture = exec('zenity --question --width=250 --title="Base de données mise à jour" --text="Imprimer la facture?"');
211 //~ $imprimer_enveloppe = exec('zenity --question --width=250 --title="Base de données mise à jour" --text="Imprimer l\'adresse sur une enveloppe? (insérer une enveloppe DL sans fenêtre dans l\'imprimante"'); 216 //~ $imprimer_enveloppe = exec('zenity --question --width=250 --title="Base de données mise à jour" --text="Imprimer l\'adresse sur une enveloppe? (insérer une enveloppe DL sans fenêtre dans l\'imprimante"');
212 217
218 // ? modifications avec le menu de la section 3 obtenu avec makeModifyCustomerWindow()
213 219
214 // -- partie 5: on fait quoi maintenant -- 220 // -- partie 5: on fait quoi maintenant --
215 $choix_niv2 = exec($FinSection2->get()); 221 $choix_niv2 = exec($FinSection2->get());
216 if($choix_niv2 === ZenitySetup::$fin_section_2_entrees[0]) 222 if($choix_niv2 === ZenitySetup::$fin_section_2['entrees'][0]) // afficher le document
217 { 223 {
218 return [4, null]; // section 4: getDocument() 224 return [4, null]; // section 4: getDocument()
219 } 225 }
220 elseif($choix_niv2 === ZenitySetup::$fin_section_2_entrees[1]) 226 elseif($choix_niv2 === ZenitySetup::$fin_section_2['entrees'][1]) // modifier les informations
221 { 227 {
222 return [3, $Client]; // section 3: modifyData() 228 return [3, $Client]; // section 3: modifyData()
223 } 229 }
224 elseif($choix_niv2 === ZenitySetup::$fin_section_2_entrees[2]) 230 elseif($choix_niv2 === ZenitySetup::$fin_section_2['entrees'][2]) // enregistrer une autre prestation
225 { 231 {
226 return [2, null]; // relancer section 2: newService() 232 return [2, null]; // relancer section 2: newService()
227 } 233 }
diff --git a/src/sections/3-1_windows.php b/src/sections/3-1_windows.php
index 7952f6d..7e7367b 100644
--- a/src/sections/3-1_windows.php
+++ b/src/sections/3-1_windows.php
@@ -55,7 +55,7 @@ function makeModifyServiceWindow(Prestations $Service, $ServiceDetails = null):
55 55
56 if($Service->getTypePresta() === 'devis') 56 if($Service->getTypePresta() === 'devis')
57 { 57 {
58 $entrees[$i][] = ZenitySetup::$modification_presta['devis_facture']; // option changer le devis en facture 58 $entrees[$i][] = ZenitySetup::$modification_presta['devis_facture']; // option créer une facture à partir du devis
59 $entrees[$i][] = ''; 59 $entrees[$i][] = '';
60 //~ $i++; 60 //~ $i++;
61 } 61 }
diff --git a/src/sections/3_modify_data.php b/src/sections/3_modify_data.php
index 5da7ed9..0a67cea 100644
--- a/src/sections/3_modify_data.php
+++ b/src/sections/3_modify_data.php
@@ -7,6 +7,11 @@ require('3-1_windows.php');
7 7
8function modifyData($Client): array 8function modifyData($Client): array
9{ 9{
10 // fenêtres fixes
11 $TypeDeClient = new ZenityList(ZenitySetup::$type_client['text'], ZenitySetup::$type_client['entrees']);
12 $Calendrier = new ZenityCalendar(ZenitySetup::$calendar['section3']);
13
14
10 // -- partie 1: rechercher un client -- 15 // -- partie 1: rechercher un client --
11 if($Client == null || get_class($Client) !== 'Clients') // étape sautable 16 if($Client == null || get_class($Client) !== 'Clients') // étape sautable
12 { 17 {
@@ -25,22 +30,21 @@ function modifyData($Client): array
25 $ModificationClientMenu = makeModifyCustomerWindow($Client); 30 $ModificationClientMenu = makeModifyCustomerWindow($Client);
26 31
27 $choix_niv2 = exec($ModificationClientMenu->get()); 32 $choix_niv2 = exec($ModificationClientMenu->get());
28 if($choix_niv2 === ZenitySetup::$modification_client['service']) // ne pas modifier le client mais une prestation 33 if($choix_niv2 === ZenitySetup::$modification_client['service']) // clic sur "Modifier une prestation"
29 { 34 {
30 echo "choix: modifier une prestation\n"; 35 echo "choix: modifier une prestation\n";
31 // on passe à la suite 36 // ne rien faire dans cette partie et passer à la suite
32 } 37 }
33 elseif($choix_niv2 === "Client ou Prospect?") // modifier type de client 38 elseif($choix_niv2 === "Client ou Prospect?")
34 { 39 {
35 echo "choix: modifier" . $choix_niv2 . "\n"; 40 echo "choix: modifier" . $choix_niv2 . "\n";
36 $TypeDeClient = new ZenityList(ZenitySetup::$type_client_text, ZenitySetup::$type_client_entrees);
37 $input = exec($TypeDeClient->get()); 41 $input = exec($TypeDeClient->get());
38 if($input === ZenitySetup::$type_client_entrees[0]) 42 if($input === ZenitySetup::$type_client['entrees'][0])
39 { 43 {
40 echo "choix: " . $input . "\n"; 44 echo "choix: " . $input . "\n";
41 $Client->setType('client'); 45 $Client->setType('client');
42 } 46 }
43 elseif($input === ZenitySetup::$type_client_entrees[1]) 47 elseif($input === ZenitySetup::$type_client['entrees'][1])
44 { 48 {
45 echo "choix: " . $input . "\n"; 49 echo "choix: " . $input . "\n";
46 $Client->setType('prospect'); 50 $Client->setType('prospect');
@@ -52,7 +56,7 @@ function modifyData($Client): array
52 $Client->update(); 56 $Client->update();
53 return [3, $Client]; // menu précédent 57 return [3, $Client]; // menu précédent
54 } 58 }
55 elseif(is_string($choix_niv2) && $choix_niv2 != '') // modifier une valeur 59 elseif(is_string($choix_niv2) && $choix_niv2 != '') // autres choix, modifier une valeur
56 { 60 {
57 echo "choix: modifier" . $choix_niv2 . "\n"; 61 echo "choix: modifier" . $choix_niv2 . "\n";
58 $ModificationClient = new ZenityEntry($choix_niv2); 62 $ModificationClient = new ZenityEntry($choix_niv2);
@@ -74,7 +78,7 @@ function modifyData($Client): array
74 } 78 }
75 return [3, $Client]; // menu précédent 79 return [3, $Client]; // menu précédent
76 } 80 }
77 else // annuler 81 else
78 { 82 {
79 echo "annulation: retour au menu principal\n"; 83 echo "annulation: retour au menu principal\n";
80 return [0, null]; // menu principal 84 return [0, null]; // menu principal
@@ -95,7 +99,6 @@ function modifyData($Client): array
95 case 'facture': 99 case 'facture':
96 $PrestaDetails = new DevisFactures('factures'); 100 $PrestaDetails = new DevisFactures('factures');
97 break; 101 break;
98
99 case 'devis': 102 case 'devis':
100 $PrestaDetails = new DevisFactures('devis'); 103 $PrestaDetails = new DevisFactures('devis');
101 break; 104 break;
@@ -122,16 +125,13 @@ function modifyData($Client): array
122 $ModificationPrestaMenu = makeModifyServiceWindow($Presta, $PrestaDetails); 125 $ModificationPrestaMenu = makeModifyServiceWindow($Presta, $PrestaDetails);
123 126
124 $choix_niv3 = exec($ModificationPrestaMenu->get()); 127 $choix_niv3 = exec($ModificationPrestaMenu->get());
125 if($choix_niv3 === ZenitySetup::$modification_presta['devis_facture']) // devis -> facture 128 //~ if($choix_niv3 === ZenitySetup::$modification_presta['devis_facture']) // devis -> facture
126 { 129 //~ {
127 echo "choix: changer un devis en facture\n"; 130 //~ echo "choix: changer un devis en facture\n";
128 return [3, $Client]; // menu "client" 131 //~ return [2, $Client]; // menu "client"
129 } 132 //~ }
130 elseif($choix_niv3 === 'Date:') 133 if($choix_niv3 === 'Date:')
131 { 134 {
132 // fenêtre
133 $Calendrier = new ZenityCalendar(ZenitySetup::$calendar['section3']);
134
135 $Date = new Dates(exec($Calendrier->get())); // exec() renvoie soit une chaîne soit un false 135 $Date = new Dates(exec($Calendrier->get())); // exec() renvoie soit une chaîne soit un false
136 if($Date->getDate() == '') // clic sur "annuler", touche "échap" 136 if($Date->getDate() == '') // clic sur "annuler", touche "échap"
137 { 137 {
@@ -157,7 +157,7 @@ function modifyData($Client): array
157 } 157 }
158 //~ elseif($choix_niv3 === 'Type de Presta:') // choix impossible pour le moment 158 //~ elseif($choix_niv3 === 'Type de Presta:') // choix impossible pour le moment
159 //~ { 159 //~ {
160 //~ echo "choix: Impossible de modifier le type de prestation\n"; 160 //~ echo "choix: changer le type de prestation (devis, facture, etc)\n";
161 //~ return [3, $Client]; // menu "client" 161 //~ return [3, $Client]; // menu "client"
162 //~ } 162 //~ }
163 elseif(is_string($choix_niv3) && $choix_niv3 != '') // modifier une valeur 163 elseif(is_string($choix_niv3) && $choix_niv3 != '') // modifier une valeur
@@ -179,7 +179,6 @@ function modifyData($Client): array
179 } 179 }
180 180
181 // mettre à jour les documents 181 // mettre à jour les documents
182 //$type = $Presta->getTypePresta();
183 if($type === 'devis' || $type === 'facture' || $type === 'location') 182 if($type === 'devis' || $type === 'facture' || $type === 'location')
184 { 183 {
185 $DocumentPresta = Latex::makeInstance($type); 184 $DocumentPresta = Latex::makeInstance($type);
diff --git a/src/view/ZenitySetup.php b/src/view/ZenitySetup.php
index d2b5796..a876c04 100644
--- a/src/view/ZenitySetup.php
+++ b/src/view/ZenitySetup.php
@@ -13,9 +13,8 @@ class ZenitySetup
13{ 13{
14 static public $menu_principal_text = "Gestion d'une micro-entreprise"; 14 static public $menu_principal_text = "Gestion d'une micro-entreprise";
15 static public $menu_principal_entrees = ["Clients et prospects", "Prestations et devis", "Modifier un enregistrement", "Consulter, imprimer un document", "Consulter/analyser les données", "Communication", "Base de données"]; 15 static public $menu_principal_entrees = ["Clients et prospects", "Prestations et devis", "Modifier un enregistrement", "Consulter, imprimer un document", "Consulter/analyser les données", "Communication", "Base de données"];
16 //~ static public $question_nouveau_client_text = "Ce client figure t\'il déjà dans le fichier clients?"; 16 static public $type_client = ['text' => "Client ou prospect?",
17 static public $type_client_text = "Client ou prospect?"; 17 'entrees' => ["Client", "Prospect"]];
18 static public $type_client_entrees = ["Client", "Prospect"];
19 static public $menu_enregistrement_text = "Type d\'enregistrement?"; 18 static public $menu_enregistrement_text = "Type d\'enregistrement?";
20 static public $menu_enregistrement_entrees = ["Devis", "Facture", "Facture à partir d'un devis", "CESU", "Location", "Prestation non vendue"]; 19 static public $menu_enregistrement_entrees = ["Devis", "Facture", "Facture à partir d'un devis", "CESU", "Location", "Prestation non vendue"];
21 //~ static public $menu_enregistrement_entrees = ["Devis", "Facture", "CESU", "Location", "Prestation non vendue"]; 20 //~ static public $menu_enregistrement_entrees = ["Devis", "Facture", "CESU", "Location", "Prestation non vendue"];
@@ -28,32 +27,28 @@ class ZenitySetup
28 static public $resultats_recherche_presta_text = "Sélectionner une prestation"; 27 static public $resultats_recherche_presta_text = "Sélectionner une prestation";
29 static public $nouveau_client_text = "Nouveau client"; 28 static public $nouveau_client_text = "Nouveau client";
30 static public $nouveau_client_entrees = ["Prénom Nom:", "Code client (J.C.Dusse):", "Adresse:", "Code postal:", "Ville:", "Telephone:", "Courriel:", "À propos:"]; 29 static public $nouveau_client_entrees = ["Prénom Nom:", "Code client (J.C.Dusse):", "Adresse:", "Code postal:", "Ville:", "Telephone:", "Courriel:", "À propos:"];
31
32 static public $calendar = ['section2' => 'Nouvelle prestation étape 1/3 - Choisir une date', 30 static public $calendar = ['section2' => 'Nouvelle prestation étape 1/3 - Choisir une date',
33 'section3' => 'Choisir une nouvelle date']; 31 'section3' => 'Choisir une nouvelle date'];
34 32 static public $formulaire = ['text' => 'Nouvelle prestation 2/3 - Détail des travaux',
35 static public $formulaire_text = 'Nouvelle prestation 2/3 - Détail des travaux'; 33 'devis_entrees' => ["Tâches effectuées:", "Total main d\'oeuvre (euros):", "Détail des pièces:", "Total pièces (euros):", "Déplacement (euros):", "Prix du devis (euros):", "Total HT (euros):", "Delai de livraison", "Durée de validite du devis:"],
36 static public $formulaire_devis_entrees = ["Tâches effectuées:", "Total main d\'oeuvre (euros):", "Détail des pièces:", "Total pièces (euros):", "Déplacement (euros):", "Total HT (euros):", "Delai de livraison", "Durée de validite du devis:"]; 34 'facture_entrees' => ["Tâches effectuées:", "Modèle du PC:", "OS:", "Données sauvegardées:", "Clés d\'activation:", "Total main d\'oeuvre (euros):", "Détail des pièces:", "Total pièces (euros):", "Déplacement (euros)", "Total HT (euros):", "Mode de paiement:"],
37 static public $formulaire_facture_entrees = ["Tâches effectuées:", "Modèle du PC:", "OS:", "Données sauvegardées:", "Clés d\'activation:", "Total main d\'oeuvre (euros):", "Détail des pièces:", "Total pièces (euros):", "Déplacement (euros)", "Total HT (euros):", "Mode de paiement:"]; 35 'facture_entrees_reduit' => ["Modèle du PC:", "OS:", "Données sauvegardées:", "Clés d\'activation:", "Mode de paiement:"],
38 static public $formulaire_cesu_entrees = ["Tâches effectuées:", "Duree de travail:", "Salaire net:", "Mode de paiement:"]; // en fait je pourrais ajouter plein d'autres trucs 36 'cesu_entrees' => ["Tâches effectuées:", "Duree de travail:", "Salaire net:", "Mode de paiement:"], // en fait je pourrais ajouter plein d'autres trucs
39 static public $formulaire_location_entrees = ["Désignation du bien:", "Modèle, numéro de série, description:", "Valeur:", "État des lieux du début:", "État des lieux de fin:", "Durée de la location en mois:", "Loyer mensuel:", "Nombre de loyers déjà payés:", "Montant du chèque de caution:"]; 37 'location_entrees' => ["Désignation du bien:", "Modèle, numéro de série, description:", "Valeur:", "État des lieux du début:", "État des lieux de fin:", "Durée de la location en mois:", "Loyer mensuel:", "Nombre de loyers déjà payés:", "Montant du chèque de caution:"]];
40 static public $commentaire_prestation_text = 'Nouvelle prestation 3/3 - Commentaires'; 38 static public $commentaire_prestation_text = 'Nouvelle prestation 3/3 - Commentaires';
41
42 static public $modification_client = ['text' => 'Modifier une information concernant un client', 39 static public $modification_client = ['text' => 'Modifier une information concernant un client',
43 'service' => "Modifier une prestation"]; 40 'service' => "Modifier une prestation"];
44 //'return' => "Retour menu principal"]; 41 //'return' => "Retour menu principal"];
45 static public $modification_presta = ['text' => 'Modifier une prestation', 42 static public $modification_presta = ['text' => 'Modifier une prestation',
46 'devis_facture' => "Changer ce devis en facture"]; 43 'devis_facture' => "Créer une facture à partir d'un devis"];
47 //'service' => "Modifier une autre prestation", 44 //'service' => "Modifier une autre prestation",
48 //'return' => "Retour menu précédent"]; 45 //'return' => "Retour menu précédent"];
49 46
50 //~ static public $recapitulatif_text = "voici toutes les informations enregistrées"; 47 //~ static public $recapitulatif_text = "voici toutes les informations enregistrées";
51 //~ static public $recapitulatif_entrees = []; 48 //~ static public $recapitulatif_entrees = [];
52 49
53 //static public $question_modification_text = "Prestation enregistrée. Modifier les informations?"; 50 static public $fin_section_1 = ['text' => "Client enregistré",
54 51 'entrees' => ["Ajouter une prestation pour ce client", "Modifier les informations", "Enregistrer un autre client", "Menu principal"]];
55 static public $fin_section_1_text = "Client enregistré"; 52 static public $fin_section_2 = ['text' => "Prestation/devis enregistré(e)",
56 static public $fin_section_1_entrees = ["Ajouter une prestation pour ce client", "Modifier les informations", "Enregistrer un autre client", "Menu principal"]; 53 'entrees' => ["Afficher le document", "Modifier les informations", "Enregistrer une autre prestation/devis", "Menu principal"]];
57 static public $fin_section_2_text = "Prestation/devis enregistré(e)";
58 static public $fin_section_2_entrees = ["Afficher le document", "Modifier les informations", "Enregistrer une autre prestation/devis", "Menu principal"];
59} 54}