summaryrefslogtreecommitdiff
path: root/LedgerSMB/DBObject/Customer.pm
blob: ef25c4a1a6a0252819ab4a2bca3edd41365ceae4 (plain)
  1. package LedgerSMB::DBObject::Customer;
  2. use base qw(LedgerSMB);
  3. use LedgerSMB::DBObject;
  4. sub save_to_db {
  5. my $self = shift @_;
  6. my $id;
  7. if ($self->{id} >= 1) {
  8. $id = $self->{id};
  9. }
  10. else {
  11. $id = $self->next_customer_id();
  12. }
  13. $id = $self->save($id, $self->{discount}, $self->{tax_included},
  14. $self->{creditlimit}, $self->{terms}, $self->{customernumber},
  15. $self->{cc}, $self->{bcc}, $self->{business_id}, $self->{language},
  16. $self->{pricegroup}, $self->{currency}, $self->{startdate},
  17. $self->{enddate}
  18. );
  19. # Undef in the created field causes the system to use now() as the current
  20. # creation date.
  21. $self->location_save(
  22. $id, 1, $self->{line_one}, $self->{line_two}, $self->{line_three},
  23. $self->{city_province}, $self->{mailing_code}, $self->{country}, undef
  24. );
  25. return $id;
  26. }
  27. 1;