WordPress.org

Plugin Directory

Changeset 1502197


Ignore:
Timestamp:
09/25/16 13:09:17 (less than one hour ago)
Author:
Will Brownsberger
Message:

uid deleted after inbox refreh fix

Location:
wp-issues-crm/branches/maxajax
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wp-issues-crm/branches/maxajax/css/settings.css

    r1460287 r1502197  
    3636    border: dashed 1px #bbb; 
    3737} 
     38 
     39#wp_issues_crm_plugin_options_array\[imap_inbox\] { 
     40    width: 120px; 
     41} 
  • wp-issues-crm/branches/maxajax/js/help.js

    r1448112 r1502197  
    55 
    66    $( "#wic_help_button" ).on( "click", function ( event ) { 
    7          window.open( "http://wp-issues-crm.com" ); 
     7         window.open( "https://wordpress.org/support/plugin/wp-issues-crm" ); 
    88         event.stopImmediatePropagation(); 
    99    }); 
  • wp-issues-crm/branches/maxajax/php/entity/class-wic-entity-email-inbox.php

    r1501649 r1502197  
    142142 
    143143        // get the incoming message text and data 
    144         $message = new  WIC_DB_Email_Message_Object ( $wp_issues_crm_IMAP_stream, $UID );    
    145         //  apply_filters includes autop inserting <p> and output sanitization  
    146         $message_output = WIC_Entity_Email_Send::filter_rough_html_for_output( $message->raw_text_body ); 
    147         $issue_title = $data->issue > 0 ? WIC_DB_Access_WP::fast_title_lookup_by_id ( $data->issue ) : 'Not mapped'; 
    148         $message_details =  
    149             '<table class = "inbox_message_details wp-issues-crm-stats"> 
    150                 <tr><td>Date:</td><td>' . $message->date . '</td></tr> 
    151                 <tr><td>Email Address:</td><td>' . $message->email_address . '</td></tr> 
    152                 <tr><td>Phone:</td><td>' . $message->phone . '</td></tr> 
    153                 <tr><td>First Name:</td><td>' . $message->first_name . '</td></tr> 
    154                 <tr><td>Middle Name:</td><td>' . $message->middle_name . '</td></tr> 
    155                 <tr><td>Last Name</td><td>' . $message->last_name . '</td></tr> 
    156                 <tr><td>Address:</td><td>' . $message->address_line . '</td></tr> 
    157                 <tr><td>Apartment:</td><td>' . $message->apartment_only_line . '</td></tr> 
    158                 <tr><td>City:</td><td>' . $message->city . '</td></tr> 
    159                 <tr><td>State:</td><td>' . $message->state . '</td></tr> 
    160                 <tr><td>Zip:</td><td>' . $message->zip . '</td></tr> 
    161                 <tr><td>Parse Quality:</td><td>' . ( WIC_Entity_Email_Process::evaluate_parse_results ( $message ) ? 'Pass' : '<strong><em>Fail</em></strong> -- check Strictness Rule in settings.' ) . '</td></tr> 
    162             </table>'; 
    163  
    164         /* 
    165         * now get the templated related data 
    166         * 
    167         * Note regarding rules: 
    168         *   -- When client goes from inbox list view to individual subject line view, it does NOT bring over mapped issue (and does not have template) -- duplicate call here rather than store template 
    169         *       -- this also has the remote advantage that if user has remapped subject after filling inbox, will get latest value to show in preview 
    170         *   -- scrollMessage is called on first view, pointing to zero (has to be called to get first value) 
    171         *   -- scrollMessage calls this routine to get all data, so on first view, issue is blank and a mapping gets filled in  
    172         *   -- this means that user can revert to stored issue and pro_con mapping by blanking out the issue; 
    173         *       -- but don't overwrite any work user has done in template 
    174         */ 
    175         // if issue is blank or zero ( it is not unset), search for mapping from subject line 
    176         if ( ! $data->issue ) { 
    177             $found_array = WIC_Entity_Email_Subject::get_subject_line_mapping( $message->subject ); 
    178             // if found, set $data->issue and pro_con and template if blank 
    179             if ( $found_array ) { 
    180                 $data->issue        = $found_array['mapped_issue']; 
    181                 $data->pro_con      = $found_array['mapped_pro_con']; 
    182                 // if template is blank, also use that 
    183                 if ( '' == trim ( $data->template ) ) { 
    184                     $data->template = $found_array['mapped_reply_template']; 
     144        $message = new  WIC_DB_Email_Message_Object ( $wp_issues_crm_IMAP_stream, $UID ); 
     145        if ( false === $message->uid_still_valid ) { 
     146            $message_output = '<h3>Message deleted from server by another client since last Inbox refresh.</h3>' . 
     147                            '<p>Possibilities include:</p>'. 
     148                            '<ol><li>You have WP Issues CRM up on another page?</li> 
     149                            <li>You deleted it through your standard mail client?</li> 
     150                            <li>WP Issues CRM autorun is enabled and just ran through and handled this message?   
     151                            Only possible for previously trained subject lines.</li> 
     152                            </ol>'; 
     153            $message_details = ''; 
     154            $templated_reply = ''; 
     155        } else { 
     156            $message_output = WIC_Entity_Email_Send::filter_rough_html_for_output( $message->raw_text_body ); 
     157            $message_details =  
     158                '<table class = "inbox_message_details wp-issues-crm-stats"> 
     159                    <tr><td>Date:</td><td>' . $message->date . '</td></tr> 
     160                    <tr><td>Email Address:</td><td>' . $message->email_address . '</td></tr> 
     161                    <tr><td>Phone:</td><td>' . $message->phone . '</td></tr> 
     162                    <tr><td>First Name:</td><td>' . $message->first_name . '</td></tr> 
     163                    <tr><td>Middle Name:</td><td>' . $message->middle_name . '</td></tr> 
     164                    <tr><td>Last Name</td><td>' . $message->last_name . '</td></tr> 
     165                    <tr><td>Address:</td><td>' . $message->address_line . '</td></tr> 
     166                    <tr><td>Apartment:</td><td>' . $message->apartment_only_line . '</td></tr> 
     167                    <tr><td>City:</td><td>' . $message->city . '</td></tr> 
     168                    <tr><td>State:</td><td>' . $message->state . '</td></tr> 
     169                    <tr><td>Zip:</td><td>' . $message->zip . '</td></tr> 
     170                    <tr><td>Parse Quality:</td><td>' . ( WIC_Entity_Email_Process::evaluate_parse_results ( $message ) ? 'Pass' : '<strong><em>Fail</em></strong> -- check Strictness Rule in settings.' ) . '</td></tr> 
     171                </table>'; 
     172            /* 
     173            * now get the templated related data 
     174            * 
     175            * Note regarding rules: 
     176            *   -- When client goes from inbox list view to individual subject line view, it does NOT bring over mapped issue (and does not have template) -- duplicate call here rather than store template 
     177            *       -- this also has the remote advantage that if user has remapped subject after filling inbox, will get latest value to show in preview 
     178            *   -- scrollMessage is called on first view, pointing to zero (has to be called to get first value) 
     179            *   -- scrollMessage calls this routine to get all data, so on first view, issue is blank and a mapping gets filled in  
     180            *   -- this means that user can revert to stored issue and pro_con mapping by blanking out the issue; 
     181            *       -- but don't overwrite any work user has done in template 
     182            */ 
     183            if ( ! $data->issue ) { 
     184                $found_array = WIC_Entity_Email_Subject::get_subject_line_mapping( $message->subject ); 
     185                // if found, set $data->issue and pro_con and template if blank 
     186                if ( $found_array ) { 
     187                    $data->issue        = $found_array['mapped_issue']; 
     188                    $data->pro_con      = $found_array['mapped_pro_con']; 
     189                    // if template is blank, also use that 
     190                    if ( '' == trim ( $data->template ) ) { 
     191                        $data->template = $found_array['mapped_reply_template']; 
     192                    } 
    185193                } 
    186             } 
    187         }  
    188          
    189         // if template is still blank, update from master 
    190         if ( '' == trim ( $data->template ) ) { 
    191             $form_variables_object = unserialize ( get_option ( 'wp-issues-crm-email-processing-options' ) ); 
    192             $data->template = $form_variables_object->reply_template; 
    193         } 
     194            }  
     195         
     196            // if template is still blank, update from master 
     197            if ( '' == trim ( $data->template ) ) { 
     198                $form_variables_object = unserialize ( get_option ( 'wp-issues-crm-email-processing-options' ) ); 
     199                $data->template = $form_variables_object->reply_template; 
     200            } 
    194201             
    195         // generate templated reply 
    196         if ( $data->issue && trim ( $data->template ) ) { 
    197             $sample_object = array (  
    198                 (object) array ( 
    199                     'first_name' => $message->first_name, 
    200                     'last_name' => $message->last_name, 
    201                     'issue' => $data->issue, 
    202                     'original_subject' => $message->subject, 
    203                     'activity_note' => $message->raw_text_body, // the sanitized, but still punctuated, incoming text 
    204                     'pro_con' => $data->pro_con,         
    205                 ), 
    206                 (object) array ( 
    207                     'mapped_reply_template' => $data->template, 
    208                 ) 
    209             ); 
    210             $templated_reply = WIC_Entity_Email_Send::reply_template_to_html( $sample_object ); 
    211         } else { 
    212             $templated_reply =  
    213                 '<p>Reply cannot be formatted because necessary values not yet set.</p>' . 
    214                 ( $data->issue ? '' : '<p>Issue not assigned or previously mapped.</p>' ) . 
    215                 ( trim( $data->template ) ? '' :  '<p>Working template is blank and master template -- set master template in <span class="dashicons dashicons-admin-settings"></span> (email settings) on inbox title bar.</p>' ); 
    216         } 
    217  
     202            // generate templated reply 
     203            if ( $data->issue && trim ( $data->template ) ) { 
     204                $sample_object = array (  
     205                    (object) array ( 
     206                        'first_name' => $message->first_name, 
     207                        'last_name' => $message->last_name, 
     208                        'issue' => $data->issue, 
     209                        'original_subject' => $message->subject, 
     210                        'activity_note' => $message->raw_text_body, // the sanitized, but still punctuated, incoming text 
     211                        'pro_con' => $data->pro_con,         
     212                    ), 
     213                    (object) array ( 
     214                        'mapped_reply_template' => $data->template, 
     215                    ) 
     216                ); 
     217                $templated_reply = WIC_Entity_Email_Send::reply_template_to_html( $sample_object ); 
     218            } else { 
     219                $templated_reply =  
     220                    '<p>Reply cannot be formatted because necessary values not yet set.</p>' . 
     221                    ( $data->issue ? '' : '<p>Issue not assigned or previously mapped.</p>' ) . 
     222                    ( trim( $data->template ) ? '' :  '<p>Working template is blank and master template -- set master template in <span class="dashicons dashicons-admin-settings"></span> (email settings) on inbox title bar.</p>' ); 
     223            } 
     224        } 
    218225 
    219226        $response = (object) array ( 
     
    224231            'issue'             => $data->issue, 
    225232            'pro_con'           => $data->pro_con, 
    226             'issue_title'       => get_the_title ( $data->issue ), 
     233            'issue_title'       => $data->issue > 0 ? WIC_DB_Access_WP::fast_title_lookup_by_id ( $data->issue ) : '', 
    227234        ); 
    228235 
  • wp-issues-crm/branches/maxajax/wp-issues-crm.php

    r1501872 r1502197  
    4141// set database version global; 
    4242global $wp_issues_crm_db_version; 
    43 $wp_issues_crm_db_version = '2.841111123';  
     43$wp_issues_crm_db_version = '2.85';  
    4444/* 
    4545* set js_css version global -- three possibilities: 
Note: See TracChangeset for help on using the changeset viewer.