mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-24 08:20:54 -04:00
Fix default location in items, sales and receivings
This commit is contained in:
@@ -19,7 +19,7 @@ class Items extends Secure_area implements iData_controller
|
||||
|
||||
$stock_location=$this->item_lib->get_item_location();
|
||||
$stock_locations=$this->Stock_locations->get_allowed_locations();
|
||||
$data['stock_location']=$this->item_lib->get_item_location();
|
||||
$data['stock_location']=$stock_location;
|
||||
$data['stock_locations']=$stock_locations;
|
||||
|
||||
$data['controller_name']=strtolower(get_class());
|
||||
|
||||
@@ -13,7 +13,7 @@ class Item_lib
|
||||
{
|
||||
if(!$this->CI->session->userdata('item_location'))
|
||||
{
|
||||
$location_name = $this->Stock_locations->get_default_location();
|
||||
$location_name = $this->CI->Stock_locations->get_default_location_id();
|
||||
$this->set_item_location($location_name);
|
||||
}
|
||||
return $this->CI->session->userdata('item_location');
|
||||
|
||||
@@ -52,7 +52,7 @@ class Receiving_lib
|
||||
{
|
||||
if(!$this->CI->session->userdata('recv_stock_source'))
|
||||
{
|
||||
$location_name = $this->Stock_locations->get_default_location();
|
||||
$location_name = $this->CI->Stock_locations->get_default_location_id();
|
||||
$this->set_stock_source($location_name);
|
||||
}
|
||||
return $this->CI->session->userdata('recv_stock_source');
|
||||
@@ -87,9 +87,8 @@ class Receiving_lib
|
||||
{
|
||||
if(!$this->CI->session->userdata('recv_stock_destination'))
|
||||
{
|
||||
$stock_locations = $this->CI->Stock_locations->get_undeleted_all()->result_array();
|
||||
$location_name = $stock_locations[0]['location_id'];
|
||||
$this->set_stock_destination($location_name);
|
||||
$location_name = $this->CI->Stock_locations->get_default_location_id();
|
||||
$this->set_stock_destination($location_name);
|
||||
}
|
||||
return $this->CI->session->userdata('recv_stock_destination');
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ class Sale_lib
|
||||
{
|
||||
if(!$this->CI->session->userdata('sale_location'))
|
||||
{
|
||||
$location_name = $this->Stock_locations->get_default_location();
|
||||
$location_name = $this->CI->Stock_locations->get_default_location_id();
|
||||
$this->set_sale_location($location_name);
|
||||
}
|
||||
return $this->CI->session->userdata('sale_location');
|
||||
|
||||
@@ -61,7 +61,7 @@ class Stock_locations extends CI_Model
|
||||
return $stock_locations;
|
||||
}
|
||||
|
||||
function get_default_location_name()
|
||||
function get_default_location_id()
|
||||
{
|
||||
$this->db->from('stock_locations');
|
||||
// TODO replace with extra join on ospos_grants
|
||||
@@ -70,7 +70,7 @@ class Stock_locations extends CI_Model
|
||||
$this->db->where('person_id', $this->session->userdata('person_id'));
|
||||
$this->db->where('deleted',0);
|
||||
$this->db->limit(1);
|
||||
return $this->db->get()->row()->location_name;
|
||||
return $this->db->get()->row()->location_id;
|
||||
}
|
||||
|
||||
function get_location_name($location_id)
|
||||
|
||||
Reference in New Issue
Block a user