[Koha-bugs] [Bug 18595] Move C4::Members::Messaging to Koha namespace

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Nov 6 10:57:02 CET 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18595

Lari Taskula <lari.taskula at hypernova.fi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #113126|0                           |1
        is obsolete|                            |

--- Comment #118 from Lari Taskula <lari.taskula at hypernova.fi> ---
Created attachment 113222
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=113222&action=edit
Bug 18595: (follow-up) Catch message preference exceptions in OPAC

This patch handles message preference exceptions in OPAC messaging template
instead of the usual white "Internal Server Error" screen.

To test:
0. This test plan assumes you have a default Koha installation that adds
   message attributes and transports from
   installer/data/mysql/mandatory/sample_notices_message_attributes.sql and
   installer/data/mysql/mandatory/sample_notices_message_transports.sql

1. Open developer tools, select console and run the following command:

$('#email1').val('non-existing message transport type').prop('checked', true);
$('form[name=opacmessaging]').submit();

Observe error:
Message transport type non-existing message transport type does not exist.

2. Open developer tools, select console and run the following command:

$($('select[name="2-DAYS"] option')[0]).attr('value', 31);
$('form[name=opacmessaging]').submit();

Observe error:
Days in advance selection is out of range. The value must be between 0 and 30.

3. Run SQL command:

delete from message_transports where message_attribute_id=1 and is_digest=0 \
and message_transport_type='email';

Open developer tools, select console and run the following command:

$('#digest1').prop('checked', false);
$('#forcedigest1').remove();
$('form[name=opacmessaging]').submit();

Observe error:
Digest must be selected for Item_Due.

Recover your test database by running the following SQL command:

insert into message_transports (message_attribute_id, message_transport_type, \
is_digest, letter_module, letter_code) values (1, 'email', 0, 'circulation', \
'DUE');

4. Remove your email address, open developer tools, select console and run the
following command:

$('#email1').removeAttr('disabled');
$('#email1').prop('checked', true);
$('form[name=opacmessaging]').submit();

Observe error:
You cannot select email notifications because you haven't set an email address.

5. Remove your SMS number, open developer tools, select console and run the
following command:

$('#sms1').removeAttr('disabled');
$('#sms1').prop('checked', true);
$('form[name=opacmessaging]').submit();

Observe error:
You cannot select SMS notifications because you haven't set an SMS number
address.

6. The rest of the template error messages are currently inaccessible and
therefore untestable via GUI, but check the changes this patch introduces
manually. These exceptions are:

Koha::Exceptions::Patron::Message::Preference::AttributeNotFound
Koha::Exceptions::Patron::Message::Preference::DaysInAdvanceNotAvailable
Koha::Exceptions::Patron::Message::Preference::DigestNotAvailable

You can test them programmatically by searching opac-messaging.pl for the
following:

C4::Form::MessagingPreferences::handle_form_action( ...

and throwing each exception before it by following code:

Koha::Exceptions::Patron::Message::Preference::AttributeNotFound->throw();

Sponsored-by: The National Library of Finland

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list