Пример #1
0
 /**
  * Get the bibliographic level of the current record.
  *
  * @return string
  */
 public function getBibliographicLevel()
 {
     $leader = $this->marcRecord->getLeader();
     $biblioLevel = strtoupper($leader[7]);
     switch ($biblioLevel) {
         case 'M':
             // Monograph
             return "Monograph";
         case 'S':
             // Serial
             return "Serial";
         case 'A':
             // Monograph Part
             return "MonographPart";
         case 'B':
             // Serial Part
             return "SerialPart";
         case 'C':
             // Collection
             return "Collection";
         case 'D':
             // Collection Part
             return "CollectionPart";
         default:
             return "Unknown";
     }
 }
    if (array_key_exists($patronData['030_BARCODE'][0], $allPatrons)) {
        //already have this patron, must be a secondary address
        echo "Warning duplicate student number exists {$patronData['030_BARCODE'][0]}\n";
    } else {
        $allPatrons[$patronData['030_BARCODE'][0]] = $patronData;
    }
}
//End reading raw data export
echo "Loaded " . count($allPatrons) . " from data extract, {$numInvalidBarcodes} Barcodes were removed because they were invalid.\n";
$patronsWritten = 0;
$finalFile = $libraryAddsFileName . ".mrc";
$finalFileHnd = fopen($finalFile, 'wb');
$numBlocked = 0;
foreach ($allPatrons as $patronData) {
    $record = new File_MARC_Record();
    $leader = $record->getLeader();
    $leader[5] = 'n';
    $leader[6] = 'a';
    $leader[7] = 'm';
    $record->setLeader($leader);
    //030 = barcode, repeatable
    foreach ($patronData['030_BARCODE'] as $pBarcode) {
        $record->appendField(new File_MARC_Data_Field('030', array(new File_MARC_Subfield('a', $pBarcode))));
    }
    //080 = expiration date
    $record->appendField(new File_MARC_Data_Field('080', array(new File_MARC_Subfield('a', $patronData['080_EXP_DATE']))));
    //081 = age group
    $record->appendField(new File_MARC_Data_Field('081', array(new File_MARC_Subfield('a', $patronData['081_AGE_GRP']))));
    //082 = pcode2 REG LIB : should be 3 MNPS for all patrons initially enrolled via MNPS data
    $record->appendField(new File_MARC_Data_Field('082', array(new File_MARC_Subfield('a', $patronData['082_REG_LIB']))));
    //083 = zip/PCODE3?