| @@ -12,8 +12,9 @@ | ||
| 12 | 12 | namespace WCPOS\WooCommercePOS; |
| 13 | 13 | |
| 14 | 14 | use WC_Email; |
| 15 | 15 | use WC_Order; |
| 16 | +use WCPOS\WooCommercePOS\Services\Settings; | |
| 16 | 17 | |
| 17 | 18 | /** |
| 18 | 19 | * Emails Class |
| 19 | 20 | * - manages email sending for POS orders. |
| @@ -80,9 +81,9 @@ | ||
| 80 | 81 | return $enabled; |
| 81 | 82 | } |
| 82 | 83 | |
| 83 | 84 | $email_id = $email_class instanceof WC_Email ? $email_class->id : 'unknown'; |
| 84 | - $settings = woocommerce_pos_get_settings( 'checkout', 'admin_emails' ); | |
| 85 | + $settings = Settings::instance()->admin_emails(); | |
| 85 | 86 | |
| 86 | 87 | // Master toggle off = all disabled. |
| 87 | 88 | if ( empty( $settings['enabled'] ) ) { |
| 88 | 89 | $is_enabled = false; |
| @@ -118,9 +119,9 @@ | ||
| 118 | 119 | return $enabled; |
| 119 | 120 | } |
| 120 | 121 | |
| 121 | 122 | $email_id = $email_class instanceof WC_Email ? $email_class->id : 'unknown'; |
| 122 | - $settings = woocommerce_pos_get_settings( 'checkout', 'customer_emails' ); | |
| 123 | + $settings = Settings::instance()->customer_emails(); | |
| 123 | 124 | |
| 124 | 125 | // Master toggle off = all disabled. |
| 125 | 126 | if ( empty( $settings['enabled'] ) ) { |
| 126 | 127 | $is_enabled = false; |
| @@ -159,10 +160,10 @@ | ||
| 159 | 160 | if ( ! $order instanceof WC_Order || ! woocommerce_pos_is_pos_order( $order ) ) { |
| 160 | 161 | return $recipient; |
| 161 | 162 | } |
| 162 | 163 | |
| 163 | - $admin_settings = woocommerce_pos_get_settings( 'checkout', 'admin_emails' ); | |
| 164 | - $cashier_settings = woocommerce_pos_get_settings( 'checkout', 'cashier_emails' ); | |
| 164 | + $admin_settings = Settings::instance()->admin_emails(); | |
| 165 | + $cashier_settings = Settings::instance()->cashier_emails(); | |
| 165 | 166 | |
| 166 | 167 | $admin_wants_new_order = ! empty( $admin_settings['enabled'] ) |
| 167 | 168 | && ( $admin_settings['new_order'] ?? true ); |
| 168 | 169 | |
| @@ -212,10 +213,10 @@ | ||
| 212 | 213 | return; |
| 213 | 214 | } |
| 214 | 215 | |
| 215 | 216 | // Check if anyone wants the new_order email. |
| 216 | - $admin_settings = woocommerce_pos_get_settings( 'checkout', 'admin_emails' ); | |
| 217 | - $cashier_settings = woocommerce_pos_get_settings( 'checkout', 'cashier_emails' ); | |
| 217 | + $admin_settings = Settings::instance()->admin_emails(); | |
| 218 | + $cashier_settings = Settings::instance()->cashier_emails(); | |
| 218 | 219 | |
| 219 | 220 | $admin_wants = ! empty( $admin_settings['enabled'] ) |
| 220 | 221 | && ( $admin_settings['new_order'] ?? true ); |
| 221 | 222 | $cashier_wants = ! empty( $cashier_settings['enabled'] ) |