[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error updating an old transaction



On 11/04/2014 00:18, Lyle wrote:
On 10/04/2014 17:14, Lyle wrote:
On 10/04/2014 16:11, Chris Travers wrote:

I remember in lsmb 1.2 I had to run some code to enable old transactions to be updated. Is that this case in 1.3?

Right.  You can re-enable this by granting DELETE permissions on acc_trans.

Thanks.

For anyone wondering the commands are:

grant delete on acc_trans to lsmb_cosmicnetworks__ap_transaction_create;
grant delete on acc_trans to lsmb_cosmicnetworks__ar_transaction_create;
grant delete on ar to lsmb_COMPANYNAME__ar_transaction_create;
grant delete on ap to lsmb_COMPANYNAME__ap_transaction_create;

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!') );
+    }
+
 }



Out of interest. From a grep I couldn't determine where it decides what role is in use for a particular transaction. Where can I find that code?

I'm also having issues when I Post as Shown rather than Post as Saved. It just hangs and eventually times out. Nothing in the PostgreSQL log. When this happens I can't post anything, although I can read... it's like a table is locked up or something. Restarting PostgreSQL fixes the issue... as long as I don't press Post as Shown again.


Lyle



------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees


_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel

------------------------------------------------------------------------------
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