[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [739] branches/1.2
- Subject: SF.net SVN: ledger-smb: [739] branches/1.2
- From: ..hidden..
- Date: Thu, 07 Dec 2006 10:26:43 -0800
Revision: 739
http://svn.sourceforge.net/ledger-smb/?rev=739&view=rev
Author: einhverfr
Date: 2006-12-07 10:26:43 -0800 (Thu, 07 Dec 2006)
Log Message:
-----------
Fixes some issues with saving parts. Also is a step towards fixing printing with 3-arg open statements. Printing is not verified yet.
Modified Paths:
--------------
branches/1.2/LedgerSMB/Form.pm
branches/1.2/LedgerSMB/IC.pm
branches/1.2/bin/arapprn.pl
branches/1.2/bin/bp.pl
branches/1.2/bin/cp.pl
branches/1.2/bin/io.pl
branches/1.2/bin/jc.pl
branches/1.2/bin/pos.pl
branches/1.2/bin/rp.pl
Modified: branches/1.2/LedgerSMB/Form.pm
===================================================================
--- branches/1.2/LedgerSMB/Form.pm 2006-12-07 16:07:09 UTC (rev 738)
+++ branches/1.2/LedgerSMB/Form.pm 2006-12-07 18:26:43 UTC (rev 739)
@@ -605,13 +605,16 @@
$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 @@
} else {
- $self->{OUT} = $out;
+ $self->{OUT} = $temphash{out};
unless (open(IN, '<', $self->{tmpfile})) {
$err = $!;
@@ -942,7 +945,7 @@
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");
Modified: branches/1.2/LedgerSMB/IC.pm
===================================================================
--- branches/1.2/LedgerSMB/IC.pm 2006-12-07 16:07:09 UTC (rev 738)
+++ branches/1.2/LedgerSMB/IC.pm 2006-12-07 18:26:43 UTC (rev 739)
@@ -611,24 +611,22 @@
}
$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);
Modified: branches/1.2/bin/arapprn.pl
===================================================================
--- branches/1.2/bin/arapprn.pl 2006-12-07 16:07:09 UTC (rev 738)
+++ branches/1.2/bin/arapprn.pl 2006-12-07 18:26:43 UTC (rev 739)
@@ -115,9 +115,10 @@
}
$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 @@
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 @@
%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 @@
}
$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 @@
}
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}/) {
Modified: branches/1.2/bin/bp.pl
===================================================================
--- branches/1.2/bin/bp.pl 2006-12-07 16:07:09 UTC (rev 738)
+++ branches/1.2/bin/bp.pl 2006-12-07 18:26:43 UTC (rev 739)
@@ -271,7 +271,8 @@
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})) {
Modified: branches/1.2/bin/cp.pl
===================================================================
--- branches/1.2/bin/cp.pl 2006-12-07 16:07:09 UTC (rev 738)
+++ branches/1.2/bin/cp.pl 2006-12-07 18:26:43 UTC (rev 739)
@@ -1279,7 +1279,8 @@
$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});
Modified: branches/1.2/bin/io.pl
===================================================================
--- branches/1.2/bin/io.pl 2006-12-07 16:07:09 UTC (rev 738)
+++ branches/1.2/bin/io.pl 2006-12-07 18:26:43 UTC (rev 739)
@@ -1427,8 +1427,8 @@
$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 @@
$form->{plainpaper} = 1;
$form->{OUT} = "${LedgerSMB::Sysconfig::sendmail}";
+ $form->{printmode} = '|-';
if ($form->{emailed} !~ /$form->{formname}/) {
$form->{emailed} .= " $form->{formname}";
@@ -1513,8 +1514,10 @@
}
$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/^ //;
Modified: branches/1.2/bin/jc.pl
===================================================================
--- branches/1.2/bin/jc.pl 2006-12-07 16:07:09 UTC (rev 738)
+++ branches/1.2/bin/jc.pl 2006-12-07 18:26:43 UTC (rev 739)
@@ -1859,8 +1859,9 @@
}
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 @@
}
$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);
Modified: branches/1.2/bin/pos.pl
===================================================================
--- branches/1.2/bin/pos.pl 2006-12-07 16:07:09 UTC (rev 738)
+++ branches/1.2/bin/pos.pl 2006-12-07 18:26:43 UTC (rev 739)
@@ -863,7 +863,8 @@
}
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);
Modified: branches/1.2/bin/rp.pl
===================================================================
--- branches/1.2/bin/rp.pl 2006-12-07 16:07:09 UTC (rev 738)
+++ branches/1.2/bin/rp.pl 2006-12-07 18:26:43 UTC (rev 739)
@@ -1892,6 +1892,7 @@
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 @@
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 {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.