Skip to content

Monetary types and fraction digits #20

@tomaszstrojny

Description

@tomaszstrojny

Hi.
I have created plugin for using money painlessly in OctoberCMS that extends yours (it is waiting in Marketplace for approval, right now you can see it only on Github: https://github.com/initbizlab/oc-money-plugin).

Its main feature for now is a form widget that formats amount-input (on blur, using format defined in currency), dropdown with currencies in the field and is managing fraction digits so that the amount can be stored as integer in database.

But I am not writing here for advertising ;) I am just curious why you have not add such field as decimals or fraction_digits to your Currency model. For me it makes sense to store default precision in database, because we will know how many places are decimals while storing the amount as integer. Right now your plugin is enforcing users to use float or doubles for their amounts and this is not good practice (or am I missing something?).

My plugin updates your currencies table (adds the fraction_digits field) and wraps the functionality in such a way that users will not see integers, but nice formatted strings.

If you think it makes sense we should join forces here or just please remember about my plugin on your plugin updates :)

I was considering creating you PRs instead of writing new plugin, but I want to have full control over this code since I want to add more features that concerns money problems while developing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions