return $response;
}
+ # Add a hold note with the RequestIdentifierValue for later
+ # lookup in CancelRequestItem. We do not care if it fails.
+ $self->create_hold_note($hold, 'NCIP Remote Request ID', $request->{$message}->{RequestId}->{RequestIdentifierValue});
+
# We return the RequestId and optionally, the ItemID. We'll
# just return what was sent to us, since we ignored all of it
# but the barcode.
if (ref($hold) eq 'NCIP::Problem') {
$response->problem($hold);
} else {
+ # Add a hold note with the RequestIdentifierValue for later
+ # lookup in CancelRequestItem. We do not care if it fails.
+ $self->create_hold_note($hold, 'NCIP Remote Request ID', $request->{$message}->{RequestId}->{RequestIdentifierValue});
my $data = {
RequestId => NCIP::RequestId->new(
$request->{$message}->{RequestId}
return $r;
}
+=head2 create_hold_note
+
+ $note = $ils->create_hold_note($hold, $title, $body);
+
+This method creates a nold note with title of $title and body of $body
+on $hold. It is used to store the RequestIdentifierValue from the
+RequestItem message so that we can later retrieve holds using that ID
+in order to cancel them.
+
+It returns a note object on success and undef on failure.
+
+=cut
+
+sub create_hold_note {
+ my $self = shift;
+ my $hold = shift;
+ my $title = shift;
+ my $body = shift;
+
+ my $note = Fieldmapper::action::hold_request_note->new();
+ $note->isnew(1);
+ $note->hold($hold->id());
+ $note->title($title);
+ $note->body($body);
+ $note->slip(0);
+ $note->pub(0);
+ $note->staff(0);
+ my $result = $U->simplereq(
+ 'open-ils.circ',
+ 'open-ils.circ.hold_request.note.cud',
+ $self->{session}->{authtoken},
+ $note
+ );
+ if (not ref($result)) {
+ $note->id($result);
+ return $note;
+ }
+ return undef;
+}
+
=head2 delete_copy
$ils->delete_copy($copy);