From 0df17bafc22a561a6a223b0ebd36523699dfd450 Mon Sep 17 00:00:00 2001 From: Djery-Tom Date: Mon, 25 Jan 2021 10:51:05 +0100 Subject: [PATCH] + Fix some bug --- application/controllers/Gestion.php | 39 ++++------ application/models/User_model.php | 3 +- .../views/historique_transactions_deleted.php | 72 ------------------- 3 files changed, 16 insertions(+), 98 deletions(-) diff --git a/application/controllers/Gestion.php b/application/controllers/Gestion.php index 11d09466..a421595a 100755 --- a/application/controllers/Gestion.php +++ b/application/controllers/Gestion.php @@ -625,19 +625,11 @@ class Gestion extends CI_Controller } $data['alert'] = "ok"; $data['success'] = "ok"; - $data['active'] = "members"; $data['message'] = "$number codes have been added!"; - - $ville = $this->session->userdata('current_ville'); - $hyper = $this->session->userdata('current_hyper'); - $pays = $this->session->userdata('current_pays'); - $data['pays'] = $this->user_model->getAllCountries(); - $data['hyper'] = $this->user_model->getAllHyper($data['pays']->first_row()->id); - $data['ville'] = $this->user_model->getVilleNetworkByHyper($data['hyper']->first_row()->code_membre); $data['list'] = $this->user_model->getGeneratedHyperCodes(); - $data['active'] = "codes"; + $data['active'] = "codes-hyper"; $data['pays'] = $this->user_model->getAllCountries(); $data['game_pays'] = $this->user_model->getGameCountry(); $data['firstname'] = $this->session->userdata('firstname'); @@ -701,11 +693,6 @@ class Gestion extends CI_Controller $this->load->view('login', $data); } else { - $ville = $this->session->userdata('current_ville'); - $hyper = $this->session->userdata('current_hyper'); - $pays = $this->session->userdata('current_pays'); - - $data['pays'] = $this->user_model->getAllCountries(); $data['game_pays'] = $this->user_model->getGameCountry(); $data['villes'] = $this->user_model->getVillesByPays($data['pays']->first_row()->id); @@ -713,18 +700,20 @@ class Gestion extends CI_Controller $data['active_ville_id'] = $data['villes']->first_row()->id; $data['agent'] = $this->user_model->getAgentsFromCountry($data['pays']->first_row()->id); $data['networks'] = $this->user_model->getNetworks($data['pays']->first_row()->id); + $data['current_agent'] = $data['agent'] ? $data['agent']->first_row()->lastname : null; $data['alert'] = ""; $data['active'] = "geoloc"; $number_geolocalisation = array(); $network_geolocalisation = array(); $count = 0; - foreach ($data['networks']->result() AS $row) { - $number_geolocalisation[$count] = $this->user_model->getPointGeolocalised($row->id, $data['agent']->first_row()->lastname); - $network_geolocalisation[$count] = $row->name; - $count++; + if($data['networks']) { + foreach ($data['networks']->result() as $row) { + $number_geolocalisation[$count] = $this->user_model->getPointGeolocalised($row->id, $data['current_agent']); + $network_geolocalisation[$count] = $row->name; + $count++; + } } - $data['current_agent'] = $data['agent']->first_row()->lastname; $data["number_geolocalisation"] = $number_geolocalisation; $data["network_geolocalisation"] = $network_geolocalisation; $data["total"] = $count; @@ -768,10 +757,12 @@ class Gestion extends CI_Controller $network_geolocalisation = array(); $count = 0; - foreach ($data['networks']->result() AS $row) { - $number_geolocalisation[$count] = $this->user_model->getPointGeolocalised($row->id, $lastname); - $network_geolocalisation[$count] = $row->name; - $count++; + if($data['networks']) { + foreach ($data['networks']->result() as $row) { + $number_geolocalisation[$count] = $this->user_model->getPointGeolocalised($row->id, $lastname); + $network_geolocalisation[$count] = $row->name; + $count++; + } } $data['current_agent'] = $lastname; $data["number_geolocalisation"] = $number_geolocalisation; @@ -920,7 +911,7 @@ class Gestion extends CI_Controller $data["agents"] = $agent; $data["total_points"] = $total; $data["countA"] = $countA; - $data['current_agent'] = $data['agent']->first_row()->lastname; + $data['current_agent'] = $data['agent'] ? $data['agent']->first_row()->lastname : null; $data["number_geolocalisation"] = $number_geolocalisation; $data["network_geolocalisation"] = $network_geolocalisation; $data["total"] = $count; diff --git a/application/models/User_model.php b/application/models/User_model.php index 1b1ecf7c..9e478a0f 100755 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -779,8 +779,7 @@ class User_model extends CI_Model $query=$this->db->query("SELECT countries.id,countries.name,countries.code_country,countries.code_dial FROM countries - INNER JOIN towns t on countries.id = t.country_id and t.status=1 - WHERE countries.id IN (SELECT country_id FROM networks INNER JOIN networks_agents ON networks.id=networks_agents.network_id GROUP BY networks.country_id) + INNER JOIN towns t on countries.id = t.country_id and t.status=1 GROUP BY countries.id"); return $query; } diff --git a/application/views/historique_transactions_deleted.php b/application/views/historique_transactions_deleted.php index 10c5a655..6f2af9dd 100755 --- a/application/views/historique_transactions_deleted.php +++ b/application/views/historique_transactions_deleted.php @@ -237,75 +237,3 @@ }); -