Bugzilla – Attachment 84281 Details for
Bug 21852
Add more columns and column configuration to overdues report
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21852: Add more columns and column configuration to overdues report
Bug-21852-Add-more-columns-and-column-configuratio.patch (text/plain), 9.81 KB, created by
Owen Leonard
on 2019-01-22 12:58:53 UTC
(
hide
)
Description:
Bug 21852: Add more columns and column configuration to overdues report
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2019-01-22 12:58:53 UTC
Size:
9.81 KB
patch
obsolete
>From ef761a3a9b20da8855358bae05c83927d89f254d Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 16 Nov 2018 14:51:48 +0000 >Subject: [PATCH] Bug 21852: Add more columns and column configuration to > overdues report > >This patch adds some new columns to the overdue report: Patron category, >item home library, item holding library, item type. Adding these columns >makes available columns better match the available filter fields in the >sidebar form. > >Column configuration is added to this DataTable, with the new columns >defined as hidden by default in order to preserve current functionality. > >New code has been added to the global DataTables configuration to allow >the locally-stored column visibility information to override the default >Koha configuration for that table. This lets us take advantage of the >"stateSave" option in DataTAbles. > >This patch also fixes a bug where the home and holding branch template >variable names didn't match what was being used in the template for >pre-selecting the searched-for value in the sidebar filter menu. > >To test, apply the patch and go to Circulation -> Overdues. > > - The list of overdues should look correct, with no new columns shown. > - Test the column visibility button, showing the columns which are > hidden by default. Confirm that the data in these columns displays > correctly. > - Show or hide columns in such a way that it doesn't match the default > configuration. > - Navigate away from this page. > - Return to the page. The same set of columns should be visible. >--- > admin/columns_settings.yml | 31 ++++++++++++++++++ > circ/overdue.pl | 8 +++-- > .../intranet-tmpl/prog/en/modules/circ/overdue.tt | 37 +++++++++++++++++----- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 28 ++++++++++++++++ > 4 files changed, 93 insertions(+), 11 deletions(-) > >diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml >index c616851..fa69a89 100644 >--- a/admin/columns_settings.yml >+++ b/admin/columns_settings.yml >@@ -672,6 +672,37 @@ modules: > - > columnname: items_needed > >+ overdues: >+ circ-overdues: >+ - >+ columname: due_date >+ - >+ columname: patron >+ - >+ columname: patron_category >+ is_hidden: 1 >+ - >+ columname: patron_library >+ - >+ columname: title >+ - >+ columname: home_library >+ is_hidden: 1 >+ - >+ columname: holding_library >+ is_hidden: 1 >+ - >+ columname: barcode >+ - >+ columname: call_number >+ - >+ columname: item_type >+ is_hidden: 1 >+ - >+ columname: price >+ - >+ columname: non-public_note >+ > opac: > biblio-detail: > holdingst: >diff --git a/circ/overdue.pl b/circ/overdue.pl >index 0b6f0f8..9604e62 100755 >--- a/circ/overdue.pl >+++ b/circ/overdue.pl >@@ -239,7 +239,8 @@ if ($noreport) { > items.itemcallnumber, > items.replacementprice, > items.enumchron, >- items.itemnotes_nonpublic >+ items.itemnotes_nonpublic, >+ items.itype > FROM issues > LEFT JOIN borrowers ON (issues.borrowernumber=borrowers.borrowernumber ) > LEFT JOIN items ON (issues.itemnumber=items.itemnumber) >@@ -322,12 +323,13 @@ if ($noreport) { > biblionumber => $data->{biblionumber}, > title => $data->{title}, > author => $data->{author}, >- homebranchcode => $data->{homebranchcode}, >- holdingbranchcode => $data->{holdingbranchcode}, >+ homebranchcode => $data->{homebranch}, >+ holdingbranchcode => $data->{holdingbranch}, > itemcallnumber => $data->{itemcallnumber}, > replacementprice => $data->{replacementprice}, > itemnotes_nonpublic => $data->{itemnotes_nonpublic}, > enumchron => $data->{enumchron}, >+ itemtype => $data->{itype}, > patron_attr_value_loop => \@patron_attr_value_loop, > }; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt >index 402918e..7213ebc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt >@@ -3,6 +3,9 @@ > [% USE KohaDates %] > [%- USE Branches -%] > [%- USE Price -%] >+[%- USE ItemTypes -%] >+[%- USE Categories -%] >+[%- USE ColumnsSettings -%] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Circulation › Items overdue as of [% todaysdate | html %]</title> >@@ -48,10 +51,14 @@ > <tr> > <th class="title-string">Due date</th> > <th>Patron</th> >- <th>Library</th> >- <th>Title</th> >+ <th>Patron category</th> >+ <th>Patron library</th> >+ <th class="anti-the">Title</th> >+ <th>Home library</th> >+ <th>Holding library</th> > <th>Barcode</th> > <th>Call number</th> >+ <th>Item type</th> > <th>Price</th> > <th>Non-public note</th> > </tr> >@@ -67,10 +74,15 @@ > [% IF ( overdueloo.email ) %][<a href="mailto:[% overdueloo.email | uri %]?subject=[% INCLUDE subject %] [% overdueloo.title | uri %]">email</a>][% END %] > [% IF ( overdueloo.phone ) %]([% overdueloo.phone | html %])[% ELSIF ( overdueloo.mobile ) %]([% overdueloo.mobile | html %])[% ELSIF ( overdueloo.phonepro ) %]([% overdueloo.phonepro | html %])[% END %]</td> > [% END %] >- <td>[% Branches.GetName( overdueloo.patron.branchcode ) | html %]</td> >+ <td>[% Categories.GetName( overdueloo.patron.categorycode ) | html %]</td> >+ <td>[% Branches.GetName( overdueloo.homebranchcode ) | html %]</td> > <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = overdueloo.biblionumber %][% overdueloo.title | html %] [% overdueloo.subtitle | html %]</a> [% IF ( overdueloo.author ) %], by [% overdueloo.author | html %][% END %][% IF ( overdueloo.enumchron ) %], [% overdueloo.enumchron | html %][% END %]</td> >+ >+ <td>[% Branches.GetName( overdueloo.holdingbranchcode ) | html %]</td> >+ <td>[% Branches.GetName( overdueloo.patron.branchcode ) | html %]</td> > <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% overdueloo.biblionumber | uri %]&itemnumber=[% overdueloo.itemnum | uri %]#item[% overdueloo.itemnum | uri %]">[% overdueloo.barcode | html %]</a></td> > <td>[% overdueloo.itemcallnumber | html %]</td> >+ <td>[% ItemTypes.GetDescription( overdueloo.itemtype ) | html %]</td> > <td>[% overdueloo.replacementprice | $Price %]</td> > <td>[% overdueloo.itemnotes_nonpublic | html %]</td> > </tr> >@@ -210,7 +222,8 @@ > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'calendar.inc' %] > [% INCLUDE 'datatables.inc' %] >- <script type="text/javascript"> >+ [% INCLUDE 'columns_settings.inc' %] >+ <script> > function clone_parent(node) { > var parent = node.parentNode; > var clone = parent.cloneNode(true); >@@ -263,13 +276,21 @@ > } > > $(document).ready(function(){ >- $("#overduest").dataTable($.extend(true, {}, dataTablesDefaults, { >+ >+ var columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'overdues', 'circ-overdues', 'json' ) | $raw %]; >+ var od_table = localStorage.getItem("DataTables_overduest_/cgi-bin/koha/circ/overdue.pl"); >+ var updated_settings = get_columns_saved_state( od_table, columns_settings ); >+ >+ KohaTable("overduest", { > "sPaginationType": "four_button", > "aaSorting": [[0, 'asc']], > "aoColumnDefs": [ >- { "sType": "title-string", "aTargets": [ "title-string" ] } >- ] >- })); >+ { "sType": "title-string", "aTargets": [ "title-string" ] }, >+ { "sType": "anti-the", "aTargets" : [ "anti-the" ] } >+ ], >+ "autoWidth": false, >+ "stateSave": true >+ }, updated_settings); > }); > </script> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 0e95d1e..0f8fdb4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -567,3 +567,31 @@ function footer_column_sum( api, column_numbers ) { > $( api.column( column_number ).footer() ).html(total.format_price()); > }; > } >+ >+/* get_columns_saved_state checks for a DataTables configuration saved >+ * in the browser's local storage. If it is present, the columns >+ * configuration supplied by Koha is overwritten >+ * >+ * It takes two parameters: >+ * - localstorage_config, the DataTables saved state object from local storage >+ * - columns_settings, the columns settings object supplied by the template >+ */ >+ >+function get_columns_saved_state( localstorage_config, columns_settings ){ >+ var tables = JSON.parse( localstorage_config ); >+ // if a table configuration was found in local storage, parse it >+ if( tables ){ >+ var stateSave_column_visibility = []; >+ $(tables.columns).each(function(){ >+ stateSave_column_visibility.push( this.visible === true ? 0 : 1 ); >+ }); >+ $.each( columns_settings, function( index, key ){ >+ if( stateSave_column_visibility[ index ] !== columns_settings[key] ){ >+ columns_settings[ index ].is_hidden = stateSave_column_visibility[ index ]; >+ } >+ }); >+ return columns_settings; >+ } else { >+ return columns_settings; >+ } >+} >\ No newline at end of file >-- >2.1.4
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 21852
:
82550
|
84281
|
84638
|
84639
|
84648
|
84649
|
84663
|
84664
|
84735
|
90269
|
90270
|
90271
|
92369
|
92370
|
92371
|
92373
|
92374
|
92375
|
92575
|
92823