Bugzilla – Attachment 184514 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: 0007-Add-branch-libraries-to-reports-edit-view
0007-Add-branch-libraries-to-reports-edit-view.patch (text/plain), 3.79 KB, created by
Casey Conlin
on 2025-07-22 22:02:24 UTC
(
hide
)
Description:
Bug 16631: 0007-Add-branch-libraries-to-reports-edit-view
Filename:
MIME Type:
Creator:
Casey Conlin
Created:
2025-07-22 22:02:24 UTC
Size:
3.79 KB
patch
obsolete
>From 81deaaa27aae4671ac00f768851262aab11c3b93 Mon Sep 17 00:00:00 2001 >From: John Doe <you@example.com> >Date: Wed, 9 Jul 2025 23:52:53 +0000 >Subject: [PATCH 07/16] Add branch libraries to reports edit view. > >--- > Koha/Reports.pm | 27 +++++++++++++++++++++++++++ > reports/guided_reports.pl | 34 +++++++++++++++++++++++++++------- > 2 files changed, 54 insertions(+), 7 deletions(-) > >diff --git a/Koha/Reports.pm b/Koha/Reports.pm >index 605a1fc0aa..387c72abb1 100644 >--- a/Koha/Reports.pm >+++ b/Koha/Reports.pm >@@ -33,6 +33,33 @@ Koha::Reports - Koha Report Object set class > > =cut > >+=head3 search_with_localization >+ >+my $itemtypes = Koha::ItemTypes->search_with_localization >+ >+=cut >+ >+sub search_with_localization { >+ my ( $self, $params, $attributes ) = @_; >+ >+ my $language = C4::Languages::getlanguage(); >+ $Koha::Schema::Result::Itemtype::LANGUAGE = $language; >+ $attributes->{order_by} = 'translated_description' unless exists $attributes->{order_by}; >+ $attributes->{join} = 'localization'; >+ $attributes->{'+select'} = [ >+ { >+ coalesce => [qw( localization.translation me.description )], >+ -as => 'translated_description' >+ } >+ ]; >+ if ( defined $params->{branchcode} ) { >+ my $branchcode = delete $params->{branchcode}; >+ $self->search_with_library_limits( $params, $attributes, $branchcode ); >+ } else { >+ $self->SUPER::search( $params, $attributes ); >+ } >+} >+ > =head3 _type > > Returns name of corresponding DBIC resultset >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index c670d39274..71a5eaf6f5 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -56,7 +56,8 @@ Script to control the guided report creation > my $input = CGI->new; > my $usecache = Koha::Caches->get_instance->memcached_cache; > >-my $op = $input->param('op') // ''; >+my $op = $input->param('op') // ''; >+my @branches = grep { $_ ne q{} } $input->multi_param('branches'); > my $flagsrequired; > if ( ( $op eq 'add_form' ) > || ( $op eq 'add_form_sql' ) >@@ -135,11 +136,29 @@ if ( !$op ) { > ); > > } elsif ( $op eq 'edit_form' ) { >- my $id = $input->param('id'); >- my $report = Koha::Reports->find($id); >- my $group = $report->report_group; >- my $subgroup = $report->report_subgroup; >- my $tables = get_tables(); >+ my $id = $input->param('id'); >+ my $report = Koha::Reports->find($id); >+ my $group = $report->report_group; >+ my $subgroup = $report->report_subgroup; >+ my $tables = get_tables(); >+ my $selected_branches = $report ? $report->get_library_limits : undef; >+ my $branches = >+ Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed; >+ my @branches_loop; >+ >+ foreach my $branch (@$branches) { >+ my $selected = >+ ( $selected_branches && grep { $_->branchcode eq $branch->{branchcode} } @{ $selected_branches->as_list } ) >+ ? 1 >+ : 0; >+ push @branches_loop, >+ { >+ branchcode => $branch->{branchcode}, >+ branchname => $branch->{branchname}, >+ selected => $selected, >+ }; >+ } >+ > $template->param( > 'sql' => $report->savedsql, > 'reportname' => $report->report_name, >@@ -152,7 +171,8 @@ if ( !$op ) { > 'editsql' => 1, > 'mana_id' => $report->{mana_id}, > 'mana_comments' => $report->{comments}, >- 'tables' => $tables >+ 'tables' => $tables, >+ 'branches_loop' => \@branches_loop > ); > > } elsif ( $op eq 'cud-update_sql' || $op eq 'cud-update_and_run_sql' ) { >-- >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