gnucash maint: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Tue Jun 26 19:22:07 EDT 2018
Updated via https://github.com/Gnucash/gnucash/commit/f7ed46a3 (commit)
via https://github.com/Gnucash/gnucash/commit/4e04f6e5 (commit)
via https://github.com/Gnucash/gnucash/commit/8de1625d (commit)
from https://github.com/Gnucash/gnucash/commit/60117491 (commit)
commit f7ed46a35b15b84190b8f0f456a7c27dddd3b2a1
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Jun 26 15:04:23 2018 -0700
Bug 796248 - Editing Scheduled Transaction, take 2.
In addition to not begining to edit already-loaded transactions,
don't try to load splits that are already loaded. It shouldn't
be possible to load a transaction without also loading its splits.
diff --git a/libgnucash/backend/sql/gnc-transaction-sql.cpp b/libgnucash/backend/sql/gnc-transaction-sql.cpp
index f2e2b1f..df1c950 100644
--- a/libgnucash/backend/sql/gnc-transaction-sql.cpp
+++ b/libgnucash/backend/sql/gnc-transaction-sql.cpp
@@ -225,16 +225,11 @@ load_single_split (GncSqlBackend* sql_be, GncSqlRow& row)
pSplit = xaccSplitLookup (&split_guid, sql_be->book());
}
- if (pSplit == NULL)
- {
- pSplit = xaccMallocSplit (sql_be->book());
- }
+ if (pSplit)
+ return pSplit; //Already loaded, nothing to do.
- /* If the split is dirty, don't overwrite it */
- if (!qof_instance_is_dirty (QOF_INSTANCE (pSplit)))
- {
- gnc_sql_load_object (sql_be, row, GNC_ID_SPLIT, pSplit, split_col_table);
- }
+ pSplit = xaccMallocSplit (sql_be->book());
+ gnc_sql_load_object (sql_be, row, GNC_ID_SPLIT, pSplit, split_col_table);
/*# -ifempty */
if (pSplit != xaccSplitLookup (&split_guid, sql_be->book()))
@@ -272,7 +267,7 @@ load_splits_for_transactions (GncSqlBackend* sql_be, std::string selector)
auto result = sql_be->execute_select_statement (stmt);
for (auto row : *result)
- Split* s = load_single_split (sql_be, row);
+ load_single_split (sql_be, row);
sql = "SELECT DISTINCT ";
sql += spkey + " FROM " SPLIT_TABLE " WHERE " + sskey + " IN " + selector;
gnc_sql_slots_load_for_sql_subquery(sql_be, sql,
@@ -292,14 +287,9 @@ load_single_tx (GncSqlBackend* sql_be, GncSqlRow& row)
if (guid == NULL) return NULL;
tx_guid = *guid;
- // Don't overwrite the transaction if it's already been loaded (and possibly modified).
- // However increase the edit level, it may be modified while loading its splits
pTx = xaccTransLookup (&tx_guid, sql_be->book());
- if (pTx != NULL)
- {
- xaccTransBeginEdit (pTx);
- return NULL;
- }
+ if (pTx)
+ return nullptr; // Nothing to do.
pTx = xaccMallocTransaction (sql_be->book());
xaccTransBeginEdit (pTx);
commit 4e04f6e51df0dc9f09366f3371def090a26fa5f0
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Jun 26 15:00:51 2018 -0700
Don't warn about an invalid date if it's just an empty column.
diff --git a/libgnucash/backend/sql/gnc-sql-column-table-entry.cpp b/libgnucash/backend/sql/gnc-sql-column-table-entry.cpp
index 63a4f7a..6daed1d 100644
--- a/libgnucash/backend/sql/gnc-sql-column-table-entry.cpp
+++ b/libgnucash/backend/sql/gnc-sql-column-table-entry.cpp
@@ -399,10 +399,14 @@ GncSqlColumnTableEntryImpl<CT_TIMESPEC>::load (const GncSqlBackend* sql_be,
GncDateTime time(val);
ts.tv_sec = static_cast<time64>(time);
}
- catch (std::invalid_argument&)
+ catch (const std::invalid_argument& err)
{
- PWARN("An invalid date was found in your database."
- "It has been set to 1 January 1970.");
+ if (strcmp(err.what(), "Column empty.") != 0)
+ {
+ auto val = row.get_string_at_col(m_col_name);
+ PWARN("An invalid date %s was found in your database."
+ "It has been set to 1 January 1970.", val.c_str());
+ }
ts.tv_sec = 0;
}
}
commit 8de1625db8e46a5c38f25f80ee69c68a16919e76
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Jun 26 10:19:53 2018 -0700
Remove duplicate declaration.
diff --git a/gnucash/gnome/gnc-split-reg.h b/gnucash/gnome/gnc-split-reg.h
index 37bea97..018836f 100644
--- a/gnucash/gnome/gnc-split-reg.h
+++ b/gnucash/gnome/gnc-split-reg.h
@@ -249,7 +249,6 @@ void gnc_split_reg_focus_on_sheet (GNCSplitReg *gsr);
void gnc_split_reg_balancing_entry (GNCSplitReg *gsr, Account *account,
time64 statement_date, gnc_numeric balancing_amount);
-void gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data );
void gsr_default_associate_handler (GNCSplitReg *gsr, gboolean uri_is_file);
void gsr_default_execassociated_handler( GNCSplitReg *gsr, gpointer data );
void gnc_split_reg_enter( GNCSplitReg *gsr, gboolean next_transaction );
Summary of changes:
gnucash/gnome/gnc-split-reg.h | 1 -
.../backend/sql/gnc-sql-column-table-entry.cpp | 10 ++++++---
libgnucash/backend/sql/gnc-transaction-sql.cpp | 24 +++++++---------------
3 files changed, 14 insertions(+), 21 deletions(-)
More information about the gnucash-changes
mailing list