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

(-)a/Koha/Item.pm (-8 / +9 lines)
Lines 405-416 sub holds { Link Here
405
=head3 request_transfer
405
=head3 request_transfer
406
406
407
  my $transfer = $item->request_transfer(
407
  my $transfer = $item->request_transfer(
408
      { to => $to_library, reason => $reason, force => 0 } );
408
      { to => $to_library, reason => $reason, ignore_limits => 0 } );
409
409
410
Add a transfer request for this item to the given branch for the given reason.
410
Add a transfer request for this item to the given branch for the given reason.
411
411
412
An exception will be thrown if the BranchTransferLimits would prevent the requested
412
An exception will be thrown if the BranchTransferLimits would prevent the requested
413
transfer, unless 'force' is passed to override the limits.
413
transfer, unless 'ignore_limits' is passed to override the limits.
414
414
415
Note: At this time, only one active transfer (i.e pending arrival date) may exist
415
Note: At this time, only one active transfer (i.e pending arrival date) may exist
416
at a time for any given item. An exception will be thrown should you attempt to
416
at a time for any given item. An exception will be thrown should you attempt to
Lines 434-443 sub request_transfer { Link Here
434
    my $request;
434
    my $request;
435
    Koha::Exceptions::Item::Transfer::Found->throw( transfer => $request )
435
    Koha::Exceptions::Item::Transfer::Found->throw( transfer => $request )
436
      if ( $request = $self->get_transfer );
436
      if ( $request = $self->get_transfer );
437
    # FIXME: Add override functionality to allow for queing transfers
438
437
439
    Koha::Exceptions::Item::Transfer::Limit->throw()
438
    Koha::Exceptions::Item::Transfer::Limit->throw()
440
      unless ( $params->{force} || $self->can_be_transferred( { to => $params->{to} } ) );
439
      unless ( $params->{ignore_limits}
440
        || $self->can_be_transferred( { to => $params->{to} } ) );
441
441
442
    my $transfer = Koha::Item::Transfer->new(
442
    my $transfer = Koha::Item::Transfer->new(
443
        {
443
        {
Lines 458-466 sub request_transfer { Link Here
458
458
459
Return the active transfer request or undef
459
Return the active transfer request or undef
460
460
461
Note: Transfers are retrieved in a LIFO (Last In First Out) order using this method.
461
Note: Transfers are retrieved in a Modified FIFO (First In First Out) order
462
whereby the most recently sent, but not recieved, transfer will be returned
463
if it exists, otherwise the oldest unsatisfied transfer will be returned.
462
464
463
FIXME: Add Tests for LIFO functionality
465
FIXME: Add Tests for FIFO functionality
464
466
465
=cut
467
=cut
466
468
Lines 469-475 sub get_transfer { Link Here
469
    my $transfer_rs = $self->_result->branchtransfers->search(
471
    my $transfer_rs = $self->_result->branchtransfers->search(
470
        { datearrived => undef },
472
        { datearrived => undef },
471
        {
473
        {
472
            order_by => [ { -asc => 'datesent' }, { -asc => 'daterequested' } ],
474
            order_by => [ { -desc => 'datesent' }, { -asc => 'daterequested' } ],
473
            rows     => 1
475
            rows     => 1
474
        }
476
        }
475
    )->first;
477
    )->first;
476
- 

Return to bug 25755