Changeset 3035680
- Timestamp:
- 02/14/2024 01:51:37 PM (2 years ago)
- Location:
- posti-warehouse
- Files:
-
- 14 edited
- 1 copied
-
tags/2.4.2 (copied) (copied from posti-warehouse/trunk)
-
tags/2.4.2/README.md (modified) (1 diff)
-
tags/2.4.2/classes/class-api.php (modified) (1 diff)
-
tags/2.4.2/classes/class-order.php (modified) (5 diffs)
-
tags/2.4.2/classes/class-settings.php (modified) (3 diffs)
-
tags/2.4.2/classes/class-text.php (modified) (1 diff)
-
tags/2.4.2/posti-warehouse.php (modified) (1 diff)
-
tags/2.4.2/readme.txt (modified) (1 diff)
-
trunk/README.md (modified) (1 diff)
-
trunk/classes/class-api.php (modified) (1 diff)
-
trunk/classes/class-order.php (modified) (5 diffs)
-
trunk/classes/class-settings.php (modified) (3 diffs)
-
trunk/classes/class-text.php (modified) (1 diff)
-
trunk/posti-warehouse.php (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
posti-warehouse/tags/2.4.2/README.md
r3035653 r3035680 97 97 98 98 ## Version history 99 - 2.4.2: Added "Verbose logging" setting. 99 100 - 2.4.1: internal: Changed how plugin gets order status (WC_Order get_status) 100 101 - 2.4.0: -
posti-warehouse/tags/2.4.2/classes/class-api.php
r3035653 r3035680 14 14 private $last_status = false; 15 15 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'; 17 17 18 18 public function __construct(Posti_Warehouse_Logger $logger, array &$options) { -
posti-warehouse/tags/2.4.2/classes/class-order.php
r3035653 r3035680 170 170 array_push($order_ids, (string) $order_id); 171 171 } 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)); 172 178 } 173 179 … … 185 191 ); 186 192 $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 187 201 if (count($posts) == 0) { 202 if ($is_verbose) { 203 $this->logger->log('info', "No matched orders for status update"); 204 } 205 188 206 return true; 189 207 } … … 196 214 } 197 215 } 198 199 $options = Posti_Warehouse_Settings::get(); 216 200 217 $autocomplete = Posti_Warehouse_Settings::get_value($options, 'posti_wh_field_autocomplete'); 201 218 foreach ($orders as $order) { 202 219 $order_id = $order['externalId']; 203 220 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); 205 222 } 206 223 } … … 209 226 } 210 227 211 public function sync_order( $id, $order_external_id, $order, $autocomplete ) {228 public function sync_order( $id, $order_external_id, $order, $autocomplete, $is_verbose) { 212 229 try { 213 230 $tracking = isset($order['trackingCodes']) ? $order['trackingCodes'] : ''; … … 252 269 else if ('completed' === $status_old) { 253 270 $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"); 254 274 } 255 275 -
posti-warehouse/tags/2.4.2/classes/class-settings.php
r3035564 r3035680 64 64 'posti_wh_field_test_mode', 65 65 'posti_wh_field_debug', 66 'posti_wh_field_verbose_logging', 66 67 'posti_wh_field_stock_sync_dttm', 67 68 'posti_wh_field_order_sync_dttm' … … 85 86 public static function is_debug( $options) { 86 87 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'); 87 92 } 88 93 … … 304 309 'posti_wh_custom_data' => 'custom', 305 310 ] 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 ] 306 324 ); 307 325 -
posti-warehouse/tags/2.4.2/classes/class-text.php
r3035564 r3035680 229 229 } 230 230 231 public static function field_field_verbose_logging() { 232 return __('Verbose logging', 'posti-warehouse'); 233 } 234 231 235 public static function field_stock_sync_dttm() { 232 236 return __('Datetime of last stock update', 'posti-warehouse'); -
posti-warehouse/tags/2.4.2/posti-warehouse.php
r3035653 r3035680 3 3 /** 4 4 * Plugin Name: Posti Warehouse 5 * Version: 2.4. 15 * Version: 2.4.2 6 6 * Description: Provides integration to Posti warehouse and dropshipping services. 7 7 * Author: Posti -
posti-warehouse/tags/2.4.2/readme.txt
r3035653 r3035680 5 5 Tested up to: 6.4.2 6 6 Requires PHP: 7.1 7 Stable tag: 2.4. 17 Stable tag: 2.4.2 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html -
posti-warehouse/trunk/README.md
r3035653 r3035680 97 97 98 98 ## Version history 99 - 2.4.2: Added "Verbose logging" setting. 99 100 - 2.4.1: internal: Changed how plugin gets order status (WC_Order get_status) 100 101 - 2.4.0: -
posti-warehouse/trunk/classes/class-api.php
r3035653 r3035680 14 14 private $last_status = false; 15 15 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'; 17 17 18 18 public function __construct(Posti_Warehouse_Logger $logger, array &$options) { -
posti-warehouse/trunk/classes/class-order.php
r3035653 r3035680 170 170 array_push($order_ids, (string) $order_id); 171 171 } 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)); 172 178 } 173 179 … … 185 191 ); 186 192 $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 187 201 if (count($posts) == 0) { 202 if ($is_verbose) { 203 $this->logger->log('info', "No matched orders for status update"); 204 } 205 188 206 return true; 189 207 } … … 196 214 } 197 215 } 198 199 $options = Posti_Warehouse_Settings::get(); 216 200 217 $autocomplete = Posti_Warehouse_Settings::get_value($options, 'posti_wh_field_autocomplete'); 201 218 foreach ($orders as $order) { 202 219 $order_id = $order['externalId']; 203 220 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); 205 222 } 206 223 } … … 209 226 } 210 227 211 public function sync_order( $id, $order_external_id, $order, $autocomplete ) {228 public function sync_order( $id, $order_external_id, $order, $autocomplete, $is_verbose) { 212 229 try { 213 230 $tracking = isset($order['trackingCodes']) ? $order['trackingCodes'] : ''; … … 252 269 else if ('completed' === $status_old) { 253 270 $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"); 254 274 } 255 275 -
posti-warehouse/trunk/classes/class-settings.php
r3035564 r3035680 64 64 'posti_wh_field_test_mode', 65 65 'posti_wh_field_debug', 66 'posti_wh_field_verbose_logging', 66 67 'posti_wh_field_stock_sync_dttm', 67 68 'posti_wh_field_order_sync_dttm' … … 85 86 public static function is_debug( $options) { 86 87 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'); 87 92 } 88 93 … … 304 309 'posti_wh_custom_data' => 'custom', 305 310 ] 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 ] 306 324 ); 307 325 -
posti-warehouse/trunk/classes/class-text.php
r3035564 r3035680 229 229 } 230 230 231 public static function field_field_verbose_logging() { 232 return __('Verbose logging', 'posti-warehouse'); 233 } 234 231 235 public static function field_stock_sync_dttm() { 232 236 return __('Datetime of last stock update', 'posti-warehouse'); -
posti-warehouse/trunk/posti-warehouse.php
r3035653 r3035680 3 3 /** 4 4 * Plugin Name: Posti Warehouse 5 * Version: 2.4. 15 * Version: 2.4.2 6 6 * Description: Provides integration to Posti warehouse and dropshipping services. 7 7 * Author: Posti -
posti-warehouse/trunk/readme.txt
r3035653 r3035680 5 5 Tested up to: 6.4.2 6 6 Requires PHP: 7.1 7 Stable tag: 2.4. 17 Stable tag: 2.4.2 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.