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

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 36-42 use C4::Message; Link Here
36
use C4::Debug;
36
use C4::Debug;
37
use C4::Log; # logaction
37
use C4::Log; # logaction
38
use C4::Overdues qw(CalcFine UpdateFine get_chargeable_units);
38
use C4::Overdues qw(CalcFine UpdateFine get_chargeable_units);
39
use C4::RotatingCollections qw(GetCollectionItemBranches);
39
use C4::RotatingCollections;
40
use Algorithm::CheckDigits;
40
use Algorithm::CheckDigits;
41
41
42
use Data::Dumper;
42
use Data::Dumper;
(-)a/C4/RotatingCollections.pm (-31 lines)
Lines 51-58 BEGIN { Link Here
51
      AddItemToCollection
51
      AddItemToCollection
52
      RemoveItemFromCollection
52
      RemoveItemFromCollection
53
      TransferCollection
53
      TransferCollection
54
55
      GetCollectionItemBranches
56
    );
54
    );
57
}
55
}
58
56
Lines 204-238 sub TransferCollection { Link Here
204
202
205
}
203
}
206
204
207
=head2 GetCollectionItemBranches
208
209
  my ( $holdingBranch, $collectionBranch ) = GetCollectionItemBranches( $itemnumber );
210
211
=cut
212
213
sub GetCollectionItemBranches {
214
    my ($itemnumber) = @_;
215
216
    if ( !$itemnumber ) {
217
        return;
218
    }
219
220
    my $dbh = C4::Context->dbh;
221
222
    my ( $sth, @results );
223
    $sth = $dbh->prepare(
224
"SELECT holdingbranch, colBranchcode FROM items, collections, collections_tracking
225
                        WHERE items.itemnumber = collections_tracking.itemnumber
226
                        AND collections.colId = collections_tracking.colId
227
                        AND items.itemnumber = ?"
228
    );
229
    $sth->execute($itemnumber);
230
231
    my $row = $sth->fetchrow_hashref;
232
233
    return ( $$row{'holdingbranch'}, $$row{'colBranchcode'}, );
234
}
235
236
=head2 isItemInThisCollection
205
=head2 isItemInThisCollection
237
206
238
  $inCollection = isItemInThisCollection( $itemnumber, $colId );
207
  $inCollection = isItemInThisCollection( $itemnumber, $colId );
(-)a/Koha/Item.pm (+19 lines)
Lines 31-36 use Koha::Item::Transfer::Limits; Link Here
31
use Koha::Item::Transfers;
31
use Koha::Item::Transfers;
32
use Koha::Patrons;
32
use Koha::Patrons;
33
use Koha::Libraries;
33
use Koha::Libraries;
34
use Koha::RotatingCollections;
34
35
35
use base qw(Koha::Object);
36
use base qw(Koha::Object);
36
37
Lines 282-287 sub current_holds { Link Here
282
    return Koha::Holds->_new_from_dbic($hold_rs);
283
    return Koha::Holds->_new_from_dbic($hold_rs);
283
}
284
}
284
285
286
=head3 rotating_collection
287
288
=cut
289
290
sub rotating_collection {
291
    my ( $self ) = @_;
292
    my $collection = Koha::RotatingCollections->search(
293
        {
294
            'collections_trackings.itemnumber' => $self->itemnumber
295
        },
296
        {
297
            join => [ 'collections_trackings' ]
298
        }
299
    );
300
301
    return $collection->single;
302
}
303
285
=head3 type
304
=head3 type
286
305
287
=cut
306
=cut
(-)a/circ/returns.pl (-3 / +4 lines)
Lines 44-50 use C4::Items; Link Here
44
use C4::Members;
44
use C4::Members;
45
use C4::Members::Messaging;
45
use C4::Members::Messaging;
46
use C4::Koha;   # FIXME : is it still useful ?
46
use C4::Koha;   # FIXME : is it still useful ?
47
use C4::RotatingCollections;
48
use Koha::AuthorisedValues;
47
use Koha::AuthorisedValues;
49
use Koha::DateUtils;
48
use Koha::DateUtils;
50
use Koha::Calendar;
49
use Koha::Calendar;
Lines 625-631 $template->param( Link Here
625
my $item_from_barcode = Koha::Items->find({barcode => $barcode }); # How many times do we fetch this item?!?
624
my $item_from_barcode = Koha::Items->find({barcode => $barcode }); # How many times do we fetch this item?!?
626
if ( $item_from_barcode ) {
625
if ( $item_from_barcode ) {
627
    $itemnumber = $item_from_barcode->itemnumber;
626
    $itemnumber = $item_from_barcode->itemnumber;
628
    my ( $holdingBranch, $collectionBranch ) = GetCollectionItemBranches( $itemnumber );
627
    my $holdingBranch = $item_from_barcode->holdingbranch;
628
    my $collection = $item_from_barcode->rotating_collection;
629
    my $collectionBranch;
630
    $collectionBranch = $collection->colBranchcode if $collection;
629
    if ( $holdingBranch and $collectionBranch ) {
631
    if ( $holdingBranch and $collectionBranch ) {
630
        $holdingBranch //= '';
632
        $holdingBranch //= '';
631
        $collectionBranch //= $returnbranch;
633
        $collectionBranch //= $returnbranch;
632
- 

Return to bug 18606