$main::lxdebug->enter_sub(2);
my ($self, $myconfig, $amount, $places, $dash) = @_;
+ $dash ||= '';
if ($amount eq "") {
$amount = 0;
$amount *= 1;
$places *= -1;
- my ($actual_places) = ($amount =~ /\.(\d+)/);
- $actual_places = length($actual_places);
- $places = $actual_places > $places ? $actual_places : $places;
+ if ($amount =~ /\.(\d+)/) {
+ my $actual_places = length $1;
+ $places = $actual_places if $actual_places > $places;
+ }
}
}
$amount = $self->round_amount($amount, $places);
$p[0] =~ s/\B(?=(...)*$)/$d[1]/g if $d[1]; # add 1,000 delimiters
$amount = $p[0];
- $amount .= $d[0].$p[1].(0 x ($places - length $p[1])) if ($places || $p[1] ne '');
+ $amount .= $d[0].($p[1]||'').(0 x ($places - length ($p[1]||''))) if ($places || $p[1] ne '');
$amount = do {
($dash =~ /-/) ? ($neg ? "($amount)" : "$amount" ) :
}
my $result;
+ my $command_formatter = sub {
+ my ($out_mode, $out) = @_;
+ return $out_mode eq '|-' ? SL::Template::create(type => 'ShellCommand', form => $self)->parse($out) : $out;
+ };
if ($self->{OUT}) {
+ $self->{OUT} = $command_formatter->($self->{OUT_MODE}, $self->{OUT});
open(OUT, $self->{OUT_MODE}, $self->{OUT}) or $self->error("error on opening $self->{OUT} with mode $self->{OUT_MODE} : $!");
} else {
*OUT = ($::dispatcher->get_standard_filehandles)[1];
#print(STDERR "OUT $self->{OUT}\n");
for my $i (1 .. $self->{copies}) {
if ($self->{OUT}) {
+ $self->{OUT} = $command_formatter->($self->{OUT_MODE}, $self->{OUT});
+
open OUT, $self->{OUT_MODE}, $self->{OUT} or $self->error($self->cleanup . "$self->{OUT} : $!");
print OUT $_ while <IN>;
close OUT;
$formname ||= $self->{formname};
$self->{recipient_locale} ||= Locale->lang_to_locale($self->{language});
- my $recipient_locale = Locale->new($self->{recipient_locale});
+ local $::locale = Locale->new($self->{recipient_locale});
my %formname_translations = (
- bin_list => $recipient_locale->text('Bin List'),
- credit_note => $recipient_locale->text('Credit Note'),
- invoice => $recipient_locale->text('Invoice'),
- pick_list => $recipient_locale->text('Pick List'),
- proforma => $recipient_locale->text('Proforma Invoice'),
- purchase_order => $recipient_locale->text('Purchase Order'),
- request_quotation => $recipient_locale->text('RFQ'),
- sales_order => $recipient_locale->text('Confirmation'),
- sales_quotation => $recipient_locale->text('Quotation'),
- storno_invoice => $recipient_locale->text('Storno Invoice'),
- sales_delivery_order => $recipient_locale->text('Delivery Order'),
- purchase_delivery_order => $recipient_locale->text('Delivery Order'),
- dunning => $recipient_locale->text('Dunning'),
+ bin_list => $main::locale->text('Bin List'),
+ credit_note => $main::locale->text('Credit Note'),
+ invoice => $main::locale->text('Invoice'),
+ pick_list => $main::locale->text('Pick List'),
+ proforma => $main::locale->text('Proforma Invoice'),
+ purchase_order => $main::locale->text('Purchase Order'),
+ request_quotation => $main::locale->text('RFQ'),
+ sales_order => $main::locale->text('Confirmation'),
+ sales_quotation => $main::locale->text('Quotation'),
+ storno_invoice => $main::locale->text('Storno Invoice'),
+ sales_delivery_order => $main::locale->text('Delivery Order'),
+ purchase_delivery_order => $main::locale->text('Delivery Order'),
+ dunning => $main::locale->text('Dunning'),
);
$main::lxdebug->leave_sub();
my ($login) = selectrow_query($self, $dbh, qq|SELECT login FROM employee WHERE id = ?|, conv_i($params{id}));
if ($login) {
- my $user = User->new($login);
+ my $user = User->new(login => $login);
map { $self->{$params{prefix} . "_${_}"} = $user->{$_}; } qw(address businessnumber co_ustid company duns email fax name signature taxnumber tel);
$self->{$params{prefix} . '_login'} = $login;
return scalar(@{ $self->{name_list} });
}
-# the selection sub is used in the AR, AP, IS, IR and OE module
+# the selection sub is used in the AR, AP, IS, IR, DO and OE module
#
sub all_vc {
$main::lxdebug->enter_sub();