commit df6226aae191616dd6e8c56c060ea1f72bd25b79
Author: Andreas Kohlbecker <a.kohlbecker@bgbm.org>
Date:   Fri Apr 22 14:41:10 2016 +0200

    #5676 sensu for misalppied names without authorteam

diff --git a/modules/cdm_dataportal/includes/taxon.inc b/modules/cdm_dataportal/includes/taxon.inc
index 3e2c33f5..e4be344d 100644
--- a/modules/cdm_dataportal/includes/taxon.inc
+++ b/modules/cdm_dataportal/includes/taxon.inc
@@ -45,12 +45,14 @@
  */
 function cdm_taxonRelationships($taxonRelationships, $focusedTaxon){
 
+  static $NULL_AUTHORTEAM = 'NULL_AUTHORTEAM';
+
   if (!$taxonRelationships) {
     return null;
   }
 
-  RenderHints::pushToRenderStack('taxonRelationships');
-  $footnoteListKey = 'taxonRelationships';
+  RenderHints::pushToRenderStack('taxon_relationships');
+  $footnoteListKey = 'taxon_relationships';
   RenderHints::setFootnoteListKey($footnoteListKey);
 
   $misapplied = array();
@@ -63,14 +65,20 @@ function cdm_taxonRelationships($taxonRelationships, $focusedTaxon){
 
     if (in_array($taxonRelation->type->uuid, $taxon_relationship_types)) {
 
+
       if ($taxonRelation->type->uuid == UUID_MISAPPLIED_NAME_FOR || $taxonRelation->type->uuid == UUID_INVALID_DESIGNATION_FOR) {
 
+        RenderHints::pushToRenderStack('misapplied_name_for'); // TODO the render path string should in future come from $taxonRelation->type->...
+
         $name = $taxonRelation->fromTaxon->name->titleCache;
 
         if(isset($taxonRelation->fromTaxon->sec)) {
           // taxa not always are have a sec reference (e.g. doubtful taxa)
           $authorteam = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $taxonRelation->fromTaxon->sec->uuid);
           $authorteam = $authorteam->titleCache;
+          if(!$authorteam){
+            $authorteam = $NULL_AUTHORTEAM;
+          }
         }
 
         if (!isset($misapplied[$name])) {
@@ -78,7 +86,7 @@ function cdm_taxonRelationships($taxonRelationships, $focusedTaxon){
           $misapplied[$name]['out'] = cdm_related_taxon($taxonRelation->fromTaxon, UUID_MISAPPLIED_NAME_FOR);
         }
         else {
-          // We need to add the anchors for all of the other mispplied names not
+          // We need to add the anchors for all of the other misapplied names not
           // being rendered explicitly.
           $misapplied[$name]['out'] = uuid_anchor($taxonRelation->fromTaxon->uuid, $misapplied[$name]['out']);
         }
@@ -88,12 +96,16 @@ function cdm_taxonRelationships($taxonRelationships, $focusedTaxon){
           $misapplied[$name]['authorteam'][$authorteam] = '';
           $joinedAuthorTeams[$authorteam] = 'sensu ' . theme('cdm_reference', array('reference' => $taxonRelation->fromTaxon->sec));
         }
+
       }
       else {
+        RenderHints::pushToRenderStack('other_taxon_relationship');
         // All relationsship types but misapplied_name_for
         // invalid_designation_for.
         $taxon_relationships_lines[] = cdm_taxonRelationship($taxonRelation, TRUE, _is_invers_taxonRelationship($taxonRelation, $focusedTaxon));
       }
+
+      RenderHints::popFromRenderStack();
     }
   }
 
@@ -101,10 +113,12 @@ function cdm_taxonRelationships($taxonRelationships, $focusedTaxon){
   ksort($joinedAuthorTeams);
   foreach ($joinedAuthorTeams as $authorteam => $sensuCitation) {
     $footnoteKey = FootnoteManager::addNewFootnote($footnoteListKey, $sensuCitation);
-    $joinedAuthorTeams[$authorteam] = '<span class="sensu">sensu '
-      . $authorteam
-      . theme('cdm_footnote_key', array('footnoteKey' => $footnoteKey))
-      . '</span>';
+
+      $joinedAuthorTeams[$authorteam] = '<span class="sensu">'
+        . ($authorteam != $NULL_AUTHORTEAM ? 'sensu '. $authorteam : '')
+        . theme('cdm_footnote_key', array('footnoteKey' => $footnoteKey))
+        . '</span>';
+
   }
 
   // ---- Generate output ---- //
diff --git a/modules/cdm_dataportal/settings.php b/modules/cdm_dataportal/settings.php
index 1a7495fa..690c75e8 100644
--- a/modules/cdm_dataportal/settings.php
+++ b/modules/cdm_dataportal/settings.php
@@ -264,13 +264,21 @@ define('CDM_NAME_RENDER_TEMPLATES_DEFAULT', serialize(
       'statusPart' => TRUE,
       'descriptionPart' => TRUE,
     ),
-    'related_taxon'=> array(
+    'related_taxon.other_taxon_relationship.taxon_relationships.taxon_page_synonymy'=> array(
       'nameAuthorPart' => array('#uri' => TRUE),
       'referencePart' => TRUE,
       'statusPart' => TRUE,
       'secReferencePart' => TRUE,
       'descriptionPart' => TRUE,
     ),
+    'related_taxon.misapplied_name_for.taxon_relationships.taxon_page_synonymy' => array(
+      'nameAuthorPart' => array('#uri' => TRUE),
+      'referencePart' => TRUE,
+      'statusPart' => TRUE,
+      /* no sec ref in this case, misapplied names are
+       * de-duplicated and the sec ref is shown as footnote */
+      'descriptionPart' => TRUE,
+    ),
     'homonym'=> array(
         'nameAuthorPart' => array('#uri' => TRUE),
         'referenceYearPart' => TRUE,
