Skip to content
Snippets Groups Projects
Commit 32c8b82e authored by Demian Katz's avatar Demian Katz
Browse files

Style fixes.

parent c96a34eb
No related merge requests found
...@@ -99,7 +99,9 @@ class AlephTranslator ...@@ -99,7 +99,9 @@ class AlephTranslator
$line = str_pad($line, 80); $line = str_pad($line, 80);
$matches = ""; $matches = "";
if (preg_match($rgxp, $line, $matches)) { if (preg_match($rgxp, $line, $matches)) {
call_user_func_array($callback, array($matches, &$result, $this->charset)); call_user_func_array(
$callback, array($matches, &$result, $this->charset)
);
} }
} }
} }
...@@ -284,7 +286,6 @@ class AlephRestfulException extends ILSException ...@@ -284,7 +286,6 @@ class AlephRestfulException extends ILSException
{ {
return $this->xmlResponse; return $this->xmlResponse;
} }
} }
/** /**
...@@ -337,7 +338,7 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface, ...@@ -337,7 +338,7 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface,
* @var \VuFindHttp\HttpServiceInterface * @var \VuFindHttp\HttpServiceInterface
*/ */
protected $httpService = null; protected $httpService = null;
/** /**
* Date converter object * Date converter object
* *
...@@ -348,10 +349,12 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface, ...@@ -348,10 +349,12 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface,
/** /**
* Constructor * Constructor
* *
* @param \VuFind\Cache\Manager $cacheManager Cache manager (optional) * @param \VuFind\Date\Converter $dateConverter Date converter
* @param \VuFind\Cache\Manager $cacheManager Cache manager (optional)
*/ */
public function __construct(\VuFind\Date\Converter $dateConverter, \VuFind\Cache\Manager $cacheManager = null) public function __construct(\VuFind\Date\Converter $dateConverter,
{ \VuFind\Cache\Manager $cacheManager = null
) {
$this->dateConverter = $dateConverter; $this->dateConverter = $dateConverter;
$this->cacheManager = $cacheManager; $this->cacheManager = $cacheManager;
} }
...@@ -519,8 +522,12 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface, ...@@ -519,8 +522,12 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface,
$replyCode = (string) $result->{'reply-code'}; $replyCode = (string) $result->{'reply-code'};
if ($replyCode != "0000") { if ($replyCode != "0000") {
$replyText = (string) $result->{'reply-text'}; $replyText = (string) $result->{'reply-text'};
$this->logger->err("DLF request failed", array('url' => $url, $this->logger->err(
'reply-code' => $replyCode, 'reply-message' => $replyText)); "DLF request failed", array(
'url' => $url, 'reply-code' => $replyCode,
'reply-message' => $replyText
)
);
$ex = new AlephRestfulException($replyText, $replyCode); $ex = new AlephRestfulException($replyText, $replyCode);
$ex->setXmlResponse($result); $ex->setXmlResponse($result);
throw $ex; throw $ex;
...@@ -654,20 +661,21 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface, ...@@ -654,20 +661,21 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface,
* @param array $ids IDs to search within library * @param array $ids IDs to search within library
* *
* @return array * @return array
* *
* Description of AVA tag: * Description of AVA tag:
* http://igelu.org/wp-content/uploads/2011/09/Staff-vs-Public-Data-views.pdf (page 28) * http://igelu.org/wp-content/uploads/2011/09/Staff-vs-Public-Data-views.pdf
* * (page 28)
*
* a ADM code - Institution Code * a ADM code - Institution Code
* b Sublibrary code - Library Code * b Sublibrary code - Library Code
* c Collection (first found) - Collection Code * c Collection (first found) - Collection Code
* d Call number (first found) * d Call number (first found)
* e Availability status - If it is on loan (it has a Z36), if it is on hold shelf * e Availability status - If it is on loan (it has a Z36), if it is on hold
* (it has Z37=S) or if it has a processing status. * shelf (it has Z37=S) or if it has a processing status.
* f Number of items (for entire sublibrary) * f Number of items (for entire sublibrary)
* g Number of unavailable loans * g Number of unavailable loans
* h Multi-volume flag (Y/N) If first Z30-ENUMERATION-A is not blank or 0, then the * h Multi-volume flag (Y/N) If first Z30-ENUMERATION-A is not blank or 0, then
* flag=Y, otherwise the flag=N. * the flag=Y, otherwise the flag=N.
* i Number of loans (for ranking/sorting) * i Number of loans (for ranking/sorting)
* j Collection code * j Collection code
*/ */
...@@ -775,15 +783,16 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface, ...@@ -775,15 +783,16 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface,
} else if (isset($this->defaultPatronId)) { } else if (isset($this->defaultPatronId)) {
$params['patron'] = $this->defaultPatronId; $params['patron'] = $this->defaultPatronId;
} }
$xml = $this->doRestDLFRequest( array('record', $resource, 'items'), $params); $xml = $this->doRestDLFRequest(array('record', $resource, 'items'), $params);
foreach ($xml->{'items'}->{'item'} as $item) { foreach ($xml->{'items'}->{'item'} as $item) {
$item_status = (string) $item->{'z30-item-status-code'}; // $isc $item_status = (string) $item->{'z30-item-status-code'}; // $isc
$item_process_status = (string) $item->{'z30-item-process-status-code'}; // $ipsc // $ipsc:
$item_process_status = (string) $item->{'z30-item-process-status-code'};
$sub_library_code = (string) $item->{'z30-sub-library-code'}; // $slc $sub_library_code = (string) $item->{'z30-sub-library-code'}; // $slc
$z30 = $item->z30; $z30 = $item->z30;
if ($this->translator) { if ($this->translator) {
$item_status = $this->translator->tab15Translate($sub_library_code, $item_status = $this->translator->tab15Translate(
$item_status, $item_process_status $sub_library_code, $item_status, $item_process_status
); );
} else { } else {
$item_status = array( $item_status = array(
...@@ -865,7 +874,7 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface, ...@@ -865,7 +874,7 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface,
'number' => (string) $z30->{'z30-inventory-number'}, 'number' => (string) $z30->{'z30-inventory-number'},
'barcode' => (string) $z30->{'z30-barcode'}, 'barcode' => (string) $z30->{'z30-barcode'},
'description' => (string) $z30->{'z30-description'}, 'description' => (string) $z30->{'z30-description'},
'notes' => ($note == null) ? null : array($note), 'notes' => ($note == null) ? null : array($note),
'is_holdable' => true, 'is_holdable' => true,
'addLink' => $addLink, 'addLink' => $addLink,
'holdtype' => 'hold', 'holdtype' => 'hold',
...@@ -1488,7 +1497,8 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface, ...@@ -1488,7 +1497,8 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface,
} }
$comment = $details['comment']; $comment = $details['comment'];
try { try {
$requiredBy = $this->dateConverter->convertFromDisplayDate('Ymd', $details['requiredBy']); $requiredBy = $this->dateConverter
->convertFromDisplayDate('Ymd', $details['requiredBy']);
} catch (DateException $de) { } catch (DateException $de) {
return array( return array(
'success' => false, 'success' => false,
...@@ -1496,8 +1506,10 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface, ...@@ -1496,8 +1506,10 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface,
); );
} }
$patronId = $patron['id']; $patronId = $patron['id'];
$body = new \SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?>' $body = new \SimpleXMLElement(
. '<hold-request-parameters></hold-request-parameters>'); '<?xml version="1.0" encoding="UTF-8"?>'
. '<hold-request-parameters></hold-request-parameters>'
);
$body->addChild('pickup-location', $pickupLocation); $body->addChild('pickup-location', $pickupLocation);
$body->addChild('last-interest-date', $requiredBy); $body->addChild('last-interest-date', $requiredBy);
$body->addChild('note-l', $comment); $body->addChild('note-l', $comment);
...@@ -1511,7 +1523,8 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface, ...@@ -1511,7 +1523,8 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface,
); );
} catch (AlephRestfulException $exception) { } catch (AlephRestfulException $exception) {
$message = $exception->getMessage(); $message = $exception->getMessage();
$note = $exception->getXmlResponse()->xpath('/put-item-hold/create-hold/note[@type="error"]'); $note = $exception->getXmlResponse()
->xpath('/put-item-hold/create-hold/note[@type="error"]');
$note = $note[0]; $note = $note[0];
return array( return array(
'success' => false, 'success' => false,
...@@ -1571,9 +1584,11 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface, ...@@ -1571,9 +1584,11 @@ class Aleph extends AbstractBase implements \Zend\Log\LoggerAwareInterface,
return ""; return "";
} else if (preg_match("/^[0-9]{8}$/", $date) === 1) { // 20120725 } else if (preg_match("/^[0-9]{8}$/", $date) === 1) { // 20120725
return $this->dateConverter->convertToDisplayDate('Ynd', $date); return $this->dateConverter->convertToDisplayDate('Ynd', $date);
} else if (preg_match("/^[0-9]+\/[A-Za-z]{3}\/[0-9]{4}$/", $date) === 1) { // 13/jan/2012 } else if (preg_match("/^[0-9]+\/[A-Za-z]{3}\/[0-9]{4}$/", $date) === 1) {
// 13/jan/2012
return $this->dateConverter->convertToDisplayDate('d/M/Y', $date); return $this->dateConverter->convertToDisplayDate('d/M/Y', $date);
} else if (preg_match("/^[0-9]+\/[0-9]+\/[0-9]{4}$/", $date) === 1) { // 13/7/2012 } else if (preg_match("/^[0-9]+\/[0-9]+\/[0-9]{4}$/", $date) === 1) {
// 13/7/2012
return $this->dateConverter->convertToDisplayDate('d/M/Y', $date); return $this->dateConverter->convertToDisplayDate('d/M/Y', $date);
} else { } else {
throw new \Exception("Invalid date: $date"); throw new \Exception("Invalid date: $date");
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment