+ Fix bug when deleting wallet transaction

This commit is contained in:
Djery-Tom 2020-12-21 17:21:06 +01:00
parent b5f82b9694
commit e79764e1ec
4 changed files with 17 additions and 14 deletions

View File

@ -578,13 +578,13 @@ class Hyperviseur_dash extends CI_Controller
if ($this->isLogged()) { if ($this->isLogged()) {
$datetime = $this->user_model->getCurrentTimeByNetworkID($this->session->userdata('network_id')); $datetime = $this->user_model->getCurrentTimeByNetworkID($this->session->userdata('network_id'));
$id = $this->input->post('id_transaction'); $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) { if($query->num_rows()>0) {
$transaction = $query->first_row(); $transaction = $query->first_row();
// Debiter le compte de l'agent de sa commission // Debiter le compte de l'agent de sa commission
$this->db->set('balance_com', 'balance_com-'.$transaction->commission_ag,false); $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'); $this->db->update('wallets');
// Debiter le compte du superviseur de sa commission // 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); $query = $this->db->update('wallet_transaction',$data);
try { 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' ; $url = NOTIFICATION_SERVICE_URL . '/onesignal/pushToAgent' ;
@ -622,29 +622,30 @@ class Hyperviseur_dash extends CI_Controller
)); ));
$data = new \stdClass(); $data = new \stdClass();
$data->screen = "Historique"; $data->screen = "notificationview";
$data->data = new \stdClass(); $data->data = new \stdClass();
$data->data->id = $id; $data->data->id = $id;
$body = new \stdClass(); $body = new \stdClass();
$body->agent_code = $demand->codeMembre; $body->agent_code = $transaction->codeMembre;
$body->message = $message; $body->message = $message;
$body->data = $data; $body->data = $data;
$body->date = $datetime; $body->date = $datetime;
//Send to agent
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
/* set return type json */
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
/* execute request */
curl_exec($ch); 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_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
curl_exec($ch); 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 */ /* close cURL resource */
curl_close($ch); curl_close($ch);

View File

@ -604,4 +604,5 @@ $lang['delete_transaction'] = "Delete a transaction";
$lang['are_you_sure'] = "Are you sure what you are doing?"; $lang['are_you_sure'] = "Are you sure what you are doing?";
$lang['deleted_transactions'] = "Deleted Transactions"; $lang['deleted_transactions'] = "Deleted Transactions";
$lang['deletion_date'] = "Date of deletion"; $lang['deletion_date'] = "Date of deletion";
$lang['wallet_transaction_deleted_message'] = "Transaction number %s made by agent %s has been deleted"
?> ?>

View File

@ -616,4 +616,5 @@ $lang['delete_transaction'] = "Supprimer une transaction";
$lang['are_you_sure'] = "Êtes vous sûr de ce que vous faites ?"; $lang['are_you_sure'] = "Êtes vous sûr de ce que vous faites ?";
$lang['deleted_transactions'] = "Transactions supprimées"; $lang['deleted_transactions'] = "Transactions supprimées";
$lang['deletion_date'] = "Date de suppression"; $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"
?> ?>

View File

@ -11,7 +11,7 @@
"source": "https://github.com/bcit-ci/CodeIgniter" "source": "https://github.com/bcit-ci/CodeIgniter"
}, },
"require": { "require": {
"php": ">=5.4", "php": ">=7.0",
"spatie/async": "^1.4", "spatie/async": "^1.4",
"nesbot/carbon": "^2.33", "nesbot/carbon": "^2.33",
"brick/money": "^0.4.5", "brick/money": "^0.4.5",