Author: jablko
Date: Mon Nov  1 12:26:21 2010
New Revision: 8743

Log:
No reference code without identifier, fixes issue 1753

Modified:
   trunk/plugins/sfIsadPlugin/lib/sfIsadPlugin.class.php

Modified: trunk/plugins/sfIsadPlugin/lib/sfIsadPlugin.class.php
==============================================================================
--- trunk/plugins/sfIsadPlugin/lib/sfIsadPlugin.class.php       Mon Nov  1 
12:19:33 2010        (r8742)
+++ trunk/plugins/sfIsadPlugin/lib/sfIsadPlugin.class.php       Mon Nov  1 
12:26:21 2010        (r8743)
@@ -94,30 +94,42 @@
 
         if (sfConfig::get('app_inherit_code_informationobject'))
         {
-          $countryCode = null;
-          $repositoryCode = null;
+          if (!isset($this->resource->identifier))
+          {
+            return;
+          }
+
           $identifier = array();
+          $repository = null;
           foreach ($this->resource->ancestors->andSelf()->orderBy('lft') as 
$item)
           {
-            if (isset($item->repository))
+            if (isset($item->identifier))
             {
-              $countryCode = $item->repository->getCountryCode();
-              if (isset($countryCode))
-              {
-                $countryCode .= ' ';
-              }
-
-              $repositoryCode = "{$item->repository->identifier} ";
+              $identifier[] = $item->identifier;
             }
 
-            if (isset($item->identifier))
+            if (isset($item->repository))
             {
-              $identifier[] = $item->identifier;
+              $repository = $item->repository;
             }
           }
           $identifier = implode('-', $identifier);
 
-          return "$countryCode$repositoryCode$identifier";
+          if (isset($repository->identifier))
+          {
+            $identifier = "$repository->identifier $identifier";
+          }
+
+          if (isset($repository))
+          {
+            $countryCode = $repository->getCountryCode();
+            if (isset($countryCode))
+            {
+              $identifier = "$countryCode $identifier";
+            }
+          }
+
+          return $identifier;
         }
 
         return $this->resource->identifier;

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to