summaryrefslogtreecommitdiff
path: root/scripts/employees.pl
blob: fa9ec05f19fde7e8ef5130f70bf1e67ece56c868 (plain)
  1. # The handler, prior to handing the execution off to this script will create a
  2. # $request object from the LedgerSMB namespace. This object contains the http
  3. # request parameters, db connections, and the like. A $user object is also
  4. # created
  5. #
  6. # Entrence points are functions which do not begin with an underscore (_)
  7. use LedgerSMB::Template;
  8. sub save {
  9. my $employee = LedgerSMB::Employee->new(base => $request, copy => 'all');
  10. $employee->save();
  11. &_display;
  12. }
  13. sub search {
  14. my $search = LedgerSMB::Employee->new(base => $request, copy => 'all');
  15. $employee->{search_results} = $employee->search();
  16. my $template = LedgerSMB::Template->new( user => $user,
  17. template => 'employee_search.html', language => $user->{language},
  18. format => 'html');
  19. $template->render($employee);
  20. }
  21. sub add {
  22. my $employee = LedgerSMB::Employee->new(base => $request, copy => 'all');
  23. &_display;
  24. }
  25. sub edit {
  26. my $employee = LedgerSMB::Employee->new(base => $request, copy => 'all');
  27. $employee->get();
  28. &_display;
  29. }
  30. sub _display {
  31. my $template = LedgerSMB::Template->new( user => $user,
  32. template => 'employee.html', language => $user->{language},
  33. format => 'html');
  34. $template->render($employee);
  35. }
  36. 1;