1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace lordelph\SIP2\Request; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* BlockPatronRequest requests that the patron card be blocked by the ACS. This is, for example, sent when the patron |
7
|
|
|
* is detected tampering with the SC or when a patron forgets to take their card. The ACS should invalidate the |
8
|
|
|
* patron’s card and respond with a Patron Status Response message. The ACS could also notify the library staff |
9
|
|
|
* that the card has been blocked. |
10
|
|
|
* |
11
|
|
|
* @method setCardRetained(string $yn) |
12
|
|
|
* @method setInstitutionId(string $institutionId) |
13
|
|
|
* @method setMessage(string $message) |
14
|
|
|
* @method setPatronIdentifier(string $patron) |
15
|
|
|
* @method setTerminalPassword(string $terminalPassword) |
16
|
|
|
* |
17
|
|
|
* @licence https://opensource.org/licenses/MIT |
18
|
|
|
* @copyright John Wohlers <[email protected]> |
19
|
|
|
* @copyright Paul Dixon <[email protected]> |
20
|
|
|
*/ |
21
|
|
|
class BlockPatronRequest extends SIP2Request |
22
|
|
|
{ |
23
|
|
|
protected $var = [ |
24
|
|
|
'CardRetained' => ['type' => 'YN', 'default' => 'N'], |
25
|
|
|
'InstitutionId' => [], |
26
|
|
|
'Message' => ['default' => ''], |
27
|
|
|
'PatronIdentifier' => [], |
28
|
|
|
'TerminalPassword' => ['default' => ''], |
29
|
|
|
]; |
30
|
|
|
|
31
|
1 |
|
public function getMessageString($withSeq = true, $withCrc = true): string |
32
|
|
|
{ |
33
|
1 |
|
$this->newMessage('01'); |
34
|
1 |
|
$this->addFixedOption($this->getVariable('CardRetained'), 1); |
35
|
1 |
|
$this->addFixedOption($this->datestamp(), 18); |
36
|
1 |
|
$this->addVarOption('AO', $this->getVariable('InstitutionId')); |
37
|
1 |
|
$this->addVarOption('AL', $this->getVariable('Message')); |
38
|
1 |
|
$this->addVarOption('AA', $this->getVariable('PatronIdentifier')); |
39
|
1 |
|
$this->addVarOption('AC', $this->getVariable('TerminalPassword')); |
40
|
|
|
|
41
|
1 |
|
return $this->returnMessage($withSeq, $withCrc); |
42
|
|
|
} |
43
|
|
|
} |
44
|
|
|
|