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 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 594-610 $template->param( Link Here
594
593
595
$itemnumber = GetItemnumberFromBarcode( $barcode );
594
$itemnumber = GetItemnumberFromBarcode( $barcode );
596
if ( $itemnumber ) {
595
if ( $itemnumber ) {
597
    my ( $holdingBranch, $collectionBranch ) = GetCollectionItemBranches( $itemnumber );
596
    my $item = Koha::Items->find( $itemnumber );
598
    if ( $holdingBranch and $collectionBranch ) {
597
    my $holdingBranch = $item->holdingbranch;
599
        $holdingBranch //= '';
598
    my $collection = $item->rotating_collection;
600
        $collectionBranch //= $returnbranch;
599
    my $collectionBranch;
601
        if ( ! ( $holdingBranch eq $collectionBranch ) ) {
600
    $collectionBranch = $collection->colBranchcode if $collection;
602
            $template->param(
601
    if ( $holdingBranch and $collectionBranch and ( $holdingBranch ne $collectionBranch ) ) {
603
              collectionItemNeedsTransferred => 1,
602
        $template->param(
604
              collectionBranch => $collectionBranch,
603
          collectionItemNeedsTransferred => 1,
605
              itemnumber => $itemnumber,
604
          collectionBranch => $collectionBranch,
606
            );
605
          itemnumber => $itemnumber,
607
        }
606
        );
608
    }
607
    }
609
}
608
}
610
609
611
- 

Return to bug 18606