From 8048ba3201bc72653e6b1a3d890d3fdb3bfced87 Mon Sep 17 00:00:00 2001 From: Vitor FERNANDES Date: Tue, 27 Nov 2012 15:17:59 +0000 Subject: [PATCH] BUG 9151 - Renewal notice according to patron alert preferences (Patch 2) Added a system preferences (RenewalSendNotice - default no) to controll the renewal notice sending. Added to installer languages the renewal notice template. Signed-off-by: Kyle M Hall Signed-off-by: Jared Camins-Esakov --- C4/Circulation.pm | 34 ++++++++++--------- .../mysql/de-DE/mandatory/sample_notices.sql | 1 + .../mysql/en/mandatory/sample_notices.sql | 5 +-- .../mysql/es-ES/mandatory/sample_notices.sql | 1 + .../fr-FR/1-Obligatoire/sample_notices.sql | 1 + .../nb-NO/1-Obligatorisk/sample_notices.sql | 1 + .../mysql/pl-PL/mandatory/sample_notices.sql | 1 + .../mysql/ru-RU/mandatory/sample_notices.sql | 1 + installer/data/mysql/sysprefs.sql | 1 + .../mysql/uk-UA/mandatory/sample_notices.sql | 1 + installer/data/mysql/updatedatabase.pl | 8 +++++ .../admin/preferences/circulation.pref | 6 ++++ 12 files changed, 43 insertions(+), 18 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 415478631d..8215752345 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2582,22 +2582,24 @@ sub AddRenewal { 'Rent', $charge, $itemnumber ); } - # Send a renewal slip according to checkout alert preference - my $borrower = C4::Members::GetMemberDetails( $borrowernumber, 0 ); - my $circulation_alert = 'C4::ItemCirculationAlertPreference'; - my %conditions = ( - branchcode => $branch, - categorycode => $borrower->{categorycode}, - item_type => $item->{itype}, - notification => 'CHECKOUT', - ); - if ($circulation_alert->is_enabled_for(\%conditions)) { - SendCirculationAlert({ - type => 'RENEWAL', - item => $item, - borrower => $borrower, - branch => $branch, - }); + # Send a renewal slip according to checkout alert preferencei + if ( C4::Context->preference('RenewalSendNotice') eq '1') { + my $borrower = C4::Members::GetMemberDetails( $borrowernumber, 0 ); + my $circulation_alert = 'C4::ItemCirculationAlertPreference'; + my %conditions = ( + branchcode => $branch, + categorycode => $borrower->{categorycode}, + item_type => $item->{itype}, + notification => 'CHECKOUT', + ); + if ($circulation_alert->is_enabled_for(\%conditions)) { + SendCirculationAlert({ + type => 'RENEWAL', + item => $item, + borrower => $borrower, + branch => $branch, + }); + } } # Log the renewal diff --git a/installer/data/mysql/de-DE/mandatory/sample_notices.sql b/installer/data/mysql/de-DE/mandatory/sample_notices.sql index 5bd39a2024..7a1a9a3864 100644 --- a/installer/data/mysql/de-DE/mandatory/sample_notices.sql +++ b/installer/data/mysql/de-DE/mandatory/sample_notices.sql @@ -106,3 +106,4 @@ Fällig am: <>
  • <>
  • <>
  • ', 1); +INSERT INTO `letter` (module, code, name, title, content) VALUES ('circulation','RENEWAL','Item Renewal','Renewals','The following items have been renew:\r\n----\r\n<>\r\n----\r\nThank you for visiting <>.'); diff --git a/installer/data/mysql/en/mandatory/sample_notices.sql b/installer/data/mysql/en/mandatory/sample_notices.sql index e6e9df08fb..30b7e1f3e3 100644 --- a/installer/data/mysql/en/mandatory/sample_notices.sql +++ b/installer/data/mysql/en/mandatory/sample_notices.sql @@ -106,7 +106,6 @@ Date due: <>
  • <>
  • ', 1); - INSERT INTO `letter` (`module`,`code`,`branchcode`,`name`,`is_html`,`title`,`content`) VALUES ( 'members', 'OPAC_REG_VERIFY', '', 'Opac Self-Registration Verification Email', '1', 'Verify Your Account', 'Hello! @@ -116,4 +115,6 @@ Your library account has been created. Please verify your email address by click http://<>/cgi-bin/koha/opac-registration-verify.pl?token=<> If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.' -); \ No newline at end of file +); + +INSERT INTO `letter` (module, code, name, title, content) VALUES ('circulation','RENEWAL','Item Renewal','Renewals','The following items have been renew:\r\n----\r\n<>\r\n----\r\nThank you for visiting <>.'); diff --git a/installer/data/mysql/es-ES/mandatory/sample_notices.sql b/installer/data/mysql/es-ES/mandatory/sample_notices.sql index 0450bd027f..26a7c812ac 100644 --- a/installer/data/mysql/es-ES/mandatory/sample_notices.sql +++ b/installer/data/mysql/es-ES/mandatory/sample_notices.sql @@ -16,3 +16,4 @@ VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <> <>,\n\nYou have suggested that the library acquire <> by <>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <>.\n\nThank you,\n\n<>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <> <>,\n\nYou have suggested that the library acquire <> by <>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <>\n\nThank you,\n\n<>'), ('suggestions','REJECTED','Suggestion rejected', 'Purchase suggestion declined','Dear <> <>,\n\nYou have suggested that the library acquire <> by <>.\n\nThe library has reviewed your request today, and has decided not to accept the suggestion at this time.\n\nThe reason given is: <>\n\nIf you have any questions, please email us at <>.\n\nThank you,\n\n<>'); +INSERT INTO `letter` (module, code, name, title, content) VALUES ('circulation','RENEWAL','Item Renewal','Renewals','The following items have been renew:\r\n----\r\n<>\r\n----\r\nThank you for visiting <>.'); diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql b/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql index 1056d14c10..4d60636b82 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql @@ -18,3 +18,4 @@ VALUES ('suggestions','AVAILABLE','Suggestion disponible', 'Suggestion d\'achat disponible','cher(e) <> <>,\n\nVous avez effectué une suggestion d\'achat pour le docuement <> de <>.\n\nNous sommes heureux de vous informer que le document que vous aviez demandé est maintenant disponible dans nos collections.\n\nSi vous avez des questions, merci de nous contacter par courriel à l\'adresse <>.\n\nMerci,\n\n<>'), ('suggestions','ORDERED','Suggestion commandée', 'Suggestion commandée','Cher(e) <> <>,\n\nVous avez effectué une demande de suggestion d\'achat sur le docuement <> de <>.\n\nNous sommes heureux de vous informer que le document que vous avez demandé est maintenant en commande. Le document devrait arriver rapidement dans nos collections.\n\nVous serez averti quand le docuement sera disponible.\n\nSi vous avez des questions, merci de nous contacter à l\'adresse <>\n\nMerci,\n\n<>'), ('suggestions','REJECTED','Suggestion rejetée', 'Suggestion d\'achat rejeté','Cher(e) <> <>,\n\nVous avez fait la demande du document <> de <>.\n\nla Bibliothèque a examiné votre demande ce jour, et a décidé de ne pas retenir la suggestion pour l\'instant.\n\nLa raison est la suivante: <>\n\nSi vous avez des questions, merci de nous contacter à l\'adresse <>.\n\nMerci,\n\n<>'); +INSERT INTO `letter` (module, code, name, title, content) VALUES ('circulation','RENEWAL','Item Renewal','Renewals','The following items have been renew:\r\n----\r\n<>\r\n----\r\nThank you for visiting <>.'); diff --git a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql b/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql index f40da366e2..9c3e5e28a8 100644 --- a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql +++ b/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql @@ -37,3 +37,4 @@ VALUES ('circulation','ODUE','Purring','Purring pÃ¥ dokument','<> <>,\n\nDu har foreslÃ¥tt at biblioteket kjøper inn <> av <>.\n\nVi har gleden av Ã¥ informere deg om at dokumentet nÃ¥ er innlemmet i samlingen.\n\nEr det noe du lurer pÃ¥, vennligst kontakt oss pÃ¥ <>.\n\nVennlig hilsen,\n\n<>'), ('suggestions','ORDERED','Innkjøpsforslag i bestilling', 'Innkjøpsforslag i bestilling','Dear <> <>,\n\nDu har foreslÃ¥tt at biblioteket kjøper inn <> av <>.\n\nVi har gleden av Ã¥ informere deg om at dokumentet du foreslo nÃ¥ er i bestilling.\n\nDu vil fÃ¥ en ny melding nÃ¥r dokumentet er tilgjengelig.\n\nEr det noe du lurer pÃ¥, vennligst kontakt oss pÃ¥ <>.\n\nVennlig hilsen,\n\n<>'), ('suggestions','REJECTED','Innkjøpsforslag avslÃ¥tt', 'Innkjøpsforslag avslÃ¥tt','<> <>,\n\nDu har foreslÃ¥tt at biblioteket kjøper inn <> av <>.\n\nBiblioteket har vurdert innkjøpsforslaget ditt i dag, og bestemt seg for Ã¥ ikke ta det til følge.\n\nBegrunnelse: <>\n\nEr det noe du lurer pÃ¥, vennligst kontakt oss pÃ¥ <>.\n\nVennlig hilsen,\n\n<>'); +INSERT INTO `letter` (module, code, name, title, content) VALUES ('circulation','RENEWAL','Item Renewal','Renewals','The following items have been renew:\r\n----\r\n<>\r\n----\r\nThank you for visiting <>.'); diff --git a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql b/installer/data/mysql/pl-PL/mandatory/sample_notices.sql index 73102af10b..69812fd1ce 100644 --- a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql +++ b/installer/data/mysql/pl-PL/mandatory/sample_notices.sql @@ -18,3 +18,4 @@ VALUES ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <> <>,\n\nYou have suggested that the library acquire <> by <>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <>.\n\nThank you,\n\n<>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <> <>,\n\nYou have suggested that the library acquire <> by <>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <>\n\nThank you,\n\n<>'), ('suggestions','REJECTED','Suggestion rejected', 'Purchase suggestion declined','Dear <> <>,\n\nYou have suggested that the library acquire <> by <>.\n\nThe library has reviewed your request today, and has decided not to accept the suggestion at this time.\n\nThe reason given is: <>\n\nIf you have any questions, please email us at <>.\n\nThank you,\n\n<>'); +INSERT INTO `letter` (module, code, name, title, content) VALUES ('circulation','RENEWAL','Item Renewal','Renewals','The following items have been renew:\r\n----\r\n<>\r\n----\r\nThank you for visiting <>.'); diff --git a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql b/installer/data/mysql/ru-RU/mandatory/sample_notices.sql index e13782ad28..358783e6ab 100644 --- a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql +++ b/installer/data/mysql/ru-RU/mandatory/sample_notices.sql @@ -16,3 +16,4 @@ VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <> <>,\n\nYou have suggested that the library acquire <> by <>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <>.\n\nThank you,\n\n<>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <> <>,\n\nYou have suggested that the library acquire <> by <>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <>\n\nThank you,\n\n<>'), ('suggestions','REJECTED','Suggestion rejected', 'Purchase suggestion declined','Dear <> <>,\n\nYou have suggested that the library acquire <> by <>.\n\nThe library has reviewed your request today, and has decided not to accept the suggestion at this time.\n\nThe reason given is: <>\n\nIf you have any questions, please email us at <>.\n\nThank you,\n\n<>'); +INSERT INTO `letter` (module, code, name, title, content) VALUES ('circulation','RENEWAL','Item Renewal','Renewals','The following items have been renew:\r\n----\r\n<>\r\n----\r\nThank you for visiting <>.'); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index ab140e75a2..08b8ae3efc 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -399,3 +399,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SeparateHoldingsBranch', 'homebranch', 'Branch used to separate holdings', 'homebranch|holdingbranch', 'Choice'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSeparateHoldings', '0', 'Separate current branch holdings from other holdings (OPAC)', NULL, 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSeparateHoldingsBranch', 'homebranch', 'Branch used to separate holdings (OPAC)', 'homebranch|holdingbranch', 'Choice'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RenewalSendNotices','0', NULL, '', 'YesNo'); diff --git a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql b/installer/data/mysql/uk-UA/mandatory/sample_notices.sql index a908f6c464..b7e67c502a 100644 --- a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql +++ b/installer/data/mysql/uk-UA/mandatory/sample_notices.sql @@ -15,3 +15,4 @@ VALUES ('circulation','ODUE','Overdue Notice','Item Overdue','Dear <> <>,\n\nYou have suggested that the library acquire <> by <>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <>.\n\nThank you,\n\n<>'), ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <> <>,\n\nYou have suggested that the library acquire <> by <>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <>\n\nThank you,\n\n<>'), ('suggestions','REJECTED','Suggestion rejected', 'Purchase suggestion declined','Dear <> <>,\n\nYou have suggested that the library acquire <> by <>.\n\nThe library has reviewed your request today, and has decided not to accept the suggestion at this time.\n\nThe reason given is: <>\n\nIf you have any questions, please email us at <>.\n\nThank you,\n\n<>'); +INSERT INTO `letter` (module, code, name, title, content) VALUES ('circulation','RENEWAL','Item Renewal','Renewals','The following items have been renew:\r\n----\r\n<>\r\n----\r\nThank you for visiting <>.'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 36d35edd9b..18ab83e1cb 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6309,6 +6309,14 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "XXXX"; +if ( C4::Context->preference('Version') < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('RenewalSendNotice', '0', '', NULL, 'YesNo')"); + print "Upgrade to $DBversion done (Bug 9151 - System preference to controll the renewal notice sending)\n"; + SetVersion($DBversion); +} + + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index c188d80edb..f121133f2a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -227,6 +227,12 @@ Circulation: choices: date_due: the old due date of the checkout. now: the current date. + - + - pref: RenewalSendNotice + choices: + yes: Send + no: "Don't send" + - a renewal notice according to patron checkout alert preferences. - - Prevent patrons from making holds on the OPAC if they owe more than - pref: maxoutstanding -- 2.39.5