Skip to content

[Enhancement]: Precision in DECIMAL attribute type #2847

Open

Description

@objecttothis

Background information

IMPORTANT: If you choose to ignore this issue report template, your issue will be closed as we cannot help without the requested information.

Please make sure you tick (add an x between the square brackets with no spaces) the following check boxes:

  • Reporting an issue of an unmodified OSPOS installation
  • Checked open and closed issues and no similar issue was already reported (please make sure you searched!)
  • Read README, WHATS_NEW, INSTALL.md and UPGRADE
  • Read the FAQ for any known install and/or upgrade gotchas (in specific PHP extensions installed)
  • Read the wiki
  • Executed any database upgrade scripts if an upgrade pre 3.0.0 (e.g. database/2.4_to_3.0.sql)
  • Aware the installation code is in bintray (see README), and GitHub master is for developers only and therefore not complete nor stable

Installation information

OSPOS Installation Info: 3.3.2 - e83059

Language Code: en-US

Extensions & Modules:
» GD: Enabled ✓
» BC Math: Enabled ✓
» INTL: Enabled ✓
» OpenSSL: Enabled ✓
» MBString: Enabled ✓
» Curl: Enabled ✓

User Configuration:
.Browser: Firefox
.Server Software: Server
.PHP Version: 7.4.4
.DB Version: 5.7.29-log
.Server Port: 80
.OS: FreeBSD 11.3-RELEASE-p9

File Permissions:
» [application/logs:] - 0770 | Writable ✓
» [public/uploads:] - 0774 | Writable ✓
» [public/uploads/item_pics:] - 0774 | Writable ✓
» [import_customers.csv:] - 0640 | Not Writable ✗

New Feature

Currently DECIMAL attribute type has a fixed precision of 3. This is fine in many cases such as attributes with weights and lengths, but it won't do when storing attributes that require integer precision (0) or money precision (2). For example if you have an attribute representing the number of pages in a book you will want to set that precision to be 0 or if you want an attribute for your computers showing the Manufacturer's Suggested Retail Price you would want the attribute set to a precision of 2.

@opensourcepos/org or anyone else, do you have any comments on me making this change? It would probably mean:

  • Adding a column called definition_precision to the attribute_definitions table.
  • Adding a dropdown to the attribute form view representing precisions of 0-3 (with the default of 3).
  • Making the dropdown invisible when the attribute type is not a DECIMAL (a la definition_unit).
  • Changing the business logic to truncate the value of decimals when storing and retrieving DECIMAL attribute types.

The database decimal_value field would remain as is, since at the database level it would still get stored the same (e.g., 123.000 pages in a book in the database, but it would get displayed as 123 to the user)

Activity

  1. added this to the 3.4.0 milestone on Jun 3, 2020
  2. self-assigned this
    on Jun 3, 2020
  3. stale commented on Jul 3, 2020

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  4. objecttothis commented on Jul 3, 2020

    @objecttothis
    MemberAuthor

    This is still in the works.

  5. daN4cat commented on Jul 4, 2020

    @daN4cat
    Collaborator

    Add a label to avoid the automatic closure.

  6. modified the milestones: 3.4.0, 3.5.0 on Dec 10, 2022
  7. changed the title [-]Enhancement: Precision in DECIMAL attribute type[/-] [+][Enhancement]: Precision in DECIMAL attribute type[/+] on Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions