diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php
index 70ba4a09..10375c0a 100755
--- a/application/controllers/Hyperviseur_dash.php
+++ b/application/controllers/Hyperviseur_dash.php
@@ -21,15 +21,7 @@ class Hyperviseur_dash extends CI_Controller
public function index()
{
-
- if (!$this->session->userdata('email')) {
- $this->session->set_flashdata('error', 'log in first');
-
- $data['alert'] = "ok";
- $data['message'] = "Login first!";
-
- redirect('index.php', $data);
- } else {
+ if ($this->isLogged()) {
$count_d_traite = $this->user_model->getCountDemandeByStatut($this->session->userdata('member_code'), '1');
$count_d_no_traite = $this->user_model->getCountDemandeByStatut($this->session->userdata('member_code'), '0');
$count_d_no_canceled = $this->user_model->getCountDemandeByStatut($this->session->userdata('member_code'), '2');
@@ -68,15 +60,7 @@ class Hyperviseur_dash extends CI_Controller
public function getAllUser_g()
{
- if (!$this->session->userdata('email')) {
- $this->session->set_flashdata('error', 'log in first');
-
- $data['alert'] = "ok";
- $data['message'] = "Login first!";
-
- redirect('index.php', $data);
- } else {
-
+ if ($this->isLogged()) {
if ($this->input->post('ville')) {
$this->session->set_userdata('current_ville', $this->input->post('ville'));
}
@@ -111,17 +95,7 @@ class Hyperviseur_dash extends CI_Controller
public function getAllSupervisor()
{
-
- if (!$this->session->userdata('email')) {
- $this->session->set_flashdata('error', 'log in first');
-
- $data['alert'] = "ok";
- $data['message'] = "Login first!";
-
-
- redirect('index.php', $data);
- } else {
-
+ if ($this->isLogged()) {
/*$this->db->select('*');
$this->db->from('users');
$this->db->where('category','super');
@@ -165,15 +139,7 @@ class Hyperviseur_dash extends CI_Controller
public function getAllSupervisorPositions()
{
- if (!$this->session->userdata('email')) {
- $this->session->set_flashdata('error', 'log in first');
-
- $data['alert'] = "ok";
- $data['message'] = "Login first!";
-
-
- redirect('index.php', $data);
- } else {
+ if ($this->isLogged()) {
$network = $this->session->userdata('network');
$category = 'super';
@@ -186,13 +152,7 @@ class Hyperviseur_dash extends CI_Controller
public function getDemandes()
{
-
- if (!$this->session->userdata('email')) {
- $this->session->set_flashdata('error', 'log in first');
- $data['alert'] = "ok";
- $data['message'] = "Login first!";
- $this->load->view('login', $data);
- } else {
+ if ($this->isLogged()) {
$debut = $this->input->get("d");
$fin = $this->input->get("f");
@@ -202,7 +162,7 @@ class Hyperviseur_dash extends CI_Controller
$fin = Date('Y-m-d', strtotime($fin . "+1 day"));
$ville = $this->session->userdata('ville');
- $data['active'] = "demandes";
+ $data['active'] = "demandes_credits_entrantes";
$data['type'] = 'incoming';
$data['demand_type'] = 'credit';
$data['alert'] = "";
@@ -230,6 +190,94 @@ class Hyperviseur_dash extends CI_Controller
}
}
+ public function demandsCancellation()
+ {
+ if ($this->isLogged()) {
+
+ $show = $this->input->get("show");
+
+ $debut = $this->input->get("d");
+ $fin = $this->input->get("f");
+ $format = $this->session->userdata('site_lang') === 'french' ? 'd-m-Y' : 'Y-m-d';
+ $data['debut'] = $debut ? date($format, strtotime($debut)) : null;
+ $data['fin'] = $fin ? date($format, strtotime($fin)) : null;
+ $fin = Date('Y-m-d', strtotime($fin . "+1 day"));
+
+
+ $data['active'] = "demandes_credits_annulation";
+ $data['type'] = 'incoming';
+ $data['demand_type'] = 'credit';
+ $data['alert'] = "";
+ $data['token'] = $this->session->userdata('token');
+ $data['email'] = $this->session->userdata('email');
+ $data['firstname'] = $this->session->userdata('firstname');
+ $data['lastname'] = $this->session->userdata('lastname');
+ $data['code_parrain'] = $this->session->userdata('code_parrain');
+ $data['phone'] = $this->session->userdata('phone');
+ $data['adresse'] = $this->session->userdata('adresse');
+ $data['category'] = $this->session->userdata('category');
+ $data['network'] = $this->session->userdata('network');
+ $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays'));
+
+ if($show == 'history'){
+ $data['list'] = $this->user_model->getAllCanceledCreditsDemands($debut, $fin, $this->session->userdata('network_id'));
+
+ }else{
+ $data['list'] = $this->user_model->getAllAcceptedCreditsDemands($debut, $fin, $this->session->userdata('network_id'));
+ $data['temp_moyen'] = $this->user_model->getTempsMoyenByNetwork($this->session->userdata('network_id'));
+
+ }
+ $data['networks'] = $this->user_model->getNetworkByHyp($this->session->userdata('member_code'));
+ $data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
+ $this->load->view('header_hyp', $data);
+ if($show == 'history'){
+ $this->load->view('historique_demande_credit_annulation');
+ }else{
+ $this->load->view('demande_credit_annulation');
+ }
+
+ $this->load->view('footer');
+
+ }
+ }
+
+ public function cancelCreditRequest(){
+ if ($this->isLogged()) {
+ $data = array(
+ 'canceled_by_hypervisor' => 1 ,
+ 'cancellation_date' => $this->user_model->getCurrentTimeByNetworkID($this->session->userdata('network_id'))
+ );
+ $id = $this->input->post('id_demand');
+ $query = $this->db->get_where('info_demandeCredits', ['demande_id' => $id]);
+
+ if($query->num_rows()>0){
+ $demand = $query->first_row();
+
+ // Debiter le compte de l'agent
+ $this->db->set('balance_princ', 'balance_princ-'.$demand->montant,false);
+ $this->db->where('id_networkAgent',$demand->network_agent_id);
+ $this->db->update('wallets');
+
+ // Credit le compte du parrain
+ $this->db->set('balance_princ', 'balance_princ+'.$demand->montant,false);
+ $this->db->where('id_networkAgent',$demand->network_parrain_id);
+ $this->db->update('wallets');
+
+ $this->db->where('id', $id);
+ $query = $this->db->update('demandeCredits', $data);
+
+ if ($query) {
+ echo json_encode("200");
+ } else {
+ echo json_encode("500");
+ }
+ }else{
+ echo json_encode("404");
+ }
+
+ }
+ }
+
public function addvilles()
{
$id = 1;
@@ -251,13 +299,7 @@ class Hyperviseur_dash extends CI_Controller
public function getDemandesAd()
{
-
- if (!$this->session->userdata('email')) {
- $this->session->set_flashdata('error', 'log in first');
- $data['alert'] = "ok";
- $data['message'] = "Login first!";
- $this->load->view('login', $data);
- } else {
+ if ($this->isLogged()) {
$network = $this->session->userdata('network');
$debut = $this->input->get("d");
$fin = $this->input->get("f");
@@ -294,13 +336,7 @@ class Hyperviseur_dash extends CI_Controller
// Wallet
public function wallet()
{
- if (!$this->session->userdata('email')) {
- $this->session->set_flashdata('error', 'log in first');
-
- $data['alert'] = "ok";
- $data['message'] = "Login first!";
- $this->load->view('login', $data);
- } else {
+ if ($this->isLogged()) {
$id_network = $this->session->userdata('network_id');
$data['hasWallet'] = $this->wallet_model->getConfigWallet($this->session->userdata('network_id'));
if ($data['hasWallet']) {
diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php
index d19bfdf1..251d1ad6 100755
--- a/application/language/english/message_lang.php
+++ b/application/language/english/message_lang.php
@@ -590,4 +590,10 @@ $lang['unexpected_error'] = "An unexpected error has occurred";
$lang['operators_enabled_disabled'] = "Operator(s) enabled / disabled";
$lang['backoffice_management'] = "Backoffice management";
$lang['number_of_members'] = "Number of members";
+$lang['cancellation_credit_requests'] = "Cancellation of credit requests";
+$lang['cancellation'] = "Cancellation";
+$lang['incoming_credits_requests_accepted'] = 'Incoming credit requests accepted';
+$lang['history_canceled_credit_requests'] = "History of canceled credit requests";
+$lang['cancellation_date'] = "Cancellation date";
+$lang['receiver'] = "Receiver";
?>
diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php
index 6ef244d3..69105598 100755
--- a/application/language/french/message_lang.php
+++ b/application/language/french/message_lang.php
@@ -602,4 +602,10 @@ $lang['unexpected_error'] = "Une erreur innatendue s'est produite";
$lang['operators_enabled_disabled'] = "Opérateur(s) activée(s)/désactivée(s)";
$lang['backoffice_management'] = "Gestion du backoffice";
$lang['number_of_members'] = "Nombre de membres";
+$lang['cancellation_credit_requests'] = "Annulation des demandes de crédits";
+$lang['cancellation'] = "Annulation";
+$lang['incoming_credits_requests_accepted'] = 'Demandes de crédits entrantes acceptées';
+$lang['history_canceled_credit_requests'] = "Historique des demandes de crédits annulées";
+$lang['cancellation_date'] = "Date d'annulation";
+$lang['receiver'] = "Destinataire";
?>
diff --git a/application/models/User_model.php b/application/models/User_model.php
index cdab1bd9..2ab9decd 100755
--- a/application/models/User_model.php
+++ b/application/models/User_model.php
@@ -397,11 +397,7 @@ class User_model extends CI_Model
WHERE d.codeParrain='".$member_code."'
ORDER BY dateAjout");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getCountDemande($codeParrain){
@@ -556,11 +552,7 @@ class User_model extends CI_Model
LIMIT 5");
}
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
@@ -664,11 +656,7 @@ class User_model extends CI_Model
LIMIT 5");
}
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
@@ -696,11 +684,7 @@ class User_model extends CI_Model
LIMIT 5");
}
- if ($query->num_rows() > 0) {
- return $query;
- } else {
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false ;
}
@@ -715,13 +699,7 @@ class User_model extends CI_Model
WHERE statut= '1' AND codeParrain='" . $codeParrain . "'
AND dateAjout BETWEEN '" . $debut . "' AND '" . $fin . "'");
}
-
- if ($query->num_rows() > 0) {
- return $query->row()->temps;
- }else{
- return false;
- }
-
+ return ($query->num_rows() > 0) ? $query->row()->temps : false ;
}
public function getTempsMoyenDemandeSup($codeParrain){
@@ -731,13 +709,7 @@ class User_model extends CI_Model
}else{
$query = $this->db->query("SELECT AVG(temps) AS temps FROM info_demandeCredits WHERE statut='1' AND codeMembre='".$codeParrain."'");
}
-
- if ($query->num_rows() > 0) {
- return $query->row()->temps;
- } else {
- return false;
- }
-
+ return ($query->num_rows() > 0) ? $query->row()->temps : false ;
}
public function getTempsMoyenByVille($codeParrain, $network)
@@ -749,6 +721,13 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT AVG(temps) AS temps FROM info_demandeCredits WHERE statut='1' AND codeParrain='" . $codeParrain . "' ");
}
+ return ($query->num_rows() > 0) ? $query->row()->temps : false ;
+ }
+
+ public function getTempsMoyenByNetwork($id_network)
+ {
+ $query = $this->db->query("SELECT AVG(temps) AS temps FROM info_demandeCredits WHERE statut='1' AND id_network='" . $id_network . "' ");
+
if ($query->num_rows() > 0) {
return $query->row()->temps;
} else {
@@ -765,13 +744,7 @@ class User_model extends CI_Model
$chain = $debut ? "AND date_creation BETWEEN '".$debut."' AND '".$fin."'" : "";
$query = $this->db->query("SELECT AVG(TIMESTAMPDIFF(SECOND,date_creation,date_modified)) AS temps FROM info_demandesAdhesion WHERE etat=1 AND code_membre='".$codeParrain."'".$chain);
}
-
- if($query->num_rows()>0){
- return $query->row()->temps;
- }else{
- return false;
- }
-
+ return ($query->num_rows() > 0) ? $query->row()->temps : false ;
}
public function getNetworkByHyp($codeHyp){
@@ -1453,11 +1426,7 @@ class User_model extends CI_Model
public function getActiveNetworks($country_id){
$query = $this->db->query("SELECT id,name FROM networks WHERE country_id ='".$country_id."' AND status = 1");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function get_current_page_records($limit, $start,$pays,$hyper,$ville)
@@ -1703,12 +1672,7 @@ class User_model extends CI_Model
ON child.code_parrain='".$codeHyp."'
WHERE child.category='super' AND dad.category='hyper' AND dad.code_membre='" . $codeHyp . "'
");
-
- if ($query->num_rows() > 0) {
- return $query;
- } else {
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getDemandesBySuper($debut, $fin, $code_parrain)
@@ -1718,13 +1682,7 @@ class User_model extends CI_Model
FROM info_demandeCredits AS d
WHERE d.codeParrain='" . $code_parrain . "' AND d.dateAjout BETWEEN '" . $debut . "' AND '" . $fin . "'
ORDER BY dateAjout");
-
- if ($query->num_rows() > 0) {
- return $query;
- } else {
- return false;
- }
-
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getGameCountry(){
@@ -1734,11 +1692,7 @@ class User_model extends CI_Model
WHERE configGame.etat=1
GROUP BY countries.id");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getCoutForQuota($pays,$quota_inf,$quota_sup){
@@ -1757,11 +1711,7 @@ class User_model extends CI_Model
FROM (SELECT users.lastname,users.phone,users.email,COUNT(*) AS total FROM game
INNER JOIN users ON game.id_parrain=users.id
WHERE `id_pays`=".$pays." GROUP BY `id_parrain` HAVING COUNT(*) >= 20) AS t");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function test($pays,$hyper,$ville){
@@ -1909,11 +1859,7 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT *
FROM infos_transaction
WHERE `codeParrain`='".$codeMembre."'".$chain);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getInfosWalletAgentForHyper($id_network){
@@ -1955,11 +1901,7 @@ class User_model extends CI_Model
INNER JOIN towns ON towns.id=agents.town_id
".$where_clause;
//var_dump($statement);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
/**
@@ -2039,11 +1981,7 @@ class User_model extends CI_Model
LEFT JOIN publiciteConfig ON countries.id=publiciteConfig.id_country AND publiciteConfig.id_config=2
WHERE towns.status=1
GROUP BY countries.id");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
/**
@@ -2076,11 +2014,7 @@ class User_model extends CI_Model
WHERE child.category='geolocated' AND dad.category='super' AND dad.code_membre='".$codeSup."'
");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function nameOfCurrentGeolocatedUser_forSuper($geolocatedUser_memberCode){
@@ -2097,21 +2031,13 @@ class User_model extends CI_Model
public function getAllActivatedNetworks(){
$query = $this->db->query("SELECT networks.name AS network,networks.status AS status,networks.id,countries.name AS country,networks.country_id , configWallet.id_network , configWallet.type FROM `networks`
INNER JOIN countries ON networks.country_id=countries.id LEFT JOIN configWallet ON configWallet.id_network = networks.id WHERE status = 1");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getConfigWallet($id_network){
$sql = "SELECT * FROM `configWallet` WHERE id_network = ?";
$query = $this->db->query($sql , array($id_network));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function addConfigWallet($network_id , $type){
@@ -2134,11 +2060,7 @@ class User_model extends CI_Model
public function getWallet($id_agent){
$sql = "SELECT * FROM `wallet_agent` WHERE agent_id = ?";
$query = $this->db->query($sql , array($id_agent));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function addWallet($id_agent){
@@ -2160,42 +2082,26 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT *
FROM wallet_transaction
WHERE `id_wallet`= '".$id_wallet."'");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getAgentiLinkTransactions($id_wallet){
$query = $this->db->query("SELECT *
FROM infos_ilink_transaction
WHERE `id_wallet_ag`= '".$id_wallet."'");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getNetworkHyper($id_network){
$sql = "SELECT * FROM `hyper_infos` WHERE network_id = ?";
$query = $this->db->query($sql , array($id_network));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getAllAgentsForNetwork($id_network){
$sql = "SELECT * FROM super_infos WHERE network_id = ?";
$query = $this->db->query($sql , array($id_network));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function reinitializeWallet($id_wallet){
@@ -2209,11 +2115,7 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT n.id AS id_network , n.name AS network,n.status AS status,c.name AS country,c.currency_name_fr, c.currency_name_en , c.currency_code, wp.id AS wallet_password FROM networks n
INNER JOIN countries_currencies c ON n.country_id=c.id INNER JOIN configWallet cw ON cw.id_network = n.id
LEFT JOIN walletsPassword wp ON wp.network_id = n.id WHERE status = 1;");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function addWalletPassword($network_id, $encrypted_password, $salt, $email)
@@ -2246,11 +2148,7 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT *
FROM infos_recharges
WHERE `network_id`=".$id_network.$chain);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function addWalletRecharge($montant,$wallet_id){
@@ -2313,11 +2211,7 @@ class User_model extends CI_Model
{
$sql = "SELECT * FROM `paliersConfigWallet` WHERE (`id` = ?);";
$query = $this->db->query($sql, array($id));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function deletePalierConfigWallet($type, $idConfig)
@@ -2386,11 +2280,7 @@ class User_model extends CI_Model
)
) AND code <> ? ;";
$query = $this->db->query($sql, array($code));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
//Liste des monnaies pour les pays dont un wallet est actif
@@ -2401,11 +2291,7 @@ class User_model extends CI_Model
)
) AND code <> ? ;";
$query = $this->db->query($sql, array($code));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function insertExchangeRate($currency ,$rate){
@@ -2417,11 +2303,7 @@ class User_model extends CI_Model
public function getExchangeRate($currency){
$sql = "SELECT * FROM `exchange_rate` WHERE `target_currency` = ?;";
$query = $this->db->query($sql , array($currency));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function updateExchangeRate($currency,$rate){
@@ -2436,11 +2318,7 @@ class User_model extends CI_Model
SELECT distinct c.id FROM networks n INNER JOIN countries_currencies c ON n.country_id=c.id INNER JOIN configWallet cw ON cw.id_network = n.id WHERE status = 1
);";
$query = $this->db->query($sql);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getActiveCountries(){
@@ -2448,21 +2326,13 @@ class User_model extends CI_Model
SELECT distinct n.country_id FROM networks n WHERE n.status = 1
);";
$query = $this->db->query($sql);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getCountry($id){
$sql= "SELECT name FROM countries WHERE id = $id";
$query = $this->db->query($sql);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function cancelCreditRequest($id_demand){
@@ -2505,11 +2375,7 @@ class User_model extends CI_Model
public function getSimulateur($code){
$sql = "SELECT * FROM `simulateur` WHERE `code` = ?;";
$query = $this->db->query($sql , array($code));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function setSharingRate($network_id,$config_id,$rate, $url){
@@ -2528,21 +2394,13 @@ class User_model extends CI_Model
public function getSharingRate($id_network ,$idConfig){
$sql = "SELECT taux_partage , url FROM `paying_networks` WHERE `id_network` = ? AND id_configWallet = ? ;";
$query = $this->db->query($sql , array($id_network,$idConfig));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getSharingRateByNetwork($id_network){
$sql = "SELECT balance_com FROM `paying_networks` WHERE `id_network` = ? ;";
$query = $this->db->query($sql , array($id_network));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function countPayingNetworks($id_country ,$idConfig){
@@ -2550,21 +2408,13 @@ class User_model extends CI_Model
networks n ON n.country_id = c.id WHERE n.status = 1 AND c.id = ?
) AND id_configWallet = ? ;";
$query = $this->db->query($sql , array($id_country, $idConfig));
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getActiveNetworksByCountry($country_id , $network_id){
$query = $this->db->query("SELECT networks.name , networks.id , configWallet.type FROM `networks` INNER JOIN countries ON networks.country_id=countries.id
INNER JOIN configWallet ON configWallet.id_network = networks.id WHERE status = 1 AND networks.id <> $network_id AND countries.id = $country_id");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getPayingNetworksByConfigWallet($id_config)
@@ -2595,11 +2445,7 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT *
FROM infos_ilink_transaction
WHERE `network_emetteur`= '".$id_network."'");
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getCurrency($id_network){
@@ -2617,11 +2463,7 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT *
FROM infos_transferts_commission
WHERE `codeParrain`='".$codeMembre."'".$chain);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getIlinkTransactionsSup($debut , $fin , $codeMembre){
@@ -2629,11 +2471,7 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT *
FROM infos_ilink_transaction
WHERE `code_parrain`='".$codeMembre."'".$chain);
- if($query->num_rows()>0){
- return $query;
- }else{
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getInfosWalletAgentForSuper($codeMembre)
@@ -2641,11 +2479,7 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT *
FROM wallet_agent
WHERE `codeParrain`='" . $codeMembre . "'");
- if ($query->num_rows() > 0) {
- return $query;
- } else {
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function insertRembourssementCompensation($montant, $id_network, $id_config)
@@ -2671,11 +2505,7 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT rp.* , n.name as network , cc.name as country , cc.currency_code FROM remboursemment_compensation rp
INNER JOIN networks n ON n.id = id_paying_network INNER JOIN countries_currencies cc ON cc.id = n.country_id
WHERE rp.id_network =" . $id_network . $chain);
- if ($query->num_rows() > 0) {
- return $query;
- } else {
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
// Nano credit
@@ -2696,32 +2526,20 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT networks.name AS network,networks.status AS status,networks.id,cc.name AS country,networks.country_id , configWallet.id_network , configWallet.type,cc.currency_code,
configWallet.limite_credit_min , configWallet.limite_credit_max , configWallet.has_nano_credit FROM `networks`
INNER JOIN countries_currencies cc ON networks.country_id=cc.id LEFT JOIN configWallet ON configWallet.id_network = networks.id WHERE status = 1 AND configWallet.type = 'ilink'");
- if ($query->num_rows() > 0) {
- return $query;
- } else {
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getUsersGroups($id_network)
{
$query = $this->db->query("SELECT * FROM infos_users_groups WHERE id_network = '" . $id_network . "'");
- if ($query->num_rows() > 0) {
- return $query;
- } else {
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getNanoCreditRates($idConfig, $type = 'nano_credit')
{
$sql = "SELECT * FROM `paliersConfigNanoCredit` WHERE (`idConfig` = ? AND `type` = ? );";
$query = $this->db->query($sql, array($idConfig, $type));
- if ($query->num_rows() > 0) {
- return $query;
- } else {
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function deleteNanoCreditRates($idConfig, $type = 'nano_credit')
@@ -2744,11 +2562,7 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT *
FROM infos_users_demandes_credits
WHERE `id_network`='" . $id_network . "'" . $chain);
- if ($query->num_rows() > 0) {
- return $query;
- } else {
- return false;
- }
+ return ($query->num_rows() > 0) ? $query : false;
}
public function getUsersSavings($debut, $fin, $id_network)
@@ -2757,10 +2571,40 @@ class User_model extends CI_Model
$query = $this->db->query("SELECT *
FROM infos_users_epargnes
WHERE `id_network`='" . $id_network . "'" . $chain);
- if ($query->num_rows() > 0) {
- return $query;
- } else {
- return false;
+ return ($query->num_rows() > 0) ? $query : false;
+ }
+
+ public function getAllAcceptedCreditsDemands($debut, $fin, $id_network)
+ {
+
+ $query = $this->db->query("SELECT *
+ FROM info_demandeCredits AS d
+ WHERE d.id_network='" . $id_network . "' AND d.dateAjout BETWEEN '" . $debut . "' AND '" . $fin . "' AND statut = '1'
+ ORDER BY dateAjout");
+ return ($query->num_rows() > 0) ? $query : false;
+ }
+
+ public function getAllCanceledCreditsDemands($debut, $fin, $id_network)
+ {
+
+ $query = $this->db->query("SELECT *
+ FROM info_demandeCredits AS d
+ WHERE d.id_network='" . $id_network . "' AND d.cancellation_date BETWEEN '" . $debut . "' AND '" . $fin . "' AND canceled_by_hypervisor = '1'
+ ORDER BY cancellation_date");
+ return ($query->num_rows() > 0) ? $query : false;
+ }
+
+ // Obtenir l'heure en fonction de l'id du reseau
+ public 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= $query->first_row();
+ $country_code = isset($country->code_country) ? $country->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');
}
}
}
diff --git a/application/views/demande_credit.php b/application/views/demande_credit.php
index bc5e7c85..0bc1e021 100755
--- a/application/views/demande_credit.php
+++ b/application/views/demande_credit.php
@@ -8,6 +8,7 @@
result() as $row) {
$num++;
@@ -257,7 +256,7 @@
echo "
$row->phone |
$origin |
- $row->montant |
+ ".$fmt->format($row->montant)." |
" . $row->dateAjout . " |
" . $row->dateModif . " |
$etat |
@@ -325,8 +324,6 @@
result() as $row) {
$num++;
@@ -347,7 +344,7 @@
}
echo "
- $row->montant |
+ ".$fmt->format($row->montant)." |
" . $row->dateAjout . " |
" . $row->dateModif . " |
$etat |
@@ -419,8 +416,7 @@
result() as $row) {
$num++;
@@ -434,7 +430,7 @@
$num |
$row->agent |
$superviseur |
- $row->montant |
+ ".$fmt->format($row->montant)." |
" . $row->dateA . " |
" . $row->dateM . " |
" . duree($row->temps) . " |
@@ -499,8 +495,7 @@
result() as $row) {
$num++;
@@ -512,7 +507,7 @@
echo "
$num |
- $row->montant |
+ ".$fmt->format($row->montant)." |
" . $row->dateA . " |
" . $row->dateM . " |
" . duree($row->temps) . " |
@@ -582,8 +577,7 @@
result() as $row) {
$num++;
@@ -597,7 +591,7 @@
$num |
$row->agent |
$superviseur |
- $row->montant |
+ ".$fmt->format($row->montant)." |
" . $row->dateA . " |
" . $row->dateM . " |
" . duree($row->temps) . " |
@@ -662,8 +656,7 @@
result() as $row) {
$num++;
@@ -675,7 +668,7 @@
echo "
$num |
- $row->montant |
+ ".$fmt->format($row->montant)." |
" . $row->dateA . " |
" . $row->dateM . " |
" . duree($row->temps) . " |
@@ -746,8 +739,7 @@
result() as $row) {
$num++;
@@ -773,7 +765,7 @@
$row->phone |
$origin |
$destination |
- $row->montant |
+ ".$fmt->format($row->montant)." |
" . $row->dateAjout . " |
" . $row->dateModif . " |
$etat |
@@ -840,8 +832,7 @@
result() as $row) {
$num++;
@@ -855,7 +846,7 @@
$num |
$row->emetteur |
$superviseur |
- $row->montant |
+ ".$fmt->format($row->montant)." |
" . $row->dateA . " |
" . $row->dateM . " |
" . duree($row->temps) . " |
@@ -935,7 +926,7 @@
$num |
$row->emetteur |
$superviseur |
- $row->montant |
+ ".$fmt->format($row->montant)." |
" . $row->dateA . " |
" . $row->dateM . " |
" . duree($row->temps) . " |
@@ -1151,36 +1142,6 @@
}
}
- $(function () {
-
- var start = moment().subtract(29, 'days');
- var end = moment();
-
- startDate = start;
- endDate = end;
-
- function cb(start, end) {
- $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
- startDate = start;
- endDate = end;
- }
-
- $('#reportrange').daterangepicker({
- startDate: start,
- endDate: end,
- ranges: {
- 'Today': [moment(), moment()],
- 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
- 'Last 7 Days': [moment().subtract(6, 'days'), moment()],
- 'Last 30 Days': [moment().subtract(29, 'days'), moment()],
- 'This Month': [moment().startOf('month'), moment().endOf('month')],
- 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
- }
- }, cb);
-
- cb(start, end);
-
- });
$(function () {
const category = $('#picker').data('category');
@@ -1210,36 +1171,3 @@
});
-
-
diff --git a/application/views/demande_credit_annulation.php b/application/views/demande_credit_annulation.php
new file mode 100755
index 00000000..30266967
--- /dev/null
+++ b/application/views/demande_credit_annulation.php
@@ -0,0 +1,391 @@
+
+
+
+
+
+
+ 86400,
+ "h" => 3600,
+ "m" => 60,
+ "s" => 1);
+ $result = "";
+
+ foreach ($tabTemps as $uniteTemps => $nombreSecondesDansUnite) {
+
+ $$uniteTemps = floor($time / $nombreSecondesDansUnite);
+
+ $time = $time % $nombreSecondesDansUnite;
+
+ if ($$uniteTemps > 0 || !empty($result)) {
+
+ $result .= $$uniteTemps . " $uniteTemps ";
+ }
+ }
+
+ return $result;
+
+ }
+
+ function dateDiff($date1, $date2,$class = null)
+ {
+ $diff = abs($date1 - $date2); // abs pour avoir la valeur absolute, ainsi éviter d'avoir une différence négative
+ $retour = array();
+
+ $tmp = $diff;
+ $second = $tmp % 60;
+
+ $tmp = floor(($tmp - $second) / 60);
+ $minute = $tmp % 60;
+
+ $tmp = floor(($tmp - $minute) / 60);
+ $heure = $tmp % 24;
+
+ $tmp = floor(($tmp - $heure) / 24);
+ $jour = $tmp;
+
+ return $class->lang->line('since').' ' . $jour . ' '.$class->lang->line('days').' ' . $heure . ' '.$class->lang->line('hours').' ' . $minute . ' '.$class->lang->line('minutes').' ' . $second . ' '.$class->lang->line('seconds');
+ }
+
+ function traitementTemps($time, $dateAjout , $class = null)
+ {
+ if ($time == null) {
+ $now = time();
+ $date2 = strtotime($dateAjout);
+
+ return dateDiff($now, $date2,$class);
+ } else {
+ return duree($time);
+ }
+ }
+
+ function getDelayOfTreatmentInSeconds($time, $dateAjout){
+ if ($time == null) {
+ $now = time();
+ $date2 = strtotime($dateAjout);
+ return abs($now - $date2);
+ }else{
+ return $time ;
+ }
+
+ }
+
+// function toLocateDate($date , $timezone){
+// if($date){
+// $carbon = Carbon::createFromFormat('Y-m-d H:i:s', $date, 'UTC');
+// $carbon->setTimezone($timezone);
+// return $carbon->toDateTimeString();
+// }
+// return $date;
+// }
+
+ ?>
+
+
+
+
+
+
+
+
+
+ lang->line('Temps moyen de traitement entrant'); ?>
+
+ lang->line('Aucune demande traitée');
+ }
+ ?>
+
+
+
+
+
+
+
+
+ lang->line('Période') ?>
+
+
+
+ Format : session->userdata('site_lang') === 'french' ? 'Jour - Mois - Année ' : 'Year - Month - Day' ?>
+
+
+
+
+
+
+
+
+
+
+ num_rows();
+ $num = 0;
+ if ($numrows > 0) {
+
+ ?>
+
+
+
+
+
+ " . $this->lang->line('Emetteur') . " |
+ " . $this->lang->line('receiver'). " |
+ " . $this->lang->line('Montant') . " |
+ " . $this->lang->line('Date de la demande') . " |
+ " . $this->lang->line('Date de traitement') . " |
+ " . $this->lang->line('Délai de traitement') . " |
+ " . $this->lang->line('Délai de traitement')."(en minutes)" . " |
+ Action |
+ ";
+
+ ?>
+
+
+
+ result() as $row) {
+ $num++;
+ $origin = $row->agent." | ".$row->phone;
+ $destination = $row->name_parrain." | ".$row->phone_parrain;
+ if ($row->codeMembre == $this->session->userdata('member_code')) {
+ $origin = $this->lang->line('Vous');
+ }
+ if ($row->codeParrain == $this->session->userdata('member_code')) {
+ $destination = $this->lang->line('Vous');
+ }
+
+ echo "
+ ".$origin." |
+ $destination |
+ ". $fmt->format($row->montant)." |
+ " . $row->dateAjout . " |
+ " . $row->dateModif . " |
+ " . traitementTemps($row->temps, $row->dateAjout,$this) . " | "; ?>
+ = getDelayOfTreatmentInSeconds($row->temps, $row->dateAjout)/60 ?> |
+ |
+
+
+
+
+
+
+ lang->line('Aucune demande');
+ }
+ } else {
+ echo $this->lang->line('Aucune demande');
+ }
+
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/application/views/header_hyp.php b/application/views/header_hyp.php
index 14821f4b..2dda4b45 100755
--- a/application/views/header_hyp.php
+++ b/application/views/header_hyp.php
@@ -134,14 +134,34 @@
- ">
-
- lang->line('Demandes de crédits'); ?>
+ "
+ style="height: auto;">
+
+
+ lang->line('Demandes de crédits'); ?>
+
+
+
+
+
">
diff --git a/application/views/historique_demande_credit_annulation.php b/application/views/historique_demande_credit_annulation.php
new file mode 100755
index 00000000..96c9aed1
--- /dev/null
+++ b/application/views/historique_demande_credit_annulation.php
@@ -0,0 +1,336 @@
+
+
+
+
+
+
+ 86400,
+ "h" => 3600,
+ "m" => 60,
+ "s" => 1);
+ $result = "";
+
+ foreach ($tabTemps as $uniteTemps => $nombreSecondesDansUnite) {
+
+ $$uniteTemps = floor($time / $nombreSecondesDansUnite);
+
+ $time = $time % $nombreSecondesDansUnite;
+
+ if ($$uniteTemps > 0 || !empty($result)) {
+
+ $result .= $$uniteTemps . " $uniteTemps ";
+ }
+ }
+
+ return $result;
+
+ }
+
+ function dateDiff($date1, $date2,$class = null)
+ {
+ $diff = abs($date1 - $date2); // abs pour avoir la valeur absolute, ainsi éviter d'avoir une différence négative
+ $retour = array();
+
+ $tmp = $diff;
+ $second = $tmp % 60;
+
+ $tmp = floor(($tmp - $second) / 60);
+ $minute = $tmp % 60;
+
+ $tmp = floor(($tmp - $minute) / 60);
+ $heure = $tmp % 24;
+
+ $tmp = floor(($tmp - $heure) / 24);
+ $jour = $tmp;
+
+ return $class->lang->line('since').' ' . $jour . ' '.$class->lang->line('days').' ' . $heure . ' '.$class->lang->line('hours').' ' . $minute . ' '.$class->lang->line('minutes').' ' . $second . ' '.$class->lang->line('seconds');
+ }
+
+ function traitementTemps($time, $dateAjout , $class = null)
+ {
+ if ($time == null) {
+ $now = time();
+ $date2 = strtotime($dateAjout);
+
+ return dateDiff($now, $date2,$class);
+ } else {
+ return duree($time);
+ }
+ }
+
+ ?>
+
+
+
+
+
+
+
+
+ lang->line('Période') ?>
+
+
+
+ Format : session->userdata('site_lang') === 'french' ? 'Jour - Mois - Année ' : 'Year - Month - Day' ?>
+
+
+
+
+
+
+
+
+
+ num_rows();
+ $num = 0;
+ if ($numrows > 0) {
+
+ ?>
+
+
+
+
+
+ " . $this->lang->line('Emetteur') . " |
+ " . $this->lang->line('receiver'). " |
+ " . $this->lang->line('Montant') . " |
+ " . $this->lang->line('Date de la demande') . " |
+ " . $this->lang->line('Date de traitement') . " |
+ " . $this->lang->line('Délai de traitement') . " |
+ " . $this->lang->line('cancellation_date') . " |
+ ";
+
+ ?>
+
+
+
+ result() as $row) {
+ $num++;
+ $origin = $row->agent." | ".$row->phone;
+ $destination = $row->name_parrain." | ".$row->phone_parrain;
+ if ($row->codeMembre == $this->session->userdata('member_code')) {
+ $origin = $this->lang->line('Vous');
+ }
+ if ($row->codeParrain == $this->session->userdata('member_code')) {
+ $destination = $this->lang->line('Vous');
+ }
+
+ echo "
+ ".$origin." |
+ $destination |
+ ". $fmt->format($row->montant)." |
+ " . $row->dateAjout . " |
+ " . $row->dateModif . " |
+ " . traitementTemps($row->temps, $row->dateAjout,$this) . " |
+ " . $row->cancellation_date. " |
+
+ "; ?>
+
+
+
+
+
+
+ lang->line('Aucune demande');
+ }
+ } else {
+ echo $this->lang->line('Aucune demande');
+ }
+
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/composer.json b/composer.json
index 4148ce35..08d64888 100755
--- a/composer.json
+++ b/composer.json
@@ -14,8 +14,9 @@
"php": ">=5.4",
"spatie/async": "^1.4",
"nesbot/carbon": "^2.33",
- "brick/money": "^0.4.5"
- },
+ "brick/money": "^0.4.5",
+ "ext-intl": "*"
+ },
"suggest": {
"paragonie/random_compat": "Provides better randomness in PHP 5.x"
},