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

(-)a/C4/SIP/ILS/Item.pm (-9 / +21 lines)
Lines 153-167 sub next_hold { Link Here
153
}
153
}
154
154
155
# hold_patron_id is NOT the barcode.  It's the borrowernumber.
155
# hold_patron_id is NOT the barcode.  It's the borrowernumber.
156
# That's because the reserving patron may not have a barcode, or may be from an different system entirely (ILL)!
156
# If a return triggers capture for a hold the borrowernumber is passed
157
# and saved so that other hold info can be retrieved
157
sub hold_patron_id {
158
sub hold_patron_id {
158
    my $self = shift or return;
159
    my $self = shift;
159
    my $hold = $self->next_hold() or return;
160
    my $id   = shift;
160
    return $hold->{borrowernumber};
161
    if ($id) {
162
        $self->{hold}->{borrowernumber} = $id;
163
    }
164
    if ($self->{hold} ) {
165
        return $self->{hold}->{borrowernumber};
166
    }
167
    return;
168
161
}
169
}
162
sub hold_patron_name {
170
sub hold_patron_name {
163
    my $self = shift or return;
171
    my $self = shift or return;
164
    # return $self->{hold_patron_name} if $self->{hold_patron_name};    TODO: consider caching
165
    my $borrowernumber = (@_ ? shift: $self->hold_patron_id()) or return;
172
    my $borrowernumber = (@_ ? shift: $self->hold_patron_id()) or return;
166
    my $holder = GetMember(borrowernumber=>$borrowernumber);
173
    my $holder = GetMember(borrowernumber=>$borrowernumber);
167
    unless ($holder) {
174
    unless ($holder) {
Lines 175-181 sub hold_patron_name { Link Here
175
                "" ;                                         # neither populated, empty string
182
                "" ;                                         # neither populated, empty string
176
    my $name = $holder->{firstname} ? $holder->{firstname} . ' ' : '';
183
    my $name = $holder->{firstname} ? $holder->{firstname} . ' ' : '';
177
    $name .= $holder->{surname} . $extra;
184
    $name .= $holder->{surname} . $extra;
178
    # $self->{hold_patron_name} = $name;      # TODO: consider caching
179
    return $name;
185
    return $name;
180
}
186
}
181
187
Lines 192-200 sub hold_patron_bcode { Link Here
192
}
198
}
193
199
194
sub destination_loc {
200
sub destination_loc {
195
    my $self = shift or return;
201
    my $self = shift;
196
    my $hold = $self->next_hold();
202
    my $set_loc = shift;
197
    return ($hold ? $hold->{branchcode} : '');
203
    if ($set_loc) {
204
        $self->{dest_loc} = $set_loc;
205
    }
206
    if ($self->{dest_loc} ) {
207
        return $self->{dest_loc};
208
    }
209
    return q{};
198
}
210
}
199
211
200
our $AUTOLOAD;
212
our $AUTOLOAD;
(-)a/C4/SIP/ILS/Transaction/Checkin.pm (-2 / +14 lines)
Lines 13-18 use ILS; Link Here
13
use ILS::Transaction;
13
use ILS::Transaction;
14
14
15
use C4::Circulation;
15
use C4::Circulation;
16
use C4::Reserves qw( ModReserveAffect );
16
use C4::Debug;
17
use C4::Debug;
17
18
18
our @ISA = qw(ILS::Transaction);
19
our @ISA = qw(ILS::Transaction);
Lines 75-82 sub do_checkin { Link Here
75
    }
76
    }
76
    if ($messages->{ResFound}) {
77
    if ($messages->{ResFound}) {
77
        $self->hold($messages->{ResFound});
78
        $self->hold($messages->{ResFound});
78
        $debug and warn "Item returned at $branch reserved at $messages->{ResFound}->{branchcode}";
79
        if ($branch eq $messages->{ResFound}->{branchcode}) {
79
        $self->alert_type(($branch eq $messages->{ResFound}->{branchcode}) ? '01' : '02');
80
            $self->alert_type('01');
81
            ModReserveAffect( $messages->{ResFound}->{itemnumber},
82
                $messages->{ResFound}->{borrowernumber}, 0);
83
84
        } else {
85
            $self->alert_type('02');
86
            ModReserveAffect( $messages->{ResFound}->{itemnumber},
87
                $messages->{ResFound}->{borrowernumber}, 1);
88
89
        }
90
        $self->{item}->hold_patron_id( $messages->{ResFound}->{borrowernumber} );
91
        $self->{item}->destination_loc( $messages->{ResFound}->{branchcode} );
80
    }
92
    }
81
    $self->alert(1) if defined $self->alert_type;  # alert_type could be "00", hypothetically
93
    $self->alert(1) if defined $self->alert_type;  # alert_type could be "00", hypothetically
82
    $self->ok($return);
94
    $self->ok($return);
(-)a/C4/SIP/Sip/MsgType.pm (-9 / +1 lines)
Lines 647-660 sub handle_checkin { Link Here
647
    # apparently we can't trust the returns from Checkin yet (because C4::Circulation::AddReturn is faulty)
647
    # apparently we can't trust the returns from Checkin yet (because C4::Circulation::AddReturn is faulty)
648
    # So we reproduce the alert logic here.
648
    # So we reproduce the alert logic here.
649
    if (not $status->alert) {
649
    if (not $status->alert) {
650
        if ($item->hold_patron_id) {
650
        if ($item->destination_loc and $item->destination_loc ne $current_loc) {
651
            $status->alert(1);
652
            if ($item->destination_loc and $item->destination_loc ne $current_loc) {
653
                $status->alert_type('02');  # hold at other library
654
            } else {
655
                $status->alert_type('01');  # hold at this library
656
            }
657
        } elsif ($item->destination_loc and $item->destination_loc ne $current_loc) {
658
            $status->alert(1);
651
            $status->alert(1);
659
            $status->alert_type('04');  # no hold, just send it
652
            $status->alert_type('04');  # no hold, just send it
660
        }
653
        }
661
- 

Return to bug 3638