Commit graph

474 commits

Author SHA1 Message Date
Juerd Waalboer
dbe75efe7f Remove references to deprecated calling convention
Deprecated 4 years ago, no longer supported since 2 years ago.
2023-11-24 05:52:04 +01:00
Juerd Waalboer
52749df5f3 Ignore all hook exceptions except in hook_checkout_prepare
A space had a custom plugin that died during hook_checkout, which caused
the CHECKOUT lines to be logged without the corresponding BALANCE, and
indeed no account balances were updated. While the plugin had a bug, it
should not cause a half transaction in RevBank.

After some hesitation, I went with ON ERROR RESUME NEXT because if a
hook throws an exception, that should not interfere with other plugins
(the hook can return ABORT if this it was intentional), including the
calling plugin. An error message is printed (but not logged... TODO: add
hook_plugin_fail to plugins/log) but the show must go on.

During hook_checkout_prepare, however, nothing is set in stone yet, so
this could be used for something that might die, and this instance of
call_hooks() is now the one place where a failing hook should result in
the transaction getting aborted. For this, call_hooks() now returns a
success status boolean. Maybe it would make sense in more places, but I
didn't identify any such calls yet.

RevBank::Cart->checkout used to return a success status boolean, but it
could just as well just die (indirectly, to abort the transaction) since
it can't be called a second time within the same transaction anyway
(because ->set_user must be called exactly once), so continuing with the
same transaction can't result in anything useful anyway.

In some places, error messages were slightly improved to contain a bit
more information.
2023-11-24 05:15:22 +01:00
Juerd Waalboer
0c2b24bdc1 Add Users.pod to README.md 2023-11-05 22:16:31 +01:00
Juerd Waalboer
a859b9640e Document tiny semantics change for v4.2.0 2023-11-05 21:26:20 +01:00
Juerd Waalboer
aa589d59cb Document RevBank::Users (accounts) 2023-11-05 21:19:39 +01:00
Juerd Waalboer
7dd94eda9b Add assertions
There should already be external checks to prevent double entries in
revbank.accounts, but better safe than sorry.
2023-11-05 21:19:17 +01:00
Juerd Waalboer
d54428b092 Add support for user-accessible accounts that are excluded from grandtotal 2023-11-02 05:33:33 +01:00
Juerd Waalboer
df8c84672d tail/users: fix warning when used with old log files 2023-11-02 04:45:03 +01:00
Juerd Waalboer
1156864fd2 v4.1.0
- New internal feature: $plugin->Tab($method)
- `adduser` has an additional check
- Tiny bug fixes
2023-11-02 04:39:57 +01:00
Juerd Waalboer
0f5cdca0f9 users: add missing tab completion for 'log' command 2023-11-02 03:58:02 +01:00
Juerd Waalboer
78d9cd916f adduser: use tab completion lists to catch some more clashes 2023-11-02 03:57:46 +01:00
Juerd Waalboer
63b4144799 split: remove irrelevant tab completions
`split` was refactored out from `take`, and this was apparently left over
from the copy/paste.
2023-11-02 03:52:32 +01:00
Juerd Waalboer
8956d8a483 Move :Tab introspection from main:: to RevBank::Plugin
- Exposes the introspection as a public method.
- Removes undocumented support for NOABORT special-case.
2023-11-02 03:16:55 +01:00
Juerd Waalboer
4f0954b2dc restart: only suppress warnings of the 'exec' category
"Statement unlikely to be reached" is the expected warning here.
2023-11-02 03:12:26 +01:00
Juerd Waalboer
4664245b8b Add plugin 'sighup' 2023-11-02 03:12:17 +01:00
Juerd Waalboer
56b9db74ae Add deprecation note to UPGRADING.md
The warnings in the log file already say "This will probably be a fatal
error in a future version of revbank" but not everyone watches log
files.
2023-09-21 03:05:24 +02:00
Juerd Waalboer
d8cde56888 UPGRADING.md: typo 2023-09-20 21:52:09 +02:00
Juerd Waalboer
b50bbfef96 Update comment 2023-09-20 21:11:19 +02:00
Juerd Waalboer
50e11f3ece Rewrap UPGRADING.md 2023-09-20 20:23:02 +02:00
Juerd Waalboer
a2bdf4dd79 Nitpick in UPGRADING.md 2023-09-20 20:22:29 +02:00
Juerd Waalboer
c07f9f484e update README 2023-09-20 20:20:46 +02:00
Juerd Waalboer
560242a4bc Bump version to 4.0.0; change transaction ID scheme 2023-09-20 20:15:43 +02:00
Juerd Waalboer
e613ff28e6 Update default/example revbank.plugins 2023-09-20 20:13:16 +02:00
Juerd Waalboer
3ca6db357d New plugin: adduser_note 2023-09-20 20:12:42 +02:00
Juerd Waalboer
f6338fe9fc gtin: fix spamurl, support element string without parentheses
The spam url has uppercase letters.
2023-09-20 00:06:12 +02:00
Juerd Waalboer
827a600f8e vat: remove unused variable 2023-09-18 15:30:00 +02:00
Juerd Waalboer
5a160fcff0 vat: match accounts case insensitively, show VAT for non-hidden accounts
Also fixed unintended masking of $vat variable.
2023-09-18 15:09:03 +02:00
Juerd Waalboer
e979c695c4 Document vat plugin 2023-09-18 15:08:55 +02:00
Juerd Waalboer
ac519c05c8 VAT plugin
No hackerspace probably needs this, but I just realised that
implementing VAT support would be very easy, so why not.
2023-09-18 05:15:13 +02:00
Juerd Waalboer
e6746afde5 Add rant 2023-09-18 01:57:37 +02:00
Juerd Waalboer
8f781dae6c Add simple GS1 "Digital Link" and "Element String" support
Also has a regex for some known promotional URLs that don't adhere to
the Digital Link standard.
2023-09-18 01:37:35 +02:00
Juerd Waalboer
0dcacfc659 Upstream support for angel-foo input as alias for foo.
This replaces the revspace_angel plugin at RevSpace.
2023-09-18 01:35:11 +02:00
Juerd Waalboer
0245f80961 url: Print line but don't skip "no such product/..." error message 2023-09-18 01:33:35 +02:00
Juerd Waalboer
fbb178d5ac Formal mechanism for retrying input
This allows for alias plugins with better error messages and better
logging than with the $_[2] =~ s/// hack.
2023-09-18 01:31:13 +02:00
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
f2506bdc74 Reword documentation
"When things don't add up" sounds like RevBank (or Perl) has a broken
addition(+) operator... :)
2023-09-10 02:56:25 +02:00
Juerd Waalboer
be47e08dc6 Small documentation update 2023-09-10 02:52:55 +02:00
Juerd Waalboer
705a431ba2 Update documentation
This adds the missing file lib/RevBank.pod which was written some time
ago.
2023-09-10 02:41:55 +02:00
Juerd Waalboer
59387ddba4 Use formerly experimental Perl features with "use experimental"
This is semantically equivalent to use feature + no warnings, but less
noisy. I've also added comments to indicate when the line can be
removed.
2023-09-10 02:13:33 +02:00
Juerd Waalboer
c465ae1445 Update README.md 2023-09-10 02:05:03 +02:00
Juerd Waalboer
f4e7d5660e revbank2beancount: reword comment 2023-09-10 02:03:25 +02:00
Juerd Waalboer
62aae74dfb Script to convert RevBank data to Beancount 2023-08-31 03:04:12 +02:00
Juerd Waalboer
6f110ee783 Update shebang to use /usr/bin/env 2023-08-21 03:43:52 +02:00
Juerd Waalboer
c43764afbb Deal with @_ in signatured sub being experimental in Perl 5.36 2023-07-17 21:56:13 +02:00
Juerd Waalboer
459e5619a7 Place cursor at start of rejected input instead of end
The cursor was placed after the rejected input, both to indicate where
the mistake was, and to make it easy to <backspace> it out. But since
"retry" is only used when there are trailing words, that means the
cursor would be placed on the space between the mistake and the trailing
input. By putting it at the first character of the rejected input, it
is less visually ambiguous. The user can now use <delete> instead of
<backspace>.
2023-07-12 22:12:30 +02:00
Juerd Waalboer
0202ab38ac users: color negative balance red 2023-07-11 22:41:39 +02:00
Juerd Waalboer
acb47457c1 tail: Reformat output
Similar to the previous commit to plugins/users, with the additional
change of dynamically sizing the username column.

I believe this is the last place where GAIN/LOSE was displayed to end
users.
2023-07-11 04:00:50 +02:00
Juerd Waalboer
be204b9ad8 users: reformat user log view
Shaves 7 characters off for most lines, and gets rid of infamous
GAIN/LOSE display.

The terms "GAIN" and "LOSE" were originally introduced because having
negative numbers everywhere would look too, er, negative, and having a
"+" for positive numbers would get hard to notice in a right aligned
list. The visibility of the "+" was fixed a while ago, simply by adding
a space between the sign and the number, and now the same style is
applied to the user log view.

Old:
2023-07-05 06:24:54 LOSE   2   1.80 Example [2x 0.90]
2023-07-07 20:55:53 GAIN   1  20.00 Received from someone (example)

New:
2023-07-05 06:24:54     1.80 2x Example [2x 0.90]
2023-07-07 20:55:53  + 20.00 Received from someone (example)
2023-07-11 03:37:09 +02:00
Juerd Waalboer
338ea37127 statiegeld: fix typo in ansi escape 2023-06-10 22:26:21 +02:00
Juerd Waalboer
194ba4990c idle: use underline instead of dim/faint
Was always intended as underline. Our old IBM terminal renders 2 as
underline. Other things interpret it as dim/faint though...
2023-06-10 22:24:14 +02:00