return $value;
},
+ get_li_attr_edi => sub {
+ my $value = get_li_attr(@_);
+ return $_TT_helpers->{escape_edi}->($value);
+ },
+
+
+ # Removes potentially troublesome characters from text for inclusion
+ # in an EDI document.
+ # See also get_li_attr_jedi()
+ escape_edi => sub {
+ my $value = shift;
+ {
+ no warnings 'uninitialized';
+ $value .= ""; # force to string
+ };
+
+ # Typical vendors dealing with EDIFACT (or is the problem with
+ # our EDI translator itself?) would seem not to want
+ # any characters outside the ASCII range, so trash them.
+ $value =~ s/[^[:ascii:]]//g;
+
+ # What the heck, get rid of [ ] too (although I couldn't get them
+ # to cause any problems for me, problems have been reported. See
+ # LP #812593).
+ $value =~ s/[\[\]]//g;
+
+ # The ? character, if in the final position of a string, breaks
+ # the translator. + or ' or : could be problematic, too. And we must
+ # avoid leaving a hanging \.
+ while ($value =~ /[\\\?\+':]$/) {
+ chop $value;
+ }
+
+ return $value;
+ },
+
+
get_queued_bib_attr => sub {
my $name = shift or return; # the first arg is always the name
my ($attr) = @_;
END -%]
LIN+[% li.id %]++[% idval %]:[% idqual %]'
PIA+5+[% idval %]:[% idqual %]'
-IMD+F+BTI+:::[% helpers.get_li_attr_jedi('title', '', li.attributes) %]'
-IMD+F+BPU+:::[% helpers.get_li_attr_jedi('author', '', li.attributes) %]'
-IMD+F+BPD+:::[% helpers.get_li_attr_jedi('pubdate', '', li.attributes) %]'
-IMD+F+BPH+:::[% helpers.get_li_attr_jedi('pagination', '', li.attributes) %]'
+IMD+F+BTI+:::[% helpers.get_li_attr_edi('title', '', li.attributes) %]'
+IMD+F+BPU+:::[% helpers.get_li_attr_edi('author', '', li.attributes) %]'
+IMD+F+BPD+:::[% helpers.get_li_attr_edi('pubdate', '', li.attributes) %]'
+IMD+F+BPH+:::[% helpers.get_li_attr_edi('pagination','', li.attributes) %]'
QTY+21:[% li.lineitem_details.size %]'
FTX+LIN+1'
PRI+AAB:30'