Return barcode as Sip hold_patron_id
authorColin Campbell <colin.campbell@ptfs-europe.com>
Sun, 6 Sep 2009 09:53:21 +0000 (10:53 +0100)
committerGalen Charlton <gmcharlt@gmail.com>
Sun, 6 Sep 2009 13:01:27 +0000 (09:01 -0400)
Behave consistently with other patron_ids as many sip clients
use this in a subsequent patron information or patron status request

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
C4/SIP/ILS/Item.pm
C4/SIP/Sip/MsgType.pm

index 7e6fac9..2e02c63 100644 (file)
@@ -175,6 +175,19 @@ sub hold_patron_name {
     # $self->{hold_patron_name} = $name;      # TODO: consider caching
     return $name;
 }
+
+sub hold_patron_bcode {
+    my $self = shift or return;
+    my $borrowernumber = (@_ ? shift: $self->hold_patron_id()) or return;
+    my $holder = GetMember($borrowernumber, 'borrowernumber');
+    if ($holder) {
+        if ($holder->{cardnumber}) {
+            return $holder->{cardnumber};
+        }
+    }
+    return;
+}
+
 sub destination_loc {
     my $self = shift or return;
     my $hold = $self->next_hold();
index f04d162..67ccc21 100644 (file)
@@ -676,7 +676,7 @@ sub handle_checkin {
             $resp .= maybe_add(FID_COLLECTION_CODE,      $item->collection_code    );
             $resp .= maybe_add(FID_CALL_NUMBER,          $item->call_number        );
             $resp .= maybe_add(FID_DESTINATION_LOCATION, $item->destination_loc    );
-            $resp .= maybe_add(FID_HOLD_PATRON_ID,       $item->hold_patron_id     );
+            $resp .= maybe_add(FID_HOLD_PATRON_ID,       $item->hold_patron_bcode     );
             $resp .= maybe_add(FID_HOLD_PATRON_NAME,     $item->hold_patron_name   );
             if ($status->hold and $status->hold->{branchcode} ne $item->destination_loc) {
                 warn 'SIP hold mismatch: $status->hold->{branchcode}=' . $status->hold->{branchcode} . '; $item->destination_loc=' . $item->destination_loc;