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 37-42 Link Here
37
                [% IF Koha.Preference( 'EnhancedMessagingPreferencesOPAC' ) || Koha.Preference('TranslateNotices') %]
37
                [% IF Koha.Preference( 'EnhancedMessagingPreferencesOPAC' ) || Koha.Preference('TranslateNotices') %]
38
                    <div id="usermessaging" class="maincontent">
38
                    <div id="usermessaging" class="maincontent">
39
                        <h1>Your messaging settings</h1>
39
                        <h1>Your messaging settings</h1>
40
                        [% IF message_preference_exception %]
41
                            <div class="alert alert-danger">
42
                                <h4>Error</h4>
43
                                [% IF message_preference_exception_ref == 'Koha::Exceptions::Patron::MessagePreference::Transport::TypeNotFound' %]
44
                                <p>Message transport type <strong>[% message_preference_exception.transport_type %]</strong> does not exist.</p>
45
                                [% ELSIF message_preference_exception_ref == 'Koha::Exceptions::Patron::MessagePreference::AttributeNotFound' %]
46
                                <p>Message attribute not found.</p>
47
                                [% ELSIF message_preference_exception_ref == 'Koha::Exceptions::Patron::MessagePreference::DaysInAdvanceOutOfRange' %]
48
                                <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>
49
                                [% ELSIF message_preference_exception_ref == 'Koha::Exceptions::Patron::MessagePreference::DaysInAdvanceNotAvailable' %]
50
                                <p><strong>Days in advance</strong> cannot be selected for <strong>[% message_preference_exception.message_name %]</strong>.</p>
51
                                [% ELSIF message_preference_exception_ref == 'Koha::Exceptions::Patron::MessagePreference::DigestNotAvailable' %]
52
                                <p><strong>Digest</strong> cannot be selected for <strong>[% message_preference_exception.message_name %]</strong>.</p>
53
                                [% ELSIF message_preference_exception_ref == 'Koha::Exceptions::Patron::MessagePreference::DigestRequired' %]
54
                                <p><strong>Digest</strong> must be selected for <strong>[% message_preference_exception.message_name %]</strong>.</p>
55
                                [% ELSIF message_preference_exception_ref == 'Koha::Exceptions::Patron::MessagePreference::EmailAddressRequired' %]
56
                                <p>You cannot select email notifications because you haven't set an email address.</p>
57
                                [% ELSIF message_preference_exception_ref == 'Koha::Exceptions::Patron::MessagePreference::NoTransportType' %]
58
                                <p>Message transport type <strong>[% message_preference_exception.transport_type %]</strong> is not available for [% message_preference_exception.message_name %].</p>
59
                                [% ELSIF message_preference_exception_ref == 'Koha::Exceptions::Patron::MessagePreference::SMSNumberRequired' %]
60
                                <p>You cannot select SMS notifications because you haven't set an SMS number address.</p>
61
                                [% END %]
62
                            </div>
63
                        [% END %]
40
                        [% IF !logged_in_user.email %]
64
                        [% IF !logged_in_user.email %]
41
                            <div class="alert alert-warning">
65
                            <div class="alert alert-warning">
42
                                <h4>Cannot select email notifications</h4>
66
                                <h4>Cannot select email notifications</h4>
(-)a/opac/opac-messaging.pl (-2 / +17 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 qw( get_template_and_user );
26
use C4::Auth qw( get_template_and_user );
25
use C4::Context;
27
use C4::Context;
Lines 62-68 if ( defined $query->param('modify') && $query->param('modify') eq 'yes' ) { Link Here
62
            sms_provider_id => $sms_provider_id,
64
            sms_provider_id => $sms_provider_id,
63
        })->store;
65
        })->store;
64
66
65
        C4::Form::MessagingPreferences::handle_form_action($query, { borrowernumber => $patron->borrowernumber }, $template);
67
        try {
68
69
            C4::Form::MessagingPreferences::handle_form_action($query, { borrowernumber => $patron->borrowernumber }, $template);
70
71
        } catch {
72
            unless ( blessed $_ && $_->can('rethrow') ) {
73
                die $_;
74
            } else {
75
                $template->param(
76
                    message_preference_exception => $_,
77
                    message_preference_exception_ref => ref($_), # FIXME ref() does not exist in Template Toolkit, not sure if this is the best approach
78
                );
79
            }
80
        };
81
66
    }
82
    }
67
83
68
    if ( C4::Context->preference('TranslateNotices') ) {
84
    if ( C4::Context->preference('TranslateNotices') ) {
69
- 

Return to bug 18595