Bugzilla – Attachment 127484 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), 13.05 KB, created by
Owen Leonard
on 2021-11-09 13:17:53 UTC
(
hide
)
Description:
Bug 5697: Automatic linking in guided reports
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2021-11-09 13:17:53 UTC
Size:
13.05 KB
patch
obsolete
>From b027f06e99c0a606b538c35bc996dd9c378e1e52 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 8 Nov 2021 19:06:59 +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 or >[[biblionumber|Biblio number]] but 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. The selection persists until the >user logs out. >--- > .../modules/reports/guided_reports_start.tt | 114 ++++++++++++++++-- > 1 file changed, 103 insertions(+), 11 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 46e2bd4e07..0bb64348ab 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 >@@ -50,7 +50,12 @@ > .cm-columnPlaceholder { > color: #BF2D5D; > } >- #mana_search_errortext { font-family: monospace; font-weight: bold; } >+ #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 %] >@@ -1089,6 +1094,15 @@ > </ul> > </div> > [% END # /IF ( unlimited_total > 10 && limit <= 1000 ) %] >+ >+ [% IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %] >+ <a href="#" class="btn btn-link" id="toggle_auto_links"> >+ <i class="fa fa-eye autolink" style="display:none"></i> >+ <i class="fa fa-eye-slash autolink"></i> >+ <span class="autolink" style="display:none">Show data menus</span> >+ <span class="autolink">Hide data menus</span> >+ </a> >+ [% END %] > </div> <!-- /#toolbar.btn-toolbar --> > [% END # /IF batch operations || ( unlimited_total > 10 && limit <= 1000 ) %] > >@@ -1100,19 +1114,82 @@ > [% END # IF ( execute ) %] > > [% 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 %] >+ [% place = loop.index %] >+ [%- IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %] >+ <td class="batch-op itemnumber" data-number="itemnumber"> >+ <span class="data-plain">[% cells.cell | $raw %]</span> >+ <div id="itemnumber_autolink" class="btn-group dropup autolink"><a class="btn btn-link dropdown-toggle" role="button" data-toggle="dropdown" href="#">[% cells.cell | $raw %] <b class="caret"></b></a> >+ <ul class="dropdown-menu pull-right" role="menu"> >+ <li><a target="_blank" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&itemnumber=[% cells.cell | $raw %]"><i class="fa fa-fw fa-pencil"></i> Edit record</a></li> >+ <li role="separator" class="divider"></li> >+ <li><a target="_blank" href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% cells.cell | $raw %]"><i class="fa fa-fw fa-eye"></i> View record</a></li> >+ </ul> >+ </div> >+ </td> >+ [% ELSIF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %] >+ <td class="batch-op biblionumber" data-number="biblionumber"> >+ <span class="data-plain">[% cells.cell | $raw %]</span> >+ <div id="biblionumber_autolink" class="btn-group dropup autolink"><a class="btn btn-link dropdown-toggle" role="button" data-toggle="dropdown" href="#">[% cells.cell | $raw %] <b class="caret"></b></a> >+ <ul class="dropdown-menu pull-right" role="menu"> >+ <li><a target="_blank" href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% cells.cell | $raw %]"><i class="fa fa-pencil"></i> Edit record</a></li> >+ <li role="separator" class="divider"></li> >+ <li><a target="_blank" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% cells.cell | $raw %]"><i class="fa fa-eye"></i> View record</a></li> >+ </ul> >+ </div> >+ </td> >+ [% ELSIF header_row.$place.cell == 'borrowernumber' || header_types.item(header_row.$place.cell) == 'borrowernumber' %] >+ <td class="batch-op borrowernumber" data-number="borrowernumber"> >+ <span class="data-plain">[% cells.cell | $raw %]</span> >+ <div id="borrowernumber_autolink" class="btn-group dropup autolink"><a class="btn btn-link dropdown-toggle" role="button" data-toggle="dropdown" href="#">[% cells.cell | $raw %] <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=[% cells.cell | $raw %]"><i class="fa fa-eye"></i> View patron</a></li> >+ <li role="separator" class="divider"></li> >+ <li><a target="_blank" href="/cgi-bin/koha/members/memberentry.pl?op=modify&borrowernumber=[% cells.cell | $raw %]"><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=[% cells.cell | $raw %]"><i class="fa fa-barcode"></i> Check out</a></li> >+ </ul> >+ </div> >+ </td> >+ [% ELSIF header_row.$place.cell == 'cardnumber' || header_types.item(header_row.$place.cell) == 'cardnumber' %] >+ <td class="batch-op cardnumber" data-number="cardnumber"> >+ <span class="data-plain">[% cells.cell | $raw %]</span> >+ <div id="cardnumber_autolink" class="btn-group dropup autolink"><a class="btn btn-link dropdown-toggle" role="button" data-toggle="dropdown" href="#">[% cells.cell | $raw %] <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=[% cells.cell | $raw %]"><i class="fa fa-barcode"></i> Check out</a></li> >+ </ul> >+ </div> >+ </td> >+ [% ELSE %] >+ <td> >+ [% cells.cell | $raw %] >+ </td> >+ [% END %] >+ [% END %] >+ </tr> >+ [% END %] >+ </tbody> > </table> > [% END %] > <div class="pages">[% pagination_bar | $raw %]</div> >@@ -2066,6 +2143,21 @@ > > }); > >+ $("#toggle_auto_links").on("click", function(e){ >+ e.preventDefault(); >+ if( $(".data-plain").is(":visible") ){ >+ /* if a data-plain element is visible, this click hides it and shows auto-links */ >+ localStorage.removeItem("reports_auto_link_off"); >+ } else { >+ /* if a data-plain element is hidden, this click shows it and hides auto-links */ >+ localStorage.setItem("reports_auto_link_off", 1); >+ } >+ $(".data-plain,.autolink").toggle(); >+ }); >+ if ( localStorage.getItem("reports_auto_link_off") == 1 ){ >+ $("#toggle_auto_links").click(); >+ } >+ > function tabsInit( ui, rtable ){ > var thisTab = ui.newTab ? ui.newTab : ui.tab; > var activeTab = thisTab.index(); >-- >2.20.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 5697
:
110075
|
110668
|
110697
|
117096
|
117755
|
117765
|
117766
|
117988
|
118022
|
127484
|
128252
|
128277