[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2499] trunk/LedgerSMB
- Subject: SF.net SVN: ledger-smb:[2499] trunk/LedgerSMB
- From: ..hidden..
- Date: Sat, 14 Mar 2009 22:16:12 +0000
Revision: 2499
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2499&view=rev
Author: einhverfr
Date: 2009-03-14 22:16:12 +0000 (Sat, 14 Mar 2009)
Log Message:
-----------
Order entry/shipto fixes in place
Modified Paths:
--------------
trunk/LedgerSMB/Form.pm
trunk/LedgerSMB/OE.pm
Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm 2009-03-14 21:52:39 UTC (rev 2498)
+++ trunk/LedgerSMB/Form.pm 2009-03-14 22:16:12 UTC (rev 2499)
@@ -1581,44 +1581,31 @@
=cut
sub add_shipto {
- my ( $self, $dbh, $id ) = @_;
-
- my $shipto;
-
- foreach my $item (
- qw(name address1 address2 city state
- zipcode country contact phone fax email)
- )
- {
-
- if ( $self->{"shipto$item"} ne "" ) {
- $shipto = 1 if ( $self->{$item} ne $self->{"shipto$item"} );
- }
- }
-
- if ($shipto) {
- my $query = qq|
- INSERT INTO shipto
- (trans_id, shiptoname, shiptoaddress1,
- shiptoaddress2, shiptocity, shiptostate,
- shiptozipcode, shiptocountry, shiptocontact,
- shiptophone, shiptofax, shiptoemail)
- VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+
+ my ( $self,$dbh,$id ) = @_;
+ my $query = qq|
+ INSERT INTO new_shipto
+ (trans_id, oe_id,location_id)
+ VALUES ( ?, ?, ?)
|;
my $sth = $self->{dbh}->prepare($query) || $self->dberror($query);
+
$sth->execute(
- $id, $self->{shiptoname},
- $self->{shiptoaddress1}, $self->{shiptoaddress2},
- $self->{shiptocity}, $self->{shiptostate},
- $self->{shiptozipcode}, $self->{shiptocountry},
- $self->{shiptocontact}, $self->{shiptophone},
- $self->{shiptofax}, $self->{shiptoemail}
- ) || $self->dberror($query);
- $sth->finish;
- }
+ undef,
+ $self->{id},
+ $self->{locationid}
+
+ ) || $self->dberror($query);
+
+ $sth->finish;
+ $dbh->commit;
+
+
+
}
+
=item $form->get_employee($dbh);
Returns a list containing the name and id of the employee $form->{login}. Any
Modified: trunk/LedgerSMB/OE.pm
===================================================================
--- trunk/LedgerSMB/OE.pm 2009-03-14 21:52:39 UTC (rev 2498)
+++ trunk/LedgerSMB/OE.pm 2009-03-14 22:16:12 UTC (rev 2499)
@@ -250,8 +250,10 @@
}
sub save {
+
+
my ( $self, $myconfig, $form ) = @_;
-
+
$form->db_prepare_vars(
"quonumber", "transdate", "vendor_id", "entity_id",
"reqdate", "taxincluded", "shippingpoint", "shipvia",
@@ -329,7 +331,7 @@
}
}
-
+ $dbh->commit;
my $did_insert = 0;
if ( !$form->{id} ) {
$query = qq|SELECT nextval('id')|;
@@ -509,10 +511,11 @@
$project_id, $form->{"ship_$i"},
$form->{"serialnumber_$i"}, $form->{"notes_$i"} );
$sth->execute(@queryargs) || $form->dberror($query);
-
+ $dbh->commit;
$form->{"sellprice_$i"} = $fxsellprice;
}
$form->{"discount_$i"} *= 100;
+
}
# set values which could be empty
@@ -543,7 +546,9 @@
: $form->parse_amount( $myconfig, $form->{exchangerate} );
( $null, $form->{department_id} ) = split( /--/, $form->{department} );
+
for (qw(department_id terms)) { $form->{$_} *= 1 }
+
if ($did_insert) {
$query = qq|
UPDATE oe SET
@@ -551,7 +556,7 @@
netamount = ?,
taxincluded = ?
WHERE id = ?|;
- @queryargs = ( $amount, $netamount, $form->{taxincluded}, $form->{id} );
+ @queryargs = ( $amount, $netamount, $form->{taxincluded}, $form->{id} );
}
else {
@@ -597,20 +602,24 @@
);
}
$sth = $dbh->prepare($query);
- $sth->execute(@queryargs) || $form->dberror($query);
+ #$sth->execute(@queryargs) || $form->error($query);
+
if ( !$did_insert ) {
@queries = $form->run_custom_queries( 'oe', 'UPDATE' );
}
+
$form->{ordtotal} = $amount;
# add shipto
$form->{name} = $form->{ $form->{vc} };
$form->{name} =~ s/--$form->{"$form->{vc}_id"}//;
- $form->add_shipto( $dbh, $form->{id} );
+ $form->add_shipto( $dbh, $form->{id});
+
# save printed, emailed, queued
+
$form->save_status($dbh);
if ( ( $form->{currency} ne $form->{defaultcurrency} ) && !$exchangerate ) {
@@ -641,7 +650,7 @@
id => $form->{id}
);
- $form->audittrail( $dbh, "", \%audittrail );
+ # $form->audittrail( $dbh, "", \%audittrail );
$form->save_recurring( $dbh, $myconfig );
@@ -2630,5 +2639,6 @@
}
+
1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.