summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xLedgerSMB/Form.pm11
-rwxr-xr-xLedgerSMB/IC.pm18
-rwxr-xr-xbin/arapprn.pl21
-rwxr-xr-xbin/bp.pl3
-rwxr-xr-xbin/cp.pl3
-rwxr-xr-xbin/io.pl9
-rwxr-xr-xbin/jc.pl8
-rwxr-xr-xbin/pos.pl3
-rwxr-xr-xbin/rp.pl4
9 files changed, 47 insertions, 33 deletions
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index 14a3ff97..860a9e97 100755
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -605,13 +605,16 @@ sub parse_template {
$tmpfile =~ s/\./_$self->{fileid}./ if $self->{fileid};
$self->{tmpfile} = "${LedgerSMB::Sysconfig::userspath}/${fileid}_${tmpfile}";
+ my $temphash;
if ($self->{format} =~ /(postscript|pdf)/ || $self->{media} eq 'email') {
- my $out = $self->{OUT};
+ $temphash{out} = $self->{OUT};
$self->{OUT} = "$self->{tmpfile}";
+ $temphash{printmode} = $self->{printmode};
+ $self->{printmode} = '>';
}
if ($self->{OUT}) {
- open(OUT, '>', "$self->{OUT}") or $self->error("$self->{OUT} : $!");
+ open(OUT, $self->{printmode}, "$self->{OUT}") or $self->error("$self->{OUT} : $!");
} else {
open(OUT, ">-") or $self->error("STDOUT : $!");
@@ -925,7 +928,7 @@ sub parse_template {
} else {
- $self->{OUT} = $out;
+ $self->{OUT} = $temphash{out};
unless (open(IN, '<', $self->{tmpfile})) {
$err = $!;
@@ -942,7 +945,7 @@ sub parse_template {
for my $i (1 .. $self->{copies}) {
if ($self->{OUT}) {
- unless (open(OUT, '>', $self->{OUT})) {
+ unless (open(OUT, $self->{printmode}, $self->{OUT})) {
$err = $!;
$self->cleanup;
$self->error("$self->{OUT} : $err");
diff --git a/LedgerSMB/IC.pm b/LedgerSMB/IC.pm
index feb7dd7a..6bcfdd80 100755
--- a/LedgerSMB/IC.pm
+++ b/LedgerSMB/IC.pm
@@ -611,24 +611,22 @@ sub update_assembly {
}
$sth->finish;
$qty = $dbh->quote($qty);
- $formlistprice = $dbh->quote($formlistprice );
- $listprice = $dbh->quote($listprice );
- $formsellprice = $dbh->quote($formsellprice );
- $formlastcost = $dbh->quote($form->{lastcost});
- $lastcost = $dbh->quote($lastcost);
- $weight = $dbh->quote($weight);
+ $formlistprice = $dbh->quote($formlistprice - $listprice);
+ $formsellprice = $dbh->quote($formsellprice - $sellprice);
+ $formlastcost = $dbh->quote($form->{lastcost} - $lastcost);
+ $weight = $dbh->quote($form->{weight} - $weight);
$id = $dbh->quote($id);
$query = qq|
UPDATE parts
SET listprice = listprice +
- $qty * ($formlistprice - $listprice),
+ $qty * cast($formlistprice AS numeric),
sellprice = sellprice +
- $qty * ($formsellprice - $sellprice),
+ $qty * cast($formsellprice AS numeric),
lastcost = lastcost +
- $qty * ($form->{lastcost} - $lastcost),
+ $qty * cast($formlastcost AS numeric),
weight = weight +
- $qty * ($form->{weight} - $weight)
+ $qty * cast($weight AS numeric)
WHERE id = $id|;
$dbh->do($query) || $form->dberror($query);
diff --git a/bin/arapprn.pl b/bin/arapprn.pl
index 18fd884f..9b2f025a 100755
--- a/bin/arapprn.pl
+++ b/bin/arapprn.pl
@@ -115,9 +115,10 @@ sub print {
}
$filename .= ($form->{format} eq 'postscript') ? '.ps' : '.pdf';
- $form->{OUT} = ">${LedgerSMB::Sysconfig::spool}/$filename" if
- $form->{media} ne 'screen';
-
+ if ($form->{media} ne 'screen'){
+ $form->{OUT} = "${LedgerSMB::Sysconfig::spool}/$filename";
+ $form->{printmode} = '>';
+ }
$form->{queued} .= " $form->{formname} $filename";
$form->{queued} =~ s/^ //;
$printform = new Form;
@@ -216,8 +217,8 @@ sub print_check {
id => $form->{id} );
$form->{audittrail} .= $form->audittrail("", \%myconfig, \%audittrail);
- $form->{OUT} = ">${LedgerSMB::Sysconfig::spool}/$filename";
-
+ $form->{OUT} = "${LedgerSMB::Sysconfig::spool}/$filename";
+ $form->{printmode} = '>';
$form->{queued} .= " $form->{formname} $filename";
$form->{queued} =~ s/^ //;
}
@@ -227,8 +228,8 @@ sub print_check {
%queued = split / /, $form->{queued};
- $form->{OUT} = "| ${LedgerSMB::Sysconfig::printer}{$form->{media}}";
-
+ $form->{OUT} = "${LedgerSMB::Sysconfig::printer}{$form->{media}}";
+ $form->{printmode} = '|-';
if ($form->{printed} !~ /$form->{formname}/) {
$form->{printed} .= " $form->{formname}";
@@ -424,7 +425,8 @@ sub print_transaction {
}
$filename .= ($form->{format} eq 'postscript') ? '.ps' : '.pdf';
- $form->{OUT} = ">${LedgerSMB::Sysconfig::spool}/$filename";
+ $form->{OUT} = "${LedgerSMB::Sysconfig::spool}/$filename";
+ $form->{printmode} = '>';
$form->{queued} .= " $form->{formname} $filename";
$form->{queued} =~ s/^ //;
@@ -444,7 +446,8 @@ sub print_transaction {
}
if ($form->{media} !~ /(queue|screen)/) {
- $form->{OUT} = "| ${LedgerSMB::Sysconfig::printer}{$form->{media}}";
+ $form->{OUT} = "${LedgerSMB::Sysconfig::printer}{$form->{media}}";
+ $form->{printmode} = '|-';
if ($form->{printed} !~ /$form->{formname}/) {
diff --git a/bin/bp.pl b/bin/bp.pl
index 0d770bda..80fe951a 100755
--- a/bin/bp.pl
+++ b/bin/bp.pl
@@ -271,7 +271,8 @@ sub print {
for $i (1 .. $form->{rowcount}) {
if ($form->{"checked_$i"}) {
- $form->{OUT} = "| ${LedgerSMB::Sysconfig::printer}{$form->{media}}";
+ $form->{OUT} = "${LedgerSMB::Sysconfig::printer}{$form->{media}}";
+ $form->{printmode} = '|-';
$form->info($locale->text('Printing')." ...");
if (BP->print_spool(\%myconfig, \%$form, ${LedgerSMB::Sysconfig::spool})) {
diff --git a/bin/cp.pl b/bin/cp.pl
index 0e8a4255..c4474e38 100755
--- a/bin/cp.pl
+++ b/bin/cp.pl
@@ -1279,7 +1279,8 @@ sub print_form {
$form->{IN} = "$form->{formname}.tex";
if ($form->{media} ne 'screen') {
- $form->{OUT} = "| ${LedgerSMB::Sysconfig::printer}{$form->{media}}";
+ $form->{OUT} = "${LedgerSMB::Sysconfig::printer}{$form->{media}}";
+ $form->{printmode} = '|-';
}
$form->parse_template(\%myconfig, ${LedgerSMB::Sysconfig::userspath});
diff --git a/bin/io.pl b/bin/io.pl
index ec824540..31e8636c 100755
--- a/bin/io.pl
+++ b/bin/io.pl
@@ -1427,8 +1427,8 @@ sub print_form {
$form->{pre} = "<body bgcolor=#ffffff>\n<pre>" if $form->{format} eq 'txt';
if ($form->{media} !~ /(screen|queue|email)/) {
- $form->{OUT} = "| ${LedgerSMB::SysConfig::printer}{$form->{media}}";
-
+ $form->{OUT} = "${LedgerSMB::SysConfig::printer}{$form->{media}}";
+ $form->{printmode} = '|-';
$form->{OUT} =~ s/<%(fax)%>/<%$form->{vc}$1%>/;
$form->{OUT} =~ s/<%(.*?)%>/$form->{$1}/g;
@@ -1458,6 +1458,7 @@ sub print_form {
$form->{plainpaper} = 1;
$form->{OUT} = "${LedgerSMB::Sysconfig::sendmail}";
+ $form->{printmode} = '|-';
if ($form->{emailed} !~ /$form->{formname}/) {
$form->{emailed} .= " $form->{formname}";
@@ -1513,7 +1514,9 @@ sub print_form {
}
$filename .= ($form->{format} eq 'postscript') ? '.ps' : '.pdf';
- $form->{OUT} = ">${LedgerSMB::Sysconfig::spool}/$filename";
+ $form->{OUT} = "${LedgerSMB::Sysconfig::spool}/$filename";
+ $form->{printmode} = '>';
+
$form->{queued} .= " $form->{formname} $filename";
$form->{queued} =~ s/^ //;
diff --git a/bin/jc.pl b/bin/jc.pl
index 97ccf3db..5066dc41 100755
--- a/bin/jc.pl
+++ b/bin/jc.pl
@@ -1859,8 +1859,9 @@ sub print_timecard {
}
if ($form->{media} !~ /(screen|queue)/) {
- $form->{OUT} = "| ${LedgerSMB::Sysconfig::printer}{$form->{media}}";
-
+ $form->{OUT} = "${LedgerSMB::Sysconfig::printer}{$form->{media}}";
+ $form->{printmode} = '|-';
+
if ($form->{printed} !~ /$form->{formname}/) {
$form->{printed} .= " $form->{formname}";
$form->{printed} =~ s/^ //;
@@ -1894,7 +1895,8 @@ sub print_timecard {
}
$filename .= ($form->{format} eq 'postscript') ? '.ps' : '.pdf';
- $form->{OUT} = ">${LedgerSMB::Sysconfig::spool}/$filename";
+ $form->{OUT} = "${LedgerSMB::Sysconfig::spool}/$filename";
+ $form->{printmode} = '>';
$form->{queued} = "$form->{formname} $filename";
$form->update_status(\%myconfig);
diff --git a/bin/pos.pl b/bin/pos.pl
index 31087cca..7071d5d3 100755
--- a/bin/pos.pl
+++ b/bin/pos.pl
@@ -863,7 +863,8 @@ sub print_form {
}
if ($form->{media} ne 'screen') {
- $form->{OUT} = "| ${LedgerSMB::Sysconfig::printer}{$form->{media}}";
+ $form->{OUT} = "${LedgerSMB::Sysconfig::printer}{$form->{media}}";
+ $form->{printmode} = '|-';
}
$form->{discount} = $form->format_amount(\%myconfig, $form->{discount} * 100);
diff --git a/bin/rp.pl b/bin/rp.pl
index 29c49869..0d5581d8 100755
--- a/bin/rp.pl
+++ b/bin/rp.pl
@@ -1892,6 +1892,7 @@ sub e_mail {
sub send_email {
$form->{OUT} = "${LedgerSMB::Sysconfig::sendmail}";
+ $form->{printmode} = '|-';
$form->{subject} = $locale->text('Statement - [_1]', $form->{todate}) unless $form->{subject};
$form->isblank("email", $locale->text('E-mail address missing!'));
@@ -1926,7 +1927,8 @@ sub print {
if ($form->{media} !~ /(screen|email)/) {
- $form->{OUT} = "| ${LedgerSMB::Sysconfig::printer}{$form->{media}}";
+ $form->{OUT} = "${LedgerSMB::Sysconfig::printer}{$form->{media}}";
+ $form->{printmode} = '|-';
$form->{"$form->{ct}_id"} = "";
$SIG{INT} = 'IGNORE';
} else {