Skip to content

Commit

Permalink
[import-main-matcher.cpp] warning if recn_date < trans_date
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherlam committed Mar 30, 2024
1 parent 364af37 commit a33acc3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions gnucash/import-export/import-main-matcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <memory>
#include <algorithm>
#include <vector>
#include <optional>

#include "import-main-matcher.h"

Expand Down Expand Up @@ -1909,6 +1910,20 @@ get_peer_acct_names (Split *split)
return retval;
}

static std::optional<time64>
acct_get_recndate (const Account* acc)
{
time64 recn_date;
if (xaccAccountGetReconcileLastDate (acc, &recn_date))
return recn_date;
else
return {};
}

const char* recn_date_warning = N_("The import date is earlier than reconcile date. \
Further reconciliation may be difficult");


static void
refresh_model_row (GNCImportMainMatcher *gui,
GtkTreeModel *model,
Expand Down Expand Up @@ -2028,6 +2043,13 @@ refresh_model_row (GNCImportMainMatcher *gui,
imbalance, acct_full_name);

}
if (auto recn_date = acct_get_recndate (dest_acc);
recn_date && date < *recn_date)
{
auto newtext = g_strdup_printf ("%s %s", text, _(recn_date_warning));
g_free (text);
text = newtext;
}

g_free (acct_full_name);
}
Expand Down

0 comments on commit a33acc3

Please sign in to comment.