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

(-)a/C4/Circulation.pm (-1 / +3 lines)
Lines 1608-1613 sub AddIssue { Link Here
1608
    my $barcodecheck           = CheckValidBarcode($barcode);
1608
    my $barcodecheck           = CheckValidBarcode($barcode);
1609
1609
1610
    my $issue;
1610
    my $issue;
1611
    my $filled_hold;
1611
1612
1612
    if ( $datedue && ref $datedue ne 'DateTime' ) {
1613
    if ( $datedue && ref $datedue ne 'DateTime' ) {
1613
        $datedue = dt_from_string($datedue);
1614
        $datedue = dt_from_string($datedue);
Lines 1716-1722 sub AddIssue { Link Here
1716
                );
1717
                );
1717
            }
1718
            }
1718
1719
1719
            C4::Reserves::MoveReserve( $item_object, $patron, $cancelreserve );
1720
            $filled_hold = C4::Reserves::MoveReserve( $item_object, $patron, $cancelreserve );
1720
1721
1721
            # Starting process for transfer job (checking transfer and validate it if we have one)
1722
            # Starting process for transfer job (checking transfer and validate it if we have one)
1722
            if ( my $transfer = $item_object->get_transfer ) {
1723
            if ( my $transfer = $item_object->get_transfer ) {
Lines 1989-1994 sub AddIssue { Link Here
1989
                if C4::Context->preference('RealTimeHoldsQueue');
1990
                if C4::Context->preference('RealTimeHoldsQueue');
1990
        }
1991
        }
1991
    }
1992
    }
1993
    $issue->add_message( { type => 'hold_filled', payload => $filled_hold, message => 'F' } );
1992
    return $issue;
1994
    return $issue;
1993
}
1995
}
1994
1996
(-)a/C4/Reserves.pm (-1 / +16 lines)
Lines 2174-2180 sub _ShiftPriority { Link Here
2174
2174
2175
=head2 MoveReserve
2175
=head2 MoveReserve
2176
2176
2177
  MoveReserve( $item, $patron, $cancelreserve )
2177
  my $filled_hold = MoveReserve( $item, $patron, $cancelreserve )
2178
2178
2179
Use when checking out an item to handle reserves
2179
Use when checking out an item to handle reserves
2180
If $cancelreserve boolean is set to true, it will remove existing reserve
2180
If $cancelreserve boolean is set to true, it will remove existing reserve
Lines 2204-2209 sub MoveReserve { Link Here
2204
    if ( $res && $res->{borrowernumber} == $patron->borrowernumber ) {
2204
    if ( $res && $res->{borrowernumber} == $patron->borrowernumber ) {
2205
        my $hold = Koha::Holds->find( $res->{reserve_id} );
2205
        my $hold = Koha::Holds->find( $res->{reserve_id} );
2206
        $hold->fill( { item_id => $item->id } );
2206
        $hold->fill( { item_id => $item->id } );
2207
        return $hold;
2207
    } else {
2208
    } else {
2208
2209
2209
        # The item is reserved by someone else.
2210
        # The item is reserved by someone else.
Lines 2227-2233 sub MoveReserve { Link Here
2227
        if ($hold) {
2228
        if ($hold) {
2228
2229
2229
            # The item is reserved by the current patron
2230
            # The item is reserved by the current patron
2231
            # if we are filling a hold previously found we need to alert the staff
2232
            if ( $hold->found() eq 'W' ) {
2233
                $hold->add_message(
2234
                    { message => "W", type => 'filled_waiting', payload => { waiting_branch => $hold->branchcode } } );
2235
            } elsif ( $hold->found() eq 'T' ) {
2236
                $hold->add_message(
2237
                    {
2238
                        message => "T", type => 'filled_transit',
2239
                        payload => { from_branch => $hold->item->holdingbranch }
2240
                    }
2241
                );
2242
            }
2230
            $hold->fill( { item_id => $item->id } );
2243
            $hold->fill( { item_id => $item->id } );
2244
            return $hold;
2231
        }
2245
        }
2232
2246
2233
        $hold = Koha::Holds->find( $res->{reserve_id} );
2247
        $hold = Koha::Holds->find( $res->{reserve_id} );
Lines 2237-2242 sub MoveReserve { Link Here
2237
            $hold->cancel;
2251
            $hold->cancel;
2238
        }
2252
        }
2239
    }
2253
    }
2254
    return;
2240
}
2255
}
2241
2256
2242
=head2 MergeHolds
2257
=head2 MergeHolds
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-1 / +25 lines)
Lines 963-968 Link Here
963
                                    [% END %]
963
                                    [% END %]
964
                                    Due on [% issue.date_due | $KohaDates as_due_date => 1 %]
964
                                    Due on [% issue.date_due | $KohaDates as_due_date => 1 %]
965
                                </p>
965
                                </p>
966
                                [%- SET issue_messages = issue.object_messages %]
967
                                [%- IF (issue_messages.size) %]
968
                                    <div class="alert alert-info">
969
                                        [%- FOREACH message IN issue_messages %]
970
                                            [%- IF (message.type == 'hold_filled') %]
971
                                                <p>
972
                                                    [%- SET hold = message.payload %]
973
                                                    [%- SET hold_messages = hold.object_messages -%]
974
                                                    [%- FOREACH message IN hold_messages %]
975
                                                        [%- IF (message.type == 'filled_transit') %]
976
                                                            [% SET from_branch = message.payload.from_branch | html %]
977
                                                            This item filled a hold that had another item in-transit to this patron from [% Branches.GetName(from_branch) %].
978
                                                        [%- ELSIF (message.type == 'filled_waiting') %]
979
                                                            [% SET waiting_branch = message.payload.waiting_branch | html %]
980
                                                            This item filled a hold that had another item waiting on the shelf for this patron at [% Branches.GetName(waiting_branch) %], please check the holds shelf and check in any other
981
                                                            copies waiting for this patron.
982
                                                        [%- END %]
983
                                                    [%- END %]
984
                                                </p>
985
                                            [%- ELSE %]
986
                                                <p> Message type: ([% message.type | html %]) Message: [% message.message | html %] </p>
987
                                            [%- END %]
988
                                        [%- END %]
989
                                    </div>
990
                                [%- END %]
966
                            </div>
991
                            </div>
967
                        [% END %]
992
                        [% END %]
968
                    </form>
993
                    </form>
969
- 

Return to bug 41282