Commit graph

2 commits

Author SHA1 Message Date
Juerd Waalboer
b22cc4c997 Move price calculation from products plugin to RevBank::Products
- Adds price tag calculation. Addons tagged #OPAQUE are excluded from the
price tag.
- BREAKING CHANGE: instead of abusing $product->{price} for a percent,
$product->{percent} is no longer a boolean but the actual percent, so
$product->{price} is the calculated amount.

The total price of a product is now calculated in two places, once when
reading the product list, and once as the result of adding the entry and
its contras when adding the product. Although this involves some
duplication and the sums are calculated in different ways, it hinges on
the existing assertion to make sure that the entry is balanced to ensure
that both sums are the same. Because of that, this code duplication
actually strengthens the integrity.
2024-12-26 01:36:55 +01:00
Juerd Waalboer
7c5431fba4 Move read_products() from plugin to core
Additional changes:
- Parametrized $filename and $default_contra
- Add ->{config} to product hashes, which is the re-serialized config line
2024-12-25 23:43:03 +01:00