Browse Source

BUG 9151 - Renewal notice according to patron alert preferences

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.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
3.12.x
Vitor FERNANDES 12 years ago
committed by Jared Camins-Esakov
parent
commit
a478c52e09
  1. 22
      C4/Circulation.pm
  2. 10
      installer/data/mysql/updatedatabase.pl

22
C4/Circulation.pm

@ -2581,6 +2581,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;
@ -2902,12 +2921,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,

10
installer/data/mysql/updatedatabase.pl

@ -6299,6 +6299,16 @@ if (C4::Context->preference("Version") < TransformToNum($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)

Loading…
Cancel
Save