diff --git a/module/VuFind/src/VuFind/ILS/Driver/Amicus.php b/module/VuFind/src/VuFind/ILS/Driver/Amicus.php index 9301c0fd682ffb67cf83a1f18f43921f948251a9..2a5042108a497fe1fa13f73bc9816162b76cb990 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Amicus.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Amicus.php @@ -469,7 +469,6 @@ class Amicus extends AbstractBase implements TranslatorAwareInterface foreach ($possibleQueries as $sql) { // Execute SQL try { - $holding = array(); $sqlStmt = $this->db->prepare($sql); $sqlStmt->execute(); } catch (PDOException $e) { @@ -477,7 +476,6 @@ class Amicus extends AbstractBase implements TranslatorAwareInterface } // Build Holdings Array - $i = 0; $data = array(); while ($row = $sqlStmt->fetch(PDO::FETCH_ASSOC)) { // Determine Location @@ -491,7 +489,6 @@ class Amicus extends AbstractBase implements TranslatorAwareInterface $status = $this->sacaStatus($row['CPY_ID_NBR']); $availability = $this->determineAvailability(array($status)); - $signatura=$row['CALLNUMBER']; $currentItem = array( 'id' => $id, 'availability' => $availability['available'], @@ -744,7 +741,7 @@ class Amicus extends AbstractBase implements TranslatorAwareInterface 'zip' => $row['ZIP_POSTAL'], 'phone' => $row['TFNO'], 'email' => $row['EMAIL'], - 'GROUP' => $ROW['PATRON_GROUP_NAME']); + 'group' => $row['PATRON_GROUP_NAME']); return $patron; } else { return null; diff --git a/module/VuFind/src/VuFind/ILS/Driver/PICA.php b/module/VuFind/src/VuFind/ILS/Driver/PICA.php index d9cf60926c1345d6519c5cf652d7039d09e7478e..3104af0e1b900662d681f2f9c38643df5f6db3cf 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/PICA.php +++ b/module/VuFind/src/VuFind/ILS/Driver/PICA.php @@ -376,10 +376,11 @@ class PICA extends DAIA * @param string $recordId Record identifier * * @return bool True on success + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function renew($recordId) { - // TODO: rewrite this to use VuFind's standard renewMyItems() mechanism. + /* TODO: rewrite this to use VuFind's standard renewMyItems() mechanism. $URL = "/loan/DB={$this->dbsid}/LNG=DU/USERINFO"; $POST = array( "ACT" => "UI_RENEWLOAN", @@ -387,13 +388,15 @@ class PICA extends DAIA "BOR_PW" => $_SESSION['picauser']->getCatPassword() ); if (is_array($recordId) === true) { + // TODO: fix this; something seems wrong with the logic foreach ($recordId as $rid) { array_push($POST['VB'], $recordId); } } else { $POST['VB'] = $recordId; } - $postit = $this->postit($URL, $POST); + $this->postit($URL, $POST); + */ return true; } @@ -408,11 +411,10 @@ class PICA extends DAIA * @throws \VuFind\Exception\Date * @throws ILSException * @return mixed Array of the patron's fines on success. + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function getMyFines($patron) { - // The patron comes as an array... - $p = $patron[0]; $URL = "/loan/DB={$this->dbsid}/LNG=DU/USERINFO"; $POST = array( "ACT" => "UI_LOC", @@ -423,7 +425,6 @@ class PICA extends DAIA // How many items are there? $holds = substr_count($postit, '<td class="plain"')/3; - $ppns = array(); $fineDate = array(); $description = array(); $fine = array(); @@ -624,6 +625,8 @@ class PICA extends DAIA */ protected function postit($file, $data_to_send) { + // TODO: can we use Zend\Http\Client here instead? + // Parameter verarbeiten foreach ($data_to_send as $key => $dat) { $data_to_send[$key] @@ -641,6 +644,7 @@ class PICA extends DAIA $out .= "\r\n"; $out .= $postData; if (!$conex = @fsockopen($this->catalogHost, "80", $errno, $errstr, 10)) { + error_log($errno . ': ' . $errstr); return 0; } fwrite($conex, $out); diff --git a/module/VuFind/src/VuFind/ILS/Driver/Polaris.php b/module/VuFind/src/VuFind/ILS/Driver/Polaris.php index 1c82230f1f56f28b429f3dbcfb7e3f9f55347bfc..b40dae9d7581943f670d3458da8bbbfeac8d9e8f 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Polaris.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Polaris.php @@ -352,9 +352,6 @@ class Polaris extends AbstractBase implements \VuFindHttp\HttpServiceAwareInterf */ public function placeHold($holdDetails) { - $api_query = 'holdrequest'; - $http_method = 'POST'; - // what do workstation & userid really mean in this context? $workstationid = '1'; $userid = '1'; diff --git a/module/VuFind/src/VuFind/ILS/Driver/Sierra.php b/module/VuFind/src/VuFind/ILS/Driver/Sierra.php index ca65c50cecc37bf8cf35274af3ade16229c829ba..6eba97bd130776f92980e71940829e14f2db4501 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Sierra.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Sierra.php @@ -445,7 +445,7 @@ class Sierra extends AbstractBase ON (item_view.id = varfield_view.record_id) WHERE item_view.id = $1 AND varfield_view.record_type_code = 'i';"; - $prep_query = pg_prepare($this->db, "prep_query", $query1); + pg_prepare($this->db, "prep_query", $query1); foreach ($itemIds as $item) { $callnumber = null; $results1 = pg_execute($this->db, "prep_query", array($item)); diff --git a/module/VuFind/src/VuFind/ILS/Driver/Symphony.php b/module/VuFind/src/VuFind/ILS/Driver/Symphony.php index af61b0b5051d908714d8cc1e7042f9c555fff849..ae549bd56670e7fd75c70e2aaf15f0233e3d605c 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Symphony.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Symphony.php @@ -400,7 +400,6 @@ class Symphony extends AbstractBase implements ServiceLocatorAwareInterface 'barcode' => $result['barcode number'], 'item_id' => $result['barcode number'], 'library' => $library, - 'material' => $material ); } } diff --git a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php index 0359cc7014085636889d5af88dd41aa2f0333257..1650f7159c3072c7eee0e69c3ca74895a87c595c 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php +++ b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php @@ -441,6 +441,27 @@ class VoyagerRestful extends Voyager implements \VuFindHttp\HttpServiceAwareInte return $transactions; } + /** + * Is the selected pickup location valid for the hold? + * + * @param string $pickUpLocation Selected pickup location + * @param array $patron Patron information returned by the patronLogin + * method. + * @param array $holdDetails Details of hold being placed + * + * @return bool + */ + protected function pickUpLocationIsValid($pickUpLocation, $patron, $holdDetails) + { + $pickUpLibs = $this->getPickUpLocations($patron, $holdDetails); + foreach ($pickUpLibs as $location) { + if ($location['locationID'] == $pickUpLocation) { + return true; + } + } + return false; + } + /** * Get Pick Up Locations * @@ -1058,15 +1079,7 @@ class VoyagerRestful extends Voyager implements \VuFindHttp\HttpServiceAwareInte } // Make Sure Pick Up Library is Valid - $pickUpValid = false; - $pickUpLibs = $this->getPickUpLocations($patron, $holdDetails); - foreach ($pickUpLibs as $location) { - if ($location['locationID'] == $pickUpLocation) { - $pickUpValid = true; - } - } - if (!$pickUpValid) { - // Invalid Pick Up Point + if (!$this->pickUpLocationIsValid($pickUpLocation, $patron, $holdDetails)) { return $this->holdError("hold_invalid_pickup"); } diff --git a/module/VuFind/src/VuFind/Sitemap.php b/module/VuFind/src/VuFind/Sitemap.php index 5cf0fac7031d8995f5f7a7d117542dadb3cbbb16..cdb5f1f3b7d300817ea54f26dfcaf1b3bedf19ca 100644 --- a/module/VuFind/src/VuFind/Sitemap.php +++ b/module/VuFind/src/VuFind/Sitemap.php @@ -197,7 +197,7 @@ class Sitemap } else { $filename = $this->getFilenameForPage($currentPage); $smf = $this->openSitemapFile($filename, 'urlset'); - foreach ($currentPageInfo as $item => $count) { + foreach (array_keys($currentPageInfo->toArray()) as $item) { $loc = htmlspecialchars($recordUrl . urlencode($item)); if (strpos($loc, 'http') === false) { $loc = 'http://'.$loc; diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/NamedList.php b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/NamedList.php index 07b59c95125a186eba3d091850219168ee78da19..c513bc1c590e968bed1656f9fc02930c8767e9a0 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/NamedList.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/NamedList.php @@ -73,6 +73,20 @@ class NamedList implements Countable, Iterator $this->list = $list; } + /** + * Convert the named list into a standard associative array. + * + * @return array + */ + public function toArray() + { + $arr = array(); + foreach ($this as $k => $v) { + $arr[$k] = $v; + } + return $arr; + } + /// Countable /** diff --git a/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/Solr/Response/Json/NamedListTest.php b/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/Solr/Response/Json/NamedListTest.php index 60ea5accaed7e6949f7a1dcde803dcc61da6527a..26dd4278a33dafdf4f91123caed521bf4490388d 100644 --- a/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/Solr/Response/Json/NamedListTest.php +++ b/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/Solr/Response/Json/NamedListTest.php @@ -68,4 +68,15 @@ class NamedListTest extends TestCase $list = new NamedList(array(array('first term', 'info'), array('second term', 'info'))); $this->assertEquals(2, count($list)); } + + /** + * Test converting the list to an array. + * + * @return void + */ + public function testToArray() + { + $list = new NamedList(array(array('first term', 'info'), array('second term', 'info2'))); + $this->assertEquals(array('first term' => 'info', 'second term' => 'info2'), $list->toArray()); + } } \ No newline at end of file