Bugzilla – Attachment 75717 Details for
Bug 20495
Refactor C4::Reports.Guided - remove get_saved_report
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20495: (follow-up) Correct search for report by name
Bug-20495-follow-up-Correct-search-for-report-by-n.patch (text/plain), 2.62 KB, created by
Jonathan Druart
on 2018-05-31 19:34:45 UTC
(
hide
)
Description:
Bug 20495: (follow-up) Correct search for report by name
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-05-31 19:34:45 UTC
Size:
2.62 KB
patch
obsolete
>From 77787aff3978c68e707254e382d4df5a8448d3e1 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 25 May 2018 03:01:48 +0000 >Subject: [PATCH] Bug 20495: (follow-up) Correct search for report by name > >Ultimately we should probably remove name access as it is not a unique >id, but this should preserve existing behaviour > >To test: >Create a report >Use the service link to confirm the report runs >Replace id=# parameter with name=XXXXXX >Confirm URL works > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Note: We should not remove the param "name", it's a feature, see bug 8256. >--- > opac/svc/report | 5 +++-- > svc/report | 7 ++++--- > 2 files changed, 7 insertions(+), 5 deletions(-) > >diff --git a/opac/svc/report b/opac/svc/report >index 49afb3df27..ddf445fa32 100755 >--- a/opac/svc/report >+++ b/opac/svc/report >@@ -35,8 +35,9 @@ my $report_id = $query->param('id'); > my $report_name = $query->param('name'); > my $report_annotation = $query->param('annotated'); > >-my $report_rec = Koha::Reports->find( $report_name ? { 'name' => $report_name } : { 'id' => $report_id } ); >-if (!$report_rec) { die "There is no such report.\n"; } >+my $report_recs = Koha::Reports->search( $report_name ? { 'report_name' => $report_name } : { 'id' => $report_id } ); >+if ( !$report_recs || $report_recs->count == 0 ) { die "There is no such report.\n"; } >+my $report_rec = $report_recs->next(); > > die "Sorry this report is not public\n" unless $report_rec->public; > >diff --git a/svc/report b/svc/report >index 662aa58c52..3c2ad96a5c 100755 >--- a/svc/report >+++ b/svc/report >@@ -34,8 +34,9 @@ my $report_id = $query->param('id'); > my $report_name = $query->param('name'); > my $report_annotation = $query->param('annotated'); > >-my $report_rec = Koha::Reports->find( $report_name ? { 'name' => $report_name } : { 'id' => $report_id } ); >-if (!$report_rec) { die "There is no such report.\n"; } >+my $report_recs = Koha::Reports->search( $report_name ? { 'report_name' => $report_name } : { 'id' => $report_id } ); >+if (!$report_recs || $report_recs->count == 0 ) { die "There is no such report.\n"; } >+my $report_rec = $report_recs->next(); > > my @sql_params = $query->param('sql_params'); > >@@ -53,7 +54,7 @@ my $cache = Koha::Caches->get_instance(); > my $cache_active = $cache->is_cache_active; > my ($cache_key, $json_text); > if ($cache_active) { >- $cache_key = "intranet:report:".($report_name ? "name:$report_name" : "id:$report_id") >+ $cache_key = "intranet:report:".($report_name ? "report_name:$report_name" : "id:$report_id") > . join( '-', @sql_params ); > $json_text = $cache->get_from_cache($cache_key); > } >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20495
:
73423
|
74868
|
74869
|
74870
|
75653
|
75654
|
75716
| 75717