summaryrefslogtreecommitdiff
path: root/LedgerSMB/DBObject
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-08-29 21:35:46 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-08-29 21:35:46 +0000
commit5a1b3f62d0b7babc2443518d88e129cd9faf0711 (patch)
treea47f75d552e2e74ac3f81e41895b7625cb25ae3f /LedgerSMB/DBObject
parent1c140610be6a844aad9a3424587955dcde01bce5 (diff)
Correcting a few issues with customers.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1473 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/DBObject')
-rw-r--r--LedgerSMB/DBObject/Customer.pm33
1 files changed, 33 insertions, 0 deletions
diff --git a/LedgerSMB/DBObject/Customer.pm b/LedgerSMB/DBObject/Customer.pm
new file mode 100644
index 00000000..ef25c4a1
--- /dev/null
+++ b/LedgerSMB/DBObject/Customer.pm
@@ -0,0 +1,33 @@
+package LedgerSMB::DBObject::Customer;
+
+use base qw(LedgerSMB);
+use LedgerSMB::DBObject;
+
+sub save_to_db {
+
+ my $self = shift @_;
+
+ my $id;
+ if ($self->{id} >= 1) {
+ $id = $self->{id};
+ }
+ else {
+ $id = $self->next_customer_id();
+ }
+ $id = $self->save($id, $self->{discount}, $self->{tax_included},
+ $self->{creditlimit}, $self->{terms}, $self->{customernumber},
+ $self->{cc}, $self->{bcc}, $self->{business_id}, $self->{language},
+ $self->{pricegroup}, $self->{currency}, $self->{startdate},
+ $self->{enddate}
+ );
+
+ # Undef in the created field causes the system to use now() as the current
+ # creation date.
+ $self->location_save(
+ $id, 1, $self->{line_one}, $self->{line_two}, $self->{line_three},
+ $self->{city_province}, $self->{mailing_code}, $self->{country}, undef
+
+ );
+ return $id;
+}
+1; \ No newline at end of file