Repository navigation
Expand file tree
/
Copy pathresponses.php
More file actions
154 lines (133 loc) · 5.13 KB
/
Copy pathresponses.php
File metadata and controls
154 lines (133 loc) · 5.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php
/*
get your system's sip2 repsonse messages for particular transactions
*/
include_once('config.php');
include_once('includes/sip2.php');
$formaction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$formaction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
$error=array();
if (!empty($_POST['form1']) OR !empty($_POST['sc_policies'])){
$mysip = new sip2;
// Set host name
$mysip->hostname = $sip_hostname;
$mysip->port = $sip_port;
if (!empty($_POST['sc_policies'])){
// connect to SIP server
$mysip->connect();
if(!empty($sip_login)){
$sc_login=$mysip->msgLogin($sip_login,$sip_password);
$mysip->parseLoginResponse($mysip->get_message($sc_login));
}
$sc = $mysip->msgSCStatus();
$self_check_status = $mysip->parseACSStatusResponse($mysip->get_message($sc));
$sc_checkouts_allowed=$self_check_status['fixed']['Checkout'];
$sc_renewals_allowed=$self_check_status['fixed']['Renewal'];
} else {
if (empty($_POST['item'])){
$error[]="You didn't enter an item barcode.";
}
if (empty($_POST['patron']) && empty($_POST['ckdout'])){
$error[]="You didn't enter a patron barcode.";
}
if (empty($error)){ //no errors so far go with the sip2
// Identify a patron
$mysip->patron = $_POST['patron'];
// connect to SIP server
$mysip->connect();
if(!empty($sip_login)){
$sc_login=$mysip->msgLogin($sip_login,$sip_password);
$mysip->parseLoginResponse($mysip->get_message($sc_login));
}
$cko = $mysip->msgCheckout($_POST['item']);
// parse the raw response into an array
$checkout = $mysip->parseCheckoutResponse( $mysip->get_message($cko));
print_r($checkout);
$response_message=trim($checkout['variable']['AF'][0]);
}
}
}
?>
<html>
<body style="font-family: Arial;font-size:13px;background-image:url('images/gradient.png');background-repeat:repeat-x;">
<h1 style="width:50%;margin:0 auto 0 auto">Response Messages</h1>
<form action="<?php echo $formaction;?>" method="post" name="form1">
<table style="width:50%" align="center">
<tr>
<td style="width:20%;white-space:nowrap">patron id/barcode:</td>
<td><input type="text" name="patron" /><input type="hidden" name="form1" value="1" /></td>
</tr>
<tr>
<td style="width:20%;white-space:nowrap">item id/barcode:</td>
<td><input type="text" name="item" /> <input type="submit" /></td>
</tr>
<?php
if (!empty($error)){?>
<tr>
<td style="width:20%;"> </td>
<td style="background-color:red;color:white;font-weight:bold">
<?php echo implode(' ',$error);?>
</td>
</tr>
<?php
}
if (!empty($response_message)){?>
<tr>
<td style="width:20%;">Response:</td>
<td style="background-color:#ffff99;font-weight:bold">
<?php echo $response_message;?>
</td>
</tr>
<?php } else if (!empty($sc_checkouts_allowed) OR !empty($sc_renewals_allowed)){
$config=0;?>
<tr>
<td style="width:20%;vertical-align:top;white-space:nowrap">Checkouts Allowed (Y or N):</td>
<td style="background-color:#ffff99;font-weight:bold">
<?php echo $sc_checkouts_allowed;
if ($sc_checkouts_allowed=='N'){ $config=1;?>(change your sip2 configuration to allow checkouts)<?php }?>
</td>
</tr>
<tr>
<td style="width:20%;vertical-align:top;white-space:nowrap">Renewals Allowed (Y or N):</td>
<td style="background-color:#ffff99;font-weight:bold">
<?php echo $sc_renewals_allowed;
if ($sc_renewals_allowed=='N'){ $config=1;?>(consider changing your sip2 configuration to allow renewals)<?php }?>
</td>
</tr>
<?php if ($config==0){?>
<tr>
<td style="width:20%;vertical-align:top">Configuring Your SIP2 Server:</td>
<td style="background-color:#ffff99;font-weight:bold;vertical-align:top">
<ol>
<li style="margin-bottom:10px">
Find you SIP2 configuration file on your server (it might be called sip2.cfg -check your vendor's SIP2 documentation)
</li>
<li style="margin-bottom:10px">
Check your vendor's SIP2 documentation for configuring your SIP2 server's settings.
</li>
</td>
</tr>
<?php }
}?>
<tr>
<td colspan="2">
<ol>
<li style="margin-bottom:10px">
Before doing anything we want to see how your sip2 server is configured (you should proably look at your config files and your vendor's documentation but you can start here -see the installation instructions). In particular we want to see if it allows checkouts and renewals. <a href="#" onclick="document['form2'].submit();return false;">Click here to take a look.</a>
</li>
<li style="margin-bottom:10px">
Enter a borrower's barcode/id above and the barcode/id of an item checked out to that borrower to show the response when trying to check out an item to a borrower who already has that item out.<br />
The response message should be entered into the config file next to <br />$already_ckdout_to_you (i.e. $already_ckdout_to_you=" <em>whatever your response is</em> ")
</li>
</ol>
</td>
</tr>
</table>
</form>
<form action="<?php echo $formaction;?>" method="post" name="form2">
<input type="hidden" value="1" name="sc_policies"/>
</form>
</body>
</html>