Bug 21915: Call reconcile_balance on manual invoice creation
[koha.git] / members / purchase-suggestions.pl
index 9e35259..8e4b76a 100755 (executable)
@@ -35,26 +35,21 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
         query           => $input,
         type            => "intranet",
         authnotrequired => 0,
-        flagsrequired   => { borrowers => 1 },
+        flagsrequired   => { acquisition => 'suggestions_manage' },
         debug           => 1,
     }
 );
 
 my $borrowernumber = $input->param('borrowernumber');
 
-# Set informations for the patron
-my $patron = Koha::Patrons->find( $borrowernumber );
+my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
+my $patron         = Koha::Patrons->find( $borrowernumber );
+output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
+
 my $category = $patron->category;
-my $data = $patron->unblessed;
-$data->{description} = $category->description;
-$data->{category_type} = $category->category_type;
-foreach my $key ( keys %$data ) {
-    $template->param( $key => $data->{$key} );
-}
 $template->param(
+    patron => $patron,
     suggestionsview  => 1,
-    categoryname => $data->{'description'},
-    RoutingSerials => C4::Context->preference('RoutingSerials'),
 );
 
 if (C4::Context->preference('ExtendedPatronAttributes')) {
@@ -65,8 +60,6 @@ if (C4::Context->preference('ExtendedPatronAttributes')) {
     );
 }
 
-$template->param( picture => 1 ) if $patron->image;
-
 my $suggestions = SearchSuggestion( { suggestedby => $borrowernumber } );
 
 $template->param( suggestions => $suggestions );