diff options
-rwxr-xr-x | LedgerSMB/Form.pm | 11 | ||||
-rwxr-xr-x | LedgerSMB/IC.pm | 18 | ||||
-rwxr-xr-x | bin/arapprn.pl | 21 | ||||
-rwxr-xr-x | bin/bp.pl | 3 | ||||
-rwxr-xr-x | bin/cp.pl | 3 | ||||
-rwxr-xr-x | bin/io.pl | 9 | ||||
-rwxr-xr-x | bin/jc.pl | 8 | ||||
-rwxr-xr-x | bin/pos.pl | 3 | ||||
-rwxr-xr-x | bin/rp.pl | 4 |
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}/) { @@ -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})) { @@ -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}); @@ -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/^ //; @@ -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); @@ -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); @@ -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 { |