Added a system preferences (RenewalSendNotice - default no) to controll the 
renewal notice sending.
Added to installer languages the renewal notice template.
---
 C4/Circulation.pm                                  |   34 +++++++++++---------
 .../data/mysql/de-DE/mandatory/sample_notices.sql  |    1 +
 .../data/mysql/en/mandatory/sample_notices.sql     |    1 +
 .../data/mysql/es-ES/mandatory/sample_notices.sql  |    1 +
 .../mysql/fr-FR/1-Obligatoire/sample_notices.sql   |    1 +
 .../mysql/nb-NO/1-Obligatorisk/sample_notices.sql  |    1 +
 .../data/mysql/pl-PL/mandatory/sample_notices.sql  |    1 +
 .../data/mysql/ru-RU/mandatory/sample_notices.sql  |    1 +
 installer/data/mysql/sysprefs.sql                  |    1 +
 .../data/mysql/uk-UA/mandatory/sample_notices.sql  |    1 +
 installer/data/mysql/updatedatabase.pl             |    8 +++++
 .../en/modules/admin/preferences/circulation.pref  |    6 ++++
 12 files changed, 41 insertions(+), 16 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index f45de73..c86c615 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -2576,22 +2576,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 5bd39a2..7a1a9a3 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: <<issues.date_due>><br />
    <li><<items.barcode>></li>
    <li><<items.itemcallnumber>></li>
 </ul>', 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<<biblio.title>>\r\n----\r\nThank you for visiting 
<<branches.branchname>>.');
diff --git a/installer/data/mysql/en/mandatory/sample_notices.sql 
b/installer/data/mysql/en/mandatory/sample_notices.sql
index 6fa0a54..3d48400 100644
--- a/installer/data/mysql/en/mandatory/sample_notices.sql
+++ b/installer/data/mysql/en/mandatory/sample_notices.sql
@@ -105,3 +105,4 @@ Date due: <<issues.date_due>><br />
    <li><<items.barcode>></li>
    <li><<items.itemcallnumber>></li>
 </ul>', 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<<biblio.title>>\r\n----\r\nThank you for visiting 
<<branches.branchname>>.');
diff --git a/installer/data/mysql/es-ES/mandatory/sample_notices.sql 
b/installer/data/mysql/es-ES/mandatory/sample_notices.sql
index 0450bd0..26a7c81 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 <<borrowers.f
 ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase 
available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have 
suggested that the library acquire <<suggestions.title>> by 
<<suggestions.author>>.\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 <<branches.branchemail>>.\n\nThank 
you,\n\n<<branches.branchname>>'),
 ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear 
<<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the 
library acquire <<suggestions.title>> by <<suggestions.author>>.\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 <<branches.branchemail>>\n\nThank 
you,\n\n<<branches.branchname>>'),
 ('suggestions','REJECTED','Suggestion rejected', 'Purchase suggestion 
declined','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have 
suggested that the library acquire <<suggestions.title>> by 
<<suggestions.author>>.\n\nThe library has reviewed your request today, and has 
decided not to accept the suggestion at this time.\n\nThe reason given is: 
<<suggestions.reason>>\n\nIf you have any questions, please email us at 
<<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>');
+INSERT INTO `letter` (module, code, name, title, content) VALUES 
('circulation','RENEWAL','Item Renewal','Renewals','The following items have 
been renew:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting 
<<branches.branchname>>.');
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 1056d14..4d60636 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) <<borrowers.firstname>> <<borrowers.surname>>,\n\nVous 
avez effectué une suggestion d\'achat pour le docuement  <<suggestions.title>> 
de <<suggestions.author>>.\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 
<<branches.branchemail>>.\n\nMerci,\n\n<<branches.branchname>>'),
 ('suggestions','ORDERED','Suggestion commandée', 'Suggestion 
commandée','Cher(e) <<borrowers.firstname>> <<borrowers.surname>>,\n\nVous avez 
effectué une demande de suggestion d\'achat sur le docuement 
<<suggestions.title>> de <<suggestions.author>>.\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 
<<branches.branchemail>>\n\nMerci,\n\n<<branches.branchname>>'),
 ('suggestions','REJECTED','Suggestion rejetée', 'Suggestion d\'achat 
rejeté','Cher(e) <<borrowers.firstname>> <<borrowers.surname>>,\n\nVous avez 
fait la demande du document <<suggestions.title>> de 
<<suggestions.author>>.\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: <<suggestions.reason>>\n\nSi vous avez des questions, merci de nous 
contacter à l\'adresse 
<<branches.branchemail>>.\n\nMerci,\n\n<<branches.branchname>>');
+INSERT INTO `letter` (module, code, name, title, content) VALUES 
('circulation','RENEWAL','Item Renewal','Renewals','The following items have 
been renew:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting 
<<branches.branchname>>.');
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 f40da36..9c3e5e2 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','<<borrowers.first
 ('suggestions','AVAILABLE','Foreslått dokument tilgjengelig', 'Foreslått 
dokument tilgjengelig','<<borrowers.firstname>> <<borrowers.surname>>,\n\nDu 
har foreslått at biblioteket kjøper inn <<suggestions.title>> av 
<<suggestions.author>>.\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å 
<<branches.branchemail>>.\n\nVennlig hilsen,\n\n<<branches.branchname>>'),
 ('suggestions','ORDERED','Innkjøpsforslag i bestilling', 'Innkjøpsforslag i 
bestilling','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nDu har 
foreslått at biblioteket kjøper inn <<suggestions.title>> av 
<<suggestions.author>>.\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å 
<<branches.branchemail>>.\n\nVennlig hilsen,\n\n<<branches.branchname>>'),
 ('suggestions','REJECTED','Innkjøpsforslag avslått', 'Innkjøpsforslag 
avslått','<<borrowers.firstname>> <<borrowers.surname>>,\n\nDu har foreslått at 
biblioteket kjøper inn <<suggestions.title>> av 
<<suggestions.author>>.\n\nBiblioteket har vurdert innkjøpsforslaget ditt i 
dag, og bestemt seg for å ikke ta det til følge.\n\nBegrunnelse: 
<<suggestions.reason>>\n\nEr det noe du lurer på, vennligst kontakt oss på 
<<branches.branchemail>>.\n\nVennlig hilsen,\n\n<<branches.branchname>>');
+INSERT INTO `letter` (module, code, name, title, content) VALUES 
('circulation','RENEWAL','Item Renewal','Renewals','The following items have 
been renew:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting 
<<branches.branchname>>.');
diff --git a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql 
b/installer/data/mysql/pl-PL/mandatory/sample_notices.sql
index 73102af..69812fd 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 <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have 
suggested that the library acquire <<suggestions.title>> by 
<<suggestions.author>>.\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 <<branches.branchemail>>.\n\nThank 
you,\n\n<<branches.branchname>>'),
 ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear 
<<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the 
library acquire <<suggestions.title>> by <<suggestions.author>>.\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 <<branches.branchemail>>\n\nThank 
you,\n\n<<branches.branchname>>'),
 ('suggestions','REJECTED','Suggestion rejected', 'Purchase suggestion 
declined','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have 
suggested that the library acquire <<suggestions.title>> by 
<<suggestions.author>>.\n\nThe library has reviewed your request today, and has 
decided not to accept the suggestion at this time.\n\nThe reason given is: 
<<suggestions.reason>>\n\nIf you have any questions, please email us at 
<<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>');
+INSERT INTO `letter` (module, code, name, title, content) VALUES 
('circulation','RENEWAL','Item Renewal','Renewals','The following items have 
been renew:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting 
<<branches.branchname>>.');
diff --git a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql 
b/installer/data/mysql/ru-RU/mandatory/sample_notices.sql
index e13782a..358783e 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 <<borrowers.f
 ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase 
available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have 
suggested that the library acquire <<suggestions.title>> by 
<<suggestions.author>>.\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 <<branches.branchemail>>.\n\nThank 
you,\n\n<<branches.branchname>>'),
 ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear 
<<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the 
library acquire <<suggestions.title>> by <<suggestions.author>>.\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 <<branches.branchemail>>\n\nThank 
you,\n\n<<branches.branchname>>'),
 ('suggestions','REJECTED','Suggestion rejected', 'Purchase suggestion 
declined','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have 
suggested that the library acquire <<suggestions.title>> by 
<<suggestions.author>>.\n\nThe library has reviewed your request today, and has 
decided not to accept the suggestion at this time.\n\nThe reason given is: 
<<suggestions.reason>>\n\nIf you have any questions, please email us at 
<<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>');
+INSERT INTO `letter` (module, code, name, title, content) VALUES 
('circulation','RENEWAL','Item Renewal','Renewals','The following items have 
been renew:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting 
<<branches.branchname>>.');
diff --git a/installer/data/mysql/sysprefs.sql 
b/installer/data/mysql/sysprefs.sql
index 44f9eb3..2d30c22 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -387,3 +387,4 @@ INSERT INTO systempreferences 
(variable,value,explanation,type) VALUES('INTRAdid
 INSERT INTO systempreferences (variable, value, options, explanation, type) 
VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are 
marked as withdrawn cannot be returned.', 'YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) 
VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to 
pull list to this many days ago',NULL,'Integer');
 INSERT INTO systempreferences (variable,value,explanation,options,type) 
VALUES('alphabet','A B C D E F G H I J K L M N O P Q R S T U V W X Y 
Z','Alphabet than can be expanded into browse links, e.g. on Home > 
Patrons',NULL,'free');
+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 a908f6c..b7e67c5 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 <<borrowers.f
 ('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase 
available','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have 
suggested that the library acquire <<suggestions.title>> by 
<<suggestions.author>>.\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 <<branches.branchemail>>.\n\nThank 
you,\n\n<<branches.branchname>>'),
 ('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear 
<<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have suggested that the 
library acquire <<suggestions.title>> by <<suggestions.author>>.\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 <<branches.branchemail>>\n\nThank 
you,\n\n<<branches.branchname>>'),
 ('suggestions','REJECTED','Suggestion rejected', 'Purchase suggestion 
declined','Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\nYou have 
suggested that the library acquire <<suggestions.title>> by 
<<suggestions.author>>.\n\nThe library has reviewed your request today, and has 
decided not to accept the suggestion at this time.\n\nThe reason given is: 
<<suggestions.reason>>\n\nIf you have any questions, please email us at 
<<branches.branchemail>>.\n\nThank you,\n\n<<branches.branchname>>');
+INSERT INTO `letter` (module, code, name, title, content) VALUES 
('circulation','RENEWAL','Item Renewal','Renewals','The following items have 
been renew:\r\n----\r\n<<biblio.title>>\r\n----\r\nThank you for visiting 
<<branches.branchname>>.');
diff --git a/installer/data/mysql/updatedatabase.pl 
b/installer/data/mysql/updatedatabase.pl
index 1a99f84..09baee7 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -6093,6 +6093,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 c583bbe..0e20916 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
-- 
1.7.9.5

_______________________________________________
Koha-patches mailing list
Koha-patches@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to