[Gnucash-changes] More hbci work.

Christian Stimming cstim at cvs.gnucash.org
Sun Sep 12 06:38:14 EDT 2004


Log Message:
-----------
More hbci work.

Modified Files:
--------------
    gnucash/src/import-export/hbci:
        dialog-hbcitrans.c
        gnc-hbci-gettrans.c
    gnucash/src/import-export/hbci/glade:
        hbcipass.glade

Revision Data
-------------
Index: gnc-hbci-gettrans.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-gettrans.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -Lsrc/import-export/hbci/gnc-hbci-gettrans.c -Lsrc/import-export/hbci/gnc-hbci-gettrans.c -u -r1.31 -r1.32
--- src/import-export/hbci/gnc-hbci-gettrans.c
+++ src/import-export/hbci/gnc-hbci-gettrans.c
@@ -227,11 +227,13 @@
    GNC transaction is done here, once for each AB_TRANSACTION.  */
 static AB_TRANSACTION *trans_list_cb(AB_TRANSACTION *h_trans, void *user_data)
 {
-  time_t current_time, tt1, tt2; 
+  time_t current_time;
+  /* time_t tt1, tt2; */
   /*struct tm tm1, tm2;*/
   Account *gnc_acc;
   GNCBook *book;
   Transaction *gnc_trans;
+  const GWEN_TIME *valutaDate, *normalDate;
   Split *split;
   struct trans_list_data *data = user_data;
   g_assert(data);
@@ -250,17 +252,22 @@
     gnc_import_set_trans_online_id(gnc_trans, data.fi_id);
     }*/
 
-  tt1 = GWEN_Time_toTime_t (AB_Transaction_GetDate(h_trans));
-  tt2 = GWEN_Time_toTime_t (AB_Transaction_GetValutaDate(h_trans));
+  normalDate = AB_Transaction_GetDate(h_trans);
+  valutaDate = AB_Transaction_GetValutaDate(h_trans);
+  if (normalDate && !valutaDate)
+    valutaDate = normalDate;
+  /* Watch out -- any of the GWEN_TIME may be NULL */
+  /*   tt1 = GWEN_Time_toTime_t (normalDate); */
+  /*   tt2 = GWEN_Time_toTime_t (valutaDate); */
   /*printf("Date? %s ValutaDate? %s", ctime(&tt1), ctime(&tt2));*/
-  /*tm1 = GWEN_TIME_to_tm (AB_Transaction_date(h_trans));
-    tm2 = GWEN_TIME_to_tm (AB_Transaction_valutaDate(h_trans));
-    printf("Date asc %s ValutaDate asc %s", asctime(&tm1), asctime(&tm2));*/
   
   
   /* Date / Time */
-  xaccTransSetDateSecs
-    (gnc_trans, GWEN_Time_toTime_t (AB_Transaction_GetValutaDate (h_trans)));
+  if (valutaDate)
+    xaccTransSetDateSecs
+      (gnc_trans, GWEN_Time_toTime_t (valutaDate));
+  else
+    printf("trans_list_cb: Oops, date 'valutaDate' was NULL.\n");
     
   current_time = time(NULL);
   xaccTransSetDateEnteredSecs(gnc_trans, mktime(localtime(&current_time)));
@@ -294,10 +301,13 @@
     
   {
     /* Amount into the split */
+    const AB_VALUE *h_value = AB_Transaction_GetValue (h_trans);
     gnc_numeric gnc_amount = double_to_gnc_numeric
-      (AB_Value_GetValue (AB_Transaction_GetValue (h_trans)),
+      (h_value ? AB_Value_GetValue (h_value) : 0.0,
        xaccAccountGetCommoditySCU(gnc_acc),
        GNC_RND_ROUND);
+    if (!h_value)
+      printf("trans_list_cb: Oops, value was NULL. Using 0.\n");
     xaccSplitSetBaseValue(split, gnc_amount, xaccAccountGetCommodity(gnc_acc));
   }
     
Index: dialog-hbcitrans.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/dialog-hbcitrans.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -Lsrc/import-export/hbci/dialog-hbcitrans.c -Lsrc/import-export/hbci/dialog-hbcitrans.c -u -r1.34 -r1.35
--- src/import-export/hbci/dialog-hbcitrans.c
+++ src/import-export/hbci/dialog-hbcitrans.c
@@ -676,7 +676,7 @@
 	(td->parent, 
 	 FALSE,
 	 "%s",
-	 _("The job was successfully sent to the bank, but the \n"
+	 _("The job was sent to the bank successfully, but the \n"
 	   "bank is refusing to execute the job. Please check \n"
 	   "the log window for the exact error message of the \n"
 	   "bank. The line with the error message contains a \n"
@@ -684,13 +684,15 @@
 	   "\n"
 	   "Do you want to enter the job again?"));
 
+    if (AB_Job_GetStatus (job) == AB_Job_StatusPending)
+      AB_Banking_DelPendingJob(api, job);
+
     AB_Transaction_free (td->hbci_trans);
     td->hbci_trans = NULL;
   }
   /* Watch out! The job *has* to be removed from the queue
      here because otherwise it might be executed again. */
-  AB_Banking_DequeueJob(api, job);
-  /* AB_Banking_DequeueJob(api, job); */
+  /* FIXME: need to do AB_Banking_DequeueJob(api, job); */
   return successful;
 }
 
Index: hbcipass.glade
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/glade/hbcipass.glade,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lsrc/import-export/hbci/glade/hbcipass.glade -Lsrc/import-export/hbci/glade/hbcipass.glade -u -r1.1 -r1.2
--- src/import-export/hbci/glade/hbcipass.glade
+++ src/import-export/hbci/glade/hbcipass.glade
@@ -80,7 +80,7 @@
       <name>heading_label</name>
       <label>Enter your password</label>
       <justify>GTK_JUSTIFY_CENTER</justify>
-      <wrap>False</wrap>
+      <wrap>True</wrap>
       <xalign>0.5</xalign>
       <yalign>0.5</yalign>
       <xpad>0</xpad>
@@ -210,7 +210,7 @@
       <name>heading_label</name>
       <label>Enter and confirm your new password</label>
       <justify>GTK_JUSTIFY_CENTER</justify>
-      <wrap>False</wrap>
+      <wrap>True</wrap>
       <xalign>0.5</xalign>
       <yalign>0.5</yalign>
       <xpad>0</xpad>


More information about the gnucash-changes mailing list