+ Update list of operators in hypervisor dashboard
This commit is contained in:
parent
396d5b9f6c
commit
f49d8d72c9
|
@ -622,7 +622,7 @@ class Hyperviseur_dash extends CI_Controller
|
||||||
|
|
||||||
if ($encrypted_password == $hash) {
|
if ($encrypted_password == $hash) {
|
||||||
$this->wallet_model->updateWalletBalance($montant, $wallet_id);
|
$this->wallet_model->updateWalletBalance($montant, $wallet_id);
|
||||||
$res = $this->wallet_model->addWalletRecharge($montant, $wallet_id);
|
$res = $this->wallet_model->addWalletRecharge($montant, $wallet_id , $this->session->userdata('network_id'));
|
||||||
$code = $res ? '200' : '500';
|
$code = $res ? '200' : '500';
|
||||||
} else {
|
} else {
|
||||||
$code = '400';
|
$code = '400';
|
||||||
|
|
|
@ -401,9 +401,10 @@ class Wallet_model extends CI_Model
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addWalletRecharge($montant,$wallet_id){
|
public function addWalletRecharge($montant,$wallet_id , $id_network){
|
||||||
$sql = "INSERT INTO `wallet_recharge` (`montant`, `wallet_id`) VALUES (?, ?);";
|
$datetime = $this->getCurrentTimeByNetworkID($id_network);
|
||||||
$query = $this->db->query($sql , array($montant,$wallet_id));
|
$sql = "INSERT INTO `wallet_recharge` (`montant`, `wallet_id`, `date`) VALUES (?, ?, ?);";
|
||||||
|
$query = $this->db->query($sql , array($montant,$wallet_id,$datetime));
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -806,8 +807,9 @@ class Wallet_model extends CI_Model
|
||||||
return false;
|
return false;
|
||||||
$sql = "UPDATE `paying_networks` SET balance_compensation = ? WHERE `id_network` = ? AND id_configWallet = ?;";
|
$sql = "UPDATE `paying_networks` SET balance_compensation = ? WHERE `id_network` = ? AND id_configWallet = ?;";
|
||||||
$this->db->query($sql, array($montant_init - $montant, $id_network, $id_config));
|
$this->db->query($sql, array($montant_init - $montant, $id_network, $id_config));
|
||||||
$sql = "INSERT INTO `remboursemment_compensation` (`montant` , `montant_restant`,`id_paying_network` , `id_network`) VALUES ( ?, ?, ? ,?);";
|
$datetime = $this->getCurrentTimeByNetworkID($id_network);
|
||||||
$this->db->query($sql, array($montant, $montant_init - $montant, $id_network, $this->session->userdata('network_id')));
|
$sql = "INSERT INTO `remboursemment_compensation` (`montant` , `montant_restant`,`id_paying_network` , `id_network` , `date`) VALUES ( ?, ?, ? ,?, ?);";
|
||||||
|
$this->db->query($sql, array($montant, $montant_init - $montant, $id_network, $this->session->userdata('network_id'),$datetime));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -898,8 +900,9 @@ INNER JOIN countries_currencies cc ON n.country_id= cc.id INNER JOIN configWalle
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Obtenir uniquement les operateurs qui sont dans le meme pays que le reseau0
|
||||||
public function getOperatorsForNetwork($id_network){
|
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
|
$sql = "SELECT b.type , n.country_id as network_country_id , 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
|
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 = ?";
|
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));
|
$query = $this->db->query($sql , array($id_network));
|
||||||
|
@ -927,4 +930,18 @@ LEFT JOIn networks_operators nb ON nb.id_operator_country = bc.id AND nb.id_netw
|
||||||
INNER JOIN configWallet cw ON cw.id_network = n.id INNER JOIN transmitting_networks pw ON pw.id_network = n.id WHERE pw.id_configWallet = $id_config ");
|
INNER JOIN configWallet cw ON cw.id_network = n.id INNER JOIN transmitting_networks pw ON pw.id_network = n.id WHERE pw.id_configWallet = $id_config ");
|
||||||
return $query->num_rows() > 0 ? $query : false ;
|
return $query->num_rows() > 0 ? $query : false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Obtenir l'heure en fonction de l'id du reseau
|
||||||
|
function getCurrentTimeByNetworkID($id_network)
|
||||||
|
{
|
||||||
|
$query= $this->db->query("SELECT code_country FROM countries c INNER JOIN networks n on n.country_id = c.id WHERE n.id = '$id_network'");
|
||||||
|
if ($query->num_rows() > 0) {
|
||||||
|
$country_code = isset($query->first_row()->code_country) ? $query->first_row()->code_country : 'GA';
|
||||||
|
$timezone = \DateTimeZone::listIdentifiers(\DateTimeZone::PER_COUNTRY, $country_code);
|
||||||
|
$date = (sizeof($timezone) > 0) ? new \DateTime('now', new \DateTimeZone($timezone[0])) : new \DateTime();
|
||||||
|
return $date->format('Y-m-d H:i:s');
|
||||||
|
} else {
|
||||||
|
return date('Y-m-d H:i:s');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,9 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
foreach($sql2->result() as $row) {
|
foreach($sql2->result() as $row) {
|
||||||
|
// Seuls les operateurs bancaires peuvent appartenir à des pays etrangers
|
||||||
|
if($row->type != 'bank' && ($row->country_id != $row->network_country_id))
|
||||||
|
continue;
|
||||||
$num ++;
|
$num ++;
|
||||||
$type = $this->session->userdata('site_lang') === 'french' ? $row->type_fr : $row->type_en;
|
$type = $this->session->userdata('site_lang') === 'french' ? $row->type_fr : $row->type_en;
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
|
|
|
@ -206,7 +206,7 @@
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<h3><?php echo $count_d_traite;?></h3>
|
<h3><?php echo $count_d_traite;?></h3>
|
||||||
|
|
||||||
<p><?php echo $this->lang->line('Demandes traitées'); ?></p>
|
<p><?php echo $this->lang->line('accepted_demands'); ?></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
<i class="ion ion-checkmark-circled"></i>
|
<i class="ion ion-checkmark-circled"></i>
|
||||||
|
|
Loading…
Reference in New Issue