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

(-)a/Koha/Holds.pm (+34 lines)
Lines 92-97 sub forced_hold_level { Link Here
92
    return;
92
    return;
93
}
93
}
94
94
95
sub get_items_that_can_fill {
96
    my ( $self ) = @_;
97
98
    my @biblionumbers = $self->get_column('biblionumber');
99
100
    my @branchtransfers = map { $_->itemnumber }
101
      Koha::Item::Transfers->search(
102
          { datearrived => undef },
103
          {
104
              columns => ['itemnumber'],
105
              collapse => 1,
106
          }
107
      );
108
    my @waiting_holds = map { $_->itemnumber }
109
      Koha::Holds->search(
110
          { 'found' => 'W' },
111
          {
112
              columns => ['itemnumber'],
113
              collapse => 1,
114
          }
115
      );
116
117
    return Koha::Items->search(
118
        {
119
            biblionumber => { in => \@biblionumbers },
120
            itemlost     => 0,
121
            withdrawn    => 0,
122
            notforloan   => 0,
123
            onloan       => undef,
124
            itemnumber   => { -not_in => [ @branchtransfers, @waiting_holds ] },
125
        }
126
    );
127
}
128
95
=head3 type
129
=head3 type
96
130
97
=cut
131
=cut
(-)a/circ/pendingreserves.pl (-17 / +3 lines)
Lines 188-214 if ( C4::Context->preference('IndependentBranches') ){ Link Here
188
}
188
}
189
189
190
# get all distinct unfulfilled reserves
190
# get all distinct unfulfilled reserves
191
my @biblionumbers = Koha::Holds->search(
191
my $holds = Koha::Holds->search(
192
    { %where },
192
    { %where },
193
    { join => 'itembib', alias => 'reserve', distinct  => 1, columns => qw[me.biblionumber] }
193
    { join => 'itembib', alias => 'reserve', distinct  => 1, columns => qw[me.biblionumber] }
194
)->get_column('biblionumber');
195
196
my @branchtransfers = map { $_->itemnumber } Koha::Item::Transfers->search({ datearrived => undef }, { columns => [ 'itemnumber' ], collapse => 1 });
197
my @waiting_holds = map { $_->itemnumber } Koha::Holds->search({'found' => 'W'}, { columns => [ 'itemnumber' ], collapse => 1 });
198
199
my @all_items = Koha::Items->search(
200
    {
201
        biblionumber => { in => \@biblionumbers },
202
        itemlost     => 0,
203
        withdrawn    => 0,
204
        notforloan   => 0,
205
        onloan       => undef,
206
        itemnumber   => { -not_in => [ @branchtransfers, @waiting_holds ] },
207
    }
208
);
194
);
195
my @biblionumbers = $holds->get_column('biblionumber');
209
196
210
my $all_items;
197
my $all_items;
211
foreach my $item ( @all_items ) {
198
foreach my $item ( $holds->get_items_that_can_fill ) {
212
    push @{$all_items->{$item->biblionumber}}, $item;
199
    push @{$all_items->{$item->biblionumber}}, $item;
213
}
200
}
214
201
215
- 

Return to bug 27131