From 15eaaebdeb0d6467d608bb3ec7bec8fc178eb2b3 Mon Sep 17 00:00:00 2001 From: aslamshekh Date: Wed, 10 Jul 2019 12:58:07 +0530 Subject: [PATCH 1/2] Fix-24115, Downloads report not getting 503 any more, If previously downloaded files are removed from product --- includes/admin/reports/class-wc-report-downloads.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/admin/reports/class-wc-report-downloads.php b/includes/admin/reports/class-wc-report-downloads.php index 21e02631926..37fd6bd68fe 100644 --- a/includes/admin/reports/class-wc-report-downloads.php +++ b/includes/admin/reports/class-wc-report-downloads.php @@ -164,11 +164,15 @@ class WC_Report_Downloads extends WP_List_Table { // File information. $file = $product->get_file( $permission->get_download_id() ); - echo esc_html( $file->get_name() . ' - ' . basename( $file->get_file() ) ); + if( false === $file ){ + echo esc_html__( 'File not exists', 'woocommerce' ); + } else { + echo esc_html( $file->get_name() . ' - ' . basename( $file->get_file() ) ); - echo '
'; - echo '' . esc_html__( 'Filter by file', 'woocommerce' ) . ''; - echo '
'; + echo '
'; + echo '' . esc_html__( 'Filter by file', 'woocommerce' ) . ''; + echo '
'; + } } break; case 'order': From 3df07693666194442b202c8ebb3e78b615ce11fc Mon Sep 17 00:00:00 2001 From: aslamshekh Date: Wed, 10 Jul 2019 14:52:59 +0530 Subject: [PATCH 2/2] I have done with few changes which is suggested. --- includes/admin/reports/class-wc-report-downloads.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/admin/reports/class-wc-report-downloads.php b/includes/admin/reports/class-wc-report-downloads.php index 37fd6bd68fe..ff326ab01df 100644 --- a/includes/admin/reports/class-wc-report-downloads.php +++ b/includes/admin/reports/class-wc-report-downloads.php @@ -164,8 +164,8 @@ class WC_Report_Downloads extends WP_List_Table { // File information. $file = $product->get_file( $permission->get_download_id() ); - if( false === $file ){ - echo esc_html__( 'File not exists', 'woocommerce' ); + if ( false === $file ) { + echo esc_html__( 'File does not exist', 'woocommerce' ); } else { echo esc_html( $file->get_name() . ' - ' . basename( $file->get_file() ) );