From 349591b3a4ee9620f4f4f337173efd84ab3227cf Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 6 Nov 2020 10:55:13 +0000 Subject: [PATCH] Bug 24786: (QA follow-up) Hide archived registers This patch hides archived registers from the list when useing the Registers template plugin. It also includes a check for UseCashRegisters so that if the preference is disabled after some registers have been defined then the plugin will no longer return the list regardless. Signed-off-by: Jonathan Druart --- Koha/Template/Plugin/Registers.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Koha/Template/Plugin/Registers.pm b/Koha/Template/Plugin/Registers.pm index 7baf5d6bf8..d737b9c2f5 100644 --- a/Koha/Template/Plugin/Registers.pm +++ b/Koha/Template/Plugin/Registers.pm @@ -84,8 +84,10 @@ Returns a list of all cash registers available that adhere to the passed filters sub all { my ( $self, $params ) = @_; + return unless C4::Context->preference('UseCashRegisters'); + my $filters = $params->{filters} // {}; - my $where; + my $where = { archived => 0 }; $where->{branch} = C4::Context->userenv->{'branch'} if ( $filters->{current_branch} && C4::Context->userenv ); my $registers = Koha::Cash::Registers->search($where)->unblessed(); -- 2.39.5