Changeset 3123909
- Timestamp:
- 07/23/2024 01:06:31 PM (21 months ago)
- Location:
- posti-warehouse
- Files:
-
- 10 edited
- 1 copied
-
tags/2.6.1 (copied) (copied from posti-warehouse/trunk)
-
tags/2.6.1/README.md (modified) (1 diff)
-
tags/2.6.1/classes/class-api.php (modified) (1 diff)
-
tags/2.6.1/classes/class-product.php (modified) (8 diffs)
-
tags/2.6.1/posti-warehouse.php (modified) (1 diff)
-
tags/2.6.1/readme.txt (modified) (1 diff)
-
trunk/README.md (modified) (1 diff)
-
trunk/classes/class-api.php (modified) (1 diff)
-
trunk/classes/class-product.php (modified) (8 diffs)
-
trunk/posti-warehouse.php (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
posti-warehouse/tags/2.6.1/README.md
r3105684 r3123909 98 98 99 99 ## Version history 100 - 2.6.1: Bug fix: do not publish product when Dropshipping is selected. 100 101 - 2.6.0: 101 102 - Added 'Reserve quantity for "On-hold" orders' setting. -
posti-warehouse/tags/2.6.1/classes/class-api.php
r3105684 r3123909 14 14 private $last_status = false; 15 15 private $token_option = 'posti_wh_api_auth'; 16 private $user_agent = 'woo-wh-client/2.6. 0';16 private $user_agent = 'woo-wh-client/2.6.1'; 17 17 18 18 public function __construct(Posti_Warehouse_Logger $logger, array &$options) { -
posti-warehouse/tags/2.6.1/classes/class-product.php
r3105684 r3123909 293 293 $product_ids_map = array(); 294 294 $warehouses = $this->api->getWarehouses(); 295 $can_ add_balances= $this->is_warehouse_supports_add_remove($warehouses, $product_warehouse_override);295 $can_manage_inventory = $this->is_warehouse_supports_add_remove($warehouses, $product_warehouse_override); 296 296 $cnt_fail = 0; 297 297 foreach ($post_ids as $post_id) { … … 313 313 if ('variable' == $product_type) { 314 314 $this->collect_products_variations($post_id, $retailerId, 315 $_product, $product_distributor, $product_warehouse, $wholesale_price, $products, $product_id_diffs, $product_ids_map, $can_add_balances);315 $_product, $product_distributor, $product_warehouse, $wholesale_price, $products, $product_id_diffs, $product_ids_map); 316 316 } else { 317 317 $this->collect_products_simple($post_id, $retailerId, 318 $_product, $product_distributor, $product_warehouse, $wholesale_price, $products, $product_id_diffs, $product_ids_map, $can_add_balances);318 $_product, $product_distributor, $product_warehouse, $wholesale_price, $products, $product_id_diffs, $product_ids_map); 319 319 } 320 320 } … … 323 323 $balances_obsolete = $this->get_balances_for_removal($product_whs_diffs, $product_ids_map, $warehouses); 324 324 if (count($balances_obsolete) > 0) { 325 $errors = $this->api->deleteInventoryBalances($balances_obsolete);325 $errors = $can_manage_inventory ? $this->api->deleteInventoryBalances($balances_obsolete) : array(); 326 326 if (false !== $errors) { 327 327 $cnt = count($balances_obsolete); … … 364 364 365 365 if (count($products) > 0) { 366 $errors = $this->api->putInventory($products);366 $errors = $can_manage_inventory ? $this->api->putInventory($products) : array(); 367 367 if (false !== $errors) { 368 368 $cnt = count($products); … … 455 455 456 456 private function collect_products_variations($post_id, $retailerId, 457 $_product, $product_distributor, $product_warehouse, $wholesale_price, &$products, &$product_id_diffs, &$product_ids_map, $can_add_balances) {457 $_product, $product_distributor, $product_warehouse, $wholesale_price, &$products, &$product_id_diffs, &$product_ids_map) { 458 458 459 459 $variations = $this->get_available_variations($_product); … … 521 521 $product_ids_map['VAR-' . $variation_product_id] = $variation_post_id; 522 522 if (!empty($product_warehouse)) { 523 if ($can_add_balances) { 524 $balances = array( 525 array( 526 'retailerId' => $retailerId, 527 'catalogExternalId' => $product_warehouse, 528 'wholesalePrice' => $wholesale_price ? $wholesale_price : (float) $variation['display_regular_price'], 529 'currency' => get_woocommerce_currency() 530 ) 531 ); 532 } 523 $balances = array( 524 array( 525 'retailerId' => $retailerId, 526 'catalogExternalId' => $product_warehouse, 527 'wholesalePrice' => $wholesale_price ? $wholesale_price : (float) $variation['display_regular_price'], 528 'currency' => get_woocommerce_currency() 529 ) 530 ); 533 531 } 534 532 else { … … 547 545 548 546 private function collect_products_simple($post_id, $retailerId, 549 $_product, $product_distributor, $product_warehouse, $wholesale_price, &$products, &$product_id_diffs, &$product_ids_map, $can_add_balances) {547 $_product, $product_distributor, $product_warehouse, $wholesale_price, &$products, &$product_id_diffs, &$product_ids_map) { 550 548 551 549 $ean = get_post_meta($post_id, '_ean', true); … … 593 591 $product_ids_map[$product_id] = $post_id; 594 592 if (!empty($product_warehouse)) { 595 if ($can_add_balances) { 596 $balances = array( 597 array( 598 'retailerId' => $retailerId, 599 'catalogExternalId' => $product_warehouse, 600 'wholesalePrice' => $wholesale_price, 601 'currency' => get_woocommerce_currency() 602 ) 603 ); 604 } 593 $balances = array( 594 array( 595 'retailerId' => $retailerId, 596 'catalogExternalId' => $product_warehouse, 597 'wholesalePrice' => $wholesale_price, 598 'currency' => get_woocommerce_currency() 599 ) 600 ); 605 601 } 606 602 else { -
posti-warehouse/tags/2.6.1/posti-warehouse.php
r3105684 r3123909 3 3 /** 4 4 * Plugin Name: Posti Warehouse 5 * Version: 2.6. 05 * Version: 2.6.1 6 6 * Description: Provides integration to Posti warehouse and dropshipping services. 7 7 * Author: Posti -
posti-warehouse/tags/2.6.1/readme.txt
r3105684 r3123909 3 3 Tags: woocommerce, warehouse, posti 4 4 Requires at least: 5.0 5 Tested up to: 6. 4.35 Tested up to: 6.6 6 6 Requires PHP: 7.1 7 Stable tag: 2.6. 07 Stable tag: 2.6.1 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html -
posti-warehouse/trunk/README.md
r3105684 r3123909 98 98 99 99 ## Version history 100 - 2.6.1: Bug fix: do not publish product when Dropshipping is selected. 100 101 - 2.6.0: 101 102 - Added 'Reserve quantity for "On-hold" orders' setting. -
posti-warehouse/trunk/classes/class-api.php
r3105684 r3123909 14 14 private $last_status = false; 15 15 private $token_option = 'posti_wh_api_auth'; 16 private $user_agent = 'woo-wh-client/2.6. 0';16 private $user_agent = 'woo-wh-client/2.6.1'; 17 17 18 18 public function __construct(Posti_Warehouse_Logger $logger, array &$options) { -
posti-warehouse/trunk/classes/class-product.php
r3105684 r3123909 293 293 $product_ids_map = array(); 294 294 $warehouses = $this->api->getWarehouses(); 295 $can_ add_balances= $this->is_warehouse_supports_add_remove($warehouses, $product_warehouse_override);295 $can_manage_inventory = $this->is_warehouse_supports_add_remove($warehouses, $product_warehouse_override); 296 296 $cnt_fail = 0; 297 297 foreach ($post_ids as $post_id) { … … 313 313 if ('variable' == $product_type) { 314 314 $this->collect_products_variations($post_id, $retailerId, 315 $_product, $product_distributor, $product_warehouse, $wholesale_price, $products, $product_id_diffs, $product_ids_map, $can_add_balances);315 $_product, $product_distributor, $product_warehouse, $wholesale_price, $products, $product_id_diffs, $product_ids_map); 316 316 } else { 317 317 $this->collect_products_simple($post_id, $retailerId, 318 $_product, $product_distributor, $product_warehouse, $wholesale_price, $products, $product_id_diffs, $product_ids_map, $can_add_balances);318 $_product, $product_distributor, $product_warehouse, $wholesale_price, $products, $product_id_diffs, $product_ids_map); 319 319 } 320 320 } … … 323 323 $balances_obsolete = $this->get_balances_for_removal($product_whs_diffs, $product_ids_map, $warehouses); 324 324 if (count($balances_obsolete) > 0) { 325 $errors = $this->api->deleteInventoryBalances($balances_obsolete);325 $errors = $can_manage_inventory ? $this->api->deleteInventoryBalances($balances_obsolete) : array(); 326 326 if (false !== $errors) { 327 327 $cnt = count($balances_obsolete); … … 364 364 365 365 if (count($products) > 0) { 366 $errors = $this->api->putInventory($products);366 $errors = $can_manage_inventory ? $this->api->putInventory($products) : array(); 367 367 if (false !== $errors) { 368 368 $cnt = count($products); … … 455 455 456 456 private function collect_products_variations($post_id, $retailerId, 457 $_product, $product_distributor, $product_warehouse, $wholesale_price, &$products, &$product_id_diffs, &$product_ids_map, $can_add_balances) {457 $_product, $product_distributor, $product_warehouse, $wholesale_price, &$products, &$product_id_diffs, &$product_ids_map) { 458 458 459 459 $variations = $this->get_available_variations($_product); … … 521 521 $product_ids_map['VAR-' . $variation_product_id] = $variation_post_id; 522 522 if (!empty($product_warehouse)) { 523 if ($can_add_balances) { 524 $balances = array( 525 array( 526 'retailerId' => $retailerId, 527 'catalogExternalId' => $product_warehouse, 528 'wholesalePrice' => $wholesale_price ? $wholesale_price : (float) $variation['display_regular_price'], 529 'currency' => get_woocommerce_currency() 530 ) 531 ); 532 } 523 $balances = array( 524 array( 525 'retailerId' => $retailerId, 526 'catalogExternalId' => $product_warehouse, 527 'wholesalePrice' => $wholesale_price ? $wholesale_price : (float) $variation['display_regular_price'], 528 'currency' => get_woocommerce_currency() 529 ) 530 ); 533 531 } 534 532 else { … … 547 545 548 546 private function collect_products_simple($post_id, $retailerId, 549 $_product, $product_distributor, $product_warehouse, $wholesale_price, &$products, &$product_id_diffs, &$product_ids_map, $can_add_balances) {547 $_product, $product_distributor, $product_warehouse, $wholesale_price, &$products, &$product_id_diffs, &$product_ids_map) { 550 548 551 549 $ean = get_post_meta($post_id, '_ean', true); … … 593 591 $product_ids_map[$product_id] = $post_id; 594 592 if (!empty($product_warehouse)) { 595 if ($can_add_balances) { 596 $balances = array( 597 array( 598 'retailerId' => $retailerId, 599 'catalogExternalId' => $product_warehouse, 600 'wholesalePrice' => $wholesale_price, 601 'currency' => get_woocommerce_currency() 602 ) 603 ); 604 } 593 $balances = array( 594 array( 595 'retailerId' => $retailerId, 596 'catalogExternalId' => $product_warehouse, 597 'wholesalePrice' => $wholesale_price, 598 'currency' => get_woocommerce_currency() 599 ) 600 ); 605 601 } 606 602 else { -
posti-warehouse/trunk/posti-warehouse.php
r3105684 r3123909 3 3 /** 4 4 * Plugin Name: Posti Warehouse 5 * Version: 2.6. 05 * Version: 2.6.1 6 6 * Description: Provides integration to Posti warehouse and dropshipping services. 7 7 * Author: Posti -
posti-warehouse/trunk/readme.txt
r3105684 r3123909 3 3 Tags: woocommerce, warehouse, posti 4 4 Requires at least: 5.0 5 Tested up to: 6. 4.35 Tested up to: 6.6 6 6 Requires PHP: 7.1 7 Stable tag: 2.6. 07 Stable tag: 2.6.1 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html
Note: See TracChangeset
for help on using the changeset viewer.