mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-24 16:28:40 -04:00
Check if grant for module exists (#2702)
This commit is contained in:
@@ -79,7 +79,7 @@ class Receiving_lib
|
||||
{
|
||||
if(!$this->CI->session->userdata('recv_stock_source'))
|
||||
{
|
||||
$this->set_stock_source($this->CI->Stock_location->get_default_location_id());
|
||||
$this->set_stock_source($this->CI->Stock_location->get_default_location_id('receivings'));
|
||||
}
|
||||
|
||||
return $this->CI->session->userdata('recv_stock_source');
|
||||
@@ -143,7 +143,7 @@ class Receiving_lib
|
||||
{
|
||||
if(!$this->CI->session->userdata('recv_stock_destination'))
|
||||
{
|
||||
$this->set_stock_destination($this->CI->Stock_location->get_default_location_id());
|
||||
$this->set_stock_destination($this->CI->Stock_location->get_default_location_id('receivings'));
|
||||
}
|
||||
|
||||
return $this->CI->session->userdata('recv_stock_destination');
|
||||
|
||||
@@ -653,7 +653,7 @@ class Sale_lib
|
||||
{
|
||||
if(!$this->CI->session->userdata('sales_location'))
|
||||
{
|
||||
$this->set_sale_location($this->CI->Stock_location->get_default_location_id());
|
||||
$this->set_sale_location($this->CI->Stock_location->get_default_location_id('sales'));
|
||||
}
|
||||
|
||||
return $this->CI->session->userdata('sales_location');
|
||||
|
||||
@@ -71,12 +71,13 @@ class Stock_location extends CI_Model
|
||||
return ($this->db->get()->num_rows() == 1);
|
||||
}
|
||||
|
||||
public function get_default_location_id()
|
||||
public function get_default_location_id($module_id = 'items')
|
||||
{
|
||||
$this->db->from('stock_locations');
|
||||
$this->db->join('permissions AS permissions', 'permissions.location_id = stock_locations.location_id');
|
||||
$this->db->join('grants AS grants', 'grants.permission_id = permissions.permission_id');
|
||||
$this->db->where('person_id', $this->session->userdata('person_id'));
|
||||
$this->db->like('permissions.permission_id', $module_id, 'after');
|
||||
$this->db->where('deleted', 0);
|
||||
$this->db->limit(1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user