Beispiel #1
0
 static function loadHoldings($id)
 {
     global $interface;
     global $configArray;
     global $library;
     $showCopiesLineInHoldingsSummary = true;
     $showCheckInGrid = true;
     if ($library && $library->showCopiesLineInHoldingsSummary == 0) {
         $showCopiesLineInHoldingsSummary = false;
     }
     $interface->assign('showCopiesLineInHoldingsSummary', $showCopiesLineInHoldingsSummary);
     if ($library && $library->showCheckInGrid == 0) {
         $showCheckInGrid = false;
     }
     $interface->assign('showCheckInGrid', $showCheckInGrid);
     try {
         $catalog = new CatalogConnection($configArray['Catalog']['driver']);
     } catch (PDOException $e) {
         // What should we do with this error?
         if ($configArray['System']['debug']) {
             echo '<pre>';
             echo 'DEBUG: ' . $e->getMessage();
             echo '</pre>';
         }
     }
     $holdingData = new stdClass();
     // Get Holdings Data
     if ($catalog->status) {
         $result = $catalog->getHolding($id);
         if (PEAR_Singleton::isError($result)) {
             PEAR_Singleton::raiseError($result);
         }
         if (count($result)) {
             $holdings = array();
             $issueSummaries = array();
             foreach ($result as $copy) {
                 if (isset($copy['type']) && $copy['type'] == 'issueSummary') {
                     $issueSummaries = $result;
                     break;
                 } else {
                     $holdings[$copy['location']][] = $copy;
                 }
             }
             if (isset($issueSummaries) && count($issueSummaries) > 0) {
                 $interface->assign('issueSummaries', $issueSummaries);
                 $holdingData->issueSummaries = $issueSummaries;
             } else {
                 $interface->assign('holdings', $holdings);
                 $holdingData->holdings = $holdings;
             }
         } else {
             $interface->assign('holdings', array());
             $holdingData->holdings = array();
         }
         // Get Acquisitions Data
         $result = $catalog->getPurchaseHistory($id);
         if (PEAR_Singleton::isError($result)) {
             PEAR_Singleton::raiseError($result);
         }
         $interface->assign('history', $result);
         $holdingData->history = $result;
         //Holdings summary
         $result = $catalog->getStatusSummary($id, false);
         if (PEAR_Singleton::isError($result)) {
             PEAR_Singleton::raiseError($result);
         }
         $holdingData->holdingsSummary = $result;
         $interface->assign('holdingsSummary', $result);
         $interface->assign('formattedHoldingsSummary', $interface->fetch('Record/holdingsSummary.tpl'));
     }
     return $holdingData;
 }