Forum

Ask, reply and learn. Join the community of Akaunting.

New Discussion

Error when creating invoice on Postgres

Chris Peeters   ( User )

Commented 3 years ago

Running a Postgres database, creating a new invoice, the system seemed to hang upon clicking the Save button. Looking at the log, this reported "SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type integer".

A search brought me to a post on Github https://github.com/akaunting/akaunting/issues/864 ; helpful but it didn't resolve the issue for me, I dug a bit deeper in the log and noticed a suspicious SQL statement 'where "document_number" = INV-00003 and "id" <> and "type" = invoice' with a value missing between the '<>' and the 'and'.

In the code for App\Http\Requests\Document\Document.php, I found $id = null on line 39, which could explain the blank in the query statement.

Since $id was only used to populate the query, I tried changing null into 'null' so that the compiled query would read '... and "id" <> null and "type" ...' and this worked for me.

I am however not sure what the effect will be when using a MySQL database.

Juan Carlos Piñeros Cañas   ( User )

Commented 2 years ago

Thanks a lot for share your solution Chris!!!!!

Did you have any troubles with other modules in PostgreSQL?

Chris Peeters   ( User )

Commented 2 years ago

Juan Carlos, not sure if it was related to Postgres, but I created a ticket to do with invoicing in foreign currencies. Akaunting reported they would deploy a fix for that in version 2.1.10. However, I haven't gone back to my setup to try it out.
Also, there were plenty more classes where I had to change null into 'null'; all in a similar construct. Note that I have not yet finished setting up the completed Akaunting system.

Please login or register to leave a response.

Showing 1 to 3 of 3 discussions