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

(-)a/installer/data/mysql/atomicupdate/bug-18532.perl (-23 / +5 lines)
Lines 28-56 if( CheckVersion( $DBversion ) ) { Link Here
28
                (7, 'sms', 1, 'circulation', 'AUTO_RENEWALS_DGST')
28
                (7, 'sms', 1, 'circulation', 'AUTO_RENEWALS_DGST')
29
    });
29
    });
30
30
31
    $dbh->do( qq{
32
        insert ignore into borrower_message_preferences (categorycode, message_attribute_id, days_in_advance, wants_digest)
33
        select 	c.categorycode, 7, NULL, 1
34
        from    categories c
35
        left join
36
                borrower_message_preferences p
37
        on      c.categorycode = p.categorycode
38
                and p.message_attribute_id = 7
39
        where   p.categorycode is null
40
41
    });
42
43
    $dbh->do( qq{
44
        insert ignore into borrower_message_preferences (borrowernumber, message_attribute_id, days_in_advance, wants_digest)
45
        select 	b.borrowernumber, 7, NULL, 1
46
        from    borrowers b
47
        left join
48
                borrower_message_preferences p
49
        on      b.borrowernumber = p.borrowernumber
50
                and p.message_attribute_id = 7
51
        where   p.borrowernumber is null
52
    });
53
54
    $dbh->do( qq{
31
    $dbh->do( qq{
55
        insert into borrower_message_transport_preferences (borrower_message_preference_id, message_transport_type)
32
        insert into borrower_message_transport_preferences (borrower_message_preference_id, message_transport_type)
56
        select  p.borrower_message_preference_id, 'email'
33
        select  p.borrower_message_preference_id, 'email'
Lines 62-67 if( CheckVersion( $DBversion ) ) { Link Here
62
                and t.borrower_message_preference_id is null;
39
                and t.borrower_message_preference_id is null;
63
    });
40
    });
64
41
42
     $dbh->do(q{
43
         INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type)
44
         VALUES ('AutoRenewalNotices','cron','cron|preferences|never','How should Koha determine whether to end autorenewal notices','Choice')
45
     });
46
65
    # Always end with this (adjust the bug info)
47
    # Always end with this (adjust the bug info)
66
    SetVersion( $DBversion );
48
    SetVersion( $DBversion );
67
    print "Upgrade to $DBversion done (Bug 18532 - Add AUTO_RENEWALS in message_attributes and add AUTO_RENEWALS_DGST letter)\n";
49
    print "Upgrade to $DBversion done (Bug 18532 - Add AUTO_RENEWALS in message_attributes and add AUTO_RENEWALS_DGST letter)\n";
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 77-82 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
77
('AutomaticItemReturn','1',NULL,'If ON, Koha will automatically set up a transfer of this item to its homebranch','YesNo'),
77
('AutomaticItemReturn','1',NULL,'If ON, Koha will automatically set up a transfer of this item to its homebranch','YesNo'),
78
('autoMemberNum','0','','If ON, patron number is auto-calculated','YesNo'),
78
('autoMemberNum','0','','If ON, patron number is auto-calculated','YesNo'),
79
('AutoRemoveOverduesRestrictions','0',NULL,'Defines whether an OVERDUES debarment should be lifted automatically if all overdue items are returned by the patron.','YesNo'),
79
('AutoRemoveOverduesRestrictions','0',NULL,'Defines whether an OVERDUES debarment should be lifted automatically if all overdue items are returned by the patron.','YesNo'),
80
('AutoRenewalNotices','cron','cron|preferences|never','How should Koha determine whether to end autorenewal notices','Choice'),
80
('AutoResumeSuspendedHolds','1',NULL,'Allow suspended holds to be automatically resumed by a set date.','YesNo'),
81
('AutoResumeSuspendedHolds','1',NULL,'Allow suspended holds to be automatically resumed by a set date.','YesNo'),
81
('AutoReturnCheckedOutItems', '0', '', 'If disabled, librarian must confirm return of checked out item when checking out to another.', 'YesNo'),
82
('AutoReturnCheckedOutItems', '0', '', 'If disabled, librarian must confirm return of checked out item when checking out to another.', 'YesNo'),
82
('AutoSelfCheckAllowed','0','','For corporate and special libraries which want web-based self-check available from any PC without the need for a manual staff login. Most libraries will want to leave this turned off. If on, requires self-check ID and password to be entered in AutoSelfCheckID and AutoSelfCheckPass sysprefs.','YesNo'),
83
('AutoSelfCheckAllowed','0','','For corporate and special libraries which want web-based self-check available from any PC without the need for a manual staff login. Most libraries will want to leave this turned off. If on, requires self-check ID and password to be entered in AutoSelfCheckID and AutoSelfCheckPass sysprefs.','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (+8 lines)
Lines 168-173 Patrons: Link Here
168
               yes: Enable
168
               yes: Enable
169
               no: Disable
169
               no: Disable
170
         - Send purchase suggestion messages by SMS if no patron email is defined.
170
         - Send purchase suggestion messages by SMS if no patron email is defined.
171
     -
172
         - "Send automatic renewal notices "
173
         - pref: AutoRenewalNotices
174
           choices:
175
               never: never
176
               preferences: according to patron messaging preferences
177
               cron: (Deprecated) according to cron switch
178
171
    Patron forms:
179
    Patron forms:
172
     -
180
     -
173
         - "The following <a href='http://schema.koha-community.org/__VERSION__/tables/borrowers.html' target='blank'>database columns</a> must be filled in on the patron entry screen:"
181
         - "The following <a href='http://schema.koha-community.org/__VERSION__/tables/borrowers.html' target='blank'>database columns</a> must be filled in on the patron entry screen:"
(-)a/misc/cronjobs/automatic_renewals.pl (-13 / +23 lines)
Lines 2-8 Link Here
2
2
3
# This file is part of Koha.
3
# This file is part of Koha.
4
#
4
#
5
# Copyright (C) 2014 Hochschule f�r Gesundheit (hsg), Germany
5
# Copyright (C) 2014 Hochschule für Gesundheit (hsg), Germany
6
#
6
#
7
# Koha is free software; you can redistribute it and/or modify it
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
8
# under the terms of the GNU General Public License as published by
Lines 43-48 and the renewal isn't premature (No Renewal before) the issue is renewed. Link Here
43
43
44
=item B<-s|--send-notices>
44
=item B<-s|--send-notices>
45
45
46
DEPRECATED: The system preference AutoRenewalNotices should be used to determine
47
whether notices are sent or not
46
Send AUTO_RENEWALS notices to patrons if the auto renewal has been done.
48
Send AUTO_RENEWALS notices to patrons if the auto renewal has been done.
47
49
48
=item B<-v|--verbose>
50
=item B<-v|--verbose>
Lines 53-66 Print report to standard out. Link Here
53
55
54
Without this parameter no changes will be made
56
Without this parameter no changes will be made
55
57
56
=item B<-d|--digest>
57
58
Flag to indicate that this script should process digest messages.
59
60
=item B<-b|--digest-per-branch>
58
=item B<-b|--digest-per-branch>
61
59
62
Flag to indicate that generation of message digests should be
60
Flag to indicate that generation of message digests should be
63
performed separately for each branch. Needs --digest option.
61
performed separately for each branch.
64
62
65
A patron could potentially have loans at several different branches
63
A patron could potentially have loans at several different branches
66
There is no natural branch to set as the sender on the aggregated
64
There is no natural branch to set as the sender on the aggregated
Lines 89-106 use Koha::Checkouts; Link Here
89
use Koha::Libraries;
87
use Koha::Libraries;
90
use Koha::Patrons;
88
use Koha::Patrons;
91
89
92
my ( $help, $send_notices, $verbose, $confirm, $digest, $digest_per_branch );
90
my ( $help, $send_notices, $verbose, $confirm, $digest_per_branch );
93
GetOptions(
91
GetOptions(
94
    'h|help' => \$help,
92
    'h|help' => \$help,
95
    's|send-notices' => \$send_notices,
93
    's|send-notices' => \$send_notices,
96
    'v|verbose'    => \$verbose,
94
    'v|verbose'    => \$verbose,
97
    'c|confirm'     => \$confirm,
95
    'c|confirm'     => \$confirm,
98
    'd|digest|' => \$digest,
99
    'b|digest-per-branch' => \$digest_per_branch,
96
    'b|digest-per-branch' => \$digest_per_branch,
100
) || pod2usage(1);
97
) || pod2usage(1);
101
98
102
pod2usage(0) if $help;
99
pod2usage(0) if $help;
103
100
101
my $send_notices_pref = C4::Context->preference('AutoRenewalNotices')
102
if ( $send_notices_pref = 'cron' ) {
103
    warn <<'END_WARN';
104
105
The "AutoRenewalNotices" syspref is set to 'Follow the cron switch'.
106
The send_notices switch for this script is deprecated, you should either set the preference
107
to 'Never send emails' or 'Follow patron messaging preferences'
108
109
END_WARN
110
} else {
111
    # If not following cron then we should not send if set to never
112
    # and always send any generated according to preferences if following those
113
    $send_notices = $send_notices_pref eq 'never' ? 0 : 1;
114
}
115
104
# Since advance notice options are not visible in the web-interface
116
# Since advance notice options are not visible in the web-interface
105
# unless EnhancedMessagingPreferences is on, let the user know that
117
# unless EnhancedMessagingPreferences is on, let the user know that
106
# this script probably isn't going to do much
118
# this script probably isn't going to do much
Lines 128-137 my %report; Link Here
128
while ( my $auto_renew = $auto_renews->next ) {
140
while ( my $auto_renew = $auto_renews->next ) {
129
    print "examining item '" . $auto_renew->itemnumber . "' to auto renew\n" if $verbose;
141
    print "examining item '" . $auto_renew->itemnumber . "' to auto renew\n" if $verbose;
130
142
131
    my $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $auto_renew->borrowernumber,
143
    my $borrower_preferences;
132
                                                                                   message_name   => 'auto_renewals' } );
144
    $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $auto_renew->borrowernumber,
133
145
                                                                                   message_name   => 'auto_renewals' } ) if $send_notices_pref eq 'preferences';
134
    next if !$digest && $borrower_preferences && $borrower_preferences->{'wants_digest'};
135
146
136
    # CanBookBeRenewed returns 'auto_renew' when the renewal should be done by this script
147
    # CanBookBeRenewed returns 'auto_renew' when the renewal should be done by this script
137
    my ( $ok, $error ) = CanBookBeRenewed( $auto_renew->borrowernumber, $auto_renew->itemnumber );
148
    my ( $ok, $error ) = CanBookBeRenewed( $auto_renew->borrowernumber, $auto_renew->itemnumber );
138
- 

Return to bug 18532