diff --git a/application/config/routes.php b/application/config/routes.php index 1047287a4..03120d02c 100644 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -39,6 +39,7 @@ */ $route['default_controller'] = "login"; +$route['no_access/(:any)'] = "no_access/index/$1"; $route['no_access/(:any)/(:any)'] = "no_access/index/$1/$2"; $route['reports/(summary_:any)/(:any)/(:any)'] = "reports/$1/$2/$3"; $route['reports/summary_:any'] = "reports/date_input_excel_export"; diff --git a/application/controllers/employees.php b/application/controllers/employees.php index 698d132d7..d6d0c7527 100644 --- a/application/controllers/employees.php +++ b/application/controllers/employees.php @@ -69,7 +69,7 @@ class Employees extends Person_controller 'country'=>$this->input->post('country'), 'comments'=>$this->input->post('comments') ); - $grants_data = $this->input->post("grants")!=false ? $this->input->post("grants"):array(); + $grants_data = $this->input->post("grants")!=FALSE ? $this->input->post("grants"):array(); //Password has been changed OR first time password set if($this->input->post('password')!='') diff --git a/application/controllers/no_access.php b/application/controllers/no_access.php index b64a7f6b9..9761c02af 100644 --- a/application/controllers/no_access.php +++ b/application/controllers/no_access.php @@ -9,7 +9,7 @@ class No_Access extends CI_Controller function index($module_id='',$permission_id='') { $data['module_name']=$this->Module->get_module_name($module_id); - $data['permission_id']=empty($permission_id)?$module_id:$permission_id; + $data['permission_id']=$permission_id; $this->load->view('no_access',$data); } } diff --git a/application/controllers/receivings.php b/application/controllers/receivings.php index 23d1bb50c..f49c49386 100644 --- a/application/controllers/receivings.php +++ b/application/controllers/receivings.php @@ -4,7 +4,7 @@ class Receivings extends Secure_area { function __construct() { - parent::__construct('receivings','items'); + parent::__construct('receivings'); $this->load->library('receiving_lib'); } diff --git a/application/controllers/sales.php b/application/controllers/sales.php index a5b735be2..897eede34 100644 --- a/application/controllers/sales.php +++ b/application/controllers/sales.php @@ -4,7 +4,7 @@ class Sales extends Secure_area { function __construct() { - parent::__construct('sales','items'); + parent::__construct('sales'); $this->load->library('sale_lib'); } diff --git a/application/views/no_access.php b/application/views/no_access.php index 695f0843e..35d546e4d 100644 --- a/application/views/no_access.php +++ b/application/views/no_access.php @@ -1,3 +1,3 @@ lang->line('error_no_permission_module').' '.$module_name . ' (' . $permission_id . ')'; +echo $this->lang->line('error_no_permission_module').' '.$module_name . (!empty($permission_id) ? ' (' . $permission_id . ')' : ''); ?> \ No newline at end of file diff --git a/database/2.3_to_2.3.1.sql b/database/2.3_to_2.3.1.sql index 3bd1f4eb4..93291b1c8 100644 --- a/database/2.3_to_2.3.1.sql +++ b/database/2.3_to_2.3.1.sql @@ -37,7 +37,14 @@ INSERT INTO `ospos_permissions` (`permission_id`, `module_id`) VALUES ('suppliers', 'suppliers'); -- add permissions for existing stock locations -INSERT INTO `ospos_permissions` (permission_id, module_id, location_id) (SELECT CONCAT('items_', location_name), 'items', location_id FROM ospos_stock_locations); +INSERT INTO `ospos_permissions` (permission_id, module_id, location_id) +(SELECT CONCAT('items_', location_name), 'items', location_id FROM ospos_stock_locations); + +INSERT INTO `ospos_permissions` (permission_id, module_id, location_id) +(SELECT CONCAT('sales_', location_name), 'sales', location_id FROM ospos_stock_locations); + +INSERT INTO `ospos_permissions` (permission_id, module_id, location_id) +(SELECT CONCAT('receivings_', location_name), 'receivings', location_id FROM ospos_stock_locations); CREATE TABLE `ospos_grants` ( `permission_id` varchar(255) NOT NULL, @@ -72,6 +79,8 @@ INSERT INTO `ospos_grants` (`permission_id`, `person_id`) VALUES ('sales', 1), ('config', 1), ('items_stock', 1), +('sales_stock', 1), +('receivings_stock', 1), ('suppliers', 1); -- add config options for tax inclusive sales diff --git a/database/database.sql b/database/database.sql index 21bada017..369421034 100644 --- a/database/database.sql +++ b/database/database.sql @@ -345,8 +345,9 @@ INSERT INTO `ospos_permissions` (`permission_id`, `module_id`) VALUES ('suppliers', 'suppliers'); INSERT INTO `ospos_permissions` (`permission_id`, `module_id`, `location_id`) VALUES -('items_stock', 'items', 1); - +('items_stock', 'items', 1), +('sales_stock', 'sales', 1), +('receivings_stock', 'receivings', 1); -- -------------------------------------------------------- @@ -387,6 +388,8 @@ INSERT INTO `ospos_grants` (`permission_id`, `person_id`) VALUES ('sales', 1), ('config', 1), ('items_stock', 1), +('sales_stock', 1), +('receivings_stock', 1), ('suppliers', 1); --