mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-07-10 23:17:08 -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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user