From 339c3199704c02edf80b682f3f83616a42082ac2 Mon Sep 17 00:00:00 2001 From: tubia Date: Tue, 27 Sep 2016 17:14:48 +0200 Subject: [PATCH] normalisation of surname --- rebal.php | 24 ++++++++++++++++++++++++ rebalqt/RebalUI/RebalUI.qml | 17 +++++++++++++++++ rebalqt/RebalUI/RebalUI.qmlproject | 20 ++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 rebalqt/RebalUI/RebalUI.qml create mode 100644 rebalqt/RebalUI/RebalUI.qmlproject diff --git a/rebal.php b/rebal.php index 80b38de..5e10d38 100644 --- a/rebal.php +++ b/rebal.php @@ -24,6 +24,7 @@ $args = Docopt::handle($doc, array('version'=>'RebAl-CLI 0.1')); // print $k.': '.$v.PHP_EOL; $in = $args['']; $out = $args['']; +$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"; diff --git a/rebalqt/RebalUI/RebalUI.qml b/rebalqt/RebalUI/RebalUI.qml new file mode 100644 index 0000000..b3d4ef3 --- /dev/null +++ b/rebalqt/RebalUI/RebalUI.qml @@ -0,0 +1,17 @@ +import QtQuick 2.0 + +Rectangle { + width: 360 + height: 360 + Text { + anchors.centerIn: parent + text: "Hello World" + } + MouseArea { + anchors.fill: parent + onClicked: { + Qt.quit(); + } + } +} + diff --git a/rebalqt/RebalUI/RebalUI.qmlproject b/rebalqt/RebalUI/RebalUI.qmlproject new file mode 100644 index 0000000..c2c19cd --- /dev/null +++ b/rebalqt/RebalUI/RebalUI.qmlproject @@ -0,0 +1,20 @@ +/* File generated by Qt Creator */ + +import QmlProject 1.1 + +Project { + mainFile: "RebalUI.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ "../exampleplugin" ] +}