Bug 308539

Summary: Dialog to match an imported transaction with a scheduled transaction does not give enough information.
Product: [Applications] kmymoney Reporter: Math <duloup>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: REPORTED ---    
Severity: wishlist    
Priority: NOR    
Version: 4.6.3   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Patch proposal
Show transaction details when matching transaction

Description Math 2012-10-17 09:17:00 UTC
I have many scheduled transactions with almost the same amount (ex. payee1 due the 4th: 20€, payee2 due the 4th: 21€...) and when I import transactions from my bank (OFX) it is always difficult to answer the 'Do you want KMyMoney to enter this schedule now so that the transaction can be matched?' question based only on the schedule name. I often end up with small mistakes.

In my opinion, the message should display the amount of the imported transaction and its name to give the user all the info, it needs to answer this question.

Thanks for this great program,

Reproducible: Always




Sample patch (I have not found how to attach it):

--- a/kmymoney/converter/mymoneystatementreader.cpp
+++ b/kmymoney/converter/mymoneystatementreader.cpp
@@ -1202,7 +1202,7 @@ void MyMoneyStatementReader::processTransactionEntry(const MyMoneyStatement::Tra
           // to enter the schedule and match it agains the new transaction. Otherwise, we
           // just leave the transaction as imported.
           MyMoneySchedule schedule(*(dynamic_cast<const MyMoneySchedule*>(o)));
-          if (KMessageBox::questionYesNo(0, QString("<qt>%1</qt>").arg(i18n("KMyMoney has found a scheduled transaction named <b>%1</b> which matches an imported transaction. Do you want KMyMoney to enter this schedule now so that the transaction can be matched? ", schedule.name())), i18n("Schedule found")) == KMessageBox::Yes) {
+          if (KMessageBox::questionYesNo(0, QString("<qt>%1</qt>").arg(i18n("KMyMoney has found a scheduled transaction named <b>%1</b> which matches an imported transaction (name: <b>%2</b>, amount: <b>%3</b>). Do you want KMyMoney to enter this schedule now so that the transaction can be matched? ", schedule.name(), t_in.m_strPayee, t_in.m_amount.toDouble()), i18n("Schedule found"))) == KMessageBox::Yes) {
 #ifdef Q_OS_WIN32                   //krazy:exclude=cpp
             // reset the input context on Windows or else we'll have a crash here caused by an invalid focus widget in the input context
             qApp->setInputContext(QInputContextFactory::create(qApp->inputContext()->identifierName(), qApp));
Comment 1 Math 2012-10-17 09:20:20 UTC
Created attachment 74593 [details]
Patch proposal

Patch tested on the 4.6.3 branch.
Comment 2 Thomas Baumgart 2012-10-17 12:38:47 UTC
Created attachment 74597 [details]
Show transaction details when matching transaction

Improved handling of currency symbol and precision of amount display. Can you verify that it works for you?
Comment 3 Math 2012-10-17 13:41:35 UTC
Tested. It does not work. It crashes KMM...

Output:
---------
...
Found 0 transaction
Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.

terminate called after throwing an instance of 'std::bad_cast'
  what():  std::bad_cast
KCrash: Application 'kmymoney' crashing...
KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
sock_file=/home/test/.kde/socket-test-VirtualBox/kdeinit4__0

Backtrace (not sure if it is useful):
-------------------------------------------------
Breakpoint 2, 0xb5ba07d0 in __cxa_rethrow () from /usr/lib/i386-linux-gnu/libstdc++.so.6

Thread 4 (Thread 0xb23f9b40 (LWP 4375)):
#0  0xb7fdd416 in __kernel_vsyscall ()
#1  0xb5a415f0 in poll () from /lib/i386-linux-gnu/libc.so.6
#2  0xb4f5574b in g_poll () from /lib/i386-linux-gnu/libglib-2.0.so.0
#3  0xb4f46d00 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#4  0xb4f46e61 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
#5  0xb693a99f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/i386-linux-gnu/libQtCore.so.4
#6  0xb690726c in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/i386-linux-gnu/libQtCore.so.4
#7  0xb6907561 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/i386-linux-gnu/libQtCore.so.4
#8  0xb67f266c in QThread::exec() () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#9  0xb68e57bd in ?? () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#10 0xb67f5a58 in ?? () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#11 0xb705ad4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#12 0xb5a4fd3e in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 3 (Thread 0xb19ffb40 (LWP 4364)):
#0  0xb7fdd416 in __kernel_vsyscall ()
#1  0xb5a415f0 in poll () from /lib/i386-linux-gnu/libc.so.6
#2  0xb4f5574b in g_poll () from /lib/i386-linux-gnu/libglib-2.0.so.0
#3  0xb4f46d00 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#4  0xb4f471db in g_main_loop_run () from /lib/i386-linux-gnu/libglib-2.0.so.0
#5  0xb2d77aba in ?? () from /usr/lib/i386-linux-gnu/libgio-2.0.so.0
#6  0xb4f6c303 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#7  0xb705ad4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#8  0xb5a4fd3e in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 1 (Thread 0xb457f980 (LWP 4358)):
#0  0xb5ba07d0 in __cxa_rethrow () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#1  0xb691ef8a in QObject::event(QEvent*) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#2  0xb5d73485 in QAction::event(QEvent*) () from /usr/lib/i386-linux-gnu/libQtGui.so.4
#3  0xb739ac39 in KAction::event(QEvent*) () from /usr/lib/libkdeui.so.5
#4  0xb5d7a39c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /usr/lib/i386-linux-gnu/libQtGui.so.4
#5  0xb5d7edaf in QApplication::notify(QObject*, QEvent*) () from /usr/lib/i386-linux-gnu/libQtGui.so.4
#6  0xb7492e91 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#7  0xb690878e in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
   from /usr/lib/i386-linux-gnu/libQtCore.so.4
#8  0xb690c97d in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) ()
   from /usr/lib/i386-linux-gnu/libQtCore.so.4
#9  0xb690cc0c in QCoreApplication::sendPostedEvents(QObject*, int) ()
   from /usr/lib/i386-linux-gnu/libQtCore.so.4
#10 0xb693a804 in ?? () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#11 0xb4f469e3 in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0
#12 0xb4f46d80 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#13 0xb4f46e61 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
#14 0xb693a981 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/i386-linux-gnu/libQtCore.so.4
#15 0xb5e309aa in ?? () from /usr/lib/i386-linux-gnu/libQtGui.so.4
#16 0xb690726c in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/i386-linux-gnu/libQtCore.so.4
#17 0xb6907561 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/i386-linux-gnu/libQtCore.so.4
#18 0xb690ccba in QCoreApplication::exec() () from /usr/lib/i386-linux-gnu/libQtCore.so.4
#19 0xb5d77fc4 in QApplication::exec() () from /usr/lib/i386-linux-gnu/libQtGui.so.4
#20 0x0808a400 in runKMyMoney (splash=0x87f8038, a=<optimized out>)
    at /home/test/kmymoney/kmymoney/main.cpp:282
#21 0x08088951 in main (argc=1, argv=0xbffff334) at /home/test/kmymoney/kmymoney/main.cpp:181