Lines 31-38
use Koha::SMS::Providers;
Link Here
|
31 |
use Koha::Token; |
31 |
use Koha::Token; |
32 |
|
32 |
|
33 |
my $query = CGI->new(); |
33 |
my $query = CGI->new(); |
|
|
34 |
my $opac_messaging = C4::Context->preference('EnhancedMessagingPreferencesOPAC'); |
34 |
|
35 |
|
35 |
unless ( C4::Context->preference('EnhancedMessagingPreferencesOPAC') and |
36 |
unless ( ( $opac_messaging or C4::Context->preference('TranslateNotices') ) and |
36 |
C4::Context->preference('EnhancedMessagingPreferences') ) { |
37 |
C4::Context->preference('EnhancedMessagingPreferences') ) { |
37 |
print $query->redirect("/cgi-bin/koha/errors/404.pl"); |
38 |
print $query->redirect("/cgi-bin/koha/errors/404.pl"); |
38 |
exit; |
39 |
exit; |
Lines 48-54
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
Link Here
|
48 |
|
49 |
|
49 |
my $patron = Koha::Patrons->find( $borrowernumber ); # FIXME and if borrowernumber is invalid? |
50 |
my $patron = Koha::Patrons->find( $borrowernumber ); # FIXME and if borrowernumber is invalid? |
50 |
|
51 |
|
51 |
my $messaging_options = C4::Members::Messaging::GetMessagingOptions(); |
52 |
my $messaging_options; |
|
|
53 |
$messaging_options = C4::Members::Messaging::GetMessagingOptions() if $opac_messaging; |
52 |
|
54 |
|
53 |
if ( defined $query->param('modify') && $query->param('modify') eq 'yes' ) { |
55 |
if ( defined $query->param('modify') && $query->param('modify') eq 'yes' ) { |
54 |
die "Wrong CSRF token" unless Koha::Token->new->check_csrf({ |
56 |
die "Wrong CSRF token" unless Koha::Token->new->check_csrf({ |
Lines 56-88
if ( defined $query->param('modify') && $query->param('modify') eq 'yes' ) {
Link Here
|
56 |
token => scalar $query->param('csrf_token'), |
58 |
token => scalar $query->param('csrf_token'), |
57 |
}); |
59 |
}); |
58 |
|
60 |
|
59 |
my $sms = $query->param('SMSnumber'); |
61 |
if( $opac_messaging ) { |
60 |
my $sms_provider_id = $query->param('sms_provider_id'); |
62 |
my $sms = $query->param('SMSnumber'); |
61 |
$patron->set({ |
63 |
my $sms_provider_id = $query->param('sms_provider_id'); |
62 |
smsalertnumber => $sms, |
64 |
$patron->set({ |
63 |
sms_provider_id => $sms_provider_id, |
65 |
smsalertnumber => $sms, |
64 |
})->store; |
66 |
sms_provider_id => $sms_provider_id, |
|
|
67 |
})->store; |
65 |
|
68 |
|
66 |
C4::Form::MessagingPreferences::handle_form_action($query, { borrowernumber => $patron->borrowernumber }, $template); |
69 |
C4::Form::MessagingPreferences::handle_form_action($query, { borrowernumber => $patron->borrowernumber }, $template); |
|
|
70 |
} |
67 |
|
71 |
|
68 |
if ( C4::Context->preference('TranslateNotices') ) { |
72 |
if ( C4::Context->preference('TranslateNotices') ) { |
69 |
$patron->set({ lang => scalar $query->param('lang') })->store; |
73 |
$patron->set({ lang => scalar $query->param('lang') })->store; |
70 |
} |
74 |
} |
71 |
} |
75 |
} |
72 |
|
76 |
|
73 |
C4::Form::MessagingPreferences::set_form_values({ borrowernumber => $patron->borrowernumber }, $template); |
77 |
C4::Form::MessagingPreferences::set_form_values({ borrowernumber => $patron->borrowernumber }, $template) if $opac_messaging; |
74 |
|
78 |
|
75 |
$template->param( |
79 |
$template->param( |
76 |
messagingview => 1, |
80 |
messagingview => 1, |
77 |
SMSnumber => $patron->smsalertnumber, # FIXME This is already sent 2 lines above |
81 |
SMSnumber => $patron->smsalertnumber, # FIXME This is already sent 2 lines above |
78 |
SMSSendDriver => C4::Context->preference("SMSSendDriver"), |
82 |
SMSSendDriver => C4::Context->preference("SMSSendDriver"), |
79 |
TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification") ); |
83 |
TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"), |
|
|
84 |
); |
80 |
|
85 |
|
81 |
if ( C4::Context->preference("SMSSendDriver") eq 'Email' ) { |
86 |
if( $opac_messaging && C4::Context->preference("SMSSendDriver") eq 'Email' ) { |
82 |
my @providers = Koha::SMS::Providers->search( {}, { order_by => 'name' } )->as_list; |
87 |
my @providers = Koha::SMS::Providers->search( {}, { order_by => 'name' } )->as_list; |
83 |
$template->param( |
88 |
$template->param( |
84 |
sms_providers => \@providers, |
89 |
sms_providers => \@providers, |
85 |
sms_provider_id => $patron->sms_provider_id ); |
90 |
sms_provider_id => $patron->sms_provider_id, |
|
|
91 |
); |
86 |
} |
92 |
} |
87 |
|
93 |
|
88 |
my $new_session_id = $query->cookie('CGISESSID'); |
94 |
my $new_session_id = $query->cookie('CGISESSID'); |
89 |
- |
|
|