From 5e863f93c06e1e67ddbf0c705657ca7d024006f6 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Mon, 8 Aug 2022 23:59:20 +0000 Subject: [PATCH] Bug 18247: Remove SQL queries from branch_transfer_limit.pl 1. Visit Administration > Patrons and circulation > Limit transfer limits 2. Observe collection codes are displayed as tabs on the Limit transfer limits page when the BranchTransferLimitsType syspref = 'Collection code' 3. Switch the BranchTransferLimitsType syspref = 'item type'. Refresh the Limit transfer limits page and observe the tabs have changed to item type codes 4. Apply patchset and restart services 5. Reload the Limit transfer limits page and confirm it displays correctly with the BranchTransferLimitsType = 'collection code' and 'item type' 6. Confirm you can successfully save transfer policies Sponsored-by: Catalyst IT Signed-off-by: Jacob Omara Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- admin/branch_transfer_limits.pl | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/admin/branch_transfer_limits.pl b/admin/branch_transfer_limits.pl index 5a2a688c70..35b1386388 100755 --- a/admin/branch_transfer_limits.pl +++ b/admin/branch_transfer_limits.pl @@ -52,23 +52,13 @@ my $limitType = C4::Context->preference("BranchTransferLimitsType") || "ccode"; my @codes; my @branchcodes; -my $sth; if ( $limitType eq 'ccode' ) { - $sth = $dbh->prepare('SELECT authorised_value AS ccode FROM authorised_values WHERE category = "CCODE"'); + @codes = Koha::AuthorisedValues->search({ category => 'CCODE' })->get_column('authorised_value'); } elsif ( $limitType eq 'itemtype' ) { - $sth = $dbh->prepare('SELECT itemtype FROM itemtypes'); -} -$sth->execute(); -while ( my $row = $sth->fetchrow_hashref ) { - push( @codes, $row->{ $limitType } ); -} - -$sth = $dbh->prepare("SELECT branchcode FROM branches"); -$sth->execute(); -while ( my $row = $sth->fetchrow_hashref ) { - push( @branchcodes, $row->{'branchcode'} ); + @codes = Koha::ItemTypes->search->get_column('itemtype'); } +@branchcodes = Koha::Libraries->search->get_column('branchcode'); ## If Form Data Passed, Update the Database if ( $input->param('updateLimits') ) { DeleteBranchTransferLimits($branchcode); -- 2.39.5