Bug 17843: Replace C4::Koha::getitemtypeinfo with Koha::ItemTypes
[koha.git] / members / purchase-suggestions.pl
index d071425..f967b10 100755 (executable)
 
 use Modern::Perl;
 
-use CGI;
+use CGI qw ( -utf8 );
 use C4::Auth;
 use C4::Context;
 use C4::Output;
-use C4::Branch;
 use C4::Members;
+use C4::Members::Attributes qw(GetBorrowerAttributes);
 use C4::Suggestions;
+use Koha::Patron::Images;
 
 my $input = new CGI;
 
@@ -42,15 +43,27 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
 my $borrowernumber = $input->param('borrowernumber');
 
 # Set informations for the patron
-my $borrower = GetMemberDetails( $borrowernumber, 0 );
+my $borrower = GetMember( borrowernumber => $borrowernumber );
 foreach my $key ( keys %$borrower ) {
     $template->param( $key => $borrower->{$key} );
 }
 $template->param(
+    suggestionsview  => 1,
     categoryname => $borrower->{'description'},
-    branchname   => GetBranchName( $borrower->{'branchcode'} ),
+    RoutingSerials => C4::Context->preference('RoutingSerials'),
 );
 
+if (C4::Context->preference('ExtendedPatronAttributes')) {
+    my $attributes = GetBorrowerAttributes($borrowernumber);
+    $template->param(
+        ExtendedPatronAttributes => 1,
+        extendedattributes => $attributes
+    );
+}
+
+my $patron_image = Koha::Patron::Images->find($borrowernumber);
+$template->param( picture => 1 ) if $patron_image;
+
 my $suggestions = SearchSuggestion( { suggestedby => $borrowernumber } );
 
 $template->param( suggestions => $suggestions );