Contacts: Add check for parent, Associated Member title
authorLaury GvR <laury@gaslightmedia.com>
Mon, 2 Oct 2017 20:18:19 +0000 (16:18 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Mon, 2 Oct 2017 20:18:19 +0000 (16:18 -0400)
On the contacts list, each child now has an Associated Member field
title (each parent does not) which is intended to have the same title
as the member (parent). Furthermore, a check was added to make sure
only the children of a particular parent show up under that parent
as well as making sure that parents with no subs that are still in
the array of parents won't try to output nonexistent subs.

glm-member-db-contacts/views/front/contacts/list.html

index 8c1be36..8cc6151 100644 (file)
@@ -92,18 +92,22 @@ and open the template in the editor.
                                             {if $contact.title}<div class="glm-contact-info-title">{$contact.title}</div>{/if}
                                             {if $contacts_with_subs !== false}
                                                 {foreach $contacts_with_subs as $contact_with_subs}
-
-                                                    {foreach $contact_with_subs["subs"] as $contact_sub}
-                                                        <div><span>{$contact_sub["title"]}{$contact_sub["fname"]}</span></div>
-                                                    {/foreach}
-                                                    
+                                                    <!-- Check whether the current contact ID is one of the parent elements -->
+                                                    <!-- and whether it has subs -->
+                                                    {if $contact_with_subs["id"] == $contact.id && "subs"|array_key_exists:$contact_with_subs}
+                                                        {foreach $contact_with_subs["subs"] as $contact_sub}
+                                                            <div><span>{$contact_sub["title"]}{$contact_sub["fname"]} {$contact_sub["lname"]}</span></div>
+                                                        {/foreach}
+                                                    {/if}
                                                 {/foreach}
                                             {/if}
                                         {/if}
                                         {if $contact.ref_type.name}
                                         <div class="glm-contact-info-member">
-                                            {if $contact.ref_dest_name}
-                                                {$contact.ref_dest_name}
+                                            {if $contact.primary_contact.value == false} 
+                                                {if $contact.ref_dest_name}
+                                                    Associated Member: {$contact.ref_dest_name}
+                                                {/if}
                                             {/if}
                                         </div>
                                         {/if}