From 1105fbc3b268defaccaee48688d4ebc5946f0b68 Mon Sep 17 00:00:00 2001 From: Juerd Waalboer Date: Wed, 7 Feb 2024 23:15:57 +0100 Subject: [PATCH] v6.0.3: add warning for duplicates in revbank.products --- plugins/products | 24 ++++++++++++++---------- revbank | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/plugins/products b/plugins/products index 2ca24c2..d7e5fc6 100644 --- a/plugins/products +++ b/plugins/products @@ -91,16 +91,20 @@ sub read_products() { next; } } - $products{$_} = { - id => $ids[0], - price => $sign * $price, - percent => $percent, - description => $desc, - contra => $contra || $default_contra, - _addon_ids => \@addon_ids, - line => $linenr, - tags => \%tags, - } for @ids; + for my $id (@ids) { + warn "Product '$id' redefined at $filename line $linenr (original at line $products{$id}{line}).\n" if exists $products{$id}; + + $products{$id} = { + id => $ids[0], + price => $sign * $price, + percent => $percent, + description => $desc, + contra => $contra || $default_contra, + _addon_ids => \@addon_ids, + line => $linenr, + tags => \%tags, + }; + } } PRODUCT: for my $product (values %products) { diff --git a/revbank b/revbank index 662df3a..2d64064 100755 --- a/revbank +++ b/revbank @@ -16,7 +16,7 @@ use RevBank::Messages; use RevBank::Cart; use RevBank::Prompt; -our $VERSION = "6.0.2"; +our $VERSION = "6.0.3"; our %HELP1 = ( "abort" => "Abort the current transaction", );