Example #1
0
 /**
  * @param array|File_MARC_Record|string $record
  */
 public function __construct($record)
 {
     if ($record instanceof File_MARC_Record) {
         $this->marcRecord = $record;
     } elseif (is_string($record)) {
         require_once ROOT_DIR . '/sys/MarcLoader.php';
         $this->id = $record;
         $this->valid = MarcLoader::marcExistsForILSId($record);
     } else {
         // Call the parent's constructor...
         parent::__construct($record);
         // Also process the MARC record:
         require_once ROOT_DIR . '/sys/MarcLoader.php';
         $this->marcRecord = MarcLoader::loadMarcRecordFromRecord($record);
         if (!$this->marcRecord) {
             $this->valid = false;
         }
     }
     if (!isset($this->id) && $this->valid) {
         /** @var File_MARC_Data_Field $idField */
         global $configArray;
         $idField = $this->marcRecord->getField($configArray['Reindex']['recordNumberTag']);
         if ($idField) {
             $this->id = $idField->getSubfield('a')->getData();
         }
     }
     parent::loadGroupedWork();
 }