summaryrefslogtreecommitdiff
path: root/LedgerSMB/Employee.pm
blob: 0aa94961a755d532faed183899410277fbc4139b (plain)
  1. =head1 NAME
  2. LedgerSMB::Employee - LedgerSMB class for managing Employees
  3. =head1 SYOPSIS
  4. This module creates object instances based on LedgerSMB's in-database ORM.
  5. =head1 METHODS
  6. The following method is static:
  7. =item new ($LedgerSMB object);
  8. The following methods are passed through to stored procedures via Autoload.
  9. =item save
  10. =item get
  11. =item search
  12. =item list_managers
  13. The above list may grow over time, and may depend on other installed modules.
  14. =head1 Copyright (C) 2007, The LedgerSMB core team.
  15. This file is licensed under the Gnu General Public License version 2, or at your
  16. option any later version. A copy of the license should have been included with
  17. your software.
  18. =back
  19. =cut
  20. package LedgerSMB::Employee;
  21. use LedgerSMB;
  22. use LedgerSMB::DBObject;
  23. our $VERSION = '1.0.0';
  24. our @ISA = qw(LedgerSMB::DBObject);
  25. sub AUTOLOAD {
  26. my $self = shift;
  27. $AUTOLOAD =~ s/^.*:://;
  28. my $procname = "employee_$AUTOLOAD";
  29. $self->exec_method($procname, @_);
  30. }
  31. sub save {
  32. my $self = shift;
  33. my $hashref = shift @{$self->exec_method("employee_save")};
  34. $self->merge($hashref, 'id');
  35. }
  36. sub get {
  37. my $self = shift;
  38. my $hashref = shift @{$self->exec_method("employee_get")};
  39. $self->merge($hashref, keys %{$hashref});
  40. }
  41. sub list_managers {
  42. my $self = shift;
  43. $self->{manager_list} = $self->exec_method("employee_list_managers");
  44. }
  45. sub search {
  46. my $self = shift;
  47. $self->{search_results} = $self->exec_method("employee_search");
  48. }
  49. 1;