summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LedgerSMB/DBObject/Payment.pm1
-rw-r--r--LedgerSMB/Sysconfig.pm5
-rwxr-xr-xLedgerSMB/Template.pm4
-rw-r--r--scripts/payment.pl16
-rw-r--r--t/04-template-handling.t14
5 files changed, 25 insertions, 15 deletions
diff --git a/LedgerSMB/DBObject/Payment.pm b/LedgerSMB/DBObject/Payment.pm
index 0efefacb..b148165e 100644
--- a/LedgerSMB/DBObject/Payment.pm
+++ b/LedgerSMB/DBObject/Payment.pm
@@ -64,7 +64,6 @@ sub __validate__ {
sub text_amount {
use LedgerSMB::Num2text;
- print STDERR "num2text\n";
my ($self, $value) = @_;
$self->{locale} = $self->{_locale};
$self->init();
diff --git a/LedgerSMB/Sysconfig.pm b/LedgerSMB/Sysconfig.pm
index b2fc1a93..f76482e6 100644
--- a/LedgerSMB/Sysconfig.pm
+++ b/LedgerSMB/Sysconfig.pm
@@ -81,10 +81,7 @@ $gzip = "gzip -S .gz";
$localepath = 'locale/po';
# available printers
-%printer = (
- Laser => 'lpr -Plaser',
- Epson => 'lpr -PEpson',
-);
+%printer;
my %config;
read_config( 'ledgersmb.conf' => %config ) or die;
diff --git a/LedgerSMB/Template.pm b/LedgerSMB/Template.pm
index e66bcfd9..59fc4d01 100755
--- a/LedgerSMB/Template.pm
+++ b/LedgerSMB/Template.pm
@@ -290,7 +290,7 @@ sub output {
$self->_email_output;
} elsif ('print' eq lc $method) {
$self->_lpr_output;
- } elsif (defined $self->{output} or $method = 'Screen') {
+ } elsif (defined $self->{output} or lc $method eq 'screen') {
$self->_http_output;
exit;
} elsif (defined $method) {
@@ -401,7 +401,7 @@ sub _lpr_output {
}
my $lpr = $LedgerSMB::Sysconfig::printer{$args->{media}};
- open(LPR, '|-', $lpr);
+ open (LPR, '|-', $lpr);
# Output is not defined here. In the future we should consider
# changing this to use the system command and hit the file as an arg.
diff --git a/scripts/payment.pl b/scripts/payment.pl
index 9061eea7..a081c5e8 100644
--- a/scripts/payment.pl
+++ b/scripts/payment.pl
@@ -282,7 +282,6 @@ sub print {
if ($payment->{multiple}){
$payment->{checks} = [];
- print "Multiple checks printing";
for my $line (1 .. $payment->{contact_count}){
my $id = $payment->{"contact_$line"};
next if !defined $payment->{"id_$id"};
@@ -337,14 +336,15 @@ sub print {
no_auto_output => 1,
output_args => $payment,
);
- try {
+ #try {
$template->render($payment);
$template->output(%$payment);
- }
- catch Error::Simple with {
- my $E = shift;
- $payment->error( $E->stacktrace );
- };
+ #}
+ #catch Error::Simple with {
+ # my $E = shift;
+ # $payment->error( $E->stacktrace );
+ #};
+ display_payments(@_);
} else {
@@ -402,7 +402,7 @@ sub display_payments {
for (keys %LedgerSMB::Sysconfig::printer){
push @{$payment->{media_options}},
{text => $_,
- value => $LedgerSMB::Sysconfig::printer{$_}};
+ value => $_};
}
if ($LedgerSMB::Sysconfig::latex){
@{$payment->{format_options}} = (
diff --git a/t/04-template-handling.t b/t/04-template-handling.t
index 704969c6..7043f53f 100644
--- a/t/04-template-handling.t
+++ b/t/04-template-handling.t
@@ -421,6 +421,20 @@ is(grep (/value="1" selected/, @output), 0, 'Select box Value 1 unselected');
is(grep (/value="1000" selected/, @output), 1, 'Select box Value 1000 selected');
is(grep (/<td class="description">dtest1/, @output), 1, 'Contact description shows');
+# LPR PRinting Tests
+use LedgerSMB::Sysconfig;
+%LedgerSMB::Sysconfig::printer = ('test' => 'cat > t/var/04-lpr-test');
+
+$template = new LedgerSMB::Template('user' => $myconfig, 'format' => 'PDF',
+ 'template' => '04-template', 'locale' => $locale, no_auto_output => 1);
+$template->render({media => 'test'});
+$template->output(media => 'test');
+
+ok (open (LPR_TEST, '<', 't/var/04-lpr-test'), 'LedgerSMB::Template::_output_lpr output file opened successfully');
+
+my $line1 = <LPR_TEST>;
+
+like($line1, qr/^%PDF/, 'output file is pdf');
# Functions
sub get_output_line_array {