[Koha-bugs] [Bug 17499] Koha objects for messaging preferences

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17499

Lari Taskula  changed:

   What|Removed |Added

 Status|Failed QA   |Needs Signoff

--- Comment #165 from Lari Taskula  ---
(In reply to Julian Maurice from comment #152)
> Any update ?
> 
> Koha::MessageAttribute(s) is not used anywhere (except in a test file:
> t/db_dependent/Illrequests.t). It should be easy to replace it with
> Koha::Patron::Message::Attribute(s).

Attached a patch that makes the replacement

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18595

Lari Taskula  changed:

   What|Removed |Added

 Attachment #113769|0   |1
is obsolete||

--- Comment #133 from Lari Taskula  ---
Created attachment 146552
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146552=edit
Bug 18595: (follow-up) Remove duplicated logic

Sponsored-by: The National Library of Finland

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18595

Lari Taskula  changed:

   What|Removed |Added

 Attachment #113222|0   |1
is obsolete||

--- Comment #132 from Lari Taskula  ---
Created attachment 146551
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146551=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::MessagePreference::AttributeNotFound
Koha::Exceptions::Patron::MessagePreference::DaysInAdvanceNotAvailable
Koha::Exceptions::Patron::MessagePreference::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::MessagePreference::AttributeNotFound->throw();

Sponsored-by: The National Library of Finland

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18595

Lari Taskula  changed:

   What|Removed |Added

 Attachment #113221|0   |1
is obsolete||

--- Comment #131 from Lari Taskula  ---
Created attachment 146550
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146550=edit
Bug 18595: (follow-up) Disable transports if missing contact information

To test:
Make sure you have enabled the following system preferences:
- opacuserlogin
- EnhancedMessagingPreferences
- EnhancedMessagingPreferencesOPAC
- SMSSendDriver

 GENERAL 
1. Apply patch

 PREREQUISITES 
1. Select a patron to test this patch with
2. Remove patron's primary email
3. Remove patron's SMS number

 OPAC 
1. Login to OPAC with your test patron.
2. Go to "your messaging" (cgi-bin/koha/opac-messaging.pl).
3. Observe two warnings "Cannot select email notifications" and
   "Cannot select SMS notifications"
4. See that the SMS and Email checkboxes are disabled in the messaging
   preferences table.
5. At the bottom of the page, set SMS number
6. Observe "Cannot select SMS notifications" gone and SMS checkboxes clickable
7. Give your test patron a primary email address
8. Refresh OPAC "your messaging" page
9. Observe all warnings are now gone and both SMS number and Email checkboxes
   in the messaging preferences table are clickable.
10. Set patron some messaging preferences and make sure your change applies.

 INTRANET 
1. Repeat "OPAC" steps but instead of "your messaging" page, use the
   "Modify patron" view.

Sponsored-by: The National Library of Finland

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18595

Lari Taskula  changed:

   What|Removed |Added

 Attachment #112155|0   |1
is obsolete||

--- Comment #130 from Lari Taskula  ---
Created attachment 146549
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146549=edit
Bug 18595: Validate days_in_advance

Rebased-by: Emmi Takkinen 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18595

Lari Taskula  changed:

   What|Removed |Added

 Attachment #112154|0   |1
is obsolete||

--- Comment #129 from Lari Taskula  ---
Created attachment 146548
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146548=edit
Bug 18595: Disable digest checkbox when forced on

To test:
1. Force a digest on via message_transports table
   (delete rows where message_attribute is 1 and is_digest is 0)
SQL: delete from message_transports where message_attribute_id=1 and
is_digest=0;
2. Go to either OPAC or staff client messaging preferences
3. Observe digest checkbox is disabled for message attribute 1
   (normally Item due row)

Rebased-by: Emmi Takkinen 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18595

Lari Taskula  changed:

   What|Removed |Added

 Attachment #112153|0   |1
is obsolete||

--- Comment #128 from Lari Taskula  ---
Created attachment 146547
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146547=edit
Bug 18595: Remove references to C4::Members::Messaging

To test:
1. grep -r 'C4::Members::Messaging'
   This command should not produce any results in Koha source code after this
   patch.
2. Check the pages touched by this commit
3. Try setting and viewing patron and patron category messaging preferences

As this completes the move from C4::Members::Messaging to new Koha-objects for
messaging preferences, everything should be ready for proper testing.

Make sure you have EnhancedMessagingPreferences system preference enabled.
Then, try creating new categories and setting default messaging preferences,
as well as editing the messaging preferences of the already existing
categories.
Try adding new patrons and make sure the default patron messaging preferences
are by default the same that you set for that category. Edit already exisiting
patrons' messaging preferences and make sure changes are applied. Observe
no crash at any point, otherwise fail this patch. Don't forget to test both
intranet and OPAC.

Finally, run unit tests:
1. prove t/db_dependent/Circulation.t
2. prove t/db_dependent/Reserves.t
3. prove t/db_dependent/Koha/Patron/Categories.t

Signed-off-by: Marc Véron 

Signed-off-by: David Bourgault 
Rebased-by: Emmi Takkinen 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18595

Lari Taskula  changed:

   What|Removed |Added

 Attachment #112152|0   |1
is obsolete||

--- Comment #127 from Lari Taskula  ---
Created attachment 146546
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146546=edit
Bug 18595: Move C4::Members::Messaging::SetMessagingPreference

This patch moves C4::Members::Messaging::SetMessagingPreference to
Koha::Patron::MessagePreference
The patch makes a heavy touch on core messaging preference features,
but should not introduce any visible changes for end user. Keep this in mind
if testing. If you notice any changes in Koha, something is probably wrong!

To test:

Make sure you have enabled the following system preferences:
- EnhancedMessagingPreferences

 GENERAL 
1. Apply patch
2. Search Koha source code for references of "SetMessagingPreference"
   (grep -r 'SetMessagingPreference').
3. Observe no results in source code.

 UNIT TESTS 
1. prove t/db_dependent/Circulation.t
2. prove t/db_dependent/Reserves.t
3. prove t/db_dependent/Koha/Patron/Categories.t
4. prove t/db_dependent/api/v1/patrons.t

Works as expected. QA tools fails with:
FAILC4/Members/Messaging.pm pod empty section in previous paragraph
Can be fixed in a followup.
Signed-off-by: Marc Véron 

QA tools pass now OK
Signed-off-by: Marc Véron 

Signed-off-by: David Bourgault 

Rebased-by: Emmi Takkinen 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18595

Lari Taskula  changed:

   What|Removed |Added

 Attachment #112151|0   |1
is obsolete||

--- Comment #126 from Lari Taskula  ---
Created attachment 146545
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146545=edit
Bug 18595: Move C4::Members::Messaging::GetMessagingPreferences

This patch moves C4::Members::Messaging::GetMessagingPreferences to
Koha::Patron::MessagePreference(s)
The patch makes a heavy touch on core messaging preference features,
but should not introduce any visible changes for end user. Keep this in mind
if testing. If you notice any changes in Koha, something is probably wrong!

To test:

Make sure you have enabled the following system preferences:
- EnhancedMessagingPreferences

 GENERAL 
1. Apply patch
2. Search Koha source code for references of "GetMessagingPreferences"
   (grep -r 'GetMessagingPreferences').
3. Observe no results in source code.

 UNIT TESTS 
1. prove t/db_dependent/Circulation.t
2. prove t/db_dependent/Reserves.t
3. prove t/db_dependent/Koha/Patron/Categories.t
4. prove t/db_dependent/api/v1/patrons.t

Signed-off-by: Marc Véron 

Signed-off-by: David Bourgault 

Rebased-by: Emmi Takkinen 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18595

Lari Taskula  changed:

   What|Removed |Added

 Attachment #112150|0   |1
is obsolete||

--- Comment #125 from Lari Taskula  ---
Created attachment 146544
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146544=edit
Bug 18595: Unit tests preparing for GetMessagingPreferences move

This patch prepares removing GetMessagingPreferences by adding some useful unit
tests for subroutines that the move targets.

Reserves.t already covers print notice, but this patch adds tests for a set
transport type.

To test:
1. Run t/db_dependent/Circulation.t
2. Run t/db_dependent/Reserves.t
3. Observe test pass

Works together with followup patch
Signed-off-by: Marc Véron 

Signed-off-by: David Bourgault 
Rebased-by: Emmi Takkinen 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18595

Lari Taskula  changed:

   What|Removed |Added

 Attachment #112149|0   |1
is obsolete||

--- Comment #124 from Lari Taskula  ---
Created attachment 146543
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146543=edit
Bug 18595: Move C4::Members::Messaging::SetMessagingPreferencesFromDefaults

This patch moves C4::Members::SetMessagingPreferencesFromDefaults to
Koha::Patron->set_default_messaging_preferences

The patch makes a heavy touch on core messaging preference features,
but should not introduce any visible changes for end user. Keep this in mind
if testing. If you notice any changes in Koha, something is probably wrong!

To test:

Make sure you have enabled the following system preferences:
- EnhancedMessagingPreferences

 GENERAL 
1. Apply patch
2. Search Koha source code for references of
"SetMessagingPreferencesFromDefaults"
   (grep -r 'SetMessagingPreferencesFromDefaults').
3. Observe no results in source code.

 INTRANET 
1. Login to intranet.
2. Go to Administration -> Patron categories -> Edit (for any category)
3. Scroll down to observe default messaging preferences for this patron
category
4. Observe the preferences, remember them for the next step.
5. Go to cgi-bin/koha/members/memberentry.pl?op=add=XXX, replace
XXX
with the categorycode you were just editing.
6. Look at messaging preferences. They should be same as in step 4.
7. Fill in required data, do not modify messaging preferences, click Save.
8. Observe a new patron with default messaging preferences.

Signed-off-by: Marc Véron 

Signed-off-by: David Bourgault 

Rebased-by: Emmi Takkinen 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18595

Lari Taskula  changed:

   What|Removed |Added

 Attachment #112148|0   |1
is obsolete||

--- Comment #123 from Lari Taskula  ---
Created attachment 146542
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146542=edit
Bug 18595: Move C4::Members::Messaging::GetMessagingOptions

This patch moves C4::Members::GetMessagingOptions to
Koha::Patron::MessagePreferences->get_options.

The patch makes a heavy touch on core messaging preference features,
but should not introduce any visible changes for end user. Keep this in mind
if testing. If you notice any changes in Koha, something is probably wrong!

This patch also removes previously unused GetMessagingOptions in
opac-messaging.pl

To test:

Make sure you have enabled the following system preferences:
- opacuserlogin
- EnhancedMessagingPreferences
- EnhancedMessagingPreferencesOPAC

 GENERAL 
1. Apply patch
2. Search Koha source code for references of "GetMessagingOptions"
   (grep -r 'GetMessagingOptions').
3. Observe no results in source code.

 OPAC 
1. Login to OPAC.
2. Go to "your messaging" (cgi-bin/koha/opac-messaging.pl).
3. Observe the preferences looking normal and as they should be.
4. Set any combination of messaging preferences.
5. Observe them apply as expected, repeat step 4-5 as much as you like.

 INTRANET 
1. Login to intranet.
2. Go to edit patron's details and scroll down to their messaging preferences.
3. Observe the preferences looking normal and as they should be.
4. Set any combination of messaging preferences.
5. Observe them apply as expected, repeat step 4-5 as much as you like.
6. Go to Administration -> Patron categories -> Edit (for any category)
7. Scroll down to observe default messaging preferences for this patron
category
8. Observe the preferences looking normal and as they should be.
9. Set any combination of messaging preferences.
10. Observe them apply as expected, repeat step 9-10 as much as you like.
11. Go to cgi-bin/koha/members/memberentry.pl?op=add=XXX, replace
XXX
with the categorycode you were just editing.
12. Fill in required data, do not modify messaging preferences, click Save.
13. Observe a new patron with default messaging preferences.

Signed-off-by: Marc Véron 

Signed-off-by: David Bourgault 

Rebased-by: Emmi Takkinen 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18595

Lari Taskula  changed:

   What|Removed |Added

 Attachment #112147|0   |1
is obsolete||

--- Comment #122 from Lari Taskula  ---
Created attachment 146541
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146541=edit
Bug 18595: Unit tests for Koha::Patron::Categories->default_messaging

This patch adds unit tests for Koha::Patron::Categories->default_messaging.
Tests
will help preparing for moving C4::Members::Messaging to Koha-objects.

To test:
1. Run t/db_dependent/Koha/Patron/Categories.t

Signed-off-by: Marc Véron 

Signed-off-by: David Bourgault 
Rebased-by: Emmi Takkinen 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


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

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18595

Lari Taskula  changed:

   What|Removed |Added

 Status|Patch doesn't apply |Needs Signoff

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 17499] Koha objects for messaging preferences

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17499

--- Comment #164 from Lari Taskula  ---
Created attachment 146540
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146540=edit
Bug 17499: Replace Koha::MessageAttribute(s) with
Koha::Patron::MessagePreference::Attribute(s)

To test:
1. prove t/db_dependent/Illrequests.t
2. grep -rn 'Koha::MessageAttribute', observe no results in Koha code

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 17499] Koha objects for messaging preferences

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17499

Lari Taskula  changed:

   What|Removed |Added

 Attachment #141418|0   |1
is obsolete||

--- Comment #163 from Lari Taskula  ---
Created attachment 146539
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146539=edit
Bug 17499: (follow-up) Add $patron->messaging_preferences accessor

To test:
1. prove t/db_dependent/Koha/Patron.t

Sponsored-by: The National Library of Finland

Signed-off-by: Michal Denar 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 17499] Koha objects for messaging preferences

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17499

Lari Taskula  changed:

   What|Removed |Added

 Attachment #141417|0   |1
is obsolete||

--- Comment #162 from Lari Taskula  ---
Created attachment 146538
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146538=edit
Bug 17499: (follow-up) Rename to Koha::Patron::MessagePreference

Koha::Patron::Message refers to "messages" table that is used for circulation
messages. MessagePreference now refers to a messaging preference that is used
for enqueued notifications.

To test:
1. prove t/db_dependent/Koha/Patron/MessagePreference/Attributes.t
2. prove t/db_dependent/Koha/Patron/MessagePreference/Transport/Preferences.t
3. prove t/db_dependent/Koha/Patron/MessagePreference/Transport/Types.t
4. prove t/db_dependent/Koha/Patron/MessagePreference/Transports.t
5. prove t/db_dependent/Koha/Patron/MessagePreferences.t

Sponsored-by: The National Library of Finland

Signed-off-by: Michal Denar 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 17499] Koha objects for messaging preferences

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17499

Lari Taskula  changed:

   What|Removed |Added

 Attachment #141416|0   |1
is obsolete||

--- Comment #161 from Lari Taskula  ---
Created attachment 146537
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146537=edit
Bug 17499: (follow-up) Contact information vs. mtt validation

This patch adds a subroutine that handles message transport type validation by
first checking related patron contact information.

As an example, if there is no email address, we shouldn't let email be selected
as a messaging transport type.

The reason to isolate logic into a separate subroutine is that C4/Reserves.pm
_koha_notify_reserve() also uses the same logic and we should not duplicate it.
C4::Reserves::_koha_notify_reserve() will be adjusted to use this new sub in
Bug 18595.

To test:
1. prove t/db_dependent/Koha/Patron/Message/Preferences.t

Sponsored-by: The National Library of Finland

Signed-off-by: Michal Denar 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 17499] Koha objects for messaging preferences

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17499

Lari Taskula  changed:

   What|Removed |Added

 Attachment #141415|0   |1
is obsolete||

--- Comment #160 from Lari Taskula  ---
Created attachment 146536
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146536=edit
Bug 17499: (follow-up) Validate phone and itiva transport types

Message transport types 'phone' and 'itiva' were not validated unlike
'email' and 'sms'. This patch adds equivalent checks to the missing mtts.

To test:
1. prove t/db_dependent/Koha/Patron/Message/Preferences.t

Sponsored-by: The National Library of Finland

Signed-off-by: Michal Denar 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 17499] Koha objects for messaging preferences

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17499

Lari Taskula  changed:

   What|Removed |Added

 Attachment #141414|0   |1
is obsolete||

--- Comment #159 from Lari Taskula  ---
Created attachment 146535
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146535=edit
Bug 17499: (follow-up) Fix warning

Fix warning

DBIx::Class::Storage::DBI::select_single(): Query returned more than one row.
SQL that returns multiple rows is DEPRECATED for ->find and ->single.

Sponsored-by: The National Library of Finland

Signed-off-by: Michal Denar 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 17499] Koha objects for messaging preferences

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17499

Lari Taskula  changed:

   What|Removed |Added

 Attachment #141413|0   |1
is obsolete||

--- Comment #158 from Lari Taskula  ---
Created attachment 146534
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146534=edit
Bug 17499: (follow-up) More explicit exceptions

Adds and throws more detailed exceptions.

This is useful for APIs and generating translatable errors in GUI.

In short, replaces Koha::Exceptions::BadParameter with:

Koha::Exceptions::Patron::NotFound
Koha::Exceptions::Patron::Category
Koha::Exceptions::Patron::Category::NotFound
Koha::Exceptions::Patron::Message::Preference
Koha::Exceptions::Patron::Message::Preference::AttributeNotFound
Koha::Exceptions::Patron::Message::Preference::DaysInAdvanceOutOfRange
Koha::Exceptions::Patron::Message::Preference::DaysInAdvanceNotAvailable
Koha::Exceptions::Patron::Message::Preference::DigestNotAvailable
Koha::Exceptions::Patron::Message::Preference::DigestRequired
Koha::Exceptions::Patron::Message::Preference::EmailAddressRequired
Koha::Exceptions::Patron::Message::Preference::NoTransportType
Koha::Exceptions::Patron::Message::Preference::SMSNumberRequired

To test:
1. prove t/db_dependent/Koha/Patron/Message/Preferences.t

Sponsored-by: The National Library of Finland

Signed-off-by: Michal Denar 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 17499] Koha objects for messaging preferences

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17499

Lari Taskula  changed:

   What|Removed |Added

 Attachment #141412|0   |1
is obsolete||

--- Comment #157 from Lari Taskula  ---
Created attachment 146533
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146533=edit
Bug 17499: (QA follow-up) Fix POD errors

Signed-off-by: Martin Renvoize 

Signed-off-by: Katrin Fischer 

Signed-off-by: Michal Denar 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 17499] Koha objects for messaging preferences

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17499

Lari Taskula  changed:

   What|Removed |Added

 Attachment #141411|0   |1
is obsolete||

--- Comment #156 from Lari Taskula  ---
Created attachment 146532
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146532=edit
Bug 17499: (QA follow-up) Fix Licence Statements

Signed-off-by: Martin Renvoize 

Signed-off-by: Katrin Fischer 

Signed-off-by: Michal Denar 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 17499] Koha objects for messaging preferences

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17499

Lari Taskula  changed:

   What|Removed |Added

 Attachment #141410|0   |1
is obsolete||

--- Comment #155 from Lari Taskula  ---
Created attachment 146531
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146531=edit
Bug 17499: Replace test subroutines with build_object

This patch replaces subroutines used to build test
objects with call to $builder->build_object.

To test prove that tests are still running with:
prove t/db_dependent/Koha/Patron/Message/*

Sponsored-by: Koha-Suomi Oy
Signed-off-by: David Nind 
Signed-off-by: Martin Renvoize 

Signed-off-by: Katrin Fischer 

Signed-off-by: Michal Denar 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 17499] Koha objects for messaging preferences

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17499

Lari Taskula  changed:

   What|Removed |Added

 Attachment #141409|0   |1
is obsolete||

--- Comment #154 from Lari Taskula  ---
Created attachment 146530
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146530=edit
Bug 17499: Define koha_object(s)_class where needed

This patch adds koha_object(s)_class for needed modules
to fix issues with tests.

Sponsored-by: Koha-Suomi Oy
Signed-off-by: David Nind 
Signed-off-by: Martin Renvoize 

Signed-off-by: Katrin Fischer 

Signed-off-by: Michal Denar 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 17499] Koha objects for messaging preferences

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17499

Lari Taskula  changed:

   What|Removed |Added

 Attachment #141408|0   |1
is obsolete||

--- Comment #153 from Lari Taskula  ---
Created attachment 146529
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146529=edit
Bug 17499: Add Koha-objects for messaging preferences

This patch adds Koha-objects for messaging preferences.

Adds simple validation for messaging preferences.

The validation includes
- throw exception if both borrowernumber or categorycode is given for a new
pref
- throw exception if patron for the given borrowernumber is not found
- throw exception if category for the given categorycode is not found
- throw exception if days in advance cannot be configured but is given
- throw exception if days in advance configuration is invalid (value between
0-30)
- throw exception if digest is not available but attempted to set on
- throw exception if digest must be enabled but attempted to set off
- throw exception on duplicate messaging preference

Adds a method for getting available messaging options.

Adds a method for setting default messaging preferenes.
  $patron->set_default_messaging_preferences (where $patron is a Koha::Patron)
  ...or...
  Koha::Patron::Message::Preference->new_from_default({
borrowernumber => 123,
categorycode => "ABC",
message_attribute_id => 1,
  });

Since messaging preference is a feature that has multiple related database
tables,
usage via Koha-objects is sometimes frustrating. This patch adds easy access to
message transport types via
  $preference->message_transport_types  (for
getting)
  $preference->set({ message_transport_types => ['email', 'sms'] }) (for
setting)
  (also supports other calling conventions, see documentation for more)

Adds optional parameter message_name for
Koha::Patron::Message::Preferences->find
and ->search. Simplifies the Koha-object usage by allowing developer to skip
joins
and / or querying the message name via attribute_id from message_attributes
table.

Includes test coverage for basic usage.

To test:
1. prove t/db_dependent/Koha/Patron/Message/*

Following Bug 17499, check also Bug 18595 that replaces C4::Members::Messaging
with these new Koha-objects.

Signed-off-by: Dominic Pichette 
Signed-off-by: David Nind 
Signed-off-by: Martin Renvoize 

Signed-off-by: Katrin Fischer 

Signed-off-by: Michal Denar 

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


[Koha-bugs] [Bug 32447] In items table barcode column can not be filtered

2023-02-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32447

--- Comment #5 from Katrin Fischer  ---
(In reply to Katrin Fischer from comment #2)
> It's not specific to barcode. If you add an URL to the item that makes an
> additional column after barcode appear. Now the URL field and actions are
> not filterable. It appears to always be the last 2 columns?

And then... it is specific to barcode. I think maybe some change I made in
between moved it, but now we are back to barcode not being filterable, even
with other new columns appearing in between? 

I don't understand the datatables well enough to see what's going on here.

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/