Bugzilla – Attachment 188347 Details for
Bug 39296
Provide a template plugin to return MARC::Record for MARCXML metadata
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39296: [POC] Send objects to the templates
Bug-39296-POC-Send-objects-to-the-templates.patch (text/plain), 2.40 KB, created by
Jonathan Druart
on 2025-10-23 12:22:15 UTC
(
hide
)
Description:
Bug 39296: [POC] Send objects to the templates
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-10-23 12:22:15 UTC
Size:
2.40 KB
patch
obsolete
>From 36c2828cdd72625d2e9e48c8d082b216481272db Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 23 Oct 2025 14:21:41 +0200 >Subject: [PATCH] Bug 39296: [POC] Send objects to the templates > >[% SET all_subjects = {} %] >[% FOREACH d IN data %] > [% SET record= d.biblio.metadata.record %] > [% SET fields = record.field('6..') %] > [% FOREACH field IN fields %] > [% tmp = field.delete_subfield('code','9') %] > [% SET subject = field.as_string() %] > [% IF ( all_subjects.$subject ) %] > [% all_subjects.$subject = all_subjects.$subject + 1 %] > [% ELSE %] > [% all_subjects.$subject = 1 %] > [% END %] > [% END %] >[% END %] ><table> ><tr><th>Subject</th><th>Count</th></tr> >[% FOREACH key IN all_subjects.nsort.reverse %] ><tr><td>[% key %]</td><td>[% all_subjects.$key %]</td></tr> >[% END %] ></table> >--- > reports/guided_reports.pl | 8 ++++++++ > 1 file changed, 8 insertions(+) > >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index d1444a7c6e5..422d4359a63 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -991,6 +991,7 @@ if ( $op eq 'run' ) { > $total = nb_rows($sql) || 0; > my $headers = header_cell_loop($sth); > $template->param( header_row => $headers ); >+ my $needs_biblio_objects = grep { $_ eq 'biblionumber' } map { $_->{cell} } @$headers; > while ( my $row = $sth->fetchrow_arrayref() ) { > my @cells = map { +{ cell => $_ } } @$row; > push @rows, { cells => \@cells }; >@@ -1017,6 +1018,13 @@ if ( $op eq 'run' ) { > my $notice_template = Koha::Notice::Templates->find($template_id); > my ( $sth2, $errors2 ) = execute_query( { sql => $sql, report_id => $report_id } ); > my $data = $sth2->fetchall_arrayref( {} ); >+ if ($needs_biblio_objects) { >+ $data = [ >+ map { >+ { %$_, biblio => Koha::Biblios->find( $_->{biblionumber} ) } >+ } @$data >+ ]; >+ } > my $notice_rendered = > process_tt( $notice_template->content, { data => $data, report_id => $report_id } ); > my $title_rendered = >-- >2.34.1
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 39296
:
179135
|
179189
| 188347