View | Details | Raw Unified | Return to bug 13240
Collapse All | Expand All

(-)a/misc/cronjobs/advance_notices.pl (-7 lines)
Lines 228-234 my @letters; Link Here
228
UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) {
228
UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) {
229
    @letters = ();
229
    @letters = ();
230
    warn 'examining ' . $upcoming->{'itemnumber'} . ' upcoming due items' if $verbose;
230
    warn 'examining ' . $upcoming->{'itemnumber'} . ' upcoming due items' if $verbose;
231
    # warn( Data::Dumper->Dump( [ $upcoming ], [ 'overdue' ] ) );
232
231
233
    my $from_address = $upcoming->{branchemail} || $admin_adress;
232
    my $from_address = $upcoming->{branchemail} || $admin_adress;
234
233
Lines 237-243 UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { Link Here
237
        # This item is due today. Send an 'item due' message.
236
        # This item is due today. Send an 'item due' message.
238
        $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $upcoming->{'borrowernumber'},
237
        $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $upcoming->{'borrowernumber'},
239
                                                                                   message_name   => 'item_due' } );
238
                                                                                   message_name   => 'item_due' } );
240
        # warn( Data::Dumper->Dump( [ $borrower_preferences ], [ 'borrower_preferences' ] ) );
241
        next unless $borrower_preferences;
239
        next unless $borrower_preferences;
242
        
240
        
243
        if ( $borrower_preferences->{'wants_digest'} ) {
241
        if ( $borrower_preferences->{'wants_digest'} ) {
Lines 271-277 UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { Link Here
271
    } else {
269
    } else {
272
        $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $upcoming->{'borrowernumber'},
270
        $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $upcoming->{'borrowernumber'},
273
                                                                                   message_name   => 'advance_notice' } );
271
                                                                                   message_name   => 'advance_notice' } );
274
        # warn( Data::Dumper->Dump( [ $borrower_preferences ], [ 'borrower_preferences' ] ) );
275
        next UPCOMINGITEM unless $borrower_preferences && exists $borrower_preferences->{'days_in_advance'};
272
        next UPCOMINGITEM unless $borrower_preferences && exists $borrower_preferences->{'days_in_advance'};
276
        next UPCOMINGITEM unless $borrower_preferences->{'days_in_advance'} == $upcoming->{'days_until_due'};
273
        next UPCOMINGITEM unless $borrower_preferences->{'days_in_advance'} == $upcoming->{'days_until_due'};
277
274
Lines 325-331 UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) { Link Here
325
}
322
}
326
323
327
324
328
# warn( Data::Dumper->Dump( [ $upcoming_digest ], [ 'upcoming_digest' ] ) );
329
325
330
# Now, run through all the people that want digests and send them
326
# Now, run through all the people that want digests and send them
331
327
Lines 344-350 PATRON: while ( my ( $borrowernumber, $digest ) = each %$upcoming_digest ) { Link Here
344
340
345
    my $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $borrowernumber,
341
    my $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $borrowernumber,
346
                                                                                  message_name   => 'advance_notice' } );
342
                                                                                  message_name   => 'advance_notice' } );
347
    # warn( Data::Dumper->Dump( [ $borrower_preferences ], [ 'borrower_preferences' ] ) );
348
    next PATRON unless $borrower_preferences; # how could this happen?
343
    next PATRON unless $borrower_preferences; # how could this happen?
349
344
350
345
Lines 404-410 PATRON: while ( my ( $borrowernumber, $digest ) = each %$due_digest ) { Link Here
404
399
405
    my $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $borrowernumber,
400
    my $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $borrowernumber,
406
                                                                                  message_name   => 'item_due' } );
401
                                                                                  message_name   => 'item_due' } );
407
    # warn( Data::Dumper->Dump( [ $borrower_preferences ], [ 'borrower_preferences' ] ) );
408
    next PATRON unless $borrower_preferences; # how could this happen?
402
    next PATRON unless $borrower_preferences; # how could this happen?
409
403
410
    my $letter_type = 'DUEDGST';
404
    my $letter_type = 'DUEDGST';
411
- 

Return to bug 13240