On 11/04/2014 00:18, Lyle wrote:
Getting delete working for the General Ledger was a bit harder: grant delete on acc_trans to lsmb_COMPANYNAME__gl_transaction_create; grant delete on gl to lsmb_COMPANYNAME__gl_transaction_create; grant delete on yearend to lsmb_COMPANYNAME__gl_transaction_create; Then patching bin/gl.pl with the patch below. I know you don't like people deleting things, but please let me know if I've missed something. --- gl.pl.orig 2014-02-06 19:01:01.000000000 +0000 +++ gl.pl 2014-04-26 16:09:33.556712883 +0100 @@ -1111,16 +1111,66 @@ +#sub delete { +# $form->error($locale->text('Cannot delete posted transaction')) +# if ($form->{approved}); +# my $lsmb = LedgerSMB->new(); +# $lsmb->merge($form); +# my $draft = LedgerSMB::DBObject::Draft->new({base => $lsmb}); +# $draft->delete(); +# delete $form->{id}; +# delete $form->{reference}; +# add(); +#} + + sub delete { - $form->error($locale->text('Cannot delete posted transaction')) - if ($form->{approved}); - my $lsmb = LedgerSMB->new(); - $lsmb->merge($form); - my $draft = LedgerSMB::DBObject::Draft->new({base => $lsmb}); - $draft->delete(); - delete $form->{id}; - delete $form->{reference}; - add(); + + $form->{title} = $locale->text('Confirm!'); + + $form->header; + + print qq| +<body> + +<form method=post action=""> +|; + + $form->{action} = "yes"; + $form->hide_form; + + print qq| +<h2 class=confirm>$form->{title}</h2> + +<h4>| + . $locale->text('Are you sure you want to delete Transaction') + . qq| $form->{invnumber}</h4> + +<button name="action" class="submit" type="submit" value="yes">| + . $locale->text('Yes') + . qq|</button> +</form> + +</body> +</html> +|; + +} + +sub yes { + + if ( + GL->delete_transaction( + \%myconfig, \%$form, ${LedgerSMB::Sysconfig::spool} + ) + ) + { + $form->redirect( $locale->text('Transaction deleted!') ); + } + else { + $form->error( $locale->text('Cannot delete transaction!') ); + } + }
|
------------------------------------------------------------------------------ Start Your Social Network Today - Download eXo Platform Build your Enterprise Intranet with eXo Platform Software Java Based Open Source Intranet - Social, Extensible, Cloud Ready Get Started Now And Turn Your Intranet Into A Collaboration Platform http://p.sf.net/sfu/ExoPlatform
_______________________________________________ Ledger-smb-devel mailing list ..hidden.. https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel