From dd340da9b42b4514f59b4f4fdcb67447c22875e3 Mon Sep 17 00:00:00 2001 From: Djery-Tom Date: Fri, 16 Oct 2020 19:29:27 +0100 Subject: [PATCH] + Fix bug on nano credits history --- app/Http/Controllers/NanoCreditController.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/NanoCreditController.php b/app/Http/Controllers/NanoCreditController.php index b167de0..47926f5 100755 --- a/app/Http/Controllers/NanoCreditController.php +++ b/app/Http/Controllers/NanoCreditController.php @@ -190,8 +190,8 @@ class NanoCreditController extends Controller // Demandes de nano credit et d'epargnes public function getAllNanoCreditsDemands($id_user, Request $request) { - $demandes = DB::select("SELECT 'N' as type_historique , i.* FROM infos_users_demandes_credits i WHERE id_user = :id ;", ['id' => $id_user]); - $savings = DB::select("SELECT 'E' as type_historique , i.* FROM infos_users_epargnes i WHERE id_user = :id;", ['id' => $id_user]); + $demandes = DB::select("SELECT 'N' as type_historique , i.user as destinataire, i.* FROM infos_users_demandes_credits i WHERE id_user = :id ;", ['id' => $id_user]); + $savings = DB::select("SELECT 'E' as type_historique ,i.user as destinataire, i.* FROM infos_users_epargnes i WHERE id_user = :id;", ['id' => $id_user]); // Supprimer les underscore sur les etats $merge = array_map(function ($demand) { @@ -208,7 +208,7 @@ class NanoCreditController extends Controller public function getNanoCreditsDemands($id_user) { - $demandes = DB::select('SELECT * FROM infos_users_demandes_credits WHERE id_user = :id ORDER BY date_creation DESC;', ['id' => $id_user]); + $demandes = DB::select('SELECT i.user as destinataire, i.* FROM infos_users_demandes_credits i WHERE i.id_user = :id ORDER BY i.date_creation DESC;', ['id' => $id_user]); $result = array_map(function ($demand) { $demand->etat = str_replace('_', ' ', $demand->etat); @@ -220,7 +220,7 @@ class NanoCreditController extends Controller // Demandes de credits en cours pour le remboursement public function getNanoCreditsDemandsInProgress($id_user) { - $demandes = DB::select("SELECT * FROM infos_users_demandes_credits WHERE id_user = :id AND etat = 'VALIDE' ORDER BY date_creation DESC;", ['id' => $id_user]); + $demandes = DB::select("SELECT i.user as destinataire, i.* FROM infos_users_demandes_credits i WHERE i.id_user = :id AND i.etat = 'VALIDE' ORDER BY date_creation DESC;", ['id' => $id_user]); $result = array_map(function ($demand) { $demand->etat = str_replace('_', ' ', $demand->etat); return $demand; @@ -230,7 +230,7 @@ class NanoCreditController extends Controller public function getGuaranteeNanoCreditsDemands($id_wallet_agent) { - $demandes = DB::select('SELECT * FROM infos_users_demandes_credits WHERE id_wallet_agent = :id ORDER BY date_creation DESC;' + $demandes = DB::select('SELECT i.user as destinataire, i.* FROM infos_users_demandes_credits i WHERE i.id_wallet_agent = :id ORDER BY i.date_creation DESC;' , ['id' => $id_wallet_agent]); $result = array_map(function ($demand) { $demand->etat = str_replace('_', ' ', $demand->etat); @@ -241,7 +241,7 @@ class NanoCreditController extends Controller public function getSavingsDemands($id_user) { - $savings = DB::select('SELECT * FROM infos_users_epargnes WHERE id_user = :id ORDER BY date_creation DESC;', ['id' => $id_user]); + $savings = DB::select('SELECT i.user as destinataire, i.* FROM infos_users_epargnes i WHERE i.id_user = :id ORDER BY i.date_creation DESC;', ['id' => $id_user]); $result = array_map(function ($demand) { $demand->etat = str_replace('_', ' ', $demand->etat); return $demand; @@ -252,7 +252,7 @@ class NanoCreditController extends Controller // Demandes d'epargnes pour la cassation public function getSavingsDemandsInProgress($id_user) { - $savings = DB::select("SELECT * FROM infos_users_epargnes WHERE id_user = :id AND etat = 'EN_COURS' ORDER BY date_creation DESC;", ['id' => $id_user]); + $savings = DB::select("SELECT i.user as destinataire, i.* FROM infos_users_epargnes i WHERE i.id_user = :id AND i.etat = 'EN_COURS' ORDER BY i.date_creation DESC;", ['id' => $id_user]); $result = array_map(function ($demand) { $demand->etat = str_replace('_', ' ', $demand->etat); return $demand;