|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace lordelph\SIP2\Request; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* HoldRequest is used to create, modify, or delete a hold. The ACS should respond with a Hold Response message. |
|
7
|
|
|
* Either or both of the setItemIdentifier and setItemTitle methods must be called for the message to |
|
8
|
|
|
* be useful. |
|
9
|
|
|
* |
|
10
|
|
|
* setHoldMode takes one of following values |
|
11
|
|
|
* HoldRequest::MODE_ADD |
|
12
|
|
|
* HoldRequest::MODE_DELETE |
|
13
|
|
|
* HoldRequest::MODE_CHANGE |
|
14
|
|
|
* |
|
15
|
|
|
* setHoldType takes one of following values: |
|
16
|
|
|
* HoldRequest::HOLD_OTHER |
|
17
|
|
|
* HoldRequest::HOLD_ANY_COPY |
|
18
|
|
|
* HoldRequest::HOLD_SPECIFIC_COPY |
|
19
|
|
|
* HoldRequest::HOLD_ANY_COPY_AT_LOCATION |
|
20
|
|
|
* |
|
21
|
|
|
* @method setHoldMode(string $mode) |
|
22
|
|
|
* @method setExpiryDate(string $timestamp) |
|
23
|
|
|
* @method setPickupLocation(string $location) |
|
24
|
|
|
* @method setHoldType(string $type) |
|
25
|
|
|
* @method setInstitutionId(string $institutionId) |
|
26
|
|
|
* @method setPatronIdentifier(string $patron) |
|
27
|
|
|
* @method setPatronPassword(string $patronPassword) |
|
28
|
|
|
* @method setItemIdentifier(string $itemIdentifier) |
|
29
|
|
|
* @method setItemTitle(string $itemTitle) |
|
30
|
|
|
* @method setTerminalPassword(string $terminalPassword) |
|
31
|
|
|
* @method setFeeAcknowledged(string $yn) |
|
32
|
|
|
* |
|
33
|
|
|
* @licence https://opensource.org/licenses/MIT |
|
34
|
|
|
* @copyright John Wohlers <[email protected]> |
|
35
|
|
|
* @copyright Paul Dixon <[email protected]> |
|
36
|
|
|
*/ |
|
37
|
|
|
class HoldRequest extends SIP2Request |
|
38
|
|
|
{ |
|
39
|
|
|
const MODE_ADD = '+'; |
|
40
|
|
|
const MODE_DELETE = '-'; |
|
41
|
|
|
const MODE_CHANGE = '*'; |
|
42
|
|
|
|
|
43
|
|
|
const HOLD_OTHER = 1; |
|
44
|
|
|
const HOLD_ANY_COPY = 2; |
|
45
|
|
|
const HOLD_SPECIFIC_COPY = 3; |
|
46
|
|
|
const HOLD_ANY_COPY_AT_LOCATION = 4; |
|
47
|
|
|
|
|
48
|
|
|
protected $var = [ |
|
49
|
|
|
'HoldMode' => ['type' => 'regex/[\-\+\*]/'], |
|
50
|
|
|
'ExpiryDate' => ['type' => 'timestamp', 'default' => ''], |
|
51
|
|
|
'PickupLocation' => ['default' => ''], |
|
52
|
|
|
'HoldType' => ['type' => 'n', 'default' => ''], |
|
53
|
|
|
'InstitutionId' => [], |
|
54
|
|
|
'PatronIdentifier' => [], |
|
55
|
|
|
'PatronPassword' => ['default' => ''], |
|
56
|
|
|
'ItemIdentifier' => ['default' => ''], |
|
57
|
|
|
'ItemTitle' => ['default' => ''], |
|
58
|
|
|
'TerminalPassword' => ['default' => ''], |
|
59
|
|
|
'FeeAcknowledged' => ['type' => 'YN', 'default' => 'N'], |
|
60
|
|
|
]; |
|
61
|
|
|
|
|
62
|
1 |
|
public function getMessageString($withSeq = true, $withCrc = true): string |
|
63
|
|
|
{ |
|
64
|
1 |
|
$this->newMessage('15'); |
|
65
|
1 |
|
$this->addFixedOption($this->getVariable('HoldMode'), 1); |
|
66
|
1 |
|
$this->addFixedOption($this->datestamp(), 18); |
|
67
|
|
|
|
|
68
|
1 |
|
$this->addVarOption('BW', $this->getVariable('ExpiryDate'), true); |
|
69
|
1 |
|
$this->addVarOption('BS', $this->getVariable('PickupLocation'), true); |
|
70
|
1 |
|
$this->addVarOption('BY', $this->getVariable('HoldType'), true); |
|
71
|
1 |
|
$this->addVarOption('AO', $this->getVariable('InstitutionId')); |
|
72
|
1 |
|
$this->addVarOption('AA', $this->getVariable('PatronIdentifier')); |
|
73
|
1 |
|
$this->addVarOption('AD', $this->getVariable('PatronPassword'), true); |
|
74
|
1 |
|
$this->addVarOption('AB', $this->getVariable('ItemIdentifier'), true); |
|
75
|
1 |
|
$this->addVarOption('AJ', $this->getVariable('ItemTitle'), true); |
|
76
|
1 |
|
$this->addVarOption('AC', $this->getVariable('TerminalPassword'), true); |
|
77
|
1 |
|
$this->addVarOption('BO', $this->getVariable('FeeAcknowledged'), true); |
|
78
|
|
|
|
|
79
|
1 |
|
return $this->returnMessage($withSeq, $withCrc); |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|