Bug 22818 - ILL should be able to send notices
Summary: ILL should be able to send notices
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: ILL (show other bugs)
Version: master
Hardware: All All
: P5 - low new feature with 1 vote (vote)
Assignee: Martin Renvoize
QA Contact: Tomás Cohen Arazi
URL:
Keywords: Manual, release-notes-needed
: 18588 20917 23614 23615 24256 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-05-01 10:23 UTC by Andrew Isherwood
Modified: 2020-09-16 14:06 UTC (History)
13 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
This patch adds the ability for ILL to send notices, both triggered by staff and triggered by events. Staff can trigger notices to patrons from the "Manage ILL request" screen: - ILL request ready for pickup - ILL request unavailable - Place request with partners The following notices to staff are triggered automatically: - Request has been modified by patron - Request has been cancelled by patron Branches can now specify an "ILL email" address to which notices intended to inform staff of changes to requests by patrons can be sent. The sending of notices is controlled by a few new sysprefs: - "ILLDefaultStaffEmail" - Fallback email address for staff ILL notices to be sent to in the absence of a branch address - "ILLSendStaffNotices" - To specify which staff notices should be sent automatically when requests are manipulated by patrons Patron notices are also controlled by the patron's messaging preferences.
Version(s) released in:


Attachments
Bug 22818: Add notices sysprefs and DB column (21.26 KB, patch)
2019-05-16 13:50 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add support for ILL notices (4.44 KB, patch)
2019-05-16 13:50 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add generation and sending of notices (23.40 KB, patch)
2019-05-16 13:50 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add MessageAttribut{e,es}.pm (3.06 KB, patch)
2019-05-16 13:50 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Unit tests (9.74 KB, patch)
2019-05-16 13:50 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add notices sysprefs and DB column (21.26 KB, patch)
2019-05-24 15:38 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add support for ILL notices (4.43 KB, patch)
2019-05-24 15:38 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add generation and sending of notices (23.40 KB, patch)
2019-05-24 15:38 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add MessageAttribut{e,es}.pm (3.06 KB, patch)
2019-05-24 15:38 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Unit tests (9.74 KB, patch)
2019-05-24 15:38 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add notices sysprefs and DB column (21.35 KB, patch)
2019-06-18 08:24 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 22818: Add support for ILL notices (4.53 KB, patch)
2019-06-18 08:24 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 22818: Add generation and sending of notices (23.50 KB, patch)
2019-06-18 08:24 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 22818: Add MessageAttribut{e,es}.pm (3.16 KB, patch)
2019-06-18 08:24 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 22818: Unit tests (9.83 KB, patch)
2019-06-18 08:24 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 22818: Add notices sysprefs and DB column (21.35 KB, patch)
2019-09-17 14:14 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add support for ILL notices (4.77 KB, patch)
2019-09-17 14:14 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add generation and sending of notices (23.50 KB, patch)
2019-09-17 14:14 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add MessageAttribut{e,es}.pm (3.16 KB, patch)
2019-09-17 14:14 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Unit tests (9.83 KB, patch)
2019-09-17 14:14 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add notices sysprefs and DB column (21.00 KB, patch)
2020-03-06 10:22 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add support for ILL notices (4.77 KB, patch)
2020-03-06 10:22 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add generation and sending of notices (23.50 KB, patch)
2020-03-06 10:22 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add MessageAttribut{e,es}.pm (3.16 KB, patch)
2020-03-06 10:22 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Unit tests (9.83 KB, patch)
2020-03-06 10:22 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add notices sysprefs and DB column (20.85 KB, patch)
2020-04-20 10:58 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add support for ILL notices (4.78 KB, patch)
2020-04-20 10:59 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add generation and sending of notices (23.49 KB, patch)
2020-04-20 10:59 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add MessageAttribut{e,es}.pm (3.14 KB, patch)
2020-04-20 10:59 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Unit tests (9.80 KB, patch)
2020-04-20 10:59 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add notices sysprefs and DB column (20.85 KB, patch)
2020-06-30 08:35 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add support for ILL notices (4.78 KB, patch)
2020-06-30 08:36 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add generation and sending of notices (23.49 KB, patch)
2020-06-30 08:36 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add MessageAttribut{e,es}.pm (3.14 KB, patch)
2020-06-30 08:36 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Unit tests (9.80 KB, patch)
2020-06-30 08:36 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 22818: Add notices sysprefs and DB column (20.17 KB, patch)
2020-07-09 07:45 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: Add support for ILL notices (4.84 KB, patch)
2020-07-09 07:45 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: Add generation and sending of notices (23.56 KB, patch)
2020-07-09 07:46 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: Add MessageAttribut{e,es}.pm (3.20 KB, patch)
2020-07-09 07:46 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: Unit tests (9.87 KB, patch)
2020-07-09 07:46 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: (QA follow-up) Email addressing corrections (12.58 KB, patch)
2020-07-09 07:46 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: (QA follow-up) Licence and POD fixes (4.12 KB, patch)
2020-07-09 08:30 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: (QA follow-up) Template CASE correction (1.42 KB, patch)
2020-07-09 08:43 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: (QA follow-up) Template CASE correction (1.42 KB, patch)
2020-07-09 09:27 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: (QA follow-up) Translation fix + Branch notices (1.45 KB, patch)
2020-07-09 09:27 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: Add notices sysprefs and DB column (20.63 KB, patch)
2020-07-09 11:23 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: Add support for ILL notices (4.84 KB, patch)
2020-07-09 11:23 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: Add generation and sending of notices (23.56 KB, patch)
2020-07-09 11:23 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: Add MessageAttribut{e,es}.pm (3.20 KB, patch)
2020-07-09 11:23 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: Unit tests (9.87 KB, patch)
2020-07-09 11:23 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: (QA follow-up) Email addressing corrections (12.79 KB, patch)
2020-07-09 11:23 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: (QA follow-up) Licence and POD fixes (4.18 KB, patch)
2020-07-09 11:23 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: (QA follow-up) Template CASE correction (1.49 KB, patch)
2020-07-09 11:23 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: (QA follow-up) Translation fix + Branch notices (1.51 KB, patch)
2020-07-09 11:23 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: (QA follow-up) Sample Notices (23.51 KB, patch)
2020-07-09 11:24 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: Add notices sysprefs and DB column (20.81 KB, patch)
2020-09-16 13:43 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: Add support for ILL notices (4.84 KB, patch)
2020-09-16 13:43 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: Add generation and sending of notices (23.56 KB, patch)
2020-09-16 13:44 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: Add MessageAttribut{e,es}.pm (3.20 KB, patch)
2020-09-16 13:44 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: Unit tests (9.87 KB, patch)
2020-09-16 13:44 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: (QA follow-up) Email addressing corrections (12.79 KB, patch)
2020-09-16 13:44 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: (QA follow-up) Licence and POD fixes (3.61 KB, patch)
2020-09-16 13:44 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: (QA follow-up) Template CASE correction (1.49 KB, patch)
2020-09-16 13:44 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: (QA follow-up) Translation fix + Branch notices (1.51 KB, patch)
2020-09-16 13:44 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: (QA follow-up) Sample Notices (23.51 KB, patch)
2020-09-16 13:45 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: (DO NOT PUSH) Schema Updates (3.07 KB, patch)
2020-09-16 13:45 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22818: (QA follow-up) Add mandatory data at install time (1.94 KB, patch)
2020-09-16 14:02 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Isherwood 2019-05-01 10:23:18 UTC
Currently ILL has no ability to send notices. There are a number of events that would warrant a notice being send out, these include:

To patron:
- Request ready for pickup
- Item requested not available

To staff:
- Request cancelled by patron
- Request modified by patron

To supplier:
- "Request from partner"

The last one, "Request from partner", is currently send via an ad-hoc function, but would make sense to convert to a notice.
Comment 1 Andrew Isherwood 2019-05-16 13:50:45 UTC
Created attachment 89831 [details] [review]
Bug 22818: Add notices sysprefs and DB column

This patch adds two new sysprefs. 'ILLDefaultEmail', 'ILLSendStaffNotices' and a new column to the
branches table called 'branchillemail'. It also adds five ILL related
notices.

Here we are providing the ability for a branch to have a dedicated email
address for it's ILL staff, the idea being that any notices sent by ILL
to staff need to go to specific staff, rather than the general branch
email address. If no branch specific address is defined, the address
specified in the ILLDefaultEmail syspref is used.

We're also providing a syspref 'ILLSendStaffNotices' to allow the user to specify which
notices should be sent to staff upon certain events.

We are also providing patron messaging preferences for the two patron
bound notices

We are also providing five notices for various ILL related events.
Comment 2 Andrew Isherwood 2019-05-16 13:50:47 UTC
Created attachment 89832 [details] [review]
Bug 22818: Add support for ILL notices

Here we're just adding ILL notices to the existing "letters"
infrastructure so notices can be displayed and edited
Comment 3 Andrew Isherwood 2019-05-16 13:50:50 UTC
Created attachment 89833 [details] [review]
Bug 22818: Add generation and sending of notices

This patch adds the ability for ILL to send notices, both triggered by
staff and triggered by events.

Staff can trigger notices to patrons from the "Manage ILL request" screen:
- ILL request ready for pickup
- ILL request unavailable
- Place request with partners

The following notices to staff are triggered automatically:
- Request has been modified by patron
- Request has been cancelled by patron

Branches can now specify an "ILL email" address to which notices
intended to inform staff of changes to requests by patrons can be sent.

The sending of notices is controlled by a few new sysprefs:
- "ILLDefaultStaffEmail" - Fallback email address for staff ILL notices
to be sent to in the absence of a branch address
- "ILLSendStaffNotices" - To specify which staff notices should be sent
automatically when requests are manipulated by patrons

Patron notices are also controlled by the patron's messaging
preferences
Comment 4 Andrew Isherwood 2019-05-16 13:50:52 UTC
Created attachment 89834 [details] [review]
Bug 22818: Add MessageAttribut{e,es}.pm

We need to be able to access individual message attributes in tests, so
adding accessors for them
Comment 5 Andrew Isherwood 2019-05-16 13:50:55 UTC
Created attachment 89835 [details] [review]
Bug 22818: Unit tests

This patch adds unit tests for the new methods in Illrequest.pm
Comment 6 Andrew Isherwood 2019-05-16 13:51:23 UTC
- Apply patch
- Update database and schema

- Create a report using the following SQL in order to verify that notices are being generated:
SELECT borrowernumber, subject, content, message_transport_type, to_address, from_address FROM message_queue WHERE letter_code LIKE 'ILL%' ORDER BY message_id DESC

- Create one or more "partners". These are patrons that belong to a patron category that has a code that matches the <partner_code> value in your koha-conf.xml (default is ILLLIBS). Patrons in this category must have a primary email defined. Patrons defined in this way are offered as request partners within the ILL interface.

SYSTEM PREFERENCES AND BRANCH CONFIG
- In the staff interface, go to Tools > Notices & Slips
=> TEST: Observe that there are 5 new notices defined for the "Interlibrary loans" module
- Go to "Koha administration" > "Libraries"
- Choose a library and "Edit" it
=> TEST: Observe there is a new "ILL staff email" field
- Enter an email address in the "ILL staff email" field and save the branch
- Go to "Koha administration" > search for the "ILLDefaultStaffEmail" syspref
=> TEST: Observe the new syspref exists
- Enter an email address in this syspref and then save it
- Go to "Koha administration" > search for the "ILLSendStaffNotices" syspref
=> TEST: Observe the new syspref exists
- Enter the names of the two staff notices in this syspref as "ILL_REQUEST_CANCEL|ILL_REQUEST_MODIFIED" and save the syspref

PATRON MESSAGING PREFERENCES
- Go to a patron's messaging preferences
=> TEST: Observe that two new messaging preferences exist, "Interlibrary loan ready" & "Interlibrary loan unavailable"
- Select email and/or SMS for each of these notices

SENDING PATRON NOTICES FROM ILL REQUEST
- In the staff interface, go to "ILL requests"
- Create an ILL request using the FreeForm backend (for the user you just modified the messaging preferences for), select the branch that you previously added the "ILL staff email" address to
- Go to the "Manage ILL request" screen for the newly created request
=> TEST: Observe that there is a new "Send notice to patron" dropdown in the button bar which offers two notices to send
- Select a notice to be sent
=> TEST: Observe that a message reporting the successful queueing of the notice is displayed
- Click on the "ILL request log" for the request
=> TEST: Observe that a log entry "Patron notice sent:" was added to the log
- Run the report created earlier
=> TEST: Observe that a notice was created for all sending methods selected in the patron's messaging preferences
=> TEST: Observe that the borrowernumber column of the notice is populated

SENDING REQUEST TO PARTNERS
- Go to the "Manage ILL request" screen for a request
- Choose "Place request with partners"
=> TEST: Observe that the text defined in the ILL_PARTNER_REQ notice is displayed and can be modified
- Select one or more partners that were defined earlier, then click "Send email"
=> TEST: Observe that the request's status has changed to "Requested from partners"
- Run the report created earlier
=> TEST: Observe that a notice was created for each selected partner
=> TEST: Observe that the to_address column matches the primary email address for the partner
=> TEST: Observe that the from_address matches the previously defined "ILL staff email" for the request's branch

PATRON GENERATED NOTICES
- As a patron with ILL requests, go to the "your interlibrary loan requests" page in the OPAC
- View a request
- Add some text to the notes field and save
- Run the report created earlier
=> TEST: Observe that a notice was created for the modification
=> TEST: Observe that the to_address matches the previously defined "ILL staff email" for the request's branch
=> TEST: Observe that the from_address matches the previously defined "ILL staff email" for the request's branch
- As a patron with ILL requests, go to the "your interlibrary loan requests" page in the OPAC
- View a request
- Choose "Request cancellation"
- Run the report created earlier
=> TEST: Observe that a notice was created for the modification
=> TEST: Observe that the to_address matches the previously defined "ILL staff email" for the request's branch
=> TEST: Observe that the from_address matches the previously defined "ILL staff email" for the request's branch

There is a fallback hierarchy for the address to which staff notices are sent:

Branch ILL staff email > ILLDefaultStaffEmail > General branch email > Koha admin email

Please test that this hierarchy is adhered to by undefining one or more of these options.
Comment 7 Andrew Isherwood 2019-05-24 11:54:04 UTC
*** Bug 18588 has been marked as a duplicate of this bug. ***
Comment 8 Andrew Isherwood 2019-05-24 15:38:21 UTC
Created attachment 90063 [details] [review]
Bug 22818: Add notices sysprefs and DB column

This patch adds two new sysprefs. 'ILLDefaultEmail', 'ILLSendStaffNotices' and a new column to the
branches table called 'branchillemail'. It also adds five ILL related
notices.

Here we are providing the ability for a branch to have a dedicated email
address for it's ILL staff, the idea being that any notices sent by ILL
to staff need to go to specific staff, rather than the general branch
email address. If no branch specific address is defined, the address
specified in the ILLDefaultEmail syspref is used.

We're also providing a syspref 'ILLSendStaffNotices' to allow the user to specify which
notices should be sent to staff upon certain events.

We are also providing patron messaging preferences for the two patron
bound notices

We are also providing five notices for various ILL related events.
Comment 9 Andrew Isherwood 2019-05-24 15:38:24 UTC
Created attachment 90064 [details] [review]
Bug 22818: Add support for ILL notices

Here we're just adding ILL notices to the existing "letters"
infrastructure so notices can be displayed and edited
Comment 10 Andrew Isherwood 2019-05-24 15:38:27 UTC
Created attachment 90065 [details] [review]
Bug 22818: Add generation and sending of notices

This patch adds the ability for ILL to send notices, both triggered by
staff and triggered by events.

Staff can trigger notices to patrons from the "Manage ILL request" screen:
- ILL request ready for pickup
- ILL request unavailable
- Place request with partners

The following notices to staff are triggered automatically:
- Request has been modified by patron
- Request has been cancelled by patron

Branches can now specify an "ILL email" address to which notices
intended to inform staff of changes to requests by patrons can be sent.

The sending of notices is controlled by a few new sysprefs:
- "ILLDefaultStaffEmail" - Fallback email address for staff ILL notices
to be sent to in the absence of a branch address
- "ILLSendStaffNotices" - To specify which staff notices should be sent
automatically when requests are manipulated by patrons

Patron notices are also controlled by the patron's messaging
preferences
Comment 11 Andrew Isherwood 2019-05-24 15:38:30 UTC
Created attachment 90066 [details] [review]
Bug 22818: Add MessageAttribut{e,es}.pm

We need to be able to access individual message attributes in tests, so
adding accessors for them
Comment 12 Andrew Isherwood 2019-05-24 15:38:32 UTC
Created attachment 90067 [details] [review]
Bug 22818: Unit tests

This patch adds unit tests for the new methods in Illrequest.pm
Comment 13 Andrew Isherwood 2019-06-03 13:11:50 UTC
Slightly revised test plan:

- Apply patch
- Update database and schema

- Create a report using the following SQL in order to verify that notices are being generated:
SELECT borrowernumber, subject, content, message_transport_type, to_address, from_address FROM message_queue WHERE letter_code LIKE 'ILL%' ORDER BY message_id DESC

- Create one or more "partners". These are patrons that belong to a patron category that has a code that matches the <partner_code> value in your koha-conf.xml (default is ILLLIBS). Patrons in this category must have a primary email defined. Patrons defined in this way are offered as request partners within the ILL interface.

- Go to "Koha administration", search for "IllLog" syspref, ensure it is set to "Log"

SYSTEM PREFERENCES AND BRANCH CONFIG
- In the staff interface, go to Tools > Notices & Slips
=> TEST: Observe that there are 5 new notices defined for the "Interlibrary loans" module
- Go to "Koha administration" > "Libraries"
- Choose a library and "Edit" it
=> TEST: Observe there is a new "ILL staff email" field
- Enter an email address in the "ILL staff email" field and save the branch
- Go to "Koha administration" > search for the "ILLDefaultStaffEmail" syspref
=> TEST: Observe the new syspref exists
- Enter an email address in this syspref and then save it
- Go to "Koha administration" > search for the "ILLSendStaffNotices" syspref
=> TEST: Observe the new syspref exists
- Enter the names of the two staff notices in this syspref as "ILL_REQUEST_CANCEL|ILL_REQUEST_MODIFIED" and save the syspref

PATRON MESSAGING PREFERENCES
- Go to a patron's messaging preferences
=> TEST: Observe that two new messaging preferences exist, "Interlibrary loan ready" & "Interlibrary loan unavailable"
- Select email and/or SMS for each of these notices

SENDING PATRON NOTICES FROM ILL REQUEST
- In the staff interface, go to "ILL requests"
- Create an ILL request using the FreeForm backend (for the user you just modified the messaging preferences for), select the branch that you previously added the "ILL staff email" address to
- Go to the "Manage ILL request" screen for the newly created request
=> TEST: Observe that there is a new "Send notice to patron" dropdown in the button bar which offers two notices to send
- Select a notice to be sent
=> TEST: Observe that a message reporting the successful queueing of the notice is displayed
- Click on the "ILL request log" for the request
=> TEST: Observe that a log entry "Patron notice sent:" was added to the log
- Run the report created earlier
=> TEST: Observe that a notice was created for all sending methods selected in the patron's messaging preferences
=> TEST: Observe that the borrowernumber column of the notice is populated

SENDING REQUEST TO PARTNERS
- Go to the "Manage ILL request" screen for a request
- Choose "Place request with partners"
=> TEST: Observe that the text defined in the ILL_PARTNER_REQ notice is displayed and can be modified
- Select one or more partners that were defined earlier, then click "Send email"
=> TEST: Observe that the request's status has changed to "Requested from partners"
- Run the report created earlier
=> TEST: Observe that a notice was created for each selected partner
=> TEST: Observe that the to_address column matches the primary email address for the partner
=> TEST: Observe that the from_address matches the previously defined "ILL staff email" for the request's branch

PATRON GENERATED NOTICES
- As a patron with ILL requests, go to the "your interlibrary loan requests" page in the OPAC
- View a request
- Add some text to the notes field and save
- Run the report created earlier
=> TEST: Observe that a notice was created for the modification
=> TEST: Observe that the to_address matches the previously defined "ILL staff email" for the request's branch
=> TEST: Observe that the from_address matches the previously defined "ILL staff email" for the request's branch
- As a patron with ILL requests, go to the "your interlibrary loan requests" page in the OPAC
- View a request
- Choose "Request cancellation"
- Run the report created earlier
=> TEST: Observe that a notice was created for the modification
=> TEST: Observe that the to_address matches the previously defined "ILL staff email" for the request's branch
=> TEST: Observe that the from_address matches the previously defined "ILL staff email" for the request's branch

There is a fallback hierarchy for the address to which staff notices are sent:

Branch ILL staff email > ILLDefaultStaffEmail > General branch email > Koha admin email

Please test that this hierarchy is adhered to by undefining one or more of these options.
Comment 14 PTFS Europe Sandboxes 2019-06-18 08:24:09 UTC
Created attachment 90715 [details] [review]
Bug 22818: Add notices sysprefs and DB column

This patch adds two new sysprefs. 'ILLDefaultEmail', 'ILLSendStaffNotices' and a new column to the
branches table called 'branchillemail'. It also adds five ILL related
notices.

Here we are providing the ability for a branch to have a dedicated email
address for it's ILL staff, the idea being that any notices sent by ILL
to staff need to go to specific staff, rather than the general branch
email address. If no branch specific address is defined, the address
specified in the ILLDefaultEmail syspref is used.

We're also providing a syspref 'ILLSendStaffNotices' to allow the user to specify which
notices should be sent to staff upon certain events.

We are also providing patron messaging preferences for the two patron
bound notices

We are also providing five notices for various ILL related events.

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 15 PTFS Europe Sandboxes 2019-06-18 08:24:13 UTC
Created attachment 90716 [details] [review]
Bug 22818: Add support for ILL notices

Here we're just adding ILL notices to the existing "letters"
infrastructure so notices can be displayed and edited

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 16 PTFS Europe Sandboxes 2019-06-18 08:24:16 UTC
Created attachment 90717 [details] [review]
Bug 22818: Add generation and sending of notices

This patch adds the ability for ILL to send notices, both triggered by
staff and triggered by events.

Staff can trigger notices to patrons from the "Manage ILL request" screen:
- ILL request ready for pickup
- ILL request unavailable
- Place request with partners

The following notices to staff are triggered automatically:
- Request has been modified by patron
- Request has been cancelled by patron

Branches can now specify an "ILL email" address to which notices
intended to inform staff of changes to requests by patrons can be sent.

The sending of notices is controlled by a few new sysprefs:
- "ILLDefaultStaffEmail" - Fallback email address for staff ILL notices
to be sent to in the absence of a branch address
- "ILLSendStaffNotices" - To specify which staff notices should be sent
automatically when requests are manipulated by patrons

Patron notices are also controlled by the patron's messaging
preferences

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 17 PTFS Europe Sandboxes 2019-06-18 08:24:19 UTC
Created attachment 90718 [details] [review]
Bug 22818: Add MessageAttribut{e,es}.pm

We need to be able to access individual message attributes in tests, so
adding accessors for them

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 18 PTFS Europe Sandboxes 2019-06-18 08:24:22 UTC
Created attachment 90719 [details] [review]
Bug 22818: Unit tests

This patch adds unit tests for the new methods in Illrequest.pm

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 19 Andrew Isherwood 2019-08-02 13:00:29 UTC
*** Bug 20917 has been marked as a duplicate of this bug. ***
Comment 20 Andrew Isherwood 2019-09-17 14:14:41 UTC
Created attachment 92898 [details] [review]
Bug 22818: Add notices sysprefs and DB column

This patch adds two new sysprefs. 'ILLDefaultEmail', 'ILLSendStaffNotices' and a new column to the
branches table called 'branchillemail'. It also adds five ILL related
notices.

Here we are providing the ability for a branch to have a dedicated email
address for it's ILL staff, the idea being that any notices sent by ILL
to staff need to go to specific staff, rather than the general branch
email address. If no branch specific address is defined, the address
specified in the ILLDefaultEmail syspref is used.

We're also providing a syspref 'ILLSendStaffNotices' to allow the user to specify which
notices should be sent to staff upon certain events.

We are also providing patron messaging preferences for the two patron
bound notices

We are also providing five notices for various ILL related events.

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 21 Andrew Isherwood 2019-09-17 14:14:44 UTC
Created attachment 92899 [details] [review]
Bug 22818: Add support for ILL notices

Here we're just adding ILL notices to the existing "letters"
infrastructure so notices can be displayed and edited

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 22 Andrew Isherwood 2019-09-17 14:14:48 UTC
Created attachment 92900 [details] [review]
Bug 22818: Add generation and sending of notices

This patch adds the ability for ILL to send notices, both triggered by
staff and triggered by events.

Staff can trigger notices to patrons from the "Manage ILL request" screen:
- ILL request ready for pickup
- ILL request unavailable
- Place request with partners

The following notices to staff are triggered automatically:
- Request has been modified by patron
- Request has been cancelled by patron

Branches can now specify an "ILL email" address to which notices
intended to inform staff of changes to requests by patrons can be sent.

The sending of notices is controlled by a few new sysprefs:
- "ILLDefaultStaffEmail" - Fallback email address for staff ILL notices
to be sent to in the absence of a branch address
- "ILLSendStaffNotices" - To specify which staff notices should be sent
automatically when requests are manipulated by patrons

Patron notices are also controlled by the patron's messaging
preferences

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 23 Andrew Isherwood 2019-09-17 14:14:51 UTC
Created attachment 92901 [details] [review]
Bug 22818: Add MessageAttribut{e,es}.pm

We need to be able to access individual message attributes in tests, so
adding accessors for them

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 24 Andrew Isherwood 2019-09-17 14:14:55 UTC
Created attachment 92902 [details] [review]
Bug 22818: Unit tests

This patch adds unit tests for the new methods in Illrequest.pm

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 25 Andrew Isherwood 2019-09-17 15:10:31 UTC
*** Bug 23614 has been marked as a duplicate of this bug. ***
Comment 26 Andrew Isherwood 2019-09-17 15:10:54 UTC
*** Bug 23615 has been marked as a duplicate of this bug. ***
Comment 27 Tomás Cohen Arazi 2019-09-17 16:56:45 UTC
I'm starting to test this. I would like to say that I see more and more the need to have an ILL configuration section in the staff interface.
Comment 28 Katrin Fischer 2019-12-22 13:58:28 UTC
*** Bug 24256 has been marked as a duplicate of this bug. ***
Comment 29 Andrew Isherwood 2020-03-06 10:22:34 UTC
Created attachment 100234 [details] [review]
Bug 22818: Add notices sysprefs and DB column

This patch adds two new sysprefs. 'ILLDefaultEmail', 'ILLSendStaffNotices' and a new column to the
branches table called 'branchillemail'. It also adds five ILL related
notices.

Here we are providing the ability for a branch to have a dedicated email
address for it's ILL staff, the idea being that any notices sent by ILL
to staff need to go to specific staff, rather than the general branch
email address. If no branch specific address is defined, the address
specified in the ILLDefaultEmail syspref is used.

We're also providing a syspref 'ILLSendStaffNotices' to allow the user to specify which
notices should be sent to staff upon certain events.

We are also providing patron messaging preferences for the two patron
bound notices

We are also providing five notices for various ILL related events.

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 30 Andrew Isherwood 2020-03-06 10:22:37 UTC
Created attachment 100235 [details] [review]
Bug 22818: Add support for ILL notices

Here we're just adding ILL notices to the existing "letters"
infrastructure so notices can be displayed and edited

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 31 Andrew Isherwood 2020-03-06 10:22:41 UTC
Created attachment 100236 [details] [review]
Bug 22818: Add generation and sending of notices

This patch adds the ability for ILL to send notices, both triggered by
staff and triggered by events.

Staff can trigger notices to patrons from the "Manage ILL request" screen:
- ILL request ready for pickup
- ILL request unavailable
- Place request with partners

The following notices to staff are triggered automatically:
- Request has been modified by patron
- Request has been cancelled by patron

Branches can now specify an "ILL email" address to which notices
intended to inform staff of changes to requests by patrons can be sent.

The sending of notices is controlled by a few new sysprefs:
- "ILLDefaultStaffEmail" - Fallback email address for staff ILL notices
to be sent to in the absence of a branch address
- "ILLSendStaffNotices" - To specify which staff notices should be sent
automatically when requests are manipulated by patrons

Patron notices are also controlled by the patron's messaging
preferences

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 32 Andrew Isherwood 2020-03-06 10:22:44 UTC
Created attachment 100237 [details] [review]
Bug 22818: Add MessageAttribut{e,es}.pm

We need to be able to access individual message attributes in tests, so
adding accessors for them

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 33 Andrew Isherwood 2020-03-06 10:22:48 UTC
Created attachment 100238 [details] [review]
Bug 22818: Unit tests

This patch adds unit tests for the new methods in Illrequest.pm

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 34 Katrin Fischer 2020-04-19 21:55:57 UTC
Hi Andrew, the patches no longer apply, sorry for not getting here earlier. Can you please rebase?
Comment 35 Andrew Isherwood 2020-04-20 10:58:58 UTC
Created attachment 103268 [details] [review]
Bug 22818: Add notices sysprefs and DB column

This patch adds two new sysprefs. 'ILLDefaultEmail', 'ILLSendStaffNotices' and a new column to the
branches table called 'branchillemail'. It also adds five ILL related
notices.

Here we are providing the ability for a branch to have a dedicated email
address for it's ILL staff, the idea being that any notices sent by ILL
to staff need to go to specific staff, rather than the general branch
email address. If no branch specific address is defined, the address
specified in the ILLDefaultEmail syspref is used.

We're also providing a syspref 'ILLSendStaffNotices' to allow the user to specify which
notices should be sent to staff upon certain events.

We are also providing patron messaging preferences for the two patron
bound notices

We are also providing five notices for various ILL related events.

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 36 Andrew Isherwood 2020-04-20 10:59:02 UTC
Created attachment 103269 [details] [review]
Bug 22818: Add support for ILL notices

Here we're just adding ILL notices to the existing "letters"
infrastructure so notices can be displayed and edited

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 37 Andrew Isherwood 2020-04-20 10:59:06 UTC
Created attachment 103270 [details] [review]
Bug 22818: Add generation and sending of notices

This patch adds the ability for ILL to send notices, both triggered by
staff and triggered by events.

Staff can trigger notices to patrons from the "Manage ILL request" screen:
- ILL request ready for pickup
- ILL request unavailable
- Place request with partners

The following notices to staff are triggered automatically:
- Request has been modified by patron
- Request has been cancelled by patron

Branches can now specify an "ILL email" address to which notices
intended to inform staff of changes to requests by patrons can be sent.

The sending of notices is controlled by a few new sysprefs:
- "ILLDefaultStaffEmail" - Fallback email address for staff ILL notices
to be sent to in the absence of a branch address
- "ILLSendStaffNotices" - To specify which staff notices should be sent
automatically when requests are manipulated by patrons

Patron notices are also controlled by the patron's messaging
preferences

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 38 Andrew Isherwood 2020-04-20 10:59:09 UTC
Created attachment 103271 [details] [review]
Bug 22818: Add MessageAttribut{e,es}.pm

We need to be able to access individual message attributes in tests, so
adding accessors for them

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 39 Andrew Isherwood 2020-04-20 10:59:14 UTC
Created attachment 103272 [details] [review]
Bug 22818: Unit tests

This patch adds unit tests for the new methods in Illrequest.pm

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 40 Andrew Isherwood 2020-04-20 11:01:39 UTC
(In reply to Katrin Fischer from comment #34)
> Hi Andrew, the patches no longer apply, sorry for not getting here earlier.
> Can you please rebase?

Hi Katrin

I've rebased. Unfortunately my Koha is in a broken state at the moment following an OS upgrade, but I believe the rebase is correct. See how you get on.
Comment 41 Katrin Fischer 2020-06-29 16:48:04 UTC
> Hi Katrin
> 
> I've rebased. Unfortunately my Koha is in a broken state at the moment
> following an OS upgrade, but I believe the rebase is correct. See how you
> get on.

Hi Andrew, I am sorry again that this took so long :( I have now setup my ILL environment and everything is ready for testing. Could you maybe rebase again? I'll also look at some other ILL related bugs if you have anything else you think of as important to have, please let me know.
Comment 42 Andrew Isherwood 2020-06-30 08:35:58 UTC
Created attachment 106424 [details] [review]
Bug 22818: Add notices sysprefs and DB column

This patch adds two new sysprefs. 'ILLDefaultEmail', 'ILLSendStaffNotices' and a new column to the
branches table called 'branchillemail'. It also adds five ILL related
notices.

Here we are providing the ability for a branch to have a dedicated email
address for it's ILL staff, the idea being that any notices sent by ILL
to staff need to go to specific staff, rather than the general branch
email address. If no branch specific address is defined, the address
specified in the ILLDefaultEmail syspref is used.

We're also providing a syspref 'ILLSendStaffNotices' to allow the user to specify which
notices should be sent to staff upon certain events.

We are also providing patron messaging preferences for the two patron
bound notices

We are also providing five notices for various ILL related events.

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 43 Andrew Isherwood 2020-06-30 08:36:01 UTC
Created attachment 106425 [details] [review]
Bug 22818: Add support for ILL notices

Here we're just adding ILL notices to the existing "letters"
infrastructure so notices can be displayed and edited

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 44 Andrew Isherwood 2020-06-30 08:36:05 UTC
Created attachment 106426 [details] [review]
Bug 22818: Add generation and sending of notices

This patch adds the ability for ILL to send notices, both triggered by
staff and triggered by events.

Staff can trigger notices to patrons from the "Manage ILL request" screen:
- ILL request ready for pickup
- ILL request unavailable
- Place request with partners

The following notices to staff are triggered automatically:
- Request has been modified by patron
- Request has been cancelled by patron

Branches can now specify an "ILL email" address to which notices
intended to inform staff of changes to requests by patrons can be sent.

The sending of notices is controlled by a few new sysprefs:
- "ILLDefaultStaffEmail" - Fallback email address for staff ILL notices
to be sent to in the absence of a branch address
- "ILLSendStaffNotices" - To specify which staff notices should be sent
automatically when requests are manipulated by patrons

Patron notices are also controlled by the patron's messaging
preferences

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 45 Andrew Isherwood 2020-06-30 08:36:09 UTC
Created attachment 106427 [details] [review]
Bug 22818: Add MessageAttribut{e,es}.pm

We need to be able to access individual message attributes in tests, so
adding accessors for them

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 46 Andrew Isherwood 2020-06-30 08:36:13 UTC
Created attachment 106428 [details] [review]
Bug 22818: Unit tests

This patch adds unit tests for the new methods in Illrequest.pm

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Sponsored-by: PTFS Europe
Comment 47 Andrew Isherwood 2020-06-30 08:37:17 UTC
Hi Katrin - This is now rebased, so all should be well!
Comment 48 Katrin Fischer 2020-07-06 16:37:28 UTC
(In reply to Andrew Isherwood from comment #47)
> Hi Katrin - This is now rebased, so all should be well!

Hi Andrew, I tried to test, but it doesn't apply against master, because of a conflict in branches.tt caused by bug 25288 (pushed on 24 June). It's not a trivial fix, so I'd be happy if you could take a look, before I try.
Comment 49 Katrin Fischer 2020-07-06 16:44:07 UTC
(In reply to Katrin Fischer from comment #48)
> (In reply to Andrew Isherwood from comment #47)
> > Hi Katrin - This is now rebased, so all should be well!
> 
> Hi Andrew, I tried to test, but it doesn't apply against master, because of
> a conflict in branches.tt caused by bug 25288 (pushed on 24 June). It's not
> a trivial fix, so I'd be happy if you could take a look, before I try.

I might have gotten it fixed for now so I can continue testing... fingers crossed. 

Note: might need to re-add ill staff email to the library summary table.
Comment 50 Katrin Fischer 2020-07-06 18:10:04 UTC
I am still working on this, but adding some first notes and questions:

1) QA test tools

 FAIL	Koha/MessageAttributes.pm
   FAIL	  forbidden patterns
		forbidden pattern: Incorrect license statement (using postal address), may be a false positive if the file is coming from outside Koha (bug 24545) (line 16)

 FAIL	Koha/MessageAttribute.pm
   FAIL	  forbidden patterns
		forbidden pattern: Incorrect license statement (using postal address), may be a false positive if the file is coming from outside Koha (bug 24545) (line 16)

2) Unit tests

While tests pass, they produce some non-good looking output:

kohadev-koha@kohadevbox:/home/vagrant/kohaclone$ prove t/db_dependent/Illrequests.t
t/db_dependent/Illrequests.t .. 7/12 Use of uninitialized value $staff_to_send in pattern match (m//) at /home/vagrant/kohaclone/Koha/Illrequest.pm line 1522.
	Koha::Illrequest::send_staff_notice(Koha::Illrequest=HASH(0x55b06c17ba40), "ILL_REQUEST_CANCEL") called at /home/vagrant/kohaclone/Koha/Illrequest.pm line 288
	Koha::Illrequest::status(Koha::Illrequest=HASH(0x55b06c17ba40), "CANCREQ") called at t/db_dependent/Illrequests.t line 788
	main::__ANON__() called at /usr/share/perl5/Test/Builder.pm line 310
	eval {...} called at /usr/share/perl5/Test/Builder.pm line 310
	Test::Builder::subtest(Test::Builder=HASH(0x55b06bac3bf8), "Helpers", CODE(0x55b063112be8)) called at /usr/share/perl5/Test/More.pm line 807
	Test::More::subtest("Helpers", CODE(0x55b063112be8)) called at t/db_dependent/Illrequests.t line 934
t/db_dependent/Illrequests.t .. ok     
All tests successful.
Files=1, Tests=12, 32 wallclock secs ( 0.09 usr  0.03 sys + 21.40 cusr  6.88 csys = 28.40 CPU)
Result: PASS

3) Code Review

3.1) Email addressing

I feel like here is a general issue here in that we will have problems with spam protection if the mail server is not in the same domain as the branchillemail given. 

Is the the new ILL staff email is to be used as the sender or the recipient of the ILL emails to staff? It looks like it's actually used as both? As the pref only reads "to", maybe we could just keep the current from and it would resolve a lot of the possible issues with spam.

I think we need to at least make use of $library->inbound_email_address in a couple of cases replacing the branchemail here:

+        my $from = $branch->branchillemail || $branch->branchemail;

get_staff_to_address seems ok in that regard, but send_staff_notice from_adress does not.
Reply-to and From are the spam critical ones.

Use of Koha::Email is removed?

3.2) Translatability

The "N/A" here are problematic. I think it would be better to just create an empty string? With TT libraries can still resolve that to another text.

+        substitute  => {
+            ill_bib_title      => $title ? $title->value : 'N/A',
+            ill_bib_author     => $author ? $author->value : 'N/A',

3.3) Sample letters

I need to take a closer look for typos and such, but the sample letters need to also be added to the new sample .yml and to the translated installers. 

3.4) Sysprefs.sql

New prefs are in the wrong alphabetic spot :)

3.5) Notices & slips

The module in the letters summary table is not translatable yet and shows as "ill".

-------------

Most of those are not bad ones, only 3.1 Email addressing worries me a fair bit. Clearing up intentions and intended behaviour would be a good firs step here.
Comment 51 Martin Renvoize 2020-07-09 07:45:54 UTC
Created attachment 106675 [details] [review]
Bug 22818: Add notices sysprefs and DB column

This patch adds two new sysprefs. 'ILLDefaultEmail', 'ILLSendStaffNotices' and a new column to the
branches table called 'branchillemail'. It also adds five ILL related
notices.

Here we are providing the ability for a branch to have a dedicated email
address for it's ILL staff, the idea being that any notices sent by ILL
to staff need to go to specific staff, rather than the general branch
email address. If no branch specific address is defined, the address
specified in the ILLDefaultEmail syspref is used.

We're also providing a syspref 'ILLSendStaffNotices' to allow the user to specify which
notices should be sent to staff upon certain events.

We are also providing patron messaging preferences for the two patron
bound notices

We are also providing five notices for various ILL related events.

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 52 Martin Renvoize 2020-07-09 07:45:58 UTC
Created attachment 106676 [details] [review]
Bug 22818: Add support for ILL notices

Here we're just adding ILL notices to the existing "letters"
infrastructure so notices can be displayed and edited

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 53 Martin Renvoize 2020-07-09 07:46:02 UTC
Created attachment 106677 [details] [review]
Bug 22818: Add generation and sending of notices

This patch adds the ability for ILL to send notices, both triggered by
staff and triggered by events.

Staff can trigger notices to patrons from the "Manage ILL request" screen:
- ILL request ready for pickup
- ILL request unavailable
- Place request with partners

The following notices to staff are triggered automatically:
- Request has been modified by patron
- Request has been cancelled by patron

Branches can now specify an "ILL email" address to which notices
intended to inform staff of changes to requests by patrons can be sent.

The sending of notices is controlled by a few new sysprefs:
- "ILLDefaultStaffEmail" - Fallback email address for staff ILL notices
to be sent to in the absence of a branch address
- "ILLSendStaffNotices" - To specify which staff notices should be sent
automatically when requests are manipulated by patrons

Patron notices are also controlled by the patron's messaging
preferences

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 54 Martin Renvoize 2020-07-09 07:46:06 UTC
Created attachment 106678 [details] [review]
Bug 22818: Add MessageAttribut{e,es}.pm

We need to be able to access individual message attributes in tests, so
adding accessors for them

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 55 Martin Renvoize 2020-07-09 07:46:10 UTC
Created attachment 106679 [details] [review]
Bug 22818: Unit tests

This patch adds unit tests for the new methods in Illrequest.pm

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 56 Martin Renvoize 2020-07-09 07:46:15 UTC
Created attachment 106680 [details] [review]
Bug 22818: (QA follow-up) Email addressing corrections

This patch updates the patchset to use recnetly introduced methods for
obtaining the correct inbound and reply email addresses for branches.

We also move get_staff_to_address into Koha::Library alongside
inbound_email_address and rename it to inbound_ill_address.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 57 Martin Renvoize 2020-07-09 08:30:56 UTC
Created attachment 106681 [details] [review]
Bug 22818: (QA follow-up) Licence and POD fixes
Comment 58 Martin Renvoize 2020-07-09 08:43:16 UTC
Created attachment 106691 [details] [review]
Bug 22818: (QA follow-up) Template CASE correction
Comment 59 Martin Renvoize 2020-07-09 09:27:34 UTC
Created attachment 106693 [details] [review]
Bug 22818: (QA follow-up) Template CASE correction
Comment 60 Martin Renvoize 2020-07-09 09:27:38 UTC
Created attachment 106694 [details] [review]
Bug 22818: (QA follow-up) Translation fix + Branch notices

This patch removes the hard coded 'N/A' being passed to
GetPreparedLetter and passes in the branchcode of the ILLRequest so
notices can be branch specific.
Comment 61 Martin Renvoize 2020-07-09 11:23:22 UTC
Created attachment 106704 [details] [review]
Bug 22818: Add notices sysprefs and DB column

This patch adds two new sysprefs. 'ILLDefaultEmail', 'ILLSendStaffNotices' and a new column to the
branches table called 'branchillemail'. It also adds five ILL related
notices.

Here we are providing the ability for a branch to have a dedicated email
address for it's ILL staff, the idea being that any notices sent by ILL
to staff need to go to specific staff, rather than the general branch
email address. If no branch specific address is defined, the address
specified in the ILLDefaultEmail syspref is used.

We're also providing a syspref 'ILLSendStaffNotices' to allow the user to specify which
notices should be sent to staff upon certain events.

We are also providing patron messaging preferences for the two patron
bound notices

We are also providing five notices for various ILL related events.

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 62 Martin Renvoize 2020-07-09 11:23:26 UTC
Created attachment 106705 [details] [review]
Bug 22818: Add support for ILL notices

Here we're just adding ILL notices to the existing "letters"
infrastructure so notices can be displayed and edited

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 63 Martin Renvoize 2020-07-09 11:23:30 UTC
Created attachment 106706 [details] [review]
Bug 22818: Add generation and sending of notices

This patch adds the ability for ILL to send notices, both triggered by
staff and triggered by events.

Staff can trigger notices to patrons from the "Manage ILL request" screen:
- ILL request ready for pickup
- ILL request unavailable
- Place request with partners

The following notices to staff are triggered automatically:
- Request has been modified by patron
- Request has been cancelled by patron

Branches can now specify an "ILL email" address to which notices
intended to inform staff of changes to requests by patrons can be sent.

The sending of notices is controlled by a few new sysprefs:
- "ILLDefaultStaffEmail" - Fallback email address for staff ILL notices
to be sent to in the absence of a branch address
- "ILLSendStaffNotices" - To specify which staff notices should be sent
automatically when requests are manipulated by patrons

Patron notices are also controlled by the patron's messaging
preferences

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 64 Martin Renvoize 2020-07-09 11:23:34 UTC
Created attachment 106707 [details] [review]
Bug 22818: Add MessageAttribut{e,es}.pm

We need to be able to access individual message attributes in tests, so
adding accessors for them

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 65 Martin Renvoize 2020-07-09 11:23:38 UTC
Created attachment 106708 [details] [review]
Bug 22818: Unit tests

This patch adds unit tests for the new methods in Illrequest.pm

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 66 Martin Renvoize 2020-07-09 11:23:43 UTC
Created attachment 106709 [details] [review]
Bug 22818: (QA follow-up) Email addressing corrections

This patch updates the patchset to use recnetly introduced methods for
obtaining the correct inbound and reply email addresses for branches.

We also move get_staff_to_address into Koha::Library alongside
inbound_email_address and rename it to inbound_ill_address.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 67 Martin Renvoize 2020-07-09 11:23:48 UTC
Created attachment 106710 [details] [review]
Bug 22818: (QA follow-up) Licence and POD fixes

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 68 Martin Renvoize 2020-07-09 11:23:52 UTC
Created attachment 106711 [details] [review]
Bug 22818: (QA follow-up) Template CASE correction

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 69 Martin Renvoize 2020-07-09 11:23:57 UTC
Created attachment 106712 [details] [review]
Bug 22818: (QA follow-up) Translation fix + Branch notices

This patch removes the hard coded 'N/A' being passed to
GetPreparedLetter and passes in the branchcode of the ILLRequest so
notices can be branch specific.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 70 Martin Renvoize 2020-07-09 11:24:02 UTC
Created attachment 106713 [details] [review]
Bug 22818: (QA follow-up) Sample Notices

Convert the update notices to TT syntax and add them into the
sample_notices file.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 71 Martin Renvoize 2020-07-09 11:28:16 UTC
(In reply to Katrin Fischer from comment #50)
> I am still working on this, but adding some first notes and questions:
> 
> 1) QA test tools
> 
>  FAIL	Koha/MessageAttributes.pm
>    FAIL	  forbidden patterns
> 		forbidden pattern: Incorrect license statement (using postal address), may
> be a false positive if the file is coming from outside Koha (bug 24545)
> (line 16)
> 
>  FAIL	Koha/MessageAttribute.pm
>    FAIL	  forbidden patterns
> 		forbidden pattern: Incorrect license statement (using postal address), may
> be a false positive if the file is coming from outside Koha (bug 24545)
> (line 16)

Fixed 

> 
> 2) Unit tests
> 
> While tests pass, they produce some non-good looking output:
> 
> kohadev-koha@kohadevbox:/home/vagrant/kohaclone$ prove
> t/db_dependent/Illrequests.t
> t/db_dependent/Illrequests.t .. 7/12 Use of uninitialized value
> $staff_to_send in pattern match (m//) at
> /home/vagrant/kohaclone/Koha/Illrequest.pm line 1522.
> 	Koha::Illrequest::send_staff_notice(Koha::Illrequest=HASH(0x55b06c17ba40),
> "ILL_REQUEST_CANCEL") called at /home/vagrant/kohaclone/Koha/Illrequest.pm
> line 288
> 	Koha::Illrequest::status(Koha::Illrequest=HASH(0x55b06c17ba40), "CANCREQ")
> called at t/db_dependent/Illrequests.t line 788
> 	main::__ANON__() called at /usr/share/perl5/Test/Builder.pm line 310
> 	eval {...} called at /usr/share/perl5/Test/Builder.pm line 310
> 	Test::Builder::subtest(Test::Builder=HASH(0x55b06bac3bf8), "Helpers",
> CODE(0x55b063112be8)) called at /usr/share/perl5/Test/More.pm line 807
> 	Test::More::subtest("Helpers", CODE(0x55b063112be8)) called at
> t/db_dependent/Illrequests.t line 934
> t/db_dependent/Illrequests.t .. ok     
> All tests successful.
> Files=1, Tests=12, 32 wallclock secs ( 0.09 usr  0.03 sys + 21.40 cusr  6.88
> csys = 28.40 CPU)
> Result: PASS

Fixed

> 3) Code Review
> 
> 3.1) Email addressing
> 
> I feel like here is a general issue here in that we will have problems with
> spam protection if the mail server is not in the same domain as the
> branchillemail given. 
> 
> Is the the new ILL staff email is to be used as the sender or the recipient
> of the ILL emails to staff? It looks like it's actually used as both? As the
> pref only reads "to", maybe we could just keep the current from and it would
> resolve a lot of the possible issues with spam.
> 
> I think we need to at least make use of $library->inbound_email_address in a
> couple of cases replacing the branchemail here:
> 
> +        my $from = $branch->branchillemail || $branch->branchemail;
> 
> get_staff_to_address seems ok in that regard, but send_staff_notice
> from_adress does not.
> Reply-to and From are the spam critical ones.
> 
> Use of Koha::Email is removed?


Fixed

> 3.2) Translatability
> 
> The "N/A" here are problematic. I think it would be better to just create an
> empty string? With TT libraries can still resolve that to another text.
> 
> +        substitute  => {
> +            ill_bib_title      => $title ? $title->value : 'N/A',
> +            ill_bib_author     => $author ? $author->value : 'N/A',

Fixed

> 3.3) Sample letters
> 
> I need to take a closer look for typos and such, but the sample letters need
> to also be added to the new sample .yml and to the translated installers. 

Converted to TT syntax and added to sampl_notices.yml

> 3.4) Sysprefs.sql
> 
> New prefs are in the wrong alphabetic spot :)

FIxed
 
> 3.5) Notices & slips
> 
> The module in the letters summary table is not translatable yet and shows as
> "ill".

Was a copy/paste error.. also fixed
 
> -------------
> 
> Most of those are not bad ones, only 3.1 Email addressing worries me a fair
> bit. Clearing up intentions and intended behaviour would be a good first step
> here.
Comment 72 Katrin Fischer 2020-08-23 21:57:15 UTC
I am sorry, but the tests are not passing, can you please have a look?

Test Summary Report
-------------------
t/db_dependent/Koha/Libraries.t (Wstat: 65280 Tests: 8 Failed: 1)
  Failed test:  8
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 10 tests but ran 8.
t/db_dependent/Illrequests.t   (Wstat: 65280 Tests: 8 Failed: 1)
  Failed test:  8
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 13 tests but ran 8.

Without the patches I still have one failing test - 
not ok 10 - Checking out
Comment 73 Martin Renvoize 2020-09-16 13:43:48 UTC
Created attachment 110196 [details] [review]
Bug 22818: Add notices sysprefs and DB column

This patch adds two new sysprefs. 'ILLDefaultEmail', 'ILLSendStaffNotices' and a new column to the
branches table called 'branchillemail'. It also adds five ILL related
notices.

Here we are providing the ability for a branch to have a dedicated email
address for it's ILL staff, the idea being that any notices sent by ILL
to staff need to go to specific staff, rather than the general branch
email address. If no branch specific address is defined, the address
specified in the ILLDefaultEmail syspref is used.

We're also providing a syspref 'ILLSendStaffNotices' to allow the user to specify which
notices should be sent to staff upon certain events.

We are also providing patron messaging preferences for the two patron
bound notices

We are also providing five notices for various ILL related events.

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 74 Martin Renvoize 2020-09-16 13:43:56 UTC
Created attachment 110197 [details] [review]
Bug 22818: Add support for ILL notices

Here we're just adding ILL notices to the existing "letters"
infrastructure so notices can be displayed and edited

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 75 Martin Renvoize 2020-09-16 13:44:03 UTC
Created attachment 110198 [details] [review]
Bug 22818: Add generation and sending of notices

This patch adds the ability for ILL to send notices, both triggered by
staff and triggered by events.

Staff can trigger notices to patrons from the "Manage ILL request" screen:
- ILL request ready for pickup
- ILL request unavailable
- Place request with partners

The following notices to staff are triggered automatically:
- Request has been modified by patron
- Request has been cancelled by patron

Branches can now specify an "ILL email" address to which notices
intended to inform staff of changes to requests by patrons can be sent.

The sending of notices is controlled by a few new sysprefs:
- "ILLDefaultStaffEmail" - Fallback email address for staff ILL notices
to be sent to in the absence of a branch address
- "ILLSendStaffNotices" - To specify which staff notices should be sent
automatically when requests are manipulated by patrons

Patron notices are also controlled by the patron's messaging
preferences

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 76 Martin Renvoize 2020-09-16 13:44:13 UTC
Created attachment 110199 [details] [review]
Bug 22818: Add MessageAttribut{e,es}.pm

We need to be able to access individual message attributes in tests, so
adding accessors for them

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 77 Martin Renvoize 2020-09-16 13:44:24 UTC
Created attachment 110201 [details] [review]
Bug 22818: Unit tests

This patch adds unit tests for the new methods in Illrequest.pm

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 78 Martin Renvoize 2020-09-16 13:44:32 UTC
Created attachment 110202 [details] [review]
Bug 22818: (QA follow-up) Email addressing corrections

This patch updates the patchset to use recnetly introduced methods for
obtaining the correct inbound and reply email addresses for branches.

We also move get_staff_to_address into Koha::Library alongside
inbound_email_address and rename it to inbound_ill_address.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 79 Martin Renvoize 2020-09-16 13:44:38 UTC
Created attachment 110203 [details] [review]
Bug 22818: (QA follow-up) Licence and POD fixes

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 80 Martin Renvoize 2020-09-16 13:44:45 UTC
Created attachment 110204 [details] [review]
Bug 22818: (QA follow-up) Template CASE correction

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 81 Martin Renvoize 2020-09-16 13:44:59 UTC
Created attachment 110205 [details] [review]
Bug 22818: (QA follow-up) Translation fix + Branch notices

This patch removes the hard coded 'N/A' being passed to
GetPreparedLetter and passes in the branchcode of the ILLRequest so
notices can be branch specific.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 82 Martin Renvoize 2020-09-16 13:45:06 UTC
Created attachment 110206 [details] [review]
Bug 22818: (QA follow-up) Sample Notices

Convert the update notices to TT syntax and add them into the
sample_notices file.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 83 Martin Renvoize 2020-09-16 13:45:14 UTC
Created attachment 110207 [details] [review]
Bug 22818: (DO NOT PUSH) Schema Updates
Comment 84 Martin Renvoize 2020-09-16 13:46:40 UTC
(In reply to Katrin Fischer from comment #72)
> I am sorry, but the tests are not passing, can you please have a look?
> 
> Test Summary Report
> -------------------
> t/db_dependent/Koha/Libraries.t (Wstat: 65280 Tests: 8 Failed: 1)
>   Failed test:  8
>   Non-zero exit status: 255
>   Parse errors: Bad plan.  You planned 10 tests but ran 8.
> t/db_dependent/Illrequests.t   (Wstat: 65280 Tests: 8 Failed: 1)
>   Failed test:  8
>   Non-zero exit status: 255
>   Parse errors: Bad plan.  You planned 13 tests but ran 8.
> 
> Without the patches I still have one failing test - 
> not ok 10 - Checking out

I've rebased the patchset as it didn't apply on master for me.

I've also added a final 'Schema Updates' patch to simplify testing.
Comment 85 Martin Renvoize 2020-09-16 14:02:43 UTC
Created attachment 110208 [details] [review]
Bug 22818: (QA follow-up) Add mandatory data at install time

This patch adds the data from the update script into the mandatory sql
files such that it is also populated at install time.
Comment 86 Martin Renvoize 2020-09-16 14:04:13 UTC
The failing tests were a sign of missing data at install time.. the final patch should correct that and mean the tests pasts now.