Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not a integer exception when trying to import on a fresh install #1774

Closed
TheAntimist opened this issue Oct 7, 2018 · 7 comments
Closed

Comments

@TheAntimist
Copy link

TheAntimist commented Oct 7, 2018

I am running Firefly III version 4.7.7 on Raspberry Pi 3B

Description

When I try to import a csv, whenever I try to import a csv (tried multiple ones, including really simple ones such as those with just date and amount), I define the structure, and then I get a Job could not be started error, and then it goes to the Applying rules stage, even though, I never ticked it in the first place.

I keep getting the following error on the fpm log:

[2018-10-07 18:36:27] local.ERROR: Argument 1 passed to FireflyIII\Events\RequestedReportOnJournals::__construct() must be of the type integer, string
given, called in /home/pi/HDD/pi/firefly/app/Import/Storage/ImportArrayStorage.php on line 119 {"userId":1,"email":"personal@email.com","exception
":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Argument 1 passed to FireflyIII\\Events\\RequestedReportOnJournals::__
construct() must be of the type integer, string given, called in /home/pi/HDD/pi/firefly/app/Import/Storage/ImportArrayStorage.php on line 119 at /home
/pi/HDD/pi/firefly/app/Events/RequestedReportOnJournals.php:52)
#1 /home/pi/HDD/pi/firefly/app/Support/Http/Controllers/CreateStuff.php(214): FireflyIII\\Import\\Storage\\ImportArrayStorage->store()
#2 /home/pi/HDD/pi/firefly/app/Http/Controllers/Import/JobStatusController.php(211): FireflyIII\\Http\\Controllers\\Import\\JobStatusController->storeTransactions(Object(FireflyIII\\Models\\ImportJob))
#3 [internal function]: FireflyIII\\Http\\Controllers\\Import\\JobStatusController->store(Object(FireflyIII\\Models\\ImportJob))
#4 /home/pi/HDD/pi/firefly/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
#5 /home/pi/HDD/pi/firefly/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction('store', Array)
#6 /home/pi/HDD/pi/firefly/vendor/laravel/framework/src/Illuminate/Routing/Route.php(212): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(FireflyIII\\Http\\Controllers\\Import\\JobStatusController), 'store')
#7 /home/pi/HDD/pi/firefly/vendor/laravel/framework/src/Illuminate/Routing/Route.php(169): Illuminate\\Routing\\Route->runController()
#8 /home/pi/HDD/pi/firefly/vendor/laravel/framework/src/Illuminate/Routing/Router.php(679): Illuminate\\Routing\\Route->run()
#9 /home/pi/HDD/pi/firefly/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))

From some digging, the transactions are imported into an Expense Account, but they do not have the current date, and don't show up in expenses. This is weird as hell.

Also, to note, my transactions are in the past week, and the initial balance has been added on 7th October.

Any suggestions?

Steps to reproduce

  1. Go to Import Data
  2. Select the csv file, and don't select a configuration file.
  3. Define the CSV Structure.
  4. After that, you should get a Job not Started.

Extra info

Debug information generated at 2018-10-07 19:06:47 Asia/Kolkata for Firefly III version **4.7.7**.

| Variable | Content |
| --- | --- |
| FF version | 4.7.7 |
| FF API version | 0.8 |
| App environment | local |
| App debug mode | false |
| App cache driver | file |
| App logging | notice, daily |
| PHP version | 7.2.9-1 |
| Display errors | Off |
| Session start | 2018-10-01 00:00:00 |
| Session end | 2018-10-31 23:59:59 |
| Session first | 0018-10-15 00:00:00 |
| Error reporting | ALL errors |
| Host | Linux |
| Interface | fpm-fcgi |
| UserID | 1 |
| Attempt at "en" | false |
| Attempt at "English" | false |
| Attempt at "en_US.utf8" | 'en_US.utf8' |
| Attempt at "en_US.UTF-8" | 'en_US.UTF-8' |
| DB drivers | sqlite |
| Current driver | sqlite |
| Using Sandstorm? | no |
| Is Sandstorm (.env) | false |
| Is Docker (.env) | false |
| bunq uses sandbox | false |
| Trusted proxies (.env) |  |
| User agent | Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0 |
| Loaded extensions | Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, sodium, standard, cgi-fcgi, PDO, xml, apcu, bcmath, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, imap, intl, json, exif, pdo_sqlite, Phar, posix, readline, shmop, SimpleXML, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlrpc, xmlwriter, xsl, zip, Zend OPcache |
| Installed packages | bacon/bacon-qr-code@1.0.3, bunq/sdk_php@dev-master, davejamesmiller/laravel-breadcrumbs@5.1.2, defuse/php-encryption@v2.2.1, doctrine/cache@v1.8.0, doctrine/dbal@v2.8.0, doctrine/event-manager@v1.0.0, doctrine/inflector@v1.3.0, doctrine/lexer@v1.0.1, dragonmantank/cron-expression@v2.2.0, egulias/email-validator@2.1.6, erusev/parsedown@1.7.1, fideloper/proxy@4.0.0, firebase/php-jwt@v5.0.0, guzzlehttp/guzzle@6.3.3, guzzlehttp/promises@v1.3.1, guzzlehttp/psr7@1.4.2, laravel/framework@v5.7.6, laravel/passport@v7.0.2, laravelcollective/html@v5.7.1, lcobucci/jwt@3.2.4, league/commonmark@0.18.0, league/csv@9.1.4, league/event@2.1.2, league/flysystem@1.0.47, league/fractal@0.17.0, league/oauth2-server@7.2.0, monolog/monolog@1.23.0, nesbot/carbon@1.34.0, paragonie/constant_time_encoding@v2.2.2, paragonie/random_compat@v9.99.99, phpseclib/phpseclib@2.0.11, pragmarx/google2fa@v3.0.3, pragmarx/google2fa-laravel@v0.2.0, psr/container@1.0.0, psr/http-message@1.0.1, psr/log@1.0.2, psr/simple-cache@1.0.1, ramsey/uuid@3.8.0, rcrowe/twigbridge@v0.9.8, swiftmailer/swiftmailer@v6.1.3, symfony/console@v4.1.4, symfony/css-selector@v4.1.4, symfony/debug@v4.1.4, symfony/event-dispatcher@v4.1.4, symfony/finder@v4.1.4, symfony/http-foundation@v4.1.4, symfony/http-kernel@v4.1.4, symfony/polyfill-ctype@v1.9.0, symfony/polyfill-mbstring@v1.9.0, symfony/polyfill-php56@v1.9.0, symfony/polyfill-php72@v1.9.0, symfony/polyfill-util@v1.9.0, symfony/process@v4.1.4, symfony/psr-http-message-bridge@v1.1.0, symfony/routing@v4.1.4, symfony/translation@v4.1.4, symfony/var-dumper@v4.1.4, tijsverkoyen/css-to-inline-styles@2.2.1, twig/twig@v1.35.4, vlucas/phpdotenv@v2.5.1, zendframework/zend-diactoros@1.8.6,  |

Bonus points
https://screenshotscdn.firefoxusercontent.com/images/61e5782f-10d2-4a34-9c05-f5283fd9364a.png

@JC5
Copy link
Member

JC5 commented Oct 7, 2018

Could you share a few example lines (anonymised if necessary) and the config you're using?

JC5 added a commit that referenced this issue Oct 7, 2018
@TheAntimist
Copy link
Author

TheAntimist commented Oct 7, 2018

Thanks for the quick turnaround, I will try to use the commits and check. For now here's two examples of the few I have attempted:

Date,Narration,Debit Amount,Credit Amount
 15/10/18,Description of a transaction worth 1000,1000,0
 25/10/18,Description of a transaction worth 39,39,0

And something resembling my actual data:


  Date     ,Narration                                                                                                                ,Value Dat,Debit Amount       ,Credit Amount      ,Chq/Ref Number   ,Closing Balance
 01/10/18  ,RANDOM DESCRIPTION                                                                      								 ,01/10/18 ,         49.00     ,          0.00     ,0000000000000000       ,    000000.00
 02/10/18  ,ANOTHER RANDOM DESCRIPTION                                                                              				 ,02/10/18 ,        201.00     ,          0.00     ,0000000000000000       ,    000000.00
 02/10/18  ,ANOTHER RANDOM DESCRIPTION                                                                                 				 ,02/10/18 ,        256.00     ,          0.00     ,0000000000000000       ,    000000.00

Also, here's my config:

APP_ENV=local

APP_DEBUG=false

SITE_OWNER=personal@email.com

APP_KEY=<APP_KEY here in base64>

TZ=Asia/Kolkata

APP_URL=http://localhost:8000

TRUSTED_PROXIES=

LOG_CHANNEL=daily

APP_LOG_LEVEL=notice

DB_CONNECTION=sqlite

CACHE_DRIVER=file
SESSION_DRIVER=file

COOKIE_PATH="/"
COOKIE_DOMAIN=
COOKIE_SECURE=false

MAIL_DRIVER=log
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_FROM=changeme@example.com
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

MAILGUN_DOMAIN=
MAILGUN_SECRET=
MANDRILL_SECRET=
SPARKPOST_SECRET=

SEND_REGISTRATION_MAIL=false
SEND_ERROR_MESSAGE=false

MAPBOX_API_KEY=
FIXER_API_KEY=
ANALYTICS_ID=
USE_ENCRYPTION=false

APP_NAME=FireflyIII
BROADCAST_DRIVER=log
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
CACHE_PREFIX=firefly
SEARCH_RESULT_LIMIT=50
PUSHER_KEY=
PUSHER_SECRET=
PUSHER_ID=
DEMO_USERNAME=
DEMO_PASSWORD=
IS_DOCKER=false
IS_SANDSTORM=false
IS_HEROKU=false
BUNQ_USE_SANDBOX=false
MAILGUN_DOMAIN=
MAILGUN_SECRET=

Note: Removed comments for brevity.

Also, for completeness, here's the logs, when APP_DEBUG is set to true:

[2018-10-07 20:28:10] local.WARNING: Cannot find anything on empty currency code and empty currency ID!
[2018-10-07 20:28:10] local.WARNING: Cannot find anything on empty currency code and empty currency ID!
[2018-10-07 20:28:10] local.ERROR: Argument 1 passed to FireflyIII\Events\RequestedReportOnJournals::__construct() must be of the type integer, string
given, called in /home/pi/HDD/pi/firefly/app/Import/Storage/ImportArrayStorage.php on line 119 {"userId":1,"email":"personal@email.com","exception
":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Argument 1 passed to FireflyIII\\Events\\RequestedReportOnJournals::__
construct() must be of the type integer, string given, called in /home/pi/HDD/pi/firefly/app/Import/Storage/ImportArrayStorage.php on line 119 at /home
/pi/HDD/pi/firefly/app/Events/RequestedReportOnJournals.php:52)
[stacktrace]
#0 /home/pi/HDD/pi/firefly/app/Import/Storage/ImportArrayStorage.php(119): FireflyIII\\Events\\RequestedReportOnJournals->__construct('1', Object(Illum
inate\\Support\\Collection))
#1 /home/pi/HDD/pi/firefly/app/Support/Http/Controllers/CreateStuff.php(214): FireflyIII\\Import\\Storage\\ImportArrayStorage->store()
#2 /home/pi/HDD/pi/firefly/app/Http/Controllers/Import/JobStatusController.php(211): FireflyIII\\Http\\Controllers\\Import\\JobStatusController->storeTransactions(Object(FireflyIII\\Models\\ImportJob))
#3 [internal function]: FireflyIII\\Http\\Controllers\\Import\\JobStatusController->store(Object(FireflyIII\\Models\\ImportJob))
#4 /home/pi/HDD/pi/firefly/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
#5 /home/pi/HDD/pi/firefly/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction('store', Array)

EDIT: Your commit 2ec310d fixed the uploading, part. Now only the understanding of the Expense account thing, and why the dates are wrong.

@JC5
Copy link
Member

JC5 commented Oct 7, 2018

What date format are you using when uploading? Looking at your CSV file, it should be d/m/y.

I am not really sure what you mean with the expense account thing. Once the file has uploaded and imported, are they linked to a tag? What exactly is wrong there?

@JC5
Copy link
Member

JC5 commented Oct 7, 2018

And could you share the role you give each column?

@TheAntimist
Copy link
Author

What date format are you using when uploading? Looking at your CSV file, it should be d/m/y.

Shoot, I was using d/m/Y missed that one, good catch. After this happens, the new transactions work great. Thanks for all the help! The app is amazing!

One minor quip, based on the roles:

Right now for me this works:

{
    "file-type": "csv",
    "date-format": "d\/m\/y",
    "has-headers": true,
    "delimiter": ",",
    "apply-rules": false,
    "specifics": [],
    "import-account": 1,
    "column-count": 7,
    "column-roles": [
        "date-transaction",
        "description",
        "_ignore",
        "amount_negated",
        "amount",
        "external-id",
        "_ignore"
    ],
    "column-do-mapping": [
        false,
        false,
        false,
        false,
        false,
        false,
        false
    ]
}

Where the Debit Amount is a Amount (negated column), and credit is just Amount. This works as expected. But, when I set them to Amount (Debit Column) and Amount (Credit Column) they don't work at all, give a value of 0, not what I expected.

{
    "file-type": "csv",
    "date-format": "d\/m\/y",
    "has-headers": true,
    "delimiter": ",",
    "apply-rules": false,
    "specifics": [],
    "import-account": 1,
    "column-count": 7,
    "column-roles": [
        "date-transaction",
        "description",
        "_ignore",
        "amount_debit",
        "amount_credit",
        "external-id",
        "_ignore"
    ],
    "column-do-mapping": [
        false,
        false,
        false,
        false,
        false,
        false,
        false
    ]
}

Also, what does Map These Values in these situations do? I can't seem to understand it.

Thanks for quick work, love what you have done, I was looking for something like this for ages.

@JC5
Copy link
Member

JC5 commented Oct 7, 2018

Glad to hear you like it. Always nice to get compliments 😁

For the amounts: Firefly III expects either one when you use the debit/credit types. This is useful when banks provide something like this:

descr,debit,credit
income,,5
expense,5,

If this doesn't seem to work properly, make sure you turn on APP_DEBUG and set the LOG_LEVEL to debug as well. This will make Firefly III spit out massive amounts of log where you can follow the logic it uses trying to determine the actual amount to use. There might be a bug in there somewhere. I am curious to see what turns up.

The "map these values" option is useful for fields like the "opposing account". Often you see stuff like this in CSV files:

destination
WALMART_AAKA
WALMRT_1A
WLMARTA_A

If you do nothing, Firefly III will create three expense accounts for just the one Walmart. So if you have a Walmart expense account already, Firefly III will simply "map" each WALMART_AAKA to Walmart.

@JC5 JC5 added the question label Oct 7, 2018
@TheAntimist
Copy link
Author

Glad to hear you like it. Always nice to get compliments grin

For the amounts: Firefly III expects either one when you use the debit/credit types. This is useful when banks provide something like this:

Ah yes, this worked perfectly fine. Debit and credit, worked great, Although, I might stick to the negated, I have to say that it is easier, 😄

The "map these values" option is useful for fields like the "opposing account". Often you see stuff like this in CSV files:

This sort of makes sense, but not something I will be able to use, oh well, thanks for the info! Closing this issue now, you have been a great help in sort this out.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants