id, 'wc-zugferd') === false && strpos($screen->id, 'shop_order') === false && strpos($screen->id, 'wc-orders') === false)) { return; } $api_key = get_option('wc_zugferd_api_key', ''); if (!empty($api_key)) { return; } ?>

'string', 'sanitize_callback' => 'sanitize_text_field', 'default' => '')); register_setting('wc_zugferd_settings_group', 'wc_zugferd_test_mode', array('type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'default' => '1')); register_setting('wc_zugferd_settings_group', 'wc_zugferd_api_url', array('type' => 'string', 'sanitize_callback' => 'esc_url_raw', 'default' => 'https://e-rechnung-cloud.de')); register_setting('wc_zugferd_settings_group', 'wc_zugferd_seller_name', array('type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'default' => '')); register_setting('wc_zugferd_settings_group', 'wc_zugferd_seller_street', array('type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'default' => '')); register_setting('wc_zugferd_settings_group', 'wc_zugferd_seller_zip', array('type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'default' => '')); register_setting('wc_zugferd_settings_group', 'wc_zugferd_seller_city', array('type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'default' => '')); register_setting('wc_zugferd_settings_group', 'wc_zugferd_seller_country', array('type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'default' => 'DE')); register_setting('wc_zugferd_settings_group', 'wc_zugferd_seller_vat_id', array('type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'default' => '')); register_setting('wc_zugferd_settings_group', 'wc_zugferd_seller_iban', array('type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'default' => '')); register_setting('wc_zugferd_settings_group', 'wc_zugferd_auto_generate', array('type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'default' => '1')); register_setting('wc_zugferd_settings_group', 'wc_zugferd_attach_email', array('type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'default' => '1')); } public static function render_settings_page() { $api_key = get_option('wc_zugferd_api_key', ''); $api_url = get_option('wc_zugferd_api_url', 'https://e-rechnung-cloud.de'); $test_mode = get_option('wc_zugferd_test_mode', '1'); // Check live credits if API Key is set $credit_info = null; if (!empty($api_key)) { $credit_info = WC_ZUGFeRD_Generator::check_api_credits($api_key, $api_url); } ?>

→

OK |

→

→

ID); if (!$order) return; $order_id = $order->get_id(); $invoice_path = $order->get_meta('_wc_zugferd_invoice_path'); $invoice_created = $order->get_meta('_wc_zugferd_created_at'); ?>
✓

add_order_note(__('ZUGFeRD E-Rechnung erfolgreich manuell über API generiert.', 'agrunert-e-rechnung-for-zugferd')); } else { $order->add_order_note(sprintf(__('Fehler bei ZUGFeRD Generierung: %s', 'agrunert-e-rechnung-for-zugferd'), $result['error'])); } } wp_safe_redirect(wp_get_referer() ? wp_get_referer() : admin_url('edit.php?post_type=shop_order')); exit; } public static function handle_manual_download() { if (!current_user_can('manage_woocommerce')) { wp_die(__('Keine Berechtigung.', 'agrunert-e-rechnung-for-zugferd')); } $order_id = isset($_GET['order_id']) ? absint($_GET['order_id']) : 0; check_admin_referer('wc_zugferd_download_' . $order_id); $order = wc_get_order($order_id); if (!$order) { wp_die(__('Bestellung nicht gefunden.', 'agrunert-e-rechnung-for-zugferd')); } $file_path = $order->get_meta('_wc_zugferd_invoice_path'); if (!empty($file_path) && file_exists($file_path)) { nocache_headers(); header('Content-Type: application/pdf'); header('Content-Disposition: attachment; filename="Rechnung_' . sanitize_file_name($order->get_order_number()) . '_ZUGFeRD.pdf"'); header('Content-Length: ' . filesize($file_path)); readfile($file_path); exit; } wp_die(__('Rechnungsdatei existiert nicht.', 'agrunert-e-rechnung-for-zugferd')); } }