app/controllers/report_controller/widgets.rb
# Validate widget entries before updating record
Validate widget entries before updating record
Validate widget entries before updating record
def widget_validate_entries
    if ["r", "c"].include?(@sb[:wtype]) && (!@edit[:new][:repfilter] || @edit[:new][:repfilter] == "")
      add_flash(_("A Report must be selected"), :error)
    end
    if %w(role group).include? @edit[:new][:visibility_typ]
      typ = @edit[:new][:visibility_typ]
      if @edit[:new][typ.pluralize.to_sym].blank?
        add_flash(_("A %{type} must be selected") % {:type => typ.titleize}, :error)
      end
    end
    if @sb[:wtype] == "r" && @edit[:new][:pivotby1] == "<<< Nothing >>>"
      add_flash(_("At least one Column must be selected"), :error)
    end
    if @sb[:wtype] == "m"
      if @edit[:new][:shortcuts].empty?
        add_flash(_("At least one Shortcut must be selected"), :error)
      else
        @edit[:new][:shortcuts].each do |s|
          if s.last.blank?
            add_flash(_("Shortcut description is required"), :error)
          end
        end
      end
    end
    @flash_array.nil?
  end
def widget_validate_entries if [ "r" , "c" ] . include? ( @sb [ :wtype ] ) && ( ! @edit [ :new ] [ :repfilter ] || @edit [ :new ] [ :repfilter ] == "" ) add_flash ( _ ( "A Report must be selected" ) , :error ) end if %w( role group ) . include? @edit [ :new ] [ :visibility_typ ] typ = @edit [ :new ] [ :visibility_typ ] if @edit [ :new ] [ typ . pluralize . to_sym ] . blank? add_flash ( _ ( "A %{type} must be selected" ) % { :type => typ . titleize } , :error ) end end if @sb [ :wtype ] == "r" && @edit [ :new ] [ :pivotby1 ] == "<<< Nothing >>>" add_flash ( _ ( "At least one Column must be selected" ) , :error ) end if @sb [ :wtype ] == "m" if @edit [ :new ] [ :shortcuts ] . empty? add_flash ( _ ( "At least one Shortcut must be selected" ) , :error ) else @edit [ :new ] [ :shortcuts ] . each do | s | if s . last . blank? add_flash ( _ ( "Shortcut description is required" ) , :error ) end end end end @flash_array . nil? end
Validate widget entries before updating record
Validate widget entries before updating record