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

(-)a/installer/data/mysql/atomicupdate/bug-18532.perl (-4 / +12 lines)
Lines 4-14 if( CheckVersion( $DBversion ) ) { Link Here
4
    $dbh->do( qq{
4
    $dbh->do( qq{
5
        INSERT IGNORE INTO letter (module, code, name, title, content, message_transport_type) VALUES ('circulation', 'AUTO_RENEWALS_DGST', 'notification on auto renewing', 'Auto renewals (Digest)',
5
        INSERT IGNORE INTO letter (module, code, name, title, content, message_transport_type) VALUES ('circulation', 'AUTO_RENEWALS_DGST', 'notification on auto renewing', 'Auto renewals (Digest)',
6
        "Dear [% borrower.firstname %] [% borrower.surname %],
6
        "Dear [% borrower.firstname %] [% borrower.surname %],
7
        [% IF checkout.auto_renew_errors %]
7
        [% IF error %]
8
        There were [% checkout.auto_renew_errors %] items that where not correctly renewed.
8
            There were [% error %] items that were not correctly renewed.
9
        [% END %]
9
        [% END %]
10
        [% IF checkout.auto_renew %]
10
        [% IF success %]
11
        There were [% checkout.auto_renew %] items that where correctly renewed.
11
            There were [% success %] items that where correctly renewed.
12
        [% END %]
13
        [% FOREACH checkout IN checkouts %]
14
            [% checkout.item.biblio.title %] : [% checkout.item.barcode %]
15
            [% IF !checkout.auto_renew_error %]
16
                was renewed until [% checkout.date_due %]
17
            [% ELSE %]
18
                was not renewed with error: [% checkout.auto_renew_error %]
19
            [% END %]
12
        [% END %]
20
        [% END %]
13
        ", 'email');
21
        ", 'email');
14
    });
22
    });
(-)a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql (-7 / +15 lines)
Lines 411-422 This item must be renewed at the library. Link Here
411
The following item, [% biblio.title %], has correctly been renewed and is now due on [% checkout.date_due | $KohaDates as_due_date => 1 %]
411
The following item, [% biblio.title %], has correctly been renewed and is now due on [% checkout.date_due | $KohaDates as_due_date => 1 %]
412
[% END %]", 'email');
412
[% END %]", 'email');
413
413
414
INSERT INTO letter (module, code, name, title, content, message_transport_type) VALUES ('circulation', 'AUTO_RENEWALS_DGST', 'Notification on auto renewing', 'Auto renewals (Digest)',
414
INSERT IGNORE INTO letter (module, code, name, title, content, message_transport_type) VALUES ('circulation', 'AUTO_RENEWALS_DGST', 'Notification on auto renewing', 'Auto renewals (Digest)',
415
"Dear [% borrower.firstname %] [% borrower.surname %],
415
"Dear [% borrower.firstname %] [% borrower.surname %],
416
[% IF <<error>> %]
416
[% IF error %]
417
There were <<error>> items that where not correctly renewed.
417
    There were [% error %] items that were not correctly renewed.
418
[% END %]
418
[% END %]
419
[% IF <<success>> %]
419
[% IF success %]
420
There were <<success>> items that where correctly renewed.
420
    There were [% success %] items that where correctly renewed.
421
[% END %]", 'email');
421
[% END %]
422
422
[% FOREACH checkout IN checkouts %]
423
    [% checkout.item.biblio.title %] : [% checkout.item.barcode %]
424
    [% IF !checkout.auto_renew_error %]
425
        was renewed until [% checkout.date_due | $KohaDates %]
426
    [% ELSE %]
427
        was not renewed with error: [% checkout.auto_renew_error %]
428
    [% END %]
429
[% END %]
430
", 'email');
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc (-2 / +1 lines)
Lines 14-23 Link Here
14
    </tr>
14
    </tr>
15
    [% FOREACH messaging_preference IN messaging_preferences %]
15
    [% FOREACH messaging_preference IN messaging_preferences %]
16
    [% NEXT IF !Koha.Preference( 'ILLModule' ) && messaging_preference.message_name.match('^Ill_') %]
16
    [% NEXT IF !Koha.Preference( 'ILLModule' ) && messaging_preference.message_name.match('^Ill_') %]
17
    [% NEXT IF messaging_preference.Auto_Renewals && Koha.Preference('AutoRenewalNotices') != 'preferences' %]
17
    <tr>
18
    <tr>
18
      <td>[% IF ( messaging_preference.Item_Due ) %]Item due
19
      <td>[% IF ( messaging_preference.Item_Due ) %]Item due
19
          [% ELSIF ( messaging_preference.Advance_Notice ) %]Advance notice
20
          [% ELSIF ( messaging_preference.Advance_Notice ) %]Advance notice
20
          [% ELSIF ( messaging_preference.Upcoming_Events ) %]Upcoming events
21
          [% ELSIF ( messaging_preference.Hold_Filled ) %]Hold filled
21
          [% ELSIF ( messaging_preference.Hold_Filled ) %]Hold filled
22
          [% ELSIF ( messaging_preference.Item_Check_in ) %]Item check-in
22
          [% ELSIF ( messaging_preference.Item_Check_in ) %]Item check-in
23
          [% ELSIF ( messaging_preference.Item_Checkout ) %]
23
          [% ELSIF ( messaging_preference.Item_Checkout ) %]
Lines 28-34 Link Here
28
            [% END %]
28
            [% END %]
29
          [% ELSIF ( messaging_preference.Ill_ready ) %]Interlibrary loan ready
29
          [% ELSIF ( messaging_preference.Ill_ready ) %]Interlibrary loan ready
30
          [% ELSIF ( messaging_preference.Ill_unavailable ) %]Interlibrary loan unavailable
30
          [% ELSIF ( messaging_preference.Ill_unavailable ) %]Interlibrary loan unavailable
31
          [% ELSIF ( messaging_preference.Auto_Renewals ) %]Auto renewals
32
          [% ELSE %]Unknown [% END %]</td>
31
          [% ELSE %]Unknown [% END %]</td>
33
      [% IF ( messaging_preference.takes_days ) %]
32
      [% IF ( messaging_preference.takes_days ) %]
34
      <td>
33
      <td>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt (-1 / +1 lines)
Lines 56-61 Link Here
56
                                    <tbody>
56
                                    <tbody>
57
                                    [% FOREACH messaging_preference IN messaging_preferences %]
57
                                    [% FOREACH messaging_preference IN messaging_preferences %]
58
                                        [% NEXT IF !Koha.Preference( 'ILLModule' ) && messaging_preference.message_name.match('^Ill_') %]
58
                                        [% NEXT IF !Koha.Preference( 'ILLModule' ) && messaging_preference.message_name.match('^Ill_') %]
59
                                        [% NEXT IF messaging_preference.Auto_Renewals && Koha.Preference('AutoRenewalNotices') != 'preferences' %]
59
                                        <tr>
60
                                        <tr>
60
                                            <td>[% IF ( messaging_preference.Item_Due ) %]Item due
61
                                            <td>[% IF ( messaging_preference.Item_Due ) %]Item due
61
                                                [% ELSIF ( messaging_preference.Advance_Notice ) %]Advance notice
62
                                                [% ELSIF ( messaging_preference.Advance_Notice ) %]Advance notice
Lines 69-75 Link Here
69
                                                    [% END %]
70
                                                    [% END %]
70
                                                [% ELSIF ( messaging_preference.Ill_ready ) %]Interlibrary loan ready
71
                                                [% ELSIF ( messaging_preference.Ill_ready ) %]Interlibrary loan ready
71
                                                [% ELSIF ( messaging_preference.Ill_unavailable ) %]Interlibrary loan unavailable
72
                                                [% ELSIF ( messaging_preference.Ill_unavailable ) %]Interlibrary loan unavailable
72
                                                [% ELSIF ( messaging_preference.Auto_Renewals ) %]Auto renewals
73
                                                [% ELSE %]Unknown [% END %]</td>
73
                                                [% ELSE %]Unknown [% END %]</td>
74
                                            [% IF ( messaging_preference.takes_days ) %]
74
                                            [% IF ( messaging_preference.takes_days ) %]
75
                                                <td><select class="input-mini" name="[% messaging_preference.message_attribute_id | html %]-DAYS">
75
                                                <td><select class="input-mini" name="[% messaging_preference.message_attribute_id | html %]-DAYS">
(-)a/misc/cronjobs/automatic_renewals.pl (-5 / +9 lines)
Lines 98-105 GetOptions( Link Here
98
98
99
pod2usage(0) if $help;
99
pod2usage(0) if $help;
100
100
101
my $send_notices_pref = C4::Context->preference('AutoRenewalNotices')
101
my $send_notices_pref = C4::Context->preference('AutoRenewalNotices');
102
if ( $send_notices_pref = 'cron' ) {
102
if ( $send_notices_pref eq 'cron' ) {
103
    warn <<'END_WARN';
103
    warn <<'END_WARN';
104
104
105
The "AutoRenewalNotices" syspref is set to 'Follow the cron switch'.
105
The "AutoRenewalNotices" syspref is set to 'Follow the cron switch'.
Lines 144-149 while ( my $auto_renew = $auto_renews->next ) { Link Here
144
    $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $auto_renew->borrowernumber,
144
    $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $auto_renew->borrowernumber,
145
                                                                                   message_name   => 'auto_renewals' } ) if $send_notices_pref eq 'preferences';
145
                                                                                   message_name   => 'auto_renewals' } ) if $send_notices_pref eq 'preferences';
146
146
147
    $send_notices = 1 if !$send_notices && $send_notices_pref eq 'preferences' && $borrower_preferences && $borrower_preferences->{transports} && $borrower_preferences->{transports}->{email};
148
147
    # CanBookBeRenewed returns 'auto_renew' when the renewal should be done by this script
149
    # CanBookBeRenewed returns 'auto_renew' when the renewal should be done by this script
148
    my ( $ok, $error ) = CanBookBeRenewed( $auto_renew->borrowernumber, $auto_renew->itemnumber, undef, 1 );
150
    my ( $ok, $error ) = CanBookBeRenewed( $auto_renew->borrowernumber, $auto_renew->itemnumber, undef, 1 );
149
    if ( $error eq 'auto_renew' ) {
151
    if ( $error eq 'auto_renew' ) {
Lines 155-161 while ( my $auto_renew = $auto_renews->next ) { Link Here
155
            my $date_due = AddRenewal( $auto_renew->borrowernumber, $auto_renew->itemnumber, $auto_renew->branchcode, undef, undef, undef, 0 );
157
            my $date_due = AddRenewal( $auto_renew->borrowernumber, $auto_renew->itemnumber, $auto_renew->branchcode, undef, undef, undef, 0 );
156
            $auto_renew->auto_renew_error(undef)->store;
158
            $auto_renew->auto_renew_error(undef)->store;
157
        }
159
        }
158
        push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew unless $borrower_preferences && (!$borrower_preferences->{transports} || !$borrower_preferences->{transports}->{email} || $borrower_preferences->{'wants_digest'});
160
        push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew unless $send_notices_pref ne 'cron' && (!$borrower_preferences || !$borrower_preferences->{transports} || !$borrower_preferences->{transports}->{email} || $borrower_preferences->{'wants_digest'});
159
    } elsif ( $error eq 'too_many'
161
    } elsif ( $error eq 'too_many'
160
        or $error eq 'on_reserve'
162
        or $error eq 'on_reserve'
161
        or $error eq 'restriction'
163
        or $error eq 'restriction'
Lines 173-179 while ( my $auto_renew = $auto_renews->next ) { Link Here
173
        if ( not $auto_renew->auto_renew_error or $error ne $auto_renew->auto_renew_error ) {
175
        if ( not $auto_renew->auto_renew_error or $error ne $auto_renew->auto_renew_error ) {
174
            $auto_renew->auto_renew_error($error)->store if $confirm;
176
            $auto_renew->auto_renew_error($error)->store if $confirm;
175
            push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew
177
            push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew
176
              if $error ne 'auto_too_soon' && (!$borrower_preferences || ($borrower_preferences->{transports} && $borrower_preferences->{transports}->{email} && !$borrower_preferences->{'wants_digest'}));    # Do not notify if it's too soon
178
              if $error ne 'auto_too_soon' && ($send_notices_pref eq 'cron' || ($borrower_preferences && $borrower_preferences->{transports} && $borrower_preferences->{transports}->{email} && !$borrower_preferences->{'wants_digest'}));    # Do not notify if it's too soon
177
        }
179
        }
178
    }
180
    }
179
181
Lines 182-190 while ( my $auto_renew = $auto_renews->next ) { Link Here
182
        if ($digest_per_branch) {
184
        if ($digest_per_branch) {
183
            $renew_digest->{ $auto_renew->branchcode }->{ $auto_renew->borrowernumber }->{success}++ if $error eq 'auto_renew';
185
            $renew_digest->{ $auto_renew->branchcode }->{ $auto_renew->borrowernumber }->{success}++ if $error eq 'auto_renew';
184
            $renew_digest->{ $auto_renew->branchcode }->{ $auto_renew->borrowernumber }->{error}++ unless $error eq 'auto_renew' || $error == 'auto_too_soon' ;
186
            $renew_digest->{ $auto_renew->branchcode }->{ $auto_renew->borrowernumber }->{error}++ unless $error eq 'auto_renew' || $error == 'auto_too_soon' ;
187
            push @{$renew_digest->{ $auto_renew->branchcode }->{ $auto_renew->borrowernumber }->{issues}}, $auto_renew->itemnumber;
185
        } else {
188
        } else {
186
            $renew_digest->{ $auto_renew->borrowernumber }->{success} ++ if $error eq 'auto_renew';
189
            $renew_digest->{ $auto_renew->borrowernumber }->{success} ++ if $error eq 'auto_renew';
187
            $renew_digest->{ $auto_renew->borrowernumber }->{error}++ unless $error eq 'auto_renew' || $error eq 'auto_too_soon' ;
190
            $renew_digest->{ $auto_renew->borrowernumber }->{error}++ unless $error eq 'auto_renew' || $error eq 'auto_too_soon' ;
191
            push @{$renew_digest->{ $auto_renew->borrowernumber }->{issues}}, $auto_renew->itemnumber;
188
        }
192
        }
189
    }
193
    }
190
194
Lines 293-298 sub send_digests { Link Here
293
                    error => $digest->{error}||0,
297
                    error => $digest->{error}||0,
294
                    success => $digest->{success}||0,
298
                    success => $digest->{success}||0,
295
                },
299
                },
300
                loops => { issues => \@{$digest->{issues}} },
296
                tables      => {
301
                tables      => {
297
                    borrowers => $patron->borrowernumber,
302
                    borrowers => $patron->borrowernumber,
298
                },
303
                },
299
- 

Return to bug 18532