Skip to content

Commit

Permalink
Change all usage of xaccTransSetDatePostedSecs to xaccTransSetDatePos…
Browse files Browse the repository at this point in the history
…tedSecsNormalized.

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.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23045 57a11ea4-9604-0410-9ed3-97b8803252fd
  • Loading branch information
cstim committed Jun 9, 2013
1 parent 697d228 commit 85749ec
Show file tree
Hide file tree
Showing 17 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/app-utils/gnc-ui-util.c
Expand Up @@ -792,7 +792,7 @@ gnc_account_create_opening_balance (Account *account,
xaccTransBeginEdit (trans);

xaccTransSetCurrency (trans, xaccAccountGetCommodity (account));
xaccTransSetDatePostedSecs (trans, date);
xaccTransSetDatePostedSecsNormalized (trans, date);
xaccTransSetDescription (trans, _("Opening Balance"));

split = xaccMallocSplit (book);
Expand Down
2 changes: 1 addition & 1 deletion src/engine/SchedXaction.c
Expand Up @@ -1113,7 +1113,7 @@ xaccSchedXactionSetTemplateTrans(SchedXaction *sx, GList *t_t_list,
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 */
Expand Down
2 changes: 1 addition & 1 deletion src/gnome-utils/dialog-account.c
Expand Up @@ -300,7 +300,7 @@ gnc_account_create_transfer_balance (QofBook *book,
xaccTransBeginEdit (trans);

xaccTransSetCurrency (trans, xaccAccountGetCommodity (account));
xaccTransSetDatePostedSecs (trans, date);
xaccTransSetDatePostedSecsNormalized (trans, date);
xaccTransSetDescription (trans, _("Opening Balance"));

split = xaccMallocSplit (book);
Expand Down
2 changes: 1 addition & 1 deletion src/gnome-utils/dialog-book-close.c
Expand Up @@ -102,7 +102,7 @@ find_or_create_txn(struct CloseAccountsCB* cacb, gnc_commodity* cmdty)
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);
Expand Down
4 changes: 2 additions & 2 deletions src/gnome-utils/gnc-tree-control-split-reg.c
Expand Up @@ -1110,7 +1110,7 @@ gnc_tree_control_split_reg_reverse_current (GncTreeViewSplitReg *view)
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);
Expand Down Expand Up @@ -1350,7 +1350,7 @@ gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)

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);
Expand Down
2 changes: 1 addition & 1 deletion src/gnome-utils/gnc-tree-view-split-reg.c
Expand Up @@ -2612,7 +2612,7 @@ gtv_sr_begin_edit (GncTreeViewSplitReg *view, Split *split, Transaction *trans)
//date on new transactions

ts.tv_sec = gnc_time (NULL);
xaccTransSetDatePostedSecs (trans, ts.tv_sec);
xaccTransSetDatePostedSecsNormalized (trans, ts.tv_sec);
}
}
LEAVE(" ");
Expand Down
2 changes: 1 addition & 1 deletion src/gnome/assistant-stock-split.c
Expand Up @@ -384,7 +384,7 @@ gnc_stock_split_assistant_finish (GtkAssistant *assistant,
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;
Expand Down
4 changes: 2 additions & 2 deletions src/gnome/gnc-plugin-page-register.c
Expand Up @@ -2964,7 +2964,7 @@ gnc_plugin_page_register_cmd_reverse_transaction (GtkAction *action,
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();
Expand Down Expand Up @@ -2997,7 +2997,7 @@ gnc_plugin_page_register_cmd_shift_transaction_forward (GtkAction *action,
qof_event_suspend();

xaccTransGetDatePostedTS(trans, &entered);
xaccTransSetDatePostedSecs(trans, entered.tv_sec + 1);
xaccTransSetDatePostedSecsNormalized(trans, entered.tv_sec + 1);

qof_event_resume();

Expand Down
2 changes: 1 addition & 1 deletion src/gnome/gnc-plugin-page-register2.c
Expand Up @@ -2818,7 +2818,7 @@ gnc_plugin_page_register2_cmd_shift_transaction_forward (GtkAction *action,
qof_event_suspend();

xaccTransGetDatePostedTS (trans, &entered);
xaccTransSetDatePostedSecs (trans, entered.tv_sec + 1);
xaccTransSetDatePostedSecsNormalized (trans, entered.tv_sec + 1);

qof_event_resume();

Expand Down
4 changes: 2 additions & 2 deletions src/gnome/gnc-split-reg.c
Expand Up @@ -893,7 +893,7 @@ gsr_default_reverse_txn_handler (GNCSplitReg *gsr, gpointer data)
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 */
Expand Down Expand Up @@ -1451,7 +1451,7 @@ create_balancing_transaction(QofBook *book, Account *account,

// fill Transaction
xaccTransSetCurrency(trans, xaccAccountGetCommodity(account));
xaccTransSetDatePostedSecs(trans, statement_date);
xaccTransSetDatePostedSecsNormalized(trans, statement_date);
xaccTransSetDescription(trans, _("Balancing entry from reconcilation"));

// 1. Split
Expand Down
2 changes: 1 addition & 1 deletion src/gnome/gnc-split-reg2.c
Expand Up @@ -726,7 +726,7 @@ gsr2_create_balancing_transaction (QofBook *book, Account *account,

// fill Transaction
xaccTransSetCurrency (trans, xaccAccountGetCommodity (account));
xaccTransSetDatePostedSecs (trans, statement_date);
xaccTransSetDatePostedSecsNormalized (trans, statement_date);
xaccTransSetDescription (trans, _("Balancing entry from reconcilation"));

// 1. Split
Expand Down
2 changes: 1 addition & 1 deletion src/import-export/aqbanking/gnc-ab-utils.c
Expand Up @@ -493,7 +493,7 @@ gnc_ab_trans_to_gnc(const AB_TRANSACTION *ab_trans, Account *gnc_acc)
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");

Expand Down
2 changes: 1 addition & 1 deletion src/import-export/csv-import/gnc-csv-model.c
Expand Up @@ -923,7 +923,7 @@ static GncCsvTransLine* trans_property_list_to_trans(TransPropertyList* list, gc
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:
Expand Down
2 changes: 1 addition & 1 deletion src/import-export/import-backend.c
Expand Up @@ -946,7 +946,7 @@ gnc_import_process_trans_item (GncImportMatchMap *matchmap,
/*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))));

Expand Down
6 changes: 3 additions & 3 deletions src/import-export/ofx/gnc-ofx-import.c
Expand Up @@ -367,16 +367,16 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_u
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);
Expand Down
2 changes: 1 addition & 1 deletion src/register/ledger-core/split-register-load.c
Expand Up @@ -348,7 +348,7 @@ gnc_split_register_load (SplitRegister *reg, GList * slist,
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
Expand Down
2 changes: 1 addition & 1 deletion src/register/ledger-core/split-register.c
Expand Up @@ -633,7 +633,7 @@ gnc_split_register_duplicate_current (SplitRegister *reg)

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)
Expand Down

0 comments on commit 85749ec

Please sign in to comment.