Files
opensourcepos/application/models/item_quantitys.php
jekkos-t520 9607300514 Added empty check in stock_locations config
Rework database script (contains stock_locations + item_quantities tables)
2014-07-05 13:47:33 +02:00

37 lines
1.1 KiB
PHP

<?php
class Item_quantitys extends CI_Model
{
function exists($item_quantity_id)
{
$this->db->from('item_quantitys');
$this->db->where('item_quantity_id',$item_quantity_id);
$query = $this->db->get();
return ($query->num_rows()==1);
}
function save($location_detail, $item_quantity_id=false)
{
if (!$item_quantity_id or !$this->exists($item_quantity_id))
{
if($this->db->insert('item_quantitys',$location_detail))
{
$location_detail['item_quantity_id']=$this->db->insert_id();
return true;
}
return false;
}
$this->db->where('item_quantity_id', $item_quantity_id);
return $this->db->update('item_quantitys',$location_detail);
}
function get_item_quantity($item_id, $location_id)
{
$this->db->from('item_quantitys');
$this->db->where('item_id',$item_id);
$this->db->where('location_id',$location_id);
return $this->db->get()->row();
}
}
?>