Bugzilla – Attachment 117765 Details for
Bug 5697
Automatic linking in guided reports
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5697: Automatic linking in guided reports
Bug-5697-Automatic-linking-in-guided-reports.patch (text/plain), 10.10 KB, created by
Katrin Fischer
on 2021-03-04 21:11:26 UTC
(
hide
)
Description:
Bug 5697: Automatic linking in guided reports
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2021-03-04 21:11:26 UTC
Size:
10.10 KB
patch
obsolete
>From cacff692f95d4be708adf825826e221b59d8d606 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 24 Sep 2020 14:23:11 +0000 >Subject: [PATCH] Bug 5697: Automatic linking in guided reports > >This patch modifies the output of reports so that if certain columns are >returned the data in the colums automatically offer menus of actions: > >- borrowernumber: View, edit, check out >- cardnumber: Check out >- itemnumber: View, edit >- biblionumber: View, edit > >Like the menu of batch operations, this functionality is available only >if the column is returned with its original name (e.g. biblionumber, not >"biblionumber AS `Biblio number`). > >To test, apply the patch and run a report which will return examples of >each kind of data. I used: > >SELECT biblio.biblionumber , biblio.title, items.itemnumber, >items.itemcallnumber, items.barcode, borrowers.firstname, >borrowers.surname, borrowers.borrowernumber, borrowers.cardnumber >FROM issues >LEFT JOIN borrowers ON borrowers.borrowernumber=issues.borrowernumber >LEFT JOIN items ON issues.itemnumber=items.itemnumber >LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber >ORDER BY RAND() LIMIT 50 > >When the report runs you should see that the data in each affected >column is displayed as a link, each of which should trigger the correct >menu. Test each case to confirm that the correct page is opened. > >Test the "toggle data menus" control. Clicking it should hide and show >the menus in the report results. > >Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../en/modules/reports/guided_reports_start.tt | 84 +++++++++++++++++++--- > 1 file changed, 74 insertions(+), 10 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 c2c3138d94..b91f2d2445 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 >@@ -57,6 +57,7 @@ > color: #11917B; > } > #mana_search_errortext { font-family: monospace; font-weight: bold; } >+ .data-plain { display: none; } > </style> > [% Asset.css("css/reports.css") | $raw %] > [% Asset.css("lib/d3c3/c3.min.css") | $raw %] >@@ -1005,6 +1006,11 @@ > [% END %] > </ul> <!-- /.dropdown-menu --> > </div> <!-- /.dropdown --> >+ <a href="#" id="toggle_auto_links"> >+ <i class="fa fa-eye autolink" style="display:none"></i> >+ <i class="fa fa-eye-slash autolink"></i> >+ Toggle data menus >+ </a> > </p> > [% END # /IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %] > [% END # UNLESS ( errors ) %] >@@ -1036,19 +1042,33 @@ > > <div class="pages">[% pagination_bar | $raw %]</div> > [% UNLESS ( errors ) %] >- <table> >- <tr> >- [% FOREACH header_ro IN header_row %] >- <th>[% header_ro.cell | html %]</th> >- [% END %] >- </tr> >- [% FOREACH result IN results %] >+ <table id="report_results"> >+ <thead> > <tr> >- [% FOREACH cells IN result.cells %] >- <td>[% cells.cell | $raw %]</td> >+ [% FOREACH header_ro IN header_row %] >+ [% IF header_ro.has_itemnumbers && ( header_ro.cell == 'itemnumber' || header_types.item( header_ro.cell ) == 'itemnumber' ) %] >+ <th class="itemnumber">[% header_ro.cell | html %]</th> >+ [% ELSIF header_ro.has_biblionumbers && ( header_ro.cell == 'biblionumber' || header_types.item( header_ro.cell ) == 'biblionumber' ) %] >+ <th class="biblionumber">[% header_ro.cell | html %]</th> >+ [% ELSIF header_ro.cell == 'cardnumber' || header_types.item( header_ro.cell ) == 'cardnumber' %] >+ <th class="cardnumber">[% header_ro.cell | html %]</th> >+ [% ELSIF header_ro.cell == 'borrowernumber' || header_types.item( header_ro.cell ) == 'borrowernumber' %] >+ <th class="borrowernumber">[% header_ro.cell | html %]</th> >+ [% ELSE %] >+ <th>[% header_ro.cell | html %]</th> >+ [% END %] > [% END %] > </tr> >- [% END %] >+ </thead> >+ <tbody> >+ [% FOREACH result IN results %] >+ <tr> >+ [% FOREACH cells IN result.cells %] >+ <td>[% cells.cell | $raw %]</td> >+ [% END %] >+ </tr> >+ [% END %] >+ </tbody> > </table> > [% END %] > <div class="pages">[% pagination_bar | $raw %]</div> >@@ -1841,6 +1861,50 @@ > var reportid = $(this).data("reportid"); > previewSql( reportid ); > }); >+ >+ $(".limitselect").on("click", function(){ >+ var limit = $(this).data("limit"); >+ $("#limit").val( limit ); >+ $("#limitselect").submit(); >+ }); >+ >+ if( $("#report_results").length > 0 ){ >+ $("#report_results").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "dom": 't', >+ "paginate": false, >+ "ordering": false, >+ "columnDefs": [ >+ { >+ targets: "biblionumber", >+ render: function ( data ) { >+ return '<span class="data-plain">' + data + '</span><div class="btn-group dropup autolink"><a class="btn btn-link dropdown-toggle" role="button" data-toggle="dropdown" href="#">' + data + ' <b class="caret"></b></a><ul class="dropdown-menu pull-right" role="menu"><li><a target="_blank" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' + data + '"><i class="fa fa-window-restore"></i> View record</a></li><li role="separator" class="divider"></li><li><a target="_blank" href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=' + data + '"><i class="fa fa-pencil"></i> Edit record</a></li></ul></div>'; >+ } >+ }, >+ { >+ targets: "itemnumber", >+ render: function ( data ) { >+ return '<span class="data-plain">' + data + '</span><div class="btn-group dropup autolink"><a class="btn btn-link dropdown-toggle" role="button" data-toggle="dropdown" href="#">' + data + ' <b class="caret"></b></a><ul class="dropdown-menu pull-right" role="menu"><li><a target="_blank" href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=' + data + '"><i class="fa fa-window-restore"></i> View item</a></li><li role="separator" class="divider"></li><li><a target="_blank" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&itemnumber=' + data + '#edititem"><i class="fa fa-pencil"></i> Edit item</a></li></ul></div>'; >+ } >+ }, >+ { >+ targets: "borrowernumber", >+ render: function ( data ) { >+ return '<span class="data-plain">' + data + '</span><div class="btn-group dropup autolink"><a class="btn btn-link dropdown-toggle" role="button" data-toggle="dropdown" href="#">' + data + ' <b class="caret"></b></a><ul class="dropdown-menu pull-right" role="menu"><li><a target="_blank" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=' + data + '"><i class="fa fa-window-restore"></i> View patron</a></li><li role="separator" class="divider"></li><li><a target="_blank" href="/cgi-bin/koha/members/memberentry.pl?borrowernumber=' + data + '"><i class="fa fa-pencil"></i> Edit patron</a></li><li role="separator" class="divider"></li><li><a target="_blank" href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=' + data + '"><i class="fa fa-window-restore"></i> Check out</a></li></ul></div>'; >+ } >+ }, >+ { >+ targets: "cardnumber", >+ render: function ( data ) { >+ return '<span class="data-plain">' + data + '</span><div class="btn-group dropup autolink"><a class="btn btn-link dropdown-toggle" role="button" data-toggle="dropdown" href="#">' + data + ' <b class="caret"></b></a><ul class="dropdown-menu pull-right" role="menu"><li><a target="_blank" href="/cgi-bin/koha/circ/circulation.pl?findborrower=' + data + '"><i class="fa fa-window-restore"></i> Check out</a></li></ul></div>'; >+ } >+ }, >+ ] >+ })); >+ } >+ $("#toggle_auto_links").on("click", function(e){ >+ e.preventDefault(); >+ $(".data-plain,.autolink").toggle(); >+ }); > }); > > function tabsInit( ui, rtable ){ >-- >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 5697
:
110075
|
110668
|
110697
|
117096
|
117755
|
117765
|
117766
|
117988
|
118022
|
127484
|
128252
|
128277