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

SF.net SVN: ledger-smb:[4768] branches/1.3



Revision: 4768
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4768&view=rev
Author:   einhverfr
Date:     2012-05-24 06:04:11 +0000 (Thu, 24 May 2012)
Log Message:
-----------
Accounts with no pending or actual transactions can now be deleted. 

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/LedgerSMB/AM.pm
    branches/1.3/bin/am.pl

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2012-05-24 03:53:22 UTC (rev 4767)
+++ branches/1.3/Changelog	2012-05-24 06:04:11 UTC (rev 4768)
@@ -10,7 +10,9 @@
 * Fixed customer email not showing emailing statements (Chris T and Erik H)
 * Approved recon reports no longer show invalid balance info (Chris T,3518283)
 * CSS directory is now configurable (Chris T, 3516730, h/t Robert C)
+* Corrected cannot delete accounts (Chris T, 3529383, h/t David M)
 
+David M is David Mora
 Robert C is Robert James Clay
 
 

Modified: branches/1.3/LedgerSMB/AM.pm
===================================================================
--- branches/1.3/LedgerSMB/AM.pm	2012-05-24 03:53:22 UTC (rev 4767)
+++ branches/1.3/LedgerSMB/AM.pm	2012-05-24 06:04:11 UTC (rev 4768)
@@ -158,13 +158,12 @@
     my ($rowcount) = $sth->fetchrow_array();
 
     if ($rowcount) {
-        $form->error( "Cannot delete accounts with associated transactions!" );
+        $form->error( "Cannot delete accounts with associated or pending transactions!" );
     }
 
     # delete chart of account record
     $query = qq|
-		DELETE FROM chart
-		      WHERE id = ?|;
+		DELETE FROM account where id = ?|;
 
     $sth = $dbh->prepare($query);
     $sth->execute( $form->{id} ) || $form->dberror($query);

Modified: branches/1.3/bin/am.pl
===================================================================
--- branches/1.3/bin/am.pl	2012-05-24 03:53:22 UTC (rev 4767)
+++ branches/1.3/bin/am.pl	2012-05-24 06:04:11 UTC (rev 4768)
@@ -185,15 +185,16 @@
 "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
 
     $form->{callback} = $callback;
-    @column_index = qw(accno gifi_accno description debit credit link);
+    @column_index = qw(accno gifi_accno description debit credit link delete);
 
     my $column_names = {
-        accno => 'Account',
-        gifi_accno => 'GIFI',
-        description => 'Description',
-        debit => 'Debit',
-        credit => 'Credit',
-        link => 'Link'
+        accno => $locale->text('Account'),
+        gifi_accno => $locale->text('GIFI'),
+        description => $locale->text('Description'),
+        debit => $locale->text('Debit'),
+        credit => $locale->text('Credit'),
+        link => $locale->text('Link'),
+        delete => $locale->text('Delete')
     };
 
     # escape callback
@@ -246,6 +247,14 @@
             $column_data{description} = $ca->{description};
             $column_data{debit}       = $ca->{debit};
             $column_data{credit} = $ca->{credit};
+	    if (($ca->{debit} =~ /\d/ )or ($ca->{credit} =~ /\d/)){
+               # Note, this is just a stub in case we want to put a 
+               # message here --CT
+            } else {
+                $column_data{delete} ={text => '['.$locale->text('Delete').']',
+                                      href => 'am.pl?action=delete_account&'.
+                                              'id='.$ca->{id} };
+            }
 	    $column_data{link}   = {text => $ca->{link}, delimiter => ':'};
 
         }

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