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