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

(-)a/Koha/Hold.pm (+7 lines)
Lines 497-504 Cancel a hold: Link Here
497
497
498
sub cancel {
498
sub cancel {
499
    my ( $self, $params ) = @_;
499
    my ( $self, $params ) = @_;
500
500
    $self->_result->result_source->schema->txn_do(
501
    $self->_result->result_source->schema->txn_do(
501
        sub {
502
        sub {
503
            if ( $self->is_in_transit ) {
504
                my $transfer = $self->item->get_transfer;
505
                if ( $transfer->in_transit ) {
506
                    $transfer->cancel({ reason => 'CancelReserve', force => 1 });
507
                }
508
            }
502
            $self->cancellationdate( dt_from_string->strftime( '%Y-%m-%d %H:%M:%S' ) );
509
            $self->cancellationdate( dt_from_string->strftime( '%Y-%m-%d %H:%M:%S' ) );
503
            $self->priority(0);
510
            $self->priority(0);
504
            $self->cancellation_reason( $params->{cancellation_reason} );
511
            $self->cancellation_reason( $params->{cancellation_reason} );
(-)a/Koha/Item/Transfer.pm (-4 / +20 lines)
Lines 52-57 sub item { Link Here
52
    return Koha::Item->_new_from_dbic($item_rs);
52
    return Koha::Item->_new_from_dbic($item_rs);
53
}
53
}
54
54
55
=head3 from_library
56
57
  my $from_library = $transfer->from_library;
58
59
Returns the associated from_library for this transfer.
60
61
=cut
62
63
sub from_library {
64
    my ($self) = @_;
65
    my $from_library_rs = $self->_result->frombranch;
66
    return Koha::Library->_new_from_dbic($from_library_rs);
67
}
68
55
=head3 transit
69
=head3 transit
56
70
57
Set the transfer as in transit by updating the datesent time.
71
Set the transfer as in transit by updating the datesent time.
Lines 147-156 sub cancel { Link Here
147
    # Set up return transfer if transfer was force cancelled whilst in transit
161
    # Set up return transfer if transfer was force cancelled whilst in transit
148
    # NOTE: We don't catch here, as we're happy to fail if there are already
162
    # NOTE: We don't catch here, as we're happy to fail if there are already
149
    # other transfers in the queue.
163
    # other transfers in the queue.
150
    try {
164
    if ($in_transit) {
151
        $self->item->request_transfer(
165
        try {
152
            { to => $self->frombranch, reason => 'TransferCancellation' } );
166
            $self->item->request_transfer(
153
    };
167
                { to => $self->from_library, reason => 'TransferCancellation' } );
168
        };
169
    }
154
170
155
    return $self;
171
    return $self;
156
}
172
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (-1 / +2 lines)
Lines 134-139 Link Here
134
                                             [%- CASE 'Reserve' -%]Reserve
134
                                             [%- CASE 'Reserve' -%]Reserve
135
                                             [%- CASE 'LostReserve' -%]Lost reserve
135
                                             [%- CASE 'LostReserve' -%]Lost reserve
136
                                             [%- CASE 'CancelReserve' -%]Cancelled reserve
136
                                             [%- CASE 'CancelReserve' -%]Cancelled reserve
137
                                             [%- CASE 'TransferCancellation' -%]Transfer was cancelled whilst in transit
138
                                             [%- CASE -%][% trigger | html %]
137
                                         [%- END -%]
139
                                         [%- END -%]
138
                                     </p>
140
                                     </p>
139
                                 </div>
141
                                 </div>
140
- 

Return to bug 12362