summaryrefslogtreecommitdiffstats
path: root/redhat/applications/kmymoney/kmymoney-3.5.13-update_to_1.0.5.patch
blob: 7aefe2026b7448b794a113339ae93b065a3caa69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
commit 8654cea10f6902719006d5975db7dc07b2fcc713
Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>
Date:   1326571732 -0600

    Update to upstream stable version 1.0.5

diff --git a/ChangeLog b/ChangeLog
index d250496..c996acb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,40 @@
 
+2010-05-15 Thomas Baumgart <ipwizard@users.sourceforge.net>
+  * Released 1.0.5
+
+2010-05-12 Thomas Baumgart <ipwizard@users.sourceforge.net>
+  * Fixed the way to calculate balance variation for the linear regression
+    forecast method (backported from KDE4)
+
+2010-05-09 Alvaro Soliverez <asoliverez@gmail.com>
+  * Fixed a crash when a budget selected for a report is no longer present
+
+2010-05-04 Thomas Baumgart <ipwizard@users.sourceforge.net>
+  * replace all new line characters because we only have one line
+    available for the displayed data (backported from KDE4)
+  * Don't allow import of investment transactions that don't have a share
+    amount. This used to end in a div by zero when calculating the price.
+    (Backported from KDE4)
+
+2010-05-03 Alvaro Soliverez <asoliverez@gmail.com>
+  * Add all overdue schedules when calculating forecast
+  * Do not show accounts of institutions if it has been selected
+    in the general settings to Do not show closed accounts
+  * Do not show an institution if it has no visible accounts and
+    it has been selected to not show closed accounts
+
+2010-04-20 Thomas Baumgart <ipwizard@users.sourceforge.net>
+  * Backported fix from Ian Neal to solve problems when opening the ledger
+    with specific scheduled transactions
+
+2010-04-03 Alvaro Soliverez <asoliverez@gmail.com>
+  * Fixed loop in payments of the home page when a schedule is set to
+    end by date
+
 2010-03-30 Thomas Baumgart <ipwizard@users.sourceforge.net>
   * Backported encoding patch from KDE4 version
   * Bumped version number
+  * Released 1.0.4
 
 2010-03-29 Thomas Baumgart <ipwizard@users.sourceforge.net>
   * Updated Finnish translation by Mikael Kujanpaa
diff --git a/configure.in b/configure.in
index 8a6c1b8..1a8dd02 100644
--- a/configure.in
+++ b/configure.in
@@ -40,7 +40,7 @@ dnl Perform program name transformation
 AC_ARG_PROGRAM
 
 dnl Automake doc recommends to do this only here. (Janos)
-AM_INIT_AUTOMAKE(kmymoney2, 1.0.4) dnl searches for some needed programs
+AM_INIT_AUTOMAKE(kmymoney2, 1.0.5) dnl searches for some needed programs
 
 KDE_SET_PREFIX
 
diff --git a/configure.in.in b/configure.in.in
index 3f82103..a90f40f 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -1,6 +1,6 @@
 #MIN_CONFIG(3.3.1)
 
-AM_INIT_AUTOMAKE(kmymoney2,1.0.4)
+AM_INIT_AUTOMAKE(kmymoney2,1.0.5)
 
 KDE_ENABLE_HIDDEN_VISIBILITY
 
diff --git a/kmymoney2/converter/mymoneystatementreader.cpp b/kmymoney2/converter/mymoneystatementreader.cpp
index 6756767..c08dcff 100644
--- a/kmymoney2/converter/mymoneystatementreader.cpp
+++ b/kmymoney2/converter/mymoneystatementreader.cpp
@@ -664,6 +664,10 @@ void MyMoneyStatementReader::processTransactionEntry(const MyMoneyStatement::Tra
       if(!t_in.m_price.isZero()) {
         s1.setPrice(t_in.m_price);
       } else {
+        if(t_in.m_shares.isZero()) {
+          KMessageBox::information(0, i18n("This imported statement contains investment transactions with no share amount.  These transactions will be ignored."), i18n("No share amount provided"), TQString("BlankAmount"));
+          return;
+        }
         s1.setPrice(((t_in.m_amount - t_in.m_fees) / t_in.m_shares).convert(MyMoneyMoney::precToDenom(KMyMoneyGlobalSettings::pricePrecision())));
       }
 
diff --git a/kmymoney2/mymoney/mymoneyforecast.cpp b/kmymoney2/mymoney/mymoneyforecast.cpp
index bfecce0..c1c88c7 100644
--- a/kmymoney2/mymoney/mymoneyforecast.cpp
+++ b/kmymoney2/mymoney/mymoneyforecast.cpp
@@ -651,7 +651,7 @@ void MyMoneyForecast::addScheduledTransactions (void)
   TQValueList<MyMoneySchedule> schedule;
 
   schedule = file->scheduleList("", MyMoneySchedule::TYPE_ANY, MyMoneySchedule::OCCUR_ANY, MyMoneySchedule::STYPE_ANY,
-                                TQDate::tqcurrentDate(), forecastEndDate());
+                                TQDate(), forecastEndDate());
   if(schedule.count() > 0) {
     TQValueList<MyMoneySchedule>::Iterator it;
     do {
@@ -871,8 +871,21 @@ MyMoneyMoney MyMoneyForecast::accountCycleVariation(const MyMoneyAccount& acc)
   MyMoneyMoney cycleVariation;
 
   if (forecastMethod() == eHistoric) {
-    for(int t_day = 1; t_day <= accountsCycle() ; ++t_day) {
-      cycleVariation += m_accountTrendList[acc.id()][t_day];
+    switch(historyMethod()) {
+      case 0:
+      case 1:
+        {
+          for(int t_day = 1; t_day <= accountsCycle() ; ++t_day) {
+            cycleVariation += m_accountTrendList[acc.id()][t_day];
+          }
+        }
+        break;
+
+      case 2:
+        {
+          cycleVariation = m_accountList[acc.id()][TQDate::currentDate().addDays(accountsCycle())] - m_accountList[acc.id()][TQDate::currentDate()];
+        }
+        break;
     }
   }
   return cycleVariation;
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
diff --git a/kmymoney2/views/kgloballedgerview.cpp b/kmymoney2/views/kgloballedgerview.cpp
index 8209d3f..e82459a 100644
--- a/kmymoney2/views/kgloballedgerview.cpp
+++ b/kmymoney2/views/kgloballedgerview.cpp
@@ -485,7 +485,12 @@ void KGlobalLedgerView::loadView(void)
             break;
 
           // for all others, we check if the next payment date is still 'in range'
-          s.setNextDueDate(s.nextPayment(s.nextDueDate()));
+          TQDate nextDueDate = s.nextPayment(s.nextDueDate());
+          if (nextDueDate.isValid()) {
+            s.setNextDueDate(nextDueDate);
+          } else {
+            break;
+          }
         }
         scheduleList.pop_front();
       }
diff --git a/kmymoney2/views/khomeview.cpp b/kmymoney2/views/khomeview.cpp
index 60bb173..8745d64 100644
--- a/kmymoney2/views/khomeview.cpp
+++ b/kmymoney2/views/khomeview.cpp
@@ -595,6 +595,13 @@ void KHomeView::showPayments(void)
           schedule.remove(it);
           continue;
         }
+        
+        //if nextPayment returns an invalid date, setNextDueDate will just skip it, resulting in a loop
+        //we check the resulting date and erase the schedule if invalid
+        if(!((*it).nextPayment((*it).nextDueDate())).isValid()) {
+          schedule.remove(it);
+          continue;
+        }
 
         (*it).setNextDueDate((*it).nextPayment((*it).nextDueDate()));
         qBubbleSort(schedule);
diff --git a/kmymoney2/views/kinstitutionsview.cpp b/kmymoney2/views/kinstitutionsview.cpp
index 0b9258f..87c0fc1 100644
--- a/kmymoney2/views/kinstitutionsview.cpp
+++ b/kmymoney2/views/kinstitutionsview.cpp
@@ -161,6 +161,9 @@ void KInstitutionsView::loadAccounts(void)
 
     // hide it, if unused
     noInstitutionItem->setVisible(noInstitutionItem->childCount() != 0);
+    
+    bool showClosedAccounts = kmymoney2->toggleAction("view_show_all_accounts")->isChecked()
+      || !KMyMoneyGlobalSettings::hideClosedAccounts();
 
     TQValueList<MyMoneyInstitution> list = file->institutionList();
     TQValueList<MyMoneyInstitution>::const_iterator it_i;
@@ -168,6 +171,8 @@ void KInstitutionsView::loadAccounts(void)
       KMyMoneyAccountTreeItem* item = new KMyMoneyAccountTreeItem(m_accountTree, *it_i);
       item->setPixmap(0, none.pixmap());
       loadSubAccounts(item, (*it_i).id());
+      if(!showClosedAccounts)
+        item->setVisible(item->childCount() != 0);
     }
 
   } catch(MyMoneyException *e) {
@@ -201,7 +206,8 @@ void KInstitutionsView::loadAccounts(void)
 
 void KInstitutionsView::loadSubAccounts(KMyMoneyAccountTreeItem* parent)
 {
-  bool showClosedAccounts = kmymoney2->toggleAction("view_show_all_accounts")->isChecked();
+  bool showClosedAccounts = kmymoney2->toggleAction("view_show_all_accounts")->isChecked()
+      || !KMyMoneyGlobalSettings::hideClosedAccounts();
   const MyMoneyAccount& account = dynamic_cast<const MyMoneyAccount&>(parent->itemObject());
   TQValueList<TQString>::const_iterator it_a;
   MyMoneyFile* file = MyMoneyFile::instance();
@@ -230,7 +236,8 @@ void KInstitutionsView::loadSubAccounts(KMyMoneyAccountTreeItem* parent, const T
 
   TQMap<TQString, MyMoneyAccount>::const_iterator it_a;
   MyMoneyMoney  value;
-  bool showClosedAccounts = kmymoney2->toggleAction("view_show_all_accounts")->isChecked();
+  bool showClosedAccounts = kmymoney2->toggleAction("view_show_all_accounts")->isChecked()
+      || !KMyMoneyGlobalSettings::hideClosedAccounts();
 
   for(it_a = m_accountMap.begin(); it_a != m_accountMap.end(); ++it_a) {
     const MyMoneyAccount& acc = *it_a;
diff --git a/kmymoney2/widgets/stdtransactionmatched.cpp b/kmymoney2/widgets/stdtransactionmatched.cpp
index 833c88e..9900c3c 100644
--- a/kmymoney2/widgets/stdtransactionmatched.cpp
+++ b/kmymoney2/widgets/stdtransactionmatched.cpp
@@ -179,6 +179,8 @@
                 memo = memo.left(pos);
                 if(memo.endsWith("\n"))
                   memo = memo.left(pos-1);
+                // replace all new line characters because we only have one line available for the displayed data
+                memo.replace('\n', " ");
               }
             }
             txt = TQString("%1 %2").tqarg(postDate.toString(Qt::ISODate)).tqarg(memo);