lib/pack_material/repositories/replenish_repo.rb
# Given a scanned or entered value and the scan_field
# value from a form, return the valid location_id or nil.
#
# @param value [string,integer] the scanned or entered value
# @param scan_field [string] the type of scan (blank if the value was typed in)
# @return [intger,nil] the location_id or nil if input was invalid or not found
Given a scanned or entered value and the scan_field
value from a form, return the valid location_id or nil.
Given a scanned or entered value and the scan_field value from a form return the valid location_id or nil .
def resolve_location_id_from_scan(value, scan_field)
      not_found = nil
      if ['', 'location_short_code'].include?(scan_field)
        location_id_from_short_code(value)
      elsif value.is_a?(Numeric) || value =~ /\A\d+\Z/
        get_id(:locations, id: value)
      else
        not_found
      end
    end
def resolve_location_id_from_scan ( value , scan_field ) not_found = nil if [ '' , 'location_short_code' ] . include? ( scan_field ) location_id_from_short_code ( value ) elsif value . is_a? ( Numeric ) || value =~ / \A \d + \Z / get_id ( :locations , id : value ) else not_found end end
Given a scanned or entered value and the scan_field
value from a form, return the valid location_id or nil.
Given a scanned or entered value and the scan_field value from a form return the valid location_id or nil .
the location_id or nil if input was invalid or not found
the location_id or nil if input was invalid or not found
intger,nil
value
the scanned or entered value
the scanned or entered value
scan_field
the type of scan (blank if the value was typed in)
the type of scan ( blank if the value was typed in )