<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>406223</bug_id>
          
          <creation_ts>2019-04-04 16:13:53 +0000</creation_ts>
          <short_desc>CSV Import of &quot;Remove&quot; transactions reclassifies as &quot;Add Shares&quot;</short_desc>
          <delta_ts>2024-12-19 09:58:40 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>kmymoney</product>
          <component>importer</component>
          <version>git (master)</version>
          <rep_platform>Appimage</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Unknown">null</reporter>
          <assigned_to name="KMyMoney Devel Mailing List">kmymoney-devel</assigned_to>
          <cc>r.cluzel</cc>
          
          <cf_commitlink>https://invent.kde.org/office/kmymoney/commit/ddc85c396f3931f4920a1f820be44d00a8c7ec1d</cf_commitlink>
          <cf_versionfixedin>5.2</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1848589</commentid>
    <comment_count>0</comment_count>
    <who name="Unknown">null</who>
    <bug_when>2019-04-04 16:13:53 +0000</bug_when>
    <thetext>SUMMARY
Importing investment transactions through CSV reclassifies &quot;remove&quot; transactions as &quot;Add Shares&quot;.

STEPS TO REPRODUCE
1. Create CSV file with action as &quot;remove&quot;, &quot;Remove&quot;, &quot;REMOVE&quot;, or any other variant (such as &quot;Out&quot;).
2. Import CSV file into KmyMoney
3. If the term is not &quot;remove&quot;, it will correctly recognize an invalid transaction type and prompt the user to select a transaction type.  Select &quot;Remove Shares&quot; from the dropdown menu.
3. The importer imports each transaction but erroneously assigns them the the &quot;Add Shares&quot; activity.  

OBSERVED RESULT
The transaction is assigned to the &quot;Add Shares&quot; activity

EXPECTED RESULT
The transaction should be assigned to the &quot;Remove Shares&quot; activity


SOFTWARE/OS VERSIONS
Windows: N/A
macOS: N/A
Linux/KDE Plasma: Kubuntu 18.04
(available in About System)
KDE Plasma Version: 5.12.7
KDE Frameworks Version: 5.44.0
Qt Version: 5.9.5

ADDITIONAL INFORMATION
I have tried a number of different variations:
positive and negative share quantities
upper and lower case combinations
different recognized and unrecognized keywords
modifying csvimporterrc but that file is not present on computer</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1848600</commentid>
    <comment_count>1</comment_count>
    <who name="Unknown">null</who>
    <bug_when>2019-04-04 17:39:27 +0000</bug_when>
    <thetext>Also turned on logging and the import seemed good at the point the log is created.  Below is an example of a line:
&lt;TRANSACTION number=&quot;&quot; security=&quot;security name xxx&quot; action=&quot;remove&quot; amount=&quot;0/1&quot; shares=&quot;1436594533/100000000&quot; brokerageaccount=&quot;&quot; dateposted=&quot;2017-02-22&quot; payee=&quot;&quot; bankid=&quot;&quot; reconcile=&quot;0&quot; memo=&quot;Quarterly Rebalancing&quot;/&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1848602</commentid>
    <comment_count>2</comment_count>
    <who name="Unknown">null</who>
    <bug_when>2019-04-04 17:42:26 +0000</bug_when>
    <thetext>Also a similar thing happens when I import an QFX through the OFX importer: where buy transactions get turned into sell transactions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1848614</commentid>
    <comment_count>3</comment_count>
    <who name="Unknown">null</who>
    <bug_when>2019-04-04 18:21:26 +0000</bug_when>
    <thetext>Located the csvimporterrc file and confirmed that invalid transaction types that the user maps to the &quot;Remove Shares&quot; action are correctly being appended to the &quot;ShrsoutParam&quot; line.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2152452</commentid>
    <comment_count>4</comment_count>
    <who name="Jack">ostroffjh</who>
    <bug_when>2022-09-13 20:12:22 +0000</bug_when>
    <thetext>*** Bug 459006 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2152453</commentid>
    <comment_count>5</comment_count>
    <who name="Jack">ostroffjh</who>
    <bug_when>2022-09-13 20:15:33 +0000</bug_when>
    <thetext>Duplicate bug was also reported in the forum (https://forum.kde.org/viewtopic.php?f=69&amp;t=176023) for 5.1.3.  I reproduced in git master appimage Version 5.1.80-06ee79919.  (I currently get a crash on File/Import/CSV in my Gentoo git master version.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2152454</commentid>
    <comment_count>6</comment_count>
      <attachid>152035</attachid>
    <who name="Jack">ostroffjh</who>
    <bug_when>2022-09-13 20:17:54 +0000</bug_when>
    <thetext>Created attachment 152035
simple csv file to demonstrate bug

I think you can demonstrate the bug importing this csv file into any Investment Account.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2153560</commentid>
    <comment_count>7</comment_count>
    <who name="Thomas Baumgart">thb</who>
    <bug_when>2022-09-17 09:07:47 +0000</bug_when>
    <thetext>Git commit ddc85c396f3931f4920a1f820be44d00a8c7ec1d by Thomas Baumgart.
Committed on 17/09/2022 at 09:04.
Pushed by tbaumgart into branch &apos;master&apos;.

Use correct sign for import of &apos;remove shares&apos; transactions

M  +7    -3    kmymoney/converter/mymoneystatementreader.cpp

https://invent.kde.org/office/kmymoney/commit/ddc85c396f3931f4920a1f820be44d00a8c7ec1d</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2155911</commentid>
    <comment_count>8</comment_count>
    <who name="Thomas Baumgart">thb</who>
    <bug_when>2022-09-24 05:09:00 +0000</bug_when>
    <thetext>Git commit a0f7c20bab58b07b48e7fbc038138c48952f3eab by Thomas Baumgart.
Committed on 24/09/2022 at 05:08.
Pushed by tbaumgart into branch &apos;5.1&apos;.

Use correct sign for import of &apos;remove shares&apos; transactions
FIXED-IN: 5.1.4

(cherry picked from commit ddc85c396f3931f4920a1f820be44d00a8c7ec1d)

M  +7    -3    kmymoney/converter/mymoneystatementreader.cpp

https://invent.kde.org/office/kmymoney/commit/a0f7c20bab58b07b48e7fbc038138c48952f3eab</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>152035</attachid>
            <date>2022-09-13 20:17:54 +0000</date>
            <delta_ts>2022-09-13 20:17:54 +0000</delta_ts>
            <desc>simple csv file to demonstrate bug</desc>
            <filename>BadRemove.csv</filename>
            <type>text/csv</type>
            <size>144</size>
            <attacher name="Jack">ostroffjh</attacher>
            
              <data encoding="base64">ImRhdGUiLCJhY3Rpb24iLCJzdG9jayIsInNoYXJlcyIsInByaWNlIiwidmFsdWUiCjIwMjItMDct
MDEsImJ1eSIsIlRTVCIsMSw1MDAsNTAwCjIwMjItMDctMDMsInJlbW92ZSIsIlRTVCIsMSwsCjIw
MjItMDctMDIsImRpdmlkZW5kIiwiVFNUIiwsLDMK
</data>

          </attachment>
      

    </bug>

</bugzilla>