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; |