summaryrefslogtreecommitdiff
path: root/LedgerSMB/DBObject/Draft.pm
blob: b57bd23873972914026e15d652c776f59b733bef (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. return $self->{deleted};
  24. }
  25. 1;