Plugin Directory

Changeset 2400631


Ignore:
Timestamp:
10/16/2020 05:36:31 AM (5 years ago)
Author:
stockunlocks
Message:

Upgrade to 1.9.5.25

Location:
stockunlocks
Files:
469 added
4 edited

Legend:

Unmodified
Added
Removed
  • stockunlocks/trunk/README.txt

    r2397188 r2400631  
    66Tested up to: 5.5.1
    77Requires PHP: 7.0
    8 Stable tag: 1.9.5.22
     8Stable tag: 1.9.5.25
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    102102== Changelog ==
    103103
     104= 1.9.5.25 - October 16, 2020 =
     105
     106*   Fix – Orders no longer automatically reset to status “Processing error” under certain conditions.
     107*   Fix –  Custom Brand/Model, Country/Network combination selections now “stick”.
     108
    104109= 1.9.5.22 - October 10, 2020 =
    105110
     
    278283== Upgrade Notice ==
    279284
     285= 1.9.5.25 =
     286This upgrade fixes a problem when orders that previously failed were continually being reset to status “Processing error”. This no longer happens when order status is set to “Refunded”, “Cancelled”, “On hold” or “Manual Processing”.
     287Also, when setting custom Product values for Brand/Model, Country/Network combinations, the selection consistently follows (“sticks to”) what the user chooses on the front end.
     288
    280289= 1.9.5.22 =
    281290This upgrade reduces the large text area to a smaller text box when a Remote Service Product is set to Serial Max Quantity = 1.
  • stockunlocks/trunk/admin/class-stockunlocks-admin.php

    r2397188 r2400631  
    16731673            $brand_groups = array_filter($brand_groups);
    16741674            $model_groups = array_filter($model_groups);
    1675 
     1675           
    16761676            // loop over each brand list
    16771677            foreach ($brand_groups as $key_brand => &$list_brand):
     
    16841684                        // error_log('CHECKING OUT THE $model_groups, $key = '. $current_model_key . ', $list_model = ' . print_r($list_model,true) );
    16851685                        if (strpos($list_model, ',,') !== false) {
     1686                            $temp_model_key = 0;
    16861687                            $model_values = ( explode(",,",$list_model) );
    16871688                            foreach( $model_values as &$model_name ) {
     1689                                $temp_model_key++;
    16881690                                $list_0_name = html_entity_decode( $list_brand );
    16891691                                $list_1_name = html_entity_decode( $model_name );
    16901692                               
    1691                                 $brands_models[$list_0_name][$list_1_name][] = $current_model_key;
     1693                                $brands_models[$list_0_name][$list_1_name][] = $current_model_key . $temp_model_key;
    16921694                            }
    16931695                        }
     
    17991801                        // error_log('CHECKING OUT THE $network_groups, $key = '. $current_network_key . ', $list_network = ' . print_r($list_network,true) );
    18001802                        if (strpos($list_network, ',,') !== false) {
     1803                            $temp_name_key = 0;
    18011804                            $network_values = ( explode(",,",$list_network) );
    18021805                            foreach( $network_values as &$network_name ) {
     1806                                $temp_name_key++;
    18031807                                $list_0_name = html_entity_decode( $list_country );
    18041808                                $list_1_name = html_entity_decode( $network_name );
    18051809                               
    1806                                 $countries_networks[$list_0_name][$list_1_name][] = $current_network_key;
     1810                                $countries_networks[$list_0_name][$list_1_name][] = $current_network_key . $temp_name_key;
    18071811                            }
    18081812                        }
     
    29012905        $suwp_orders = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "posts WHERE  post_type=%s ORDER BY ID ASC", 'shop_order' ) );
    29022906       
     2907        // list of orders status to avoid, in other words: don't try to compare with API results
     2908        // this prevents resetting order status
     2909        $suwp_avoid = array('wc-refunded','wc-cancelled','wc-on-hold','wc-suwp-manual');
     2910
    29032911        // loop over orders and check the comment type details
    29042912        foreach( $suwp_orders as $order ):
    29052913           
    2906             $final_status = 'wc-suwp-ordered';
    2907             $flag_update_status = true;
    2908             $current_order_id = $order->ID;
    2909             $suwp_order_comments = $wpdb->get_results( $wpdb->prepare( "SELECT comment_type FROM " . $wpdb->prefix . "comments WHERE comment_post_ID=%d ORDER BY comment_ID ASC", $current_order_id ) );
    2910            
    2911             $send_order_success = $wpdb->get_results( $wpdb->prepare( "SELECT comment_ID FROM " . $wpdb->prefix. "comments WHERE comment_post_ID=%d AND comment_type=%s ORDER BY comment_ID ASC", $current_order_id, 'suwp_order_success' ) );
    2912             $send_order_error = $wpdb->get_results( $wpdb->prepare( "SELECT comment_ID FROM " . $wpdb->prefix. "comments WHERE comment_post_ID=%d AND comment_type=%s ORDER BY comment_ID ASC", $current_order_id, 'suwp_order_error' ) );
    2913             $send_order_fail = $wpdb->get_results( $wpdb->prepare( "SELECT comment_ID FROM " . $wpdb->prefix. "comments WHERE comment_post_ID=%d AND comment_type=%s ORDER BY comment_ID ASC", $current_order_id, 'suwp_connect_fail' ) );
    2914                
    2915             $check_order_success = $wpdb->get_results( $wpdb->prepare( "SELECT comment_ID FROM " . $wpdb->prefix. "comments WHERE comment_post_ID=%d AND comment_type=%s ORDER BY comment_ID ASC", $current_order_id, 'suwp_reply_success' ) );
    2916             $check_order_rejects = $wpdb->get_results( $wpdb->prepare( "SELECT comment_ID FROM " . $wpdb->prefix. "comments WHERE comment_post_ID=%d AND comment_type=%s ORDER BY comment_ID ASC", $current_order_id, 'suwp_reply_reject' ) );
    2917             $check_order_error = $wpdb->get_results( $wpdb->prepare( "SELECT comment_ID FROM " . $wpdb->prefix. "comments WHERE comment_post_ID=%d AND comment_type=%s ORDER BY comment_ID ASC", $current_order_id, 'suwp_reply_error' ) );
    2918            
    2919             $num_send_order_success = count( $send_order_success );
    2920             $num_send_order_error = count( $send_order_error );
    2921             $num_send_order_fail = count( $send_order_fail );
    2922             $num_send_total = $num_send_order_success+$num_send_order_error+$num_send_order_fail;
    2923             $num_send_error_total = $num_send_order_error+$num_send_order_fail;
    2924            
    2925             $num_check_order_success = count( $check_order_success );
    2926             $num_check_order_rejects = count( $check_order_rejects );
    2927             $num_check_error_total = count( $check_order_error );
    2928             $num_check_total = $num_check_order_success+$num_check_order_rejects+$num_check_error_total;
    2929            
    2930             $api_check = $num_send_order_success + $num_send_order_error + $num_send_order_fail + $num_check_order_success + $num_check_order_rejects + $num_check_error_total;
    2931            
    2932             // error_log( 'CHECKING IF this is an API type order,  $api_check = ' . $api_check . ', $num_send_total = ' . $num_send_total . ', $num_check_total = ' . $num_check_total );
    2933            
    2934             // must be sure that this order is API related
    2935             if( $api_check > 0 ) {
    2936                
    2937                 // determine the final order status
    2938                 if( $num_send_total == 0 ) {
    2939                     // all orders processed, proceed to check how things went
    2940                            
    2941                     /**
    2942                     $num_check_order_success = count( $check_order_success );
    2943                     $num_check_order_rejects = count( $check_order_rejects );
    2944                     $num_check_error_total = count( $check_order_error );
    2945                     **/
    2946                    
    2947                     /** Possible order status
    2948                     'wc-suwp-ordered': Code ordered
    2949                     'wc-suwp-order-part': Partially ordered
    2950                     'wc-suwp-unavailable': Code unavailable
    2951                     'wc-suwp-available': Code delivered
    2952                     'wc-suwp-avail-part': Codes partially delivered
    2953                     'wc-suwp-error': Processing error
    2954                     **/
    2955                    
    2956                     if( $num_check_error_total == 0) {
    2957                         // no errors when checking order
    2958                         if( $num_check_order_success > 0 && $num_check_order_rejects > 0 ) {
    2959                             // some IMEI were rejected and some were success
    2960                             // mixed results, partially delivered
    2961                             $final_status = 'wc-suwp-avail-part';
    2962                         }
    2963                         if( $num_check_order_success > 0 && $num_check_order_rejects == 0 ) {
    2964                             // no IMEI rejected, code delivered
    2965                             $final_status = 'wc-suwp-available';
    2966                         }
    2967                         if( $num_check_order_success == 0 && $num_check_order_rejects > 0 ) {
    2968                             // no IMEI were success, code unavailable
    2969                             $final_status = 'wc-suwp-unavailable';
    2970                         }
    2971                        
    2972                     } else {
    2973                         // there were errors when checkng this order, need to resolve them and then resubmit
    2974                         $final_status = 'wc-suwp-error';
    2975                     }
    2976        
    2977                 } else {
    2978                     // at least one order has not yet been sent off, find out why
    2979                    
    2980                     if( $num_send_error_total == 0) {
    2981                         // no errors when sending order
    2982                         if( $num_send_order_success > 0 ) {
    2983                             // all IMEI sent off with no errors, code ordered
    2984                             $final_status = 'wc-suwp-ordered';
    2985                         }
    2986                        
    2987                     } else {
    2988                         // there were errors when sending this order, need to resolve them and then resubmit
    2989                         $final_status = 'wc-suwp-error';
    2990                     }
    2991                 }
    2992                
    2993                 if( $num_check_total == 0 ) {
    2994                     // no orders checked on yet, still queued for send off
    2995                    
    2996                     /**
    2997                     $num_send_order_success = count( $send_order_success );
    2998                     $num_send_order_error = count( $send_order_error );
    2999                     $num_send_order_fail = count( $send_order_fail );
    3000                     **/
    3001                    
    3002                     /** Possible order status
    3003                     'wc-suwp-ordered': Code ordered
    3004                     'wc-suwp-order-part': Partially ordered
    3005                     'wc-suwp-unavailable': Code unavailable
    3006                     'wc-suwp-available': Code delivered
    3007                     'wc-suwp-avail-part': Codes partially delivered
    3008                     'wc-suwp-error': Processing error
    3009                     **/
    3010                    
    3011                     if( $num_send_error_total == 0) {
    3012                         // no errors when sending order
    3013                         if( $num_send_order_success > 0 ) {
    3014                             // all IMEI sent off with no errors, code ordered
    3015                             $final_status = 'wc-suwp-ordered';
    3016                         }
    3017                        
    3018                     } else {
    3019                         // there were errors when sending this order, need to resolve them and then resubmit
    3020                         $final_status = 'wc-suwp-error';
    3021                     }
    3022                    
    3023                 }
    3024                
    3025                 /**
     2914            // skip the API results lookup
     2915            if ( !in_array($order->post_status, $suwp_avoid, true) ) {
     2916
     2917                // error_log('NOT AVOIDING THIS, status = ' . $order->post_status);
     2918           
     2919                $final_status = 'wc-suwp-ordered';
     2920                $flag_update_status = true;
     2921                $current_order_id = $order->ID;
     2922                $suwp_order_comments = $wpdb->get_results( $wpdb->prepare( "SELECT comment_type FROM " . $wpdb->prefix . "comments WHERE comment_post_ID=%d ORDER BY comment_ID ASC", $current_order_id ) );
     2923               
     2924                $send_order_success = $wpdb->get_results( $wpdb->prepare( "SELECT comment_ID FROM " . $wpdb->prefix. "comments WHERE comment_post_ID=%d AND comment_type=%s ORDER BY comment_ID ASC", $current_order_id, 'suwp_order_success' ) );
     2925                $send_order_error = $wpdb->get_results( $wpdb->prepare( "SELECT comment_ID FROM " . $wpdb->prefix. "comments WHERE comment_post_ID=%d AND comment_type=%s ORDER BY comment_ID ASC", $current_order_id, 'suwp_order_error' ) );
     2926                $send_order_fail = $wpdb->get_results( $wpdb->prepare( "SELECT comment_ID FROM " . $wpdb->prefix. "comments WHERE comment_post_ID=%d AND comment_type=%s ORDER BY comment_ID ASC", $current_order_id, 'suwp_connect_fail' ) );
     2927                   
     2928                $check_order_success = $wpdb->get_results( $wpdb->prepare( "SELECT comment_ID FROM " . $wpdb->prefix. "comments WHERE comment_post_ID=%d AND comment_type=%s ORDER BY comment_ID ASC", $current_order_id, 'suwp_reply_success' ) );
     2929                $check_order_rejects = $wpdb->get_results( $wpdb->prepare( "SELECT comment_ID FROM " . $wpdb->prefix. "comments WHERE comment_post_ID=%d AND comment_type=%s ORDER BY comment_ID ASC", $current_order_id, 'suwp_reply_reject' ) );
     2930                $check_order_error = $wpdb->get_results( $wpdb->prepare( "SELECT comment_ID FROM " . $wpdb->prefix. "comments WHERE comment_post_ID=%d AND comment_type=%s ORDER BY comment_ID ASC", $current_order_id, 'suwp_reply_error' ) );
     2931               
    30262932                $num_send_order_success = count( $send_order_success );
    30272933                $num_send_order_error = count( $send_order_error );
     
    30342940                $num_check_error_total = count( $check_order_error );
    30352941                $num_check_total = $num_check_order_success+$num_check_order_rejects+$num_check_error_total;
    3036                 **/
    3037                
    3038                 if( ( $num_send_total > 0 && $num_check_total > 0 ) && ( $num_send_error_total == 0 && $num_check_error_total == 0 ) ) {
    3039                    
    3040                     // no errors on either side, just partially available/ordered
    3041                    
    3042                     /** Possible order status
    3043                     'wc-suwp-ordered': Code ordered
    3044                     'wc-suwp-order-part': Partially ordered
    3045                     'wc-suwp-unavailable': Code unavailable
    3046                     'wc-suwp-available': Code delivered
    3047                     'wc-suwp-avail-part': Codes partially delivered
    3048                     'wc-suwp-error': Processing error
     2942               
     2943                $api_check = $num_send_order_success + $num_send_order_error + $num_send_order_fail + $num_check_order_success + $num_check_order_rejects + $num_check_error_total;
     2944               
     2945                // error_log( 'CHECKING IF this is an API type order,  $api_check = ' . $api_check . ', $num_send_total = ' . $num_send_total . ', $num_check_total = ' . $num_check_total );
     2946               
     2947                // must be sure that this order is API related
     2948                if( $api_check > 0 ) {
     2949                   
     2950                    // determine the final order status
     2951                    if( $num_send_total == 0 ) {
     2952                        // all orders processed, proceed to check how things went
     2953                               
     2954                        /**
     2955                        $num_check_order_success = count( $check_order_success );
     2956                        $num_check_order_rejects = count( $check_order_rejects );
     2957                        $num_check_error_total = count( $check_order_error );
     2958                        **/
     2959                       
     2960                        /** Possible order status
     2961                        'wc-suwp-ordered': Code ordered
     2962                        'wc-suwp-order-part': Partially ordered
     2963                        'wc-suwp-unavailable': Code unavailable
     2964                        'wc-suwp-available': Code delivered
     2965                        'wc-suwp-avail-part': Codes partially delivered
     2966                        'wc-suwp-error': Processing error
     2967                        **/
     2968                       
     2969                        if( $num_check_error_total == 0) {
     2970                            // no errors when checking order
     2971                            if( $num_check_order_success > 0 && $num_check_order_rejects > 0 ) {
     2972                                // some IMEI were rejected and some were success
     2973                                // mixed results, partially delivered
     2974                                $final_status = 'wc-suwp-avail-part';
     2975                            }
     2976                            if( $num_check_order_success > 0 && $num_check_order_rejects == 0 ) {
     2977                                // no IMEI rejected, code delivered
     2978                                $final_status = 'wc-suwp-available';
     2979                            }
     2980                            if( $num_check_order_success == 0 && $num_check_order_rejects > 0 ) {
     2981                                // no IMEI were success, code unavailable
     2982                                $final_status = 'wc-suwp-unavailable';
     2983                            }
     2984                           
     2985                        } else {
     2986                            // there were errors when checkng this order, need to resolve them and then resubmit
     2987                            $final_status = 'wc-suwp-error';
     2988                        }
     2989           
     2990                    } else {
     2991                        // at least one order has not yet been sent off, find out why
     2992                       
     2993                        if( $num_send_error_total == 0) {
     2994                            // no errors when sending order
     2995                            if( $num_send_order_success > 0 ) {
     2996                                // all IMEI sent off with no errors, code ordered
     2997                                $final_status = 'wc-suwp-ordered';
     2998                            }
     2999                           
     3000                        } else {
     3001                            // there were errors when sending this order, need to resolve them and then resubmit
     3002                            $final_status = 'wc-suwp-error';
     3003                        }
     3004                    }
     3005                   
     3006                    if( $num_check_total == 0 ) {
     3007                        // no orders checked on yet, still queued for send off
     3008                       
     3009                        /**
     3010                        $num_send_order_success = count( $send_order_success );
     3011                        $num_send_order_error = count( $send_order_error );
     3012                        $num_send_order_fail = count( $send_order_fail );
     3013                        **/
     3014                       
     3015                        /** Possible order status
     3016                        'wc-suwp-ordered': Code ordered
     3017                        'wc-suwp-order-part': Partially ordered
     3018                        'wc-suwp-unavailable': Code unavailable
     3019                        'wc-suwp-available': Code delivered
     3020                        'wc-suwp-avail-part': Codes partially delivered
     3021                        'wc-suwp-error': Processing error
     3022                        **/
     3023                       
     3024                        if( $num_send_error_total == 0) {
     3025                            // no errors when sending order
     3026                            if( $num_send_order_success > 0 ) {
     3027                                // all IMEI sent off with no errors, code ordered
     3028                                $final_status = 'wc-suwp-ordered';
     3029                            }
     3030                           
     3031                        } else {
     3032                            // there were errors when sending this order, need to resolve them and then resubmit
     3033                            $final_status = 'wc-suwp-error';
     3034                        }
     3035                       
     3036                    }
     3037                   
     3038                    /**
     3039                    $num_send_order_success = count( $send_order_success );
     3040                    $num_send_order_error = count( $send_order_error );
     3041                    $num_send_order_fail = count( $send_order_fail );
     3042                    $num_send_total = $num_send_order_success+$num_send_order_error+$num_send_order_fail;
     3043                    $num_send_error_total = $num_send_order_error+$num_send_order_fail;
     3044                   
     3045                    $num_check_order_success = count( $check_order_success );
     3046                    $num_check_order_rejects = count( $check_order_rejects );
     3047                    $num_check_error_total = count( $check_order_error );
     3048                    $num_check_total = $num_check_order_success+$num_check_order_rejects+$num_check_error_total;
    30493049                    **/
    30503050                   
    3051                     // partially available (or ordered)
    3052                     $final_status = 'wc-suwp-order-part';
    3053                    
     3051                    if( ( $num_send_total > 0 && $num_check_total > 0 ) && ( $num_send_error_total == 0 && $num_check_error_total == 0 ) ) {
     3052                       
     3053                        // no errors on either side, just partially available/ordered
     3054                       
     3055                        /** Possible order status
     3056                        'wc-suwp-ordered': Code ordered
     3057                        'wc-suwp-order-part': Partially ordered
     3058                        'wc-suwp-unavailable': Code unavailable
     3059                        'wc-suwp-available': Code delivered
     3060                        'wc-suwp-avail-part': Codes partially delivered
     3061                        'wc-suwp-error': Processing error
     3062                        **/
     3063                       
     3064                        // partially available (or ordered)
     3065                        $final_status = 'wc-suwp-order-part';
     3066                       
     3067                    }
     3068                   
     3069                    // update order post_status
     3070                    $order_post = array(
     3071                    'ID' => $current_order_id,
     3072                    'post_status'    => $final_status,
     3073                    );
     3074                   
     3075                    // update the post into the database
     3076                    wp_update_post( $order_post );
     3077               
    30543078                }
    3055                
    3056                 // update order post_status
    3057                 $order_post = array(
    3058                 'ID' => $current_order_id,
    3059                 'post_status'    => $final_status,
    3060                 );
    3061                
    3062                 // update the post into the database
    3063                 wp_update_post( $order_post );
    3064            
    3065             }
    3066            
     3079
     3080        } else {
     3081            // error_log('AVOIDING THIS, status = ' . $order->post_status);
     3082        } // if ( !in_array($order->post_status, $suwp_avoid, true) )
     3083
    30673084        endforeach; // foreach( $suwp_orders as $order )
    30683085    }
  • stockunlocks/trunk/includes/class-stockunlocks.php

    r2397188 r2400631  
    7272            $this->version = STOCKUNLOCKS_VERSION;
    7373        } else {
    74             $this->version = '1.9.5.22';
     74            $this->version = '1.9.5.25';
    7575        }
    7676       
  • stockunlocks/trunk/stockunlocks.php

    r2397188 r2400631  
    1111 * Plugin URI: https://www.stockunlocks.com/forums/forum/stockunlocks-wordpress-plugin/
    1212 * Description: Automate your mobile unlocking store with the StockUnlocks plugin combined with WooCommerce and the power of various mobile unlocking APIs. Now, focus your time and energy where they're needed the most.
    13  * Version: 1.9.5.22
     13 * Version: 1.9.5.25
    1414 * Author: StockUnlocks
    1515 * Author URI: https://www.stockunlocks.com
     
    5252 * Current plugin version.
    5353 */
    54 define( 'STOCKUNLOCKS_VERSION', '1.9.5.22' );
     54define( 'STOCKUNLOCKS_VERSION', '1.9.5.25' );
    5555
    5656/**
Note: See TracChangeset for help on using the changeset viewer.