https://bugs.kde.org/show_bug.cgi?id=524270

            Bug ID: 524270
           Summary: Can't delete any payee in a file that has a custom
                    report (patch included)
    Classification: Applications
           Product: kmymoney
      Version First 5.2.2
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Created attachment 195162
  --> https://bugs.kde.org/attachment.cgi?id=195162&action=edit
simple test file for reproducing the problem

KMyMoney
Version 5.2.2-ecf53d1ad

DESCRIPTION
After the recent fix to https://bugs.kde.org/show_bug.cgi?id=524131
if a file contains a report, a payee cannot be deleted without reassigning to
another even if the payee is completely unused

STEPS TO REPRODUCE
1. Open attached test file
2. Create a payee named "delete me"
3. Delete the payee just created

OBSERVED RESULT
It asks for a payee to reassign

EXPECTED RESULT
It should only ask for a reassign if the payee is used somewhere.

The following change seems to resolve the problem
diff --git a/kmymoney/views/kpayeesview_p.h b/kmymoney/views/kpayeesview_p.h
index c17e1010c..397f1268c 100644
--- a/kmymoney/views/kpayeesview_p.h
+++ b/kmymoney/views/kpayeesview_p.h
@@ -473,7 +473,9 @@ public:
             for (const auto& report : allReports) {
                 for (const MyMoneyPayee& payee : list) {
                     if (payeeInList(list, payee.id())) {
-                        usedReportIds.insert(report.id());
+                        if (report.includesPayee(payee.id())) {
+                          usedReportIds.insert(report.id());
+                       }
                         break;
                     }
                 }



Operating System: Debian GNU/Linux 13
KDE Plasma Version: 6.3.6
KDE Frameworks Version: 6.13.0
Qt Version: 6.8.2
Kernel Version: 6.12.101+deb13-amd64 (64-bit)
Graphics Platform: Wayland


ADDITIONAL INFORMATION

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to