summaryrefslogtreecommitdiff
path: root/LedgerSMB/Customer.pm
diff options
context:
space:
mode:
Diffstat (limited to 'LedgerSMB/Customer.pm')
-rw-r--r--LedgerSMB/Customer.pm33
1 files changed, 33 insertions, 0 deletions
diff --git a/LedgerSMB/Customer.pm b/LedgerSMB/Customer.pm
new file mode 100644
index 00000000..ef25c4a1
--- /dev/null
+++ b/LedgerSMB/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