Giter VIP home page Giter VIP logo

qif-converter's People

Contributors

larmar avatar matthijsmelissen avatar nonbinary avatar rubenhoms avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

qif-converter's Issues

Look over thousands separators

I experienced some trouble with the seb setup:

I downloaded an xlsx file from SEB, which I opened in LibreOffice.
From here, I exported the csv file.
There was some confusion in the formatting of the xlsx file, which caused some amounts to be typed as: 3,342.00
When the script replaces all commas with dots, the amount turned into 3.342.00, which the script interpreted as 3

After some careful formatting of the cells in LibreOffice, I got around this.
But it might be helpful to have the script catch this incorrect formatting, and it shouldn't be all that difficult.

Small suggestions for improvements

Hi Matthijs, thanks for saving the time of not having to re-invent the wheel. I audited the source code before use, and found some room for improvements:

  • index.html references an external script (without SRI, so the integrity of the file cannot be guaranteed). jQuery is not used, so remove the line that loads jQuery:
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  • This = should have been a ==:
    if (file.type = 'text/csv') {

The following are not directly accessible through the UI, but they would be broken anyway due to the following issues:

  • $row and $fields are not defined. You should remove $ and prepend var fields = {};:

    qif-converter/script.js

    Lines 132 to 138 in 49ee9da

    function seb($row) {
    $fields['date'] = row[0].substr(5,2) + "/" + row[0].substr(8,2) + "/" + row[0].substr(0,4);
    $fields['amount'] = row[4].replace(',','.');
    $fields['payee'] = row[3];
    $fields['category'] = '';
    return $fields;
    }
  • In the original PHP version, you used str_replace, which replaces all occurrences. The .replace function in JavaScript only replaces the first occurrence. Use .replace with a regular expression and the g flag to replace all occurrences, e.g. by using .replace(/\0/g, '') , .replace(/\xA/g, '') , .replace(/ /g, '') , etc. :

    qif-converter/script.js

    Lines 80 to 96 in 49ee9da

    function bcee(row) {
    row[0] = row[0].replace('\0','');
    row[1] = row[1].replace('\0','');
    row[2] = row[2].replace('\0','');
    row[3] = row[3].replace('\0','');
    var fields = {};
    fields['date'] = row[0];
    fields['amount'] = row[2].replace('\xA0', '').replace('ย ', '').replace(',', '.'); //this is not a space but some strange character
    fields['payee'] = row[1];
    fields['payee'] = fields['payee'].replace(/\s\s+/g, ' ').trim();
    fields['category'] = '';
    return fields;
    }

Rewrite to JavaScript

It would be cool if we could run the conversion locally in the browser, so users of this tool don't need to trust the server on which it is hosted with their financial data. Therefore, it would be nice if we could create a JavaScript version of the tool.

Initialize $error in convert.php

The $error variable is not initalized in convert.php.
This causes an error message when $error is emtpy, and this message made it into my .qif files.
Initializing $error fixed this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.