summaryrefslogtreecommitdiff
path: root/LedgerSMB/DBObject/Customer.pm
blob: 7cd550dc8010b293f1c47f0afc833a3988ab5676 (plain)
  1. package LedgerSMB::DBObject::Customer;
  2. use base qw(LedgerSMB::DBObject);
  3. use LedgerSMB::DBObject;
  4. use LedgerSMB::Entity;
  5. my $CUSTOMER_ENTITY_CLASS = 2;
  6. sub save {
  7. my $self = shift @_;
  8. # This saves both the entity and the credit account. -- CT
  9. $self->{entity_class} = $CUSTOMER_ENTITY_CLASS;
  10. $self->{entity_id} = $self->exec_method(funcname => 'entity_credit_save');
  11. $self->{dbh}->commit;
  12. }
  13. sub get_metadata {
  14. my $self = shift @_;
  15. @{$self->{location_class}} =
  16. $self->exec_method(funcname => 'location_list_class');
  17. @{$self->{country}} =
  18. $self->exec_method(funcname => 'location_list_country');
  19. @{$self->{contact_class}} =
  20. $self->exec_method(funcname => 'entity_list_contact_class');
  21. }
  22. sub save_location {
  23. $self = shift @_;
  24. $self->{entity_class} = $CUSTOMER_ENTITY_CLASS;
  25. $self->exec_method(funcname => 'customer_location_save');
  26. }
  27. sub save_contact {
  28. }
  29. sub save_bank_acct {
  30. }
  31. sub get {
  32. my $self = shift @_;
  33. $self->merge(shift @{$self->exec_method(funcname => 'customer__retrieve')});
  34. $self->{name} = $self->{legal_name};
  35. @{$self->{locations}} = $self->exec_method(
  36. funcname => 'company__list_locations');
  37. @{$self->{contacts}} = $self->exec_method(
  38. funcname => 'company__list_contacts');
  39. @{$self->{contacts}} = $self->exec_method(
  40. funcname => 'company__list_bank_accounts');
  41. @{$self->{notes}} = $self->exec_method(
  42. funcname => 'company__list_notes');
  43. }
  44. sub search {
  45. }
  46. 1;