test some older SIP spec extensions
authorJason Etheridge <jason@EquinoxOLI.org>
Sat, 26 Nov 2022 16:41:30 +0000 (11:41 -0500)
committerJason Etheridge <jason@EquinoxOLI.org>
Sat, 26 Nov 2022 16:41:30 +0000 (11:41 -0500)
"SIP Extensions by 3M spec: Document Revision 1.20, 02/14/2005"

These don't actually appear in a 2.00 document I'm referencing.

Signed-off-by: Jason Etheridge <jason@EquinoxOLI.org>
Sip/Constants.pm
t/17extensions.t
t/SIPtest.pm
t/augment_concerto.sql

index a5ccda0..b27bc5b 100644 (file)
@@ -260,6 +260,12 @@ use constant {
     FID_CALL_NUMBER            => 'CS',
     FID_DESTINATION_LOCATION   => 'CT',
     FID_ALERT_TYPE             => 'CV',
+        # 00 unknown
+        # 01 hold for this library
+        # 02 hold for other branch
+        # 03 hold for ILL
+        # 04 send to other branch
+        # 99 Other
     FID_HOLD_PATRON_ID         => 'CY',
     FID_HOLD_PATRON_NAME       => 'DA',
 
index 1258e63..76f1695 100755 (executable)
@@ -8,7 +8,8 @@ use Sip::Constants qw(:all);
 use SIPtest qw($datepat $textpat $instid $currency $user_barcode $user_pin
     $user_fullname $user_homeaddr $user_email $user_phone
     $user_birthday $user_ptype $user_inet $user_homelib
-    $item_barcode $item_title $item_owner $item2_on_hold_barcode);
+    $item_barcode $item_title $item_owner $item2_on_hold_barcode
+    $item3_on_hold_barcode_for_br1);
 
 my $patron_info_test_template = {
     id => 'valid Patron Info no details',
@@ -84,6 +85,20 @@ my $item2_on_hold_info_test_template = {
             required => 1, },
 ], };
 
+my $checkin_test_template = {
+    id => 'Checkin: Item is checked out',
+    msg => "09N20060102    08423620060113    084235APUnder the bed|AO$instid|AB$item_barcode|ACterminal password|",
+    pat => qr/^101YNN$datepat/o,
+    fields => [],
+};
+
+my $checkout_template = {
+    id => 'Checkin: prep: check out item',
+    msg => "11YN20060329    203000                  AO$instid|AA$user_barcode|AB$item_barcode|AC|",
+    pat => qr/^121NNY$datepat/o,
+    fields => [],
+};
+
 my @tests = (
     $SIPtest::login_test,
     $SIPtest::sc_status_test,
@@ -91,6 +106,8 @@ my @tests = (
     clone($patron_status_test_template),
     clone($item_info_test_template),
     clone($item2_on_hold_info_test_template),
+    $checkout_template,
+    clone($checkin_test_template),
 );
 
 
@@ -214,7 +231,7 @@ sub create_amh_sorting_extension_tests {
     $test->{id} = "Item Info destination location extension";
     push @{$test->{fields}}, {
         field    => FID_DESTINATION_LOCATION,
-        pat      => qr/^BR4$/o,
+        pat      => qr/^BM1$/o,
         just_warn => 1, required => 1, };
     push @tests, $test;
 
@@ -228,10 +245,69 @@ sub create_amh_sorting_extension_tests {
     push @tests, $test;
 }
 
+sub create_maybe_deprecated_extension_tests {
+    # SIP Extensions by 3M spec: Document Revision 1.20, 02/14/2005
+    # I don't actually see these in a 2.00 document, but in 1.20 they
+    # are optional extensions for the checkin response
+
+    my $test = clone($checkin_test_template);
+    $test->{id} = "Checkin response collection code extension";
+    push @tests, $checkout_template;
+    push @{$test->{fields}}, {
+        field    => FID_COLLECTION_CODE,
+        pat      => qr/^Young Adult Fiction$/o,
+        just_warn => 1, required => 1, };
+    push @tests, $test;
+
+    $test = clone($checkin_test_template);
+    $test->{id} = "Checkin response call number extension";
+    push @tests, $checkout_template;
+    push @{$test->{fields}}, {
+        field    => FID_CALL_NUMBER,
+        pat      => qr/^ML 2533 B34 C3$/o,
+        just_warn => 1, required => 1, };
+    push @tests, $test;
+
+    $test = clone($checkin_test_template);
+    $test->{msg} =~ s/$item_barcode/$item2_on_hold_barcode/g;
+    $test->{pat} = qr/^101YN[YN]$datepat/o; # let alert field in leader be Y or N
+    $test->{id} = "Checkin response destination location extension";
+    # No need to check this out; we should have a transit for it
+    push @{$test->{fields}}, {
+        field    => FID_DESTINATION_LOCATION,
+        pat      => qr/^BM1$/o,
+        just_warn => 1, required => 1, };
+    push @tests, $test;
+
+    $test = clone($checkin_test_template);
+    $test->{msg} =~ s/$item_barcode/$item3_on_hold_barcode_for_br1/g;
+    $test->{pat} = qr/^101YN[YN]$datepat/o; # let alert field in leader be Y or N
+    $test->{id} = "Checkin response hold patron ID extension";
+    # No need to check this out, we're just interested in hold routing being triggered
+    push @{$test->{fields}}, {
+        field    => FID_HOLD_PATRON_ID,
+        pat      => qr/^99999354444$/o,
+        just_warn => 1, required => 1, };
+    push @tests, $test;
+
+    $test = clone($checkin_test_template);
+    $test->{msg} =~ s/$item_barcode/$item3_on_hold_barcode_for_br1/g;
+    $test->{pat} = qr/^101YN[YN]$datepat/o; # let alert field in leader be Y or N
+    $test->{id} = "Checkin response hold patron ID extension";
+    # No need to check this out, we're just interested in hold routing being triggered
+    push @{$test->{fields}}, {
+        field    => FID_HOLD_PATRON_NAME,
+        pat      => qr/^Edward David Ellis$/o, # the standard doesn't actually specify how names are formatted
+        just_warn => 1, required => 1, };
+    push @tests, $test;
+
+}
+
 create_patron_info_extension_tests();
 create_patron_status_extension_tests();
 create_ils_defined_protocol_extension_tests();
 create_amh_sorting_extension_tests();
+create_maybe_deprecated_extension_tests();
 
 SIPtest::run_sip_tests(@tests);
 
index 01bc624..8e86524 100644 (file)
@@ -47,6 +47,7 @@ our @EXPORT_OK = qw(run_sip_tests no_tagged_fields
             $item_barcode $item_title $item_owner
             $item2_barcode $item2_title $item2_owner
             $item_on_hold_barcode $item2_on_hold_barcode
+            $item3_on_hold_barcode_for_br1
             $item_diacritic_barcode $item_diacritic_title
             $item_diacritic_owner);
 
@@ -107,6 +108,9 @@ our $item_on_hold_barcode = 'CONC70000345';
 # another on hold item with a transit
 our $item2_on_hold_barcode = 'CONC70000352';
 
+# and another on hold for a specific pickup lib
+our $item3_on_hold_barcode_for_br1 = 'CONC90000520';
+
 # Valid user (that we will deactivate later) barcode and corresponding user password/pin and full name
 our $block_user_barcode  = '99999391951';
 our $block_user_pin      = 'mistyg1234';
index 0d0831a..0e56047 100644 (file)
@@ -33,6 +33,10 @@ INSERT INTO asset.stat_cat_entry(stat_cat, owner, value)
 INSERT INTO asset.stat_cat_entry_copy_map (stat_cat, stat_cat_entry, owning_copy) 
     VALUES (1, 2, 2003);
 
-INSERT INTO action.transit_copy (source_send_time, target_copy, source, dest, copy_status, persistant_transfer)
-    VALUES (NOW(), 317, 4, 7, 0, 'f');
+INSERT INTO action.hold_transit_copy (source_send_time, target_copy, source, dest, copy_status, persistant_transfer, hold)
+    VALUES (NOW(), 317, 4, 9, 0, 'f', 158);
+
+UPDATE action.hold_request SET pickup_lib = 4, request_lib = 4, selection_ou = 4 WHERE id = 254;
+UPDATE asset.copy SET circ_lib = 4 WHERE id = 485;
+INSERT INTO action.hold_copy_map (hold, target_copy, proximity) VALUES (254, 485, 0);