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>
(cherry picked from commit b57ce0e15b)
(cherry picked from commit d5038e3124)
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
This commit is contained in:
Alex Buckley 2022-08-08 23:59:20 +00:00 committed by Arthur Suzuki
parent fb06a4a09c
commit f32ad78ef8
1 changed files with 3 additions and 13 deletions

View File

@ -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);