Improve calling the cron job queryDR, avoid adding the note 2 times to the order

Issue: OnePay Gateway - For the type return, the
$order->add_order_note() run 2 times #19
This commit is contained in:
htdat
2017-04-22 11:47:46 +07:00
parent a33745b850
commit 44c0a34fe8
+7 -5
View File
@@ -145,11 +145,13 @@ class WooViet {
// Add the action to check the cron job for handling queryDR // Add the action to check the cron job for handling queryDR
// It's not possible to add in the class "WooViet_OnePay_Domestic_Hook" because it's NOT always loadded // It's not possible to add in the class "WooViet_OnePay_Domestic_Hook" because it's NOT always loadded
$this->WooViet_OnePay_Domestic_Hook = new WooViet_OnePay_Domestic(); if ( defined( 'DOING_CRON' ) and DOING_CRON ) {
add_action( 'wooviet_handle_onepay_querydr', array( $this->WooViet_OnePay_Domestic_Hook = new WooViet_OnePay_Domestic();
$this->WooViet_OnePay_Domestic_Hook, add_action( 'wooviet_handle_onepay_querydr', array(
'handle_onepay_querydr' $this->WooViet_OnePay_Domestic_Hook,
), 10, 1 ); 'handle_onepay_querydr'
), 10, 1 );
}
} }