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

(-)a/C4/Reserves.pm (-1 / +1 lines)
Lines 399-405 sub CanBookBeReserved { Link Here
399
                ]
399
                ]
400
            },
400
            },
401
            { join => ['item'] }
401
            { join => ['item'] }
402
        )->count;
402
        );
403
403
404
        return { status => '' }
404
        return { status => '' }
405
            if defined $reservesallowed and $reservesallowed < $count + 1;
405
            if defined $reservesallowed and $reservesallowed < $count + 1;
(-)a/Koha/Holds.pm (-5 / +6 lines)
Lines 217-229 Return the number of holds, where a hold group is counted as one hold. Link Here
217
=cut
217
=cut
218
218
219
sub count_holds {
219
sub count_holds {
220
    my ( $self, $search_params ) = @_;
220
    my ( $self, $search_params, $search_attrs ) = @_;
221
    $search_params = {} if !$search_params;
221
    $search_params                  = {} if !$search_params;
222
    $search_attrs                   = {} if !$search_attrs;
222
    $search_params->{hold_group_id} = undef;
223
    $search_params->{hold_group_id} = undef;
223
    my $holds_without_group_count = $self->search($search_params)->count();
224
    my $holds_without_group_count = $self->search( $search_params, $search_attrs )->count();
224
225
225
    $search_params->{hold_group_id} = { '!=', undef };
226
    $search_params->{hold_group_id} = { '!=', undef };
226
    my $hold_groups_count = $self->search( $search_params, { group_by => 'me.hold_group_id' } )->count();
227
    $search_attrs->{group_by}       = 'me.hold_group_id';
228
    my $hold_groups_count = $self->search( $search_params, $search_attrs )->count();
227
    return $holds_without_group_count + $hold_groups_count;
229
    return $holds_without_group_count + $hold_groups_count;
228
}
230
}
229
231
230
- 

Return to bug 15516