diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-11-13 01:15:47 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-11-13 01:15:47 +0000 |
commit | 1aaa9fe478fc2e9ea0fa744edb704ccacf46d07b (patch) | |
tree | 948069945fd10e396cb2c3876269fba31add977d /bin | |
parent | f7ae08a1336c4667e2fb4028d034a52fda7f492b (diff) |
Correcting issues with draft editing.
Moving AA::post_transaction to use strict.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2392 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'bin')
-rw-r--r-- | bin/aa.pl | 24 | ||||
-rw-r--r-- | bin/gl.pl | 49 |
2 files changed, 72 insertions, 1 deletions
@@ -883,7 +883,16 @@ sub form_footer { { ndx => 8, key => 'D', value => $locale->text('Delete') }, ); if (!$form->{approved} && !$form->{batch_id}){ - $button{approve} = { ndx => 3, key => 'O', value => $locale->text('Post') }; + $button{approve} = { + ndx => 3, + key => 'O', + value => $locale->text('Post as Saved') }; + if (grep /^lsmb_$form->{company}__draft_modify$/, @{$form->{_roles}}){ + $button{edit_and_approve} = { + ndx => 4, + key => 'O', + value => $locale->text('Post as Shown') }; + } delete $button{post_as_new}; delete $button{print_and_post_as_new}; delete $button{post}; @@ -942,6 +951,18 @@ sub form_footer { } +sub edit_and_approve { + use LedgerSMB::DBObject::Draft; + use LedgerSMB; + my $lsmb = LedgerSMB->new(); + $lsmb->merge($form); + my $draft = LedgerSMB::DBObject::Draft->new({base => $lsmb}); + $draft->delete(); + delete $form->{id}; + AA->post_transaction( \%myconfig, \%$form ); + approve(); +} + sub approve { use LedgerSMB::DBObject::Draft; use LedgerSMB; @@ -1150,6 +1171,7 @@ sub post { if ( $form->{printandpost} ) { &{"print_$form->{formname}"}( $old_form, 1 ); } + print STDERR "Redirecting\n"; $form->redirect( $locale->text('Transaction posted!') ); } else { @@ -92,6 +92,39 @@ sub pos_adjust { $form->{accno_3} = $pos_config{'coa_prefix'}; } +sub edit_and_approve { + use LedgerSMB::DBObject::Draft; + use LedgerSMB; + my $lsmb = LedgerSMB->new(); + $lsmb->merge($form); + my $draft = LedgerSMB::DBObject::Draft->new({base => $lsmb}); + $draft->delete(); + GL->post_transaction( \%myconfig, \%$form ); + approve(); +} + +sub approve { + use LedgerSMB::DBObject::Draft; + use LedgerSMB; + my $lsmb = LedgerSMB->new(); + $lsmb->merge($form); + + my $draft = LedgerSMB::DBObject::Draft->new({base => $lsmb}); + + $draft->approve(); + 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 add_pos_adjust { $form->{pos_adjust} = 1; $form->{reference} = @@ -1283,6 +1316,22 @@ sub form_footer { for ( "update", "post", "schedule" ) { $a{$_} = 1 } } } + if (!$form->{approved} && !$form->{batch_id}){ + $button{approve} = { + ndx => 3, + key => 'S', + value => $locale->text('Post as Saved') }; + $a{approve} = 1; + $a{edit_and_approve} = 1; + if (grep /^lsmb_$form->{company}__draft_modify$/, @{$form->{_roles}}){ + $button{edit_and_approve} = { + ndx => 4, + key => 'O', + value => $locale->text('Post as Shown') }; + } + delete $button{post_as_new}; + delete $button{post}; + } for ( keys %button ) { delete $button{$_} if !$a{$_} } for ( sort { $button{$a}->{ndx} <=> $button{$b}->{ndx} } keys %button ) |