Bug 20067: Fix other checks for linked authorised value categories
[koha.git] / tools / overduerules.pl
index d77a6ad..616f607 100755 (executable)
 # You should have received a copy of the GNU General Public License
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
-use strict;
-use warnings;
+use Modern::Perl;
 use CGI qw ( -utf8 );
 use C4::Context;
 use C4::Output;
 use C4::Auth;
 use C4::Koha;
-use C4::Branch;
 use C4::Letters;
 use C4::Members;
 use C4::Overdues;
@@ -75,7 +73,7 @@ my $type = $input->param('type');
 my $branch = $input->param('branch');
 $branch =
     defined $branch                                                    ? $branch
-  : C4::Context->preference('DefaultToLoggedInLibraryOverdueTriggers') ? C4::Branch::mybranch()
+  : C4::Context->preference('DefaultToLoggedInLibraryOverdueTriggers') ? C4::Context::mybranch()
   : Koha::Libraries->search->count() == 1                              ? undef
   :                                                                      undef;
 $branch ||= q{};
@@ -129,8 +127,8 @@ if ($op eq 'save') {
 
     foreach my $bor (keys %temphash){
         # get category name if we need it for an error message
-        my $bor_category = GetBorrowercategory($bor);
-        my $bor_category_name = defined($bor_category) ? $bor_category->{description} : $bor;
+        my $bor_category = Koha::Patron::Categories->find($bor);
+        my $bor_category_name = $bor_category ? $bor_category->description : $bor;
 
         # Do some Checking here : delay1 < delay2 <delay3 all of them being numbers
         # Raise error if not true
@@ -210,7 +208,6 @@ if ($op eq 'save') {
         $input_saved = 1;
     }
 }
-my $branchloop = GetBranchesLoop($branch);
 
 my $letters = C4::Letters::GetLettersAvailableForALibrary(
     {
@@ -310,7 +307,6 @@ my @tabs = (
 
 $template->param(
     table => ( @first or @second or @third ? 1 : 0 ),
-    branchloop => $branchloop,
     branch => $branch,
     tabs => \@tabs,
     message_transport_types => $message_transport_types,