Disables unique check and fixes return

- If allow duplicate barcodes is enabled then this function automatically returns FALSE allowing item imports and new items to no longer balk.
- Modified the code to return TRUE not only when there is 1 row but when there are one or more rows.  This will fix problems with users that allow duplicate barcodes and who upgraded from older versions before unique barcode was required.
This commit is contained in:
objecttothis
2017-09-12 13:28:50 +04:00
committed by FrancescoUK
parent 27e9f3ff1a
commit 372c3ab6bf

View File

@@ -44,6 +44,11 @@ class Item extends CI_Model
*/
public function item_number_exists($item_number, $item_id = '')
{
if($this->config->item('allow_duplicate_barcodes') != FALSE)
{
return FALSE;
}
$this->db->from('items');
$this->db->where('item_number', (string) $item_number);
if(ctype_digit($item_id))
@@ -51,7 +56,7 @@ class Item extends CI_Model
$this->db->where('item_id !=', (int) $item_id);
}
return ($this->db->get()->num_rows() == 1);
return ($this->db->get()->num_rows() >= 1);
}
/*