mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-10 01:51:02 -04:00
Primary changes return type from ResultSet to int for those requests that only return a record count. Also corrected a few other minor issues.
This commit is contained in:
@@ -35,7 +35,7 @@ class Customers extends Persons
|
||||
{
|
||||
parent::__construct('customers');
|
||||
$this->mailchimp_lib = new Mailchimp_lib();
|
||||
|
||||
$this->customer_rewards = model('Customer_rewards');
|
||||
$this->customer = model('Customer');
|
||||
$this->tax_code = model('Tax_code');
|
||||
$this->config = config('OSPOS')->settings;
|
||||
@@ -91,7 +91,7 @@ class Customers extends Persons
|
||||
/*
|
||||
Returns customer table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function getSearch(): void
|
||||
public function getSearch()
|
||||
{
|
||||
$search = $this->request->getGet('search', FILTER_SANITIZE_STRING);
|
||||
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
|
||||
@@ -187,7 +187,7 @@ class Customers extends Persons
|
||||
$data['packages'] = $packages;
|
||||
$data['selected_package'] = $info->package_id;
|
||||
|
||||
if($$this->config['use_destination_based_tax']) //TODO: This can be shortened for ternary notation
|
||||
if($this->config['use_destination_based_tax']) //TODO: This can be shortened for ternary notation
|
||||
{
|
||||
$data['use_destination_based_tax'] = TRUE;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class Cashup extends Model
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search, array $filters): ResultInterface
|
||||
public function get_found_rows(string $search, array $filters): int
|
||||
{
|
||||
return $this->search($search, $filters, 0, 0, 'cashup_id', 'asc', TRUE);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ class Customer extends Person
|
||||
//append those fields to base parent object, we have a complete empty object
|
||||
foreach($this->db->getFieldNames('customers') as $field)
|
||||
{
|
||||
$person_obj->$field = '';
|
||||
$person_obj->$field = null;
|
||||
}
|
||||
|
||||
return $person_obj;
|
||||
@@ -398,9 +398,11 @@ class Customer extends Person
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'last_name', 'asc', TRUE);
|
||||
$result = $this->search($search, 0, 0, 'last_name', 'asc', TRUE);
|
||||
log_message('info', '>>>Customer.get_found_rows-' . $result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -327,7 +327,7 @@ class Employee extends Person
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'last_name', 'asc', TRUE);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ class Expense extends Model
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search, array $filters): ResultInterface
|
||||
public function get_found_rows(string $search, array $filters): int
|
||||
{
|
||||
return $this->search($search, $filters, 0, 0, 'expense_id', 'asc', TRUE);
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ class Expense_category extends Model
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'category_name', 'asc', TRUE);
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ class Giftcard extends Model
|
||||
/**
|
||||
* Gets gift cards
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'giftcard_number', 'asc', TRUE);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ class Item extends Model
|
||||
/**
|
||||
* Get number of rows
|
||||
*/
|
||||
public function get_found_rows(string $search, array $filters): ResultInterface
|
||||
public function get_found_rows(string $search, array $filters): int
|
||||
{
|
||||
return $this->search($search, $filters, 0, 0, 'items.name', 'asc', TRUE);
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ class Item_kit extends Model
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'name', 'asc', TRUE);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ class Sale extends Model
|
||||
/**
|
||||
* Get number of rows for the takings (sales/manage) view
|
||||
*/
|
||||
public function get_found_rows(string $search, array $filters): ResultInterface
|
||||
public function get_found_rows(string $search, array $filters): int
|
||||
{
|
||||
return $this->search($search, $filters, 0, 0, 'sales.sale_time', 'desc', TRUE);
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ class Supplier extends Person
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'last_name', 'asc', TRUE);
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ class Tax extends Model
|
||||
/**
|
||||
* Gets tax_codes
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'tax_code_name', 'asc', TRUE);
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ class Tax_category extends Model
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'tax_category', 'asc', TRUE);
|
||||
}
|
||||
|
||||
@@ -48,15 +48,18 @@ class Tax_code extends Model
|
||||
/**
|
||||
* Gets information about the particular record
|
||||
*/
|
||||
public function get_info(int $tax_code_id): object
|
||||
public function get_info(?int $tax_code_id): object
|
||||
{
|
||||
$builder = $this->db->table('tax_codes');
|
||||
if($tax_code_id != null)
|
||||
{
|
||||
$builder = $this->db->table('tax_codes');
|
||||
|
||||
$builder->where('tax_code_id', $tax_code_id);
|
||||
$builder->where('deleted', 0);
|
||||
$query = $builder->get();
|
||||
$builder->where('tax_code_id', $tax_code_id);
|
||||
$builder->where('deleted', 0);
|
||||
$query = $builder->get();
|
||||
}
|
||||
|
||||
if($query->getNumRows() == 1) //TODO: ===
|
||||
if($tax_code_id != null && $query->getNumRows() === 1)
|
||||
{
|
||||
return $query->getRow();
|
||||
}
|
||||
@@ -68,7 +71,7 @@ class Tax_code extends Model
|
||||
//Get all the fields from the table
|
||||
foreach($this->db->getFieldNames('tax_codes') as $field)
|
||||
{
|
||||
$tax_code_obj->$field = '';
|
||||
$tax_code_obj->$field = null;
|
||||
}
|
||||
return $tax_code_obj;
|
||||
}
|
||||
@@ -191,7 +194,7 @@ class Tax_code extends Model
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'tax_code_name', 'asc', TRUE);
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ class Tax_jurisdiction extends Model
|
||||
/**
|
||||
* Gets rows
|
||||
*/
|
||||
public function get_found_rows(string $search): ResultInterface
|
||||
public function get_found_rows(string $search): int
|
||||
{
|
||||
return $this->search($search, 0, 0, 'jurisdiction_name', 'asc', TRUE);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ $(document).ready(function()
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-submit='<?php echo lang('Common.submit') ?>' data-href='<?php echo esc(site_url("$controller_name/view"), 'url') ?>'
|
||||
<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-submit='<?php echo lang('Common.submit') ?>' data-href='<?php echo site_url("$controller_name/view") ?>'
|
||||
title='<?php echo lang("$controller_name.new") ?>'>
|
||||
<span class="glyphicon glyphicon-user"> </span><?php echo lang("$controller_name.new") ?>
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user