Bug 792157 - Cannot create account with different currency

Restore force-insert logic that had gotten lost in the C++ conversion.
This commit is contained in:
John Ralls 2018-02-20 17:32:22 -08:00
parent c58b0024c5
commit a4399ee732
2 changed files with 4 additions and 2 deletions

View File

@ -217,8 +217,8 @@ GncSqlCommodityBackend::commit (GncSqlBackend* sql_be, QofInstance* inst)
g_return_val_if_fail (sql_be != NULL, FALSE);
g_return_val_if_fail (inst != NULL, FALSE);
g_return_val_if_fail (GNC_IS_COMMODITY (inst), FALSE);
return do_commit_commodity (sql_be, inst, FALSE);
auto in_be = instance_in_db(sql_be, inst);
return do_commit_commodity (sql_be, inst, !in_be);
}
/* ----------------------------------------------------------------- */

View File

@ -811,6 +811,8 @@ GncSqlBackend::object_in_db (const char* table_name, QofIdTypeConst obj_name,
/* WHERE */
PairVec values{get_object_values(obj_name, pObject, table)};
/* We want only the first item in the table, which should be the PK. */
values.resize(1);
stmt->add_where_cond(obj_name, values);
auto result = execute_select_statement (stmt);
return (result != nullptr && result->size() > 0);