diff options
| author | polo <ordipolo@gmx.fr> | 2023-09-03 02:45:17 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2023-09-03 02:45:17 +0200 |
| commit | 78439b6a178e238ab8fb73d25567a85df78d6681 (patch) | |
| tree | 219181bc81bff750d9ec3a44c5ccb2a3028694e4 /src/sections/3_modify_data.php | |
| parent | 45262760a7d575a9d612cc2056e66bf105e43df8 (diff) | |
| download | AppliGestionPHP-78439b6a178e238ab8fb73d25567a85df78d6681.tar.gz AppliGestionPHP-78439b6a178e238ab8fb73d25567a85df78d6681.tar.bz2 AppliGestionPHP-78439b6a178e238ab8fb73d25567a85df78d6681.zip | |
section 3 prestas non vendues
Diffstat (limited to 'src/sections/3_modify_data.php')
| -rw-r--r-- | src/sections/3_modify_data.php | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/src/sections/3_modify_data.php b/src/sections/3_modify_data.php index 1f48870..5da7ed9 100644 --- a/src/sections/3_modify_data.php +++ b/src/sections/3_modify_data.php | |||
| @@ -88,7 +88,9 @@ function modifyData($Client): array | |||
| 88 | echo "debug: annulation sélection client\n"; | 88 | echo "debug: annulation sélection client\n"; |
| 89 | return [3, $Client]; // menu précédent | 89 | return [3, $Client]; // menu précédent |
| 90 | } | 90 | } |
| 91 | switch($Presta->getTypePresta()) | 91 | |
| 92 | $type = $Presta->getTypePresta(); | ||
| 93 | switch($type) | ||
| 92 | { | 94 | { |
| 93 | case 'facture': | 95 | case 'facture': |
| 94 | $PrestaDetails = new DevisFactures('factures'); | 96 | $PrestaDetails = new DevisFactures('factures'); |
| @@ -103,16 +105,21 @@ function modifyData($Client): array | |||
| 103 | case 'location': | 105 | case 'location': |
| 104 | $PrestaDetails = new Locations(); | 106 | $PrestaDetails = new Locations(); |
| 105 | break; | 107 | break; |
| 108 | case 'non_vendue': | ||
| 109 | $PrestaDetails = null; | ||
| 110 | break; | ||
| 111 | } | ||
| 112 | if($type != 'non_vendue') | ||
| 113 | { | ||
| 114 | $PrestaDetails->setIDPresta($Presta->getID()); | ||
| 115 | $PrestaDetails->hydrate($PrestaDetails->getDetailsByIdPresta()); | ||
| 106 | } | 116 | } |
| 107 | $PrestaDetails->setIDPresta($Presta->getID()); | ||
| 108 | $PrestaDetails->hydrate($PrestaDetails->getDetailsByIdPresta()); | ||
| 109 | 117 | ||
| 110 | 118 | ||
| 111 | // -- partie 4: modifier une prestation -- | 119 | // -- partie 4: modifier une prestation -- |
| 112 | 120 | ||
| 113 | // fenêtre | 121 | // fenêtre |
| 114 | $ModificationPrestaMenu = makeModifyServiceWindow($Presta, $PrestaDetails); | 122 | $ModificationPrestaMenu = makeModifyServiceWindow($Presta, $PrestaDetails); |
| 115 | $Calendrier = new ZenityCalendar(ZenitySetup::$calendar['section3']); | ||
| 116 | 123 | ||
| 117 | $choix_niv3 = exec($ModificationPrestaMenu->get()); | 124 | $choix_niv3 = exec($ModificationPrestaMenu->get()); |
| 118 | if($choix_niv3 === ZenitySetup::$modification_presta['devis_facture']) // devis -> facture | 125 | if($choix_niv3 === ZenitySetup::$modification_presta['devis_facture']) // devis -> facture |
| @@ -122,11 +129,13 @@ function modifyData($Client): array | |||
| 122 | } | 129 | } |
| 123 | elseif($choix_niv3 === 'Date:') | 130 | elseif($choix_niv3 === 'Date:') |
| 124 | { | 131 | { |
| 132 | // fenêtre | ||
| 133 | $Calendrier = new ZenityCalendar(ZenitySetup::$calendar['section3']); | ||
| 134 | |||
| 125 | $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 |
| 126 | if($Date->getDate() == '') // on n'a pas cliqué sur "annuler" | 136 | if($Date->getDate() == '') // clic sur "annuler", touche "échap" |
| 127 | { | 137 | { |
| 128 | echo "debug: annulation à la saisie d'une date\n"; | 138 | echo "debug: annulation à la saisie d'une date\n"; |
| 129 | //return [3, $Client]; // menu principal | ||
| 130 | } | 139 | } |
| 131 | else | 140 | else |
| 132 | { | 141 | { |
| @@ -135,10 +144,13 @@ function modifyData($Client): array | |||
| 135 | $Presta->update(); | 144 | $Presta->update(); |
| 136 | 145 | ||
| 137 | // mettre à jour les documents | 146 | // mettre à jour les documents |
| 138 | $DocumentPresta = Latex::makeInstance($Presta->getTypePresta()); // $type = facture, devis, location | 147 | if($type === 'devis' || $type === 'facture' || $type === 'location') |
| 139 | $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails); | 148 | { |
| 140 | $DocumentPresta->makeLatex(); | 149 | $DocumentPresta = Latex::makeInstance($Presta->getTypePresta()); // $type = facture, devis, location |
| 141 | makeTexAndPdf($DocumentPresta); | 150 | $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails); |
| 151 | $DocumentPresta->makeLatex(); | ||
| 152 | makeTexAndPdf($DocumentPresta); | ||
| 153 | } | ||
| 142 | } | 154 | } |
| 143 | 155 | ||
| 144 | return [3, $Client]; // menu précédent | 156 | return [3, $Client]; // menu précédent |
| @@ -156,17 +168,21 @@ function modifyData($Client): array | |||
| 156 | //if(is_string($input) && $input != '') | 168 | //if(is_string($input) && $input != '') |
| 157 | if(is_string($input)) // chaine vide autorisée | 169 | if(is_string($input)) // chaine vide autorisée |
| 158 | { | 170 | { |
| 159 | $Presta->set($choix_niv3, $input); | ||
| 160 | $PrestaDetails->set($choix_niv3, $input); | ||
| 161 | |||
| 162 | // mettre à jour la base de données | 171 | // mettre à jour la base de données |
| 172 | $Presta->set($choix_niv3, $input); | ||
| 163 | $Presta->update(); | 173 | $Presta->update(); |
| 164 | $PrestaDetails->update(); | 174 | |
| 175 | if($type != 'non_vendue') | ||
| 176 | { | ||
| 177 | $PrestaDetails->set($choix_niv3, $input); | ||
| 178 | $PrestaDetails->update(); | ||
| 179 | } | ||
| 165 | 180 | ||
| 166 | // mettre à jour les documents | 181 | // mettre à jour les documents |
| 167 | if($Presta->getTypePresta() === 'devis' || $Presta->getTypePresta() === 'facture' || $Presta->getTypePresta() === 'location') | 182 | //$type = $Presta->getTypePresta(); |
| 183 | if($type === 'devis' || $type === 'facture' || $type === 'location') | ||
| 168 | { | 184 | { |
| 169 | $DocumentPresta = Latex::makeInstance($Presta->getTypePresta()); // $type = facture, devis, location | 185 | $DocumentPresta = Latex::makeInstance($type); |
| 170 | $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails); | 186 | $DocumentPresta->setData($Client)->setData($Presta)->setData($PrestaDetails); |
| 171 | $DocumentPresta->makeLatex(); | 187 | $DocumentPresta->makeLatex(); |
| 172 | makeTexAndPdf($DocumentPresta); | 188 | makeTexAndPdf($DocumentPresta); |
