/** * Protected support method for getHolding. * * @param array $data Item Data * @param string $id The record id * @param mixed $patron Patron Data or boolean false * * @return array Keyed data * @access protected */ protected function processHoldingData($data, $id, $patron = false) { $holding = parent::processHoldingData($data, $id, $patron); $mode = CatalogConnection::getHoldsMode(); foreach ($holding as $i => $row) { $is_borrowable = $this->isBorrowable($row['_fullRow']['ITEM_TYPE_ID']); $is_holdable = $this->itemHolds && $this->isHoldable($row['_fullRow']['STATUS_ARRAY']); $isCallSlipAllowed = $this->isCallSlipAllowed($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; $addCallSlipLink = false; $holdType = ''; $callslip = ''; // Hold Type - If we have patron data, we can use it to dermine if a // hold link should be shown if ($is_holdable) { 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"; } } if ($isCallSlipAllowed) { if ($patron && $mode == "driver") { if ($i < $this->callSlipCheckLimit && $this->callSlipCheckLimit != "0") { $callslip = false; if ($this->isCallSlipAllowed($row)) { $callslip = $this->checkItemRequests($patron['id'], 'callslip', $row['id'], $row['item_id']); } } else { $callslip = "auto"; $addCallSlipLink = "check"; } } else { $callslip = "auto"; } } $UBRequest = ''; $addUBRequestLink = false; if ($patron && isset($this->config['UBRequests']['enabled']) && $this->config['UBRequests']['enabled']) { $UBRequest = 'auto'; $addUBRequestLink = 'check'; } $holding[$i] += array('is_holdable' => $is_holdable, 'holdtype' => $holdType, 'addLink' => $addLink, 'level' => "copy", 'callslip' => $callslip, 'addCallSlipLink' => $addCallSlipLink, 'ubrequest' => $UBRequest, 'addUBRequestLink' => $addUBRequestLink); unset($holding[$i]['_fullRow']); } return $holding; }
/** * Protected support method for getHolding. * * @param array $data Item Data * @param mixed $patron Patron Data or boolean false * * @return array Keyed data * @access protected */ protected function processHoldingData($data, $patron = false) { $holding = parent::processHoldingData($data, $patron); foreach ($holding as $i => $row) { $is_borrowable = $this->_isBorrowable($row['_fullRow']['ITEM_TYPE_ID']); $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 dermine if a // hold link should be shown if ($patron) { $holdType = $this->_determineHoldType($row['id'], $row['item_id'], $patron['id']); $addLink = $holdType ? $holdType : false; } else { $holdType = "auto"; } $holding[$i] += array('is_holdable' => $is_holdable, 'holdtype' => $holdType, 'addLink' => $addLink); unset($holding[$i]['_fullRow']); } return $holding; }