diff --git a/www/application/config/constants.php b/www/application/config/constants.php index 215bcc70..316455ee 100644 --- a/www/application/config/constants.php +++ b/www/application/config/constants.php @@ -172,6 +172,7 @@ define('WRENCHBOARD_SAVE_GALLERY', 11042); define('WRENCHBOARD_USER_ADNEWCC', 11054); define('WRENCHBOARD_USER_USESAVEDCC', 11056); +define('WRENCHBOARD_USER_DELETEACC', 11990); define('WRENCHBOARD_ACCOUNT_END', 11999); //************************************************************** define('WRENCHBOARD_JOB_CREATEJOB',13010 ); diff --git a/www/application/controllers/Login.php b/www/application/controllers/Login.php index f867d71d..a672d9dd 100644 --- a/www/application/controllers/Login.php +++ b/www/application/controllers/Login.php @@ -177,8 +177,10 @@ class Login extends WRB_Controller { public function refreshAccountDetail($member_id) { $this->load->model('account_model'); $qr = $this->account_model->loadAccountData($member_id); - // print_r($qr); - $_SESSION['current_balance'] = $qr[0]['balance']; + $this->load->model('account_model'); + + $_SESSION['current_balance'] = $this->account_model->getUserWallet($member_id,$currency='NAIRA'); // $out['current_balance']; + // $_SESSION['current_balance'] = $qr[0]['balance']; $_SESSION['active_task'] = $this->account_model->loadActiveTaskCount($member_id); } diff --git a/www/application/controllers/Member.php b/www/application/controllers/Member.php index 2e910187..6ddd2da9 100644 --- a/www/application/controllers/Member.php +++ b/www/application/controllers/Member.php @@ -26,10 +26,24 @@ class Member extends Users_Controller { } } + /* + * Schedule account delete in the backend + */ public function deleteacc(){ - echo "Please log out of your account, and you will not be able to log in anymore. "; + // echo "Please log out of your account, and you will not be able to log in anymore. "; $data = $this->getSessionArray(); + $in = []; + $in['member_id'] = $_SESSION['member_id']; + $in['reason'] = "Not accepted in this version"; + $in['action'] = WRENCHBOARD_USER_DELETEACC; + if ($this->wrenchboard_api($in, $outx) == PHP_API_OK) { + $data['delete_message'] = "
Your Account and Information Deleted.
"; + redirect('/logout'); + } else { + $data['delete_message'] = "
Unable to complete account delete at this time.
"; + } + echo $data['delete_message']; } public function addreccipient() { @@ -702,11 +716,9 @@ class Member extends Users_Controller { public function smoney() { - $data = $this->getSessionArray(); - - - + //var_dump($data); + //exit(); $data['add_error'] = ''; $data['amount'] = 0; @@ -717,6 +729,9 @@ class Member extends Users_Controller { $data['comment'] = ''; // $data['fee'] = 0; //$data['escrow_balance'] = 0; + $this->load->model('account_model'); + $data['wallet'] = $this->account_model->getUserWallet($_SESSION['member_id'],$currency='NAIRA'); // $out['current_balance']; + $data['current_balance'] = $data['wallet'][0]['current_balance']; if ($_POST) { $data['comment'] = $this->input->post('comment'); @@ -739,7 +754,7 @@ class Member extends Users_Controller { $TotalAmount = $data['total']; // now let us do initial check if you have enough money - if ($_SESSION['current_balance'] < $TotalAmount) { + if ($data['current_balance'] < $TotalAmount) { $out['error'] = 'You do not have enough balance for this transfer'; $data['add_error'] = "
" . $out['error'] . "
"; } else { @@ -765,6 +780,9 @@ class Member extends Users_Controller { $data['sendmoney_table'] = $this->table->generate($query); $data['sendmoney_table_result'] = $query->result(); $data['page_title'] ="Wallet"; + + + $this->RenderUserPage('users/view_smoney', $data); } @@ -793,19 +811,7 @@ class Member extends Users_Controller { $final_page = false; $data = $this->getSessionArray(); - - - - - - - - - - //$data = $this->getSessionArray(); if ($_POST) { -// case 'sendmoney':$in["action"] = WRENCHBOARD_USER_SENDMONEY; - //$data = array(); $data['member_id'] = $_SESSION['member_id']; $data['action'] = WRENCHBOARD_SMONEY_MEMBER; $data["senderid"] = $_SESSION['member_id']; @@ -830,13 +836,13 @@ class Member extends Users_Controller { $out = array(); $res = $this->backend_model->wrenchboard_api($data, $out); // print_r($out); - //exit; + exit; $data = $this->getSessionArray(); // you will need this for new balace $data["fee"] = $out["Fee"]; $data["amount"] = $out["InitiatingAmount"]; $data["total"] = $data["fee"] + $data["amount"]; $data["recipient_account_detail"] = "Recipient Account Here"; - $data["comment"] = "Coment Here"; + $data["comment"] = "Comment Here"; $data["rec_firstname"] = $out["firstname"]; $data["rec_lastname"] = $out["lastname"]; @@ -879,17 +885,11 @@ class Member extends Users_Controller { $this->load->model('combo_model'); $this->combo_model->setReadOnly(true); $data['recipient_account_combo'] = $this->combo_model->getUserRecipientCombo('recipient_account', $_SESSION['member_id'], $data['recipient_account']); - - // $this->load->view('users/view_header_user', $data); - $data['sendmoney_table_result'] = $this->getSendMoneyRecent(); - $this->RenderUserPage('users/view_confirmwithdraw', $data); - // $this->load->view('users/view_footer_user', $data); - } else { - - //$this->load->view('users/view_header_user', $data); $data['sendmoney_table_result'] = $this->getSendMoneyRecent(); - $this->RenderUserPage('users/view_finalwithdraw', $data); - // $this->load->view('users/view_footer_user', $data); + $this->RenderUserPage('users/view_confirmwithdraw', $data); + } else { + $data['sendmoney_table_result'] = $this->getSendMoneyRecent(); + $this->RenderUserPage('users/view_finalwithdraw', $data); } } diff --git a/www/application/controllers/Paymnt.php b/www/application/controllers/Paymnt.php index 38563024..6a3c2f9f 100644 --- a/www/application/controllers/Paymnt.php +++ b/www/application/controllers/Paymnt.php @@ -99,6 +99,9 @@ class Paymnt extends Users_Controller { public function cardreciepts(){ $data = array_merge($this->getSessionArray(), $this->session->flashdata('reciept_data')); + if (!isset($data['confirmation'])){ + redirect("dash"); + } $this->RenderUserPage('users/view_payreciepts', $data); // return back to card page } } diff --git a/www/application/core/WRB_Controller.php b/www/application/core/WRB_Controller.php index ebc8835f..2f33dd1c 100644 --- a/www/application/core/WRB_Controller.php +++ b/www/application/core/WRB_Controller.php @@ -74,17 +74,22 @@ class WRB_Controller extends CI_Controller { $out = $this->dash_model->getDashData($data); $data['active_task'] = $out['active_task']; $data['active_pass_due'] = $out['active_pass_due']; - $data['current_balance'] = $out['current_balance']; $data['new_message'] = $out['new_message']; $_SESSION["active_offers_count"] = $out['active_offers_count']; - $data = $_SESSION['secure_data']; + $this->load->model('account_model'); + $data['wallet'] = $this->account_model->getUserWallet($_SESSION['member_id'],$currency='NAIRA'); // $out['current_balance']; + $data['current_balance'] = $data['wallet'][0]['current_balance']; + + + $data = $_SESSION['secure_data']; $data['member_id'] = $_SESSION['member_id']; // = $ret->email; $this->refreshAccountDetail($_SESSION['member_id']); return $data; } + protected function logUser($mlog) { // $data['action'] = WRENCHBOARD_LOG_MEMBER; diff --git a/www/application/libraries/Users_Controller.php b/www/application/libraries/Users_Controller.php index a22a8ae4..6ac1efc3 100644 --- a/www/application/libraries/Users_Controller.php +++ b/www/application/libraries/Users_Controller.php @@ -39,11 +39,15 @@ class Users_Controller extends WRB_Controller { $out = $this->dash_model->getDashData($data); $data['active_task'] = $out['active_task']; $data['active_pass_due'] = $out['active_pass_due']; - $data['current_balance'] = $out['current_balance']; + //$data['current_balance'] = $out['current_balance']; $data['new_message'] = $out['new_message']; $data['escrow_balance'] = $out['escrow_balance']; $data['description'] = $out["description"]; + $this->load->model('account_model'); + $data['wallet'] = $this->account_model->getUserWallet($_SESSION['member_id'],$currency='NAIRA'); // $out['current_balance']; + $data['current_balance'] = $data['wallet'][0]['current_balance']; + //$data = $_SESSION['secure_data']; $data['member_id'] = $_SESSION['member_id']; // = $ret->email; $_SESSION["active_offers_count"] = $out['active_offers_count']; @@ -58,7 +62,12 @@ class Users_Controller extends WRB_Controller { $this->load->model('account_model'); $qr = $this->account_model->loadAccountData($member_id); // print_r($qr); - $_SESSION['current_balance'] = $qr[0]['balance']; + // $_SESSION['current_balance'] = $qr[0]['balance']; + + $this->load->model('account_model'); + $data['wallet'] = $this->account_model->getUserWallet($member_id,$currency='NAIRA'); // $out['current_balance']; + $_SESSION['current_balance'] = $data['wallet'][0]['current_balance']; + $_SESSION['active_task'] = $this->account_model->loadActiveTaskCount($member_id); $_SESSION['state'] = $qr[0]['state']; $_SESSION['city'] = $qr[0]['city']; diff --git a/www/application/models/Account_model.php b/www/application/models/Account_model.php index d69505ae..00233353 100644 --- a/www/application/models/Account_model.php +++ b/www/application/models/Account_model.php @@ -9,7 +9,11 @@ class Account_model extends CI_Model { public function getUserWallet($member_id,$currency='') { $num = 0; //$mysql = "SELECT * FROM members_wallet WHERE member_id = $member_id AND currency='".$currency."' "; - $mysql = "SELECT w.amount,c.* FROM members_wallet w LEFT JOIN currency c ON c.code=w.currency WHERE w.member_id = $member_id ORDER BY c.lorder DESC"; + $and_part = ''; + if ($currency =''){ + $and_part = " AND w.currency='$currency' "; + } + $mysql = "SELECT w.amount,c.*,w.amount AS current_balance FROM members_wallet w LEFT JOIN currency c ON c.code=w.currency WHERE w.member_id = $member_id ".$and_part." ORDER BY c.lorder DESC"; $query = $this->db->query($mysql); return $query->result_array(); } diff --git a/www/application/models/Backend_model.php b/www/application/models/Backend_model.php index 4b2ce0fa..0e2d0f8d 100644 --- a/www/application/models/Backend_model.php +++ b/www/application/models/Backend_model.php @@ -20,6 +20,11 @@ class Backend_model extends CI_Model { public function wrenchboard_api($in, $out = array()) { $this->wrenchboard_load(); $ret = $this->wrenchboard->wrenchboard_api($in, $out); + + // var_dump($ret); + // echo "-----"; + // var_dump($out); + // exit(); return $ret; } diff --git a/www/application/models/Dash_model.php b/www/application/models/Dash_model.php index bbdd32ee..c2c84d6d 100644 --- a/www/application/models/Dash_model.php +++ b/www/application/models/Dash_model.php @@ -54,6 +54,7 @@ class Dash_model extends CI_Model { return $out; } + public function getNewMessageCount($member_id) { $out = array(); $out['new_message'] =0; diff --git a/www/application/views/users/view_settings.php b/www/application/views/users/view_settings.php index 566b6817..62e97b93 100644 --- a/www/application/views/users/view_settings.php +++ b/www/application/views/users/view_settings.php @@ -51,250 +51,32 @@ $email_preff = array (
- - -
- - - - - - - -
- - - - - -
- - - - - -
- - - - - -
- - - - - -
- - - - - -
- - - - -
- - - - -
- -
- - - - -
- -
-
-

Notifications

-
-
- - -
- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Notifications -
- - -
-
-
- - -
-
Billing Updates -
- - -
-
-
- - -
-
New Team Members -
- - -
-
-
- - -
-
Completed Projects -
- - -
-
-
- - -
-
Newsletters -
- - -
-
-
- - -
-
-
- + + + + + +
+ +
@@ -308,6 +90,7 @@ $email_preff = array (
+
@@ -373,14 +156,14 @@ $email_preff = array (