From e79764e1ec3012338d5fec06e6e8b7de989880c3 Mon Sep 17 00:00:00 2001 From: Djery-Tom Date: Mon, 21 Dec 2020 17:21:06 +0100 Subject: [PATCH] + Fix bug when deleting wallet transaction --- application/controllers/Hyperviseur_dash.php | 27 ++++++++++--------- application/language/english/message_lang.php | 1 + application/language/french/message_lang.php | 1 + composer.json | 2 +- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php index 7c3ef671..dc71f906 100755 --- a/application/controllers/Hyperviseur_dash.php +++ b/application/controllers/Hyperviseur_dash.php @@ -578,13 +578,13 @@ class Hyperviseur_dash extends CI_Controller if ($this->isLogged()) { $datetime = $this->user_model->getCurrentTimeByNetworkID($this->session->userdata('network_id')); $id = $this->input->post('id_transaction'); - $query = $this->db->get_where('wallet_transaction', ['id' => $id]); + $query = $this->db->get_where('infos_transaction', ['id' => $id]); if($query->num_rows()>0) { $transaction = $query->first_row(); // Debiter le compte de l'agent de sa commission $this->db->set('balance_com', 'balance_com-'.$transaction->commission_ag,false); - $this->db->where('id',$transaction->id_wallet); + $this->db->where('id',$transaction->id_wallet_ag); $this->db->update('wallets'); // Debiter le compte du superviseur de sa commission @@ -606,7 +606,7 @@ class Hyperviseur_dash extends CI_Controller $query = $this->db->update('wallet_transaction',$data); try { - $message = line_with_arguments($this->lang->line('credit_request_canceled_by_hypervisor_message'), array($id,$demand->montant)); + $message = line_with_arguments($this->lang->line('wallet_transaction_deleted_message'), array($id,$transaction->agent)); $url = NOTIFICATION_SERVICE_URL . '/onesignal/pushToAgent' ; @@ -622,29 +622,30 @@ class Hyperviseur_dash extends CI_Controller )); $data = new \stdClass(); - $data->screen = "Historique"; + $data->screen = "notificationview"; $data->data = new \stdClass(); $data->data->id = $id; $body = new \stdClass(); - $body->agent_code = $demand->codeMembre; + $body->agent_code = $transaction->codeMembre; $body->message = $message; $body->data = $data; $body->date = $datetime; - + //Send to agent curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); - - /* set return type json */ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - - /* execute request */ curl_exec($ch); - $body->agent_code = $demand->codeParrain; - + //Send to supervisor + $body->agent_code = $transaction->codeParrain; curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); - curl_exec($ch); + + //Send to hypervisor + $body->agent_code = $transaction->code_membre_hyp; + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); + curl_exec($ch); + /* close cURL resource */ curl_close($ch); diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index 80915d18..5e337249 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -604,4 +604,5 @@ $lang['delete_transaction'] = "Delete a transaction"; $lang['are_you_sure'] = "Are you sure what you are doing?"; $lang['deleted_transactions'] = "Deleted Transactions"; $lang['deletion_date'] = "Date of deletion"; +$lang['wallet_transaction_deleted_message'] = "Transaction number %s made by agent %s has been deleted" ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index b0f9733e..a6d0a461 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -616,4 +616,5 @@ $lang['delete_transaction'] = "Supprimer une transaction"; $lang['are_you_sure'] = "Êtes vous sûr de ce que vous faites ?"; $lang['deleted_transactions'] = "Transactions supprimées"; $lang['deletion_date'] = "Date de suppression"; +$lang['wallet_transaction_deleted_message'] = "La transaction numéro %s faites par l'agent %s a été supprimée" ?> diff --git a/composer.json b/composer.json index d4c0ed8e..a647241a 100755 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "source": "https://github.com/bcit-ci/CodeIgniter" }, "require": { - "php": ">=5.4", + "php": ">=7.0", "spatie/async": "^1.4", "nesbot/carbon": "^2.33", "brick/money": "^0.4.5",