use C4::Overdues;
use Koha::Calendar;
use Koha::DateUtils;
+use Koha::Patrons;
sub usage {
pod2usage( -verbose => 2 );
my $library_code;
my $help;
my $outfile;
+my $skip_patrons_with_email;
# maps to convert I-tiva terms to Koha terms
my $type_module_map = {
'type:s' => \@types,
'w|waiting-hold-day:s' => \@holds_waiting_days_to_call,
'c|code|library-code:s' => \$library_code,
+ 's|skip-patrons-with-email' => \$skip_patrons_with_email,
'help|h' => \$help,
);
} else {
print "No output file defined; printing to STDOUT\n"
if ( defined $verbose );
- open( $OUT, '>', "&STDOUT" ) || die("Couldn't duplicate STDOUT: $!");
+ $OUT = *STDOUT || die "Couldn't duplicate STDOUT: $!";
}
my $format = 'V'; # format for phone notifications
next;
}
+ my $patrons;
foreach my $issues (@loop) {
+ $patrons->{$issues->{borrowernumber}} ||= Koha::Patrons->find( $issues->{borrowernumber} ) if $skip_patrons_with_email;
+ next if $skip_patrons_with_email && $patrons->{$issues->{borrowernumber}}->notice_email_address;
+
my $date_dt = dt_from_string ( $issues->{'date_due'} );
my $due_date = output_pref( { dt => $date_dt, dateonly => 1, dateformat =>'metric' } );
JOIN biblio USING (biblionumber)
JOIN branches ON (issues.branchcode = branches.branchcode)
JOIN overduerules USING (categorycode)
+ JOIN overduerules_transport_types USING ( overduerules_id )
WHERE ( overduerules.branchcode = borrowers.branchcode or overduerules.branchcode = '')
+ AND overduerules_transport_types.message_transport_type = 'phone'
AND ( (TO_DAYS(NOW())-TO_DAYS(date_due) ) = delay1
OR (TO_DAYS(NOW())-TO_DAYS(date_due) ) = delay2
OR (TO_DAYS(NOW())-TO_DAYS(date_due) ) = delay3 )