summaryrefslogtreecommitdiff
path: root/LedgerSMB/Employee.pm
blob: bf22cb45a48997db2e6f608f7137f69d6fd74d5a (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. use strict;
  24. our $VERSION = '1.0.0';
  25. our @ISA = qw(LedgerSMB::DBObject);
  26. sub AUTOLOAD {
  27. my $self = shift;
  28. my $AUTOLOAD = $LedgerSMB::Employee::AUTOLOAD;
  29. $AUTOLOAD =~ s/^.*:://;
  30. my $procname = "employee_$AUTOLOAD";
  31. $self->exec_method($procname, @_);
  32. }
  33. sub save {
  34. my $self = shift;
  35. my $hashref = shift @{$self->exec_method("employee_save")};
  36. $self->merge($hashref, 'id');
  37. }
  38. sub get {
  39. my $self = shift;
  40. my $hashref = shift @{$self->exec_method("employee_get")};
  41. $self->merge($hashref, keys %{$hashref});
  42. }
  43. sub list_managers {
  44. my $self = shift;
  45. $self->{manager_list} = $self->exec_method("employee_list_managers");
  46. }
  47. sub search {
  48. my $self = shift;
  49. $self->{search_results} = $self->exec_method("employee_search");
  50. }
  51. 1;