Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions bin/codelist_sch_errors
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,25 @@ def is_de_code?(code, filename)
!excluded.include?(code)
end

Dir.glob('lib/sch/compiled/*.sch.xslt').each do |file_path|
# Afegir només els que es volen actualitzar
XSLT_FILES = %w[
lib/sch/compiled/PINT-AUNZ-billing-1-aligned.sch.xslt
lib/sch/compiled/PINT-AUNZ-selfbilling-1-aligned.sch.xslt
lib/sch/compiled/PINT-AUNZ-selfbilling-1-shared.sch.xslt
lib/sch/compiled/PINT-JP-billing-1-aligned.sch.xslt
lib/sch/compiled/PINT-JP-nontaxinvoice-1-aligned.sch.xslt
lib/sch/compiled/PINT-JP-nontaxinvoice-1-shared.sch.xslt
lib/sch/compiled/PINT-JP-selfbilling-1-aligned.sch.xslt
lib/sch/compiled/PINT-JP-selfbilling-1-shared.sch.xslt
lib/sch/compiled/PINT-MY-billing-1-aligned.sch.xslt
lib/sch/compiled/PINT-SG-billing-1-aligned.sch.xslt
lib/sch/compiled/CEN-EN16931-UBL.sch.xslt
lib/sch/compiled/PEPPOL-EN16931-UBL-SB.sch.xslt
lib/sch/compiled/PEPPOL-EN16931-UBL.sch.xslt
]

XSLT_FILES.each do |file_path|
next unless File.exist?(file_path)
doc = Nokogiri::XML(File.read(file_path))

templates = doc.xpath('//xsl:stylesheet//xsl:template//xsl:choose//xsl:otherwise//svrl:failed-assert', namespaces)
Expand Down Expand Up @@ -72,8 +90,8 @@ end
file_out.puts "#{prefix}:"
code_files.each do |file, codes|
file_default = (file == 'default')
tabs_code = file_default ? "\t" : "\t\t"
file_out.puts "\t#{file}:" unless file_default
tabs_code = file_default ? " " : " "
file_out.puts " #{file}:" unless file_default
codes.each do |code|
text_key = file_default ? code : "#{file}_#{code}"
file_out.puts "#{tabs_code}#{code}: #{text_codes[text_key]}"
Expand All @@ -83,5 +101,5 @@ end
end

File.open("bin/en.yml", 'a') do |file_out|
file_out.puts "\tB2B-DOC-1: 'Unknown customizationID'"
file_out.puts " B2B-DOC-1: 'Unknown customizationID'"
end