currency.pl tries to see if a currency is active before deleting it: my $total_row = $dbh->selectrow_hashref( 'select count(*) as total from aqbooksellers where currency=?', {}, $curr ); However it doesn't look like the currency column in aqbooksellers is used (anymore?). It looks to me like there are two columns to check: List prices aqbooksellers.listprice) and invoice price (aqbooksellers.invoiceprice). If you try to delete a currency which is in use as a list or invoice price in a vendor record the process will fail silently: currency.pl: DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`aqbasket`, CONSTRAINT `aqbasket_ibfk_3` FOREIGN KEY (`basketgroupid`) REFERENCES `aqbasketgroups` (`id`) ON UPDATE CASCADE)
Nice catch! I think you are right about currency being no longer in use - I had to track down the deletion problem a little while ago.
Created attachment 48773 [details] [review] Bug 15962: Add messages on the currency admin page Bug 15084 rewrote the currency admin page but forgot to add the messages block. Test plan: Add/update/delete vendors. You should get information messages.
Created attachment 48774 [details] [review] Bug 15962: Block the currency deletion if used A currency should not be deleted if used by a vendor or a basket. Test plan: 1/ Add a new currency 2/ Create a vendor using this currency 3/ Create a basket using this currency 4/ Try to delete the currency 5/ Delete the basket 6/ Try to delete the currency 7/ Delete the vendor 8/ Delete the currency
You will need the last patch on bug 15084 (typo currency vs currency_code) to test this patch.
In testing the "active" status for a currency keeps getting unset: 1. Edit active currency. 2. Save without making changes (the "active" checkbox is checked). 3. The currency is saved without the "active" status and I get a warning, "No active currency is defined."
(In reply to Owen Leonard from comment #5) > In testing the "active" status for a currency keeps getting unset: > > 1. Edit active currency. > 2. Save without making changes (the "active" checkbox is checked). > 3. The currency is saved without the "active" status and I get a warning, > "No active currency is defined." Confirmed, but on master :)
(In reply to Jonathan Druart from comment #6) > (In reply to Owen Leonard from comment #5) > > In testing the "active" status for a currency keeps getting unset: > > > > 1. Edit active currency. > > 2. Save without making changes (the "active" checkbox is checked). > > 3. The currency is saved without the "active" status and I get a warning, > > "No active currency is defined." > > Confirmed, but on master :) Fixed on bug 16053.
Created attachment 49047 [details] [review] [SIGNED-OFF] Bug 15962: Add messages on the currency admin page Bug 15084 rewrote the currency admin page but forgot to add the messages block. Test plan: Add/update/delete vendors. You should get information messages. Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 49048 [details] [review] [SIGNED-OFF] Bug 15962: Block the currency deletion if used A currency should not be deleted if used by a vendor or a basket. Test plan: 1/ Add a new currency 2/ Create a vendor using this currency 3/ Create a basket using this currency 4/ Try to delete the currency 5/ Delete the basket 6/ Try to delete the currency 7/ Delete the vendor 8/ Delete the currency Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 49374 [details] [review] [PASSED QA] Bug 15962: Block the currency deletion if used A currency should not be deleted if used by a vendor or a basket. Test plan: 1/ Add a new currency 2/ Create a vendor using this currency 3/ Create a basket using this currency 4/ Try to delete the currency 5/ Delete the basket 6/ Try to delete the currency 7/ Delete the vendor 8/ Delete the currency Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 49375 [details] [review] [PASSED QA] Bug 15962: Add messages on the currency admin page Bug 15084 rewrote the currency admin page but forgot to add the messages block. Test plan: Add/update/delete vendors. You should get information messages. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 49376 [details] [review] [PASSED QA] Bug 15962: Block the currency deletion if used A currency should not be deleted if used by a vendor or a basket. Test plan: 1/ Add a new currency 2/ Create a vendor using this currency 3/ Create a basket using this currency 4/ Try to delete the currency 5/ Delete the basket 6/ Try to delete the currency 7/ Delete the vendor 8/ Delete the currency Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Pushed to Master - Should be in the May 2016 release. Thanks!
Created attachment 50232 [details] [review] [3.22.x] Bug 15962: Block the currency deletion if used Patch for 3.22.x
Patch pushed to 3.22.x, will be in 3.22.6
Pushed to 3.22.x, will be in 3.20.11.