From 460df72892e28b92024e3d9070d03f91f3678d18 Mon Sep 17 00:00:00 2001 From: Alexandre Faustino Date: Thu, 12 Dec 2024 11:30:54 +0000 Subject: [PATCH] Tweaks --- assets/css/order-styles.css | 4 ++-- includes/Admin.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/css/order-styles.css b/assets/css/order-styles.css index 25da40ccc..a9b41e91a 100644 --- a/assets/css/order-styles.css +++ b/assets/css/order-styles.css @@ -26,8 +26,8 @@ fill: #2aad2a; } -.type-shop_order .column-wc_actions a.button.wpo_wcpdf > svg.icon-ubl, -.woocommerce_page_wc-orders .column-wc_actions a.button.wpo_wcpdf > svg.icon-ubl { +.type-shop_order .column-wc_actions a.button.wpo_wcpdf > svg.icon-xml, +.woocommerce_page_wc-orders .column-wc_actions a.button.wpo_wcpdf > svg.icon-xml { left: auto; right: 2px; fill: black; diff --git a/includes/Admin.php b/includes/Admin.php index c6cb6e71e..6a5b201c2 100644 --- a/includes/Admin.php +++ b/includes/Admin.php @@ -223,7 +223,6 @@ public function add_listing_actions( $order ) { if ( $document = wcpdf_get_document( $document_type, $order ) ) { foreach ( $document->output_formats as $output_format ) { switch ( $output_format ) { - default: case 'pdf': if ( $document->is_enabled( $output_format ) ) { $document_url = WPO_WCPDF()->endpoint->get_document_link( $order, $document->get_type() ); @@ -280,6 +279,7 @@ public function add_listing_actions( $order ) { } $listing_actions = apply_filters( 'wpo_wcpdf_listing_actions', $listing_actions, $order ); + $xml_formats = apply_filters( 'wpo_wcpdf_xml_formats', array( 'ubl' ) ); foreach ( $listing_actions as $action => $data ) { if ( ! isset( $data['class'] ) ) { @@ -290,9 +290,9 @@ public function add_listing_actions( $order ) { $printed = $data['printed'] ? '' : ''; // ubl replaces exists - $exists = isset( $data['output_format'] ) && 'ubl' === $data['output_format'] ? '' : $exists; + $exists = isset( $data['output_format'] ) && in_array( $data['output_format'], $xml_formats ) ? '' : $exists; - if ( isset( $data['output_format'] ) && ( 'ubl' !== $data['output_format'] || $data['exists'] ) ) { + if ( isset( $data['output_format'] ) && ( ! in_array( $data['output_format'], $xml_formats ) || $data['exists'] ) ) { printf( '%5$s%6$s', esc_attr( $data['url'] ),