From 991830817ec9b65879985db3dfe7cf66e28ee73c Mon Sep 17 00:00:00 2001 From: objecttothis <17935339+objecttothis@users.noreply.github.com> Date: Fri, 12 Jul 2019 15:05:14 +0400 Subject: [PATCH 1/2] Create 20190712150200_fix_empty_reports.php This corrects an error in a previous migration (2.3_to_2.3.1.sql) that assigned a null value to receivings_stock and sales_stock for the location_id when it should have been the location_id of that particular stock_location. --- .../20190712150200_fix_empty_reports.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 application/migrations/20190712150200_fix_empty_reports.php diff --git a/application/migrations/20190712150200_fix_empty_reports.php b/application/migrations/20190712150200_fix_empty_reports.php new file mode 100644 index 000000000..ed067329c --- /dev/null +++ b/application/migrations/20190712150200_fix_empty_reports.php @@ -0,0 +1,30 @@ +db->select('location_name'); + $this->db->from('stock_locations'); + $this->db->where('location_id', 1); + $this->db->limit(1); + $location_name = $this->db->get()->result_array()[0]['location_name']; + + $location_name = str_replace(' ', '_', $location_name); + $this->db->set('location_id',1); + $this->db->where('permission_id','receivings_' . $location_name); + $this->db->or_where('permission_id', 'sales_' . $location_name); + $this->db->update('permissions'); + } + + public function down() + { + + } +} +?> From f235cede080b6e6841b5254d450abd2fbf8514a1 Mon Sep 17 00:00:00 2001 From: objecttothis <17935339+objecttothis@users.noreply.github.com> Date: Fri, 12 Jul 2019 15:16:21 +0400 Subject: [PATCH 2/2] Update date_input.php Corrected this from 1 to 2. 'All' is counted in the array which means that if there is only one stock location, this dropdown will still appear. Setting this to 2 means that the dropdown only shows when there is more than 1 stock location. --- application/views/reports/date_input.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/views/reports/date_input.php b/application/views/reports/date_input.php index 979375bb7..75219aaa4 100644 --- a/application/views/reports/date_input.php +++ b/application/views/reports/date_input.php @@ -70,7 +70,7 @@ if(isset($error)) ?> 1) + if (!empty($stock_locations) && count($stock_locations) > 2) { ?>