View | Details | Raw Unified | Return to bug 18595
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt (+24 lines)
Lines 34-39 Link Here
34
                [% IF Koha.Preference( 'EnhancedMessagingPreferencesOPAC' )  %]
34
                [% IF Koha.Preference( 'EnhancedMessagingPreferencesOPAC' )  %]
35
                    <div id="usermessaging" class="maincontent">
35
                    <div id="usermessaging" class="maincontent">
36
                        <h3>Your messaging settings</h3>
36
                        <h3>Your messaging settings</h3>
37
                        [% IF message_preference_exception %]
38
                            <div class="alert alert-danger">
39
                                <h4>Error</h4>
40
                                [% IF message_preference_exception_ref == 'Koha::Exceptions::Patron::Message::Transport::TypeNotFound' %]
41
                                <p>Message transport type <strong>[% message_preference_exception.transport_type %]</strong> does not exist.</p>
42
                                [% ELSIF message_preference_exception_ref == 'Koha::Exceptions::Patron::Message::Preference::AttributeNotFound' %]
43
                                <p>Message attribute not found.</p>
44
                                [% ELSIF message_preference_exception_ref == 'Koha::Exceptions::Patron::Message::Preference::DaysInAdvanceOutOfRange' %]
45
                                <p><strong>Days in advance</strong> selection is out of range. The value must be between [% message_preference_exception.min %] and [% message_preference_exception.max %].</p>
46
                                [% ELSIF message_preference_exception_ref == 'Koha::Exceptions::Patron::Message::Preference::DaysInAdvanceNotAvailable' %]
47
                                <p><strong>Days in advance</strong> cannot be selected for <strong>[% message_preference_exception.message_name %]</strong>.</p>
48
                                [% ELSIF message_preference_exception_ref == 'Koha::Exceptions::Patron::Message::Preference::DigestNotAvailable' %]
49
                                <p><strong>Digest</strong> cannot be selected for <strong>[% message_preference_exception.message_name %]</strong>.</p>
50
                                [% ELSIF message_preference_exception_ref == 'Koha::Exceptions::Patron::Message::Preference::DigestRequired' %]
51
                                <p><strong>Digest</strong> must be selected for <strong>[% message_preference_exception.message_name %]</strong>.</p>
52
                                [% ELSIF message_preference_exception_ref == 'Koha::Exceptions::Patron::Message::Preference::EmailAddressRequired' %]
53
                                <p>You cannot select email notifications because you haven't set an email address.</p>
54
                                [% ELSIF message_preference_exception_ref == 'Koha::Exceptions::Patron::Message::Preference::NoTransportType' %]
55
                                <p>Message transport type <strong>[% message_preference_exception.transport_type %]</strong> is not available for [% message_preference_exception.message_name %].</p>
56
                                [% ELSIF message_preference_exception_ref == 'Koha::Exceptions::Patron::Message::Preference::SMSNumberRequired' %]
57
                                <p>You cannot select SMS notifications because you haven't set an SMS number address.</p>
58
                                [% END %]
59
                            </div>
60
                        [% END %]
37
                        [% IF !logged_in_user.email %]
61
                        [% IF !logged_in_user.email %]
38
                            <div class="alert alert-warning">
62
                            <div class="alert alert-warning">
39
                                <h4>Cannot select email notifications</h4>
63
                                <h4>Cannot select email notifications</h4>
(-)a/opac/opac-messaging.pl (-2 / +15 lines)
Lines 20-25 Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use CGI qw ( -utf8 );
22
use CGI qw ( -utf8 );
23
use Scalar::Util qw( blessed );
24
use Try::Tiny;
23
25
24
use C4::Auth;    # checkauth, getborrowernumber.
26
use C4::Auth;    # checkauth, getborrowernumber.
25
use C4::Context;
27
use C4::Context;
Lines 64-71 if ( defined $query->param('modify') && $query->param('modify') eq 'yes' ) { Link Here
64
        sms_provider_id => $sms_provider_id,
66
        sms_provider_id => $sms_provider_id,
65
    })->store;
67
    })->store;
66
68
67
    C4::Form::MessagingPreferences::handle_form_action($query, { borrowernumber => $patron->borrowernumber }, $template);
69
    try {
68
70
71
        C4::Form::MessagingPreferences::handle_form_action($query, { borrowernumber => $patron->borrowernumber }, $template);
72
73
    } catch {
74
        unless ( blessed $_ && $_->can('rethrow') ) {
75
            die $_;
76
        } else {
77
            $template->param(
78
                message_preference_exception => $_,
79
                message_preference_exception_ref => ref($_), # FIXME ref() does not exist in Template Toolkit, not sure if this is the best approach
80
            );
81
        }
82
    };
69
    if ( C4::Context->preference('TranslateNotices') ) {
83
    if ( C4::Context->preference('TranslateNotices') ) {
70
        $patron->set({ lang => scalar $query->param('lang') })->store;
84
        $patron->set({ lang => scalar $query->param('lang') })->store;
71
    }
85
    }
72
- 

Return to bug 18595