[Gnucash-changes] Improve HBCI balance download.

Christian Stimming cstim at cvs.gnucash.org
Sun Mar 13 07:49:26 EST 2005


Log Message:
-----------
Improve HBCI balance download.

2005-03-13  Christian Stimming  <stimming at tuhh.de>

	* src/import-export/hbci/gnc-hbci-getbalance.c: Improve user
	message when downloaded balance is already identical to reconciled
	balance.

Modified Files:
--------------
    gnucash:
        ChangeLog
    gnucash/src/import-export/hbci:
        gnc-hbci-getbalance.c

Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1897
retrieving revision 1.1898
diff -LChangeLog -LChangeLog -u -r1.1897 -r1.1898
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,9 @@
+2005-03-13  Christian Stimming  <stimming at tuhh.de>
+
+	* src/import-export/hbci/gnc-hbci-getbalance.c: Improve user
+	message when downloaded balance is already identical to reconciled
+	balance.
+
 2005-03-12  Christian Stimming  <stimming at tuhh.de>
 
 	* src/import-export/hbci/gnc-hbci-gettrans.c, hbci-interaction.h:
Index: gnc-hbci-getbalance.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-getbalance.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -Lsrc/import-export/hbci/gnc-hbci-getbalance.c -Lsrc/import-export/hbci/gnc-hbci-getbalance.c -u -r1.32 -r1.33
--- src/import-export/hbci/gnc-hbci-getbalance.c
+++ src/import-export/hbci/gnc-hbci-getbalance.c
@@ -197,6 +197,7 @@
   time_t booked_tt;
   gboolean dialogres;
   double booked_value, noted_value;
+  gnc_numeric value;
 
   response = AB_JobGetBalance_GetAccountStatus((AB_JOB*)job);
   if (!response) {
@@ -238,6 +239,9 @@
     noted_val = NULL;
   }
 
+  value = double_to_gnc_numeric (booked_value,
+				 xaccAccountGetCommoditySCU(gnc_acc),
+				 GNC_RND_ROUND);
   if ((noted_value == 0.0) && (booked_value == 0.0))
     {
       gnome_ok_dialog_parented 
@@ -256,6 +260,8 @@
     }
   else
     {
+      gnc_numeric reconc_balance = xaccAccountGetReconciledBalance (gnc_acc);
+
       char *booked_str = gnc_AB_VALUE_toReadableString (booked_val);
       char *message1 = g_strdup_printf
 	(
@@ -269,14 +275,24 @@
 	 (_("For your information: This account also \n"
 	    "has a noted balance of %s\n"),
 	  noted_val));
-      const char *message3 = _("Reconcile account now?");
-
-      dialogres = gnc_verify_dialog
-	(parent, 
-	 TRUE,
-	 "%s%s\n%s",
-	 message1, message2, message3);
 
+      if (gnc_numeric_equal(value, reconc_balance)) {
+	const char *message3 = _("The booked balance is identical to the current \n"
+				 "reconciled balance of the account.");
+	char *msg = g_strdup_printf ("%s%s\n%s", message1, message2, message3);
+	gnome_ok_dialog_parented (msg, GTK_WINDOW (parent));
+	g_free (msg);
+	dialogres = FALSE;
+
+      } else {
+	const char *message3 = _("Reconcile account now?");
+
+	dialogres = gnc_verify_dialog
+	  (parent, 
+	   TRUE,
+	   "%s%s\n%s",
+	   message1, message2, message3);
+      }
       g_free (message1);
       g_free (message2);
       free (booked_str);
@@ -285,10 +301,6 @@
       
   if (dialogres) 
     {
-      gnc_numeric value =
-	double_to_gnc_numeric (booked_value,
-			       xaccAccountGetCommoditySCU(gnc_acc),
-			       GNC_RND_ROUND);
       recnWindowWithBalance (parent, 
 			     gnc_acc, 
 			     value,


More information about the gnucash-changes mailing list