|
@@ -24,6 +24,7 @@ $args = Docopt::handle($doc, array('version'=>'RebAl-CLI 0.1'));
|
|
|
// print $k.': '.$v.PHP_EOL;
|
|
|
$in = $args['<input>'];
|
|
|
$out = $args['<output>'];
|
|
|
+$count = 0;
|
|
|
// Retrieve a set of MARC records from a file
|
|
|
$entries = new File_MARC($in);
|
|
|
// Prepare to write the new MARC file
|
|
@@ -34,6 +35,7 @@ while ($record = $entries->next()) {
|
|
|
// Get the UNIMARC author field and iterate through subfields
|
|
|
// normalising the output if the Name is found without comma
|
|
|
$lead_authors = $record->getFields('700');
|
|
|
+ $sec_authors = $record->getFields('702');
|
|
|
foreach ($lead_authors as $auth) {
|
|
|
$a = $auth->getSubfield('a');
|
|
|
$b = $auth->getSubfield('b');
|
|
@@ -47,6 +49,28 @@ while ($record = $entries->next()) {
|
|
|
//print $b;
|
|
|
//print "\n";
|
|
|
}
|
|
|
+ if ($a) {
|
|
|
+ $adata= $a->getData();
|
|
|
+ $a->setData(ucwords(strtolower($adata)));
|
|
|
+ };
|
|
|
+ }
|
|
|
+ foreach ($sec_authors as $auth) {
|
|
|
+ $a = $auth->getSubfield('a');
|
|
|
+ $b = $auth->getSubfield('b');
|
|
|
+ if ($b && strpos($b, ',')) {
|
|
|
+ //print $b;
|
|
|
+ //print "\n";
|
|
|
+ $count++;
|
|
|
+ } else if ($b) {
|
|
|
+ $bdata = $b->getData();
|
|
|
+ $b->setData(', ' . $bdata);
|
|
|
+ //print $b;
|
|
|
+ //print "\n";
|
|
|
+ }
|
|
|
+ if ($a) {
|
|
|
+ $adata= $a->getData();
|
|
|
+ $a->setData(ucwords(strtolower($adata)));
|
|
|
+ };
|
|
|
}
|
|
|
fwrite($marc21_file, $record->toRaw());
|
|
|
//print "\n";
|