Plugin Directory

Changeset 2647366


Ignore:
Timestamp:
12/21/2021 01:48:54 PM (4 years ago)
Author:
bjorntech
Message:

tagging version 5.1.3

Location:
woo-fortnox-hub
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • woo-fortnox-hub/tags/5.1.3/includes/admin/class-wcfh-util.php

    r2635282 r2647366  
    225225        }
    226226
    227         public static function clean_fortnox_text($str, $max_len = false)
     227        public static function clean_fortnox_text($str, $max_len = false, $empty = '')
    228228        {
    229229            $re = '/[^\p{L}\’\\\\\x{030a}a-zåäöéáœæøüA-ZÅÄÖÉÁÜŒÆØ0-9 –:\.`´’,;\^¤#%§£$€¢¥©™°&\/\(\)=\+\-\*_\!?²³®½\@\x{00a0}\n\r]*/u';
     
    236236            }
    237237
    238             return $result;
     238            return empty($result) ? $empty : $result;
    239239        }
    240240
  • woo-fortnox-hub/tags/5.1.3/includes/class-woo-fortnox-customer-handler.php

    r2640658 r2647366  
    227227                $data = array_merge($data, array(
    228228                    "Name" => WCFH_Util::clean_fortnox_text($billing_name, 1024),
    229                     "Address1" => WCFH_Util::clean_fortnox_text($order->get_billing_address_1(), 1024),
    230                     "Address2" => WCFH_Util::clean_fortnox_text($order->get_billing_address_2(), 1024),
     229                    "Address1" => WCFH_Util::clean_fortnox_text($order->get_billing_address_1(), 1024, API_BLANK),
     230                    "Address2" => WCFH_Util::clean_fortnox_text($order->get_billing_address_2(), 1024, API_BLANK),
    231231                    "City" => WCFH_Util::clean_fortnox_text($order->get_billing_city(), 1024),
    232232                    "ZipCode" => WCFH_Util::clean_fortnox_text($order->get_billing_postcode(), 10),
     
    291291                $data = array(
    292292                    "DeliveryName" => WCFH_Util::clean_fortnox_text($shipping_to, 1024),
    293                     "DeliveryAddress1" => WCFH_Util::clean_fortnox_text($order->get_shipping_address_1(), 1024),
    294                     "DeliveryAddress2" => WCFH_Util::clean_fortnox_text($order->get_shipping_address_2(), 1024),
     293                    "DeliveryAddress1" => WCFH_Util::clean_fortnox_text($order->get_shipping_address_1(), 1024, API_BLANK),
     294                    "DeliveryAddress2" => WCFH_Util::clean_fortnox_text($order->get_shipping_address_2(), 1024, API_BLANK),
    295295                    "DeliveryCity" => WCFH_Util::clean_fortnox_text($order->get_shipping_city(), 1024),
    296296                    "DeliveryZipCode" => WCFH_Util::clean_fortnox_text($order->get_shipping_postcode(), 10),
  • woo-fortnox-hub/tags/5.1.3/includes/class-woo-fortnox-hub-document-handler.php

    r2635282 r2647366  
    1313defined('ABSPATH') || exit;
    1414
    15 require_once plugin_dir_path(self::PLUGIN_FILE) . 'includes/class-woo-fortnox-hub-order.php';
    16 require_once plugin_dir_path(self::PLUGIN_FILE) . 'includes/class-woo-fortnox-hub-invoice.php';
    17 require_once plugin_dir_path(self::PLUGIN_FILE) . 'includes/class-woo-fortnox-hub-refund.php';
    18 require_once plugin_dir_path(self::PLUGIN_FILE) . 'includes/class-woo-fortnox-hub-stockchange.php';
    19 require_once plugin_dir_path(self::PLUGIN_FILE) . 'includes/class-woo-fortnox-hub-document-admin.php';
    20 
    2115if (!class_exists('Woo_Fortnox_Hub_Document_Handler', false)) {
    2216
  • woo-fortnox-hub/tags/5.1.3/includes/class-woo-fortnox-hub-invoice-status-handler.php

    r2635282 r2647366  
    630630                        as_schedule_single_action(as_get_datetime_object(), 'fortnox_process_changed_invoices', array($invoice['DocumentNumber']));
    631631                    }
    632                 } else {
    633 
    634                     WC_FH()->logger->add(sprintf('No changed Fortnox invoices since %s.', $last_sync_done));
    635632                }
    636633
  • woo-fortnox-hub/tags/5.1.3/includes/class-woo-fortnox-hub-wc-product-handler.php

    r2640658 r2647366  
    681681
    682682                $article = WC_FH()->fortnox->update_article($article['ArticleNumber'], $article_data);
     683
    683684            } else {
    684685
    685686                WC_FH()->logger->add(sprintf('update_article (%s): Processing Fortnox Article %s did not result in any changes', $product->get_id(), $article['ArticleNumber']));
     687
    686688            }
    687689        }
     
    941943            }
    942944
    943             $update_stock_level = get_option('fortnox_wc_product_update_stock_level');
    944             if ((($sync_all && 'yes' == $update_stock_level) || 'always' == $update_stock_level) && $product->get_manage_stock('edit') && $article['QuantityInStock'] != ($stock_quantity = $product->get_stock_quantity('edit'))) {
    945                 $article_data = $this->update_fortnox_article_stocklevel($article_data, $article['QuantityInStock'], $stock_quantity, false);
     945            $wc_qty = $product->get_stock_quantity('edit');
     946            $fn_qty = $article['QuantityInStock'];
     947            $sl_option = get_option('fortnox_wc_product_update_stock_level');
     948
     949            if ((($sync_all && 'yes' == $sl_option) || 'always' == $sl_option) && $product->get_manage_stock('edit') && $fn_qty != $wc_qty) {
     950                $article_data = $this->update_fortnox_article_stocklevel($article_data, $fn_qty, $wc_qty, false);
    946951                $changed = true;
    947952            }
     
    10111016            if ($from_stock != $to_stock) {
    10121017
    1013                 WC_FH()->logger->add(sprintf('update_fortnox_stocklevel: Changing stocklevel on Fortnox Article %s from %s to %s', $article_data['ArticleNumber'], $from_stock, $to_stock));
     1018                WC_FH()->logger->add(sprintf('update_fortnox_article_stocklevel: Changing stocklevel on Fortnox Article %s from %s to %s', $article_data['ArticleNumber'], $from_stock, $to_stock));
    10141019
    10151020                $article_data = $this->create_stocklevel_data($article_data, $to_stock);
     
    10181023                    $article = WC_FH()->fortnox->update_article($article_data['ArticleNumber'], $article_data);
    10191024                }
     1025
    10201026            } else {
    10211027
    10221028                WC_FH()->logger->add(sprintf('update_fortnox_stocklevel: No need to change stock on Fortnox Article %s from %s', $article_data['ArticleNumber'], $from_stock));
     1029
    10231030            }
    10241031
  • woo-fortnox-hub/tags/5.1.3/libraries/bjorntech-fortnox-api/class-fortnox-api.php

    r2635282 r2647366  
    784784        public function get_first_customer_by_organisation_number($organisation_number)
    785785        {
    786             return ($customers = $this->get_customers_by_organisation_number($organisation_number)) ? $customers[0] : $customers;
     786            $customers = $this->get_customers_by_organisation_number($organisation_number);
     787            return $customers ? $customers[0] : $customers;
    787788        }
    788789
  • woo-fortnox-hub/tags/5.1.3/readme.txt

    r2640658 r2647366  
    55Tested up to: 5.8
    66Requires PHP: 7.3
    7 Stable tag: 5.1.2
     7Stable tag: 5.1.3
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    3434
    3535== Changelog ==
     36= 5.1.3 =
     37* Working with WooCommerce 6.0
     38* Fix: If one of the adress field was empty in a new order and at the same time had content on a Fortnox customer card, the card data was faulty added to the Order/Invoice.
     39* Fix: Stocklevel was faulty changed on a product in Fortnox when an order item including the product was removed from a order manually in order admin.
    3640= 5.1.2 =
    3741* Fix: Rows in partial credits was not updated correctly in Fortnox causing credit invoice to be blank.
  • woo-fortnox-hub/tags/5.1.3/woo-fortnox-hub.php

    r2640658 r2647366  
    1616 * Plugin URI:        https://www.bjorntech.com/fortnox-hub?utm_source=wp-fortnox&utm_medium=plugin&utm_campaign=product
    1717 * Description:       Sync your WooCommerce shop with Fortnox
    18  * Version:           5.1.2
     18 * Version:           5.1.3
    1919 * Author:            BjornTech
    2020 * Author URI:        https://bjorntech.com?utm_source=wp-fortnox&utm_medium=plugin&utm_campaign=product
     
    2323 *
    2424 * WC requires at least: 4.0
    25  * WC tested up to: 5.9
     25 * WC tested up to: 6.0
    2626 *
    2727 * Copyright:         2020 BjornTech AB
     
    7575         */
    7676        const NAME = 'WooCommerce Fortnox Hub';
    77         const VERSION = '5.1.2';
     77        const VERSION = '5.1.3';
    7878        const SCRIPT_HANDLE = 'woo-fortnox-hub';
    7979        const PLUGIN_FILE = __FILE__;
     
    176176            require_once $this->includes_dir . 'class-woo-fortnox-customer-handler.php';
    177177            require_once $this->includes_dir . 'class-woo-fortnox-hub-document-handler.php';
     178            require_once $this->includes_dir . 'class-woo-fortnox-hub-document-admin.php';
     179
     180            if ('stockchange' === get_option('fortnox_woo_order_creates')) {
     181                require_once $this->includes_dir . 'class-woo-fortnox-hub-stockchange.php';
     182            } else {
     183                require_once $this->includes_dir . 'class-woo-fortnox-hub-order.php';
     184                require_once $this->includes_dir . 'class-woo-fortnox-hub-invoice.php';
     185                require_once $this->includes_dir . 'class-woo-fortnox-hub-refund.php';
     186            }
     187
    178188            require_once $this->includes_dir . 'class-woo-fortnox-hub-invoice-status-handler.php';
    179189            require_once $this->includes_dir . 'api/class-woo-fortnox-api-filters-and-hooks.php';
     
    253263            if ('yes' == get_option('fortnox_manual_cron')) {
    254264                do_action('action_scheduler_run_queue');
    255             }
    256 
    257             if (!get_site_transient('fortnox_update_4_0_0')) {
    258                 foreach (WCFH_Util::get_available_payment_gateways() as $key => $payment_gateway) {
    259                     if ('yes' == get_option('fortnox_automatic_payment_' . $key)) {
    260                         update_option('fortnox_automatic_payment_' . $key, 'sent');
    261                     }
    262                 }
    263 
    264                 set_site_transient('fortnox_update_4_0_0', microtime());
    265             }
    266 
    267             if (!get_site_transient('fortnox_update_4_1_0')) {
    268                 $product_status = get_option('fortnox_wc_get_product_status', false);
    269 
    270                 if ($product_status === false || (!is_array($product_status) && $product_status == 'publish')) {
    271                     update_option('fortnox_wc_get_product_status', array('publish'));
    272                 } elseif (!$product_status) {
    273                     update_option('fortnox_wc_get_product_status', array_keys(get_post_statuses()));
    274                 }
    275 
    276                 set_site_transient('fortnox_update_4_1_0', microtime());
    277             }
    278 
    279             if (!get_site_transient('fortnox_update_4_2_0')) {
    280                 as_unschedule_all_actions('fortnox_sync_price_stocklevel_start');
    281                 as_unschedule_all_actions('fortnox_stripe_sync');
    282                 set_site_transient('fortnox_update_4_2_0', microtime());
    283             }
    284 
    285             if (!get_site_transient('fortnox_update_4_4_0')) {
    286                 if ($barcode = get_option('fortnox_wc_barcode')) {
    287                     update_option('fortnox_metadata_mapping_ean', $barcode);
    288                     update_option('fortnox_wc_product_update_ean', 'yes');
    289                 }
    290 
    291                 set_site_transient('fortnox_update_4_4_0', microtime());
    292265            }
    293266
  • woo-fortnox-hub/trunk/includes/admin/class-wcfh-util.php

    r2635282 r2647366  
    225225        }
    226226
    227         public static function clean_fortnox_text($str, $max_len = false)
     227        public static function clean_fortnox_text($str, $max_len = false, $empty = '')
    228228        {
    229229            $re = '/[^\p{L}\’\\\\\x{030a}a-zåäöéáœæøüA-ZÅÄÖÉÁÜŒÆØ0-9 –:\.`´’,;\^¤#%§£$€¢¥©™°&\/\(\)=\+\-\*_\!?²³®½\@\x{00a0}\n\r]*/u';
     
    236236            }
    237237
    238             return $result;
     238            return empty($result) ? $empty : $result;
    239239        }
    240240
  • woo-fortnox-hub/trunk/includes/class-woo-fortnox-customer-handler.php

    r2640658 r2647366  
    227227                $data = array_merge($data, array(
    228228                    "Name" => WCFH_Util::clean_fortnox_text($billing_name, 1024),
    229                     "Address1" => WCFH_Util::clean_fortnox_text($order->get_billing_address_1(), 1024),
    230                     "Address2" => WCFH_Util::clean_fortnox_text($order->get_billing_address_2(), 1024),
     229                    "Address1" => WCFH_Util::clean_fortnox_text($order->get_billing_address_1(), 1024, API_BLANK),
     230                    "Address2" => WCFH_Util::clean_fortnox_text($order->get_billing_address_2(), 1024, API_BLANK),
    231231                    "City" => WCFH_Util::clean_fortnox_text($order->get_billing_city(), 1024),
    232232                    "ZipCode" => WCFH_Util::clean_fortnox_text($order->get_billing_postcode(), 10),
     
    291291                $data = array(
    292292                    "DeliveryName" => WCFH_Util::clean_fortnox_text($shipping_to, 1024),
    293                     "DeliveryAddress1" => WCFH_Util::clean_fortnox_text($order->get_shipping_address_1(), 1024),
    294                     "DeliveryAddress2" => WCFH_Util::clean_fortnox_text($order->get_shipping_address_2(), 1024),
     293                    "DeliveryAddress1" => WCFH_Util::clean_fortnox_text($order->get_shipping_address_1(), 1024, API_BLANK),
     294                    "DeliveryAddress2" => WCFH_Util::clean_fortnox_text($order->get_shipping_address_2(), 1024, API_BLANK),
    295295                    "DeliveryCity" => WCFH_Util::clean_fortnox_text($order->get_shipping_city(), 1024),
    296296                    "DeliveryZipCode" => WCFH_Util::clean_fortnox_text($order->get_shipping_postcode(), 10),
  • woo-fortnox-hub/trunk/includes/class-woo-fortnox-hub-document-handler.php

    r2635282 r2647366  
    1313defined('ABSPATH') || exit;
    1414
    15 require_once plugin_dir_path(self::PLUGIN_FILE) . 'includes/class-woo-fortnox-hub-order.php';
    16 require_once plugin_dir_path(self::PLUGIN_FILE) . 'includes/class-woo-fortnox-hub-invoice.php';
    17 require_once plugin_dir_path(self::PLUGIN_FILE) . 'includes/class-woo-fortnox-hub-refund.php';
    18 require_once plugin_dir_path(self::PLUGIN_FILE) . 'includes/class-woo-fortnox-hub-stockchange.php';
    19 require_once plugin_dir_path(self::PLUGIN_FILE) . 'includes/class-woo-fortnox-hub-document-admin.php';
    20 
    2115if (!class_exists('Woo_Fortnox_Hub_Document_Handler', false)) {
    2216
  • woo-fortnox-hub/trunk/includes/class-woo-fortnox-hub-invoice-status-handler.php

    r2635282 r2647366  
    630630                        as_schedule_single_action(as_get_datetime_object(), 'fortnox_process_changed_invoices', array($invoice['DocumentNumber']));
    631631                    }
    632                 } else {
    633 
    634                     WC_FH()->logger->add(sprintf('No changed Fortnox invoices since %s.', $last_sync_done));
    635632                }
    636633
  • woo-fortnox-hub/trunk/includes/class-woo-fortnox-hub-wc-product-handler.php

    r2640658 r2647366  
    681681
    682682                $article = WC_FH()->fortnox->update_article($article['ArticleNumber'], $article_data);
     683
    683684            } else {
    684685
    685686                WC_FH()->logger->add(sprintf('update_article (%s): Processing Fortnox Article %s did not result in any changes', $product->get_id(), $article['ArticleNumber']));
     687
    686688            }
    687689        }
     
    941943            }
    942944
    943             $update_stock_level = get_option('fortnox_wc_product_update_stock_level');
    944             if ((($sync_all && 'yes' == $update_stock_level) || 'always' == $update_stock_level) && $product->get_manage_stock('edit') && $article['QuantityInStock'] != ($stock_quantity = $product->get_stock_quantity('edit'))) {
    945                 $article_data = $this->update_fortnox_article_stocklevel($article_data, $article['QuantityInStock'], $stock_quantity, false);
     945            $wc_qty = $product->get_stock_quantity('edit');
     946            $fn_qty = $article['QuantityInStock'];
     947            $sl_option = get_option('fortnox_wc_product_update_stock_level');
     948
     949            if ((($sync_all && 'yes' == $sl_option) || 'always' == $sl_option) && $product->get_manage_stock('edit') && $fn_qty != $wc_qty) {
     950                $article_data = $this->update_fortnox_article_stocklevel($article_data, $fn_qty, $wc_qty, false);
    946951                $changed = true;
    947952            }
     
    10111016            if ($from_stock != $to_stock) {
    10121017
    1013                 WC_FH()->logger->add(sprintf('update_fortnox_stocklevel: Changing stocklevel on Fortnox Article %s from %s to %s', $article_data['ArticleNumber'], $from_stock, $to_stock));
     1018                WC_FH()->logger->add(sprintf('update_fortnox_article_stocklevel: Changing stocklevel on Fortnox Article %s from %s to %s', $article_data['ArticleNumber'], $from_stock, $to_stock));
    10141019
    10151020                $article_data = $this->create_stocklevel_data($article_data, $to_stock);
     
    10181023                    $article = WC_FH()->fortnox->update_article($article_data['ArticleNumber'], $article_data);
    10191024                }
     1025
    10201026            } else {
    10211027
    10221028                WC_FH()->logger->add(sprintf('update_fortnox_stocklevel: No need to change stock on Fortnox Article %s from %s', $article_data['ArticleNumber'], $from_stock));
     1029
    10231030            }
    10241031
  • woo-fortnox-hub/trunk/libraries/bjorntech-fortnox-api/class-fortnox-api.php

    r2635282 r2647366  
    784784        public function get_first_customer_by_organisation_number($organisation_number)
    785785        {
    786             return ($customers = $this->get_customers_by_organisation_number($organisation_number)) ? $customers[0] : $customers;
     786            $customers = $this->get_customers_by_organisation_number($organisation_number);
     787            return $customers ? $customers[0] : $customers;
    787788        }
    788789
  • woo-fortnox-hub/trunk/readme.txt

    r2640658 r2647366  
    55Tested up to: 5.8
    66Requires PHP: 7.3
    7 Stable tag: 5.1.2
     7Stable tag: 5.1.3
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    3434
    3535== Changelog ==
     36= 5.1.3 =
     37* Working with WooCommerce 6.0
     38* Fix: If one of the adress field was empty in a new order and at the same time had content on a Fortnox customer card, the card data was faulty added to the Order/Invoice.
     39* Fix: Stocklevel was faulty changed on a product in Fortnox when an order item including the product was removed from a order manually in order admin.
    3640= 5.1.2 =
    3741* Fix: Rows in partial credits was not updated correctly in Fortnox causing credit invoice to be blank.
  • woo-fortnox-hub/trunk/woo-fortnox-hub.php

    r2640658 r2647366  
    1616 * Plugin URI:        https://www.bjorntech.com/fortnox-hub?utm_source=wp-fortnox&utm_medium=plugin&utm_campaign=product
    1717 * Description:       Sync your WooCommerce shop with Fortnox
    18  * Version:           5.1.2
     18 * Version:           5.1.3
    1919 * Author:            BjornTech
    2020 * Author URI:        https://bjorntech.com?utm_source=wp-fortnox&utm_medium=plugin&utm_campaign=product
     
    2323 *
    2424 * WC requires at least: 4.0
    25  * WC tested up to: 5.9
     25 * WC tested up to: 6.0
    2626 *
    2727 * Copyright:         2020 BjornTech AB
     
    7575         */
    7676        const NAME = 'WooCommerce Fortnox Hub';
    77         const VERSION = '5.1.2';
     77        const VERSION = '5.1.3';
    7878        const SCRIPT_HANDLE = 'woo-fortnox-hub';
    7979        const PLUGIN_FILE = __FILE__;
     
    176176            require_once $this->includes_dir . 'class-woo-fortnox-customer-handler.php';
    177177            require_once $this->includes_dir . 'class-woo-fortnox-hub-document-handler.php';
     178            require_once $this->includes_dir . 'class-woo-fortnox-hub-document-admin.php';
     179
     180            if ('stockchange' === get_option('fortnox_woo_order_creates')) {
     181                require_once $this->includes_dir . 'class-woo-fortnox-hub-stockchange.php';
     182            } else {
     183                require_once $this->includes_dir . 'class-woo-fortnox-hub-order.php';
     184                require_once $this->includes_dir . 'class-woo-fortnox-hub-invoice.php';
     185                require_once $this->includes_dir . 'class-woo-fortnox-hub-refund.php';
     186            }
     187
    178188            require_once $this->includes_dir . 'class-woo-fortnox-hub-invoice-status-handler.php';
    179189            require_once $this->includes_dir . 'api/class-woo-fortnox-api-filters-and-hooks.php';
     
    253263            if ('yes' == get_option('fortnox_manual_cron')) {
    254264                do_action('action_scheduler_run_queue');
    255             }
    256 
    257             if (!get_site_transient('fortnox_update_4_0_0')) {
    258                 foreach (WCFH_Util::get_available_payment_gateways() as $key => $payment_gateway) {
    259                     if ('yes' == get_option('fortnox_automatic_payment_' . $key)) {
    260                         update_option('fortnox_automatic_payment_' . $key, 'sent');
    261                     }
    262                 }
    263 
    264                 set_site_transient('fortnox_update_4_0_0', microtime());
    265             }
    266 
    267             if (!get_site_transient('fortnox_update_4_1_0')) {
    268                 $product_status = get_option('fortnox_wc_get_product_status', false);
    269 
    270                 if ($product_status === false || (!is_array($product_status) && $product_status == 'publish')) {
    271                     update_option('fortnox_wc_get_product_status', array('publish'));
    272                 } elseif (!$product_status) {
    273                     update_option('fortnox_wc_get_product_status', array_keys(get_post_statuses()));
    274                 }
    275 
    276                 set_site_transient('fortnox_update_4_1_0', microtime());
    277             }
    278 
    279             if (!get_site_transient('fortnox_update_4_2_0')) {
    280                 as_unschedule_all_actions('fortnox_sync_price_stocklevel_start');
    281                 as_unschedule_all_actions('fortnox_stripe_sync');
    282                 set_site_transient('fortnox_update_4_2_0', microtime());
    283             }
    284 
    285             if (!get_site_transient('fortnox_update_4_4_0')) {
    286                 if ($barcode = get_option('fortnox_wc_barcode')) {
    287                     update_option('fortnox_metadata_mapping_ean', $barcode);
    288                     update_option('fortnox_wc_product_update_ean', 'yes');
    289                 }
    290 
    291                 set_site_transient('fortnox_update_4_4_0', microtime());
    292265            }
    293266
Note: See TracChangeset for help on using the changeset viewer.