[Koha-patches] [PATCH 1/2] BUG 9151 - Renewal notice according to patron alert preferences
Vitor FERNANDES
vitorfernandes87 at gmail.com
Tue Nov 27 16:21:15 CET 2012
Modifications on AddRenewals and SendCirculationAlert in order to send a renewal notice to the patron according to the patron checkout alert preference.
Added a new notice template for renewals notices.
---
C4/Circulation.pm | 22 +++++++++++++++++++++-
installer/data/mysql/updatedatabase.pl | 10 ++++++++++
2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index ad86d41..f45de73 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -2575,6 +2575,25 @@ sub AddRenewal {
"Renewal of Rental Item $item->{'title'} $item->{'barcode'}",
'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,
+ });
+ }
+
# Log the renewal
UpdateStats( $branch, 'renew', $charge, '', $itemnumber, $item->{itype}, $borrowernumber, undef, $item->{'ccode'});
return $datedue;
@@ -2896,12 +2915,13 @@ sub SendCirculationAlert {
my %message_name = (
CHECKIN => 'Item_Check_in',
CHECKOUT => 'Item_Checkout',
+ RENEWAL => 'Item_Checkout',
);
my $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences({
borrowernumber => $borrower->{borrowernumber},
message_name => $message_name{$type},
});
- my $issues_table = ( $type eq 'CHECKOUT' ) ? 'issues' : 'old_issues';
+ my $issues_table = ( $type eq 'CHECKOUT' || $type eq 'RENEWAL' ) ? 'issues' : 'old_issues';
my $letter = C4::Letters::GetPreparedLetter (
module => 'circulation',
letter_code => $type,
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 966ec9b..1a99f84 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -6083,6 +6083,16 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
SetVersion($DBversion);
}
+$DBversion = "XXXX";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do(q{
+ 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>>.');
+ });
+ print "Upgrade to $DBversion done (Bug 9151 - Renewal notice according to patron alert preferences)\n";
+ SetVersion($DBversion);
+}
+
=head1 FUNCTIONS
=head2 TableExists($table)
--
1.7.9.5
More information about the Koha-patches
mailing list