Ejemplo n.º 1
0
 /**
  * Public method for getting item holdings from the catalog and selecting which
  * holding method to call
  *
  * @param string $id  A Bib ID
  * @param array  $ids A list of Source Records (if catalog is for a consortium)
  *
  * @return array A sorted results set
  */
 public function getHoldings($id, $ids = null)
 {
     $holdings = [];
     // Get Holdings Data
     if ($this->catalog) {
         // Retrieve stored patron credentials; it is the responsibility of the
         // controller and view to inform the user that these credentials are
         // needed for hold data.
         $patron = $this->ilsAuth->storedCatalogLogin();
         // Does this ILS Driver handle consortial holdings?
         $config = $this->catalog->checkFunction('Holds', compact('id', 'patron'));
         if (isset($config['consortium']) && $config['consortium'] == true) {
             $result = $this->catalog->getConsortialHoldings($id, $patron ? $patron : null, $ids);
         } else {
             $result = $this->catalog->getHolding($id, $patron ? $patron : null);
         }
         $mode = $this->catalog->getHoldsMode();
         if ($mode == "disabled") {
             $holdings = $this->standardHoldings($result);
         } else {
             if ($mode == "driver") {
                 $holdings = $this->driverHoldings($result, $config);
             } else {
                 $holdings = $this->generateHoldings($result, $mode, $config);
             }
         }
         $holdings = $this->processStorageRetrievalRequests($holdings, $id, $patron);
         $holdings = $this->processILLRequests($holdings, $id, $patron);
     }
     return $this->formatHoldings($holdings);
 }
Ejemplo n.º 2
0
 /**
  * Public method for getting item holdings from the catalog and selecting which
  * holding method to call
  *
  * @param string $id A Bib ID
  *
  * @return array A sorted results set
  */
 public function getHoldings($id)
 {
     $holdings = array();
     // Get Holdings Data
     if ($this->catalog) {
         // Retrieve stored patron credentials; it is the responsibility of the
         // controller and view to inform the user that these credentials are
         // needed for hold data.
         $patron = $this->account->storedCatalogLogin();
         $result = $this->catalog->getHolding($id, $patron);
         $mode = ILSConnection::getHoldsMode();
         if ($mode == "disabled") {
             $holdings = $this->standardHoldings($result);
         } else {
             if ($mode == "driver") {
                 $holdings = $this->driverHoldings($result);
             } else {
                 $holdings = $this->generateHoldings($result, $mode);
             }
         }
     }
     return $this->formatHoldings($holdings);
 }
Ejemplo n.º 3
0
 /**
  * checkRequestIsValid
  *
  * This is responsible for determining if an item is requestable
  *
  * @param string $id     The Bib ID
  * @param array  $data   An Array of item data
  * @param patron $patron An array of patron data
  *
  * @return string True if request is valid, false if not
  */
 public function checkRequestIsValid($id, $data, $patron)
 {
     $holdType = isset($data['holdtype']) ? $data['holdtype'] : "auto";
     $level = isset($data['level']) ? $data['level'] : "copy";
     $mode = "title" == $level ? ILSConnection::getTitleHoldsMode() : ILSConnection::getHoldsMode();
     if ("driver" == $mode && "auto" == $holdType) {
         $itemID = isset($data['item_id']) ? $data['item_id'] : false;
         $result = $this->determineHoldType($patron['id'], $id, $itemID);
         if (!$result || $result == 'block') {
             return false;
         }
     }
     return true;
 }