Return no variants when document_number is blank
Otherwise the variants returned for document_type="1" and document_number="" will be `["0", "00", "000", "0000", "00000", "000000", "0000000", "00000000"]` which seems to be useless.
This commit is contained in:
committed by
Javi Martín
parent
93e458d46e
commit
3ed4bdaff8
@@ -1,5 +1,7 @@
|
||||
module DocumentParser
|
||||
def get_document_number_variants(document_type, document_number)
|
||||
return [] if document_number.blank?
|
||||
|
||||
# Delete all non-alphanumerics
|
||||
document_number = document_number.to_s.gsub(/[^0-9A-Za-z]/i, "")
|
||||
variants = []
|
||||
|
||||
Reference in New Issue
Block a user