From e7ff9418aa08e0f28b21a5c274b397b6a81c266d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20LAVERGNE?= Date: Wed, 8 Nov 2023 00:02:43 +0100 Subject: [PATCH 01/19] =?UTF-8?q?Ajout=20des=20mots=20de=20passe=20et=20du?= =?UTF-8?q?=20cryptage/d=C3=A9cryptage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/login.c | 45 +++++++++++++++++++++++++++++++++++++-------- src/main.c | 6 +++--- src/main.h | 16 ++++++++++------ src/passwd.c | 36 ++++++++++++++++++++++++++++++++++++ src/traitement.c | 21 +++++++++++---------- 5 files changed, 97 insertions(+), 27 deletions(-) create mode 100644 src/passwd.c diff --git a/src/login.c b/src/login.c index 9d6119e..7934d00 100644 --- a/src/login.c +++ b/src/login.c @@ -7,9 +7,9 @@ * @param tlog: Taille logique des Tableaux * @return Est Admin ? (1 > Oui, 0 > Non, -1 > Quitter) */ -int login(int clientID[], int isAdmin[], int tlog) +int login(int clientID[], int clientPassword[], int isAdmin[], int tlog) { - int id, index, found, tentative=3; + int id, password, index, found, tentative=3; printf("Entrez votre identifiant: "); scanf("%d%*c", &id); while (id < 0) @@ -18,7 +18,6 @@ int login(int clientID[], int isAdmin[], int tlog) scanf("%d%*c", &id); } index = searchTab(clientID, id, tlog, &found); - printf("%d",found); while(found == 0) { printf("Erreur, l'identifiant n'existe pas, entrez votre identifiant: "); @@ -34,21 +33,40 @@ int login(int clientID[], int isAdmin[], int tlog) printf("Nombre de tentatives dépassé, retour au menu principal.\n"); return -1; } + printf("Il vous reste %d tentatives.\n", tentative); + index = searchTab(clientID, id, tlog, &found); } - if (isAdmin[index] == 1) + + printf("Entrez votre mot de passe: "); + scanf("%d%*c", &password); + while (password < 0) { - return 1; + printf("Erreur, le mot de passe doit être positif, entrez votre mot de passe: "); + scanf("%d%*c", &password); + } + + if (password == decrypt(clientPassword[index])) + { + if (isAdmin[index] == 1) + { + return 1; + } + else + { + return 0; + } } else { - return 0; + printf("Erreur, le mot de passe est incorrect.\n"); + return -1; } } -int signup(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int *tlog) +int signup(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog) { - int id, index, found; + int id, password, index, found; printf("Entrez votre identifiant: "); scanf("%d%*c", &id); while (id < 0) @@ -67,6 +85,17 @@ int signup(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int } index = searchTab(clientID, id, *tlog, &found); } + + printf("Entrez votre mot de passe: "); + scanf("%d%*c", &password); + while (password < 0) + { + printf("Erreur, le mot de passe doit être positif, entrez votre mot de passe: "); + scanf("%d%*c", &password); + } + + clientPassword[*tlog] = encrypt(password); + clientID[*tlog] = id; cagnotte[*tlog] = 0; suspended[*tlog] = 0; diff --git a/src/main.c b/src/main.c index 70d4f03..6b49f22 100644 --- a/src/main.c +++ b/src/main.c @@ -53,7 +53,7 @@ void global(void) */ // Déclaration des variables int tLogArticle, tLogClient, choice, status, currentUser; - int reference[tmaxArticles], clientID[tmaxClients], suspended[tmaxClients], isAdmin[tmaxClients]; + int reference[tmaxArticles], clientID[tmaxClients], clientPassword[tmaxClients], suspended[tmaxClients], isAdmin[tmaxClients]; float weight[tmaxArticles], volume[tmaxArticles], unitPrice[tmaxArticles], cagnotte[tmaxClients]; // Chargement de toute les données chargeDonnees(&tLogArticle, &tLogClient, reference, weight, volume, unitPrice, clientID, cagnotte, suspended, isAdmin); @@ -65,7 +65,7 @@ void global(void) switch (choice) { case 1: - status = login(clientID, isAdmin, tLogClient); + status = login(clientID, clientPassword, isAdmin, tLogClient); if(status == 1) { //TODO > Menu Admin @@ -83,7 +83,7 @@ void global(void) } break; case 2: - status = signup(clientID, cagnotte, suspended, isAdmin, &tLogClient); + status = signup(clientID, clientPassword, cagnotte, suspended, isAdmin, &tLogClient); if(status == 0) { printf("Inscription réussie.\nRetour au menu principal...\n"); diff --git a/src/main.h b/src/main.h index 9d27a05..ddb70c3 100644 --- a/src/main.h +++ b/src/main.h @@ -19,13 +19,13 @@ void debugHandling(int code); void debugMenu(int tabReference[], float tabWeight[], float tabVolume[], float unitPrice[], int clientID[], float cagnotte[], int suspended[], int isAdmin[], int tlogArticle, int tlogClient); //! TRAITEMENT DES FICHIERS -void chargeDonnees(int *tLogArticle, int *tLogClient,int reference[], float weight[], float volume[], float unitPrice[], int clientID[], float cagnotte[], int suspended[], int isAdmin[]); +void chargeDonnees(int *tLogArticle, int *tLogClient,int reference[], float weight[], float volume[], float unitPrice[], int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[]); int chargeArticles(int reference[], float weight[], float volume[], float unitPrice[]); -int chargeClients(int clientID[], float cagnotte[], int suspended[], int isAdmin[]); +int chargeClients(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[]); -void sauvegardeDonnees(int tLogArticle, int tLogClient, int reference[], float weight[], float volume[], float unitPrice[], int clientID[], float cagnotte[], int isAdmin[], int suspended[]); +void sauvegardeDonnees(int tLogArticle, int tLogClient, int reference[], float weight[], float volume[], float unitPrice[], int clientID[], int clientPassword[], float cagnotte[], int isAdmin[], int suspended[]); void sauvegardeArticles(int reference[], float weight[], float volume[], float unitPrice[], int tLogArticle); -void sauvegardeClients(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int tLogClient); +void sauvegardeClients(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int tLogClient); //! GESTION CLIENTS int inputClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int *tlog); @@ -54,5 +54,9 @@ int reinit_basket(int tlog_basket); int basket_del_article( int basket_tab_ref[], int basket_tab_qte[], int tlog_basket); //! LOGIN -int login(int clientID[], int isAdmin[], int tlog); -int signup(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int *tlog); \ No newline at end of file +int login(int clientID[], int clientPassword[], int isAdmin[], int tlog); +int signup(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog); + +//! MOT DE PASSE +int encrypt(int password); +int decrypt(int password); \ No newline at end of file diff --git a/src/passwd.c b/src/passwd.c new file mode 100644 index 0000000..7c4dc22 --- /dev/null +++ b/src/passwd.c @@ -0,0 +1,36 @@ +/** + * @file passwd.c + * @brief Gestion des mots de passe +*/ + +#include "main.h" + +/** + * @brief Encryption d'un mot de passe avec la méthode de César + * @param password: Mot de passe à encrypter + * @return int: Mot de passe encrypté +*/ +int encrypt(int password) +{ + int i; + for (i=0; i Date: Wed, 8 Nov 2023 08:06:44 +0100 Subject: [PATCH 02/19] Modif temporaire --- src/passwd.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/passwd.c b/src/passwd.c index 7c4dc22..d4ac35e 100644 --- a/src/passwd.c +++ b/src/passwd.c @@ -12,11 +12,7 @@ */ int encrypt(int password) { - int i; - for (i=0; i Date: Wed, 8 Nov 2023 08:26:30 +0100 Subject: [PATCH 03/19] fix de divers bugs --- src/display.c | 3 +-- src/errorHandling.c | 2 +- src/main.c | 4 ++-- src/main.h | 2 +- src/panier.c | 1 - 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/display.c b/src/display.c index fb28a71..30df8e0 100644 --- a/src/display.c +++ b/src/display.c @@ -110,7 +110,7 @@ void displayClientList(int clientID[], float cagnotte[], int suspended[], int is * @param tlog_basket: taille logique du panier * @return Rien */ -void display_basket(int basket_tab_ref[], int basket_qte[], float weight[], float volume[], float unitPrice[], float *cagnotte, int tlog, int tlog_basket) +void display_basket(int basket_tab_ref[], int basket_qte[], float weight[], float volume[], float unitPrice[], int tlog, int tlog_basket) { float total_weight_line[tlog_basket], total_volume_line[tlog_basket], total_price_line[tlog_basket], cagnotte_line[tlog_basket], total_weight, total_volume, total_price; int i; @@ -133,7 +133,6 @@ void display_basket(int basket_tab_ref[], int basket_qte[], float weight[], floa printf("%d\t%d\t%f\t%f\t%f\t%f\t%f\t%f\t%f\n", basket_tab_ref[i], basket_qte[i], weight[i], volume[i], unitPrice[i], total_weight_line[i], total_volume_line[i], total_price_line[i],cagnotte_line[i]); printf("\t\t\t\t\tPrix total à payer: %f\t euros\n", total_price); - printf("\t\t\t\t\tCagnotte totale: %f\t euros\n", *cagnotte); //constraintExceeded( weightConstraint, volumeConstraint, *priceConstraint, *cagnotte, tabWeight[], tabVolume[], tabPrice[], tabItemRef[], tabBasketRef[], tabBasketQuantity[], tlogItem, int tlogBasket) diff --git a/src/errorHandling.c b/src/errorHandling.c index 1020908..756f617 100644 --- a/src/errorHandling.c +++ b/src/errorHandling.c @@ -25,7 +25,7 @@ void errorHandling(int error) printf("[ERREUR] - La taille physique du tableau est dépassée.\n"); break; case -3: - print("ERREUR] - Problème lors de la lecture d'un fichier.\n"); + printf("ERREUR] - Problème lors de la lecture d'un fichier.\n"); break; case -4: printf("[ERREUR] - Problème lors de l'écriture d'un fichier.\n"); diff --git a/src/main.c b/src/main.c index 6b49f22..564fecd 100644 --- a/src/main.c +++ b/src/main.c @@ -52,11 +52,11 @@ void global(void) +var cagnotte: tableau des cagnottes des clients */ // Déclaration des variables - int tLogArticle, tLogClient, choice, status, currentUser; + int tLogArticle, tLogClient, choice, status, currentUser, clientPassword; int reference[tmaxArticles], clientID[tmaxClients], clientPassword[tmaxClients], suspended[tmaxClients], isAdmin[tmaxClients]; float weight[tmaxArticles], volume[tmaxArticles], unitPrice[tmaxArticles], cagnotte[tmaxClients]; // Chargement de toute les données - chargeDonnees(&tLogArticle, &tLogClient, reference, weight, volume, unitPrice, clientID, cagnotte, suspended, isAdmin); + chargeDonnees(&tLogArticle, &tLogClient, reference, weight, volume, unitPrice, clientID, clientPassword, cagnotte, suspended, isAdmin); // Affichage du menu choice = displayMenu(); diff --git a/src/main.h b/src/main.h index ddb70c3..8dcd7a1 100644 --- a/src/main.h +++ b/src/main.h @@ -49,7 +49,7 @@ int searchTab(int targetTab[], int valSearched, int tLog, int *found); void clientConstraint(float *weight, float *volume, float *price); int constraintExceeded(float weightConstraint, float volumeConstraint, float *priceConstraint, float *cagnotte, float tabWeight[], float tabVolume[], float tabPrice[], int tabItemRef[], int tabBasketRef[], int tabBasketQuantity[], int tlogItem, int tlogBasket); int basket_add (int tab_reference[], float weight[], float volume[], float unitPrice[], float *cagnotte, int basket_tab_ref[], int basket_tab_qte[],int tlog, int tlog_basket); -void display_basket(int basket_tab_ref[], int basket_qte[], float weight[], float volume[], float unitPrice[], float *cagnotte, int tlog, int tlog_basket); +void display_basket(int basket_tab_ref[], int basket_qte[], float weight[], float volume[], float unitPrice[], int tlog, int tlog_basket); int reinit_basket(int tlog_basket); int basket_del_article( int basket_tab_ref[], int basket_tab_qte[], int tlog_basket); diff --git a/src/panier.c b/src/panier.c index 3762247..a0b8cd1 100644 --- a/src/panier.c +++ b/src/panier.c @@ -156,7 +156,6 @@ int basket_add (int tab_reference[], float weight[], float volume[], float unitP *cagnotte = *cagnotte + *cagnotte*0.10; tlog_basket = tlog_basket+1; - display_basket( basket_tab_ref, basket_tab_qte, weight, volume, unitPrice, *cagnotte, tlog, tlog_basket); return tlog_basket; } From c667b11e786eb85a15ecfac8a951b0cd303def7c Mon Sep 17 00:00:00 2001 From: Remi Date: Wed, 8 Nov 2023 08:29:33 +0100 Subject: [PATCH 04/19] Gestion d'erreur --- src/errorHandling.c | 13 ++++++++----- src/menu.c | 11 +++++++++++ src/traitement.c | 4 ++-- 3 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 src/menu.c diff --git a/src/errorHandling.c b/src/errorHandling.c index 1020908..9b933d1 100644 --- a/src/errorHandling.c +++ b/src/errorHandling.c @@ -25,18 +25,21 @@ void errorHandling(int error) printf("[ERREUR] - La taille physique du tableau est dépassée.\n"); break; case -3: - print("ERREUR] - Problème lors de la lecture d'un fichier.\n"); + printf("[ERREUR] - L'espace disponible du tableau est insuffisant.\n"); break; case -4: - printf("[ERREUR] - Problème lors de l'écriture d'un fichier.\n"); - break; + print("ERREUR] - Problème lors de la lecture d'un fichier.\n"); + exit(1); case -5: + printf("[ERREUR] - Problème lors de l'écriture d'un fichier.\n"); + exit(2); + case -6: printf("[ERREUR] - Le champ renseigné doit être positif.\n"); break; - case -6: + case -7: printf("[ERREUR] - L'identifiant n'existe pas.\n"); break; - case -7: + case -8: printf("[ERREUR] - La référence existe déjà.\n"); break; default: diff --git a/src/menu.c b/src/menu.c new file mode 100644 index 0000000..33ac292 --- /dev/null +++ b/src/menu.c @@ -0,0 +1,11 @@ +/** + * @file menu.c + * @brief Menu client et administrateur +*/ + +#include "main.h" + +void clientMenu() +{ + +} \ No newline at end of file diff --git a/src/traitement.c b/src/traitement.c index d258686..0b0952d 100644 --- a/src/traitement.c +++ b/src/traitement.c @@ -47,7 +47,7 @@ int chargeArticles(int reference[], float weight[], float volume[], float unitPr article = fopen("articles.txt","r"); if(article==NULL) { - printf("ERREUR: Echec de l'ouverture en lecture de 'articles.txt'.\n"); + errorHandling(-4); exit(1); } @@ -59,7 +59,7 @@ int chargeArticles(int reference[], float weight[], float volume[], float unitPr { if(tL == tmaxArticles) { - printf("Tableau trop petit.\n"); + errorHandling(-3); return tL; } From e369770244f36ce5da334789daa32fea4ac40073 Mon Sep 17 00:00:00 2001 From: Remi Date: Wed, 8 Nov 2023 08:35:39 +0100 Subject: [PATCH 05/19] reglage de bug --- src/errorHandling.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/errorHandling.c b/src/errorHandling.c index 9b933d1..8b64c67 100644 --- a/src/errorHandling.c +++ b/src/errorHandling.c @@ -28,7 +28,7 @@ void errorHandling(int error) printf("[ERREUR] - L'espace disponible du tableau est insuffisant.\n"); break; case -4: - print("ERREUR] - Problème lors de la lecture d'un fichier.\n"); + printf("ERREUR] - Problème lors de la lecture d'un fichier.\n"); exit(1); case -5: printf("[ERREUR] - Problème lors de l'écriture d'un fichier.\n"); From c3c9033546ad90a9beeef9c14b5eb749593aef0b Mon Sep 17 00:00:00 2001 From: Remi Date: Wed, 8 Nov 2023 08:40:50 +0100 Subject: [PATCH 06/19] Gestion d'erreur dans le traitement des fichiers --- src/traitement.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/traitement.c b/src/traitement.c index 0b0952d..3492cbd 100644 --- a/src/traitement.c +++ b/src/traitement.c @@ -48,7 +48,6 @@ int chargeArticles(int reference[], float weight[], float volume[], float unitPr if(article==NULL) { errorHandling(-4); - exit(1); } int ref, tL=0; @@ -98,8 +97,7 @@ int chargeClients(int clientID[], int clientPassword[], float cagnotte[], int su client = fopen("clients.txt","r"); if(client==NULL) { - printf("ERREUR: Echec de l'ouverture en lecture de 'clients.txt'.\n"); - exit(1); + errorHandling(-4); } int id, passwd, sus, tL=0, adm; @@ -110,7 +108,7 @@ int chargeClients(int clientID[], int clientPassword[], float cagnotte[], int su { if(tL == tmaxArticles) { - printf("Tableau trop petit.\n"); + errorHandling(-3); return tL; } @@ -166,14 +164,10 @@ void sauvegardeArticles(int reference[], float weight[], float volume[], float u article = fopen("articles.txt","w"); if(article==NULL) { - printf("ERREUR: Echec de l'ouverture en écriture de 'articles.txt'.\n"); - exit(1); + errorHandling(-5); } - - int i; - for(i=0; i Date: Wed, 8 Nov 2023 08:53:54 +0100 Subject: [PATCH 07/19] Modification du README --- README.md | 48 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 74126dc..9774a26 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,45 @@ -# SAE 1.01 - Implémentation d'un besoin client +=============================================== +SAÉ 1.01 - Implémentation d'un besoin client +=============================================== -__1A - Groupe 7/8:__ -- Rémi LAVERGNE -- Julien ABADIE -- Louis GERMAIN +Par: +Rémi LAVERGNE - Julien ABADIE - Louis GERMAIN +Groupe 7/8 - 1A 2023-2024 + +**Répartition du Travail** +----------------------- + +Rémi LAVERGNE : / +Louis GERMAIN : / +Julien ABADIE : / + +**Composition des fichiers sources** +-------------------------------- + +- *main.c* >> Juste la fonction main, se lançant lors de l'exécution du programme. +- *main.h* >> Tous les prototypes des fonctions réalisées, ainsi que les inclusions de module et déclaration de constantes. + + +- *articles.txt* >> Fichier texte composé de x colonnes, +- *clients.txt* >> Fichier texte composé de x colonnes dans l'ordre qui suit : + identifiant | mot de passe | cagnotte | suspendu (0=actif ; 1=suspendu) | rôle (0=client ; 1=administrateur) + + +**Fonctionnement** +------------ + + + +Jeu de données +============== + +articles.txt +``` +/ +``` + +clients.txt +``` +/ +``` \ No newline at end of file From fc6933c515fd5e1c9bb035c8cd15dfb0839fc91e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20LAVERGNE?= Date: Wed, 8 Nov 2023 08:55:03 +0100 Subject: [PATCH 08/19] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9774a26..b0c9334 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -=============================================== +===================================== SAÉ 1.01 - Implémentation d'un besoin client -=============================================== +===================================== Par: Rémi LAVERGNE - Julien ABADIE - Louis GERMAIN From b27e0ccbab414e46cac080c589a82762a2d279d4 Mon Sep 17 00:00:00 2001 From: "louis.germain" Date: Wed, 8 Nov 2023 10:49:41 +0100 Subject: [PATCH 09/19] =?UTF-8?q?d=C3=A9but=20de=20l'ajout=20du=20menu=20c?= =?UTF-8?q?lient=20et=20fix=20de=20bugs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/display.c | 47 ++++++++++++----------------------------------- src/main.h | 11 +++++++---- src/menu.c | 43 +++++++++++++++++++++++++++++++++++++++++-- src/panier.c | 18 +++++------------- 4 files changed, 65 insertions(+), 54 deletions(-) diff --git a/src/display.c b/src/display.c index 30df8e0..5847c05 100644 --- a/src/display.c +++ b/src/display.c @@ -108,53 +108,30 @@ void displayClientList(int clientID[], float cagnotte[], int suspended[], int is * @param cagnotte: pointeur indiquant la valeur de la cagnotte * @param tlog: taille logique du tableau `tab_reference` * @param tlog_basket: taille logique du panier - * @return Rien + * @return void */ -void display_basket(int basket_tab_ref[], int basket_qte[], float weight[], float volume[], float unitPrice[], int tlog, int tlog_basket) +void display_basket(int basket_tab_ref[], int basket_qte[], float weight[], float volume[], float cagnotte[], float unitPrice[], int tlog, int tlog_basket) { - float total_weight_line[tlog_basket], total_volume_line[tlog_basket], total_price_line[tlog_basket], cagnotte_line[tlog_basket], total_weight, total_volume, total_price; + float total_weight_line[tlog_basket], total_volume_line[tlog_basket], total_price_line[tlog_basket]; + float totalWeight = 0, totalVol = 0, total_price = 0; int i; for (i=0; i Date: Wed, 8 Nov 2023 15:10:47 +0100 Subject: [PATCH 10/19] =?UTF-8?q?Correction=20de=20probl=C3=A8me=20de=20du?= =?UTF-8?q?plication?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.c | 2 +- src/traitement.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 564fecd..89b1fe8 100644 --- a/src/main.c +++ b/src/main.c @@ -52,7 +52,7 @@ void global(void) +var cagnotte: tableau des cagnottes des clients */ // Déclaration des variables - int tLogArticle, tLogClient, choice, status, currentUser, clientPassword; + int tLogArticle, tLogClient, choice, status, currentUser; int reference[tmaxArticles], clientID[tmaxClients], clientPassword[tmaxClients], suspended[tmaxClients], isAdmin[tmaxClients]; float weight[tmaxArticles], volume[tmaxArticles], unitPrice[tmaxArticles], cagnotte[tmaxClients]; // Chargement de toute les données diff --git a/src/traitement.c b/src/traitement.c index 3492cbd..02f7176 100644 --- a/src/traitement.c +++ b/src/traitement.c @@ -166,8 +166,11 @@ void sauvegardeArticles(int reference[], float weight[], float volume[], float u { errorHandling(-5); } -printf("ERREUR: Echec de l'ouverture en écriture de 'clients.txt'.\n"); - exit(1);%f\n", reference[i], weight[i], volume[i], unitPrice[i]); + + int i; + for(i=0; i Date: Wed, 8 Nov 2023 16:16:18 +0100 Subject: [PATCH 11/19] =?UTF-8?q?Mise=20=C3=A0=20jour?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/clients.txt | 4 ++-- src/errorHandling.c | 3 +++ src/login.c | 22 ++++++++++++---------- src/main.c | 7 ++++--- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/clients.txt b/src/clients.txt index 30acd5e..487c6f3 100644 --- a/src/clients.txt +++ b/src/clients.txt @@ -1,2 +1,2 @@ -1313 12.1 0 0 -2010 12.1 0 0 +1313 11 12.1 0 0 +2010 22 12.1 0 0 diff --git a/src/errorHandling.c b/src/errorHandling.c index 8b64c67..41c3940 100644 --- a/src/errorHandling.c +++ b/src/errorHandling.c @@ -42,6 +42,9 @@ void errorHandling(int error) case -8: printf("[ERREUR] - La référence existe déjà.\n"); break; + case -9: + printf("[ERREUR] - Le mot de passe est incorrect.\n"); + break; default: printf("[ERREUR] - Une erreur s'est produite.\n"); break; diff --git a/src/login.c b/src/login.c index 7934d00..06252c5 100644 --- a/src/login.c +++ b/src/login.c @@ -23,9 +23,8 @@ int login(int clientID[], int clientPassword[], int isAdmin[], int tlog) printf("Erreur, l'identifiant n'existe pas, entrez votre identifiant: "); scanf("%d%*c", &id); if (id == 0) - { return -1; - } + // Nombre de tentatives restantes tentative--; if (tentative == 0) @@ -59,8 +58,8 @@ int login(int clientID[], int clientPassword[], int isAdmin[], int tlog) } else { - printf("Erreur, le mot de passe est incorrect.\n"); - return -1; + errorHandling(-9); + return -9; } } @@ -90,16 +89,19 @@ int signup(int clientID[], int clientPassword[], float cagnotte[], int suspended scanf("%d%*c", &password); while (password < 0) { + errorHandling(-6); printf("Erreur, le mot de passe doit être positif, entrez votre mot de passe: "); scanf("%d%*c", &password); } - clientPassword[*tlog] = encrypt(password); + //! Ne pas oublier de décaler vers la droite + + clientPassword[index] = encrypt(password); - clientID[*tlog] = id; - cagnotte[*tlog] = 0; - suspended[*tlog] = 0; - isAdmin[*tlog] = 0; - *tlog ++; + clientID[index] = id; + cagnotte[index] = 0; + suspended[index] = 0; + isAdmin[index] = 0; + *tlog++; return 0; } \ No newline at end of file diff --git a/src/main.c b/src/main.c index 89b1fe8..7837853 100644 --- a/src/main.c +++ b/src/main.c @@ -86,13 +86,13 @@ void global(void) status = signup(clientID, clientPassword, cagnotte, suspended, isAdmin, &tLogClient); if(status == 0) { - printf("Inscription réussie.\nRetour au menu principal...\n"); - sleep(3); + printf("Inscription réussie, vous pouvez vous connecter.\nRetour au menu principal...\n"); + sleep(2); } else { printf("Inscription échouée.\nRetour au menu principal...\n"); - sleep(3); + sleep(2); } break; case 3: @@ -100,6 +100,7 @@ void global(void) //opposition(); break; case 4: + sauvegardeDonnees(tLogArticle, tLogClient, reference, weight, volume, unitPrice, clientID, clientPassword, cagnotte, isAdmin, suspended); return; case 9: debugMenu(reference, weight, volume, unitPrice, clientID, cagnotte, suspended, isAdmin, tLogArticle, tLogClient); From bdb6ac8daade79441360eca720d0735a0db90068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20LAVERGNE?= Date: Thu, 9 Nov 2023 09:15:49 +0100 Subject: [PATCH 12/19] =?UTF-8?q?Ajout=20des=20fonctions=20de=20d=C3=A9cal?= =?UTF-8?q?age=20=C3=A0=20gauche/droite?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/decalage.c | 25 +++++++++++++++++++++++++ src/main.h | 4 ++++ 2 files changed, 29 insertions(+) create mode 100644 src/decalage.c diff --git a/src/decalage.c b/src/decalage.c new file mode 100644 index 0000000..59ac7b5 --- /dev/null +++ b/src/decalage.c @@ -0,0 +1,25 @@ +/** + * @file decalage.c + * @brief Fonctions de décalage d'un tableau + * + * Contient les fonctions de décalage de tableau vers la droite (pour l'insertion) + * et vers la gauche (pour la suppression). +*/ + +#include "main.h" + +void decalageADroite(int tab[], int index, int tlog) +{ + for (int i = tlog; i > index; i--) + { + tab[i] = tab[i-1]; + } +} + +void decalageAGauche(int tab[], int index, int tlog) +{ + for (int i = index; i < tlog; i++) + { + tab[i] = tab[i+1]; + } +} \ No newline at end of file diff --git a/src/main.h b/src/main.h index 229ce29..7195831 100644 --- a/src/main.h +++ b/src/main.h @@ -27,6 +27,10 @@ void sauvegardeDonnees(int tLogArticle, int tLogClient, int reference[], float w void sauvegardeArticles(int reference[], float weight[], float volume[], float unitPrice[], int tLogArticle); void sauvegardeClients(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int tLogClient); +//! DECALAGES TABLEAUX +void decalageADroite(int tab[], int index, int tlog); +void decalageAGauche(int tab[], int index, int tlog); + //! GESTION CLIENTS int inputClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int *tlog); void modifyClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int tlog); From a459857202dc7436cbc774fec4d7ddc5cd72c863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20LAVERGNE?= Date: Thu, 9 Nov 2023 10:19:44 +0100 Subject: [PATCH 13/19] Appel de l'ajout client dans l'inscription --- src/login.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/login.c b/src/login.c index 06252c5..7cd9646 100644 --- a/src/login.c +++ b/src/login.c @@ -65,7 +65,7 @@ int login(int clientID[], int clientPassword[], int isAdmin[], int tlog) int signup(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog) { - int id, password, index, found; + int id, password, index, found, status; printf("Entrez votre identifiant: "); scanf("%d%*c", &id); while (id < 0) @@ -94,7 +94,11 @@ int signup(int clientID[], int clientPassword[], float cagnotte[], int suspended scanf("%d%*c", &password); } - //! Ne pas oublier de décaler vers la droite + decalageADroite(clientID, index, *tlog); + decalageADroite(clientPassword, index, *tlog); + decalageADroite(cagnotte, index, *tlog); + decalageADroite(suspended, index, *tlog); + decalageADroite(isAdmin, index, *tlog); clientPassword[index] = encrypt(password); From 24f629909fc974b1d2876de584e9844cb3352a97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20LAVERGNE?= Date: Thu, 9 Nov 2023 10:21:09 +0100 Subject: [PATCH 14/19] Simplification de l'Ajout de client --- src/modif.c | 46 +++++++++++++++------------------------------- 1 file changed, 15 insertions(+), 31 deletions(-) diff --git a/src/modif.c b/src/modif.c index 78f59d3..aaf7001 100644 --- a/src/modif.c +++ b/src/modif.c @@ -9,45 +9,29 @@ * @param tlog: Taille logique de ces tableaux * @return 0 > Tout s'est bien passé, -1 > L'utilisateur a quitté, -2 > La taille physique du tableau est dépassée */ -int inputClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int *tlog) +int inputClient(int id, int passwd, int index, int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog) { - int index, found, id = -1; - float cagnotteClient; - // Vérification du dépassement de la taille physique du tableau if (*tlog == tmaxClients) { printf("[ERREUR] - La taille physique du tableau est dépassée, impossible d'ajouter un nouveau client.\n"); return -2; } + + // Décalage + decalageADroite(clientID, index, *tlog); + decalageADroite(cagnotte, index, *tlog); + decalageADroite(suspended, index, *tlog); + decalageADroite(isAdmin, index, *tlog); - while(id != 0) - { - printf("Entrez l'identifiant du client ou 0 si vous souhaitez arrêter la saisie: "); - scanf("%d%*c", &id); - while(id < 0) - { - printf("[ERREUR] - L'identifiant doit être positif, entrez l'identifiant du client ou 0 si vous souhaitez arrêter la saisie: "); - scanf("%d%*c", &id); - } - index = searchTab(clientID, id, *tlog, &found); - while(found == 1) - { - printf("Cet identifiant existe déjà, réessayer ou tapez 0 si vous souhaitez arrêter la saisie: "); - scanf("%d%*c", &id); - index = searchTab(clientID, id, *tlog, &found); - } - if(id != 0) - { - clientID[index] = id; - cagnotte[index] = 0; - suspended[index] = 0; - isAdmin[index] = 0; - *tlog++; - return 0; // Tout s'est bien passé - } - } - return -1; // L'utilisateur a quitté + clientID[index] = id; + clientPassword[index] = encrypt(passwd); + cagnotte[index] = 0; + suspended[index] = 0; + isAdmin[index] = 0; + + *tlog++; + return 0; // Tout s'est bien passé } void modifyClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int tlog) From b30a56110745a87761f0fcbabf6d1cbc33bee635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20LAVERGNE?= Date: Thu, 9 Nov 2023 17:25:27 +0100 Subject: [PATCH 15/19] Modification du main et ajout de la documentation --- src/main.c | 52 +++++++++++++++++++++++++++------------------------- src/main.h | 2 +- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/main.c b/src/main.c index 7837853..a94bbc0 100644 --- a/src/main.c +++ b/src/main.c @@ -1,21 +1,26 @@ +/** + * @file main.c + * @brief Fonctions principales du programme + * + * Contient les fonctions principales du programme, notamment le menu principal. + * La fonction main() se trouve dans ce fichier et est executée au lancement. + * La fonction global() est la fonction principale du programme. +*/ #include "main.h" +/** + * @brief Affichage du menu principal + * @return Choix de l'utilisateur +*/ int displayMenu(void) { - /* - Choix de l'action à réaliser - - +return: choix de l'action - - +var choice: choix de l'action - */ int choice; printf("\nTapez sur Entrée pour continuer..."); //TODO Clear le buffer pour éviter les problèmes if (getchar() == '\n') // getchar() pour récupérer le caractère entré par l'utilisateur { - printf("\e[1;1H\e[2J"); // Clear le terminal + system("clear"); // Clear le terminal } printf("\n=================================\n"); @@ -27,30 +32,23 @@ int displayMenu(void) printf("4. \u274C Quitter\n"); printf("9. \u26A0 Débug\n"); printf("=================================\n"); + printf("\u00A9 2023 - Pascal Inc.\n\n"); printf("Votre choix : "); scanf("%d%*c", &choice); - printf("\e[1;1H\e[2J"); + system("clear"); return choice; } +/** + * @brief Fonction globale du programme + * Crée les variables et les tableaux nécessaires au programme, + * charge les données depuis les fichiers, affiche le menu principal + * et appelle les fonctions nécessaires en fonction du choix de l'utilisateur. +*/ void global(void) { - /* - Fonction global: Exécute les autres fonctions selon les choix de l'utilisateur - - +var tLogArticle: taille logique des tableaux contenant les données des articles - +var tLogClient: taille logique des tableaux contenant les données des clients - +var choice: choix de l'action à réaliser - +var reference: tableau des références des articles - +var clientID: tableau des identifiants des clients - +var suspended: tableau de l'état du compte des clients - +var weight: tableau du poids des articles - +var volume: tableau du volume des articles - +var unitPrice: tableau du prix unitaire des actions - +var cagnotte: tableau des cagnottes des clients - */ // Déclaration des variables int tLogArticle, tLogClient, choice, status, currentUser; int reference[tmaxArticles], clientID[tmaxClients], clientPassword[tmaxClients], suspended[tmaxClients], isAdmin[tmaxClients]; @@ -60,9 +58,9 @@ void global(void) // Affichage du menu choice = displayMenu(); - while (choice != 4) + while(choice != 4) { - switch (choice) + switch(choice) { case 1: status = login(clientID, clientPassword, isAdmin, tLogClient); @@ -114,6 +112,10 @@ void global(void) } } +/** + * @brief Fonction principale du programme + * @return 0 si tout s'est bien passé et que le programme s'est terminé correctement +*/ int main(void) { global(); diff --git a/src/main.h b/src/main.h index 7195831..ff64698 100644 --- a/src/main.h +++ b/src/main.h @@ -32,7 +32,7 @@ void decalageADroite(int tab[], int index, int tlog); void decalageAGauche(int tab[], int index, int tlog); //! GESTION CLIENTS -int inputClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int *tlog); +int inputClient(int id, int passwd, int index, int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog); void modifyClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int tlog); void deleteClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int *tlog); From 74ac403e4e72fe9f1ba68f2f11e32eb3a53206cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20LAVERGNE?= Date: Thu, 9 Nov 2023 18:37:23 +0100 Subject: [PATCH 16/19] Ajout de la documentation Doxyfile --- src/display.c | 79 +++++++++++++------------ src/login.c | 30 +++++----- src/modif.c | 91 ++++++++++++++++++----------- src/panier.c | 32 ++--------- src/traitement.c | 147 +++++++++++++++++++++-------------------------- 5 files changed, 186 insertions(+), 193 deletions(-) diff --git a/src/display.c b/src/display.c index 5847c05..38c678b 100644 --- a/src/display.c +++ b/src/display.c @@ -1,5 +1,19 @@ +/** + * @file display.c + * @brief Fonctions d'affichage des articles et des clients +*/ + #include "main.h" +/** + * @brief Affichage d'un seul article + * @param tabReference: tableau des références des articles + * @param weight: tableau des poids des articles + * @param volume: tableau des volumes des articles + * @param unitPrice: tableau des prix à l'unité des articles + * @param tlog: taille logique des tableaux des articles + * @return void +*/ void displayItem(int tabReference[], float weight[], float volume[], float unitPrice[], int tlog) { int reference, index, found; @@ -20,21 +34,17 @@ void displayItem(int tabReference[], float weight[], float volume[], float unitP printf("%d\t%f\t%f\t%f", tabReference[index], weight[index], volume[index], unitPrice[index]); } +/** + * @brief Affichage de la liste des articles + * @param tabReference: tableau des références des articles + * @param weight: tableau des poids des articles + * @param volume: tableau des volumes des articles + * @param unitPrice: tableau des prix à l'unité des articles + * @param tlog: taille logique des tableaux des articles + * @return void +*/ void displayItemList(int reference[], float weight[], float volume[], float unitPrice[], int tlog) { - /* - Affichage de la liste des articles, un article par ligne, sous forme: - référence poids volume prix - Avec la référence unique du produit, le poids du produit, le volume du produit et son prix à l'unité. - - +param reference: tableau des références des articles - +param weight: tableau des poids des articles - +param volume: tableau des volumes des articles - +param unitPrice: tableau des prix à l'unité des articles - +param tlog: taille logique des tableaux des articles - - +var i: compteur servant à parcourir les données des tableaux jusqu'à leur taille logique - */ int i; printf("reference\tpoids\tvolume\tprix à l'unité"); for (i=0; i Tout s'est bien passé, -1 > L'utilisateur a quitté, -2 > La taille physique du tableau est dépassée +*/ int signup(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog) { int id, password, index, found, status; @@ -94,18 +109,5 @@ int signup(int clientID[], int clientPassword[], float cagnotte[], int suspended scanf("%d%*c", &password); } - decalageADroite(clientID, index, *tlog); - decalageADroite(clientPassword, index, *tlog); - decalageADroite(cagnotte, index, *tlog); - decalageADroite(suspended, index, *tlog); - decalageADroite(isAdmin, index, *tlog); - - clientPassword[index] = encrypt(password); - - clientID[index] = id; - cagnotte[index] = 0; - suspended[index] = 0; - isAdmin[index] = 0; - *tlog++; - return 0; + return inputClient(id, password, index, clientID, clientPassword, cagnotte, suspended, isAdmin, tlog); } \ No newline at end of file diff --git a/src/modif.c b/src/modif.c index aaf7001..78e6595 100644 --- a/src/modif.c +++ b/src/modif.c @@ -1,13 +1,22 @@ +/** + * @file modif.c + * @brief Fonctions de modification des données (ajout, suppression, modification) +*/ + #include "main.h" /** - * @brief Fonction d'inserion d'un client - * @param clientID: Tableau des identifiants client - * @param cagnotte: Tableau des cagnottes client - * @param suspended: Tableau des états de compte client - * @param isAdmin: Tableau des statuts Administrateur des clients - * @param tlog: Taille logique de ces tableaux - * @return 0 > Tout s'est bien passé, -1 > L'utilisateur a quitté, -2 > La taille physique du tableau est dépassée + * @brief Ajout d'un client dans les tableaux + * @param id: Tableau des identifiants des clients + * @param passwd: Tableau des mots de passe des clients + * @param index: Index du client à ajouter + * @param clientID: Tableau des identifiants des clients + * @param clientPassword: Tableau des mots de passe des clients + * @param cagnotte: Tableau des cagnottes des clients + * @param suspended: Tableau de l'état du compte des clients + * @param isAdmin: Tableau de l'état d'administrateur des clients + * @param tlog: Taille logique des tableaux + * @return 0 si tout s'est bien passé, -2 si la taille physique du tableau est dépassée */ int inputClient(int id, int passwd, int index, int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog) { @@ -34,21 +43,17 @@ int inputClient(int id, int passwd, int index, int clientID[], int clientPasswor return 0; // Tout s'est bien passé } +/** + * @brief Modification des données d'un client + * @param clientID: Tableau des identifiants des clients + * @param cagnotte: Tableau des cagnottes des clients + * @param suspended: Tableau de l'état du compte des clients + * @param isAdmin: Tableau de l'état d'administrateur des clients + * @param tlog: Taille logique des tableaux + * @return void +*/ void modifyClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int tlog) { - /* - Modification des données d'un client dans les tableaux - - +param clientID: tableau des identifiants des clients - +param cagnotte: tableau des cagnottes des clients - +param suspended: tableau de l'état du compte des clients - +param tlog: taille logique des tableaux des clients - - +var numClient: identifiant du client à modifier - +var index: index de l'article recherché dans le tableau pour le modifier - +var montant: montant à ajouter à la cagnotte - +var modif: modification à exécuter sur le client - */ int index, numClient, found; float montant; char modif; @@ -91,22 +96,18 @@ void modifyClient(int clientID[], float cagnotte[], int suspended[], int isAdmin isAdmin[index] = 0; } +/** + * @brief Ajout d'un ou plusieurs articles dans les tableaux d'articles (reference, poids, volume et prix) + * @param tabReference: tableau des références des articles + * @param weight: tableau des poids des articles + * @param volume: tableau des volumes des articles + * @param unitPrice: tableau des prix à l'unité des articles + * @param tlog: taille logique des tableaux des articles + * @return void + * @warning La saisie s'arrête lorsque l'utilisateur entre 0 +*/ void inputItem(int tabReference[], float tabWeight[], float tabVolume[], float unitPrice[], int *tlog) { - /* - Ajout d'un ou plusieurs articles dans les tableaux d'articles (reference, poids, volume et prix) - - +param tabReference: tableau des références des articles - +param weight: tableau des poids des articles - +param volume: tableau des volumes des articles - +param unitPrice: tableau des prix à l'unité des articles - +param tlog: taille logique des tableaux des articles - - +var reference: reference de l'article à ajouter - +var weight: poids de l'article à ajouter - +var volume: volume de l'article à ajoueter - +var price: prix de l'article à ajouter - */ int reference = -1; float weight, volume, price; while (reference != 0) @@ -151,6 +152,16 @@ void inputItem(int tabReference[], float tabWeight[], float tabVolume[], float u } } +/** + * @brief Suppression d'un ou plusieurs articles dans les tableaux d'articles (reference, poids, volume et prix) + * @param tabReference: tableau des références des articles + * @param weight: tableau des poids des articles + * @param volume: tableau des volumes des articles + * @param unitPrice: tableau des prix à l'unité des articles + * @param tlog: taille logique des tableaux des articles + * @return void + * @warning La saisie s'arrête lorsque l'utilisateur entre 0 +*/ void deleteItem(int tabReference[], float tabWeight[], float tabVolume[], float unitPrice[], int *tlog) { int reference = -1, index, i, found; @@ -181,6 +192,18 @@ void deleteItem(int tabReference[], float tabWeight[], float tabVolume[], float } } +/** + * @brief Suppression d'un ou plusieurs clients dans les tableaux des clients (clientID, clientPassword, cagnotte, suspended et isAdmin) + * @param clientID: tableau des identifiants des clients + * @param cagnotte: tableau des cagnottes des clients + * @param suspended: tableau de l'état du compte des clients + * @param isAdmin: tableau de l'état d'administrateur des clients + * @param tlog: taille logique des tableaux des clients + * @return void + * @warning La saisie s'arrête lorsque l'utilisateur entre 0 +*/ +//! Ajouter la suppression de la colonne mot de passe. +//! Utiliser la fonction décalaageAGauche void deleteClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int *tlog) { int numClient = -1, index, i, found; diff --git a/src/panier.c b/src/panier.c index a1b2bec..bbcd628 100644 --- a/src/panier.c +++ b/src/panier.c @@ -1,10 +1,13 @@ +/** + * @file panier.c + * @brief Fonctions de gestion du panier client et des contraintes +*/ + #include "main.h" void clientConstraint(float *weight, float *volume, float *price) { - /* - Saisie des contraintes du client. - */ + // Saisie des contraintes du client. printf("Entrez la charge maximale de votre véhicule en kilogrammes: "); scanf("%f", weight); while (*weight < 0) @@ -30,29 +33,6 @@ void clientConstraint(float *weight, float *volume, float *price) } } - -// TODO réécrire cette documentation -/** - * The function checks if the weight, volume, and price constraints are exceeded based on the items in - * the basket and the given constraints. - * - * @param weightConstraint The maximum weight constraint for the vehicle. - * @param volumeConstraint The volume constraint is the maximum volume that the vehicle can hold. - * @param priceConstraint A pointer to a float variable representing the maximum budget constraint. - * @param cagnotte A pointer to a float variable representing the amount of money in the user's - * account. - * @param tabWeight An array containing the weights of each item in the log. - * @param tabVolume tabVolume is an array that stores the volume of each item in the shopping basket. - * @param tabPrice tabPrice is an array that stores the prices of items in a shopping basket. - * @param tabItemRef An array containing the reference numbers of the items in the inventory. - * @param tabBasketRef tabBasketRef is an array that contains the references of the items in the - * basket. - * @param tabBasketQuantity An array that stores the quantity of each item in the basket. - * @param tlogItem The parameter "tlogItem" represents the number of items in the log. - * @param tlogBasket The parameter "tlogBasket" represents the number of items in the shopping basket. - * @return an integer value. If the constraints for weight, volume, or price are exceeded, the function - * returns -1. Otherwise, it returns 0. - */ int constraintExceeded(float weightConstraint, float volumeConstraint, float *priceConstraint, float *cagnotte, float tabWeight[], float tabVolume[], float tabPrice[], int tabItemRef[], int tabBasketRef[], int tabBasketQuantity[], int tlogItem, int tlogBasket) { int index, found, i; diff --git a/src/traitement.c b/src/traitement.c index 02f7176..7670ed0 100644 --- a/src/traitement.c +++ b/src/traitement.c @@ -5,44 +5,37 @@ #include "main.h" +/** + * @brief Chargement des données depuis les 2 fichiers vers les tableaux + * @param tLogArticle: Taille logique du tableau des articles + * @param tLogClient: Taille logique du tableau des clients + * @param reference: Tableau des références des articles + * @param weight: Tableau des poids des articles + * @param volume: Tableau des volumes des articles + * @param unitPrice: Tableau des prix à l'unité des articles + * @param clientID: Tableau des identifiants des clients + * @param clientPassword: Tableau des mots de passe des clients + * @param cagnotte: Tableau des cagnottes des clients + * @param suspended: Tableau de l'état du compte des clients + * @param isAdmin: Tableau de l'état d'administrateur des clients + * @return void +*/ void chargeDonnees(int *tLogArticle, int *tLogClient,int reference[], float weight[], float volume[], float unitPrice[], int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[]) { - /* - Chargement des données des articles et clients de fichiers vers des tableaux - - +param tLogArticle: taille logique des tableaux des articles - +param tLogClient: taille logique des tableaux des clients - +param reference: tableau des références des articles - +param weight: tableau des poids des articles - +param volume: tableau des volumes des articles - +param unitPrice: tableau des prix à l'unité des articles - +param clientID: tableau des identifiants des clients - +param cagnotte: tableau des cagnottes des clients - +param suspended: tableau de l'état du compte des clients - */ *tLogArticle = chargeArticles(reference, weight, volume, unitPrice); *tLogClient = chargeClients(clientID, clientPassword, cagnotte, suspended, isAdmin); } +/** + * @brief Chargement des données du fichier des articles vers les tableaux + * @param reference: Tableau des références des articles + * @param weight: Tableau des poids des articles + * @param volume: Tableau des volumes des articles + * @param unitPrice: Tableau des prix à l'unité des articles + * @return Taille logique des tableaux d'articles +*/ int chargeArticles(int reference[], float weight[], float volume[], float unitPrice[]) { - /* - Chargement des données des articles d'un fichier vers des tableaux - - +param reference: tableau des références des articles - +param weight: tableau des poids des articles - +param volume: tableau des volumes des articles - +param unitPrice: tableau des prix à l'unité des articles - - +return: taille logique des tableaux - - +var article: fichier 'articles.txt' ouvert en lecture - +var ref: reference de l'article - +var tL: taille logique des tableaux - +var w: poids de l'article - +var v: volume de l'article - +var up: prix de l'article à l'unité - */ FILE *article; article = fopen("articles.txt","r"); if(article==NULL) @@ -76,23 +69,17 @@ int chargeArticles(int reference[], float weight[], float volume[], float unitPr return tL; } +/** + * @brief Chargement des données du fichier des clients vers les tableaux + * @param clientID: Tableau des identifiants des clients + * @param clientPassword: Tableau des mots de passe des clients + * @param cagnotte: Tableau des cagnottes des clients + * @param suspended: Tableau de l'état du compte des clients + * @param isAdmin: Tableau de l'état d'administrateur des clients + * @return Taille logique des tableaux des clients +*/ int chargeClients(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[]) { - /* - Chargement des données des clients d'un fichier vers des tableaux - - +param clientID: tableau des identifiants des clients - +param cagnotte: tableau des cagnottes des clients - +param suspended: tableau de l'état du compte des clients - - +return: taille logique des tableaux - - +var client: fichier 'clients.txt' ouvert en lecture - +var id: identifiant du client - +var sus: état du compte du client - +var tL: taille logique des tableaux - +var cag: montant de la cagnotte du client - */ FILE *client; client = fopen("clients.txt","r"); if(client==NULL) @@ -127,39 +114,38 @@ int chargeClients(int clientID[], int clientPassword[], float cagnotte[], int su return tL; } +/** + * @brief Sauvegarde des données des tableaux vers les 2 fichiers correspondants + * @param tLogArticle: Taille logique du tableau des articles + * @param tLogClient: Taille logique du tableau des clients + * @param reference: Tableau des références des articles + * @param weight: Tableau des poids des articles + * @param volume: Tableau des volumes des articles + * @param unitPrice: Tableau des prix à l'unité des articles + * @param clientID: Tableau des identifiants des clients + * @param clientPassword: Tableau des mots de passe des clients + * @param cagnotte: Tableau des cagnottes des clients + * @param suspended: Tableau de l'état du compte des clients + * @param isAdmin: Tableau de l'état d'administrateur des clients + * @return void +*/ void sauvegardeDonnees(int tLogArticle, int tLogClient, int reference[], float weight[], float volume[], float unitPrice[], int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[]) { - /* - Sauvegarde des données des articles et clients de tableaux vers des fichiers - - +param tLogArticle: taille logique des tableaux des articles - +param tLogClient: taille logique des tableaux des clients - +param reference: tableau des références des articles - +param weight: tableau des poids des articles - +param volume: tableau des volumes des articles - +param unitPrice: tableau des prix à l'unité des articles - +param clientID: tableau des identifiants des clients - +param cagnotte: tableau des cagnottes des clients - +param suspended: tableau de l'état du compte des clients - */ sauvegardeArticles(reference, weight, volume, unitPrice, tLogArticle); sauvegardeClients(clientID, clientPassword, cagnotte, suspended, isAdmin, tLogClient); } +/** + * @brief Sauvegarde des données des articles de tableaux vers le fichier des articles + * @param reference: Tableau des références des articles + * @param weight: Tableau des poids des articles + * @param volume: Tableau des volumes des articles + * @param unitPrice: Tableau des prix à l'unité des articles + * @param tLogArticle: Taille logique des tableaux des articles + * @return void +*/ void sauvegardeArticles(int reference[], float weight[], float volume[], float unitPrice[], int tLogArticle) { - /* - Sauvegarde des données des articles de tableaux vers le fichier des articles - - +param reference: tableau des références des articles - +param weight: tableau des poids des articles - +param volume: tableau des volumes des articles - +param unitPrice: tableau des prix à l'unité des articles - +param tLogArticle: taille logique des tableaux des articles - - +var article: fichier 'articles.txt' ouvert en écriture - +var i: compteur permettant de parcourir les tableaux - */ FILE *article; article = fopen("articles.txt","w"); if(article==NULL) @@ -176,19 +162,18 @@ void sauvegardeArticles(int reference[], float weight[], float volume[], float u fclose(article); } +/** + * @brief Sauvegarde des données des clients de tableaux vers le fichier des clients + * @param clientID: Tableau des identifiants des clients + * @param clientPassword: Tableau des mots de passe des clients + * @param cagnotte: Tableau des cagnottes des clients + * @param suspended: Tableau de l'état du compte des clients + * @param isAdmin: Tableau de l'état d'administrateur des clients + * @param tLogClient: Taille logique des tableaux des clients + * @return void +*/ void sauvegardeClients(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int tLogClient) { - /* - Sauvegarde des données des articles de tableaux vers le fichier des articles - - +param clientID: tableau des identifiants des clients - +param cagnotte: tableau des cagnottes des clients - +param suspended: tableau de l'état du compte des clients - +param tLogClient: taille logique des tableaux des clients - - +var client: fichier 'clients.txt' ouvert en lecture - +var i: compteur permettant de parcourir les tableaux - */ FILE *client; client = fopen("clients.txt","w"); if(client==NULL) From e8df641096a346a0894139e02bc13956e8e816ff Mon Sep 17 00:00:00 2001 From: "louis.germain" Date: Thu, 9 Nov 2023 23:30:19 +0100 Subject: [PATCH 17/19] correction d'erreur et ajout du menu client --- src/display.c | 35 ++++++++++++++++++++++------------- src/main.h | 4 ++-- src/menu.c | 11 +++++++++-- src/panier.c | 15 ++++++--------- 4 files changed, 39 insertions(+), 26 deletions(-) diff --git a/src/display.c b/src/display.c index 38c678b..8a155df 100644 --- a/src/display.c +++ b/src/display.c @@ -108,33 +108,42 @@ void displayClientList(int clientID[], float cagnotte[], int suspended[], int is * @param weight: tableau des poids des articles * @param volume: tableau du volume des articles * @param unitPrice: tableau du prix unitaire des articles - * @param cagnotte: pointeur indiquant la valeur de la cagnotte + * @param cagnotte: valeur de la cagnotte * @param tlog: taille logique du tableau `tab_reference` * @param tlog_basket: taille logique du panier * @return void */ -void display_basket(int basket_tab_ref[], int basket_qte[], float weight[], float volume[], float cagnotte[], float unitPrice[], int tlog, int tlog_basket) +void display_basket(int basket_tab_ref[], int tabItemRef[], int basket_qte[], float tabWeight[], float tabVolume[], float cagnotte, float tabUnitPrice[], int tlogItem, int tlog_basket) { float total_weight_line[tlog_basket], total_volume_line[tlog_basket], total_price_line[tlog_basket]; - float totalWeight = 0, totalVol = 0, total_price = 0; - int i; + float totalWeight = 0, totalVol = 0, total_price = 0, weight[tmaxArticles], volume[tmaxArticles], unitPrice[tmaxArticles]; + int i, found, index, j = 0; + + + printf("Récapitulatif de votre panier:\n"); + printf("Référence\tQuantité\tPoids\tVolume\tPrix unitaire\tPoids Total\tVol Total\tPrix Total\n"); + for (i=0; i Date: Fri, 10 Nov 2023 00:09:32 +0100 Subject: [PATCH 18/19] Ajout du menu admin et reglage d'erreurs --- src/login.c | 4 ++-- src/main.h | 8 ++++---- src/menu.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++-- src/modif.c | 5 ++--- 4 files changed, 64 insertions(+), 11 deletions(-) diff --git a/src/login.c b/src/login.c index d175957..0232656 100644 --- a/src/login.c +++ b/src/login.c @@ -78,7 +78,7 @@ int login(int clientID[], int clientPassword[], int isAdmin[], int tlog) * @param tlog: Taille logique des Tableaux * @return 0 > Tout s'est bien passé, -1 > L'utilisateur a quitté, -2 > La taille physique du tableau est dépassée */ -int signup(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog) +void signup(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog) { int id, password, index, found, status; printf("Entrez votre identifiant: "); @@ -109,5 +109,5 @@ int signup(int clientID[], int clientPassword[], float cagnotte[], int suspended scanf("%d%*c", &password); } - return inputClient(id, password, index, clientID, clientPassword, cagnotte, suspended, isAdmin, tlog); + inputClient(id, password, index, clientID, clientPassword, cagnotte, suspended, isAdmin, tlog); } \ No newline at end of file diff --git a/src/main.h b/src/main.h index e39b0e5..0d8c399 100644 --- a/src/main.h +++ b/src/main.h @@ -32,7 +32,7 @@ void decalageADroite(int tab[], int index, int tlog); void decalageAGauche(int tab[], int index, int tlog); //! GESTION CLIENTS -int inputClient(int id, int passwd, int index, int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog); +void inputClient(int id, int passwd, int index, int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog); void modifyClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int tlog); void deleteClient(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int *tlog); @@ -58,12 +58,12 @@ void basket_del_article(int basket_tab_ref[], int basket_tab_qte[], int *tlog_ba //! LOGIN int login(int clientID[], int clientPassword[], int isAdmin[], int tlog); -int signup(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog); +void signup(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog); //! MOT DE PASSE int encrypt(int password); int decrypt(int password); //! MENUS -void adminMenu(void); -void clientMenu(float *weight, float *volume, float *price); \ No newline at end of file +void adminMenu(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int tabReference[], float tabWeight[], float tabVolume[], float unitPrice[], int *tlogItem, int *tlogClient); +void clientMenu(float *weight, float *volume, float *price, int tabItemRef[], float unitPrice[], float *cagnotte, int basket_tab_ref[], int basket_tab_qte[], float tabWeight[], float tabVolume[], float tabPrice[], int tlogItem, int *tlogBasket); \ No newline at end of file diff --git a/src/menu.c b/src/menu.c index 77b3479..1b62717 100644 --- a/src/menu.c +++ b/src/menu.c @@ -51,7 +51,61 @@ void clientMenu(float *weight, float *volume, float *price, int tabItemRef[], fl } } -void adminMenu(void) +void adminMenu(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int tabReference[], float tabWeight[], float tabVolume[], float unitPrice[], int *tlogItem, int *tlogClient) { - + int choice = 0; + while (choice != 10) + { + printf("\n=================================\n"); + printf(" Menu Client\n"); + printf("=================================\n"); + printf("1\u2022 Ajouter un client\n"); + printf("2\u2022 Modifier les données d'un client\n"); + printf("3\u2022 Supprimer un client\n"); + printf("4\u2022 Ajouter un article\n"); + printf("5\u2022 Supprimer un article\n"); + printf("6\u2022 Afficher les données d'un article\n"); + printf("7\u2022 Afficher la liste des articles\n"); + printf("8\u2022 Afficher les données d'un client\n"); + printf("9\u2022 Afficher la liste des clients\n"); + printf("10\u2022 Quitter\n"); + printf("=================================\n"); + printf("Votre choix: "); + scanf("%d", &choice); + switch (choice) + { + case 1: + signup(clientID, clientPassword, cagnotte, suspended, isAdmin, tlogClient); + break; + case 2: + modifyClient(clientID, cagnotte, suspended, isAdmin, *tlogClient); + break; + case 3: + deleteClient(clientID, cagnotte, suspended, isAdmin, tlogClient); + break; + case 4: + inputItem(tabReference, tabWeight, tabVolume, unitPrice, tlogItem); + break; + case 5: + deleteItem(tabReference, tabWeight, tabVolume, unitPrice, tlogItem); + break; + case 6: + displayItem(tabReference, tabWeight, tabVolume, unitPrice, *tlogItem); + break; + case 7: + displayItemList(tabReference, tabWeight, tabVolume, unitPrice, *tlogItem); + break; + case 8: + displayClient(clientID, cagnotte, suspended, isAdmin, *tlogClient); + break; + case 9: + displayClientList(clientID, cagnotte, suspended, isAdmin, *tlogClient); + break; + case 10: + return; + default: + printf("Erreur, veuillez entrer un choix valide.\n"); + break; + } + } } \ No newline at end of file diff --git a/src/modif.c b/src/modif.c index 78e6595..686486d 100644 --- a/src/modif.c +++ b/src/modif.c @@ -18,13 +18,13 @@ * @param tlog: Taille logique des tableaux * @return 0 si tout s'est bien passé, -2 si la taille physique du tableau est dépassée */ -int inputClient(int id, int passwd, int index, int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog) +void inputClient(int id, int passwd, int index, int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog) { // Vérification du dépassement de la taille physique du tableau if (*tlog == tmaxClients) { printf("[ERREUR] - La taille physique du tableau est dépassée, impossible d'ajouter un nouveau client.\n"); - return -2; + return; } // Décalage @@ -40,7 +40,6 @@ int inputClient(int id, int passwd, int index, int clientID[], int clientPasswor isAdmin[index] = 0; *tlog++; - return 0; // Tout s'est bien passé } /** From d6157c8d1674ec7a1da53b6e7747b11daee1ed22 Mon Sep 17 00:00:00 2001 From: "louis.germain" Date: Fri, 10 Nov 2023 09:24:49 +0100 Subject: [PATCH 19/19] fix de divers erreurs --- src/decalage.c | 20 ++++++++++++++------ src/display.c | 17 ++++++++--------- src/exe | Bin 26096 -> 39560 bytes src/login.c | 23 ++++++++++++----------- src/main.c | 18 ++++++++---------- src/main.h | 17 ++++++++++------- src/menu.c | 6 +++--- src/modif.c | 8 ++++---- src/panier.c | 8 ++++---- 9 files changed, 63 insertions(+), 54 deletions(-) mode change 100644 => 100755 src/exe diff --git a/src/decalage.c b/src/decalage.c index 59ac7b5..483a0cd 100644 --- a/src/decalage.c +++ b/src/decalage.c @@ -8,18 +8,26 @@ #include "main.h" -void decalageADroite(int tab[], int index, int tlog) +void decalageADroiteInt(int tab[], int index, int tlog) { for (int i = tlog; i > index; i--) - { tab[i] = tab[i-1]; - } } -void decalageAGauche(int tab[], int index, int tlog) +void decalageAGaucheInt(int tab[], int index, int tlog) +{ + for (int i = index; i < tlog; i++) + tab[i] = tab[i+1]; +} + +void decalageADroiteFloat(float tab[], int index, int tlog) +{ + for (int i = tlog; i > index; i--) + tab[i] = tab[i-1]; +} + +void decalageAGaucheFloat(float tab[], int index, int tlog) { for (int i = index; i < tlog; i++) - { tab[i] = tab[i+1]; - } } \ No newline at end of file diff --git a/src/display.c b/src/display.c index 8a155df..7925d39 100644 --- a/src/display.c +++ b/src/display.c @@ -117,7 +117,7 @@ void display_basket(int basket_tab_ref[], int tabItemRef[], int basket_qte[], fl { float total_weight_line[tlog_basket], total_volume_line[tlog_basket], total_price_line[tlog_basket]; float totalWeight = 0, totalVol = 0, total_price = 0, weight[tmaxArticles], volume[tmaxArticles], unitPrice[tmaxArticles]; - int i, found, index, j = 0; + int i, found, index; printf("Récapitulatif de votre panier:\n"); @@ -128,14 +128,13 @@ void display_basket(int basket_tab_ref[], int tabItemRef[], int basket_qte[], fl index = searchTab(tabItemRef, basket_tab_ref[i], tlogItem, &found); if (found == 1) { - weight[j] = tabWeight[index]; - volume[j] = tabVolume[index]; - unitPrice[j] = tabUnitPrice[index]; - j++; + weight[i] = tabWeight[index]; + volume[i] = tabVolume[index]; + unitPrice[i] = tabUnitPrice[index]; } - total_weight_line[i] = basket_qte[i]*weight; - total_volume_line[i] = basket_qte[i]*volume; - total_price_line[i] = basket_qte[i]*unitPrice; + total_weight_line[i] = basket_qte[i]*weight[i]; + total_volume_line[i] = basket_qte[i]*volume[i]; + total_price_line[i] = basket_qte[i]*unitPrice[i]; totalWeight += total_weight_line[i]; totalVol += total_volume_line [i]; total_price += total_price_line[i]; @@ -145,5 +144,5 @@ void display_basket(int basket_tab_ref[], int tabItemRef[], int basket_qte[], fl printf("Prix total: %f€\n", total_price); printf("Poids total: %fkg\n", totalWeight); printf("Volume total: %fm³\n", totalVol); - printf("Cagnotte:%.2f€", cagnotte) + printf("Cagnotte:%.2f€", cagnotte); } diff --git a/src/exe b/src/exe old mode 100644 new mode 100755 index 91811c85ed3f5bc96c0c4b06c0ab642770ae1a84..d10b2c6427893daf04aa4c048adbcbb61f103793 GIT binary patch literal 39560 zcmeHw3wTu3wf{*1@(?poQE7dRS_>$I@RWzC1TrwOi4925s&pJ?CS)|p#Cafa4WcpC z=`b2w@v67}OTF4ct1VjbrdA~(XwYgKy|$)`ZBSY#P1Go8V~foFt+gL>&SVDB`}*JS zY#G z#_7f}xF5zaQ9fTJC>2*tt~DJg;dw}jZi_5WPfwG0Dpe9vN_5$-B3Xe-jRJv5bi*kt z@6*%9xdKn6s$ADsDawtsboMy{u2M4{=_b)A$`f&Gs@l6vwqMcFEzu21xFO~IW)5|z1 zze;8G#*|wB%2_j})Osh^`s*WWCa;-2Yx1lag`q&wB)j;WjW{p2?P z%nk87wp=}Bo@e{?=?|0KBm?my9J&Z!sh`pl@S$?iuA7h(FiKzc{icr6Y?mDcM4x^= z0DwImi2IrNWWql+3*3j0BpjkIPmMch zRQm$e#wwq<(TLRov)WS|2>FcA+ECb6XH+)?{q^B$BUJ12HGrvSjoVf2uXoq_*ZFV@ z1NOK=VRta>s&o764Z0`$onb%A=x%_UGXBBG&W*?IW3{v$X+DW&fmeBX>zjnh;7{^N*lql87i>>owA zcjKNe<kx>Cx;_4II_LQ4Ji`z)=kx z)xiH{4LF=D}-@MT%tY1haO-K6Bqw@{QkcOSlOXU<2C?rW&LwZD)lz-{R4DQAz|;;e19L^Q^?d?$@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qk=clk} z^OWtEP%Xx$3824KeFfhI#af@$OV-5#s-nc|{;2wUL9o`Zmlf(|eWjrK)erXO>Wb`Ncge%t=kx}*KV~3`y`c|lYS939TyKJAy2|&|mCO%3Z6@Q7W ibhlJzw_hPj&pC*yUByd}6%H0o3dje&QH~0ZBKt2>GB^zY diff --git a/src/login.c b/src/login.c index 0232656..3e53c34 100644 --- a/src/login.c +++ b/src/login.c @@ -12,9 +12,9 @@ * @param tlog: Taille logique des Tableaux * @return Est Admin ? (1 > Oui, 0 > Non, -1 > Quitter) */ -int login(int clientID[], int clientPassword[], int isAdmin[], int tlog) +int login(int clientID[], int clientPassword[], int isAdmin[], int tlog, int *index) { - int id, password, index, found, tentative=3; + int id, password, found, tentative=3; printf("Entrez votre identifiant: "); scanf("%d%*c", &id); while (id < 0) @@ -22,7 +22,7 @@ int login(int clientID[], int clientPassword[], int isAdmin[], int tlog) printf("Erreur, l'identifiant doit être positif, entrez votre identifiant: "); scanf("%d%*c", &id); } - index = searchTab(clientID, id, tlog, &found); + *index = searchTab(clientID, id, tlog, &found); while(found == 0) { printf("Erreur, l'identifiant n'existe pas, entrez votre identifiant: "); @@ -39,7 +39,7 @@ int login(int clientID[], int clientPassword[], int isAdmin[], int tlog) } printf("Il vous reste %d tentatives.\n", tentative); - index = searchTab(clientID, id, tlog, &found); + *index = searchTab(clientID, id, tlog, &found); } printf("Entrez votre mot de passe: "); @@ -50,9 +50,9 @@ int login(int clientID[], int clientPassword[], int isAdmin[], int tlog) scanf("%d%*c", &password); } - if (password == decrypt(clientPassword[index])) + if (password == decrypt(clientPassword[*index])) { - if (isAdmin[index] == 1) + if (isAdmin[*index] == 1) { return 1; } @@ -78,20 +78,20 @@ int login(int clientID[], int clientPassword[], int isAdmin[], int tlog) * @param tlog: Taille logique des Tableaux * @return 0 > Tout s'est bien passé, -1 > L'utilisateur a quitté, -2 > La taille physique du tableau est dépassée */ -void signup(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog) +int signup(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog) { - int id, password, index, found, status; - printf("Entrez votre identifiant: "); + int id, password, index, found; + printf("Entrez votre identifiant ou 0 si vous souhaitez quitter: "); scanf("%d%*c", &id); while (id < 0) { - printf("Erreur, l'identifiant doit être positif, entrez votre identifiant: "); + printf("Erreur, l'identifiant doit être positif, entrez votre identifiant ou 0 si vous souhaitez quitter: "); scanf("%d%*c", &id); } index = searchTab(clientID, id, *tlog, &found); while(found == 1) { - printf("Erreur, l'identifiant existe déjà, entrez votre identifiant: "); + printf("Erreur, l'identifiant existe déjà, entrez votre identifiant ou 0 si vous souhaitez quitter: "); scanf("%d%*c", &id); if (id == 0) { @@ -110,4 +110,5 @@ void signup(int clientID[], int clientPassword[], float cagnotte[], int suspende } inputClient(id, password, index, clientID, clientPassword, cagnotte, suspended, isAdmin, tlog); + return 0; } \ No newline at end of file diff --git a/src/main.c b/src/main.c index a94bbc0..73224b8 100644 --- a/src/main.c +++ b/src/main.c @@ -50,11 +50,11 @@ int displayMenu(void) void global(void) { // Déclaration des variables - int tLogArticle, tLogClient, choice, status, currentUser; - int reference[tmaxArticles], clientID[tmaxClients], clientPassword[tmaxClients], suspended[tmaxClients], isAdmin[tmaxClients]; + int tLogItem, tLogClient, tlogBasket, choice, status, currentUser, index; + int reference[tmaxArticles], clientID[tmaxClients], clientPassword[tmaxClients], suspended[tmaxClients], isAdmin[tmaxClients], basket_tab_ref[tmaxArticles], basket_tab_qte[tmaxArticles]; float weight[tmaxArticles], volume[tmaxArticles], unitPrice[tmaxArticles], cagnotte[tmaxClients]; // Chargement de toute les données - chargeDonnees(&tLogArticle, &tLogClient, reference, weight, volume, unitPrice, clientID, clientPassword, cagnotte, suspended, isAdmin); + chargeDonnees(&tLogItem, &tLogClient, reference, weight, volume, unitPrice, clientID, clientPassword, cagnotte, suspended, isAdmin); // Affichage du menu choice = displayMenu(); @@ -63,16 +63,14 @@ void global(void) switch(choice) { case 1: - status = login(clientID, clientPassword, isAdmin, tLogClient); + status = login(clientID, clientPassword, isAdmin, tLogClient, &index); if(status == 1) { - //TODO > Menu Admin - //adminMenu(); + adminMenu(clientID, clientPassword, cagnotte, suspended, isAdmin, reference, weight, volume, unitPrice, &tLogItem, &tLogClient); } else if(status == 0) { - //TODO > Menu Client - //clientMenu(); + clientMenu(&weight[index], &volume[index], &unitPrice[index], reference, unitPrice, &cagnotte[index], basket_tab_ref, basket_tab_qte, weight, volume, tLogItem, &tlogBasket); } else { @@ -98,10 +96,10 @@ void global(void) //opposition(); break; case 4: - sauvegardeDonnees(tLogArticle, tLogClient, reference, weight, volume, unitPrice, clientID, clientPassword, cagnotte, isAdmin, suspended); + sauvegardeDonnees(tLogItem, tLogClient, reference, weight, volume, unitPrice, clientID, clientPassword, cagnotte, isAdmin, suspended); return; case 9: - debugMenu(reference, weight, volume, unitPrice, clientID, cagnotte, suspended, isAdmin, tLogArticle, tLogClient); + debugMenu(reference, weight, volume, unitPrice, clientID, cagnotte, suspended, isAdmin, tLogItem, tLogClient); break; default: printf("Erreur, veuillez entrer un choix valide.\n"); diff --git a/src/main.h b/src/main.h index 0d8c399..3cfefa9 100644 --- a/src/main.h +++ b/src/main.h @@ -28,8 +28,10 @@ void sauvegardeArticles(int reference[], float weight[], float volume[], float u void sauvegardeClients(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int tLogClient); //! DECALAGES TABLEAUX -void decalageADroite(int tab[], int index, int tlog); -void decalageAGauche(int tab[], int index, int tlog); +void decalageADroiteInt(int tab[], int index, int tlog); +void decalageAGaucheInt(int tab[], int index, int tlog); +void decalageADroiteFloat(float tab[], int index, int tlog); +void decalageAGaucheFloat(float tab[], int index, int tlog); //! GESTION CLIENTS void inputClient(int id, int passwd, int index, int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog); @@ -53,12 +55,13 @@ int searchTab(int targetTab[], int valSearched, int tLog, int *found); void clientConstraint(float *weight, float *volume, float *price); int constraintExceeded(float weightConstraint, float volumeConstraint, float *priceConstraint, float *cagnotte, float tabWeight[], float tabVolume[], float tabPrice[], int tabItemRef[], int tabBasketRef[], int tabBasketQuantity[], int tlogItem, int tlogBasket); void basket_add(int tab_reference[], float unitPrice[], float *cagnotte, int basket_tab_ref[], int basket_tab_qte[], int tlogItem, int *tlog_basket); -void display_basket(int basket_tab_ref[], int basket_qte[], float weight[], float volume[], float cagnotte[], float unitPrice[], int tlog, int tlog_basket); -void basket_del_article(int basket_tab_ref[], int basket_tab_qte[], int *tlog_basket) +void display_basket(int basket_tab_ref[], int tabItemRef[], int basket_qte[], float tabWeight[], float tabVolume[], float cagnotte, float tabUnitPrice[], int tlogItem, int tlog_basket); +void reinit_basket(int *tlog_basket); +void basket_del_article(int basket_tab_ref[], int basket_tab_qte[], int *tlog_basket); //! LOGIN -int login(int clientID[], int clientPassword[], int isAdmin[], int tlog); -void signup(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog); +int login(int clientID[], int clientPassword[], int isAdmin[], int tlog, int *index); +int signup(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int *tlog); //! MOT DE PASSE int encrypt(int password); @@ -66,4 +69,4 @@ int decrypt(int password); //! MENUS void adminMenu(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int tabReference[], float tabWeight[], float tabVolume[], float unitPrice[], int *tlogItem, int *tlogClient); -void clientMenu(float *weight, float *volume, float *price, int tabItemRef[], float unitPrice[], float *cagnotte, int basket_tab_ref[], int basket_tab_qte[], float tabWeight[], float tabVolume[], float tabPrice[], int tlogItem, int *tlogBasket); \ No newline at end of file +void clientMenu(float *weight, float *volume, float *price, int tabItemRef[], float unitPrice[], float *cagnotte, int basket_tab_ref[], int basket_tab_qte[], float tabWeight[], float tabVolume[], int tlogItem, int *tlogBasket); \ No newline at end of file diff --git a/src/menu.c b/src/menu.c index 1b62717..c37aeb3 100644 --- a/src/menu.c +++ b/src/menu.c @@ -5,7 +5,7 @@ #include "main.h" -void clientMenu(float *weight, float *volume, float *price, int tabItemRef[], float unitPrice[], float *cagnotte, int basket_tab_ref[], int basket_tab_qte[], float tabWeight[], float tabVolume[], float tabPrice[], int tlogItem, int *tlogBasket) +void clientMenu(float *weight, float *volume, float *price, int tabItemRef[], float unitPrice[], float *cagnotte, int basket_tab_ref[], int basket_tab_qte[], float tabWeight[], float tabVolume[], int tlogItem, int *tlogBasket) { int choice = 0, constraint; while (choice != 6) @@ -29,12 +29,12 @@ void clientMenu(float *weight, float *volume, float *price, int tabItemRef[], fl break; case 2: basket_add(tabItemRef, unitPrice, cagnotte, basket_tab_ref, basket_tab_qte, tlogItem, tlogBasket); - constraint = constraintExceeded(*weight, *volume, price, cagnotte, tabWeight, tabVolume, tabPrice, tabItemRef, basket_tab_ref, basket_tab_qte, tlogItem, *tlogBasket); + constraint = constraintExceeded(*weight, *volume, price, cagnotte, tabWeight, tabVolume, unitPrice, tabItemRef, basket_tab_ref, basket_tab_qte, tlogItem, *tlogBasket); if (constraint == -1) basket_del_article(basket_tab_ref, basket_tab_qte, tlogBasket); break; case 3: - display_basket(basket_tab_ref[], tabItemRef[], basket_tab_qte[], tabWeight[], tabVolume[], *cagnotte, tabPrice[], tlogItem, *tlogBasket); + display_basket(basket_tab_ref, tabItemRef, basket_tab_qte, tabWeight, tabVolume, *cagnotte, unitPrice, tlogItem, *tlogBasket); break; case 4: reinit_basket(tlogBasket); diff --git a/src/modif.c b/src/modif.c index 686486d..c442074 100644 --- a/src/modif.c +++ b/src/modif.c @@ -28,10 +28,10 @@ void inputClient(int id, int passwd, int index, int clientID[], int clientPasswo } // Décalage - decalageADroite(clientID, index, *tlog); - decalageADroite(cagnotte, index, *tlog); - decalageADroite(suspended, index, *tlog); - decalageADroite(isAdmin, index, *tlog); + decalageADroiteInt(clientID, index, *tlog); + decalageADroiteFloat(cagnotte, index, *tlog); + decalageADroiteInt(suspended, index, *tlog); + decalageADroiteInt(isAdmin, index, *tlog); clientID[index] = id; clientPassword[index] = encrypt(passwd); diff --git a/src/panier.c b/src/panier.c index 8768f3b..bc97423 100644 --- a/src/panier.c +++ b/src/panier.c @@ -106,7 +106,7 @@ int constraintExceeded(float weightConstraint, float volumeConstraint, float *pr void basket_add(int tab_reference[], float unitPrice[], float *cagnotte, int basket_tab_ref[], int basket_tab_qte[], int tlogItem, int *tlog_basket) { int ref_to_add, qte_to_add, trouve, index_ajout; - float total_weight[tlog_basket], total_volume[tlog_basket], total_price[tlog_basket], total_cagnotte[tlog_basket]; + float total_weight[tmaxArticles], total_volume[tmaxArticles], total_price[tmaxArticles], total_cagnotte[tmaxArticles]; printf("Quelle référence souhaitez-vous ajouter au panier?"); scanf("%d", &ref_to_add); index_ajout = searchTab(tab_reference, ref_to_add, tlogItem, &trouve); @@ -155,12 +155,12 @@ void basket_del_article(int basket_tab_ref[], int basket_tab_qte[], int *tlog_ba printf("Quelle référence voulez vous supprimer de votre panier?\n"); scanf("%d",&ref_to_del); - index_to_del = searchTab(basket_tab_ref, ref_to_del, tlog_basket, &trouve); + index_to_del = searchTab(basket_tab_ref, ref_to_del, *tlog_basket, &trouve); while (trouve == 0) { printf("Erreur, la valeur que vous voulez supprimer n'existe pas, réssayez"); scanf("%d",&ref_to_del); - index_to_del = searchTab(basket_tab_ref, ref_to_del, tlog_basket, &trouve); + index_to_del = searchTab(basket_tab_ref, ref_to_del, *tlog_basket, &trouve); } if (basket_tab_qte[index_to_del]>1) { @@ -184,7 +184,7 @@ void basket_del_article(int basket_tab_ref[], int basket_tab_qte[], int *tlog_ba } else if (qte_to_del==basket_tab_qte[index_to_del]) { - for (i=tlog_basket; i>index_to_del; i--) + for (i=*tlog_basket; i>index_to_del; i--) { basket_tab_ref[i]=basket_tab_ref[i+1]; basket_tab_qte[i]=basket_tab_qte[i+1];