sysadminsmedia/homebox

Cannot save numbers with commas in Purchase Price

Closed this issue · 2 comments

First Check

  • This is not a feature request
  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the documentation, with the integrated search.
  • I already read the docs and didn't find an answer.

Homebox Version

v0.14.1

What is the issue you are experiencing?

Attempting to save an asset with a purchase price with a comma, e.g. 1,416.11, results in an 500 Internal Server Error, failing to save the item.

Optimally, we would be able to enter numbers with commas.

How can the maintainer reproduce the issue?

  1. Create a new item.
  2. Edit it's fields.
  3. Enable advanced fields
  4. Enter 1,000 into the Purchase Price
  5. Attempt to save.

You should see a PUT request to /api/v1/items/<UUID> that returns a 500.

This PUT request contains the key-value "purchasePrice": "1,000".

On the server side, you'll see an error:

homebox  | 6:19AM ERR ../go/src/app/internal/web/mid/errors.go:31 > ERROR occurred error="body decoding error: json: cannot unmarshal number 1,416.11 into Go struct field ItemUpdate.purchasePrice of type float64" req_id=3b9ebf27d97f/ecrDg3bAEj-000443

Deployment

Docker (Linux)

Deployment Details

No response

that's peculiar, I'm sure I've managed this in the past but I can replicate this on our demo instance - Tagging the bug and will review. Thanks for the heads up!

Apologies - Turns out I was getting confused.
The asset is inputting the purchase price as a float which is incompatible with commas, but then when you save it, the purchase price is then formatted with one:
image

Bit strange, and probably could do with some validation or such to be honest. Will open this up for community input.