From 4f1857c1c608db090d89c46b63063287b6acbc7a Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Fri, 24 May 2013 13:36:25 -0400
Subject: [PATCH] Added RDA 264 support to place of publication loading.
 Resolves VUFIND-749.

---
 .../src/VuFind/RecordDriver/SolrMarc.php      | 35 ++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/module/VuFind/src/VuFind/RecordDriver/SolrMarc.php b/module/VuFind/src/VuFind/RecordDriver/SolrMarc.php
index 6e86ac47827..6d560340095 100644
--- a/module/VuFind/src/VuFind/RecordDriver/SolrMarc.php
+++ b/module/VuFind/src/VuFind/RecordDriver/SolrMarc.php
@@ -325,7 +325,40 @@ class SolrMarc extends SolrDefault
      */
     public function getPlacesOfPublication()
     {
-        return $this->getFieldArray('260');
+        // First check old-style 260a place:
+        $places = $this->getFieldArray('260');
+
+        // Now track down relevant RDA-style 264a places; we only care about
+        // copyright and publication places (and ignore copyright places if
+        // publication places are present).  This behavior is designed to be
+        // consistent with default SolrMarc handling of names/dates.
+        $pubPlaces = $copyPlaces = array();
+
+        $fields = $this->marcRecord->getFields('264');
+        if (is_array($fields)) {
+            foreach ($fields as $currentField) {
+                $currentPlace = $currentField->getSubfield('a');
+                $currentPlace = is_object($currentPlace)
+                    ? $currentPlace->getData() : null;
+                if (!empty($currentPlace)) {
+                    switch ($currentField->getIndicator('2')) {
+                    case '1':
+                        $pubPlaces[] = $currentPlace;
+                        break;
+                    case '4':
+                        $copyPlaces[] = $currentPlace;
+                        break;
+                    }
+                }
+            }
+        }
+        if (count($pubPlaces) > 0) {
+            $places = array_merge($places, $pubPlaces);
+        } else if (count($copyPlaces) > 0) {
+            $places = array_merge($places, $copyPlaces);
+        }
+
+        return $places;
     }
 
     /**
-- 
GitLab