[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [163] trunk/LedgerSMB/OE.pm
- Subject: SF.net SVN: ledger-smb: [163] trunk/LedgerSMB/OE.pm
- From: ..hidden..
- Date: Thu, 28 Sep 2006 08:35:09 -0700
Revision: 163
http://svn.sourceforge.net/ledger-smb/?rev=163&view=rev
Author: einhverfr
Date: 2006-09-28 08:35:08 -0700 (Thu, 28 Sep 2006)
Log Message:
-----------
Moving loading of Perl Module CP to top of function.
Modified Paths:
--------------
trunk/LedgerSMB/OE.pm
Modified: trunk/LedgerSMB/OE.pm
===================================================================
--- trunk/LedgerSMB/OE.pm 2006-09-28 04:31:54 UTC (rev 162)
+++ trunk/LedgerSMB/OE.pm 2006-09-28 15:35:08 UTC (rev 163)
@@ -247,7 +247,7 @@
$form->db_prepare_vars("quonumber", "transdate", "vendor_id",
"customer_id", "reqdate", "taxincluded", "shippingpoint",
- "shipvia", "currency", "closed", "department_id",
+ "shipvia", "currency", "department_id",
"employee_id", "language_code", "ponumber", "terms");
# connect to database, turn off autocommit
my $dbh = $form->{dbh};
@@ -309,13 +309,18 @@
$sth->execute($form->{id}) || $form->dberror($query);
} else { # id is not in the database
- $form->{id} = undef;
+ delete $form->{id};
}
}
my $did_insert = 0;
if (! $form->{id}) {
+ $query = qq|SELECT nextval('id')|;
+ $sth = $dbh->prepare($query);
+ $sth->execute || $form->dberror($query);
+ ($form->{id}) = $sth->fetchrow_array;
+ $sth->finish;
my $uid = localtime;
$uid .= "$$";
@@ -325,16 +330,20 @@
if (!$form->{transdate}){
$form->{transdate} = "now";
}
-
+
+ if (($form->{closed} ne 't') and ($form->{closed} ne "1")){
+ $form->{closed} = 'f';
+ }
+ # $form->{id} is safe because it is only pulled *from* the db.
$query = qq|
INSERT INTO oe
- (ordnumber, quonumber, transdate, vendor_id,
+ (id, ordnumber, quonumber, transdate, vendor_id,
customer_id, reqdate, shippingpoint, shipvia,
notes, intnotes, curr, closed, department_id,
employee_id, language_code, ponumber, terms,
quotation)
VALUES
- (?, ?, ?, ?,
+ ($form->{id}, ?, ?, ?, ?,
?, ?, ?, ?,
?, ?, ?, ?, ?,
?, ?, ?, ?, ?)|;
@@ -351,11 +360,6 @@
$sth->execute(@queryargs) || $form->dberror($query);
$sth->finish;
- $query = qq|SELECT currval('id')|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
- ($form->{id}) = $sth->fetchrow_array;
- $sth->finish;
@queries = $form->get_custom_queries('oe', 'INSERT');
for (@queries){
@@ -1194,6 +1198,7 @@
sub order_details {
+ use LedgerSMB::CP;
my ($self, $myconfig, $form) = @_;
# connect to database
@@ -1774,7 +1779,6 @@
? $form->{ordtotal}
: $form->{ordtotal} + $tax;
- use LedgerSMB::CP;
my $c;
if ($form->{language_code} ne "") {
$c = new CP $form->{language_code};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.