Plugin Directory

Changeset 3035680


Ignore:
Timestamp:
02/14/2024 01:51:37 PM (2 years ago)
Author:
postiwp
Message:

Update to version 2.4.2 from GitHub

Location:
posti-warehouse
Files:
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • posti-warehouse/tags/2.4.2/README.md

    r3035653 r3035680  
    9797
    9898## Version history
     99- 2.4.2: Added "Verbose logging" setting.
    99100- 2.4.1: internal: Changed how plugin gets order status (WC_Order get_status)
    100101- 2.4.0:
  • posti-warehouse/tags/2.4.2/classes/class-api.php

    r3035653 r3035680  
    1414    private $last_status = false;
    1515    private $token_option = 'posti_wh_api_auth';
    16     private $user_agent = 'woo-wh-client/2.4.1';
     16    private $user_agent = 'woo-wh-client/2.4.2';
    1717
    1818    public function __construct(Posti_Warehouse_Logger $logger, array &$options) {
  • posti-warehouse/tags/2.4.2/classes/class-order.php

    r3035653 r3035680  
    170170                array_push($order_ids, (string) $order_id);
    171171            }
     172        }
     173       
     174        $options = Posti_Warehouse_Settings::get();
     175        $is_verbose = Posti_Warehouse_Settings::is_verbose_logging($options);
     176        if ($is_verbose) {
     177            $this->logger->log('info', "Got order statuses for: " . implode(', ', $order_ids));
    172178        }
    173179       
     
    185191        );
    186192        $posts = get_posts($posts_query);
     193        if ($is_verbose) {
     194            $matched_post_ids = array();
     195            foreach ($posts as $post) {
     196                array_push($matched_post_ids, (string) $post->ID);
     197            }
     198            $this->logger->log('info', "Matched orders: " . implode(', ', $matched_post_ids));
     199        }
     200       
    187201        if (count($posts) == 0) {
     202            if ($is_verbose) {
     203                $this->logger->log('info', "No matched orders for status update");
     204            }
     205
    188206            return true;
    189207        }
     
    196214            }
    197215        }
    198        
    199         $options = Posti_Warehouse_Settings::get();
     216
    200217        $autocomplete = Posti_Warehouse_Settings::get_value($options, 'posti_wh_field_autocomplete');
    201218        foreach ($orders as $order) {
    202219            $order_id = $order['externalId'];
    203220            if (isset($post_by_order_id[$order_id]) && !empty($post_by_order_id[$order_id])) {
    204                 $this->sync_order($post_by_order_id[$order_id], $order_id, $order, $autocomplete);
     221                $this->sync_order($post_by_order_id[$order_id], $order_id, $order, $autocomplete, $is_verbose);
    205222            }
    206223        }
     
    209226    }
    210227
    211     public function sync_order( $id, $order_external_id, $order, $autocomplete) {
     228    public function sync_order( $id, $order_external_id, $order, $autocomplete, $is_verbose) {
    212229        try {
    213230            $tracking = isset($order['trackingCodes']) ? $order['trackingCodes'] : '';
     
    252269            else if ('completed' === $status_old) {
    253270                $this->logger->log('info', "Order $id ($order_external_id) status is already completed");
     271            }
     272            else if ($is_verbose) {
     273                $this->logger->log('info', "Order $id ($order_external_id) status is already $status_new");
    254274            }
    255275           
  • posti-warehouse/tags/2.4.2/classes/class-settings.php

    r3035564 r3035680  
    6464            'posti_wh_field_test_mode',
    6565            'posti_wh_field_debug',
     66            'posti_wh_field_verbose_logging',
    6667            'posti_wh_field_stock_sync_dttm',
    6768            'posti_wh_field_order_sync_dttm'
     
    8586    public static function is_debug( $options) {
    8687        return self::is_option_true($options, 'posti_wh_field_debug');
     88    }
     89   
     90    public static function is_verbose_logging( $options) {
     91        return self::is_option_true($options, 'posti_wh_field_verbose_logging');
    8792    }
    8893   
     
    304309                    'posti_wh_custom_data' => 'custom',
    305310                ]
     311        );
     312
     313        add_settings_field(
     314            'posti_wh_field_verbose_logging',
     315            Posti_Warehouse_Text::field_field_verbose_logging(),
     316            array($this, 'posti_wh_field_checkbox_cb'),
     317            'posti_wh',
     318            'posti_wh_options',
     319            [
     320                'label_for' => 'posti_wh_field_verbose_logging',
     321                'class' => 'posti_wh_row',
     322                'posti_wh_custom_data' => 'custom',
     323            ]
    306324        );
    307325
  • posti-warehouse/tags/2.4.2/classes/class-text.php

    r3035564 r3035680  
    229229    }
    230230   
     231    public static function field_field_verbose_logging() {
     232        return __('Verbose logging', 'posti-warehouse');
     233    }
     234   
    231235    public static function field_stock_sync_dttm() {
    232236        return __('Datetime of last stock update', 'posti-warehouse');
  • posti-warehouse/tags/2.4.2/posti-warehouse.php

    r3035653 r3035680  
    33/**
    44 * Plugin Name: Posti Warehouse
    5  * Version: 2.4.1
     5 * Version: 2.4.2
    66 * Description: Provides integration to Posti warehouse and dropshipping services.
    77 * Author: Posti
  • posti-warehouse/tags/2.4.2/readme.txt

    r3035653 r3035680  
    55Tested up to: 6.4.2
    66Requires PHP: 7.1
    7 Stable tag: 2.4.1
     7Stable tag: 2.4.2
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
  • posti-warehouse/trunk/README.md

    r3035653 r3035680  
    9797
    9898## Version history
     99- 2.4.2: Added "Verbose logging" setting.
    99100- 2.4.1: internal: Changed how plugin gets order status (WC_Order get_status)
    100101- 2.4.0:
  • posti-warehouse/trunk/classes/class-api.php

    r3035653 r3035680  
    1414    private $last_status = false;
    1515    private $token_option = 'posti_wh_api_auth';
    16     private $user_agent = 'woo-wh-client/2.4.1';
     16    private $user_agent = 'woo-wh-client/2.4.2';
    1717
    1818    public function __construct(Posti_Warehouse_Logger $logger, array &$options) {
  • posti-warehouse/trunk/classes/class-order.php

    r3035653 r3035680  
    170170                array_push($order_ids, (string) $order_id);
    171171            }
     172        }
     173       
     174        $options = Posti_Warehouse_Settings::get();
     175        $is_verbose = Posti_Warehouse_Settings::is_verbose_logging($options);
     176        if ($is_verbose) {
     177            $this->logger->log('info', "Got order statuses for: " . implode(', ', $order_ids));
    172178        }
    173179       
     
    185191        );
    186192        $posts = get_posts($posts_query);
     193        if ($is_verbose) {
     194            $matched_post_ids = array();
     195            foreach ($posts as $post) {
     196                array_push($matched_post_ids, (string) $post->ID);
     197            }
     198            $this->logger->log('info', "Matched orders: " . implode(', ', $matched_post_ids));
     199        }
     200       
    187201        if (count($posts) == 0) {
     202            if ($is_verbose) {
     203                $this->logger->log('info', "No matched orders for status update");
     204            }
     205
    188206            return true;
    189207        }
     
    196214            }
    197215        }
    198        
    199         $options = Posti_Warehouse_Settings::get();
     216
    200217        $autocomplete = Posti_Warehouse_Settings::get_value($options, 'posti_wh_field_autocomplete');
    201218        foreach ($orders as $order) {
    202219            $order_id = $order['externalId'];
    203220            if (isset($post_by_order_id[$order_id]) && !empty($post_by_order_id[$order_id])) {
    204                 $this->sync_order($post_by_order_id[$order_id], $order_id, $order, $autocomplete);
     221                $this->sync_order($post_by_order_id[$order_id], $order_id, $order, $autocomplete, $is_verbose);
    205222            }
    206223        }
     
    209226    }
    210227
    211     public function sync_order( $id, $order_external_id, $order, $autocomplete) {
     228    public function sync_order( $id, $order_external_id, $order, $autocomplete, $is_verbose) {
    212229        try {
    213230            $tracking = isset($order['trackingCodes']) ? $order['trackingCodes'] : '';
     
    252269            else if ('completed' === $status_old) {
    253270                $this->logger->log('info', "Order $id ($order_external_id) status is already completed");
     271            }
     272            else if ($is_verbose) {
     273                $this->logger->log('info', "Order $id ($order_external_id) status is already $status_new");
    254274            }
    255275           
  • posti-warehouse/trunk/classes/class-settings.php

    r3035564 r3035680  
    6464            'posti_wh_field_test_mode',
    6565            'posti_wh_field_debug',
     66            'posti_wh_field_verbose_logging',
    6667            'posti_wh_field_stock_sync_dttm',
    6768            'posti_wh_field_order_sync_dttm'
     
    8586    public static function is_debug( $options) {
    8687        return self::is_option_true($options, 'posti_wh_field_debug');
     88    }
     89   
     90    public static function is_verbose_logging( $options) {
     91        return self::is_option_true($options, 'posti_wh_field_verbose_logging');
    8792    }
    8893   
     
    304309                    'posti_wh_custom_data' => 'custom',
    305310                ]
     311        );
     312
     313        add_settings_field(
     314            'posti_wh_field_verbose_logging',
     315            Posti_Warehouse_Text::field_field_verbose_logging(),
     316            array($this, 'posti_wh_field_checkbox_cb'),
     317            'posti_wh',
     318            'posti_wh_options',
     319            [
     320                'label_for' => 'posti_wh_field_verbose_logging',
     321                'class' => 'posti_wh_row',
     322                'posti_wh_custom_data' => 'custom',
     323            ]
    306324        );
    307325
  • posti-warehouse/trunk/classes/class-text.php

    r3035564 r3035680  
    229229    }
    230230   
     231    public static function field_field_verbose_logging() {
     232        return __('Verbose logging', 'posti-warehouse');
     233    }
     234   
    231235    public static function field_stock_sync_dttm() {
    232236        return __('Datetime of last stock update', 'posti-warehouse');
  • posti-warehouse/trunk/posti-warehouse.php

    r3035653 r3035680  
    33/**
    44 * Plugin Name: Posti Warehouse
    5  * Version: 2.4.1
     5 * Version: 2.4.2
    66 * Description: Provides integration to Posti warehouse and dropshipping services.
    77 * Author: Posti
  • posti-warehouse/trunk/readme.txt

    r3035653 r3035680  
    55Tested up to: 6.4.2
    66Requires PHP: 7.1
    7 Stable tag: 2.4.1
     7Stable tag: 2.4.2
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
Note: See TracChangeset for help on using the changeset viewer.