Bug 32070: Consistent classes for primary buttons: Acquisitions
[koha-ffzg.git] / opac / opac-messaging.pl
index bb44b4c..a221b39 100755 (executable)
@@ -21,12 +21,9 @@ use Modern::Perl;
 
 use CGI qw ( -utf8 );
 
-use C4::Auth;    # checkauth, getborrowernumber.
+use C4::Auth qw( get_template_and_user );
 use C4::Context;
-use C4::Koha;
-use C4::Circulation;
-use C4::Output;
-use C4::Members;
+use C4::Output qw( output_html_with_http_headers );
 use C4::Members::Messaging;
 use C4::Form::MessagingPreferences;
 use Koha::Patrons;
@@ -46,7 +43,6 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
         template_name   => 'opac-messaging.tt',
         query           => $query,
         type            => 'opac',
-        debug           => 1,
     }
 );
 
@@ -83,11 +79,13 @@ $template->param(
                   TalkingTechItivaPhone        =>  C4::Context->preference("TalkingTechItivaPhoneNotification") );
 
 if ( C4::Context->preference("SMSSendDriver") eq 'Email' ) {
-    my @providers = Koha::SMS::Providers->search();
-    $template->param( sms_providers => \@providers, sms_provider_id => $patron->sms_provider_id );
+    my @providers = Koha::SMS::Providers->search( {}, { order_by => 'name' } )->as_list;
+    $template->param(
+            sms_providers => \@providers,
+            sms_provider_id => $patron->sms_provider_id );
 }
 
-my $new_session_id = $cookie->value;
+my $new_session_id = $query->cookie('CGISESSID');
 $template->param(
     csrf_token => Koha::Token->new->generate_csrf({
             session_id => $new_session_id,