From e8ac6567b714f155b0628fe43fb7c2068dfbcf36 Mon Sep 17 00:00:00 2001
From: aspangaro <alexandre.spangaro@gmail.com>
Date: Tue, 7 Oct 2014 20:50:57 +0200
Subject: [PATCH] Fix :: Button on/off for account in chart of accounts

---
 htdocs/accountancy/admin/account.php | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php
index 0c929ef5de5..317cd12885d 100644
--- a/htdocs/accountancy/admin/account.php
+++ b/htdocs/accountancy/admin/account.php
@@ -65,8 +65,7 @@ if ($action == 'delete') {
 $accounting = new AccountingAccount($db);
 
 if ($action == 'disable') {
-	$accounting = $accounting->fetch($id);
-	if (! empty($accounting->id)) {
+	if ($accounting->fetch($id)) {
 		$result = $accounting->account_desactivate($id);
 	}
 	
@@ -75,10 +74,7 @@ if ($action == 'disable') {
 		setEventMessage($accounting->error, 'errors');
 	}
 } else if ($action == 'enable') {
-	
-	$accounting = $accounting->fetch($id);
-	
-	if (! empty($accounting->id)) {
+	if ($accounting->fetch($id)) {
 		$result = $accounting->account_activate($id);
 	}
 	$action = 'update';
-- 
GitLab