Adding mailing fields into the export
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 29 Dec 2016 18:59:16 +0000 (13:59 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 29 Dec 2016 19:05:56 +0000 (14:05 -0500)
Add the 5 mailing fields into the member export.

models/admin/ajax/membersListExport.php
views/admin/ajax/membersListExport.html
views/admin/ajax/membersListExportCsv.html
views/admin/members/list.html

index e4c65bb..c5e7bfc 100644 (file)
@@ -108,6 +108,11 @@ class GlmMembersAdmin_ajax_membersListExport extends GlmDataMemberInfo
             'exportCity'            => $this->checkFlag('exportCity'),
             'exportState'           => $this->checkFlag('exportState'),
             'exportZip'             => $this->checkFlag('exportZip'),
+            'exportMailingAddr1'    => $this->checkFlag('exportMailingAddr1'),
+            'exportMailingAddr2'    => $this->checkFlag('exportMailingAddr2'),
+            'exportMailingCity'     => $this->checkFlag('exportMailingCity'),
+            'exportMailingState'    => $this->checkFlag('exportMailingState'),
+            'exportMailingZip'      => $this->checkFlag('exportMailingZip'),
             'exportPhone'           => $this->checkFlag('exportPhone'),
             'exportTollFree'        => $this->checkFlag('exportTollFree'),
             'exportEmail'           => $this->checkFlag('exportEmail'),
index 3a60d59..46eb8da 100644 (file)
@@ -6,8 +6,8 @@
         <span style="float: right;"><b>Total found: {$memberCount}&nbsp;&nbsp;</b></span>
         <b>List&nbsp;of&nbsp;{$terms.term_member_plur_cap}</b>
         <br clear="all">
-        
-    
+
+
         <table>
             <thead>
                 <tr>
                     {if $select.exportCity}<th align="left">City</th>{/if}
                     {if $select.exportState}<th align="left">State</th>{/if}
                     {if $select.exportZip}<th align="left">ZIP</th>{/if}
+                    {if $select.exportMailingAddr1}<th align="left">Mailing Address</th>{/if}
+                    {if $select.exportMailingAddr2}<th align="left">Mailing Addr Line #2</th>{/if}
+                    {if $select.exportMailingCity}<th align="left">Mailing City</th>{/if}
+                    {if $select.exportMailingState}<th align="left">Mailing State</th>{/if}
+                    {if $select.exportMailingZip}<th align="left">Mailing ZIP</th>{/if}
                     {if $select.exportPhone}<th align="left">Phone</th>{/if}
                     {if $select.exportTollFree}<th align="left">Toll Free</th>{/if}
                     {if $select.exportEmail}<th align="left">E-Mail</th>{/if}
                     {if $select.exportCity}<td>{$m.city}</td>{/if}
                     {if $select.exportState}<td>{$m.state.value}</td>{/if}
                     {if $select.exportZip}<td>{$m.zip}</td>{/if}
+                    {if $select.exportMailingAddr1}<td>{$m.mailing_addr1}</td>{/if}
+                    {if $select.exportMailingAddr2}<td>{$m.mailing_addr2}</td>{/if}
+                    {if $select.exportMailingCity}<td>{$m.mailing_city}</td>{/if}
+                    {if $select.exportMailingState}<td>{$m.mailing_state.value}</td>{/if}
+                    {if $select.exportMailingZip}<td>{$m.mailing_zip}</td>{/if}
                     {if $select.exportPhone}<td>{$m.phone}</td>{/if}
                     {if $select.exportTollFree}<td>{$m.toll_free}</td>{/if}
                     {if $select.exportEmail}<td>{$m.email}</td>{/if}
                     {if $select.exportUrl}<td>{$m.url}</td>{/if}
                     {if $select.exportCategories}<td>
                {foreach $m.categories as $t}
-                        {$t.name}, 
+                        {$t.name},
                {/foreach}
                     </td>{/if}
-                    
+
                 </tr>
         {/foreach}
     {else}
@@ -61,6 +71,6 @@
     {/if}
             </tbody>
         </table>
-        
+
     </body>
-</html>
\ No newline at end of file
+</html>
index f2e9d88..abc1707 100644 (file)
@@ -9,6 +9,11 @@
 {if $select.exportCity}"City",{/if}
 {if $select.exportState}"State",{/if}
 {if $select.exportZip}"ZIP/Postal",{/if}
+{if $select.exportMailingAddr1}"Mailing Address",{/if}
+{if $select.exportMailingAddr2}"Mailing Addr Line #2",{/if}
+{if $select.exportMailingCity}"Mailing City",{/if}
+{if $select.exportMailingState}"Mailing State",{/if}
+{if $select.exportMailingZip}"Mailing ZIP/Postal",{/if}
 {if $select.exportPhone}"Phone",{/if}
 {if $select.exportTollFree}"Toll Free",{/if}
 {if $select.exportEmail}"E-Mail",{/if}
 {if $select.exportCity}"{$m.city}",{/if}
 {if $select.exportState}"{$m.state.value}",{/if}
 {if $select.exportZip}"{$m.zip}",{/if}
+{if $select.exportMailingAddr1}"{$m.mailing_addr1}",{/if}
+{if $select.exportMailingAddr2}"{$m.mailing_addr2}",{/if}
+{if $select.exportMailingCity}"{$m.mailing_city}",{/if}
+{if $select.exportMailingState}"{$m.mailing_state.value}",{/if}
+{if $select.exportMailingZip}"{$m.mailing_zip}",{/if}
 {if $select.exportPhone}"{$m.phone}",{/if}
 {if $select.exportTollFree}"{$m.toll_free}",{/if}
 {if $select.exportEmail}"{$m.email}",{/if}
@@ -36,4 +46,4 @@
 {if $select.exportCategories}"{foreach $m.categories as $t}{$t.name},{/foreach}"{/if}
 
 {/foreach}
-{else}No {$terms.term_member_plur_cap} Selected{/if}
\ No newline at end of file
+{else}No {$terms.term_member_plur_cap} Selected{/if}
index 5410b6f..4ad186d 100644 (file)
@@ -1,5 +1,5 @@
 {include file='admin/members/header.html'}
-    
+
     <form action="{$thisUrl}?page={$thisPage}" method="post" id="searchForm">
         <input type="hidden" name="glm_action" value="list">
         <input type="hidden" name="prevStart" value="{$prevStart}">
                 <b>Pending Only: </b><input type="checkbox" id="filterPending" class="listFilter"{if $filterPending} checked{/if} style="margin-right: 1em;">
                 <b>Text Search: </b><input  class="glmMembersSearch" type="text" name="text_search" id="autoTest">
        </p>
-        
+
         <p><b>Total found:</b> {$memberCount}&nbsp;&nbsp;</p>
 
-        <br clear="all">        
+        <br clear="all">
         <!-- Add Member Type Button and Dialog Box -->
-        <div id="exportMembersButton" class="button button-secondary glm-right">Export {$terms.term_member_plur_cap}</div>    
-              
+        <div id="exportMembersButton" class="button button-secondary glm-right">Export {$terms.term_member_plur_cap}</div>
+
         {if $paging}
             <input type="Submit" name="pageSelect" value="Previous {$limit} {$terms.term_member_plur_cap}" class="button button-secondary glm-button"{if !$prevStart} disabled{/if}>
             <input type="Submit" name="pageSelect" value="Next {$limit} {$terms.term_member_plur_cap}" class="button button-secondary glm-button"{if !$nextStart} disabled{/if}>
-        {/if}    
-        
+        {/if}
+
         <table class="wp-list-table striped glm-admin-table">
             <thead>
                 <tr>
@@ -48,7 +48,7 @@
     {if $haveMembers}
         {assign var="i" value="0"}
         {foreach $members as $m}
-            {if $i++ is odd by 1} 
+            {if $i++ is odd by 1}
                 <tr>
             {else}
                 <tr class="alternate">
@@ -83,7 +83,7 @@
         {if $paging}
             <input type="Submit" name="pageSelect" value="Previous {$limit} {$terms.term_member_plur_cap}" class="button button-secondary glm-button"{if !$prevStart} disabled{/if}>
             <input type="Submit" name="pageSelect" value="Next {$limit} {$terms.term_member_plur_cap}" class="button button-secondary glm-button"{if !$nextStart} disabled{/if}>
-        {/if}    
+        {/if}
 
     </form>
 
                                     <input type="checkbox" name="exportPriContactEmail" checked> Primary Contact E-Mail<br>
                                     <input type="checkbox" name="exportUrl" checked> Web Address (URL)<br>
                                     <input type="checkbox" name="exportCategories" checked> Categories<br>
+                                    <input type="checkbox" name="exportMailingAddr1" checked> Mailing Address Line #1<br>
+                                    <input type="checkbox" name="exportMailingAddr2" checked> Mailing Address Line #2<br>
+                                    <input type="checkbox" name="exportMailingCity" checked> Mailing City<br>
+                                    <input type="checkbox" name="exportMailingState" checked> Mailing State<br>
+                                    <input type="checkbox" name="exportMailingZip" checked> Mailing ZIP/Postal Code<br>
                                 </td>
                             </tr>
                         </table>
                     </td>
-                </tr>                         
+                </tr>
                 <tr>
                     <th>Export to: </th>
                     <td>
                         <input type="radio" name="type" value="print" checked="checked"> Export for Print<br>
                         <input type="radio" name="type" value="csv"> Export to Spreadsheet (CSV)
                     </td>
-                </tr>       
+                </tr>
             </table>
             <a id="exportMembersCancel" class="button button-secondary glm-right">Cancel</a>
             <input type="submit" value="Export" class="button button-primary">
 
     <script type="text/javascript">
         jQuery(document).ready(function($) {
-            
-            
+
+
             $("#exportMembersDialog").dialog({
                 autoOpen: false,
                 minWidth: 600,
             $('#exportMembersCancel').click( function() {
                 $("#exportMembersDialog").dialog("close");
             });
-            
+
             // Filter triggers
             $(".listFilter" ).change( function() {
-                
+
                 var filter = '';
-                
+
                 // Check for archived filter
                 if ($("#filterArchived").attr('checked')) {
                     filter += '&filterArchived=true';
                 }
-                
+
                 // Check for pending data filter
                 if ($("#filterPending").attr('checked')) {
                     filter += '&filterPending=true';
                 }
-                
+
                 // Check for featured data filter
                 if ($("#filterFeatured").attr('checked')) {
                     filter += '&filterFeatured=true';
                 }
-                
+
                 window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=list" + filter;
-                
+
                 return false;
             });
-            
+
             // Perform Export
             $("#glmMembersExport").on( 'click', function() {
                 window.open("{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=membersListExport&type=print", 'Member Export');
                 window.open("{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=membersListExport&type=csv", 'Member Export CSV');
                 return false;
             });
-            
+
             /*
              * Do autocomplete search for member
              * label: What will be searched
              * value: What will be displayed when selected
              * id: Member id added so we can go to the member while showing what was selected
-             * Also note that autocomplete does not properly render HTML codes, so we 
+             * Also note that autocomplete does not properly render HTML codes, so we
              * "unescape" them for HTML in Smarty.
              */
 
                 { label: "{$m.name|unescape:'html'|replace:'"':''}", value: "{$m.name|unescape:'html'|replace:'"':''}", id: '{$m.id}' },
     {/foreach}
              ];
-            
+
              // Autocomplete for list Text Search
              $( ".glmMembersSearch" ).autocomplete({
-                 
+
                  source: availableTags,
                  html: true,
                  position: { my : "right top", at: "right bottom" },
                      }
                  }
              });
-             
+
              // Autocomplete for export Text field
              $( ".exportMembersSearch" ).autocomplete({
-                 
+
                  source: availableTags,
                  html: true,
                  position: { my : "right top", at: "right bottom" },
                      }
                  }
              });
-             
+
              // No submit on ENTER for pop-up export form
              jQuery.each($("#exportForm").find('input'), function(){
                  $(this).bind('keypress keydown keyup', function(e){
-                    if(e.keyCode == 13) { 
+                    if(e.keyCode == 13) {
                         $( ".exportMembersSearch" ).autocomplete("close");
-                        return false; 
+                        return false;
                     }
                  });
              });
-             
+
              // Restrict autocomplete list to a certain height with scrollbar
              $('.ui-autocomplete').css('height','200px').css('overflow-y','scroll');
 
              // Expand multi-select on hover
              $('#filterCategories').multiselect();
              $('#exportFilterCategories').multiselect();
-             
-             
+
+
         });
     </script>
-            
+
 
 {include file='admin/footer.html'}