Update to fix the csv file for different groups of interests.
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 26 Jul 2016 20:37:49 +0000 (16:37 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 26 Jul 2016 20:37:49 +0000 (16:37 -0400)
When getting the entries for the file each one has to have all the group
name fields so it can properly put them into the file.

models/admin/leads/index.php

index ee705fb..a221772 100644 (file)
@@ -422,6 +422,12 @@ class GlmMembersAdmin_leads_index extends GlmDataLeadEntry
                         'date_submitted' => $lead['date_submitted'],
                         'source'         => $lead['source_id']['name'],
                     );
+                    // Add fields for group names
+                    if ( $groups ) {
+                        foreach ( $groups as $group ) {
+                            $out[$group['title']] = '';
+                        }
+                    }
                     if ( !$user_can_edit_leads ) {
                         unset(
                             $out['source']
@@ -514,12 +520,10 @@ class GlmMembersAdmin_leads_index extends GlmDataLeadEntry
             }
             // Get the record for this Entry.
             $entry = $this->editEntry( $this->entryId );
-            //echo '<pre>$entry: ' . print_r($entry, true) . '</pre>';
 
             // get the field from the leads table
             $leadData = new GlmDataLeads( $this->wpdb, $this->config  );
             $lead     = $leadData->getEntry( $entry['fieldData']['lead_id']['value'] );
-            //echo '<pre>$lead: ' . print_r($lead, true) . '</pre>';
 
             // Use the edit view file.
             $view = 'edit.html';
@@ -605,7 +609,6 @@ class GlmMembersAdmin_leads_index extends GlmDataLeadEntry
                 $lead_id = $this->wpdb->insert_id;
             } else {
                 $lead_id = $lead['id'];
-                echo '<pre>$lead: ' . print_r($lead, true) . '</pre>';
             }
             if ( !isset( $lead_id ) && !$lead_id ) {
                 die( 'Fatal Error: Cannot generate lead_id for new leads record' );