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 / +9 lines)
Lines 46-52 use C4::Items; Link Here
46
use C4::Members;
46
use C4::Members;
47
use C4::Members::Messaging;
47
use C4::Members::Messaging;
48
use C4::Koha;   # FIXME : is it still useful ?
48
use C4::Koha;   # FIXME : is it still useful ?
49
use C4::RotatingCollections;
50
use Koha::AuthorisedValues;
49
use Koha::AuthorisedValues;
51
use Koha::DateUtils;
50
use Koha::DateUtils;
52
use Koha::Calendar;
51
use Koha::Calendar;
Lines 644-660 $template->param( Link Here
644
643
645
$itemnumber = GetItemnumberFromBarcode( $barcode );
644
$itemnumber = GetItemnumberFromBarcode( $barcode );
646
if ( $itemnumber ) {
645
if ( $itemnumber ) {
647
    my ( $holdingBranch, $collectionBranch ) = GetCollectionItemBranches( $itemnumber );
646
    my $item = Koha::Items->find( $itemnumber );
648
    if ( $holdingBranch and $collectionBranch ) {
647
    my $holdingBranch = $item->holdingbranch;
649
        $holdingBranch //= '';
648
    my $collectionBranch = $item->rotating_collection->colBranchcode;
650
        $collectionBranch //= $returnbranch;
649
    if ( $holdingBranch and $collectionBranch and ( $holdingBranch ne $collectionBranch ) ) {
651
        if ( ! ( $holdingBranch eq $collectionBranch ) ) {
650
        $template->param(
652
            $template->param(
651
          collectionItemNeedsTransferred => 1,
653
              collectionItemNeedsTransferred => 1,
652
          collectionBranch => $collectionBranch,
654
              collectionBranch => $collectionBranch,
653
          itemnumber => $itemnumber,
655
              itemnumber => $itemnumber,
654
        );
656
            );
657
        }
658
    }
655
    }
659
}
656
}
660
657
661
- 

Return to bug 18606