r23045 - gnucash/trunk/src - Change all usage of xaccTransSetDatePostedSecs to xaccTransSetDatePostedSecsNormalized.

Christian Stimming cstim at code.gnucash.org
Sun Jun 9 17:33:19 EDT 2013


Author: cstim
Date: 2013-06-09 17:33:19 -0400 (Sun, 09 Jun 2013)
New Revision: 23045
Trac: http://svn.gnucash.org/trac/changeset/23045

Modified:
   gnucash/trunk/src/app-utils/gnc-ui-util.c
   gnucash/trunk/src/engine/SchedXaction.c
   gnucash/trunk/src/gnome-utils/dialog-account.c
   gnucash/trunk/src/gnome-utils/dialog-book-close.c
   gnucash/trunk/src/gnome-utils/gnc-tree-control-split-reg.c
   gnucash/trunk/src/gnome-utils/gnc-tree-view-split-reg.c
   gnucash/trunk/src/gnome/assistant-stock-split.c
   gnucash/trunk/src/gnome/gnc-plugin-page-register.c
   gnucash/trunk/src/gnome/gnc-plugin-page-register2.c
   gnucash/trunk/src/gnome/gnc-split-reg.c
   gnucash/trunk/src/gnome/gnc-split-reg2.c
   gnucash/trunk/src/import-export/aqbanking/gnc-ab-utils.c
   gnucash/trunk/src/import-export/csv-import/gnc-csv-model.c
   gnucash/trunk/src/import-export/import-backend.c
   gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c
   gnucash/trunk/src/register/ledger-core/split-register-load.c
   gnucash/trunk/src/register/ledger-core/split-register.c
Log:
Change all usage of xaccTransSetDatePostedSecs to xaccTransSetDatePostedSecsNormalized.

In fact, all calls to this setter refer to the plain date and not to
any time-of-day. Consequently, only the normalized setter must be used
everywhere. (Subsequently, the previous setter could be removed, as
it turned out to be not used anywhere, but that's another story.)

As a side effect, this makes the register2 set the PostedDate in the
same way as the old register again. The register2 used to introduce a
time-of-day part in the PostedDate, but this should not be done. Only
the EnteredDate has a time-of-day part.

Modified: gnucash/trunk/src/app-utils/gnc-ui-util.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-ui-util.c	2013-06-09 21:32:06 UTC (rev 23044)
+++ gnucash/trunk/src/app-utils/gnc-ui-util.c	2013-06-09 21:33:19 UTC (rev 23045)
@@ -792,7 +792,7 @@
     xaccTransBeginEdit (trans);
 
     xaccTransSetCurrency (trans, xaccAccountGetCommodity (account));
-    xaccTransSetDatePostedSecs (trans, date);
+    xaccTransSetDatePostedSecsNormalized (trans, date);
     xaccTransSetDescription (trans, _("Opening Balance"));
 
     split = xaccMallocSplit (book);

Modified: gnucash/trunk/src/engine/SchedXaction.c
===================================================================
--- gnucash/trunk/src/engine/SchedXaction.c	2013-06-09 21:32:06 UTC (rev 23044)
+++ gnucash/trunk/src/engine/SchedXaction.c	2013-06-09 21:33:19 UTC (rev 23045)
@@ -1113,7 +1113,7 @@
         xaccTransSetDescription(new_trans,
                                 gnc_ttinfo_get_description(tti));
 
-        xaccTransSetDatePostedSecs(new_trans, gnc_time (NULL));
+        xaccTransSetDatePostedSecsNormalized(new_trans, gnc_time (NULL));
 
         /* Set tran-num with gnc_set_num_action which is the same as
          * xaccTransSetNum with these arguments */

Modified: gnucash/trunk/src/gnome/assistant-stock-split.c
===================================================================
--- gnucash/trunk/src/gnome/assistant-stock-split.c	2013-06-09 21:32:06 UTC (rev 23044)
+++ gnucash/trunk/src/gnome/assistant-stock-split.c	2013-06-09 21:33:19 UTC (rev 23045)
@@ -384,7 +384,7 @@
     xaccTransSetCurrency (trans, gnc_default_currency ());
 
     date = gnc_date_edit_get_date (GNC_DATE_EDIT (info->date_edit));
-    xaccTransSetDatePostedSecs (trans, date);
+    xaccTransSetDatePostedSecsNormalized (trans, date);
 
     {
         const char *description;

Modified: gnucash/trunk/src/gnome/gnc-plugin-page-register.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-register.c	2013-06-09 21:32:06 UTC (rev 23044)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-register.c	2013-06-09 21:33:19 UTC (rev 23045)
@@ -2964,7 +2964,7 @@
     new_trans = xaccTransReverse(trans);
 
     /* Clear transaction level info */
-    xaccTransSetDatePostedSecs (new_trans, gnc_time (NULL));
+    xaccTransSetDatePostedSecsNormalized (new_trans, gnc_time (NULL));
     xaccTransSetDateEnteredSecs (new_trans, gnc_time (NULL));
 
     qof_event_resume();
@@ -2997,7 +2997,7 @@
     qof_event_suspend();
 
     xaccTransGetDatePostedTS(trans, &entered);
-    xaccTransSetDatePostedSecs(trans, entered.tv_sec + 1);
+    xaccTransSetDatePostedSecsNormalized(trans, entered.tv_sec + 1);
 
     qof_event_resume();
 

Modified: gnucash/trunk/src/gnome/gnc-plugin-page-register2.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-register2.c	2013-06-09 21:32:06 UTC (rev 23044)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-register2.c	2013-06-09 21:33:19 UTC (rev 23045)
@@ -2818,7 +2818,7 @@
     qof_event_suspend();
 
     xaccTransGetDatePostedTS (trans, &entered);
-    xaccTransSetDatePostedSecs (trans, entered.tv_sec + 1);
+    xaccTransSetDatePostedSecsNormalized (trans, entered.tv_sec + 1);
 
     qof_event_resume();
 

Modified: gnucash/trunk/src/gnome/gnc-split-reg.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-split-reg.c	2013-06-09 21:32:06 UTC (rev 23044)
+++ gnucash/trunk/src/gnome/gnc-split-reg.c	2013-06-09 21:33:19 UTC (rev 23045)
@@ -893,7 +893,7 @@
     new_trans = xaccTransReverse(trans);
 
     /* Clear transaction level info */
-    xaccTransSetDatePostedSecs(new_trans, gnc_time (NULL));
+    xaccTransSetDatePostedSecsNormalized(new_trans, gnc_time (NULL));
     xaccTransSetDateEnteredSecs(new_trans, gnc_time (NULL));
 
     /* Now jump to new trans */
@@ -1451,7 +1451,7 @@
 
     // fill Transaction
     xaccTransSetCurrency(trans, xaccAccountGetCommodity(account));
-    xaccTransSetDatePostedSecs(trans, statement_date);
+    xaccTransSetDatePostedSecsNormalized(trans, statement_date);
     xaccTransSetDescription(trans, _("Balancing entry from reconcilation"));
 
     // 1. Split

Modified: gnucash/trunk/src/gnome/gnc-split-reg2.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-split-reg2.c	2013-06-09 21:32:06 UTC (rev 23044)
+++ gnucash/trunk/src/gnome/gnc-split-reg2.c	2013-06-09 21:33:19 UTC (rev 23045)
@@ -726,7 +726,7 @@
 
     // fill Transaction
     xaccTransSetCurrency (trans, xaccAccountGetCommodity (account));
-    xaccTransSetDatePostedSecs (trans, statement_date);
+    xaccTransSetDatePostedSecsNormalized (trans, statement_date);
     xaccTransSetDescription (trans, _("Balancing entry from reconcilation"));
 
     // 1. Split

Modified: gnucash/trunk/src/gnome-utils/dialog-account.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-account.c	2013-06-09 21:32:06 UTC (rev 23044)
+++ gnucash/trunk/src/gnome-utils/dialog-account.c	2013-06-09 21:33:19 UTC (rev 23045)
@@ -300,7 +300,7 @@
     xaccTransBeginEdit (trans);
 
     xaccTransSetCurrency (trans, xaccAccountGetCommodity (account));
-    xaccTransSetDatePostedSecs (trans, date);
+    xaccTransSetDatePostedSecsNormalized (trans, date);
     xaccTransSetDescription (trans, _("Opening Balance"));
 
     split = xaccMallocSplit (book);

Modified: gnucash/trunk/src/gnome-utils/dialog-book-close.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-book-close.c	2013-06-09 21:32:06 UTC (rev 23044)
+++ gnucash/trunk/src/gnome-utils/dialog-book-close.c	2013-06-09 21:33:19 UTC (rev 23045)
@@ -102,7 +102,7 @@
         txn->txn = xaccMallocTransaction(cacb->cbw->book);
         xaccTransBeginEdit(txn->txn);
         xaccTransSetDateEnteredSecs(txn->txn, gnc_time (NULL));
-        xaccTransSetDatePostedSecs(txn->txn, cacb->cbw->close_date);
+        xaccTransSetDatePostedSecsNormalized(txn->txn, cacb->cbw->close_date);
         xaccTransSetDescription(txn->txn, cacb->cbw->desc);
         xaccTransSetCurrency(txn->txn, cmdty);
         xaccTransSetIsClosingTxn(txn->txn, TRUE);

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-control-split-reg.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-control-split-reg.c	2013-06-09 21:32:06 UTC (rev 23044)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-control-split-reg.c	2013-06-09 21:33:19 UTC (rev 23045)
@@ -1110,7 +1110,7 @@
     xaccTransBeginEdit (new_trans);
 
     /* Clear transaction level info */
-    xaccTransSetDatePostedSecs (new_trans, gnc_time (NULL));
+    xaccTransSetDatePostedSecsNormalized (new_trans, gnc_time (NULL));
     xaccTransSetDateEnteredSecs (new_trans, gnc_time (NULL));
 
     xaccTransCommitEdit (new_trans);
@@ -1350,7 +1350,7 @@
 
         xaccTransCopyOnto (trans, new_trans);
 
-        xaccTransSetDatePostedSecs (new_trans, date);
+        xaccTransSetDatePostedSecsNormalized (new_trans, date);
 
         /* set per book option */
         gnc_set_num_action (new_trans, NULL, out_num, out_tnum);

Modified: gnucash/trunk/src/gnome-utils/gnc-tree-view-split-reg.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-tree-view-split-reg.c	2013-06-09 21:32:06 UTC (rev 23044)
+++ gnucash/trunk/src/gnome-utils/gnc-tree-view-split-reg.c	2013-06-09 21:33:19 UTC (rev 23045)
@@ -2612,7 +2612,7 @@
             //date on new transactions
 
             ts.tv_sec = gnc_time (NULL);
-            xaccTransSetDatePostedSecs (trans, ts.tv_sec);
+            xaccTransSetDatePostedSecsNormalized (trans, ts.tv_sec);
         }
     }
     LEAVE(" ");

Modified: gnucash/trunk/src/import-export/aqbanking/gnc-ab-utils.c
===================================================================
--- gnucash/trunk/src/import-export/aqbanking/gnc-ab-utils.c	2013-06-09 21:32:06 UTC (rev 23044)
+++ gnucash/trunk/src/import-export/aqbanking/gnc-ab-utils.c	2013-06-09 21:33:19 UTC (rev 23045)
@@ -493,7 +493,7 @@
             valuta_date = normal_date;
     }
     if (valuta_date)
-        xaccTransSetDatePostedSecs(gnc_trans, GWEN_Time_toTime_t(valuta_date));
+        xaccTransSetDatePostedSecsNormalized(gnc_trans, GWEN_Time_toTime_t(valuta_date));
     else
         g_warning("transaction_cb: Oops, date 'valuta_date' was NULL");
 

Modified: gnucash/trunk/src/import-export/csv-import/gnc-csv-model.c
===================================================================
--- gnucash/trunk/src/import-export/csv-import/gnc-csv-model.c	2013-06-09 21:32:06 UTC (rev 23044)
+++ gnucash/trunk/src/import-export/csv-import/gnc-csv-model.c	2013-06-09 21:33:19 UTC (rev 23045)
@@ -923,7 +923,7 @@
         switch (prop->type)
         {
         case GNC_CSV_DATE:
-            xaccTransSetDatePostedSecs(trans_line->trans, *((time64*)(prop->value)));
+            xaccTransSetDatePostedSecsNormalized(trans_line->trans, *((time64*)(prop->value)));
             break;
 
         case GNC_CSV_DESCRIPTION:

Modified: gnucash/trunk/src/import-export/import-backend.c
===================================================================
--- gnucash/trunk/src/import-export/import-backend.c	2013-06-09 21:32:06 UTC (rev 23044)
+++ gnucash/trunk/src/import-export/import-backend.c	2013-06-09 21:33:19 UTC (rev 23045)
@@ -946,7 +946,7 @@
             /*DEBUG("BeginEdit selected_match")*/
             xaccTransBeginEdit(selected_match->trans);
 
-            xaccTransSetDatePostedSecs(selected_match->trans,
+            xaccTransSetDatePostedSecsNormalized(selected_match->trans,
                                        xaccTransGetDate(xaccSplitGetParent(
                                                    gnc_import_TransInfo_get_fsplit(trans_info))));
 

Modified: gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c
===================================================================
--- gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c	2013-06-09 21:32:06 UTC (rev 23044)
+++ gnucash/trunk/src/import-export/ofx/gnc-ofx-import.c	2013-06-09 21:33:19 UTC (rev 23045)
@@ -367,16 +367,16 @@
     if (data.date_posted_valid && (data.date_posted != 0))
     {
         /* The hopeful case: We have a posted_date */
-        xaccTransSetDatePostedSecs(transaction, data.date_posted);
+        xaccTransSetDatePostedSecsNormalized(transaction, data.date_posted);
     } else if (data.date_initiated_valid && (data.date_initiated != 0))
     {
         /* No posted date? Maybe we have an initiated_date */
-        xaccTransSetDatePostedSecs(transaction, data.date_initiated);
+        xaccTransSetDatePostedSecsNormalized(transaction, data.date_initiated);
     }
     else
     {
         /* Uh no, no valid date. As a workaround use today's date */
-        xaccTransSetDatePostedSecs(transaction, current_time);
+        xaccTransSetDatePostedSecsNormalized(transaction, current_time);
     }
 
     xaccTransSetDateEnteredSecs(transaction, current_time);

Modified: gnucash/trunk/src/register/ledger-core/split-register-load.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register-load.c	2013-06-09 21:32:06 UTC (rev 23044)
+++ gnucash/trunk/src/register/ledger-core/split-register-load.c	2013-06-09 21:33:19 UTC (rev 23045)
@@ -348,7 +348,7 @@
         xaccTransBeginEdit (new_trans);
         xaccTransSetCurrency (new_trans,
                               currency ? currency : gnc_default_currency());
-        xaccTransSetDatePostedSecs (new_trans, info->last_date_entered);
+        xaccTransSetDatePostedSecsNormalized(new_trans, info->last_date_entered);
         blank_split = xaccMallocSplit (gnc_get_current_book ());
         xaccSplitSetParent(blank_split, new_trans);
         /* We don't want to commit this transaction yet, because the split

Modified: gnucash/trunk/src/register/ledger-core/split-register.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register.c	2013-06-09 21:32:06 UTC (rev 23044)
+++ gnucash/trunk/src/register/ledger-core/split-register.c	2013-06-09 21:33:19 UTC (rev 23045)
@@ -633,7 +633,7 @@
 
         xaccTransBeginEdit (new_trans);
         gnc_copy_trans_onto_trans (trans, new_trans, FALSE, FALSE);
-        xaccTransSetDatePostedSecs (new_trans, date);
+        xaccTransSetDatePostedSecsNormalized (new_trans, date);
         /* set per book option */
         gnc_set_num_action (new_trans, NULL, out_num, out_tnum);
         if (!reg->use_tran_num_for_num_field)



More information about the gnucash-changes mailing list