Bug 17030: Enable REST api on packages
[koha.git] / mainpage.pl
index ccea240..d9e01b7 100755 (executable)
@@ -28,8 +28,8 @@ use C4::NewsChannels; # GetNewsToDisplay
 use C4::Review qw/numberofreviews/;
 use C4::Suggestions qw/CountSuggestion/;
 use C4::Tags qw/get_count_by_tag_status/;
-use Koha::Borrower::Modifications;
-use Koha::Borrower::Discharge;
+use Koha::Patron::Modifications;
+use Koha::Patron::Discharge;
 
 my $query = new CGI;
 
@@ -55,16 +55,19 @@ $template->param(
     koha_news_count => $koha_news_count
 );
 
-my $branch = $flags->{'superlibrarian'}
-  ? undef
-  : C4::Context->userenv()->{'branch'};
+my $branch =
+  (      C4::Context->preference("IndependentBranchesPatronModifications")
+      || C4::Context->preference("IndependentBranches") )
+  && !$flags->{'superlibrarian'}
+  ? C4::Context->userenv()->{'branch'}
+  : undef;
 
 my $pendingcomments    = numberofreviews(0);
 my $pendingtags        = get_count_by_tag_status(0);
 my $pendingsuggestions = CountSuggestion("ASKED");
 my $pending_borrower_modifications =
-  Koha::Borrower::Modifications->GetPendingModificationsCount( $branch );
-my $pending_discharge_requests = Koha::Borrower::Discharge::count({ pending => 1 });
+  Koha::Patron::Modifications->GetPendingModificationsCount( $branch );
+my $pending_discharge_requests = Koha::Patron::Discharge::count({ pending => 1 });
 
 $template->param(
     pendingcomments                => $pendingcomments,