From 0968cb101b40c0f558956c5125c499c07f69efdb Mon Sep 17 00:00:00 2001 From: Djery-Tom Date: Fri, 6 Nov 2020 18:47:42 +0100 Subject: [PATCH] + Adding payment operators --- application/controllers/Gestion.php | 48 +++--- application/controllers/Hyperviseur_dash.php | 20 +-- application/language/english/message_lang.php | 15 ++ application/language/french/message_lang.php | 16 +- application/models/Wallet_model.php | 43 ++--- ...admin.php => gestion_operateurs_admin.php} | 161 ++++++++++-------- ...ues_hyp.php => gestion_operateurs_hyp.php} | 52 +++--- application/views/header_gestion.php | 6 +- application/views/header_hyp.php | 46 +---- 9 files changed, 214 insertions(+), 193 deletions(-) rename application/views/{gestion_banques_admin.php => gestion_operateurs_admin.php} (66%) rename application/views/{gestion_banques_hyp.php => gestion_operateurs_hyp.php} (78%) diff --git a/application/controllers/Gestion.php b/application/controllers/Gestion.php index d82e7a9a..62c8f3c7 100755 --- a/application/controllers/Gestion.php +++ b/application/controllers/Gestion.php @@ -2286,33 +2286,35 @@ class Gestion extends CI_Controller } } - public function banks() + public function operators() { if ($this->isLogged()) { - $data['banks'] = $this->wallet_model->getAllBanksCountries(); + $data['operators'] = $this->wallet_model->getAllOperatorsCountries(); $data['pays'] = $this->user_model->getAllPays(); $data['game_pays'] = $this->user_model->getGameCountry(); $data['alert'] = ""; - $data['active'] = "banks"; - $data['distinct_banks'] = $this->wallet_model->getAllBanks(); + $data['active'] = "operators"; + $data['distinct_operators'] = $this->wallet_model->getAllOperators(); + $data['operators_types'] = $this->db->get('type_operators'); $this->load->view('header_gestion', $data); - $this->load->view('gestion_banques_admin'); + $this->load->view('gestion_operateurs_admin'); $this->load->view('footer'); } } - public function add_bank() + public function add_operator() { if ($this->isLogged()) { if (isset($_POST)) { $data = array( 'nom' => $this->input->post('name'), + 'type' => $this->input->post('type') ); - $query = $this->db->insert('banks', $data); + $query = $this->db->insert('operators', $data); if ($query) { echo json_encode("completed"); } else { @@ -2322,14 +2324,14 @@ class Gestion extends CI_Controller } } - public function delete_bank() + public function delete_operator() { if ($this->isLogged()) { if (isset($_POST)) { - $id_bank = $this->input->post('id_bank'); + $id_operator = $this->input->post('id_operator'); $id_country = $this->input->post('id_country'); - $query = $this->wallet_model->deleteBankCountry($id_bank, $id_country); + $query = $this->wallet_model->deleteOperatorCountry($id_operator, $id_country); if ($query) { echo json_encode("completed"); } else { @@ -2339,18 +2341,18 @@ class Gestion extends CI_Controller } } - public function assign_bank() + public function assign_operator() { if ($this->isLogged()) { if (isset($_POST)) { - $id_bank = $this->input->post('id_bank'); + $id_operator = $this->input->post('id_operator'); $existe = 0; $this->db->trans_begin(); foreach ($_POST['id_country'] AS $country) { - $res = $this->wallet_model->checkIfBankAssignationExist($country, $id_bank); + $res = $this->wallet_model->checkIfOperatorAssignationExist($country, $id_operator); if ($res == false) { - $data = array('id_country' => $country , 'id_bank' => $id_bank); - $this->db->insert('banks_countries', $data); + $data = array('id_country' => $country , 'id_operator' => $id_operator); + $this->db->insert('operators_countries', $data); } else { $existe = $existe + 1; } @@ -2370,17 +2372,17 @@ class Gestion extends CI_Controller } } - public function update_bank() + public function update_operator() { if ($this->isLogged()) { if (isset($_POST)) { - $id_bank = $this->input->post('id_bank'); + $id_operator = $this->input->post('id_operator'); $id_country = $this->input->post('id_country'); $name = $this->input->post('name'); $address = $this->input->post('address'); $code = $this->input->post('code'); - $res = $this->wallet_model->updateBank($id_bank, $id_country ,$name , $address , $code); + $res = $this->wallet_model->updateOperator($id_operator, $id_country ,$name , $address , $code); if ($res == true) { echo json_encode("completed"); @@ -2391,7 +2393,7 @@ class Gestion extends CI_Controller } } - public function change_bank_status() + public function change_operator_status() { if ($this->isLogged()) { if (isset($_POST)) { @@ -2403,9 +2405,9 @@ class Gestion extends CI_Controller foreach ($_POST['activations'] AS $row) { $data = array('status' => 1); - $this->db->where('id_bank', $row['id_bank']); + $this->db->where('id_operator', $row['id_operator']); $this->db->where('id_country', $row['id_country']); - $this->db->update('banks_countries', $data); + $this->db->update('operators_countries', $data); } } @@ -2413,9 +2415,9 @@ class Gestion extends CI_Controller foreach ($_POST['desactivations'] AS $row) { $data = array('status' => 0); - $this->db->where('id_bank', $row['id_bank']); + $this->db->where('id_operator', $row['id_operator']); $this->db->where('id_country', $row['id_country']); - $this->db->update('banks_countries', $data); + $this->db->update('operators_countries', $data); } } diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php index bb2a6dee..5b171734 100755 --- a/application/controllers/Hyperviseur_dash.php +++ b/application/controllers/Hyperviseur_dash.php @@ -1546,12 +1546,12 @@ class Hyperviseur_dash extends CI_Controller } } - public function banks() + public function operators() { if ($this->isLogged()) { - $data['active'] = "banks"; + $data['active'] = "operators"; $data['alert'] = ""; $data['firstname'] = $this->session->userdata('firstname'); $data['lastname'] = $this->session->userdata('lastname'); @@ -1563,25 +1563,25 @@ class Hyperviseur_dash extends CI_Controller $data['category'] = $this->session->userdata('category'); $data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id')); - $data['banks'] = $this->wallet_model->getBanksForNetwork($this->session->userdata('network_id')); + $data['operators'] = $this->wallet_model->getOperatorsForNetwork($this->session->userdata('network_id')); $this->load->view('header_hyp', $data); - $this->load->view('gestion_banques_hyp'); + $this->load->view('gestion_operateurs_hyp'); $this->load->view('footer'); } } - public function active_bank() + public function active_operator() { if ($this->isLogged()) { if (isset($_POST)) { $data = array( - 'id_bank_country' => $this->input->post('id_bank_country'), + 'id_operator_country' => $this->input->post('id_operator_country'), 'id_network' => $this->input->post('id_network') ); - $query = $this->db->insert('networks_banks', $data); + $query = $this->db->insert('networks_operators', $data); if ($query) { echo json_encode("200"); @@ -1592,16 +1592,16 @@ class Hyperviseur_dash extends CI_Controller } } - public function deactive_bank() + public function deactive_operator() { if ($this->isLogged()) { if (isset($_POST)) { $data = array( - 'id_bank_country' => $this->input->post('id_bank_country'), + 'id_operator_country' => $this->input->post('id_operator_country'), 'id_network' => $this->input->post('id_network') ); - $query = $this->db->delete('networks_banks', $data); + $query = $this->db->delete('networks_operators', $data); if ($query) { echo json_encode("200"); diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index 7cd692d4..69e862fe 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -538,4 +538,19 @@ $lang['configure_transmitter_network'] = 'Configure the sending network'; $lang['paying_and_transmitting_networks_accounts'] = "Accounts of paying and issuing networks"; $lang['transmitting_networks_accounts'] = 'Accounts of transmitting networks'; $lang['bank_code'] = "Bank code"; +$lang['operators'] = "Operators"; +$lang['management_operators'] = "Management of operators"; +$lang['add_operator'] = "Add an operator"; +$lang['no_operator'] = "No operator"; +$lang['operator_added'] = "The operator has been added"; +$lang['operator_assigned'] = "The operator has been assigned"; +$lang['operator_modified'] = "The operator has been modified"; +$lang['operator_deleted'] = "The operator has been deleted"; +$lang['operator_activated'] = "The operator has been activated"; +$lang['operator_deactivated'] = "The operator has been deactivated"; +$lang['operator_deactivation'] = "Operator deactivation"; +$lang['modify_operator'] = "Modify operator"; +$lang['assign_operator_to_country'] = "Assign an operator to a country"; +$lang['operator_type'] = "Operator type"; +$lang['no_type'] = "No type"; ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index 179fcdc9..79ebd8b6 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -550,5 +550,19 @@ $lang['configure_transmitter_network'] = 'Configurer le réseau émetteur'; $lang['paying_and_transmitting_networks_accounts'] = "Comptes des reseaux payeurs et émetteurs"; $lang['transmitting_networks_accounts'] = 'Comptes des reseaux émetteurs'; $lang['bank_code'] = "Code banque"; - +$lang['operators'] = "Opérateurs"; +$lang['management_operators'] = "Gestion des opérateurs"; +$lang['add_operator'] = "Ajouter un opérateur"; +$lang['no_operator'] = "Aucun opérateur"; +$lang['operator_added'] = "L'opérateur a été ajouté"; +$lang['operator_assigned'] = "L'opérateur a été assigné"; +$lang['operator_modified'] = "L'opérateur a été modifié"; +$lang['operator_deleted'] = "L'opérateur a été supprimé"; +$lang['operator_activated'] = "L'opérateur a été activé"; +$lang['operator_deactivated'] = "L'opérateur a été désactivé"; +$lang['operator_deactivation'] = "Désactivation de l'opérateur"; +$lang['modify_operator'] = "Modifier l'opérateur"; +$lang['assign_operator_to_country'] = "Assigner un opérateur à un pays"; +$lang['operator_type'] = "Type d'opérateur"; +$lang['no_type'] = "Aucun type"; ?> diff --git a/application/models/Wallet_model.php b/application/models/Wallet_model.php index 22375624..42139381 100644 --- a/application/models/Wallet_model.php +++ b/application/models/Wallet_model.php @@ -862,45 +862,46 @@ INNER JOIN countries_currencies cc ON n.country_id= cc.id INNER JOIN configWalle return $query; } - // Banques - public function getAllBanksCountries(){ - $query = $this->db->query("SELECT b.id, b.nom as bank_name , bc.adresse as bank_address , bc.code_banque as bank_code , bc.status, c.name as country , c.id as country_id FROM banks_countries bc INNER JOIN banks b ON b.id = bc.id_bank INNER JOIN countries c ON c.id = bc.id_country"); + // Operateurs + public function getAllOperatorsCountries(){ + $query = $this->db->query("SELECT b.id, b.nom as operator_name , bc.adresse as operator_address , bc.code as operator_code , bc.status, c.name as country , c.id as country_id , top.description_fr as type_fr, top.description_en as type_en + FROM operators_countries bc INNER JOIN operators b ON b.id = bc.id_operator INNER JOIN type_operators top ON b.type = top.code INNER JOIN countries c ON c.id = bc.id_country "); return $query->num_rows() > 0 ? $query : false ; } - public function getAllBanks(){ - $query = $this->db->query("SELECT * FROM banks"); + public function getAllOperators(){ + $query = $this->db->query("SELECT o.* , top.description_fr ,top.description_en FROM operators o INNER JOIN type_operators top ON o.type = top.code"); return $query->num_rows() > 0 ? $query : false ; } - public function checkIfBankAssignationExist($id_country,$id_bank){ - $query = $this->db->query("SELECT * FROM banks_countries WHERE id_country ='".$id_country."' AND id_bank='".$id_bank."'"); + public function checkIfOperatorAssignationExist($id_country,$id_operator){ + $query = $this->db->query("SELECT * FROM operators_countries WHERE id_country ='".$id_country."' AND id_operator='".$id_operator."'"); return $query->num_rows() > 0 ? $query : false ; } - public function getBank($id_bank){ - $query = $this->db->query("SELECT * FROM banks WHERE id='".$id_bank."'"); + public function getOperator($id_operator){ + $query = $this->db->query("SELECT * FROM operators WHERE id='".$id_operator."'"); return $query->num_rows() > 0 ? $query : false ; } - public function updateBank($id_bank,$id_country, $name , $address , $code){ - $sql = "UPDATE `banks` SET `nom` = ? WHERE (`id` = ?);"; - $this->db->query($sql , array($name,$id_bank)); + public function updateOperator($id_operator,$id_country, $name , $address , $code){ + $sql = "UPDATE `operators` SET `nom` = ? WHERE (`id` = ?);"; + $this->db->query($sql , array($name,$id_operator)); - $sql = "UPDATE `banks_countries` SET `adresse` = ? , `code_banque` = ? WHERE (`id_bank` = ? AND `id_country` = ?);"; - return $this->db->query($sql , array($address,$code,$id_bank,$id_country)); + $sql = "UPDATE `operators_countries` SET `adresse` = ? , `code` = ? WHERE (`id_operator` = ? AND `id_country` = ?);"; + return $this->db->query($sql , array($address,$code,$id_operator,$id_country)); } - public function deleteBankCountry($id_bank, $id_country){ - $sql = "DELETE FROM `banks_countries` WHERE `id_bank` = ? AND `id_country` = ?"; - $query = $this->db->query($sql, array($id_bank,$id_country)); + public function deleteOperatorCountry($id_operator, $id_country){ + $sql = "DELETE FROM `operators_countries` WHERE `id_operator` = ? AND `id_country` = ?"; + $query = $this->db->query($sql, array($id_operator,$id_country)); return $query; } - public function getBanksForNetwork($id_network){ - $sql = "SELECT bc.id, b.nom as bank_name , bc.adresse as bank_address, bc.code_banque as bank_code , c.name as country , c.id as country_id , nb.id_network FROM networks n -CROSS JOIN banks_countries bc INNER JOIN banks b ON b.id = bc.id_bank INNER JOIN countries c ON c.id = bc.id_country -LEFT JOIn networks_banks nb ON nb.id_bank_country = bc.id AND nb.id_network = n.id WHERE bc.status = 1 AND n.id = ?"; + public function getOperatorsForNetwork($id_network){ + $sql = "SELECT bc.id, b.nom as operator_name , bc.adresse as operator_address, bc.code as operator_code , c.name as country , c.id as country_id , nb.id_network , top.description_fr as type_fr, top.description_en as type_en +FROM networks n CROSS JOIN operators_countries bc INNER JOIN operators b ON b.id = bc.id_operator INNER JOIN countries c ON c.id = bc.id_country INNER JOIN type_operators top ON b.type = top.code +LEFT JOIn networks_operators nb ON nb.id_operator_country = bc.id AND nb.id_network = n.id WHERE bc.status = 1 AND n.id = ?"; $query = $this->db->query($sql , array($id_network)); return $query->num_rows() > 0 ? $query : false ; } diff --git a/application/views/gestion_banques_admin.php b/application/views/gestion_operateurs_admin.php similarity index 66% rename from application/views/gestion_banques_admin.php rename to application/views/gestion_operateurs_admin.php index f3210f3a..8df19c59 100755 --- a/application/views/gestion_banques_admin.php +++ b/application/views/gestion_operateurs_admin.php @@ -5,7 +5,7 @@

- lang->line('management_banks'); ?> + lang->line('management_operators'); ?>

-

lang->line('banks'); ?>

+

lang->line('operators'); ?>

num_rows(); $num = 0; @@ -58,13 +58,13 @@ N° lang->line('Pays'); ?> + Type lang->line('Nom'); ?> - lang->line('bank_code'); ?> + Code lang->line('Adresse'); ?> lang->line('Statut'); ?> lang->line('Activer/Désactiver'); ?> - lang->line('Modifier'); ?> - lang->line('Supprimer'); ?> + Action @@ -75,38 +75,41 @@ if($row->status==0){ $libelle_status = $this->lang->line('Inactif'); } - echo " - $num - $row->country - $row->bank_name - $row->bank_code - $row->bank_address - $libelle_status"; + $type = $this->session->userdata('site_lang') === 'french' ? $row->type_fr : $row->type_en; + ?> + + + country?> + + operator_name ?> + operator_code?> + operator_address?> + + status==0){ echo " "; }else{ echo " "; } - echo " - - - - + ?> + + + + - "; - } - ?> + + @@ -115,10 +118,10 @@ } else { - echo $this->lang->line('no_bank'); + echo $this->lang->line('no_operator'); } }else { - echo $this->lang->line('no_bank'); + echo $this->lang->line('no_operator'); } ?>
@@ -127,14 +130,30 @@
-

lang->line('add_bank'); ?>

+

lang->line('add_operator'); ?>

-
+
+
+ + num_rows(); + if ($numrows > 0) { ?> + + lang->line("no_type"); + } + ?> +
@@ -143,7 +162,7 @@
-

lang->line('assign_bank_to_country'); ?>

+

lang->line('assign_operator_to_country'); ?>

@@ -164,22 +183,22 @@ ?>
- + num_rows(); if ($numrows > 0) { ?> - result() as $row) { - echo ""; + echo ""; } ?> lang->line("no_bank"); + echo $this->lang->line("no_operator"); } }else{ - echo $this->lang->line("no_bank"); + echo $this->lang->line("no_operator"); } ?>
@@ -199,7 +218,7 @@ - +
+
+ + +
- +
@@ -270,17 +293,17 @@ var desactivation = []; $.each($("input[name='activer']:checked"), function(){ - activation.push({"id_bank" : $(this).data('id-bank'),"id_country": $(this).data('id-country')}); + activation.push({"id_operator" : $(this).data('id-operator'),"id_country": $(this).data('id-country')}); }); $.each($("input[name='desactiver']:checked"), function(){ - desactivation.push({"id_bank" : $(this).data('id-bank'),"id_country": $(this).data('id-country')}); + desactivation.push({"id_operator" : $(this).data('id-operator'),"id_country": $(this).data('id-country')}); }); // console.log('act' , activation) // console.log('desact' , desactivation) $.ajax({ - url:'', + url:'', type: 'post', data: {activations: activation,desactivations:desactivation}, dataType: 'json', @@ -317,38 +340,41 @@ - - - - - -