Bugzilla – Attachment 107970 Details for
Bug 26165
Duplicating large saved report leads to error due to length of URI
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26165: Fix duplication of large saved reports
Bug-26165-Fix-duplication-of-large-saved-reports.patch (text/plain), 6.15 KB, created by
Owen Leonard
on 2020-08-07 17:29:48 UTC
(
hide
)
Description:
Bug 26165: Fix duplication of large saved reports
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2020-08-07 17:29:48 UTC
Size:
6.15 KB
patch
obsolete
>From 6630780ebd86edefca7c6f7f5a75cf694567e040 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 7 Aug 2020 12:44:28 +0200 >Subject: [PATCH] Bug 26165: Fix duplication of large saved reports > >If the combined character length of a saved report's >title, notes and SQL is too long then pressing the >'duplicate' button will lead to an error: > >"Request-URI Too Long >The requested URL's length exceeds the capacity limit >for this server." > >Test plan: >1. Create a simple SQL report and add a lot of text > into the notes field (the combined URL lenth must be > >8225 characters) >2. Save the report >3. Press the duplicate the report from the saved reports page > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > .../prog/en/includes/reports-toolbar.inc | 2 +- > .../en/modules/reports/guided_reports_start.tt | 2 +- > reports/guided_reports.pl | 33 ++++++++++++++-------- > 3 files changed, 24 insertions(+), 13 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc >index fd7ce29ce9..305de93f34 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc >@@ -23,7 +23,7 @@ > </div> > [% END %] > <div class="btn-group"> >- <a class="btn btn-default" title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from SQL&sql=[% original_sql || sql |uri %]&reportname=[% reportname |uri %]&notes=[% notes |uri %]"> >+ <a class="btn btn-default" title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from existing&report_id=[% id | uri %]"> > <i class="fa fa-copy"></i> Duplicate > </a> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >index e704e19493..a7a52b7c5b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt >@@ -332,7 +332,7 @@ > <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&phase=Show%20SQL"><i class="fa fa-search"></i> Show</a></li> > [% IF ( CAN_user_reports_create_reports ) %] > <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&phase=Edit%20SQL"><i class="fa fa-pencil"></i> Edit</a></li> >- <li><a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from SQL&sql=[% savedreport.savedsql |uri %]&reportname=[% savedreport.report_name |uri %]&notes=[% savedreport.notes |uri %]"><i class="fa fa-copy"></i> Duplicate</a></li> >+ <li><a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from existing&report_id=[% savedreport.id | uri %]"><i class="fa fa-copy"></i> Duplicate</a></li> > [% END %] > [% IF (Koha.Preference('Mana') == 1) %] > <li><a class="ShareButton" data-toggle="modal" href="#mana_share_report" title="Share your report with Mana Knowledge Base"><i class="fa fa-share-alt"></i> Share</a></li> >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index fa2817f1c7..f52a6df432 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -55,7 +55,8 @@ my $usecache = Koha::Caches->get_instance->memcached_cache; > > my $phase = $input->param('phase') // ''; > my $flagsrequired; >-if ( ( $phase eq 'Build new' ) || ( $phase eq 'Create report from SQL' ) || ( $phase eq 'Edit SQL' ) ){ >+if ( ( $phase eq 'Build new' ) || ( $phase eq 'Create report from SQL' ) || ( $phase eq 'Edit SQL' ) >+ || ( $phase eq 'Build new from existing' ) ) { > $flagsrequired = 'create_reports'; > } > elsif ( $phase eq 'Use saved' ) { >@@ -973,25 +974,35 @@ elsif ($phase eq 'Export'){ > ); > } > >-elsif ( $phase eq 'Create report from SQL' ) { >+elsif ( $phase eq 'Create report from SQL' || $phase eq 'Create report from existing' ) { > >- my ($group, $subgroup); >- # allow the user to paste in sql >+ my ($group, $subgroup, $sql, $reportname, $notes); > if ( $input->param('sql') ) { >- $group = $input->param('report_group'); >- $subgroup = $input->param('report_subgroup'); >- $template->param( >- 'sql' => scalar $input->param('sql') // '', >- 'reportname' => scalar $input->param('reportname') // '', >- 'notes' => scalar $input->param('notes') // '', >- ); >+ $group = $input->param('report_group'); >+ $subgroup = $input->param('report_subgroup'); >+ $sql = $input->param('sql') // ''; >+ $reportname = $input->param('reportname') // ''; >+ $notes = $input->param('notes') // ''; >+ } >+ elsif ( my $report_id = $input->param('report_id') ) { >+ my $report = Koha::Reports->find($report_id); >+ $group = $report->report_group; >+ $subgroup = $report->report_subgroup; >+ $sql = $report->savedsql // ''; >+ $reportname = $report->report_name // ''; >+ $notes = $report->notes // ''; > } >+ > $template->param( >+ sql => $sql, >+ reportname => $reportname, >+ notes => $notes, > 'create' => 1, > 'groups_with_subgroups' => groups_with_subgroups($group, $subgroup), > 'public' => '0', > 'cache_expiry' => 300, > 'usecache' => $usecache, >+ > ); > } > >-- >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 26165
:
107950
|
107970
|
108011