gnucash maint: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Tue Sep 23 04:35:14 EDT 2014


Updated	 via  https://github.com/Gnucash/gnucash/commit/e693a689 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/97d6bffa (commit)
	from  https://github.com/Gnucash/gnucash/commit/345f576b (commit)



commit e693a68972c393c59d943d6c7b9775c4b85700c7
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Tue Sep 23 10:26:00 2014 +0200

    Bug 630638 - 'Process payment' should allow to select equity accounts for payment

diff --git a/src/business/business-gnome/dialog-payment.c b/src/business/business-gnome/dialog-payment.c
index ad8c9d1..5cc09e5 100644
--- a/src/business/business-gnome/dialog-payment.c
+++ b/src/business/business-gnome/dialog-payment.c
@@ -786,7 +786,8 @@ gnc_payment_leave_amount_cb (GtkWidget *widget, GdkEventFocus *event,
 
 static gboolean AccountTypeOkForPayments (GNCAccountType type)
 {
-    if (xaccAccountIsAssetLiabType(type))
+    if (xaccAccountIsAssetLiabType(type) ||
+        xaccAccountIsEquityType(type))
         return TRUE;
     else
         return FALSE;
diff --git a/src/engine/Account.c b/src/engine/Account.c
index 69cd072..3e842ce 100644
--- a/src/engine/Account.c
+++ b/src/engine/Account.c
@@ -4048,6 +4048,7 @@ gboolean xaccAccountIsAssetLiabType(GNCAccountType t)
                 || xaccAccountTypesCompatible(ACCT_TYPE_LIABILITY, t));
     }
 }
+
 gboolean xaccAccountIsAPARType(GNCAccountType t)
 {
     switch (t)
@@ -4060,6 +4061,17 @@ gboolean xaccAccountIsAPARType(GNCAccountType t)
     }
 }
 
+gboolean xaccAccountIsEquityType(GNCAccountType t)
+{
+    switch (t)
+    {
+    case ACCT_TYPE_EQUITY:
+        return TRUE;
+    default:
+        return FALSE;
+    }
+}
+
 gboolean
 xaccAccountIsPriced(const Account *acc)
 {
diff --git a/src/engine/Account.h b/src/engine/Account.h
index 23ddbd1..ae1f0a8 100644
--- a/src/engine/Account.h
+++ b/src/engine/Account.h
@@ -944,6 +944,10 @@ gboolean xaccAccountIsAssetLiabType(GNCAccountType t);
  *  (meaning an Accounts Payable/Accounts Receivable). */
 gboolean xaccAccountIsAPARType(GNCAccountType t);
 
+/** Convenience function to check if the account is a valid
+ *  Equity type. */
+gboolean xaccAccountIsEquityType(GNCAccountType t);
+
 
 /** @} */
 

commit 97d6bffa0caa30e6c10e9eee0d85e74bdbdca28f
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Tue Sep 23 10:24:42 2014 +0200

    Use same test for payment dialog transfer accounts and assign as payment checks

diff --git a/src/business/business-gnome/dialog-payment.c b/src/business/business-gnome/dialog-payment.c
index f7779d1..ad8c9d1 100644
--- a/src/business/business-gnome/dialog-payment.c
+++ b/src/business/business-gnome/dialog-payment.c
@@ -784,6 +784,14 @@ gnc_payment_leave_amount_cb (GtkWidget *widget, GdkEventFocus *event,
     gnc_payment_window_check_payment (pw);
 }
 
+static gboolean AccountTypeOkForPayments (GNCAccountType type)
+{
+    if (xaccAccountIsAssetLiabType(type))
+        return TRUE;
+    else
+        return FALSE;
+}
+
 /* Select the list of accounts to show in the tree */
 static void
 gnc_payment_set_account_types (GncTreeViewAccount *tree)
@@ -794,19 +802,7 @@ gnc_payment_set_account_types (GncTreeViewAccount *tree)
     gnc_tree_view_account_get_view_info (tree, &avi);
 
     for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
-        switch (i)
-        {
-        case ACCT_TYPE_BANK:
-        case ACCT_TYPE_CASH:
-        case ACCT_TYPE_CREDIT:
-        case ACCT_TYPE_ASSET:
-        case ACCT_TYPE_LIABILITY:
-            avi.include_type[i] = TRUE;
-            break;
-        default:
-            avi.include_type[i] = FALSE;
-            break;
-        }
+        avi.include_type[i] = AccountTypeOkForPayments (i);
 
     gnc_tree_view_account_set_view_info (tree, &avi);
 }
@@ -1123,7 +1119,7 @@ static void increment_if_asset_account (gpointer data,
     int *r = user_data;
     const Split *split = data;
     const Account *account = xaccSplitGetAccount(split);
-    if (xaccAccountIsAssetLiabType(xaccAccountGetType(account)))
+    if (AccountTypeOkForPayments(xaccAccountGetType (account)))
         ++(*r);
 }
 static int countAssetAccounts(SplitList* slist)
@@ -1138,7 +1134,7 @@ static gint predicate_is_asset_account(gconstpointer a,
 {
     const Split *split = a;
     const Account *account = xaccSplitGetAccount(split);
-    if (xaccAccountIsAssetLiabType(xaccAccountGetType(account)))
+    if (AccountTypeOkForPayments(xaccAccountGetType(account)))
         return 0;
     else
         return -1;



Summary of changes:
 src/business/business-gnome/dialog-payment.c | 27 ++++++++++++---------------
 src/engine/Account.c                         | 12 ++++++++++++
 src/engine/Account.h                         |  4 ++++
 3 files changed, 28 insertions(+), 15 deletions(-)



More information about the gnucash-changes mailing list