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, undef, 1 ); |
148 |
my ( $ok, $error ) = CanBookBeRenewed( $auto_renew->borrowernumber, $auto_renew->itemnumber, undef, 1 ); |
138 |
- |
|
|