Bug 20724: Move the ReservesNeedReturns logic to AddReserve
[koha.git] / opac / opac-sendbasket.pl
index c51e8c4..09c462c 100755 (executable)
@@ -59,7 +59,7 @@ if ( $email_add ) {
     });
     my $email = Koha::Email->new();
     my $patron = Koha::Patrons->find( $borrowernumber );
-    my $user_email = GetFirstValidEmailAddress($borrowernumber)
+    my $user_email = $patron->first_valid_email_address
     || C4::Context->preference('KohaAdminEmailAddress');
 
     my $email_replyto = $patron->firstname . " " . $patron->surname . " <$user_email>";
@@ -192,13 +192,14 @@ END_OF_BODY
     output_html_with_http_headers $query, $cookie, $template->output;
 }
 else {
+    my $new_session_id = $cookie->value;
     $template->param(
         bib_list       => $bib_list,
         url            => "/cgi-bin/koha/opac-sendbasket.pl",
         suggestion     => C4::Context->preference("suggestion"),
         virtualshelves => C4::Context->preference("virtualshelves"),
         csrf_token => Koha::Token->new->generate_csrf(
-            { session_id => scalar $query->cookie('CGISESSID'), } ),
+            { session_id => $new_session_id, } ),
     );
     output_html_with_http_headers $query, $cookie, $template->output;
 }