|
Lines 153-159
while ( my $auto_renew = $auto_renews->next ) {
Link Here
|
| 153 |
print "examining item '" . $auto_renew->itemnumber . "' to auto renew\n" if $verbose; |
153 |
print "examining item '" . $auto_renew->itemnumber . "' to auto renew\n" if $verbose; |
| 154 |
|
154 |
|
| 155 |
my ( $borrower_preferences, $wants_messages, $wants_digest ) = ( undef, 0, 0 ); |
155 |
my ( $borrower_preferences, $wants_messages, $wants_digest ) = ( undef, 0, 0 ); |
| 156 |
if ( $send_notices_pref eq 'preferences' ){ |
156 |
if ( $send_notices_pref eq 'preferences' ) { |
| 157 |
$borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( |
157 |
$borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( |
| 158 |
{ |
158 |
{ |
| 159 |
borrowernumber => $auto_renew->borrowernumber, |
159 |
borrowernumber => $auto_renew->borrowernumber, |
|
Lines 166-178
while ( my $auto_renew = $auto_renews->next ) {
Link Here
|
| 166 |
$wants_digest = 1 |
166 |
$wants_digest = 1 |
| 167 |
if $wants_messages |
167 |
if $wants_messages |
| 168 |
&& $borrower_preferences->{wants_digest}; |
168 |
&& $borrower_preferences->{wants_digest}; |
| 169 |
} else { # Preference is never or cron |
169 |
} else { # Preference is never or cron |
| 170 |
$wants_messages = $send_notices; |
170 |
$wants_messages = $send_notices; |
| 171 |
$wants_digest = 0; |
171 |
$wants_digest = 0; |
| 172 |
} |
172 |
} |
| 173 |
|
173 |
|
| 174 |
my ( $success, $error, $updated ) = $auto_renew->attempt_auto_renew({ confirm => $confirm }); |
174 |
my ( $success, $error, $updated ) = $auto_renew->attempt_auto_renew( { confirm => $confirm } ); |
| 175 |
if ( $success ) { |
175 |
if ($success) { |
| 176 |
if ($verbose) { |
176 |
if ($verbose) { |
| 177 |
say sprintf "Issue id: %s for borrower: %s and item: %s %s be renewed.", |
177 |
say sprintf "Issue id: %s for borrower: %s and item: %s %s be renewed.", |
| 178 |
$auto_renew->issue_id, $auto_renew->borrowernumber, $auto_renew->itemnumber, |
178 |
$auto_renew->issue_id, $auto_renew->borrowernumber, $auto_renew->itemnumber, |
|
Lines 182-208
while ( my $auto_renew = $auto_renews->next ) {
Link Here
|
| 182 |
push @item_renewal_ids, $auto_renew->itemnumber; |
182 |
push @item_renewal_ids, $auto_renew->itemnumber; |
| 183 |
} |
183 |
} |
| 184 |
push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew |
184 |
push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew |
| 185 |
if ( $wants_messages ) && !$wants_digest; |
185 |
if ($wants_messages) && !$wants_digest; |
| 186 |
} elsif ( |
186 |
} elsif ( |
|
|
187 |
|
| 187 |
# FIXME Do we need to list every status? Why not simply else? |
188 |
# FIXME Do we need to list every status? Why not simply else? |
| 188 |
$error eq 'too_many' || |
189 |
$error eq 'too_many' |
| 189 |
$error eq 'on_reserve' || |
190 |
|| $error eq 'on_reserve' |
| 190 |
$error eq 'restriction' || |
191 |
|| $error eq 'restriction' |
| 191 |
$error eq 'overdue' || |
192 |
|| $error eq 'overdue' |
| 192 |
$error eq 'too_unseen' || |
193 |
|| $error eq 'too_unseen' |
| 193 |
$error eq 'auto_account_expired' || |
194 |
|| $error eq 'auto_account_expired' |
| 194 |
$error eq 'auto_too_late' || |
195 |
|| $error eq 'auto_too_late' |
| 195 |
$error eq 'auto_too_much_oweing' || |
196 |
|| $error eq 'auto_too_much_oweing' |
| 196 |
$error eq 'auto_too_soon' || |
197 |
|| $error eq 'auto_too_soon' |
| 197 |
$error eq 'item_denied_renewal' || |
198 |
|| $error eq 'item_denied_renewal' |
| 198 |
$error eq 'item_issued_to_other_patron' |
199 |
|| $error eq 'item_issued_to_other_patron' |
| 199 |
) { |
200 |
) |
| 200 |
if ( $verbose ) { |
201 |
{ |
|
|
202 |
if ($verbose) { |
| 201 |
say sprintf "Issue id: %s for borrower: %s and item: %s %s not be renewed. (%s)", |
203 |
say sprintf "Issue id: %s for borrower: %s and item: %s %s not be renewed. (%s)", |
| 202 |
$auto_renew->issue_id, $auto_renew->borrowernumber, $auto_renew->itemnumber, |
204 |
$auto_renew->issue_id, $auto_renew->borrowernumber, $auto_renew->itemnumber, |
| 203 |
$confirm ? 'will' : 'would', $error; |
205 |
$confirm ? 'will' : 'would', $error; |
| 204 |
} |
206 |
} |
| 205 |
if ( $updated ) { |
207 |
if ($updated) { |
| 206 |
push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew |
208 |
push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew |
| 207 |
if $error ne 'auto_too_soon' && ( $wants_messages && !$wants_digest ); # Do not notify if it's too soon |
209 |
if $error ne 'auto_too_soon' && ( $wants_messages && !$wants_digest ); # Do not notify if it's too soon |
| 208 |
} |
210 |
} |