{"action":"created","issue":{"url":"https://api.github.com/repos/system76/beansbooks/issues/234","labels_url":"https://api.github.com/repos/system76/beansbooks/issues/234/labels{/name}","comments_url":"https://api.github.com/repos/system76/beansbooks/issues/234/comments","events_url":"https://api.github.com/repos/system76/beansbooks/issues/234/events","html_url":"https://github.com/system76/beansbooks/issues/234","id":80738351,"number":234,"title":"Import transaction issues and  a query about the meaning of \"Transfer'","user":{"login":"MrJamesEllis","id":603960,"avatar_url":"https://avatars.githubusercontent.com/u/603960?v=3","gravatar_id":"","url":"https://api.github.com/users/MrJamesEllis","html_url":"https://github.com/MrJamesEllis","followers_url":"https://api.github.com/users/MrJamesEllis/followers","following_url":"https://api.github.com/users/MrJamesEllis/following{/other_user}","gists_url":"https://api.github.com/users/MrJamesEllis/gists{/gist_id}","starred_url":"https://api.github.com/users/MrJamesEllis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrJamesEllis/subscriptions","organizations_url":"https://api.github.com/users/MrJamesEllis/orgs","repos_url":"https://api.github.com/users/MrJamesEllis/repos","events_url":"https://api.github.com/users/MrJamesEllis/events{/privacy}","received_events_url":"https://api.github.com/users/MrJamesEllis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-26T01:42:48Z","updated_at":"2015-05-26T11:36:04Z","closed_at":null,"body":"Hello, I recently ran an import of transactions from my bank. There were a couple of issues with the import that may have caused some problems -\r\n\r\n1. The code/reference character limit is 16 chrs, my bank does not provide a unique transaction code in a single column, so I had to concatentate two columns in a CSV and select that as a code. The resulting column was over 16 characters. During import this was caught as an error and displayed  but I noticed that the table column type for transactions.code and transactions.reference is varchar(255).\r\nChanging the validation to 255 chrs max in the import method allowed the transactions to be imported without issue.\r\nAdditionally, I noticed there are no keys on those two columns which could cause some performance issues when looking up transactions by code.\r\n\r\n\r\n2. The import kept on timing out due to the FCGI timeout being 30s. I switched this to 600s and the import progressed.\r\n\r\n3. Finally, the POSTed transaction data could not be JSON decoded successfully as there were two instances of  an extra \" character inside a field that threw json_decode(). This wasn't picked up when uploading the transaction CSV -  the JSON encoded data that it was tripping on looked like this:\r\n\r\n```\r\n... ,\"import-transaction-13-number\":\" 201410\"\",\"import-transaction-13-description\":\"DIRECT CREDIT\",\"import-transaction-13-date\":\"2015-04-16\",\"import-transaction-13-amount\":\"200\",\"import-transaction-13-transfer_account\":\"\",\"import-transaction-13-transaction-transfer\":\"ignore\", ...\r\n```\r\n\r\nThe relevant line in the CSV looks like this:\r\n\r\n```\r\n...,20150416,XXX10,200,DIRECT CREDIT,XXXXX               12345678,\"P 201501-3, 201410\",\"XXXXX               12345678 - P 201501-3, 201410\"\r\n```\r\n\r\nNote that the \"import-transaction-13-number\" is  \"<space>201410\" so I think it's tripping up on the \"P 201501-3, 201410\" cell with a comma in it. That cell is the payment reference field from the bank (who include spaces).\r\nThe last field is used as the transaction code.\r\n\r\n\r\nWithout digging further into the code,  I was wondering why the import doesn't POST the forn data as an array which would be handle in PHP as an array.  It seems to be encoding, POSTing a string, then the import method in PHP is running a json_decode() and tripping up.\r\n\r\n\r\n\r\nWith that in mind and maybe it affected the 'Transfer' - once I imported all the transactions and had select a  'Transfer' account I noticed that the line item is noted as a 'Decrease' within the account I had imported it into but an 'Increase' on the account I selected as a 'Transfer'.\r\n\r\nAs an example in my import account I see a \"DEBIT CARD FEE\" for $3.00 marked as a Decrease. I select 'Transfer' to the 'Bank Service Charge' acocunt and the same transaction when viewing the Bank Service Charge account from Chart Of Accounts is listed as Increase $3.00.\r\nThe same transaction is now listed under two accounts, as a decrease and an increase.\r\n\r\nMaybe I'm misundertanding 'Transfer' but I was thinking I could import transactions into one account then move (Transfer) those transactions to their relevant sub accounts and would appear only once ?\r\n\r\n\r\nThanks\r\n\r\nJames\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/system76/beansbooks/issues/comments/105494938","html_url":"https://github.com/system76/beansbooks/issues/234#issuecomment-105494938","issue_url":"https://api.github.com/repos/system76/beansbooks/issues/234","id":105494938,"user":{"login":"funnylookinhat","id":397918,"avatar_url":"https://avatars.githubusercontent.com/u/397918?v=3","gravatar_id":"","url":"https://api.github.com/users/funnylookinhat","html_url":"https://github.com/funnylookinhat","followers_url":"https://api.github.com/users/funnylookinhat/followers","following_url":"https://api.github.com/users/funnylookinhat/following{/other_user}","gists_url":"https://api.github.com/users/funnylookinhat/gists{/gist_id}","starred_url":"https://api.github.com/users/funnylookinhat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/funnylookinhat/subscriptions","organizations_url":"https://api.github.com/users/funnylookinhat/orgs","repos_url":"https://api.github.com/users/funnylookinhat/repos","events_url":"https://api.github.com/users/funnylookinhat/events{/privacy}","received_events_url":"https://api.github.com/users/funnylookinhat/received_events","type":"User","site_admin":false},"created_at":"2015-05-26T11:36:04Z","updated_at":"2015-05-26T11:36:04Z","body":"Hi James -\r\nThanks for the bug reports.\r\n\r\nI think I would need to see screen shots of your transfers to understand them completely - but generally speaking, what you're trying to accomplish is best handled with a split.\r\n\r\n![federal-state](https://cloud.githubusercontent.com/assets/397918/7811521/b28754ba-0368-11e5-90de-1589067dce87.png)\r\n\r\nI'm going to separate out the other three items into separate issues so that we can track them better.  In the meantime, could you tell me what server + setup you are running ( re: item 2 ) ?  Nginx + FCGI?  What does your site configuration file and relevant PHP config file look like?  Feel free to paste their entire contents into this issue.\r\n\r\nRegarding the extra quote that is in the import data - are you saying the import data is malformed?  I would have guessed each item to be surrounded by quotes - but instead it looks like just this should be a single item?  `\"P 201501-3, 201410\"`  Or is that two separate items?"}}