From 7c24682584c4319898a1e7ee71edcb79d0930f92 Mon Sep 17 00:00:00 2001 From: jekkos-t520 Date: Mon, 2 Feb 2015 16:55:26 +0100 Subject: [PATCH] Fix stock location removal --- application/models/stock_locations.php | 1 - application/views/configs/location_config.php | 10 +++------- application/views/partial/stock_locations.php | 9 ++++++--- css/tabcontent.css | 1 + 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/application/models/stock_locations.php b/application/models/stock_locations.php index 2d3ab0220..c8fb95fd6 100644 --- a/application/models/stock_locations.php +++ b/application/models/stock_locations.php @@ -133,7 +133,6 @@ class Stock_locations extends CI_Model $this->db->where('location_id', $location_id); $this->db->update('stock_locations', array('deleted' => 1)); - // should delete permissions and grants as well? $this->db->where('location_id', $location_id); $this->db->delete('permissions'); $this->db->trans_complete(); diff --git a/application/views/configs/location_config.php b/application/views/configs/location_config.php index 4d7b8b6ec..c9d3211ed 100644 --- a/application/views/configs/location_config.php +++ b/application/views/configs/location_config.php @@ -36,7 +36,7 @@ $(document).ready(function() var hide_show_remove = function() { - if ($("input[name*='stock_location']").length > 1) + if ($("input[name*='stock_location']:enabled").length > 1) { $(".remove_stock_location").show(); } @@ -46,8 +46,6 @@ $(document).ready(function() } }; - hide_show_remove(); - var add_stock_location = function() { var id = $(this).parent().find('input').attr('id'); @@ -72,6 +70,7 @@ $(document).ready(function() { $('.add_stock_location').click(add_stock_location); $('.remove_stock_location').click(remove_stock_location); + hide_show_remove(); }; init_add_remove_locations(); @@ -100,10 +99,7 @@ $(document).ready(function() { set_feedback(response.message,'error_message',true); } - $("#stock_locations").load('', function() { - init_add_remove_locations(); - hide_show_remove(); - }); + $("#stock_locations").load('', init_add_remove_locations); }, dataType:'json' }); diff --git a/application/views/partial/stock_locations.php b/application/views/partial/stock_locations.php index f00afcfb0..422711df6 100644 --- a/application/views/partial/stock_locations.php +++ b/application/views/partial/stock_locations.php @@ -2,14 +2,17 @@ $location_data ) { ?> -