Revert "Bug 797648 - Fix problem reconciling multiple splits in a transaction"

This reverts commit dd589060a3.
This commit is contained in:
goodvibes2 committed 2020-05-02 16:11:50 +10:00
1 parent 4759453356
commit 327544e6c0
1 file changed
+9 -47
+9 -47
View File
@@ -501,43 +501,8 @@ gnc_reconcile_view_class_init (GNCReconcileViewClass *klass)
}
static gboolean
gnc_reconcile_view_toggle_split (GNCReconcileView *view, Split *split)
{
Split *current;
g_return_val_if_fail (GNC_IS_RECONCILE_VIEW (view), FALSE);
g_return_val_if_fail (view->reconciled != NULL, FALSE);
current = g_hash_table_lookup (view->reconciled, split);
if (current == NULL)
{
g_hash_table_insert (view->reconciled, split, split);
return TRUE;
}
else
{
g_hash_table_remove (view->reconciled, split);
return FALSE;
}
}
/*****************************************************************************\
* gnc_reconcile_view_rec_or_unrec_split *
* insert or remove a child split from the list of splits to be reconciled *
* (view->reconciled) so that all other splits in the same transaction *
* for the account being reconciled (including children), are the same *
* reconciliation state as the split that has been toggled *
* *
* Args: view - the view to use *
* split - the split to be inserted or removed *
* reconcile - TRUE=insert, FALSE=remove *
* Returns: void *
\*****************************************************************************/
static void
gnc_reconcile_view_rec_or_unrec_split (GNCReconcileView *view, Split *split, gboolean reconcile)
gnc_reconcile_view_toggle_split (GNCReconcileView *view, Split *split)
{
Split *current;
@@ -546,15 +511,15 @@ gnc_reconcile_view_rec_or_unrec_split (GNCReconcileView *view, Split *split, gbo
current = g_hash_table_lookup (view->reconciled, split);
if (current == NULL && reconcile)
if (current == NULL)
g_hash_table_insert (view->reconciled, split, split);
if ((current != NULL) && (!reconcile))
else
g_hash_table_remove (view->reconciled, split);
}
static void
gnc_reconcile_view_toggle_children (Account *account, GNCReconcileView *view, Split *split, gboolean reconcile)
gnc_reconcile_view_toggle_children (Account *account, GNCReconcileView *view, Split *split)
{
GList *child_accounts, *node;
Transaction *transaction;
@@ -564,8 +529,7 @@ gnc_reconcile_view_toggle_children (Account *account, GNCReconcileView *view, Sp
* in the same hierarchy as the account being reconciled (not necessarily
* the account this split is from.)
*
* For each of these splits set them to the same state as the split whose
* checkbox was toggled.
* For each of these splits toggle them all to the same state.
*/
child_accounts = gnc_account_get_descendants (account);
child_accounts = g_list_prepend (child_accounts, account);
@@ -614,8 +578,7 @@ gnc_reconcile_view_toggle_children (Account *account, GNCReconcileView *view, Sp
{
gboolean toggled;
gtk_tree_model_get (model, &iter, REC_RECN, &toggled, -1);
if (toggled != reconcile)
gtk_list_store_set (GTK_LIST_STORE (model), &iter, REC_RECN, reconcile, -1);
gtk_list_store_set (GTK_LIST_STORE (model), &iter, REC_RECN, !toggled, -1);
break;
}
@@ -623,7 +586,7 @@ gnc_reconcile_view_toggle_children (Account *account, GNCReconcileView *view, Sp
}
/* ...and toggle its reconciled state in the internal hash */
gnc_reconcile_view_rec_or_unrec_split (current_view, other_split, reconcile);
gnc_reconcile_view_toggle_split (current_view, other_split);
}
g_list_free (child_accounts);
}
@@ -633,16 +596,15 @@ static void
gnc_reconcile_view_toggle (GNCReconcileView *view, Split *split)
{
gboolean include_children;
gboolean is_reconciled;
g_return_if_fail (GNC_IS_RECONCILE_VIEW (view));
g_return_if_fail (view->reconciled != NULL);
is_reconciled = gnc_reconcile_view_toggle_split (view, split);
gnc_reconcile_view_toggle_split (view, split);
include_children = xaccAccountGetReconcileChildrenStatus (view->account);
if (include_children)
gnc_reconcile_view_toggle_children (view->account, view, split, is_reconciled);
gnc_reconcile_view_toggle_children (view->account, view, split);
g_signal_emit (G_OBJECT (view),
reconcile_view_signals[TOGGLE_RECONCILED], 0, split);