From 5a1b3f62d0b7babc2443518d88e129cd9faf0711 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Wed, 29 Aug 2007 21:35:46 +0000 Subject: 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 --- LedgerSMB/DBObject/Customer.pm | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 LedgerSMB/DBObject/Customer.pm (limited to 'LedgerSMB/DBObject/Customer.pm') 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 -- cgit v1.2.3