Fix 'Ledger search box doesn't support account hierarchy character ":"'
ClosedPublic

Authored by habacker on Nov 14 2017, 8:37 PM.

Diff Detail

Repository
R261 KMyMoney
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
habacker created this revision.Nov 14 2017, 8:37 PM
habacker added inline comments.Nov 15 2017, 4:01 AM
kmymoney/widgets/transaction.cpp
711

After rethinking about this implementation I guess entering a filter with ':' is only be applicable to the account hierarchy and not to any other split or transaction detail.
It would probably be better to implement this as shown by the following pseudo code:

for iterating through splits

  if (filter text contains(':')) {
     search for account hierarchy
 } else {
     search in all other transaction details
}

Can anyone confirm ?

wojnilowicz added inline comments.
kmymoney/widgets/transaction.cpp
719

What if "MyMoneyAccount current = acc;" is not the standard account from the beginning?

This revision was automatically updated to reflect the committed changes.
habacker reopened this revision.Jan 20 2018, 11:35 PM
tbaumgart added inline comments.
kmymoney/widgets/transaction.cpp
711

You should use MyMoneyFile::AccountSeparator instead of the colon character. It is used in all other locations.

719

Isn't the question what would happen if acc is a standard account from the beginning more interesting here? I don't know if that could happen, but usually if called with acc being an account somewhere in the hierarchy going upward always ends with a standard account sometime. If not, we have a real problem.

720

Use MyMoneyFile::AccountSeparator here also.

habacker updated this revision to Diff 27047.Feb 13 2018, 10:50 AM
  • use MyMoneyFile::AccountSeparator
habacker updated this revision to Diff 28317.Mar 1 2018, 11:25 AM
  • fix variable name spelling
tbaumgart added inline comments.Mar 1 2018, 1:02 PM
kmymoney/widgets/transaction.cpp
711

Not sure, but I do have things like "EREF: xxxxx" in my memo field which I could search for.

  • fix variable name spelling

In fact you broke it. See https://www.dict.cc/?s=separator It might be broken in other spots of the 4.8 branch as well. Then they should also be fixed.

habacker updated this revision to Diff 28329.Mar 1 2018, 3:22 PM
habacker marked 5 inline comments as done.
  • rebased
  • add an additional guard to make sure that loop is not endless
habacker marked an inline comment as done.Mar 1 2018, 3:37 PM
habacker added inline comments.
kmymoney/widgets/transaction.cpp
711

Then it should be as currently implemented with this patch

719

added additional guard

habacker marked 3 inline comments as done.Mar 1 2018, 3:38 PM
tbaumgart accepted this revision as: tbaumgart.Mar 2 2018, 7:24 AM
This revision is now accepted and ready to land.Mar 2 2018, 7:24 AM
This revision was automatically updated to reflect the committed changes.
  • fix variable name spelling

In fact you broke it. See https://www.dict.cc/?s=separator It might be broken in other spots of the 4.8 branch as well. Then they should also be fixed.

The incorrect spelling has been imported 2009 from kmymoney2 sources, see https://phabricator.kde.org/R261:e5a82fdf7e350f7e00a9aca38456f09bad878ca7