From 065d51bbb4886c91dc0800d1d94e8703a74baf50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Math=C3=A9o=20Hersan?= Date: Wed, 8 Nov 2023 21:29:59 +0100 Subject: [PATCH] better error handling in resp --- app | Bin 0 -> 58368 bytes donnee/client.txt | 3 +- src/app/core_logic/responsable.c | 1 + src/app/interface/interface_resp.c | 335 ++++++++++++----------------- src/app/interface/interface_resp.h | 5 + 5 files changed, 144 insertions(+), 200 deletions(-) create mode 100755 app diff --git a/app b/app new file mode 100755 index 0000000000000000000000000000000000000000..667991fedb000a829dc89f253bb339b33d7b2cfb GIT binary patch literal 58368 zcmeHw3w%`7)$g86LLPvCpu7}LKui!MJQVO93{+G^1XO&EAsHZ&WMU>!5L$B^Y-#1z zoJuRLwxXgY$Y*Kwt4W25##(N#-&d@*Vz0N&3!R|#(q3DWR+{_&@5h-vClj=Oy}#dm z%;;gx+Iz3ZUVE*z*WUZ&%rF1?hrbUIA|UWd!!-g|Rk{%O3I}&WjK#GWS17b>!DWkX zT(taZmL`5Aa$-?Gh;$C4VJNh6(W;e+)e^rhu}o+<1I6ZIi%_U0yrG77>f@)k1sx#0 zcdk8D34(j`4U!WJQsV=Krt1JEV<^!Mooi$N4AZ&kZSy>(m)mGkBR#_SBB z-=pX?Xd;CDG<22x;<)a>6$&j}uyR4D=<1~_)aceJI-(Gj{M5;Rg@M^;UX*<}u25)g zB(AlA=^435&(_-@O$T4{6SvzXmoL3?(Zb7>R6-o^$pu(`&QM>JhnM-B1IZ~L@m8T? zj)qsgBt&z%(hbM5?p2Hd>c{*R`p6VwFv^zU;-_0*bMZY9ZBAz40H21pg_xA2?j)2s zxM*huwbAN=^0L(hr5npj0rN8+7v(rI|Io|VTsQZ$hra$|!51Dr{*Bovb8vwzKBRJz zyqCJm{5W_PN@V|7jZZ$hLONZyO3?d&G{xH65=Pu7jnJXcKPRVA1=nkz%`qV}LV7uWR7x0rwlYZ_6y~-Nx_1 zg}q-lbyWd(XZ^&UuNb&4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eZWzyI6yw){XB!ve$cucF6%a2SY~e2@7RVUs^GUnXqwVdkHNO@4`Ck+8{kn4hrT z}d`QD4A8s?S&fjSFY;V@X>9{9s)}LH25H{-p z&Yy(M{K)x)u$eEoJ|=9|znt$0oB5pakFbe<^k>4xUm4#CoA}M~mhJU;bNx!#tWTMb z5jOc2=O@Bu{^5K>*vuzfKN2?UL&kH$CSG%WM%b*sm@g4F`4H`gu(1!W2ML??9`iH8 zCja7mP1wxGTt5>w>tn7*37hpM^9#Zzf8ctVaF?U(jq#hXiO^X;2}0pfr4>GZ*W_QCj#=7jbmeQ>T1F7UzgeDK9S_%a`SwGUq9gNuD|nGe3h z2XFMjbv}5j51t6kIJhR`VjP@;>r7mExagZxah-*08m{TM&c?;~SAc6KE`y(o`$@Py zFC7ObDE+r0L&b9UUHr2xJ&N+0kd;`CI z#t|>qo9(*b+Df04*H$JnOgNp;NMW;k@4@)Viuf^zRf_HQkp9VqI3IN`;jvMm*;lsC zGH?{d^9G(XXk=(6UZ(c0bwT{d0tLR~36vz9PlQSaJdOyJ#E&CFrTCRF`v`&s-XR14 z-_b)T`Nnfd?>m>MGa&=YbA}LqActpXI5RNy6415!5W!Pjg)SKI7y=dY=MEFLwL{+T zkXdI9C`@wLfKuzUArv*+`EmVwMPaS~c!78P5R$(#p$-SkFk3|i(flN`*FD*WR%?s_ z=Y^(`DY6bGLW!I7#mbq4uh{5SZs4nPg^;}G*@C)@JJtWiN2&$a;%tNI zx*dK2wqVwRg3GU6Sx|(Z5r`J7Sg?p!Xx7YG1<~q~0-Ssl;PhC%vA;lgw|W?7l!$+b zxWM)TeGF}U z{48tbh9M1qa<>2dmQ9!a@SfTqe(UD#&)ix6n^SvEKYIUZOZT6A+lyBppZaLzy7onL u$M<%e`QzvBaGt$o=J+RXZu`;)&f&H%Ed1)8w}vfV`-`6*-?% #include "responsable.h" #include "../interface/interface_resp.h" +#include "client.h" #define MAX_SIZE_MDP 21 diff --git a/src/app/interface/interface_resp.c b/src/app/interface/interface_resp.c index 52eb37f..adebeea 100644 --- a/src/app/interface/interface_resp.c +++ b/src/app/interface/interface_resp.c @@ -1,9 +1,4 @@ -#include -#include #include "interface_resp.h" -#include "../core_logic/responsable.h" -#include "../core_logic/client.h" -#include "../interface/interface_client.h" #define MAX_CLIENTS 100 #define MAX_ARTICLES 100 @@ -11,7 +6,6 @@ #define MAX_SIZE_MDP 21 #define MENU_QUIT 14 - void affiche_resp(void) { printf("\n"); printf("+-------------+\n"); @@ -59,11 +53,8 @@ void affichArticles(int tRef[], float tPoids[], float tVol[], float tPrix[], int void affichUnArticle(int tRef[], float tPoids[], float tVol[], float tPrix[], int tLogique) { int ref; - printf("\tQuelle est la référence de l'article à rechercher ?\n"); - while (scanf("%d", &ref) != 1 || ref <= 0) { - printf("\tEntrez une référence valide\n"); - while (getchar() != '\n'); - } + printf("Entrez la référence de l'article à rechercher : "); + verifInt(&ref); for (int i = 0; i < tLogique; ++i) { if (ref == tRef[i]) { @@ -78,11 +69,10 @@ void affichUnArticle(int tRef[], float tPoids[], float tVol[], float tPrix[], in void affichUnClient(int tNumClient[], float tCagnotte[], int tSus[], int tLogique) { int numC; - printf("\tVeuillez entrer le numéro du client à rechercher\n"); - while (scanf("%d", &numC) != 1 || numC <= 0) { - printf("\t Veuillez entrez un numéro valide !\n"); - while (getchar() != '\n'); - } + printf("Veuillez entrer le numéro du client à rechercher : "); + + verifInt(&numC); + for (int i = 0; i < tLogique; ++i) { if (numC == tNumClient[i]) { printf("\t NumClient\t Cagnotte\t Etat\n"); @@ -103,99 +93,75 @@ void affichClients(int tNumClient[], float tCagnotte[], int tSus[], int tLogique } void affichAjoutArticle(int *ref, float *poids, float *volume, float *prix, int tRef[], int tLogArticle) { - printf("\t Entrez la ref du nouveau produit\n"); - while (scanf("%d", ref) != 1 || *ref <= 0) { + int articleIndex; + printf("Entrez la ref du nouveau produit : "); - printf("\t Veuillez entrer une référence valide.\n"); - while (getchar() != '\n'); - } + verifInt(ref); - if ( trouver_index_article(*ref, tRef, tLogArticle) != -1) - { - printf("\t L'article existe déjà\n"); - return; + articleIndex = trouver_index_article(*ref, tRef, tLogArticle); + + while (articleIndex != -1) { + fprintf(stderr, "\x1B[31mERREUR : Article déjà présent. Veuillez entrer une référence valide :\x1B[0m "); + verifInt(ref); + articleIndex = trouver_index_article(*ref, tRef, tLogArticle); } - else - { - printf("\t Entrez le poids du nouveau produit\n"); - while (scanf("%f", poids) != 1 || *poids <= 0) - { - printf("\t Veuillez entrer un poids valide.\n"); - while (getchar() != '\n'); - } - printf("\t Entrez le volume du nouveau produit\n"); - while (scanf("%f", volume) != 1 || *volume <= 0) - { - printf("\t Veuillez entrer un volume valide.\n"); - while (getchar() != '\n'); - } + printf("Entrez le poids du nouveau produit : "); + verifFloat(poids); - printf("\t Entrez le prix du nouveau produit\n"); - while (scanf("%f", prix) != 1 || *prix <= 0) - { - printf("\t Veuillez entrer un prix valide.\n"); - while (getchar() != '\n'); - } - } + printf("Entrez le volume du nouveau produit : "); + verifFloat(volume); + + printf("Entrez le prix du nouveau produit : "); + verifFloat(prix); } void affichSupprimerArticle(int *ref) { - printf("\t Quelle est la référence de l'article que vous voulez supprimer ?\n"); - while (scanf("%d", ref) != 1 || *ref <= 0) { - printf("\t Veuillez entrer une référence valide.\n"); - while (getchar() != '\n'); - } + printf("Entrez la référence de l'article que vous voulez supprimer : "); + verifInt(ref); } void affichModifierArticle(int *ref, float *poids, float *volume, float *prix) { + int articleIndex; printf("\t Quelle est la référence de l'article que vous voulez modifier ?\n"); - while (scanf("%d", ref) != 1 || *ref <= 0) { - printf("\t Veuillez entrer une référence correcte !\n"); - while (getchar() != '\n'); - } + verifInt(ref); printf("\t Quel est le nouveau poids à entrer ?\n"); - while (scanf("%f", poids) != 1 || *poids <= 0) { - printf("\t Veuillez entrer un poids correct !\n"); - while (getchar() != '\n'); - } + verifFloat(poids); printf("\t Quel est le nouveau volume à entrer ?\n"); - while (scanf("%f", volume) != 1 || *volume <= 0) { - printf("\t Veuillez entrer un volume correct !\n"); - while (getchar() != '\n'); - } + verifFloat(volume); printf("\t Quel est le nouveau prix à entrer ?\n"); - while (scanf("%f", prix) != 1 || *prix <= 0) { - printf("\t Veuillez entrer un prix correct !\n"); - while (getchar() != '\n'); - } + verifFloat(prix); } void affichAjoutClient(int tNumClient[], int tLogique, int *numC) { - printf("\t Veuillez entrer le numéro du nouveau client\n"); - while (scanf("%d", numC) != 1 || *numC <= 0) { - printf("Entrez un numéro valide !\n"); - while (getchar() != '\n'); - } - for (int i = 0; i < tLogique; ++i) { - if (*numC == tNumClient[i]) { - fprintf(stderr, "\t /!/ Client déjà existant. /!/\n"); - return; - } + int clientIndex; + printf("Veuillez entrer le numéro du nouveau client : "); + verifInt(numC); + + clientIndex = trouver_index_client(*numC, tNumClient, tLogique); + + while (clientIndex != -1) { + fprintf(stderr, "\x1B[31mERREUR : Client déjà existant. Veuillez entrer un numéro valide :\x1B[0m "); + verifInt(numC); + clientIndex = trouver_index_client(*numC, tNumClient, tLogique); } + } int affichageConnexion(void) { char mdpEnter[20]; - printf("Entrer le mot de passe responsable : "); - scanf("%s", mdpEnter); + char* mdp= getpass("Entrer le mot de passe responsable : "); +// printf("Entrer le mot de passe responsable : "); +// scanf("%s", mdpEnter); + + strcpy(mdpEnter, mdp); int verif = decodageMDP(mdpEnter); @@ -219,107 +185,96 @@ int affichageConnexion(void) void affichModifClient(int tNumClient[], int tSus[], int tLogique) { - int choix, numC; - printf("\tEntrez le numéro du client : "); - while( scanf("%d", &numC) != 1 || numC <=0 ) + int choix, numC, indexClient; + printf("Entrez le numéro du client : "); + verifInt(&numC); + + indexClient = trouver_index_client(numC, tNumClient, tLogique); + + while ( indexClient == -1 ) { - printf("\t Entrez une valeur valide ! \n"); - while (getchar() != '\n'); + fprintf(stderr, "\x1B[31mERREUR : Client non trouvé. Veuillez entrer un numéro valide :\x1B[0m "); + verifInt(&numC); + indexClient = trouver_index_client(numC, tNumClient, tLogique); } - for ( int i = 0; i <= tLogique; i++) + if ( tSus[indexClient] == 0) { - if ( numC == tNumClient[i] ) + printf("La cagnotte du client n'est pas suspendu, voulez-vous le suspendre ? ( Oui = 1 / Non = 0 ) : "); + while(scanf("%d", &choix) != 1 || choix < 0 || choix > 1) { - if ( tSus[i] == 0 ) - { - printf("\t La cagnotte du client n'est pas suspendu, voulez-vous le suspendre ?\n ( Oui = 0 / Non = 1 )\n "); - while(scanf("%d", &choix) != 1 || choix < 0 || choix > 1) - { - printf("\t Veuillez entrer un choix valide ! \n"); - while (getchar() != '\n'); - } - if ( choix == 0 ) - { - tSus[i] = 1; - printf("\t La cagnotte est maintenant suspendu\n"); - return; - } - else - { - printf("\t La cagnotte n'a pas été changé. Au revoir ! \n"); - return; - } - } - else - { - printf("\t La cagnotte du client %d est suspendue, voulez-vous l'activer à nouveau ?\n ( Oui = 0 / Non = 1 )\n", tNumClient[i]); - while(scanf("%d", &choix) != 1 || choix < 0 || choix > 1) - { - printf("\t Veuillez entrer un choix valide ! \n"); - while (getchar() != '\n'); - } - if ( choix == 0 ) - { - tSus[i] = 0; - printf("\t La cagnotte n'est plus suspendu\n"); - return; - } - else - { - printf("\t La cagnotte n'a pas été changé. Au revoir ! \n"); - return; - } - } + fprintf(stderr, "\x1B[31mERREUR : Veuillez entrer un choix valide ! : \x1B[0m"); + while (getchar() != '\n'); + } + if ( choix == 1 ) + { + tSus[indexClient] = 1; + printf("La cagnotte est maintenant suspendu\n"); + return; + } + else + { + printf("La cagnotte n'a pas été changé. Au revoir ! \n"); + return; + } + } + else + { + printf("La cagnotte du client %d est suspendue, voulez-vous l'activer à nouveau ? ( Oui = 1 / Non = 0 ) : ", tNumClient[indexClient]); + while(scanf("%d", &choix) != 1 || choix < 0 || choix > 1) + { + fprintf(stderr, "\x1B[31mERREUR : Veuillez entrer un choix valide ! : \x1B[0m"); + while (getchar() != '\n'); + } + if ( choix == 1 ) + { + tSus[indexClient] = 0; + printf("La cagnotte n'est plus suspendu\n"); + return; + } + else + { + printf("La cagnotte n'a pas été changé. Au revoir ! \n"); + return; } } - printf("\t Le client %d n'a pas été trouvé. \n", numC); - return; } -void suppressionClient(int tNumClient[], float tCagnotte[], int tSus[], int *tLogique) -{ - int choix, numC; - printf("\tEntrez le numéro du client : "); - while( scanf("%d", &numC) != 1 || numC <=0 ) +void suppressionClient(int tNumClient[], float tCagnotte[], int tSus[], int *tLogique) { + int choix, numC, indexClient; + printf("Entrez le numéro du client : "); + verifInt(&numC); + + indexClient = trouver_index_client(numC, tNumClient, *tLogique); + + while (indexClient == -1) { - printf("\t Entrez une valeur valide ! \n"); - while (getchar() != '\n'); + fprintf(stderr, "\x1B[31mERREUR : Client %d non trouvé. Veuillez entrer un numéro valide :\x1B[0m ", numC); + verifInt(&numC); + indexClient = trouver_index_client(numC, tNumClient, *tLogique); } + printf("Êtes-vous sur de vouloir supprimer ce client ? ( Oui = 1 / Non = 0 ) : "); + while (scanf("%d", &choix) != 1 || choix < 0 || choix > 1) { + fprintf(stderr, "\x1B[31mERREUR : Veuillez entrer un choix valide ! : \x1B[0m"); + } - for ( int i = 0; i < *tLogique; ++i) - { - if ( numC == tNumClient[i] ) - { - printf("\tÊtes-vous sur de vouloir supprimer ce client ? ( Oui = 0 / Non = 1 )\n"); - while(scanf("%d", &choix) != 1 || choix < 0 || choix > 1) - { - printf("\t Veuillez entrer un choix valide ! \n"); - } - if ( choix == 0 ) - { - while ( i < *tLogique-1 ) - { - tNumClient[i] = tNumClient[i+1]; - tCagnotte[i] = tCagnotte[i+1]; - tSus[i] = tSus[i+1]; - i++; - } - printf("Le client %d a été supprimé.\n", tNumClient[i]); - (*tLogique)--; - return; - } - else - { - printf("\t Le client %d n'a pas été supprimé.\n", tNumClient[i]); - return; - } + if (choix == 1) { + while (indexClient < *tLogique - 1) { + tNumClient[indexClient] = tNumClient[indexClient + 1]; + tCagnotte[indexClient] = tCagnotte[indexClient + 1]; + tSus[indexClient] = tSus[indexClient + 1]; + indexClient++; } + printf("\033[32mLe client %d a été supprimé avec succès.\033[0m\n", tNumClient[indexClient]); + (*tLogique)--; + return; + } else { + printf("\t Le client %d n'a pas été supprimé.\n", tNumClient[indexClient]); + return; } - printf("\t Le client %d n'a pas été trouvé. \n", numC); - return; + } void affichModifMDP(void) @@ -327,13 +282,13 @@ void affichModifMDP(void) int choix, decalage; char newMDP[MAX_SIZE_MDP], confirmMDP[MAX_SIZE_MDP]; printf("\t /!/ Vous entrez dans le menu de modification du mot de passe /!/\n"); - printf("\t Êtes-vous sur de vouloir changer le mot de passe ?\n Si oui, entrez 0 et sinon entrez 1\n"); + printf("\t Êtes-vous sur de vouloir changer le mot de passe ?\n Si oui, entrez 1 et sinon entrez 0\n"); while (scanf("%d", &choix) !=1 || choix < 0 || choix > 1) { - printf("/!/ Entrez une valeur valide /!/"); + fprintf(stderr, "\x1B[31mERREUR : /!/ Entrez une valeur valide : /!/ \x1B[0m"); while (getchar() != '\n'); } - if ( choix == 1 ) + if ( choix == 0 ) { printf("\t Vous quittez le menu de modification du mot de passe.\n"); return; @@ -372,7 +327,7 @@ void affichModifMDP(void) int verif = verifModifMDP(newMDP, confirmMDP, decalage); if ( verif == 0 ) { - printf("\t Mot de passe modifié !\n"); + printf("\t\033[32mMot de passe modifié avec succès!\033[0m\n"); return; } else @@ -390,33 +345,25 @@ void creerReduc( int tRefReduc[], int tReduc[], int *tLogReduc, int tPhysiqueRed if ( *tLogReduc == tPhysiqueReduc) { - fprintf(stderr, "\tTableau pleins !\n"); + fprintf(stderr, "\x1B[31mERREUR : Tableau pleins !\n \x1B[0m"); return; } - printf("\tA quel article voulez-vous ajouter une promotion ?\n"); - while (scanf("%d", &ref) !=1 || ref < 0) - { - printf("\t Entrez une référence correcte !\n"); - while (getchar() != '\n'); - } + printf("A quel article voulez-vous ajouter une promotion : "); + verifInt(&ref); int verif = trouver_index_article(ref, tRef, tLogArticle); while ( (verif = trouver_index_article(ref, tRef, tLogArticle)) == -1 ) { - printf("\t Entrez une référence existante !\n"); - while (scanf("%d", &ref) !=1 || ref < 0) - { - printf("\t Entrez une référence correcte !\n"); - while (getchar() != '\n'); - } + printf("\x1B[31mERREUR : Entrez une référence existante ! : \x1B[0m"); + verifInt(&ref); } - printf("\tQuel pourcentage ?\n"); + printf("Entrez le pourcentage pourcentage : "); while (scanf("%f", &reduc) !=1 || reduc < 0 || reduc > 100) { - printf("\t Entrez un nombre correcte !\n"); + printf("\x1B[31mERREUR : Entrez un nombre correcte ! : \x1B[0m"); while (getchar() != '\n'); } @@ -424,30 +371,22 @@ void creerReduc( int tRefReduc[], int tReduc[], int *tLogReduc, int tPhysiqueRed tPrix[indexPrix] = tPrix[indexPrix]*(1-reduc/100); tReduc[*tLogReduc] = reduc; tRefReduc[*tLogReduc] = ref; - printf("\n\tModification réussi !\n\n"); + printf("\n\t\033[32mModification réussi !\033[0m\n\n"); ++(*tLogReduc); } int affichSuprReduc(int tRefReduc[], int tLogReduc, int *indexReduc) { int ref; - printf("\tQuel est la référence de l'article auquel il faut supprimer la réduction ?\n"); - while (scanf("%d", &ref) !=1 || ref < 0) - { - fprintf(stderr, "\t Entrez une référence correcte !\n"); - while (getchar() != '\n'); - } + printf("Entrez la référence de l'article auquel il faut supprimer la réduction : "); + verifInt(&ref); while( ( *indexReduc = trouver_index_article(ref, tRefReduc, tLogReduc) )== -1 ) { - printf("\t Entrez une référence qui a une réduction !\n"); - while (scanf("%d", &ref) !=1 || ref < 0) - { - printf("\t Entrez une référence correcte !\n"); - while (getchar() != '\n'); - } + printf("\x1B[31mERREUR : Entrez une référence qui a une réduction ! : \x1B[0m"); + verifInt(&ref); } - printf("\t Suppression réussi !\n"); + printf("\n\t\033[32mSuppression réussi !\033[0m\n"); return ref; } @@ -477,7 +416,7 @@ void global_resp(void) { int tLogArticle = chargementArticles(tRef, tPoids, tVol, tPrix, MAX_ARTICLES); int tLogClient = charger_clients(tNumClient, tCagnotte, tSus, MAX_CLIENTS); int tLogReduc = chargementReduc(tRefReduc, tReduc, MAX_REDUCTION); - // system("clear"); + //system("clear"); do { menu_resp(&choix); switch (choix) { diff --git a/src/app/interface/interface_resp.h b/src/app/interface/interface_resp.h index f4bebc5..1b512bc 100644 --- a/src/app/interface/interface_resp.h +++ b/src/app/interface/interface_resp.h @@ -3,6 +3,11 @@ * @brief En-tête des fonctions liées à l'interface du responsable. */ +#include +#include +#include "../core_logic/responsable.h" +#include "../core_logic/client.h" + /** * @brief Affiche la liste des articles. * @author Yannis Doumir Fernandes