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] 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() + { + + } +} +?>