Skip to content

Commit

Permalink
Fix deletion of Default Container Image Rate
Browse files Browse the repository at this point in the history
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1486658

Fix deletion of Default Container Image Rate in Cloud Intel -> Chargeback
-> Rates so that the Rate can't be deleted and error message is displayed.
  • Loading branch information
Hilda Stastna committed Jan 10, 2018
1 parent 36a0514 commit 6d281ac
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions app/controllers/chargeback_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,25 +205,22 @@ def cb_rates_delete
if !params[:id] # showing a list
rates = find_checked_items
if rates.empty?
render_flash(_("No Chargeback Rate were selected for deletion"), :error)
add_flash(_("No Chargeback Rates were selected for deletion"), :error)
end
else # showing 1 rate, delete it
cb_rate = ChargebackRate.find_by_id(params[:id])
cb_rate = ChargebackRate.find_by(:id => params[:id])
self.x_node = x_node.split('_').first
if cb_rate.nil?
render_flash(_("Chargeback Rate no longer exists"), :error)
add_flash(_("Chargeback Rate no longer exists"), :error)
else
rates.push(params[:id])
self.x_node = "xx-#{cb_rate.rate_type}"
end
end
process_cb_rates(rates, 'destroy') unless rates.empty?
if flash_errors?
javascript_flash
else
cb_rates_list
@right_cell_text = _("%{typ} Chargeback Rate") % {:typ => x_node.split('-').last}
replace_right_cell(:replace_trees => [:cb_rates])
end
process_cb_rates(rates, 'destroy') if rates.present?

cb_rates_list
@right_cell_text = _("%{typ} Chargeback Rates") % {:typ => x_node.split('-').last}
replace_right_cell(:replace_trees => [:cb_rates])
end

# AJAX driven routine to check for changes in ANY field on the form
Expand Down

0 comments on commit 6d281ac

Please sign in to comment.