ffzg/recall_notices.pl: added --interval and --dedup
[koha.git] / opac / opac-suggestions.pl
index cd8816a..cf562fb 100755 (executable)
@@ -15,8 +15,8 @@
 # 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 Encode qw( encode );
@@ -30,6 +30,7 @@ use C4::Scrubber;
 
 use Koha::AuthorisedValues;
 use Koha::Libraries;
+use Koha::Patrons;
 
 use Koha::DateUtils qw( dt_from_string );
 
@@ -195,14 +196,14 @@ my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG");
 
 # Is the person allowed to choose their branch
 if ( C4::Context->preference("AllowPurchaseSuggestionBranchChoice") ) {
-    my ( $borr ) = GetMemberDetails( $borrowernumber );
+    my $branchcode = $input->param('branchcode') || q{};
 
-# pass the pickup branch along....
-    my $userbranch = '';
-    if (C4::Context->userenv && C4::Context->userenv->{'branch'}) {
-        $userbranch = C4::Context->userenv->{'branch'};
+    if ( !$branchcode
+        && C4::Context->userenv
+        && C4::Context->userenv->{branch} )
+    {
+        $branchcode = C4::Context->userenv->{branch};
     }
-    my $branchcode = $input->param('branchcode') || $borr->{'branchcode'} || $userbranch || '' ;
 
     $template->param( branchcode => $branchcode );
 }