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

SF.net SVN: ledger-smb:[3885] branches/1.3/LedgerSMB/DBObject/Account.pm



Revision: 3885
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3885&view=rev
Author:   einhverfr
Date:     2011-10-18 06:50:10 +0000 (Tue, 18 Oct 2011)
Log Message:
-----------
Making errors saving chart of accounts entries more friendly, closing bug 3423930

Modified Paths:
--------------
    branches/1.3/LedgerSMB/DBObject/Account.pm

Modified: branches/1.3/LedgerSMB/DBObject/Account.pm
===================================================================
--- branches/1.3/LedgerSMB/DBObject/Account.pm	2011-10-18 06:35:54 UTC (rev 3884)
+++ branches/1.3/LedgerSMB/DBObject/Account.pm	2011-10-18 06:50:10 UTC (rev 3885)
@@ -59,7 +59,21 @@
     if ($self->{charttype} and $self->{charttype} eq 'H') {
         $func = 'account_heading_save';
     }
-    my ($id_ref) = $self->exec_method(funcname => $func);
+    my ($id_ref) = $self->exec_method(funcname => $func,
+                             continue_on_error => 1);
+    if (!$id_ref->{$func}){ # Didn't return anything.  Chances are this was an 
+                            # Error we trapped from the function.  Time to test
+                            # that error and display a more friendly error.
+       if ($@ =~ /Invalid link settings:\s*Summary/){
+           $self->error($self->{_locale}->text(
+               'Error: Cannot include summary account in other dropdown menus'
+           ));
+       } else {
+          $self->error($self->{_locale}->text(
+               'Internal Database Error.'
+          ) . " $@");
+       }
+    }
     $self->{id} = $id_ref->{$func};
     if (defined $self->{recon}){
         $self->call_procedure(procname => 'cr_coa_to_account_save', args =>[ $self->{accno}, $self->{description}]);

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.