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

(-)a/C4/Biblio.pm (-3 / +8 lines)
Lines 344-349 Unless C<disable_autolink> is passed ModBiblio will relink record headings Link Here
344
to authorities based on settings in the system preferences. This flag allows
344
to authorities based on settings in the system preferences. This flag allows
345
us to not relink records when the authority linker is saving modifications.
345
us to not relink records when the authority linker is saving modifications.
346
346
347
=item C<skip_holds_queue>
348
349
Unless C<skip_holds_queue> is passed, ModBiblio will trigger the BatchUpdateBiblioHoldsQueue
350
task to rebuild the holds queue for the biblio.
351
347
=back
352
=back
348
353
349
Returns 1 on success 0 on failure
354
Returns 1 on success 0 on failure
Lines 433-439 sub ModBiblio { Link Here
433
        {
438
        {
434
            biblio_ids => [ $biblionumber ]
439
            biblio_ids => [ $biblionumber ]
435
        }
440
        }
436
    );
441
    ) unless $options->{skip_holds_queue};
437
442
438
    return 1;
443
    return 1;
439
}
444
}
Lines 3082-3088 Update the total issue count for a particular bib record. Link Here
3082
=cut
3087
=cut
3083
3088
3084
sub UpdateTotalIssues {
3089
sub UpdateTotalIssues {
3085
    my ($biblionumber, $increase, $value) = @_;
3090
    my ($biblionumber, $increase, $value, $skip_holds_queue) = @_;
3086
    my $totalissues;
3091
    my $totalissues;
3087
3092
3088
    my $record = GetMarcBiblio({ biblionumber => $biblionumber });
3093
    my $record = GetMarcBiblio({ biblionumber => $biblionumber });
Lines 3116-3122 sub UpdateTotalIssues { Link Here
3116
         $record->insert_grouped_field($field);
3121
         $record->insert_grouped_field($field);
3117
     }
3122
     }
3118
3123
3119
     return ModBiblio($record, $biblionumber, $biblio->frameworkcode);
3124
     return ModBiblio($record, $biblionumber, $biblio->frameworkcode, { skip_holds_queue => $skip_holds_queue });
3120
}
3125
}
3121
3126
3122
=head2 RemoveAllNsb
3127
=head2 RemoveAllNsb
(-)a/C4/Circulation.pm (-11 / +16 lines)
Lines 1671-1677 sub AddIssue { Link Here
1671
            }
1671
            }
1672
1672
1673
            if ( C4::Context->preference('UpdateTotalIssuesOnCirc') ) {
1673
            if ( C4::Context->preference('UpdateTotalIssuesOnCirc') ) {
1674
                UpdateTotalIssues( $item_object->biblionumber, 1 );
1674
                UpdateTotalIssues( $item_object->biblionumber, 1, undef, { skip_holds_queue => 1 } );
1675
            }
1675
            }
1676
1676
1677
            # Record if item was lost
1677
            # Record if item was lost
Lines 1683-1689 sub AddIssue { Link Here
1683
            $item_object->onloan($datedue->ymd());
1683
            $item_object->onloan($datedue->ymd());
1684
            $item_object->datelastborrowed( dt_from_string()->ymd() );
1684
            $item_object->datelastborrowed( dt_from_string()->ymd() );
1685
            $item_object->datelastseen( dt_from_string()->ymd() );
1685
            $item_object->datelastseen( dt_from_string()->ymd() );
1686
            $item_object->store({log_action => 0});
1686
            $item_object->store( { log_action => 0, skip_holds_queue => 1 } );
1687
1687
1688
            # If the item was lost, it has now been found, charge the overdue if necessary
1688
            # If the item was lost, it has now been found, charge the overdue if necessary
1689
            if ($was_lost) {
1689
            if ($was_lost) {
Lines 2077-2083 sub AddReturn { Link Here
2077
                . Dumper($issue->unblessed) . "\n";
2077
                . Dumper($issue->unblessed) . "\n";
2078
    } else {
2078
    } else {
2079
        $messages->{'NotIssued'} = $barcode;
2079
        $messages->{'NotIssued'} = $barcode;
2080
        $item->onloan(undef)->store({skip_record_index=>1}) if defined $item->onloan;
2080
        $item->onloan(undef)->store( { skip_record_index => 1, skip_holds_queue => 1 } ) if defined $item->onloan;
2081
2081
2082
        # even though item is not on loan, it may still be transferred;  therefore, get current branch info
2082
        # even though item is not on loan, it may still be transferred;  therefore, get current branch info
2083
        $doreturn = 0;
2083
        $doreturn = 0;
Lines 2110-2116 sub AddReturn { Link Here
2110
                (!defined $item->location && $update_loc_rules->{_ALL_} ne "")
2110
                (!defined $item->location && $update_loc_rules->{_ALL_} ne "")
2111
               ) {
2111
               ) {
2112
                $messages->{'ItemLocationUpdated'} = { from => $item->location, to => $update_loc_rules->{_ALL_} };
2112
                $messages->{'ItemLocationUpdated'} = { from => $item->location, to => $update_loc_rules->{_ALL_} };
2113
                $item->location($update_loc_rules->{_ALL_})->store({skip_record_index=>1});
2113
                $item->location($update_loc_rules->{_ALL_})->store({ skip_record_index => 1, skip_holds_queue => 1});
2114
            }
2114
            }
2115
        }
2115
        }
2116
        else {
2116
        else {
Lines 2119-2125 sub AddReturn { Link Here
2119
                if ( $update_loc_rules->{$key} eq '_BLANK_') { $update_loc_rules->{$key} = '' ;}
2119
                if ( $update_loc_rules->{$key} eq '_BLANK_') { $update_loc_rules->{$key} = '' ;}
2120
                if ( ($item->location eq $key && $item->location ne $update_loc_rules->{$key}) || ($key eq '_BLANK_' && $item->location eq '' && $update_loc_rules->{$key} ne '') ) {
2120
                if ( ($item->location eq $key && $item->location ne $update_loc_rules->{$key}) || ($key eq '_BLANK_' && $item->location eq '' && $update_loc_rules->{$key} ne '') ) {
2121
                    $messages->{'ItemLocationUpdated'} = { from => $item->location, to => $update_loc_rules->{$key} };
2121
                    $messages->{'ItemLocationUpdated'} = { from => $item->location, to => $update_loc_rules->{$key} };
2122
                    $item->location($update_loc_rules->{$key})->store({skip_record_index=>1});
2122
                    $item->location($update_loc_rules->{$key})->store({ skip_record_index => 1, skip_holds_queue => 1});
2123
                    last;
2123
                    last;
2124
                }
2124
                }
2125
            }
2125
            }
Lines 2138-2144 sub AddReturn { Link Here
2138
            foreach my $key ( keys %$rules ) {
2138
            foreach my $key ( keys %$rules ) {
2139
                if ( $item->notforloan eq $key ) {
2139
                if ( $item->notforloan eq $key ) {
2140
                    $messages->{'NotForLoanStatusUpdated'} = { from => $item->notforloan, to => $rules->{$key} };
2140
                    $messages->{'NotForLoanStatusUpdated'} = { from => $item->notforloan, to => $rules->{$key} };
2141
                    $item->notforloan($rules->{$key})->store({ log_action => 0, skip_record_index => 1 });
2141
                    $item->notforloan($rules->{$key})->store({ log_action => 0, skip_record_index => 1, skip_holds_queue => 1 });
2142
                    last;
2142
                    last;
2143
                }
2143
                }
2144
            }
2144
            }
Lines 2174-2180 sub AddReturn { Link Here
2174
2174
2175
        if ($patron) {
2175
        if ($patron) {
2176
            eval {
2176
            eval {
2177
                MarkIssueReturned( $borrowernumber, $item->itemnumber, $return_date, $patron->privacy, { skip_record_index => 1} );
2177
                MarkIssueReturned( $borrowernumber, $item->itemnumber, $return_date, $patron->privacy, { skip_record_index => 1, skip_holds_queue => 1} );
2178
            };
2178
            };
2179
            unless ( $@ ) {
2179
            unless ( $@ ) {
2180
                if (
2180
                if (
Lines 2200-2218 sub AddReturn { Link Here
2200
            $messages->{'WasReturned'} = 1;
2200
            $messages->{'WasReturned'} = 1;
2201
2201
2202
        } else {
2202
        } else {
2203
            $item->onloan(undef)->store({ log_action => 0 , skip_record_index => 1 });
2203
            $item->onloan(undef)->store({ log_action => 0 , skip_record_index => 1, skip_holds_queue => 1 });
2204
        }
2204
        }
2205
    }
2205
    }
2206
2206
2207
    # the holdingbranch is updated if the document is returned to another location.
2207
    # the holdingbranch is updated if the document is returned to another location.
2208
    # this is always done regardless of whether the item was on loan or not
2208
    # this is always done regardless of whether the item was on loan or not
2209
    if ($item->holdingbranch ne $branch) {
2209
    if ($item->holdingbranch ne $branch) {
2210
        $item->holdingbranch($branch)->store({ skip_record_index => 1 });
2210
        $item->holdingbranch($branch)->store({ skip_record_index => 1, skip_holds_queue => 1 });
2211
    }
2211
    }
2212
2212
2213
    my $item_was_lost = $item->itemlost;
2213
    my $item_was_lost = $item->itemlost;
2214
    my $leave_item_lost = C4::Context->preference("BlockReturnOfLostItems") ? 1 : 0;
2214
    my $leave_item_lost = C4::Context->preference("BlockReturnOfLostItems") ? 1 : 0;
2215
    my $updated_item = ModDateLastSeen( $item->itemnumber, $leave_item_lost, { skip_record_index => 1 } ); # will unset itemlost if needed
2215
    my $updated_item = ModDateLastSeen( $item->itemnumber, $leave_item_lost, { skip_record_index => 1, skip_holds_queue => 1 } ); # will unset itemlost if needed
2216
2216
2217
    # fix up the accounts.....
2217
    # fix up the accounts.....
2218
    if ($item_was_lost) {
2218
    if ($item_was_lost) {
Lines 2509-2515 sub MarkIssueReturned { Link Here
2509
        # And finally delete the issue
2509
        # And finally delete the issue
2510
        $issue->delete;
2510
        $issue->delete;
2511
2511
2512
        $issue->item->onloan(undef)->store({ log_action => 0, skip_record_index => $params->{skip_record_index} });
2512
        $issue->item->onloan(undef)->store(
2513
            {   log_action        => 0,
2514
                skip_record_index => $params->{skip_record_index},
2515
                skip_holds_queue  => $params->{skip_holds_queue}
2516
            }
2517
        );
2513
2518
2514
        if ( C4::Context->preference('StoreLastBorrower') ) {
2519
        if ( C4::Context->preference('StoreLastBorrower') ) {
2515
            my $item = Koha::Items->find( $itemnumber );
2520
            my $item = Koha::Items->find( $itemnumber );
(-)a/C4/Items.pm (-1 / +1 lines)
Lines 400-406 sub ModDateLastSeen { Link Here
400
    my $item = Koha::Items->find($itemnumber);
400
    my $item = Koha::Items->find($itemnumber);
401
    $item->datelastseen($today);
401
    $item->datelastseen($today);
402
    $item->itemlost(0) unless $leave_item_lost;
402
    $item->itemlost(0) unless $leave_item_lost;
403
    $item->store({ log_action => 0, skip_record_index => $params->{skip_record_index} });
403
    $item->store({ log_action => 0, skip_record_index => $params->{skip_record_index}, skip_holds_queue => $params->{skip_holds_queue} });
404
}
404
}
405
405
406
=head2 CheckItemPreSave
406
=head2 CheckItemPreSave
(-)a/Koha/Item.pm (-2 / +1 lines)
Lines 217-223 sub store { Link Here
217
        {
217
        {
218
            biblio_ids => [ $self->biblionumber ]
218
            biblio_ids => [ $self->biblionumber ]
219
        }
219
        }
220
    );
220
    ) unless $params->{skip_holds_queue};
221
221
222
    return $result;
222
    return $result;
223
}
223
}
224
- 

Return to bug 29346