summaryrefslogtreecommitdiff
path: root/LedgerSMB/DBObject/Company.pm
blob: 30023c923191a0c440cd968ba835bb9a503717f8 (plain)
  1. package LedgerSMB::DBObject::Company;
  2. use base qw(LedgerSMB::DBObject);
  3. use strict;
  4. sub save_credit {
  5. my $self = shift @_;
  6. my ($ref) = $self->exec_method(funcname => 'entity_credit_save');
  7. $self->{entity_id} = $ref->{entity_credit_save};
  8. $self->{dbh}->commit;
  9. }
  10. sub get_metadata {
  11. my $self = shift @_;
  12. @{$self->{location_class_list}} =
  13. $self->exec_method(funcname => 'location_list_class');
  14. @{$self->{country_list}} =
  15. $self->exec_method(funcname => 'location_list_country');
  16. @{$self->{contact_class_list}} =
  17. $self->exec_method(funcname => 'entity_list_contact_class');
  18. }
  19. sub save_contact {
  20. my ($self) = @_;
  21. $self->exec_method(funcname => 'company__save_contact');
  22. $self->{dbh}->commit;
  23. }
  24. sub save_bank_account {
  25. my $self = shift @_;
  26. $self->exec_method(funcname => 'entity__save_bank_account');
  27. $self->{dbh}->commit;
  28. }
  29. sub get_company{
  30. my $self = shift @_;
  31. @{$self->{locations}} = $self->exec_method(
  32. funcname => 'company__list_locations');
  33. @{$self->{contacts}} = $self->exec_method(
  34. funcname => 'company__list_contacts');
  35. @{$self->{bank_account}} = $self->exec_method(
  36. funcname => 'company__list_bank_account');
  37. @{$self->{notes}} = $self->exec_method(
  38. funcname => 'company__list_notes');
  39. };
  40. 1;