Bugzilla – Attachment 184518 Details for
Bug 16631
Show groups/categories of reports to authorized staff
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Bug 16631: 0011-Add-library-limits-info-to-duplicate-section-and-fix
0011-Add-library-limits-info-to-duplicate-section-and-fix.patch (text/plain), 6.83 KB, created by
Casey Conlin
on 2025-07-22 22:04:02 UTC
(
hide
)
Description:
Bug 16631: 0011-Add-library-limits-info-to-duplicate-section-and-fix
Filename:
MIME Type:
Creator:
Casey Conlin
Created:
2025-07-22 22:04:02 UTC
Size:
6.83 KB
patch
obsolete
>From 1eb2c4bfbea6d55a29b33d0e66a7fcd886226de8 Mon Sep 17 00:00:00 2001 >From: Casey Conlin <101153261+CaseyConlin@users.noreply.github.com> >Date: Sat, 12 Jul 2025 15:23:38 -0400 >Subject: [PATCH 11/16] Add library limits info to duplicate section and fix > limit info not showing after saving. > >--- > .../modules/reports/guided_reports_start.tt | 13 +++++++- > reports/guided_reports.pl | 33 ++++++++++++++----- > 2 files changed, 37 insertions(+), 9 deletions(-) > >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 8e6a4fd042..ade44dd2c7 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 >@@ -1436,7 +1436,18 @@ > <span class="required">Required</span> > </div> > </fieldset> >- >+ [% IF ( Koha.Preference('EnableFilteringReports') ) %] >+ <fieldset class="rows"> >+ <legend>Library limitation:</legend> >+ <div >+ ><label for="library_limitation">Library limitation: </label> >+ <select id="library_limitation" name="branches" multiple size="10"> >+ [% PROCESS options_for_libraries libraries => Branches.all( selected => report.get_library_limits, unfiltered => 1, do_not_select_my_library => 1 ) %] >+ </select> >+ <div class="hint">Limits the use of this report to the selected libraries.</div> >+ </div> >+ </fieldset> >+ [% END %] > <fieldset class="action"> > <input type="hidden" name="op" value="cud-save" /> > <input type="submit" name="submit" class="btn btn-primary" value="Save report" /> >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index e3c34532e6..00d2e0ccb0 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -58,6 +58,7 @@ my $input = CGI->new; > my $usecache = Koha::Caches->get_instance->memcached_cache; > > my $op = $input->param('op') // ''; >+print STDERR "DEBUG op: $op\n"; > > # my @branches = grep { $_ ne q{} } $input->multi_param('branches'); > my $flagsrequired; >@@ -130,7 +131,7 @@ if ( !$op ) { > 'showsql' => 1, > 'mana_success' => scalar $input->param('mana_success'), > 'mana_id' => $report->{mana_id}, >- 'mana_comments' => $report->{comments} >+ 'mana_comments' => $report->{comments}, > ); > > } elsif ( $op eq 'edit_form' ) { >@@ -228,9 +229,8 @@ if ( !$op ) { > 'problematic_authvals' => $problematic_authvals, > 'warn_authval_problem' => 1, > 'phase_update' => 1, >- >- # 'branches' => @branches, >- 'report' => $report, >+ 'branches' => @branches, >+ 'report' => $report, > ); > > } else { >@@ -246,6 +246,8 @@ if ( !$op ) { > notes => $notes, > public => $public, > cache_expiry => $cache_expiry, >+ >+ # report => $report, > } > ); > >@@ -269,7 +271,9 @@ if ( !$op ) { > 'public' => $public, > 'usecache' => $usecache, > 'tables' => $tables, >- 'branches' => @branches, >+ >+ # 'branches' => @branches, >+ 'report' => $report, > ); > logaction( "REPORTS", "MODIFY", $id, "$reportname | $sql" ) if C4::Context->preference("ReportsLog"); > } >@@ -513,6 +517,7 @@ if ( !$op ) { > my $area = $input->param('area'); > my $sql = $input->param('sql'); > my $type = $input->param('type'); >+ > $template->param( > 'save' => 1, > 'area' => $area, >@@ -538,6 +543,7 @@ if ( !$op ) { > my $public = $input->param('public'); > my $save_anyway = $input->param('save_anyway'); > my $tables = get_tables(); >+ my @branches = grep { $_ ne q{} } $input->multi_param('branches'); > > # if we have the units, then we came from creating a report from SQL and thus need to handle converting units > if ($cache_expiry_units) { >@@ -615,6 +621,9 @@ if ( !$op ) { > public => $public, > } > ); >+ my $report = Koha::Reports->find($id); >+ $report->replace_library_limits( \@branches ); >+ > logaction( "REPORTS", "ADD", $id, "$name | $sql" ) if C4::Context->preference("ReportsLog"); > $template->param( > 'save_successful' => 1, >@@ -627,7 +636,8 @@ if ( !$op ) { > 'cache_expiry' => $cache_expiry, > 'public' => $public, > 'usecache' => $usecache, >- 'tables' => $tables >+ 'tables' => $tables, >+ 'report' => $report, > ); > } > } >@@ -770,20 +780,24 @@ if ( !$op ) { > > } elsif ( $op eq 'add_form_sql' || $op eq 'duplicate' ) { > >- my ( $group, $subgroup, $sql, $reportname, $notes ); >+ my ( $group, $subgroup, $sql, $reportname, $notes, @branches, $report ); > if ( $input->param('sql') ) { > $group = $input->param('report_group'); > $subgroup = $input->param('report_subgroup'); > $sql = $input->param('sql') // ''; > $reportname = $input->param('reportname') // ''; > $notes = $input->param('notes') // ''; >+ @branches = grep { $_ ne q{} } $input->multi_param('branches'); >+ > } elsif ( my $report_id = $input->param('id') ) { >- my $report = Koha::Reports->find($report_id); >+ $report = Koha::Reports->find($report_id); > $group = $report->report_group; > $subgroup = $report->report_subgroup; > $sql = $report->savedsql // ''; > $reportname = $report->report_name // ''; > $notes = $report->notes // ''; >+ @branches = grep { $_ ne q{} } $input->multi_param('branches'); >+ > } > > my $tables = get_tables(); >@@ -799,6 +813,9 @@ if ( !$op ) { > 'usecache' => $usecache, > 'tables' => $tables, > >+ # 'branches' => \@branches, >+ 'report' => $report, >+ > ); > } > >-- >2.39.5 >
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 Raw
Actions:
View
Attachments on
bug 16631
:
184422
|
184508
|
184509
|
184510
|
184511
|
184512
|
184513
|
184514
|
184515
|
184516
|
184517
|
184518
|
184519
|
184520
|
184521
|
184522
|
184525
|
184526
|
184657
|
184674
|
184686
|
184687
|
184688
|
184689
|
184690
|
184691
|
184692
|
184693
|
184694
|
184695
|
184845
|
184846
|
184847
|
184848
|
184859
|
184861