summaryrefslogtreecommitdiff
path: root/LedgerSMB/DBObject/Draft.pm
blob: 1cfe16b40815d564f6971be01e3a1620b4d2d076 (plain)
  1. package LedgerSMB::DBObject::Draft;
  2. use base qw/LedgerSMB::DBObject/;
  3. sub search {
  4. my ($self) = @_;
  5. @{$self->{draft_results}} = $self->exec_method(funcname => 'draft__search');
  6. return @{$self->{draft_results}};
  7. }
  8. sub approve {
  9. my ($self) = @_;
  10. if (!$self->{id}){
  11. $self->error($self->{_locale}->text('No ID Set'));
  12. }
  13. ($self->{approved}) = $self->exec_method(funcname => 'draft_approve');
  14. $self->{dbh}->commit;
  15. return $self->{approved};
  16. }
  17. sub delete {
  18. my ($self) = @_;
  19. if (!$self->{id}){
  20. $self->error($self->{_locale}->text('No ID Set'));
  21. }
  22. ($self->{deleted}) = $self->exec_method(funcname => 'draft_delete');
  23. $self->{dbh}->commit;
  24. return $self->{deleted};
  25. }
  26. 1;