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

(-)a/misc/cronjobs/automatic_renewals.pl (-30 / +60 lines)
Lines 215-221 while ( my $auto_renew = $auto_renews->next ) { Link Here
215
215
216
}
216
}
217
217
218
if ( $send_notices && $confirm ) {
218
if ( $send_notices && ( $confirm || $verbose ) ) {
219
    for my $borrowernumber ( keys %report ) {
219
    for my $borrowernumber ( keys %report ) {
220
        my $patron = Koha::Patrons->find($borrowernumber);
220
        my $patron = Koha::Patrons->find($borrowernumber);
221
        for my $issue ( @{ $report{$borrowernumber} } ) {
221
        for my $issue ( @{ $report{$borrowernumber} } ) {
Lines 232-263 if ( $send_notices && $confirm ) { Link Here
232
                lang => $patron->lang,
232
                lang => $patron->lang,
233
            );
233
            );
234
234
235
            my $library = Koha::Libraries->find( $patron->branchcode );
235
            if ($verbose) {
236
            my $admin_email_address = $library->from_email_address;
236
                say "Would send the following notice to borrowernumber: "
237
                  . $patron->borrowernumber;
237
238
238
            C4::Letters::EnqueueLetter(
239
                print $letter->{content};
239
                {   letter                 => $letter,
240
            }
240
                    borrowernumber         => $borrowernumber,
241
241
                    message_transport_type => 'email',
242
            if ($confirm) {
242
                    from_address           => $admin_email_address,
243
                my $library = Koha::Libraries->find( $patron->branchcode );
243
                }
244
                my $admin_email_address = $library->from_email_address;
244
            );
245
246
                C4::Letters::EnqueueLetter(
247
                    {
248
                        letter                 => $letter,
249
                        borrowernumber         => $borrowernumber,
250
                        message_transport_type => 'email',
251
                        from_address           => $admin_email_address,
252
                    }
253
                );
254
            }
245
        }
255
        }
246
    }
256
    }
247
257
248
    if ($digest_per_branch) {
258
    if ($digest_per_branch) {
249
        while (my ($branchcode, $digests) = each %$renew_digest) {
259
        while ( my ( $branchcode, $digests ) = each %$renew_digest ) {
250
            send_digests({
260
            send_digests(
251
                digests => $digests,
261
                {
252
                branchcode => $branchcode,
262
                    digests     => $digests,
253
                letter_code => 'AUTO_RENEWALS_DGST',
263
                    branchcode  => $branchcode,
254
            });
264
                    letter_code => 'AUTO_RENEWALS_DGST',
265
                    confirm     => $confirm,
266
                    verbose     => $verbose
267
                }
268
            );
255
        }
269
        }
256
    } else {
270
    }
257
        send_digests({
271
    else {
258
            digests => $renew_digest,
272
        send_digests(
259
            letter_code => 'AUTO_RENEWALS_DGST',
273
            {
260
        });
274
                digests     => $renew_digest,
275
                letter_code => 'AUTO_RENEWALS_DGST',
276
                confirm     => $confirm,
277
                verbose     => $verbose
278
279
            }
280
        );
261
    }
281
    }
262
}
282
}
263
283
Lines 331-344 sub send_digests { Link Here
331
            );
351
            );
332
352
333
            if ($letter) {
353
            if ($letter) {
334
                C4::Letters::EnqueueLetter(
354
335
                    {
355
                if ($params->{verbose}) {
336
                        letter                 => $letter,
356
                    say "Would send the following digest notice to borrowernumber: "
337
                        borrowernumber         => $borrowernumber,
357
                      . $patron->borrowernumber;
338
                        from_address           => $from_address,
358
339
                        message_transport_type => $transport
359
                    print $letter->{content};
340
                    }
360
                }
341
                );
361
362
                if ($params->{confirm}) {
363
364
                    C4::Letters::EnqueueLetter(
365
                        {
366
                            letter                 => $letter,
367
                            borrowernumber         => $borrowernumber,
368
                            from_address           => $from_address,
369
                            message_transport_type => $transport
370
                        }
371
                    );
372
                }
342
            }
373
            }
343
            else {
374
            else {
344
                warn
375
                warn
345
- 

Return to bug 30751