summaryrefslogtreecommitdiff
path: root/LedgerSMB/Vendor.pm
blob: 52aa49446e774cd27dcec0ae16e50b8860d45a38 (plain)
  1. package LedgerSMB::DBObject::Vendor;
  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_vendor_id();
  12. }
  13. $id = $self->save($id, $self->{discount}, $self->{tax_included},
  14. $self->{creditlimit}, $self->{terms}, $self->{vendornumber},
  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;