Changeset 2647366
- Timestamp:
- 12/21/2021 01:48:54 PM (4 years ago)
- Location:
- woo-fortnox-hub
- Files:
-
- 16 edited
- 1 copied
-
tags/5.1.3 (copied) (copied from woo-fortnox-hub/trunk)
-
tags/5.1.3/includes/admin/class-wcfh-util.php (modified) (2 diffs)
-
tags/5.1.3/includes/class-woo-fortnox-customer-handler.php (modified) (2 diffs)
-
tags/5.1.3/includes/class-woo-fortnox-hub-document-handler.php (modified) (1 diff)
-
tags/5.1.3/includes/class-woo-fortnox-hub-invoice-status-handler.php (modified) (1 diff)
-
tags/5.1.3/includes/class-woo-fortnox-hub-wc-product-handler.php (modified) (4 diffs)
-
tags/5.1.3/libraries/bjorntech-fortnox-api/class-fortnox-api.php (modified) (1 diff)
-
tags/5.1.3/readme.txt (modified) (2 diffs)
-
tags/5.1.3/woo-fortnox-hub.php (modified) (5 diffs)
-
trunk/includes/admin/class-wcfh-util.php (modified) (2 diffs)
-
trunk/includes/class-woo-fortnox-customer-handler.php (modified) (2 diffs)
-
trunk/includes/class-woo-fortnox-hub-document-handler.php (modified) (1 diff)
-
trunk/includes/class-woo-fortnox-hub-invoice-status-handler.php (modified) (1 diff)
-
trunk/includes/class-woo-fortnox-hub-wc-product-handler.php (modified) (4 diffs)
-
trunk/libraries/bjorntech-fortnox-api/class-fortnox-api.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/woo-fortnox-hub.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-fortnox-hub/tags/5.1.3/includes/admin/class-wcfh-util.php
r2635282 r2647366 225 225 } 226 226 227 public static function clean_fortnox_text($str, $max_len = false )227 public static function clean_fortnox_text($str, $max_len = false, $empty = '') 228 228 { 229 229 $re = '/[^\p{L}\’\\\\\x{030a}a-zåäöéáœæøüA-ZÅÄÖÉÁÜŒÆØ0-9 –:\.`´’,;\^¤#%§£$€¢¥©™°&\/\(\)=\+\-\*_\!?²³®½\@\x{00a0}\n\r]*/u'; … … 236 236 } 237 237 238 return $result;238 return empty($result) ? $empty : $result; 239 239 } 240 240 -
woo-fortnox-hub/tags/5.1.3/includes/class-woo-fortnox-customer-handler.php
r2640658 r2647366 227 227 $data = array_merge($data, array( 228 228 "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), 231 231 "City" => WCFH_Util::clean_fortnox_text($order->get_billing_city(), 1024), 232 232 "ZipCode" => WCFH_Util::clean_fortnox_text($order->get_billing_postcode(), 10), … … 291 291 $data = array( 292 292 "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), 295 295 "DeliveryCity" => WCFH_Util::clean_fortnox_text($order->get_shipping_city(), 1024), 296 296 "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 13 13 defined('ABSPATH') || exit; 14 14 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 21 15 if (!class_exists('Woo_Fortnox_Hub_Document_Handler', false)) { 22 16 -
woo-fortnox-hub/tags/5.1.3/includes/class-woo-fortnox-hub-invoice-status-handler.php
r2635282 r2647366 630 630 as_schedule_single_action(as_get_datetime_object(), 'fortnox_process_changed_invoices', array($invoice['DocumentNumber'])); 631 631 } 632 } else {633 634 WC_FH()->logger->add(sprintf('No changed Fortnox invoices since %s.', $last_sync_done));635 632 } 636 633 -
woo-fortnox-hub/tags/5.1.3/includes/class-woo-fortnox-hub-wc-product-handler.php
r2640658 r2647366 681 681 682 682 $article = WC_FH()->fortnox->update_article($article['ArticleNumber'], $article_data); 683 683 684 } else { 684 685 685 686 WC_FH()->logger->add(sprintf('update_article (%s): Processing Fortnox Article %s did not result in any changes', $product->get_id(), $article['ArticleNumber'])); 687 686 688 } 687 689 } … … 941 943 } 942 944 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); 946 951 $changed = true; 947 952 } … … 1011 1016 if ($from_stock != $to_stock) { 1012 1017 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)); 1014 1019 1015 1020 $article_data = $this->create_stocklevel_data($article_data, $to_stock); … … 1018 1023 $article = WC_FH()->fortnox->update_article($article_data['ArticleNumber'], $article_data); 1019 1024 } 1025 1020 1026 } else { 1021 1027 1022 1028 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 1023 1030 } 1024 1031 -
woo-fortnox-hub/tags/5.1.3/libraries/bjorntech-fortnox-api/class-fortnox-api.php
r2635282 r2647366 784 784 public function get_first_customer_by_organisation_number($organisation_number) 785 785 { 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; 787 788 } 788 789 -
woo-fortnox-hub/tags/5.1.3/readme.txt
r2640658 r2647366 5 5 Tested up to: 5.8 6 6 Requires PHP: 7.3 7 Stable tag: 5.1. 27 Stable tag: 5.1.3 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 34 34 35 35 == 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. 36 40 = 5.1.2 = 37 41 * 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 16 16 * Plugin URI: https://www.bjorntech.com/fortnox-hub?utm_source=wp-fortnox&utm_medium=plugin&utm_campaign=product 17 17 * Description: Sync your WooCommerce shop with Fortnox 18 * Version: 5.1. 218 * Version: 5.1.3 19 19 * Author: BjornTech 20 20 * Author URI: https://bjorntech.com?utm_source=wp-fortnox&utm_medium=plugin&utm_campaign=product … … 23 23 * 24 24 * WC requires at least: 4.0 25 * WC tested up to: 5.925 * WC tested up to: 6.0 26 26 * 27 27 * Copyright: 2020 BjornTech AB … … 75 75 */ 76 76 const NAME = 'WooCommerce Fortnox Hub'; 77 const VERSION = '5.1. 2';77 const VERSION = '5.1.3'; 78 78 const SCRIPT_HANDLE = 'woo-fortnox-hub'; 79 79 const PLUGIN_FILE = __FILE__; … … 176 176 require_once $this->includes_dir . 'class-woo-fortnox-customer-handler.php'; 177 177 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 178 188 require_once $this->includes_dir . 'class-woo-fortnox-hub-invoice-status-handler.php'; 179 189 require_once $this->includes_dir . 'api/class-woo-fortnox-api-filters-and-hooks.php'; … … 253 263 if ('yes' == get_option('fortnox_manual_cron')) { 254 264 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());292 265 } 293 266 -
woo-fortnox-hub/trunk/includes/admin/class-wcfh-util.php
r2635282 r2647366 225 225 } 226 226 227 public static function clean_fortnox_text($str, $max_len = false )227 public static function clean_fortnox_text($str, $max_len = false, $empty = '') 228 228 { 229 229 $re = '/[^\p{L}\’\\\\\x{030a}a-zåäöéáœæøüA-ZÅÄÖÉÁÜŒÆØ0-9 –:\.`´’,;\^¤#%§£$€¢¥©™°&\/\(\)=\+\-\*_\!?²³®½\@\x{00a0}\n\r]*/u'; … … 236 236 } 237 237 238 return $result;238 return empty($result) ? $empty : $result; 239 239 } 240 240 -
woo-fortnox-hub/trunk/includes/class-woo-fortnox-customer-handler.php
r2640658 r2647366 227 227 $data = array_merge($data, array( 228 228 "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), 231 231 "City" => WCFH_Util::clean_fortnox_text($order->get_billing_city(), 1024), 232 232 "ZipCode" => WCFH_Util::clean_fortnox_text($order->get_billing_postcode(), 10), … … 291 291 $data = array( 292 292 "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), 295 295 "DeliveryCity" => WCFH_Util::clean_fortnox_text($order->get_shipping_city(), 1024), 296 296 "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 13 13 defined('ABSPATH') || exit; 14 14 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 21 15 if (!class_exists('Woo_Fortnox_Hub_Document_Handler', false)) { 22 16 -
woo-fortnox-hub/trunk/includes/class-woo-fortnox-hub-invoice-status-handler.php
r2635282 r2647366 630 630 as_schedule_single_action(as_get_datetime_object(), 'fortnox_process_changed_invoices', array($invoice['DocumentNumber'])); 631 631 } 632 } else {633 634 WC_FH()->logger->add(sprintf('No changed Fortnox invoices since %s.', $last_sync_done));635 632 } 636 633 -
woo-fortnox-hub/trunk/includes/class-woo-fortnox-hub-wc-product-handler.php
r2640658 r2647366 681 681 682 682 $article = WC_FH()->fortnox->update_article($article['ArticleNumber'], $article_data); 683 683 684 } else { 684 685 685 686 WC_FH()->logger->add(sprintf('update_article (%s): Processing Fortnox Article %s did not result in any changes', $product->get_id(), $article['ArticleNumber'])); 687 686 688 } 687 689 } … … 941 943 } 942 944 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); 946 951 $changed = true; 947 952 } … … 1011 1016 if ($from_stock != $to_stock) { 1012 1017 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)); 1014 1019 1015 1020 $article_data = $this->create_stocklevel_data($article_data, $to_stock); … … 1018 1023 $article = WC_FH()->fortnox->update_article($article_data['ArticleNumber'], $article_data); 1019 1024 } 1025 1020 1026 } else { 1021 1027 1022 1028 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 1023 1030 } 1024 1031 -
woo-fortnox-hub/trunk/libraries/bjorntech-fortnox-api/class-fortnox-api.php
r2635282 r2647366 784 784 public function get_first_customer_by_organisation_number($organisation_number) 785 785 { 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; 787 788 } 788 789 -
woo-fortnox-hub/trunk/readme.txt
r2640658 r2647366 5 5 Tested up to: 5.8 6 6 Requires PHP: 7.3 7 Stable tag: 5.1. 27 Stable tag: 5.1.3 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 34 34 35 35 == 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. 36 40 = 5.1.2 = 37 41 * 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 16 16 * Plugin URI: https://www.bjorntech.com/fortnox-hub?utm_source=wp-fortnox&utm_medium=plugin&utm_campaign=product 17 17 * Description: Sync your WooCommerce shop with Fortnox 18 * Version: 5.1. 218 * Version: 5.1.3 19 19 * Author: BjornTech 20 20 * Author URI: https://bjorntech.com?utm_source=wp-fortnox&utm_medium=plugin&utm_campaign=product … … 23 23 * 24 24 * WC requires at least: 4.0 25 * WC tested up to: 5.925 * WC tested up to: 6.0 26 26 * 27 27 * Copyright: 2020 BjornTech AB … … 75 75 */ 76 76 const NAME = 'WooCommerce Fortnox Hub'; 77 const VERSION = '5.1. 2';77 const VERSION = '5.1.3'; 78 78 const SCRIPT_HANDLE = 'woo-fortnox-hub'; 79 79 const PLUGIN_FILE = __FILE__; … … 176 176 require_once $this->includes_dir . 'class-woo-fortnox-customer-handler.php'; 177 177 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 178 188 require_once $this->includes_dir . 'class-woo-fortnox-hub-invoice-status-handler.php'; 179 189 require_once $this->includes_dir . 'api/class-woo-fortnox-api-filters-and-hooks.php'; … … 253 263 if ('yes' == get_option('fortnox_manual_cron')) { 254 264 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());292 265 } 293 266
Note: See TracChangeset
for help on using the changeset viewer.