Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't use id from params going from relationship table screen
Browse files Browse the repository at this point in the history
'params[:id]' is providers id
romanblanco committed Oct 18, 2018
1 parent c42829b commit f2b0c18
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/controllers/application_controller/buttons.rb
Original file line number Diff line number Diff line change
@@ -296,8 +296,15 @@ def custom_buttons(ids = nil, display_options = {})
button = CustomButton.find(params[:button_id])
cls = custom_button_class_model(button.applies_to_class)
@explorer = true if BASE_MODEL_EXPLORER_CLASSES.include?(cls)
ids ||= params[:id]
if ids.to_s == 'LIST'
ids ||= params[:id] unless relationship_table_screen? && @record.nil?
ids ||= find_checked_items

if ids.empty?
render_flash(_("Error executing custom button: No item was selected."), :error)
return
end

if ids.to_s == 'LIST' || ids.any?
objs = Rbac.filtered(cls.where(:id => find_checked_items))
obj = objs.first
else

0 comments on commit f2b0c18

Please sign in to comment.