diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php index e8f2a207..077ac2a6 100755 --- a/application/controllers/Hyperviseur_dash.php +++ b/application/controllers/Hyperviseur_dash.php @@ -4,6 +4,8 @@ defined('BASEPATH') or exit('No direct script access allowed'); use Brick\Money\Context\AutoContext; use Brick\Money\Money; +use function PHPSTORM_META\type; + /** * Created by PhpStorm. * User: Hanry Nzale diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index a4cd8b86..6af004d3 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -1082,4 +1082,5 @@ $lang['fixed_fees_currency'] = "Fixed fee currency"; $lang['add_rate'] = "Add a rate"; $lang['channel'] = "Channel/Réseau"; $lang["select_country"] = "Select a country"; +$lang["confirm_recharge_account"] = "Confirm account recharge"; ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index 3a8823a5..dc544edb 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -1090,4 +1090,5 @@ $lang['fixed_fees_currency'] = "Monnaie des frais fixes"; $lang['add_rate'] = "Ajouter un taux"; $lang['channel'] = "Cannal/Réseau"; $lang["select_country"] = "Sélectionner un pays"; +$lang["confirm_recharge_account"] = "Confirmer le rechargement du compte"; ?> diff --git a/application/models/Wallet_model.php b/application/models/Wallet_model.php index ff732893..00345cd0 100755 --- a/application/models/Wallet_model.php +++ b/application/models/Wallet_model.php @@ -88,17 +88,35 @@ class Wallet_model extends CI_Model return $query->num_rows() > 0 ? $query : false ; } - public function addWallet($id_agent){ - $query = $this->db->get_where('networks_agents' , ['agent_id' => $id_agent]); - if($query->num_rows()>0){ - $id_networkAgent = $query->first_row()->id; - $query = $this->db->insert('wallets' , ['id_networkAgent' => $id_networkAgent]); - return $query; - }else{ + public function addWallet($id_agent) + { + $sql = "SELECT id FROM networks_agents WHERE agent_id = ?"; + $query = $this->db->query($sql, [$id_agent]); + + if ($query->num_rows() === 0) { return false; } + $id_networkAgent = $query->first_row()->id; + + // Vérifier si un wallet existe déjà pour ce id_networkAgent + $check = $this->db->query( + "SELECT id FROM wallets WHERE id_networkAgent = ?", + [$id_networkAgent] + ); + if ($check->num_rows() > 0) { + return true; + } + + // Insérer un nouveau wallet sinon + $query = $this->db->query( + "INSERT INTO wallets (id_networkAgent) VALUES (?)", + [$id_networkAgent] + ); + + return $query; } + public function getAgentTransactions($id_wallet){ $query = $this->db->get_where('wallet_transaction' , ['id_wallet' => $id_wallet]); return $query->num_rows() > 0 ? $query : false ; diff --git a/application/views/listeadmin.php b/application/views/listeadmin.php index 846028cf..ed717e38 100755 --- a/application/views/listeadmin.php +++ b/application/views/listeadmin.php @@ -550,67 +550,58 @@ - - + -