Lines 81-88
BEGIN {
Link Here
|
81 |
&GetBorrowersWhoHaveNeverBorrowed |
81 |
&GetBorrowersWhoHaveNeverBorrowed |
82 |
&GetBorrowersWithIssuesHistoryOlderThan |
82 |
&GetBorrowersWithIssuesHistoryOlderThan |
83 |
|
83 |
|
84 |
&GetUpcomingMembershipExpires |
|
|
85 |
|
86 |
&IssueSlip |
84 |
&IssueSlip |
87 |
GetBorrowersWithEmail |
85 |
GetBorrowersWithEmail |
88 |
|
86 |
|
Lines 1166-1218
sub GetNoticeEmailAddress {
Link Here
|
1166 |
return $data->{'primaryemail'} || ''; |
1164 |
return $data->{'primaryemail'} || ''; |
1167 |
} |
1165 |
} |
1168 |
|
1166 |
|
1169 |
=head2 GetUpcomingMembershipExpires |
|
|
1170 |
|
1171 |
my $expires = GetUpcomingMembershipExpires({ |
1172 |
branch => $branch, before => $before, after => $after, |
1173 |
}); |
1174 |
|
1175 |
$branch is an optional branch code. |
1176 |
$before/$after is an optional number of days before/after the date that |
1177 |
is set by the preference MembershipExpiryDaysNotice. |
1178 |
If the pref would be 14, before 2 and after 3, you will get all expires |
1179 |
from 12 to 17 days. |
1180 |
|
1181 |
=cut |
1182 |
|
1183 |
sub GetUpcomingMembershipExpires { |
1184 |
my ( $params ) = @_; |
1185 |
my $before = $params->{before} || 0; |
1186 |
my $after = $params->{after} || 0; |
1187 |
my $branch = $params->{branch}; |
1188 |
|
1189 |
my $dbh = C4::Context->dbh; |
1190 |
my $days = C4::Context->preference("MembershipExpiryDaysNotice") || 0; |
1191 |
my $date1 = dt_from_string->add( days => $days - $before ); |
1192 |
my $date2 = dt_from_string->add( days => $days + $after ); |
1193 |
$date1= output_pref({ dt => $date1, dateformat => 'iso', dateonly => 1 }); |
1194 |
$date2= output_pref({ dt => $date2, dateformat => 'iso', dateonly => 1 }); |
1195 |
|
1196 |
my $query = q| |
1197 |
SELECT borrowers.*, categories.description, |
1198 |
branches.branchname, branches.branchemail FROM borrowers |
1199 |
LEFT JOIN branches USING (branchcode) |
1200 |
LEFT JOIN categories USING (categorycode) |
1201 |
|; |
1202 |
if( $branch ) { |
1203 |
$query.= 'WHERE branchcode=? AND dateexpiry BETWEEN ? AND ?'; |
1204 |
} else { |
1205 |
$query.= 'WHERE dateexpiry BETWEEN ? AND ?'; |
1206 |
} |
1207 |
|
1208 |
my $sth = $dbh->prepare( $query ); |
1209 |
my @pars = $branch? ( $branch ): (); |
1210 |
push @pars, $date1, $date2; |
1211 |
$sth->execute( @pars ); |
1212 |
my $results = $sth->fetchall_arrayref( {} ); |
1213 |
return $results; |
1214 |
} |
1215 |
|
1216 |
=head2 GetAge |
1167 |
=head2 GetAge |
1217 |
|
1168 |
|
1218 |
$dateofbirth,$date = &GetAge($date); |
1169 |
$dateofbirth,$date = &GetAge($date); |
1219 |
- |
|
|