summaryrefslogtreecommitdiffstats
path: root/kmymoney2/reports
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-01-14 14:08:52 -0600
committerSlávek Banko <slavek.banko@axis.cz>2012-06-06 03:55:18 +0200
commite8959f4b89a05d00ac29b8e9f35aedc2bae8d524 (patch)
tree39eaa1de5d1697fd769f547ef960c1d54cb27a43 /kmymoney2/reports
parent8336e7809567ac0d4b209441330a6bdfaee1bf6a (diff)
downloadkmymoney-e8959f4b89a05d00ac29b8e9f35aedc2bae8d524.tar.gz
kmymoney-e8959f4b89a05d00ac29b8e9f35aedc2bae8d524.zip
Update to upstream stable version 1.0.5
(cherry picked from commit 8654cea10f6902719006d5975db7dc07b2fcc713)
Diffstat (limited to 'kmymoney2/reports')
-rw-r--r--kmymoney2/reports/pivottable.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/kmymoney2/reports/pivottable.cpp b/kmymoney2/reports/pivottable.cpp
index db73062..b75ffb9 100644
--- a/kmymoney2/reports/pivottable.cpp
+++ b/kmymoney2/reports/pivottable.cpp
@@ -825,9 +825,27 @@ void PivotTable::calculateBudgetMapping( void )
//
// It will choose the first budget in the list for the start year of the report if no budget is select
MyMoneyBudget budget = MyMoneyBudget();
+
+ TQValueList<MyMoneyBudget> budgets = file->budgetList();
+ bool validBudget = false;
+
+ //check that the selected budget is valid
+ if (m_config_f.budget() != "Any") {
+ TQValueList<MyMoneyBudget>::const_iterator budgets_it = budgets.begin();
+ while( budgets_it != budgets.end() ) {
+ //pick the budget by id
+ if ((*budgets_it).id() == m_config_f.budget()) {
+ budget = file->budget((*budgets_it).id());
+ validBudget = true;
+ break;
+ }
+ ++budgets_it;
+ }
+ }
+
//if no budget has been selected
- if (m_config_f.budget() == "Any" ) {
- TQValueList<MyMoneyBudget> budgets = file->budgetList();
+ if (!validBudget ) {
+
TQValueList<MyMoneyBudget>::const_iterator budgets_it = budgets.begin();
while( budgets_it != budgets.end() ) {
//pick the first budget that matches the report start year
@@ -843,9 +861,6 @@ void PivotTable::calculateBudgetMapping( void )
//assign the budget to the report
m_config_f.setBudget(budget.id(), m_config_f.isIncludingBudgetActuals());
- } else {
- //pick the budget selected by the user
- budget = file->budget( m_config_f.budget());
}
// Dump the budget