From 7cb4c3eef1a165a080959cdddfe821a92c83021a Mon Sep 17 00:00:00 2001 From: Steve Ireland Date: Sun, 12 Mar 2023 12:41:46 -0400 Subject: [PATCH] Correct some experimental code. --- app/Controllers/Customers.php | 12 ++++++------ app/Controllers/Sales.php | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/Controllers/Customers.php b/app/Controllers/Customers.php index 97dc318e5..7ec3bb496 100644 --- a/app/Controllers/Customers.php +++ b/app/Controllers/Customers.php @@ -93,11 +93,11 @@ class Customers extends Persons */ public function getSearch(): void { - $search = $this->request->get('search', FILTER_SANITIZE_STRING); - $limit = $this->request->get('limit', FILTER_SANITIZE_NUMBER_INT); - $offset = $this->request->get('offset', FILTER_SANITIZE_NUMBER_INT); - $sort = $this->request->get('sort', FILTER_SANITIZE_STRING); - $order = $this->request->get('order', FILTER_SANITIZE_STRING); + $search = $this->request->getVar('search', FILTER_SANITIZE_STRING); + $limit = $this->request->getVar('limit', FILTER_SANITIZE_NUMBER_INT); + $offset = $this->request->getVar('offset', FILTER_SANITIZE_NUMBER_INT); + $sort = $this->request->getVar('sort', FILTER_SANITIZE_STRING); + $order = $this->request->getVar('order', FILTER_SANITIZE_STRING); $customers = $this->customer->search($search, $limit, $offset, $sort, $order); $total_rows = $this->customer->get_found_rows($search); @@ -131,7 +131,7 @@ class Customers extends Persons */ public function suggest(): void { - $suggestions = $this->customer->get_search_suggestions($this->request->get('term', FILTER_SANITIZE_STRING), 25,TRUE); + $suggestions = $this->customer->get_search_suggestions($this->request->getVar('term', FILTER_SANITIZE_STRING), 25,TRUE); echo json_encode($suggestions); } diff --git a/app/Controllers/Sales.php b/app/Controllers/Sales.php index 6e225d337..8fa384d64 100644 --- a/app/Controllers/Sales.php +++ b/app/Controllers/Sales.php @@ -101,27 +101,27 @@ class Sales extends Secure_Controller public function getSearch(): void { - $search = $this->request->get('search', FILTER_SANITIZE_STRING); - $limit = $this->request->get('limit', FILTER_SANITIZE_NUMBER_INT); - $offset = $this->request->get('offset', FILTER_SANITIZE_NUMBER_INT); - $sort = $this->request->get('sort', FILTER_SANITIZE_STRING); - $order = $this->request->get('order', FILTER_SANITIZE_STRING); + $search = $this->request->getVar('search', FILTER_SANITIZE_STRING); + $limit = $this->request->getVar('limit', FILTER_SANITIZE_NUMBER_INT); + $offset = $this->request->getVar('offset', FILTER_SANITIZE_NUMBER_INT); + $sort = $this->request->getVar('sort', FILTER_SANITIZE_STRING); + $order = $this->request->getVar('order', FILTER_SANITIZE_STRING); $filters = [ 'sale_type' => 'all', 'location_id' => 'all', - 'start_date' => $this->request->get('start_date', FILTER_SANITIZE_STRING), - 'end_date' => $this->request->get('end_date', FILTER_SANITIZE_STRING), + 'start_date' => $this->request->getVar('start_date', FILTER_SANITIZE_STRING), + 'end_date' => $this->request->getVar('end_date', FILTER_SANITIZE_STRING), 'only_cash' => FALSE, 'only_due' => FALSE, 'only_check' => FALSE, 'only_creditcard' => FALSE, - 'only_invoices' => $this->config['invoice_enable'] && $this->request->get('only_invoices', FILTER_SANITIZE_NUMBER_INT), + 'only_invoices' => $this->config['invoice_enable'] && $this->request->getVar('only_invoices', FILTER_SANITIZE_NUMBER_INT), 'is_valid_receipt' => $this->sale->is_valid_receipt($search) ]; // check if any filter is set in the multiselect dropdown - $filledup = array_fill_keys($this->request->get('filters', FILTER_SANITIZE_STRING), TRUE); //TODO: Variable does not meet naming conventions + $filledup = array_fill_keys($this->request->getVar('filters', FILTER_SANITIZE_STRING), TRUE); //TODO: Variable does not meet naming conventions $filters = array_merge($filters, $filledup); $sales = $this->sale->search($search, $filters, $limit, $offset, $sort, $order); @@ -150,7 +150,7 @@ class Sales extends Secure_Controller public function item_search(): void { $suggestions = []; - $receipt = $search = $this->request->get('term') != '' ? $this->request->get('term', FILTER_SANITIZE_STRING) : NULL; + $receipt = $search = $this->request->getVar('term') != '' ? $this->request->get('term', FILTER_SANITIZE_STRING) : NULL; if($this->sale_lib->get_mode() == 'return' && $this->sale->is_valid_receipt($receipt)) {