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>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Andrew Isherwood 2019-05-07 11:09:58 +01:00 committed by Jonathan Druart
parent f8206ca60c
commit 51895cd7fb
11 changed files with 62 additions and 1 deletions

View File

@ -1312,7 +1312,7 @@ EOF
my @address = map { $library->$_ }
qw/ branchname branchaddress1 branchaddress2 branchaddress3
branchzip branchcity branchstate branchcountry branchphone
branchemail /;
branchillemail branchemail /;
my $address = "";
foreach my $line ( @address ) {
$address .= $line . "\n" if $line;

View File

@ -179,6 +179,7 @@ sub to_api_mapping {
branchphone => 'phone',
branchfax => 'fax',
branchemail => 'email',
branchillemail => 'illemail',
branchreplyto => 'reply_to_email',
branchreturnpath => 'return_path_email',
branchurl => 'url',

View File

@ -75,6 +75,7 @@ if ( $op eq 'add_form' ) {
branchphone
branchfax
branchemail
branchillemail
branchreplyto
branchreturnpath
branchurl

View File

@ -0,0 +1,38 @@
$DBversion = 'XXX';
if( CheckVersion( $DBversion ) ) {
if( !column_exists( 'branches', 'branchillemail' ) ) {
$dbh->do( q| ALTER TABLE branches ADD branchillemail LONGTEXT AFTER branchemail | );
}
# Add new sysprefs
$dbh->do( q| INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('ILLDefaultStaffEmail', '', 'Fallback email address for staff ILL notices to be sent to in the absence of a branch address', NULL, 'Free'); | );
$dbh->do( q| INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('ILLSendStaffNotices', NULL, 'Send these ILL notices to staff', NULL, 'multiple'); | );
# Add new notices
$dbh->do( q| INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_PICKUP_READY', '', 'ILL request ready for pickup', 0, "Interlibrary loan request ready for pickup", "Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nThe Interlibrary loans request number <<illrequests.illrequest_id>> you placed for:\n\n- <<ill_bib_title>> - <<ill_bib_author>>\n\nis ready for pick up from <<branches.branchname>>.\n\nKind Regards\n\n<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>>\n<<branches.branchaddress3>>\n<<branches.branchcity>>\n<<branches.branchstate>>\n<<branches.branchzip>>\n<<branches.branchphone>>\n<<branches.branchillemail>>\n<<branches.branchemail>>", 'email', 'default'); | );
$dbh->do( q| INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_UNAVAIL', '', 'ILL request unavailable', 0, "Interlibrary loan request unavailable", "Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nThe Interlibrary loans request number <<illrequests.illrequest_id>> you placed for\n\n- <<ill_bib_title>> - <<ill_bib_author>>\n\nis unfortunately unavailable.\n\nKind Regards\n\n<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>>\n<<branches.branchaddress3>>\n<<branches.branchcity>>\n<<branches.branchstate>>\n<<branches.branchzip>>\n<<branches.branchphone>>\n<<branches.branchillemail>>\n<<branches.branchemail>>", 'email', 'default'); | );
$dbh->do( q| INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_CANCEL', '', 'ILL request cancelled', 0, "Interlibrary loan request cancelled", "The patron for interlibrary loans request <<illrequests.illrequest_id>>, with the following details, has requested cancellation of this ILL request:\n\n<<ill_full_metadata>>", 'email', 'default'); | );
$dbh->do( q| INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_MODIFIED', '', 'ILL request modified', 0, "Interlibrary loan request modified", "The patron for interlibrary loans request <<illrequests.illrequest_id>>, with the following details, has modified this ILL request:\n\n<<ill_full_metadata>>", 'email', 'default'); | );
$dbh->do( q| INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_PARTNER_REQ', '', 'ILL request to partners', 0, "Interlibrary loan request to partners", "Dear Sir/Madam,\n\nWe would like to request an interlibrary loan for a title matching the following description:\n\n<<ill_full_metadata>>\n\nPlease let us know if you are able to supply this to us.\n\nKind Regards\n\n<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>>\n<<branches.branchaddress3>>\n<<branches.branchcity>>\n<<branches.branchstate>>\n<<branches.branchzip>>\n<<branches.branchphone>>\n<<branches.branchillemail>>\n<<branches.branchemail>>", 'email', 'default'); | );
$dbh->do( q| INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_PICKUP_READY', '', 'ILL request ready for pickup', 0, "Interlibrary loan request ready for pickup", "Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nThe Interlibrary loans request number <<illrequests.illrequest_id>> you placed for:\n\n- <<ill_bib_title>> - <<ill_bib_author>>\n\nis ready for pick up from <<branches.branchname>>.\n\nKind Regards\n\n<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>>\n<<branches.branchaddress3>>\n<<branches.branchcity>>\n<<branches.branchstate>>\n<<branches.branchzip>>\n<<branches.branchphone>>\n<<branches.branchillemail>>\n<<branches.branchemail>>", 'sms', 'default'); | );
$dbh->do( q| INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_UNAVAIL', '', 'ILL request unavailable', 0, "Interlibrary loan request unavailable", "Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nThe Interlibrary loans request number <<illrequests.illrequest_id>> you placed for\n\n- <<ill_bib_title>> - <<ill_bib_author>>\n\nis unfortunately unavailable.\n\nKind Regards\n\n<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>>\n<<branches.branchaddress3>>\n<<branches.branchcity>>\n<<branches.branchstate>>\n<<branches.branchzip>>\n<<branches.branchphone>>\n<<branches.branchillemail>>\n<<branches.branchemail>>", 'sms', 'default'); | );
$dbh->do( q| INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_CANCEL', '', 'ILL request cancelled', 0, "Interlibrary loan request cancelled", "The patron for interlibrary loans request <<illrequests.illrequest_id>>, with the following details, has requested cancellation of this ILL request:\n\n<<ill_full_metadata>>", 'sms', 'default'); | );
$dbh->do( q| INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_MODIFIED', '', 'ILL request modified', 0, "Interlibrary loan request modified", "The patron for interlibrary loans request <<illrequests.illrequest_id>>, with the following details, has modified this ILL request:\n\n<<ill_full_metadata>>", 'sms', 'default'); | );
$dbh->do( q| INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_PARTNER_REQ', '', 'ILL request to partners', 0, "Interlibrary loan request to partners", "Dear Sir/Madam,\n\nWe would like to request an interlibrary loan for a title matching the following description:\n\n<<ill_full_metadata>>\n\nPlease let us know if you are able to supply this to us.\n\nKind Regards\n\n<<branches.branchname>>\n<<branches.branchaddress1>>\n<<branches.branchaddress2>>\n<<branches.branchaddress3>>\n<<branches.branchcity>>\n<<branches.branchstate>>\n<<branches.branchzip>>\n<<branches.branchphone>>\n<<branches.branchillemail>>\n<<branches.branchemail>>", 'sms', 'default'); | );
# Add patron messaging preferences
$dbh->do( q| INSERT IGNORE INTO message_attributes (message_name, takes_days) VALUES ('Ill_ready', 0); | );
my $ready_id = $dbh->{mysql_insertid};
if (defined $ready_id) {
$dbh->do( qq(INSERT IGNORE INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES ($ready_id, 'email', 0, 'ill', 'ILL_PICKUP_READY');) );
$dbh->do( qq(INSERT IGNORE INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES ($ready_id, 'sms', 0, 'ill', 'ILL_PICKUP_READY');) );
$dbh->do( qq(INSERT IGNORE INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES ($ready_id, 'phone', 0, 'ill', 'ILL_PICKUP_READY');) );
}
$dbh->do( q| INSERT IGNORE INTO message_attributes (message_name, takes_days) VALUES ('Ill_unavailable', 0); | );
my $unavail_id = $dbh->{mysql_insertid};
if (defined $unavail_id) {
$dbh->do( qq(INSERT IGNORE INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES ($unavail_id, 'email', 0, 'ill', 'ILL_REQUEST_UNAVAIL');) );
$dbh->do( qq(INSERT IGNORE INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES ($unavail_id, 'sms', 0, 'ill', 'ILL_REQUEST_UNAVAIL');) );
$dbh->do( qq(INSERT IGNORE INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES ($unavail_id, 'phone', 0, 'ill', 'ILL_REQUEST_UNAVAIL');) );
}
SetVersion( $DBversion );
print "Upgrade to $DBversion done (Bug 22818 - Add ILL notices)\n";
}

View File

@ -265,6 +265,7 @@ CREATE TABLE `branches` ( -- information about your libraries or branches are st
`branchphone` LONGTEXT, -- the primary phone for your library or branch
`branchfax` LONGTEXT, -- the fax number for your library or branch
`branchemail` LONGTEXT, -- the primary email address for your library or branch
`branchillemail` LONGTEXT, -- the ILL staff email address for your library or branch
`branchreplyto` LONGTEXT, -- the email to be used as a Reply-To
`branchreturnpath` LONGTEXT, -- the email to be used as Return-Path
`branchurl` LONGTEXT, -- the URL for your library or branch's website

View File

@ -239,12 +239,14 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('HTML5MediaYouTube',0,'Embed|Don\'t embed','YouTube links as videos','YesNo'),
('IdRef','0','','Disable/enable the IdRef webservice from the OPAC detail page.','YesNo'),
('IllCheckAvailability', 0, '', 'If ON, during the ILL request process third party sources will be checked for current availability', 'YesNo'),
('ILLDefaultStaffEmail', '', NULL, 'Fallback email address for staff ILL notices to be sent to in the absence of a branch address', 'Free'),
('ILLHiddenRequestStatuses', NULL, NULL, 'ILL statuses that are considered finished and should not be displayed in the ILL module', 'multiple'),
('IllLog', 0, '', 'If ON, log information about ILL requests', 'YesNo'),
('ILLModule','0','If ON, enables the interlibrary loans module.','','YesNo'),
('ILLModuleCopyrightClearance','','70|10','Enter text to enable the copyright clearance stage of request creation. Text will be displayed','Textarea'),
('ILLModuleUnmediated','0','','If enabled, try to immediately progress newly placed ILL requests.','YesNo'),
('ILLOpacbackends',NULL,NULL,'ILL backends to enabled for OPAC initiated requests','multiple'),
('ILLSendStaffNotices', NULL, NULL, 'Send these ILL notices to staff', 'multiple'),
('ILS-DI','0','','Enables ILS-DI services at OPAC.','YesNo'),
('ILS-DI:AuthorizedIPs','','Restricts usage of ILS-DI to some IPs','.','Free'),
('ImageLimit','5','','Limit images stored in the database by the Patron Card image manager to this number.','Integer'),

View File

@ -25,6 +25,8 @@
[% ELSE %]
Item checkout
[% END %]
[% ELSIF ( messaging_preference.Ill_ready ) %]Interlibrary loan ready
[% ELSIF ( messaging_preference.Ill_unavailable ) %]Interlibrary loan unavailable
[% ELSE %]Unknown [% END %]</td>
[% IF ( messaging_preference.takes_days ) %]
<td>

View File

@ -1,3 +1,4 @@
[% USE Koha %]
[% USE raw %]
[% USE Asset %]
[% SET footerjs = 1 %]
@ -139,6 +140,9 @@
<li><label for="branchphone">Phone: </label><input type="text" name="branchphone" id="branchphone" size="60" value="[% library.branchphone | html %]" /></li>
<li><label for="branchfax">Fax: </label><input type="text" name="branchfax" id="branchfax" size="60" value="[% library.branchfax | html %]" /></li>
<li><label for="branchemail">Email: </label><input type="text" name="branchemail" id="branchemail" class="email" size="80" value="[% library.branchemail | html %]" /></li>
[% IF (Koha.Preference('ILLModule')) %]
<li><label for="branchillemail">ILL staff email: </label><input type="text" name="branchillemail" id="branchillemail" class="email" size="80" value="[% library.branchillemail | html %]" /></li>
[% END %]
<li><label for="branchreplyto">Reply-To: </label> <input type="text" name="branchreplyto" id="branchreplyto" class="email" size="80" value="[% library.branchreplyto | html %]" /><br /><span class="hint">Default: ReplyToDefault system preference</span></li>
<li><label for="branchreturnpath">Return-Path: </label> <input type="text" name="branchreturnpath" id="branchreturnpath" class="email" size="80" value="[% library.branchreturnpath | html %]" /><br /><span class="hint">Default: ReturnpathDefault system preference</span></li>
<li><label for="smtp_server">SMTP server: </label>

View File

@ -536,6 +536,8 @@
[% ELSIF ( prefs.Hold_Filled ) %]Hold filled
[% ELSIF ( prefs.Item_Check_in ) %]Item check-in
[% ELSIF ( prefs.Item_Checkout ) %]Item checkout
[% ELSIF ( prefs.Ill_ready ) %]Interlibrary loan ready
[% ELSIF ( prefs.Ill_unavailable ) %]Interlibrary loan unavailable
[% ELSE %]Unknown
[% END %]:
<strong>[% transport.transport | html %]</strong><br />

View File

@ -931,6 +931,14 @@ Circulation:
- pref: ILLHiddenRequestStatuses
class: multi
- (separated with |). If left empty, all ILL requests will be displayed.
-
- "Send these ILL notices to staff when appropriate"
- pref: ILLSendStaffNotices
class: multi
- (separated with |). e.g. ILL_REQUEST_CANCEL|ILL_REQUEST_MODIFIED If left empty, no staff ILL notices will be sent
-
- Fallback email address for staff ILL notices to be sent to in the absence of a branch address
- pref: ILLDefaultStaffEmail
Fines Policy:
-
- pref: finesCalendar

View File

@ -67,6 +67,8 @@
[% ELSE %]
Item checkout
[% END %]
[% ELSIF ( messaging_preference.Ill_ready ) %]Interlibrary loan ready
[% ELSIF ( messaging_preference.Ill_unavailable ) %]Interlibrary loan unavailable
[% ELSE %]Unknown [% END %]</td>
[% IF ( messaging_preference.takes_days ) %]
<td><select class="input-mini" name="[% messaging_preference.message_attribute_id | html %]-DAYS">