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 <jacob.omara@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5e863f93c0)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
Alex Buckley 2022-08-08 23:59:20 +00:00 committed by Matt Blenkinsop
parent ab0a00dcb9
commit b57ce0e15b

View file

@ -52,23 +52,13 @@ my $limitType = C4::Context->preference("BranchTransferLimitsType") || "ccode";
my @codes; my @codes;
my @branchcodes; my @branchcodes;
my $sth;
if ( $limitType eq 'ccode' ) { 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' ) { } elsif ( $limitType eq 'itemtype' ) {
$sth = $dbh->prepare('SELECT itemtype FROM itemtypes'); @codes = Koha::ItemTypes->search->get_column('itemtype');
}
$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'} );
} }
@branchcodes = Koha::Libraries->search->get_column('branchcode');
## If Form Data Passed, Update the Database ## If Form Data Passed, Update the Database
if ( $input->param('updateLimits') ) { if ( $input->param('updateLimits') ) {
DeleteBranchTransferLimits($branchcode); DeleteBranchTransferLimits($branchcode);