Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
KMyMoney
Manage
Activity
Members
Labels
Plan
Issues
41
Issue boards
Milestones
Wiki
Code
Merge requests
8
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Office
KMyMoney
Commits
81d6396a
Commit
81d6396a
authored
12 years ago
by
Allan Anderson
Browse files
Options
Downloads
Patches
Plain Diff
BUG:308247. Improve handling of invalid splits.
parent
f835c2cc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kmymoney/converter/mymoneyqifreader.cpp
+31
-17
31 additions, 17 deletions
kmymoney/converter/mymoneyqifreader.cpp
kmymoney/converter/mymoneyqifreader.h
+1
-2
1 addition, 2 deletions
kmymoney/converter/mymoneyqifreader.h
with
32 additions
and
19 deletions
kmymoney/converter/mymoneyqifreader.cpp
+
31
−
17
View file @
81d6396a
...
...
@@ -730,27 +730,44 @@ const QString MyMoneyQifReader::extractLine(const QChar& id, int cnt)
return
QString
();
}
void
MyMoneyQifReader
::
extractSplits
(
QList
<
qSplit
>&
listqSplits
)
const
bool
MyMoneyQifReader
::
extractSplits
(
QList
<
qSplit
>&
listqSplits
)
const
{
// *** With apologies to QString MyMoneyQifReader::extractLine ***
QStringList
::
ConstIterator
it
;
bool
ret
=
false
;
bool
memoPresent
=
false
;
int
neededCount
=
0
;
qSplit
q
;
for
(
it
=
m_qifEntry
.
constBegin
();
it
!=
m_qifEntry
.
constEnd
();
++
it
)
{
if
((
*
it
)[
0
]
==
'S'
)
{
qSplit
q
;
q
.
m_strCategoryName
=
(
*
it
++
).
mid
(
1
);
// 'S'
if
(((
*
it
)[
0
]
==
'S'
)
||
((
*
it
)[
0
]
==
'$'
)
||
((
*
it
)[
0
]
==
'E'
))
{
memoPresent
=
false
;
// in case no memo line in this split
if
((
*
it
)[
0
]
==
'E'
)
{
q
.
m_strMemo
=
(
*
it
++
).
mid
(
1
);
// 'E'
q
.
m_strMemo
=
(
*
it
).
mid
(
1
);
//
'E'
= Memo
d
->
fixMultiLineMemo
(
q
.
m_strMemo
);
memoPresent
=
true
;
// This transaction contains memo
}
else
if
((
*
it
)[
0
]
==
'S'
)
{
q
.
m_strCategoryName
=
(
*
it
).
mid
(
1
);
// 'S' = CategoryName
neededCount
++
;
}
else
if
((
*
it
)[
0
]
==
'$'
)
{
q
.
m_amount
=
(
*
it
).
mid
(
1
);
// '$' = Amount
neededCount
++
;
}
if
((
*
it
)[
0
]
==
'$'
)
{
q
.
m_amount
=
(
*
it
).
mid
(
1
);
// '$'
if
(
neededCount
>
1
)
{
// CategoryName & Amount essential
listqSplits
+=
q
;
// Add valid split
if
(
!
memoPresent
)
{
// If no memo, clear previous
q
.
m_strMemo
.
clear
();
}
qSplit
q
;
// Start new split
neededCount
=
0
;
ret
=
true
;
}
listqSplits
+=
q
;
}
}
return
ret
;
}
#if 0
void MyMoneyQifReader::processMSAccountEntry(const MyMoneyAccount::accountTypeE accountType)
{
...
...
@@ -1131,7 +1148,11 @@ void MyMoneyQifReader::processTransactionEntry(void)
s1
.
m_strMemo
=
tr
.
m_strMemo
;
// tr.m_listSplits.append(s1);
if
(
extractLine
(
'$'
).
isEmpty
())
{
// split transaction
// ****** ensure each field is ******
// * attached to correct split *
QList
<
qSplit
>
listqSplits
;
if
(
!
extractSplits
(
listqSplits
))
{
MyMoneyAccount
account
;
// use the same values for the second split, but clear the ID and reverse the value
MyMoneyStatement
::
Split
s2
=
s1
;
...
...
@@ -1184,14 +1205,8 @@ void MyMoneyQifReader::processTransactionEntry(void)
}
}
else
{
// split transaction
QList
<
qSplit
>
listqSplits
;
extractSplits
(
listqSplits
);
// ****** ensure each field is ******
// * attached to correct split *
int
count
;
for
(
count
=
1
;
!
extractLine
(
'$'
,
count
).
isEmpty
();
++
count
)
{
for
(
count
=
1
;
count
<=
listqSplits
.
count
();
++
count
)
{
// Use true splits count
MyMoneyStatement
::
Split
s2
=
s1
;
s2
.
m_amount
=
(
-
m_qifProfile
.
value
(
'$'
,
listqSplits
[
count
-
1
].
m_amount
));
// Amount of split
s2
.
m_strMemo
=
listqSplits
[
count
-
1
].
m_strMemo
;
// Memo in split
...
...
@@ -1203,7 +1218,6 @@ void MyMoneyQifReader::processTransactionEntry(void)
}
else
{
pos
=
tmp
.
lastIndexOf
(
"--"
);
if
(
pos
!=
-
1
)
{
/// t.setValue("Dialog", tmp.mid(pos+2));
tmp
=
tmp
.
left
(
pos
);
}
tmp
=
tmp
.
trimmed
();
...
...
This diff is collapsed.
Click to expand it.
kmymoney/converter/mymoneyqifreader.h
+
1
−
2
View file @
81d6396a
...
...
@@ -77,7 +77,6 @@ private:
QString
m_amount
;
};
public
:
MyMoneyQifReader
();
~
MyMoneyQifReader
();
...
...
@@ -256,7 +255,7 @@ private:
* searching for split entries, which it extracts into a struct qSplit and
* stores all splits found in @p listqSplits .
*/
void
extractSplits
(
QList
<
qSplit
>&
listqSplits
)
const
;
bool
extractSplits
(
QList
<
qSplit
>&
listqSplits
)
const
;
enum
SelectCreateMode
{
Create
=
0
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment