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

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 35-41 use C4::Message; Link Here
35
use C4::Debug;
35
use C4::Debug;
36
use C4::Log; # logaction
36
use C4::Log; # logaction
37
use C4::Overdues qw(CalcFine UpdateFine get_chargeable_units);
37
use C4::Overdues qw(CalcFine UpdateFine get_chargeable_units);
38
use C4::RotatingCollections qw(GetCollectionItemBranches);
38
use C4::RotatingCollections;
39
use Algorithm::CheckDigits;
39
use Algorithm::CheckDigits;
40
40
41
use Data::Dumper;
41
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 30-35 use Koha::IssuingRules; Link Here
30
use Koha::Item::Transfer;
30
use Koha::Item::Transfer;
31
use Koha::Patrons;
31
use Koha::Patrons;
32
use Koha::Libraries;
32
use Koha::Libraries;
33
use Koha::RotatingCollections;
33
34
34
use base qw(Koha::Object);
35
use base qw(Koha::Object);
35
36
Lines 235-240 sub current_holds { Link Here
235
    return Koha::Holds->_new_from_dbic($hold_rs);
236
    return Koha::Holds->_new_from_dbic($hold_rs);
236
}
237
}
237
238
239
=head3 rotating_collection
240
241
=cut
242
243
sub rotating_collection {
244
    my ( $self ) = @_;
245
    my $collection = Koha::RotatingCollections->search(
246
        {
247
            'collections_trackings.itemnumber' => $self->itemnumber
248
        },
249
        {
250
            join => [ 'collections_trackings' ]
251
        }
252
    );
253
254
    return $collection->single;
255
}
256
238
=head3 type
257
=head3 type
239
258
240
=cut
259
=cut
(-)a/circ/returns.pl (-13 / +11 lines)
Lines 45-51 use C4::Items; Link Here
45
use C4::Members;
45
use C4::Members;
46
use C4::Members::Messaging;
46
use C4::Members::Messaging;
47
use C4::Koha;   # FIXME : is it still useful ?
47
use C4::Koha;   # FIXME : is it still useful ?
48
use C4::RotatingCollections;
49
use Koha::AuthorisedValues;
48
use Koha::AuthorisedValues;
50
use Koha::DateUtils;
49
use Koha::DateUtils;
51
use Koha::Calendar;
50
use Koha::Calendar;
Lines 645-661 $template->param( Link Here
645
644
646
$itemnumber = GetItemnumberFromBarcode( $barcode );
645
$itemnumber = GetItemnumberFromBarcode( $barcode );
647
if ( $itemnumber ) {
646
if ( $itemnumber ) {
648
    my ( $holdingBranch, $collectionBranch ) = GetCollectionItemBranches( $itemnumber );
647
    my $item = Koha::Items->find( $itemnumber );
649
    if ( $holdingBranch and $collectionBranch ) {
648
    my $holdingBranch = $item->holdingbranch;
650
        $holdingBranch //= '';
649
    my $collection = $item->rotating_collection;
651
        $collectionBranch //= $returnbranch;
650
    my $collectionBranch;
652
        if ( ! ( $holdingBranch eq $collectionBranch ) ) {
651
    $collectionBranch = $collection->colBranchcode if $collection;
653
            $template->param(
652
    if ( $holdingBranch and $collectionBranch and ( $holdingBranch ne $collectionBranch ) ) {
654
              collectionItemNeedsTransferred => 1,
653
        $template->param(
655
              collectionBranch => $collectionBranch,
654
          collectionItemNeedsTransferred => 1,
656
              itemnumber => $itemnumber,
655
          collectionBranch => $collectionBranch,
657
            );
656
          itemnumber => $itemnumber,
658
        }
657
        );
659
    }
658
    }
660
}
659
}
661
660
662
- 

Return to bug 18606