diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index 121e4a059..2f11069dd 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -15,7 +15,7 @@ class Home extends Secure_Controller echo view('home/home'); } - public function logout(): void + public function getLogout(): void { $this->employee->logout(); } diff --git a/app/Controllers/Reports.php b/app/Controllers/Reports.php index 7ecbe9164..6b8d935a2 100644 --- a/app/Controllers/Reports.php +++ b/app/Controllers/Reports.php @@ -26,6 +26,7 @@ use App\Models\Reports\Summary_sales_taxes; use App\Models\Reports\Summary_suppliers; use App\Models\Reports\Summary_taxes; use CodeIgniter\HTTP\Uri; +use Config\Services; /** * @property attribute attribute @@ -51,16 +52,14 @@ use CodeIgniter\HTTP\Uri; * @property summary_sales_taxes summary_sales_taxes * @property summary_suppliers summary_suppliers * @property summary_taxes summary_taxes - * @property URI uri */ class Reports extends Secure_Controller { public function __construct() { parent::__construct('reports'); - - $this->uri->setURI(uri_string()); - $method_name = $this->uri->getSegment(2); + $request = Services::request(); + $method_name = $request->getUri()->getSegment(2); $exploder = explode('_', $method_name); if(sizeof($exploder) > 1) @@ -1921,4 +1920,4 @@ class Reports extends Secure_Controller return $subtitle; } -} \ No newline at end of file +} diff --git a/app/Views/partial/header.php b/app/Views/partial/header.php index 0c9d00389..f4266a8ea 100644 --- a/app/Views/partial/header.php +++ b/app/Views/partial/header.php @@ -5,7 +5,9 @@ * @var CodeIgniter\HTTP\IncomingRequest $request */ -$request = \Config\Services::request(); +use Config\Services; + +$request = Services::request(); helper('cookie'); ?> @@ -118,7 +120,7 @@ helper('cookie'); diff --git a/app/Views/reports/listing.php b/app/Views/reports/listing.php index d7ec51493..cdf167f43 100644 --- a/app/Views/reports/listing.php +++ b/app/Views/reports/listing.php @@ -64,21 +64,22 @@ if(isset($error))

 

- session->get('person_id'); - show_report_if_allowed('detailed', 'sales', $person_id); - show_report_if_allowed('detailed', 'receivings', $person_id); - show_report_if_allowed('specific', 'customer', $person_id, 'reports_customers'); - show_report_if_allowed('specific', 'discount', $person_id, 'reports_discounts'); - show_report_if_allowed('specific', 'employee', $person_id, 'reports_employees'); - show_report_if_allowed('specific', 'supplier', $person_id, 'reports_suppliers'); +
has_grant('reports_inventory', $this->session->get('person_id'))) + if ($employee->has_grant('reports_inventory', session('person_id'))) { ?>
diff --git a/app/Views/sales/receipt.php b/app/Views/sales/receipt.php index ed2c2a924..5ca197bc1 100644 --- a/app/Views/sales/receipt.php +++ b/app/Views/sales/receipt.php @@ -50,7 +50,7 @@ if (isset($error_message))  ' . lang('Sales.register'), ['class' => 'btn btn-info btn-sm', 'id' => 'show_sales_button']) ?> has_grant('reports_sales', $this->session->get('person_id'))): ?> + if($employee->has_grant('reports_sales', session('person_id'))): ?>  ' . lang('Sales.takings'), ['class' => 'btn btn-info btn-sm', 'id' => 'show_takings_button']) ?>
diff --git a/app/Views/sales/register.php b/app/Views/sales/register.php index 2a183515a..8378a8a95 100644 --- a/app/Views/sales/register.php +++ b/app/Views/sales/register.php @@ -106,7 +106,7 @@ if(isset($success)) has_grant('reports_sales', $this->session->get('person_id'))) + if($employee->has_grant('reports_sales', session('person_id'))) { ?>