@@ -, +, @@ --- Koha/Illrequest.pm | 2 +- Koha/Library.pm | 1 + admin/branches.pl | 1 + .../bug_22818_add_ill_notices.perl | 38 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/mandatory/sysprefs.sql | 2 + .../en/includes/messaging-preference-form.inc | 2 + .../prog/en/modules/admin/branches.tt | 4 ++ .../prog/en/modules/admin/categories.tt | 2 + .../admin/preferences/circulation.pref | 8 ++++ .../bootstrap/en/modules/opac-messaging.tt | 2 + 11 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_22818_add_ill_notices.perl --- a/Koha/Illrequest.pm +++ a/Koha/Illrequest.pm @@ -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; --- a/Koha/Library.pm +++ a/Koha/Library.pm @@ -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', --- a/admin/branches.pl +++ a/admin/branches.pl @@ -75,6 +75,7 @@ if ( $op eq 'add_form' ) { branchphone branchfax branchemail + branchillemail branchreplyto branchreturnpath branchurl --- a/installer/data/mysql/atomicupdate/bug_22818_add_ill_notices.perl +++ a/installer/data/mysql/atomicupdate/bug_22818_add_ill_notices.perl @@ -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 <> <>,\n\nThe Interlibrary loans request number <> you placed for:\n\n- <> - <>\n\nis ready for pick up from <>.\n\nKind Regards\n\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>", '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 <> <>,\n\nThe Interlibrary loans request number <> you placed for\n\n- <> - <>\n\nis unfortunately unavailable.\n\nKind Regards\n\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>", '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 <>, with the following details, has requested cancellation of this ILL request:\n\n<>", '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 <>, with the following details, has modified this ILL request:\n\n<>", '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<>\n\nPlease let us know if you are able to supply this to us.\n\nKind Regards\n\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>", '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 <> <>,\n\nThe Interlibrary loans request number <> you placed for:\n\n- <> - <>\n\nis ready for pick up from <>.\n\nKind Regards\n\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>", '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 <> <>,\n\nThe Interlibrary loans request number <> you placed for\n\n- <> - <>\n\nis unfortunately unavailable.\n\nKind Regards\n\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>", '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 <>, with the following details, has requested cancellation of this ILL request:\n\n<>", '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 <>, with the following details, has modified this ILL request:\n\n<>", '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<>\n\nPlease let us know if you are able to supply this to us.\n\nKind Regards\n\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>\n<>", '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"; +} --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -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 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ a/installer/data/mysql/mandatory/sysprefs.sql @@ -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'), --- a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc @@ -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 %] [% IF ( messaging_preference.takes_days ) %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt @@ -1,3 +1,4 @@ +[% USE Koha %] [% USE raw %] [% USE Asset %] [% SET footerjs = 1 %] @@ -139,6 +140,9 @@
  • + [% IF (Koha.Preference('ILLModule')) %] +
  • + [% END %]

  • Default: ReplyToDefault system preference

  • Default: ReturnpathDefault system preference
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt @@ -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 %]: [% transport.transport | html %]
    --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -923,6 +923,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 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt @@ -66,6 +66,8 @@ [% ELSE %] Item checkout [% END %] + [% ELSIF ( messaging_preference.Ill_ready ) %]Interlibrary loan ready + [% ELSIF ( messaging_preference.Ill_unavailable ) %]Interlibrary loan unavailable [% ELSE %]Unknown [% END %] [% IF ( messaging_preference.takes_days ) %]