summaryrefslogtreecommitdiff
path: root/LedgerSMB/Batch.pm
blob: 127ee7912764d82ee90bf5a694ae7fde3495ab91 (plain)
  1. package LedgerSMB::Batch;
  2. use base qw(LedgerSMB::DBObject);
  3. sub create {
  4. $self = shift @_;
  5. my ($ref) = $self->exec_method(funcname => 'batch_create');
  6. $self->{id} = $ref->{batch_create};
  7. $self->{dbh}->commit;
  8. return $ref->{id};
  9. }
  10. sub delete_voucher {
  11. my ($self, $voucher_id) = @_;
  12. $self->call_procedure(procname => 'voucher__delete', args => [$voucher_id]);
  13. $self->{dbh}->commit;
  14. }
  15. sub get_search_criteria {
  16. $self = shift @_;
  17. @{$self->{batch_classes}} = $self->exec_method(
  18. funcname => 'batch_list_classes'
  19. );
  20. @{$self->{batch_users}} = $self->exec_method(
  21. funcname => 'batch_get_users'
  22. );
  23. }
  24. sub get_search_results {
  25. my ($self) = @_;
  26. @{$self->{search_results}} = $self->exec_method(funcname => 'batch_search');
  27. return @{$self->{search_results}};
  28. }
  29. sub post {
  30. my ($self) = @_;
  31. ($self->{post_return_ref}) = $self->exec_method(funcname => 'batch_post');
  32. $self->{dbh}->commit;
  33. return $self->{post_return_ref};
  34. }
  35. sub delete {
  36. my ($self) = @_;
  37. ($self->{delete_ref}) = $self->exec_method(funcname => 'batch_delete');
  38. $self->{dbh}->commit;
  39. return $self->{delete_ref};
  40. }
  41. sub list_vouchers {
  42. my ($self) = @_;
  43. @{$self->{vouchers}} = $self->exec_method(funcname => 'voucher_list');
  44. return @{$self->{vouchers}};
  45. }
  46. 1;