Bug 19620: Allow skipping of patrons with valid emails for Talking Tech

Some libraries want to be able to skip patrons with valid email addresses when generated outbound files for Talking Tech.

Test Plan:
1) Apply this patch
2) Run TalkingTech_itiva_outbound.pl
   Overdue will be easiest to use for testing
3) Note one or more patrons show up that have email addresses
4) Run again with -s ( or --skip-patrons-with-email )
5) Note the new file no longer has patrons with emails!

Signed-off-by: Jesse Maseto <jesse@bywatersolution.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
I did not test but changes make sense

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Kyle M Hall 2018-03-02 11:10:12 -05:00 committed by Nick Clemens
parent 90ff0f3343
commit 172f2e0e05
1 changed files with 7 additions and 0 deletions

View File

@ -37,6 +37,7 @@ use C4::Letters;
use C4::Overdues;
use Koha::Calendar;
use Koha::DateUtils;
use Koha::Patrons;
sub usage {
pod2usage( -verbose => 2 );
@ -57,6 +58,7 @@ my @holds_waiting_days_to_call;
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 = {
@ -78,6 +80,7 @@ GetOptions(
'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,
);
@ -116,7 +119,11 @@ foreach my $type (@types) {
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' } );