Exemplo n.º 1
0
 /**
  * Support method for getItemStatuses() -- Get Axiell Full Item Status
  *
  * @param array  $holdings Holdings for the record
  * @param object $catalog  Catalog connection
  * @param array  $patron   Patron
  *
  * @return void
  * @access public
  * @author Erik Henriksson <*****@*****.**>
  * @author Ere Maijala <*****@*****.**>
  */
 protected function getAxiellItemStatusFull($holdings, $catalog, $patron)
 {
     global $interface;
     global $configArray;
     $itemCount = 0;
     $requestCount = 0;
     $locationCount = 0;
     $branchCount = 0;
     $availableLocationCount = 0;
     $availableCount = 0;
     $itemStatusText = '';
     $closestDueDate = '';
     $closestDueDateStamp = 0;
     $journal = false;
     $itemStatusText = '';
     $isHoldable = false;
     foreach ($holdings as &$location) {
         if (is_array($location)) {
             $journal = isset($location['journal']) && $location['journal'];
             if (is_array($location['holdings'])) {
                 foreach ($location['holdings'] as $holding) {
                     if (isset($holding['total'])) {
                         $itemCount += $holding['total'];
                     }
                     if (isset($holding['status']) && trim($holding['status']) === JSON::REFERENCE_DESK_STATUS) {
                         $location['status']['availableCount']++;
                     }
                     $branchCount++;
                 }
             }
             if (isset($location['status'])) {
                 if (isset($location['status']['reservations']) && $location['status']['reservations'] > $requestCount) {
                     $requestCount = $location['status']['reservations'];
                 }
                 if (isset($location['status']['available']) && $location['status']['available']) {
                     $availableLocationCount++;
                 }
                 if (isset($location['status']['availableCount']) && $location['status']['availableCount'] > 0) {
                     $availableCount += $location['status']['availableCount'];
                 }
                 if (isset($location['status']['text']) && $location['status']['text'] != '' && $closestDueDate == '') {
                     $itemStatusText = $location['status']['text'];
                 }
                 if (isset($location['status']['dueDateStamp']) && $location['status']['dueDateStamp'] != '' && isset($location['status']['closestDueDate']) && $location['status']['closestDueDate'] != '') {
                     $dueDate = $location['status']['dueDateStamp'];
                     if ($closestDueDateStamp < $dueDate) {
                         $closestDueDate = $location['status']['closestDueDate'];
                         if (isset($location['status']['text']) && $location['status']['text'] != '') {
                             $itemStatusText = $location['status']['text'];
                         }
                     }
                 }
                 $locationCount++;
             }
             if (isset($location['is_holdable']) && $location['is_holdable']) {
                 $isHoldable = true;
             }
         }
     }
     $id = $holdings[0]['id'];
     $interface->assign('id', $id);
     $interface->assign('holdings', $holdings);
     $locationThreshold = isset($configArray['Site']['locationThreshold']) ? $configArray['Site']['locationThreshold'] : 5;
     $branchThreshold = isset($configArray['Site']['branchThreshold']) ? $configArray['Site']['branchThreshold'] : 15;
     $interface->assign('itemCount', $itemCount);
     $interface->assign('requestCount', $requestCount);
     $interface->assign('branchCount', $branchCount);
     $interface->assign('locationCount', $locationCount);
     $interface->assign('availableLocationCount', $availableLocationCount);
     $interface->assign('availableCount', $availableCount);
     $interface->assign('closestDueDate', $closestDueDate);
     $interface->assign('itemStatusText', $itemStatusText);
     $interface->assign('isHoldable', $isHoldable);
     $interface->assign('locationThreshold', $locationThreshold);
     $interface->assign('branchThreshold', $branchThreshold);
     $interface->assign('journal', $journal);
     $interface->assign('referenceDeskStatus', JSON::REFERENCE_DESK_STATUS);
     $db = ConnectionManager::connectToIndex();
     if (!($record = $db->getRecord($id))) {
         PEAR::raiseError(new PEAR_Error('Record Does Not Exist'));
     }
     $recordDriver = RecordDriverFactory::initRecordDriver($record);
     $interface->assign('patronFunctions', $recordDriver->hasPatronFunctions());
     if ("driver" == CatalogConnection::getHoldsMode()) {
         $interface->assign('driverMode', true);
     }
     if ("driver" == CatalogConnection::getTitleHoldsMode()) {
         $interface->assign('titleDriverMode', true);
     }
     if (!PEAR::isError($patron)) {
         $holdLogic = new HoldLogicTitle($catalog);
         $holdingTitleHold = $holdLogic->getHold($id, $patron);
         $interface->assign('holdingTitleHold', $holdingTitleHold);
     }
     return $interface->fetch('AJAX/holdings-axiell.tpl');
 }
Exemplo n.º 2
0
 /**
  * Get a link for placing a title level hold.
  *
  * @param array $patron An array of patron data
  *
  * @return mixed A url if a hold is possible, boolean false if not
  * @access protected
  */
 protected function getRealTimeTitleHold($patron = false)
 {
     global $configArray;
     $biblioLevel = $this->getBibliographicLevel();
     if ("monograph" == strtolower($biblioLevel) || stristr("part", $biblioLevel)) {
         $titleHoldEnabled = CatalogConnection::getTitleHoldsMode();
         if ($titleHoldEnabled != "disabled") {
             include_once 'sys/HoldLogicTitle.php';
             // Get ID and connect to catalog
             $id = $this->getUniqueID();
             $catalog = ConnectionManager::connectToCatalog();
             $holdLogic = new HoldLogicTitle($catalog);
             return $holdLogic->getHold($id, $patron);
         }
     }
     return false;
 }