Commit graph

25 commits

Author SHA1 Message Date
Juerd Waalboer
b3cd3833f1 products: clear products cache before reading products list
Fixes bug where a product would remain available if it is removed from
revbank.products during runtime.
2023-09-18 00:04:00 +02:00
Juerd Waalboer
fffb2d72e9 Fix deduplication bug, refactor deduplication to own plugin
(Bumps version to 3.8 because admins should update the plugin list.)

Deduplication didn't work on quantified additions, i.e. if you added
"20x clubmate" when there was already clubmate in the cart, it would add
just ONE item, and have a lingering message that the next thing would be
multiplied by 20.

This old bug was especially annoying if there is a barcode "20x
clubmate" to scan 20 bottles (which is the size of a crate), and this is
repeated.

The fix also uncovered another bug: newly added entries were selected
too early. There are two hooks, hook_add_entry and hook_added_entry, and
of course the selection should happen in between, not before the former.
No entry in UPGRADING.md, because I think it is extremely unlikely that
any plugin author will have used the selection feature yet, which is
very new.
2023-02-12 17:53:14 +01:00
Juerd Waalboer
9045eb7ff4 Don't tab complete invalid input
Products and users that begin with `+` are internal, as are users that
begin with `-`. These should be excluded from tab completion.
2023-01-30 17:19:50 +01:00
Juerd Waalboer
99435cef17 Highlight change; apply operators to last scanned instead of last added 2023-01-30 04:40:42 +01:00
Juerd Waalboer
5b0c85d770 Refactor read_products and its callers
- Promote to public function since it's used in other plugins anyway
- Move resolving of addons to read_products (print errors immediately)
- Cache product list based on mtime; mostly to reduce the amount of spam
  from errors as performance was never an issue.
- Cache product object in cart entry, so statiegeld_tokens plugin
  doesn't have to do the lookup all over again.
2023-01-17 20:28:35 +01:00
Juerd Waalboer
d4c6c1be35 Replace add_info() with extra parameter for add_contra()
add_info was a thing that grew organically to account for hidden
contras, but just wasn't right. The assumption was that if the
contra account is hidden, the contra itself should be hidden from
view - the sign of the amount would be wrong anyway.

The correct approach, however, would of course to flip the sign so it
matches the user's perspective, and to add a separate description string
to display to the user.
2023-01-05 20:46:46 +01:00
Juerd Waalboer
7c05b3108c New feature: percentage addons (discounts etc) 2023-01-05 19:42:34 +01:00
Juerd Waalboer
eb55aa0eb5 revbank.products: trim whitespace, document comment/whitespace rules
Beginning of a line was already trimmed, courtesy of the whitespace
split. The end of a line was previously not trimmed because of the limit
for split.
2022-12-26 04:54:41 +01:00
Juerd Waalboer
da523f8daa v3.6: products overhaul
New features, new documentation.
2022-12-25 05:32:00 +01:00
Juerd Waalboer
43a1990974 bump to v3.5; add built-in editor 2022-08-30 20:45:01 +02:00
Juerd Waalboer
22ca2ec61e Implement global advisory lock 2022-08-29 17:50:12 +02:00
Juerd Waalboer
441bf05fde Bump to v3.4; make all transactions balanced using hidden accounts
See UPGRADING.md for details.
2022-06-11 18:51:26 +02:00
Juerd Waalboer
f262bce57c Split "help" into "help" and "help2"; ditch pager 2022-06-11 16:31:44 +02:00
Juerd Waalboer
eed0db7897 Cleanup: use subroutine signatures, remove deprecated methods.
The signatures feature has been "experimental" since Perl 5.20 (May 2014), but
expected to stay. After 8 years I'm ready to take the risk :)

Have added Perl v5.28 (June 2018) as the minimum requirement, even though the
current revbank should work with 5.20, to see if this bothers any users. Perl
v5.28 is in Debian "buster", which is now oldstable.
2021-12-03 18:00:34 +01:00
Juerd Waalboer
29b3eea131 market/products: reuse existing entry 2019-12-12 23:16:10 +01:00
Juerd Waalboer
1cbc906f1e Further update to new ledger-like internals 2019-11-05 00:57:39 +01:00
Juerd Waalboer
fa60e1081a chmod 644 plugins/*
Undoes 714b337 because github seems to no longer require chmod +x
for syntax highlighting extensionless files.
2019-08-07 15:42:16 +02:00
Juerd Waalboer
7b088cb175 Tab completion improvements
A plugin can now specify &subroutine in the :Tab attribute; this sub will
be called as a method and can return a list of possible completions.
2013-02-28 16:04:36 +01:00
Juerd Waalboer
551c22c8ba Product ID in cart items internal metadata + alias support.
The alias support is implemented in products, but not in market.

The product ID in the cart items is useful for plugins that hook the checkout.
2013-02-28 01:42:33 +01:00
Juerd Waalboer
c1db0fc1e9 Treat product database as user input. 2013-02-27 23:12:13 +01:00
Juerd Waalboer
ac1c7235f7 Prevent negative prices for products 2013-02-26 23:06:55 +01:00
RevBar
116be18b2f WTH, no $EDITOR :) 2013-02-26 20:26:45 +01:00
Juerd Waalboer
4995e84b83 Git highlight alleen met +x? Okay, dan doen we +x :-) 2013-02-26 04:44:29 +01:00
Juerd Waalboer
18d1a552fb Shebangs voor syntax highlighting 2013-02-26 04:42:45 +01:00
Juerd Waalboer
c157ea0214 RevBank 2.0, a rewrite. It's plugin based now. 2013-02-26 04:11:13 +01:00