Bug 17569: Remove C4::Members::GetUpcomingMembershipExpires

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-11-08 08:02:38 +00:00 committed by Kyle M Hall
parent 4f48dcc9f8
commit f91fe7da2c

View file

@ -76,8 +76,6 @@ BEGIN {
&GetBorrowersWhoHaveNeverBorrowed
&GetBorrowersWithIssuesHistoryOlderThan
&GetUpcomingMembershipExpires
&IssueSlip
GetBorrowersWithEmail
@ -1059,53 +1057,6 @@ sub GetNoticeEmailAddress {
return $data->{'primaryemail'} || '';
}
=head2 GetUpcomingMembershipExpires
my $expires = GetUpcomingMembershipExpires({
branch => $branch, before => $before, after => $after,
});
$branch is an optional branch code.
$before/$after is an optional number of days before/after the date that
is set by the preference MembershipExpiryDaysNotice.
If the pref would be 14, before 2 and after 3, you will get all expires
from 12 to 17 days.
=cut
sub GetUpcomingMembershipExpires {
my ( $params ) = @_;
my $before = $params->{before} || 0;
my $after = $params->{after} || 0;
my $branch = $params->{branch};
my $dbh = C4::Context->dbh;
my $days = C4::Context->preference("MembershipExpiryDaysNotice") || 0;
my $date1 = dt_from_string->add( days => $days - $before );
my $date2 = dt_from_string->add( days => $days + $after );
$date1= output_pref({ dt => $date1, dateformat => 'iso', dateonly => 1 });
$date2= output_pref({ dt => $date2, dateformat => 'iso', dateonly => 1 });
my $query = q|
SELECT borrowers.*, categories.description,
branches.branchname, branches.branchemail FROM borrowers
LEFT JOIN branches USING (branchcode)
LEFT JOIN categories USING (categorycode)
|;
if( $branch ) {
$query.= 'WHERE branchcode=? AND dateexpiry BETWEEN ? AND ?';
} else {
$query.= 'WHERE dateexpiry BETWEEN ? AND ?';
}
my $sth = $dbh->prepare( $query );
my @pars = $branch? ( $branch ): ();
push @pars, $date1, $date2;
$sth->execute( @pars );
my $results = $sth->fetchall_arrayref( {} );
return $results;
}
=head2 GetBorrowersToExpunge
$borrowers = &GetBorrowersToExpunge(