File: | C4/SIP/Sip/Constants.pm |
Coverage: | 100.0% |
line | stmt | bran | cond | sub | time | code |
---|---|---|---|---|---|---|
1 | # | |||||
2 | # Sip::Constants.pm | |||||
3 | # | |||||
4 | # Various protocol constant values for 3M's Standard Interchange | |||||
5 | # Protocol for communication between a library's Automated | |||||
6 | # Checkout System (ACS) and stand-alone Self-Check (SC) units | |||||
7 | ||||||
8 | package Sip::Constants; | |||||
9 | ||||||
10 | 1 1 1 | 5 2 26 | use strict; | |||
11 | 1 1 1 | 4 2 40 | use warnings; | |||
12 | 1 1 1 | 5 1 353 | use Exporter; | |||
13 | ||||||
14 | our (@ISA, @EXPORT_OK, %EXPORT_TAGS); | |||||
15 | ||||||
16 | BEGIN { | |||||
17 | 1 | 12 | @ISA = qw(Exporter); | |||
18 | 1 | 58 | %EXPORT_TAGS = ( | |||
19 | ||||||
20 | SC_msgs => [qw( | |||||
21 | PATRON_STATUS_REQ | |||||
22 | CHECKOUT CHECKIN | |||||
23 | SC_STATUS REQUEST_ACS_RESEND | |||||
24 | LOGIN PATRON_INFO END_PATRON_SESSION | |||||
25 | FEE_PAID ITEM_INFORMATION ITEM_STATUS_UPDATE | |||||
26 | HOLD RENEW RENEW_ALL | |||||
27 | PATRON_ENABLE | |||||
28 | BLOCK_PATRON | |||||
29 | )], | |||||
30 | ||||||
31 | ACS_msgs => [qw( | |||||
32 | PATRON_STATUS_RESP | |||||
33 | CHECKOUT_RESP CHECKIN_RESP | |||||
34 | ACS_STATUS REQUEST_SC_RESEND | |||||
35 | LOGIN_RESP PATRON_INFO_RESP END_SESSION_RESP | |||||
36 | FEE_PAID_RESP ITEM_INFO_RESP ITEM_STATUS_UPDATE_RESP | |||||
37 | HOLD_RESP RENEW_RESP RENEW_ALL_RESP | |||||
38 | PATRON_ENABLE_RESP | |||||
39 | )], | |||||
40 | ||||||
41 | SC_status => [qw(SC_STATUS_OK SC_STATUS_PAPER SC_STATUS_SHUTDOWN)], | |||||
42 | formats => [qw(SIP_DATETIME)], | |||||
43 | constant_msgs => [qw(REQUEST_ACS_RESEND_CKSUM REQUEST_SC_RESEND_CKSUM)], | |||||
44 | ||||||
45 | field_ids => [qw( | |||||
46 | FID_PATRON_ID FID_ITEM_ID | |||||
47 | FID_TERMINAL_PWD FID_PATRON_PWD | |||||
48 | FID_PERSONAL_NAME FID_DUE_DATE | |||||
49 | FID_SCREEN_MSG FID_PRINT_LINE | |||||
50 | FID_TITLE_ID FID_BLOCKED_CARD_MSG | |||||
51 | FID_TERMINAL_LOCN FID_INST_ID | |||||
52 | FID_CURRENT_LOCN FID_LIBRARY_NAME | |||||
53 | FID_PERM_LOCN | |||||
54 | FID_HOLD_ITEMS FID_HOLD_ITEMS_LMT | |||||
55 | FID_OVERDUE_ITEMS FID_OVERDUE_ITEMS_LMT | |||||
56 | FID_CHARGED_ITEMS FID_CHARGED_ITEMS_LMT | |||||
57 | FID_FINE_ITEMS FID_SEQNO | |||||
58 | FID_CKSUM FID_HOME_ADDR | |||||
59 | FID_EMAIL FID_HOME_PHONE | |||||
60 | FID_OWNER FID_CURRENCY | |||||
61 | FID_CANCEL | |||||
62 | FID_TRANSACTION_ID FID_VALID_PATRON | |||||
63 | FID_RENEWED_ITEMS | |||||
64 | FID_UNRENEWED_ITEMS | |||||
65 | FID_FEE_ACK | |||||
66 | FID_START_ITEM FID_END_ITEM FID_QUEUE_POS | |||||
67 | FID_PICKUP_LOCN FID_FEE_TYPE | |||||
68 | FID_RECALL_ITEMS | |||||
69 | FID_FEE_AMT FID_FEE_LMT | |||||
70 | FID_EXPIRATION | |||||
71 | FID_SUPPORTED_MSGS | |||||
72 | FID_HOLD_TYPE | |||||
73 | FID_UNAVAILABLE_HOLD_ITEMS | |||||
74 | FID_HOLD_QUEUE_LEN | |||||
75 | FID_FEE_ID FID_ITEM_PROPS | |||||
76 | FID_RECALL_DATE FID_SECURITY_INHIBIT | |||||
77 | FID_MEDIA_TYPE FID_SORT_BIN | |||||
78 | FID_HOLD_PICKUP_DATE | |||||
79 | FID_LOGIN_UID FID_LOGIN_PWD | |||||
80 | FID_LOCATION_CODE | |||||
81 | FID_VALID_PATRON_PWD | |||||
82 | FID_PATRON_BIRTHDATE | |||||
83 | FID_PATRON_CLASS | |||||
84 | FID_INET_PROFILE | |||||
85 | ||||||
86 | FID_COLLECTION_CODE | |||||
87 | FID_CALL_NUMBER | |||||
88 | FID_DESTINATION_LOCATION | |||||
89 | FID_ALERT_TYPE | |||||
90 | FID_HOLD_PATRON_ID | |||||
91 | FID_HOLD_PATRON_NAME | |||||
92 | )], | |||||
93 | ); | |||||
94 | ||||||
95 | # Add the contents of the other ":class" tags to make an ":all" class (deleting duplicates) | |||||
96 | # This is the textbook example from http://perldoc.perl.org/Exporter.html | |||||
97 | 1 | 2 | my %seen; | |||
98 | 1 1 6 105 6 | 2 4 11 556 8 | push @{$EXPORT_TAGS{all}}, grep {!$seen{$_}++} @{$EXPORT_TAGS{$_}} foreach keys %EXPORT_TAGS; | |||
99 | 1 | 236 | Exporter::export_ok_tags('all'); # now add :all to @EXPORT_OK | |||
100 | } | |||||
101 | ||||||
102 | # | |||||
103 | # Declare message types | |||||
104 | # | |||||
105 | ||||||
106 | # Messages from SC to ACS | |||||
107 | use constant { | |||||
108 | 1 | 24 | PATRON_STATUS_REQ => '23', | |||
109 | CHECKOUT => '11', | |||||
110 | CHECKIN => '09', | |||||
111 | BLOCK_PATRON => '01', | |||||
112 | SC_STATUS => '99', | |||||
113 | REQUEST_ACS_RESEND => '97', | |||||
114 | LOGIN => '93', | |||||
115 | PATRON_INFO => '63', | |||||
116 | END_PATRON_SESSION => '35', | |||||
117 | FEE_PAID => '37', | |||||
118 | ITEM_INFORMATION => '17', | |||||
119 | ITEM_STATUS_UPDATE => '19', | |||||
120 | PATRON_ENABLE => '25', | |||||
121 | HOLD => '15', | |||||
122 | RENEW => '29', | |||||
123 | RENEW_ALL => '65', | |||||
124 | 1 1 | 230 1265 | }; | |||
125 | ||||||
126 | # Message responses from ACS to SC | |||||
127 | use constant { | |||||
128 | 1 | 27 | PATRON_STATUS_RESP => '24', | |||
129 | CHECKOUT_RESP => '12', | |||||
130 | CHECKIN_RESP => '10', | |||||
131 | ACS_STATUS => '98', | |||||
132 | REQUEST_SC_RESEND => '96', | |||||
133 | LOGIN_RESP => '94', | |||||
134 | PATRON_INFO_RESP => '64', | |||||
135 | END_SESSION_RESP => '36', | |||||
136 | FEE_PAID_RESP => '38', | |||||
137 | ITEM_INFO_RESP => '18', | |||||
138 | ITEM_STATUS_UPDATE_RESP => '20', | |||||
139 | PATRON_ENABLE_RESP => '26', | |||||
140 | HOLD_RESP => '16', | |||||
141 | RENEW_RESP => '30', | |||||
142 | RENEW_ALL_RESP => '66', | |||||
143 | 1 1 | 358 2 | }; | |||
144 | ||||||
145 | # | |||||
146 | # Some messages are short and invariant, so they're constant's too | |||||
147 | # | |||||
148 | use constant { | |||||
149 | 1 | 11 | REQUEST_ACS_RESEND_CKSUM => '97AZFEF5', | |||
150 | REQUEST_SC_RESEND_CKSUM => '96AZFEF6', | |||||
151 | 1 1 | 255 7 | }; | |||
152 | ||||||
153 | # | |||||
154 | # Field Identifiers | |||||
155 | # | |||||
156 | use constant { | |||||
157 | 1 | 201 | FID_PATRON_ID => 'AA', | |||
158 | FID_ITEM_ID => 'AB', | |||||
159 | FID_TERMINAL_PWD => 'AC', | |||||
160 | FID_PATRON_PWD => 'AD', | |||||
161 | FID_PERSONAL_NAME => 'AE', | |||||
162 | FID_SCREEN_MSG => 'AF', | |||||
163 | FID_PRINT_LINE => 'AG', | |||||
164 | FID_DUE_DATE => 'AH', | |||||
165 | # UNUSED AI | |||||
166 | FID_TITLE_ID => 'AJ', | |||||
167 | # UNUSED AK | |||||
168 | FID_BLOCKED_CARD_MSG => 'AL', | |||||
169 | FID_LIBRARY_NAME => 'AM', | |||||
170 | FID_TERMINAL_LOCN => 'AN', | |||||
171 | FID_INST_ID => 'AO', | |||||
172 | FID_CURRENT_LOCN => 'AP', | |||||
173 | FID_PERM_LOCN => 'AQ', | |||||
174 | # UNUSED AR | |||||
175 | FID_HOLD_ITEMS => 'AS', # SIP 2.0 | |||||
176 | FID_OVERDUE_ITEMS => 'AT', # SIP 2.0 | |||||
177 | FID_CHARGED_ITEMS => 'AU', # SIP 2.0 | |||||
178 | FID_FINE_ITEMS => 'AV', # SIP 2.0 | |||||
179 | # UNUSED AW | |||||
180 | # UNUSED AX | |||||
181 | FID_SEQNO => 'AY', | |||||
182 | FID_CKSUM => 'AZ', | |||||
183 | ||||||
184 | # SIP 2.0 Fields | |||||
185 | # UNUSED BA | |||||
186 | # UNUSED BB | |||||
187 | # UNUSED BC | |||||
188 | FID_HOME_ADDR => 'BD', | |||||
189 | FID_EMAIL => 'BE', | |||||
190 | FID_HOME_PHONE => 'BF', | |||||
191 | FID_OWNER => 'BG', | |||||
192 | FID_CURRENCY => 'BH', | |||||
193 | FID_CANCEL => 'BI', | |||||
194 | # UNUSED BJ | |||||
195 | FID_TRANSACTION_ID => 'BK', | |||||
196 | FID_VALID_PATRON => 'BL', | |||||
197 | FID_RENEWED_ITEMS => 'BM', | |||||
198 | FID_UNRENEWED_ITEMS => 'BN', | |||||
199 | FID_FEE_ACK => 'BO', | |||||
200 | FID_START_ITEM => 'BP', | |||||
201 | FID_END_ITEM => 'BQ', | |||||
202 | FID_QUEUE_POS => 'BR', | |||||
203 | FID_PICKUP_LOCN => 'BS', | |||||
204 | FID_FEE_TYPE => 'BT', | |||||
205 | FID_RECALL_ITEMS => 'BU', | |||||
206 | FID_FEE_AMT => 'BV', | |||||
207 | FID_EXPIRATION => 'BW', | |||||
208 | FID_SUPPORTED_MSGS => 'BX', | |||||
209 | FID_HOLD_TYPE => 'BY', | |||||
210 | FID_HOLD_ITEMS_LMT => 'BZ', | |||||
211 | FID_OVERDUE_ITEMS_LMT => 'CA', | |||||
212 | FID_CHARGED_ITEMS_LMT => 'CB', | |||||
213 | FID_FEE_LMT => 'CC', | |||||
214 | FID_UNAVAILABLE_HOLD_ITEMS => 'CD', | |||||
215 | # UNUSED CE | |||||
216 | FID_HOLD_QUEUE_LEN => 'CF', | |||||
217 | FID_FEE_ID => 'CG', | |||||
218 | FID_ITEM_PROPS => 'CH', | |||||
219 | FID_SECURITY_INHIBIT => 'CI', | |||||
220 | FID_RECALL_DATE => 'CJ', | |||||
221 | FID_MEDIA_TYPE => 'CK', | |||||
222 | FID_SORT_BIN => 'CL', | |||||
223 | FID_HOLD_PICKUP_DATE => 'CM', | |||||
224 | FID_LOGIN_UID => 'CN', | |||||
225 | FID_LOGIN_PWD => 'CO', | |||||
226 | FID_LOCATION_CODE => 'CP', | |||||
227 | FID_VALID_PATRON_PWD => 'CQ', | |||||
228 | ||||||
229 | # SIP Extensions used by Envisionware Terminals | |||||
230 | FID_PATRON_BIRTHDATE => 'PB', | |||||
231 | FID_PATRON_CLASS => 'PC', | |||||
232 | ||||||
233 | # SIP Extension for reporting patron internet privileges... application unknown | |||||
234 | FID_INET_PROFILE => 'PI', | |||||
235 | ||||||
236 | # SIP Extensions by 3M spec: Document Revision 1.20, 02/14/2005 | |||||
237 | FID_COLLECTION_CODE => 'CR', | |||||
238 | FID_CALL_NUMBER => 'CS', | |||||
239 | FID_DESTINATION_LOCATION => 'CT', | |||||
240 | FID_ALERT_TYPE => 'CV', | |||||
241 | FID_HOLD_PATRON_ID => 'CY', | |||||
242 | FID_HOLD_PATRON_NAME => 'DA', | |||||
243 | 1 1 | 307 847 | }; | |||
244 | ||||||
245 | # | |||||
246 | # SC Status Codes | |||||
247 | # | |||||
248 | use constant { | |||||
249 | 1 | 11 | SC_STATUS_OK => '0', | |||
250 | SC_STATUS_PAPER => '1', | |||||
251 | SC_STATUS_SHUTDOWN => '2', | |||||
252 | 1 1 | 1139 1 | }; | |||
253 | ||||||
254 | # | |||||
255 | # Various format strings | |||||
256 | # | |||||
257 | use constant { | |||||
258 | 1 | 7 | SIP_DATETIME => "%Y%m%d %H%M%S", | |||
259 | 1 1 | 84 1 | }; | |||
260 | ||||||
261 | 1; |