diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-07-10 05:37:44 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-07-10 05:37:44 +0000 |
commit | 00c92a41fb134790d8a1f3132ebe50d9dd41a978 (patch) | |
tree | 3d985dcd4bc97f40f241171fe76d6a182a23628e | |
parent | 4a07e174e74e2b707ecf9bf308917ad689e9f317 (diff) |
Fine-tuning changes to draft approval workflow
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2204 4979c152-3d1c-0410-bac9-87ea11338e46
-rw-r--r-- | bin/aa.pl | 12 | ||||
-rw-r--r-- | scripts/drafts.pl | 35 |
2 files changed, 44 insertions, 3 deletions
@@ -958,7 +958,17 @@ sub approve { my $draft = LedgerSMB::DBObject::Draft->new({base => $lsmb}); $draft->approve(); - $form->info($locale->text('Draft Posted')); + if ($form->{callback}){ + print "Location: $form->{callback}\n"; + print "Status: 302 Found\n\n"; + print "<html><body>"; + my $url = $form->{callback}; + print qq|If you are not redirected automatically, click <a href="$url">| + . qq|here</a>.</body></html>|; + + } else { + $form->info($locale->text('Draft Posted')); + } } sub update { diff --git a/scripts/drafts.pl b/scripts/drafts.pl index e38b434c..f7771f30 100644 --- a/scripts/drafts.pl +++ b/scripts/drafts.pl @@ -23,12 +23,42 @@ sub search { $template->render($request); } +sub list_drafts_draft_approve { + my ($request) = @_; + my $draft= LedgerSMB::DBObject::Draft->new(base => $request); + for my $row (1 .. $draft->{rowcount}){ + if ($draft->{"draft_" .$draft->{"row_$row"}}){ + $draft->{id} = $draft->{"row_$row"}; + $draft->approve; + } + } + search($request); +} + +sub list_drafts_draft_delete { + my ($request) = @_; + my $draft= LedgerSMB::DBObject::Draft->new(base => $request); + for my $row (1 .. $draft->{rowcount}){ + if ($draft->{"draft_" .$draft->{"row_$row"}}){ + $draft->{id} = $draft->{"row_$row"}; + $draft->delete; + } + } + search($request); +} + sub list_drafts { my ($request) = @_; my $draft= LedgerSMB::DBObject::Draft->new(base => $request); + my $callback = 'drafts.pl?action=list_drafts'; + for (qw(type reference amount_gy amount_lt)){ + if (defined $draft->{$_}){ + $callback .= "&$_=$draft->{$_}"; + } + } my @search_results = $draft->search; $draft->{script} = "drafts.pl"; - + $draft->{callback} = $draft->escape(string => $callback); my @columns = qw(select id transdate reference description amount); @@ -83,7 +113,8 @@ sub list_drafts { ), reference => { text => $result->{reference}, - href => "$request->{type}.pl?action=edit&id=$result->{id}", + href => "$request->{type}.pl?action=edit&id=$result->{id}" . + "&callback=$draft->{callback}", }, description => $result->{description}, transdate => $result->{transdate}, |