summaryrefslogtreecommitdiff
path: root/scripts/vouchers.pl
blob: 343051394528d406610cb2cc8da6f51f93832177 (plain)
  1. #!/usr/bin/perl
  2. # This file is copyright (C) 2007the LedgerSMB core team and licensed under
  3. # the GNU General Public License. For more information please see the included
  4. # LICENSE and COPYRIGHT files
  5. package LedgerSMB::Scripts::vouchers;
  6. our $VERSION = '0.1';
  7. $menufile = "menu.ini";
  8. use LedgerSMB::Batch;
  9. use LedgerSMB::Voucher;
  10. use LedgerSMB::Template;
  11. use strict;
  12. sub create_batch {
  13. my ($request) = @_;
  14. $request->{hidden} = [
  15. batch_type => $request->{batch_type},
  16. ];
  17. my $template = LedgerSMB::Template->new(
  18. user =>$request->{_user},
  19. locale => $request->{_locale},
  20. path => 'UI',
  21. template => 'create_batch',
  22. format => 'HTML'
  23. );
  24. $template->render($request);
  25. }
  26. sub create_vouchers {
  27. # This function is not safe for caching as long as the scripts are in bin.
  28. # This is because these scripts import all functions into the *current*
  29. # namespace. People using fastcgi and modperl should *not* cache this
  30. # module at the moment. -- CT
  31. my %vouchers_dispatch = (
  32. payable => {script => 'bin/ap.pl', function => sub {add()}},
  33. receivable => {script => 'bin/ar.pl', function => sub {add()}},
  34. payments => {script => 'bin/cp.pl', function => sub {payments()}},
  35. receipts => {script => 'bin/cp.pl', function => sub {receipts()}},
  36. gl => {script => 'bin/gl.pl'. function => sub {add()}},
  37. )
  38. require $vouchers_dispatch{$request->{batch_type}}{script}
  39. $vouchers_dispatch{$request->{batch_type}}{function}();
  40. }
  41. sub list_vouchers {
  42. }
  43. sub approve_batch {
  44. }
  45. sub delete_batch {
  46. }
  47. 1;