Esempio n. 1
0
 /**
  * Protected support method for getHolding.
  *
  * @param array  $data   Item Data
  * @param string $id     The BIB record id
  * @param mixed  $patron Patron Data or boolean false
  *
  * @return array Keyed data
  */
 protected function processHoldingData($data, $id, $patron = false)
 {
     $holding = parent::processHoldingData($data, $id, $patron);
     foreach ($holding as $i => $row) {
         $is_borrowable = isset($row['_fullRow']['ITEM_TYPE_ID']) ? $this->isBorrowable($row['_fullRow']['ITEM_TYPE_ID']) : false;
         $is_holdable = $this->itemHoldsEnabled && $this->isHoldable($row['_fullRow']['STATUS_ARRAY']);
         $isStorageRetrievalRequestAllowed = isset($this->config['StorageRetrievalRequests']) && $this->isStorageRetrievalRequestAllowed($row);
         $isILLRequestAllowed = isset($this->config['ILLRequests']) && $this->isILLRequestAllowed($row);
         // If the item cannot be borrowed or if the item is not holdable,
         // set is_holdable to false
         if (!$is_borrowable || !$is_holdable) {
             $is_holdable = false;
         }
         // Only used for driver generated hold links
         $addLink = false;
         $addStorageRetrievalLink = false;
         $holdType = '';
         $storageRetrieval = '';
         if ($is_holdable) {
             // Hold Type - If we have patron data, we can use it to determine if
             // a hold link should be shown
             if ($patron && $this->holdsMode == "driver") {
                 // This limit is set as the api is slow to return results
                 if ($i < $this->holdCheckLimit && $this->holdCheckLimit != "0") {
                     $holdType = $this->determineHoldType($patron['id'], $row['id'], $row['item_id']);
                     $addLink = $holdType ? $holdType : false;
                 } else {
                     $holdType = "auto";
                     $addLink = "check";
                 }
             } else {
                 $holdType = "auto";
             }
         }
         if ($isStorageRetrievalRequestAllowed) {
             if ($patron) {
                 if ($i < $this->callSlipCheckLimit && $this->callSlipCheckLimit != "0") {
                     $storageRetrieval = $this->checkItemRequests($patron['id'], 'callslip', $row['id'], $row['item_id']);
                     $addStorageRetrievalLink = $storageRetrieval ? true : false;
                 } else {
                     $storageRetrieval = "auto";
                     $addStorageRetrievalLink = "check";
                 }
             } else {
                 $storageRetrieval = "auto";
             }
         }
         $ILLRequest = '';
         $addILLRequestLink = false;
         if ($patron && $isILLRequestAllowed) {
             $ILLRequest = 'auto';
             $addILLRequestLink = 'check';
         }
         $holding[$i] += ['is_holdable' => $is_holdable, 'holdtype' => $holdType, 'addLink' => $addLink, 'level' => "copy", 'storageRetrievalRequest' => $storageRetrieval, 'addStorageRetrievalRequestLink' => $addStorageRetrievalLink, 'ILLRequest' => $ILLRequest, 'addILLRequestLink' => $addILLRequestLink];
         unset($holding[$i]['_fullRow']);
     }
     return $holding;
 }
Esempio n. 2
0
 /**
  * Protected support method for getHolding.
  *
  * @param array $data   Item Data
  * @param mixed $patron Patron Data or boolean false
  *
  * @return array Keyed data
  */
 protected function processHoldingData($data, $patron = false)
 {
     $holding = parent::processHoldingData($data, $patron);
     $mode = ILSConnection::getHoldsMode();
     foreach ($holding as $i => $row) {
         $is_borrowable = isset($row['_fullRow']['ITEM_TYPE_ID']) ? $this->isBorrowable($row['_fullRow']['ITEM_TYPE_ID']) : false;
         $is_holdable = $this->isHoldable($row['_fullRow']['STATUS_ARRAY']);
         // If the item cannot be borrowed or if the item is not holdable,
         // set is_holdable to false
         if (!$is_borrowable || !$is_holdable) {
             $is_holdable = false;
         }
         // Only used for driver generated hold links
         $addLink = false;
         // Hold Type - If we have patron data, we can use it to determine if a
         // hold link should be shown
         if ($patron && $mode == "driver") {
             // This limit is set as the api is slow to return results
             if ($i < $this->holdCheckLimit && $this->holdCheckLimit != "0") {
                 $holdType = $this->determineHoldType($patron['id'], $row['id'], $row['item_id']);
                 $addLink = $holdType ? $holdType : false;
             } else {
                 $holdType = "auto";
                 $addLink = "check";
             }
         } else {
             $holdType = "auto";
         }
         $holding[$i] += array('is_holdable' => $is_holdable, 'holdtype' => $holdType, 'addLink' => $addLink, 'level' => "copy");
         unset($holding[$i]['_fullRow']);
     }
     return $holding;
 }