Plugin Directory

Changeset 2721958


Ignore:
Timestamp:
05/11/2022 11:19:14 AM (4 years ago)
Author:
avitrop
Message:

Update to version 2.1.2 from GitHub

Location:
storeman
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • storeman/tags/2.1.2/README.txt

    r2701368 r2721958  
    33Tags: storeman , woocommerce , stock manager , export product , import product , stock, orders, bulk edit products
    44Requires at lest: 3.0.1
    5 Tested up to: 5.9
    6 Stable tag: 2.1.1
     5Tested up to: 6.0
     6Stable tag: 2.2.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3333
    3434== Changelog ==
    35 = 2.1.1 =
     35= 2.2.2 =
    3636prevent shut down hooks
    3737= 2.1.0 =
  • storeman/tags/2.1.2/admin/class-storeman-admin.php

    r2701368 r2721958  
    122122        if (
    123123            in_array($webhook->get_topic(), $this->removeTopic)
    124                 &&
    125                 (
    126                     strpos($webhook->get_delivery_url(), 'storeman') !== false
    127                 ||
    128                 strpos($webhook->get_delivery_url(), 'stores.com') !== false
    129                 ||
    130                 strpos($webhook->get_delivery_url(), 'crm.sharpen') !== false
    131                 )
    132                 && $this->removeElementId === $id
     124                // &&
     125                // (
     126                //     strpos($webhook->get_delivery_url(), 'storeman') !== false
     127                // ||
     128                // strpos($webhook->get_delivery_url(), 'stores.com') !== false
     129                // ||
     130                // strpos($webhook->get_delivery_url(), 'crm.sharpen') !== false
     131                // )
     132                &&
     133                $this->removeElementId === $id
    133134        ) {
    134135            return false;
     
    138139    protected function checkFromStoreman($request)
    139140    {
    140         $h = $request->get_header('user_agent');
    141         // return true;
    142141        return strpos($request->get_header('user_agent'), 'StoreMan') !== false;
    143142    }
     
    153152    {
    154153        if ($this->checkFromStoreman($request)) {
    155             $this->removeTopic = ['product.updated','product.created'
    156                 // ,'product.update_variation'
    157                 ];
     154            $this->removeTopic = ['product.updated','product.created'];
     155            $this->removeElementId = $object->get_id();
     156        }
     157
     158        return $object;
     159    }
     160
     161    public function set_get_item_schema($c){
     162        if(apply_filters('storeman_stock_quantity_doubleval',false) && isset($c['stock_quantity'])){
     163            $c['stock_quantity']['type'] = 'float';
     164        }
     165        return $c;
     166    }
     167    public function set_doubleval($q)
     168    {
     169        if (apply_filters('storeman_stock_quantity_doubleval', false)) {
     170            remove_filter('woocommerce_stock_amount', 'intval');
     171            return  doubleval($q);
     172        }
     173        return $q;
     174    }
     175    public function remove_product_variation_webhook_action($object, $request)
     176    {
     177        if ($this->checkFromStoreman($request)) {
     178            $this->removeTopic = ['product.update_variation'];
    158179            $this->removeElementId = $object->get_id();
    159180        }
     
    391412    }
    392413}
     414// add_filter('storeman_stock_quantity_doubleval' , function($type){
     415//     return true;
     416//         });
     417
  • storeman/tags/2.1.2/includes/class-storeman.php

    r2701368 r2721958  
    182182       
    183183        $this->loader->add_filter( 'rest_product_variation_collection_params',$plugin_admin, 'fix_bath_pp' );
    184         foreach ($post_types as $post_type) {
    185             $this->loader->add_action("woocommerce_rest_pre_insert_{$post_type}_object", $plugin_admin, 'remove_product_webhook_action',1,3);
    186             $this->loader->add_action("woocommerce_rest_insert_{$post_type}_object", $plugin_admin, 'remove_product_webhook_action',999,3);
    187         }
     184        // foreach ($post_types as $post_type) {
     185        //     $this->loader->add_action("woocommerce_rest_pre_insert_product_object", $plugin_admin, 'remove_product_webhook_action',1,3);
     186        //     $this->loader->add_action("woocommerce_rest_insert_{$post_type}_object", $plugin_admin, 'remove_product_webhook_action',999,3);
     187        // }
     188
     189        $this->loader->add_action("woocommerce_rest_pre_insert_product_object", $plugin_admin, 'remove_product_webhook_action',1,3);
     190        $this->loader->add_action("woocommerce_rest_insert_product_object", $plugin_admin, 'remove_product_webhook_action',999,3);
     191 
     192        $this->loader->add_filter('woocommerce_stock_amount',$plugin_admin, 'set_doubleval',1,1);
     193        foreach ($post_types as $post_type){
     194            $this->loader->add_filter( 'woocommerce_rest_' . $post_type . '_schema', $plugin_admin,'set_get_item_schema');
     195        }
     196        $this->loader->add_action("woocommerce_rest_pre_insert_product_variation_object", $plugin_admin, 'remove_product_variation_webhook_action',1,3);
     197        $this->loader->add_action("woocommerce_rest_insert_product_variation_object", $plugin_admin, 'remove_product_variation_webhook_action',999,3);
     198 
    188199
    189200    }
  • storeman/tags/2.1.2/storeman.php

    r2701368 r2721958  
    1717 * Plugin URI:        https://storeman.co.il
    1818 * Description:       add storeman to your WordPress site.
    19  * Version:           2.1.1
     19 * Version:           2.2.2
    2020 * Author:            avitrop
    2121 * Author URI:        https://profiles.wordpress.org/avitrop/
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'STOREMAN_VERSION', '2.1.1' );
     38define( 'STOREMAN_VERSION', '2.2.2' );
    3939
    4040/**
  • storeman/trunk/README.txt

    r2701368 r2721958  
    33Tags: storeman , woocommerce , stock manager , export product , import product , stock, orders, bulk edit products
    44Requires at lest: 3.0.1
    5 Tested up to: 5.9
    6 Stable tag: 2.1.1
     5Tested up to: 6.0
     6Stable tag: 2.2.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3333
    3434== Changelog ==
    35 = 2.1.1 =
     35= 2.2.2 =
    3636prevent shut down hooks
    3737= 2.1.0 =
  • storeman/trunk/admin/class-storeman-admin.php

    r2701368 r2721958  
    122122        if (
    123123            in_array($webhook->get_topic(), $this->removeTopic)
    124                 &&
    125                 (
    126                     strpos($webhook->get_delivery_url(), 'storeman') !== false
    127                 ||
    128                 strpos($webhook->get_delivery_url(), 'stores.com') !== false
    129                 ||
    130                 strpos($webhook->get_delivery_url(), 'crm.sharpen') !== false
    131                 )
    132                 && $this->removeElementId === $id
     124                // &&
     125                // (
     126                //     strpos($webhook->get_delivery_url(), 'storeman') !== false
     127                // ||
     128                // strpos($webhook->get_delivery_url(), 'stores.com') !== false
     129                // ||
     130                // strpos($webhook->get_delivery_url(), 'crm.sharpen') !== false
     131                // )
     132                &&
     133                $this->removeElementId === $id
    133134        ) {
    134135            return false;
     
    138139    protected function checkFromStoreman($request)
    139140    {
    140         $h = $request->get_header('user_agent');
    141         // return true;
    142141        return strpos($request->get_header('user_agent'), 'StoreMan') !== false;
    143142    }
     
    153152    {
    154153        if ($this->checkFromStoreman($request)) {
    155             $this->removeTopic = ['product.updated','product.created'
    156                 // ,'product.update_variation'
    157                 ];
     154            $this->removeTopic = ['product.updated','product.created'];
     155            $this->removeElementId = $object->get_id();
     156        }
     157
     158        return $object;
     159    }
     160
     161    public function set_get_item_schema($c){
     162        if(apply_filters('storeman_stock_quantity_doubleval',false) && isset($c['stock_quantity'])){
     163            $c['stock_quantity']['type'] = 'float';
     164        }
     165        return $c;
     166    }
     167    public function set_doubleval($q)
     168    {
     169        if (apply_filters('storeman_stock_quantity_doubleval', false)) {
     170            remove_filter('woocommerce_stock_amount', 'intval');
     171            return  doubleval($q);
     172        }
     173        return $q;
     174    }
     175    public function remove_product_variation_webhook_action($object, $request)
     176    {
     177        if ($this->checkFromStoreman($request)) {
     178            $this->removeTopic = ['product.update_variation'];
    158179            $this->removeElementId = $object->get_id();
    159180        }
     
    391412    }
    392413}
     414// add_filter('storeman_stock_quantity_doubleval' , function($type){
     415//     return true;
     416//         });
     417
  • storeman/trunk/includes/class-storeman.php

    r2701368 r2721958  
    182182       
    183183        $this->loader->add_filter( 'rest_product_variation_collection_params',$plugin_admin, 'fix_bath_pp' );
    184         foreach ($post_types as $post_type) {
    185             $this->loader->add_action("woocommerce_rest_pre_insert_{$post_type}_object", $plugin_admin, 'remove_product_webhook_action',1,3);
    186             $this->loader->add_action("woocommerce_rest_insert_{$post_type}_object", $plugin_admin, 'remove_product_webhook_action',999,3);
    187         }
     184        // foreach ($post_types as $post_type) {
     185        //     $this->loader->add_action("woocommerce_rest_pre_insert_product_object", $plugin_admin, 'remove_product_webhook_action',1,3);
     186        //     $this->loader->add_action("woocommerce_rest_insert_{$post_type}_object", $plugin_admin, 'remove_product_webhook_action',999,3);
     187        // }
     188
     189        $this->loader->add_action("woocommerce_rest_pre_insert_product_object", $plugin_admin, 'remove_product_webhook_action',1,3);
     190        $this->loader->add_action("woocommerce_rest_insert_product_object", $plugin_admin, 'remove_product_webhook_action',999,3);
     191 
     192        $this->loader->add_filter('woocommerce_stock_amount',$plugin_admin, 'set_doubleval',1,1);
     193        foreach ($post_types as $post_type){
     194            $this->loader->add_filter( 'woocommerce_rest_' . $post_type . '_schema', $plugin_admin,'set_get_item_schema');
     195        }
     196        $this->loader->add_action("woocommerce_rest_pre_insert_product_variation_object", $plugin_admin, 'remove_product_variation_webhook_action',1,3);
     197        $this->loader->add_action("woocommerce_rest_insert_product_variation_object", $plugin_admin, 'remove_product_variation_webhook_action',999,3);
     198 
    188199
    189200    }
  • storeman/trunk/storeman.php

    r2701368 r2721958  
    1717 * Plugin URI:        https://storeman.co.il
    1818 * Description:       add storeman to your WordPress site.
    19  * Version:           2.1.1
     19 * Version:           2.2.2
    2020 * Author:            avitrop
    2121 * Author URI:        https://profiles.wordpress.org/avitrop/
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'STOREMAN_VERSION', '2.1.1' );
     38define( 'STOREMAN_VERSION', '2.2.2' );
    3939
    4040/**
Note: See TracChangeset for help on using the changeset viewer.