diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-12-07 18:26:43 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-12-07 18:26:43 +0000 |
commit | a3c7eaeb221da06f96c1bd3c288e62c83b4d7be2 (patch) | |
tree | e56df466dbaa50fd2ddf2b6dd871ec93925b2b1b /LedgerSMB | |
parent | b36b485608b9fc389cd0aeedbd0edc1b92c0c063 (diff) |
Fixes some issues with saving parts. Also is a step towards fixing printing with 3-arg open statements. Printing is not verified yet.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@739 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rwxr-xr-x | LedgerSMB/Form.pm | 11 | ||||
-rwxr-xr-x | LedgerSMB/IC.pm | 18 |
2 files changed, 15 insertions, 14 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); |