From a1cab689825a75292ca6fa9171d86576154f1498 Mon Sep 17 00:00:00 2001 From: Djery-Tom Date: Mon, 1 Mar 2021 17:53:59 +0100 Subject: [PATCH] Add phone number verification in gestion_recherche menu --- application/controllers/Gestion.php | 14 ++- application/language/english/message_lang.php | 1 + application/language/french/message_lang.php | 1 + application/models/User_model.php | 5 + application/views/gestion_recherche.php | 108 ++---------------- 5 files changed, 26 insertions(+), 103 deletions(-) diff --git a/application/controllers/Gestion.php b/application/controllers/Gestion.php index 13126ce2..aace0e1e 100755 --- a/application/controllers/Gestion.php +++ b/application/controllers/Gestion.php @@ -1428,11 +1428,15 @@ class Gestion extends CI_Controller $adresse = $_POST['adresse']; $email = $_POST['email']; $nom = $_POST['nom']; - $res = $this->user_model->update_geolocated_infos($nom, $adresse, $email, $id_agent, $transac, $phone, $id_netAg); - if ($res != false) { - echo json_encode("200"); - } else { - echo json_encode("500"); + if($this->user_model->isAgentPhoneExist($id_netAg,$phone,$transac)){ + echo json_encode("400"); + }else{ + $res = $this->user_model->update_geolocated_infos($nom, $adresse, $email, $id_agent, $transac, $phone, $id_netAg); + if ($res != false) { + echo json_encode("200"); + } else { + echo json_encode("500"); + } } } else { diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index 099c0ae2..f453820b 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -611,4 +611,5 @@ $lang['nano_health_management'] = 'Nano health management'; $lang['nano_health_removal'] = 'Removal of nano health'; $lang['activate_nano_health'] = 'Activate nano health'; $lang['nano_health_deleted'] = 'Nano health deleted'; +$lang['phone_already_exists'] = "This phone number already exists"; ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index 99d34e34..759149a6 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -623,4 +623,5 @@ $lang['nano_health_management'] = 'Gestion du nano santé'; $lang['nano_health_removal'] = 'Suppression du nano santé'; $lang['activate_nano_health'] = 'Activation du nano santé'; $lang['nano_health_deleted'] = 'Nano santé supprimé'; +$lang['phone_already_exists'] = "This phone number already exists"; ?> diff --git a/application/models/User_model.php b/application/models/User_model.php index 9e478a0f..a4bba4ce 100755 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -2608,4 +2608,9 @@ class User_model extends CI_Model return date('Y-m-d H:i:s'); } } + + public function isAgentPhoneExist($id_network_agent , $phone, $phoneTransaction){ + $query = $this->db->query("SELECT na.phone from networks_agents na WHERE na.id <> '$id_network_agent' AND (na.phone ='$phone' OR na.transactionNumber ='$phoneTransaction')"); + return $query->num_rows() ; + } } diff --git a/application/views/gestion_recherche.php b/application/views/gestion_recherche.php index 907035c2..0ed39730 100755 --- a/application/views/gestion_recherche.php +++ b/application/views/gestion_recherche.php @@ -6,6 +6,7 @@ href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/css/bootstrap-multiselect.css"> +