@@ -, +, @@ --- Koha/Illrequest.pm | 2 +- Koha/REST/V1/Library.pm | 2 ++ admin/branches.pl | 1 + .../atomicupdate/bug_22818_add_ill_notices.perl | 38 ++++++++++++++++++++++ installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/sysprefs.sql | 2 ++ .../prog/en/includes/messaging-preference-form.inc | 2 ++ .../prog/en/modules/admin/branches.tt | 6 ++++ .../prog/en/modules/admin/categories.tt | 2 ++ .../en/modules/admin/preferences/circulation.pref | 8 +++++ .../bootstrap/en/modules/opac-messaging.tt | 2 ++ 11 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_22818_add_ill_notices.perl --- a/Koha/Illrequest.pm +++ a/Koha/Illrequest.pm @@ -1064,7 +1064,7 @@ EOF my @address = map { $branch->$_ } 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/REST/V1/Library.pm +++ a/Koha/REST/V1/Library.pm @@ -276,6 +276,7 @@ our $to_api_mapping = { branchphone => 'phone', branchfax => 'fax', branchemail => 'email', + branchillemail => 'illemail', branchreplyto => 'reply_to_email', branchreturnpath => 'return_path_email', branchurl => 'url', @@ -303,6 +304,7 @@ our $to_model_mapping = { phone => 'branchphone', fax => 'branchfax', email => 'branchemail', + illemail => 'branchillemail', reply_to_email => 'branchreplyto', return_path_email => 'branchreturnpath', url => 'branchurl', --- a/admin/branches.pl +++ a/admin/branches.pl @@ -66,6 +66,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 @@ -257,6 +257,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/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -225,6 +225,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('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'), +('ILLDefaultStaffEmail', '', NULL, 'Fallback email address for staff ILL notices to be sent to in the absence of a branch address', 'Free'), +('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 @@ -21,6 +21,8 @@ [% ELSIF ( messaging_preference.Hold_Filled ) %]Hold filled [% ELSIF ( messaging_preference.Item_Check_in ) %]Item check-in [% ELSIF ( messaging_preference.Item_Checkout ) %]Item checkout + [% 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
  • @@ -221,6 +225,8 @@
    Fax: [% library.branchfax | html %][% END %] [% IF library.branchemail %]
    [% library.branchemail | html %][% END %] + [% IF library.branchillemail && Koha.Preference('ILLModule') %] +
    [% library.branchillemail | html %][% END %] [% IF library.branchurl %]
    [% library.branchurl | html %][% END %] [% IF library.opac_info %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt @@ -485,6 +485,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 @@ -827,6 +827,14 @@ Circulation: yes: Enable no: Disable - unmediated Interlibrary loan requests. If enabled and the ILL backend supports it, the newly created requests are immediately requested by backend. + - + - "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: - - Calculate fines based on days overdue --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt @@ -52,6 +52,8 @@ [% ELSIF ( messaging_preference.Hold_Filled ) %]Hold filled [% ELSIF ( messaging_preference.Item_Check_in ) %]Item check-in [% ELSIF ( messaging_preference.Item_Checkout ) %]Item checkout + [% ELSIF ( messaging_preference.Ill_ready ) %]Interlibrary loan ready + [% ELSIF ( messaging_preference.Ill_unavailable ) %]Interlibrary loan unavailable [% ELSE %]Unknown [% END %] [% IF ( messaging_preference.takes_days ) %]