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

(-)a/C4/Circulation.pm (-4 / +11 lines)
Lines 3083-3088 fallback to a true value Link Here
3083
3083
3084
C<$automatic> is a boolean flag indicating the renewal was triggered automatically and not by a person ( librarian or patron )
3084
C<$automatic> is a boolean flag indicating the renewal was triggered automatically and not by a person ( librarian or patron )
3085
3085
3086
C<$skip_record_index> is an optional boolean flag to indicate whether queuing the search indexing
3087
should be skipped for this renewal.
3088
3086
=cut
3089
=cut
3087
3090
3088
sub AddRenewal {
3091
sub AddRenewal {
Lines 3094-3099 sub AddRenewal { Link Here
3094
    my $skipfinecalc    = shift;
3097
    my $skipfinecalc    = shift;
3095
    my $seen            = shift;
3098
    my $seen            = shift;
3096
    my $automatic       = shift;
3099
    my $automatic       = shift;
3100
    my $skip_record_index = shift;
3097
3101
3098
    # Fallback on a 'seen' renewal
3102
    # Fallback on a 'seen' renewal
3099
    $seen = defined $seen && $seen == 0 ? 0 : 1;
3103
    $seen = defined $seen && $seen == 0 ? 0 : 1;
Lines 3188-3194 sub AddRenewal { Link Here
3188
        $renews = ( $item_object->renewals || 0 ) + 1;
3192
        $renews = ( $item_object->renewals || 0 ) + 1;
3189
        $item_object->renewals($renews);
3193
        $item_object->renewals($renews);
3190
        $item_object->onloan($datedue);
3194
        $item_object->onloan($datedue);
3191
        # Don't index as we are in a transaction
3195
        # Don't index as we are in a transaction, skip hardcoded here
3192
        $item_object->store({ log_action => 0, skip_record_index => 1 });
3196
        $item_object->store({ log_action => 0, skip_record_index => 1 });
3193
3197
3194
        # Charge a new rental fee, if applicable
3198
        # Charge a new rental fee, if applicable
Lines 3274-3282 sub AddRenewal { Link Here
3274
            }
3278
            }
3275
        });
3279
        });
3276
    });
3280
    });
3277
    # We index now, after the transaction is committed
3281
3278
    my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX });
3282
    unless( $skip_record_index ){
3279
    $indexer->index_records( $item_object->biblionumber, "specialUpdate", "biblioserver" );
3283
        # We index now, after the transaction is committed
3284
        my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX });
3285
        $indexer->index_records( $item_object->biblionumber, "specialUpdate", "biblioserver" );
3286
    }
3280
3287
3281
    return $datedue;
3288
    return $datedue;
3282
}
3289
}
(-)a/misc/cronjobs/automatic_renewals.pl (-1 / +7 lines)
Lines 148-153 print "found " . $auto_renews->count . " auto renewals\n" if $verbose; Link Here
148
148
149
my $renew_digest = {};
149
my $renew_digest = {};
150
my %report;
150
my %report;
151
my @item_renewal_ids;
151
while ( my $auto_renew = $auto_renews->next ) {
152
while ( my $auto_renew = $auto_renews->next ) {
152
    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;
153
154
Lines 181-186 while ( my $auto_renew = $auto_renews->next ) { Link Here
181
        }
182
        }
182
        if ($confirm){
183
        if ($confirm){
183
            my $date_due = AddRenewal( $auto_renew->borrowernumber, $auto_renew->itemnumber, $auto_renew->branchcode, undef, undef, undef, 0, 1 );
184
            my $date_due = AddRenewal( $auto_renew->borrowernumber, $auto_renew->itemnumber, $auto_renew->branchcode, undef, undef, undef, 0, 1 );
185
            push @item_renewal_ids, $auto_renew->itemnumber;
184
            $auto_renew->auto_renew_error(undef)->store;
186
            $auto_renew->auto_renew_error(undef)->store;
185
        }
187
        }
186
        push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew
188
        push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew
Lines 226-231 while ( my $auto_renew = $auto_renews->next ) { Link Here
226
228
227
}
229
}
228
230
231
if( @item_renewal_ids ){
232
    my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX });
233
    $indexer->index_records( \@item_renewal_ids, "specialUpdate", "biblioserver" );
234
}
235
229
if ( $send_notices && $confirm ) {
236
if ( $send_notices && $confirm ) {
230
    for my $borrowernumber ( keys %report ) {
237
    for my $borrowernumber ( keys %report ) {
231
        my $patron = Koha::Patrons->find($borrowernumber);
238
        my $patron = Koha::Patrons->find($borrowernumber);
232
- 

Return to bug 32013