gnucash maint: Bug 782274 - Transactions produced by Transfer Funds or Process...

John Ralls jralls at code.gnucash.org
Sun Jun 25 18:47:05 EDT 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/118dd417 (commit)
	from  https://github.com/Gnucash/gnucash/commit/99a732cb (commit)



commit 118dd41759b4395cf54684928495efed47195261
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Jun 25 15:45:56 2017 -0700

    Bug 782274 - Transactions produced by Transfer Funds or Process...
    
    Payment dialogs sort to beginning of day and do not honor NUM field for
    custom sorting.
    
    Do a two-step, first retrieving a GDate from the date_edit then use
    gdate_to_timespec to convert it to a time64: gdate_to_timespec calls
    gnc_dmy2timespec_neutral while gnc_date_edit_get_date_ts gets a
    begining-of-the-day time.

diff --git a/src/business/business-gnome/dialog-payment.c b/src/business/business-gnome/dialog-payment.c
index 96d20e4..b024cb8 100644
--- a/src/business/business-gnome/dialog-payment.c
+++ b/src/business/business-gnome/dialog-payment.c
@@ -699,7 +699,8 @@ gnc_payment_ok_cb (GtkWidget *widget, gpointer data)
     gnc_suspend_gui_refresh ();
     {
         const char *memo, *num;
-        Timespec date;
+        GDate date;
+        Timespec ts;
         gnc_numeric exch = gnc_numeric_create(1, 1); //default to "one to one" rate
         GList *selected_lots = NULL;
         GtkTreeSelection *selection;
@@ -708,7 +709,9 @@ gnc_payment_ok_cb (GtkWidget *widget, gpointer data)
         /* Obtain all our ancillary information */
         memo = gtk_entry_get_text (GTK_ENTRY (pw->memo_entry));
         num = gtk_entry_get_text (GTK_ENTRY (pw->num_entry));
-        date = gnc_date_edit_get_date_ts (GNC_DATE_EDIT (pw->date_edit));
+        g_date_clear (&date, 1);
+        gnc_date_edit_get_gdate (GNC_DATE_EDIT (pw->date_edit), &date);
+        ts = gdate_to_timespec (date);
 
         /* Obtain the list of selected lots (documents/payments) from the dialog */
         selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(pw->docs_list_tree_view));
@@ -751,7 +754,7 @@ gnc_payment_ok_cb (GtkWidget *widget, gpointer data)
 
         gncOwnerApplyPayment (&pw->owner, &(pw->pre_existing_txn), selected_lots,
                               pw->post_acct, pw->xfer_acct, pw->amount_tot, exch,
-                              date, memo, num, auto_pay);
+                              ts, memo, num, auto_pay);
     }
     gnc_resume_gui_refresh ();
 
@@ -843,7 +846,7 @@ gnc_payment_leave_amount_cb (GtkWidget *widget, GdkEventFocus *event,
     gnc_payment_window_check_payment (pw);
 }
 
-/* Select the list of accounts to show in the tree */
+/* Select the list of accoutns to show in the tree */
 static void
 gnc_payment_set_account_types (GncTreeViewAccount *tree)
 {
diff --git a/src/gnome-utils/dialog-transfer.c b/src/gnome-utils/dialog-transfer.c
index a0dbe63..a69c7f8 100644
--- a/src/gnome-utils/dialog-transfer.c
+++ b/src/gnome-utils/dialog-transfer.c
@@ -1683,6 +1683,7 @@ gnc_xfer_dialog_response_cb (GtkDialog *dialog, gint response, gpointer data)
     Account *from_account;
     gnc_numeric amount, to_amount;
     Timespec ts;
+    GDate date;
 
     g_return_if_fail (xferData != NULL);
     ENTER(" ");
@@ -1723,8 +1724,9 @@ gnc_xfer_dialog_response_cb (GtkDialog *dialog, gint response, gpointer data)
         LEAVE("invalid from amount");
         return;
     }
-
-    ts = gnc_date_edit_get_date_ts(GNC_DATE_EDIT(xferData->date_entry));
+    g_date_clear (&date, 1);
+    gnc_date_edit_get_gdate (GNC_DATE_EDIT (xferData->date_entry), &date);
+    ts = gdate_to_timespec (date);
 
     if (!gnc_commodity_equiv(xferData->from_commodity, xferData->to_commodity))
     {



Summary of changes:
 src/business/business-gnome/dialog-payment.c | 11 +++++++----
 src/gnome-utils/dialog-transfer.c            |  6 ++++--
 2 files changed, 11 insertions(+), 6 deletions(-)



More information about the gnucash-changes mailing list