Bugzilla – Attachment 42628 Details for
Bug 14510
Allow column visibility in additem.pl to be customized
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14510: Allow column visibility in additem.pl to be customized
Bug-14510-Allow-column-visibility-in-additempl-to-.patch (text/plain), 8.26 KB, created by
Jonathan Druart
on 2015-09-17 07:12:00 UTC
(
hide
)
Description:
Bug 14510: Allow column visibility in additem.pl to be customized
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-09-17 07:12:00 UTC
Size:
8.26 KB
patch
obsolete
>From f158ca176c6e8b4a73087c181ad8c03193ed65f3 Mon Sep 17 00:00:00 2001 >From: Jesse Weaver <pianohacker@gmail.com> >Date: Thu, 9 Jul 2015 16:26:36 -0600 >Subject: [PATCH] Bug 14510: Allow column visibility in additem.pl to be > customized > >This patch adds the table of items on additem.pl to the columns >customizer. > >Test plan: > 1. Open item editor on a record, and verify that all columns are visible. > 2. Apply patch. > 3. Reload editor, and verify that column visibility hasn't changed. > 4. Open "Hide/show columns," and verify that you can add and remove > columns. > 5. Change the visibility and togglability of some columns in > columns_settings.pl, and verify that these correctly apply to > additem.pl. > >NOTE: The columns that are configurable are selected from the non-hidden >columns that have mappings to MARC subfields in the default MARC21 >framework (and can thus be displayed in the item editor). > >Signed-off-by: Jenny Schmidt <jschmidt@switchinc.org> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > admin/columns_settings.yml | 76 ++++++++++++++++++++++ > cataloguing/additem.pl | 7 ++ > .../prog/en/includes/columns_settings.inc | 7 +- > .../prog/en/modules/admin/columns_settings.tt | 5 ++ > .../prog/en/modules/cataloguing/additem.tt | 21 ++++-- > 5 files changed, 109 insertions(+), 7 deletions(-) > >diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml >index b8c6bfc..dd0bd35 100644 >--- a/admin/columns_settings.yml >+++ b/admin/columns_settings.yml >@@ -83,6 +83,82 @@ modules: > - > columnname: actions > >+ cataloguing: >+ additem: >+ itemst: >+ # NOTE: These columns are selected from the non-hidden columns that have mappings to MARC >+ # subfields in the default MARC21 framework (and can thus be displayed in the item editor). >+ - >+ columnname: withdrawn >+ - >+ columnname: itemlost >+ - >+ columnname: cn_source >+ - >+ columnname: materials >+ - >+ columnname: damaged >+ - >+ columnname: restricted >+ - >+ columnname: cn_sort >+ - >+ columnname: notforloan >+ - >+ columnname: ccode >+ - >+ columnname: itemnumber >+ - >+ columnname: homebranch >+ - >+ columnname: holdingbranch >+ - >+ columnname: location >+ - >+ columnname: dateaccessioned >+ - >+ columnname: booksellerid >+ - >+ columnname: coded_location_qualifier >+ - >+ columnname: price >+ - >+ columnname: enumchron >+ - >+ columnname: stocknumber >+ - >+ columnname: stack >+ - >+ columnname: issues >+ - >+ columnname: renewals >+ - >+ columnname: reserves >+ - >+ columnname: itemcallnumber >+ - >+ columnname: barcode >+ - >+ columnname: onloan >+ - >+ columnname: datelastseen >+ - >+ columnname: datelastborrowed >+ - >+ columnname: copynumber >+ - >+ columnname: uri >+ - >+ columnname: replacementprice >+ - >+ columnname: replacementpricedate >+ - >+ columnname: itemnotes_nonpublic >+ - >+ columnname: itype >+ - >+ columnname: itemnotes >+ > members: > member: > memberresultst: >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 38f5d92..753a515 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -803,6 +803,13 @@ for my $row ( @big_array ) { > foreach my $subfield_code (sort keys(%witness)) { > my %header_value; > $header_value{header_value} = $witness{$subfield_code}; >+ >+ my $subfieldlib = $tagslib->{$itemtagfield}->{$subfield_code}; >+ my $kohafield = $subfieldlib->{kohafield}; >+ if ( $kohafield && $kohafield =~ /items.(.+)/ ) { >+ $header_value{column_name} = $1; >+ } >+ > push(@header_value_loop, \%header_value); > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >index 87d9da6..52ab38f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >@@ -9,11 +9,14 @@ function KohaTable(selector, dt_parameters, columns_settings) { > var hidden_ids = []; > var excluded_ids = []; > $(columns_settings).each( function() { >+ var named_id = $( 'thead th[data-colname="' + this.columnname + '"]', selector ).index( 'th' ); >+ var used_id = named_id == -1 ? id : named_id; >+ > if ( this['is_hidden'] == "1" ) { >- hidden_ids.push( id ); >+ hidden_ids.push( used_id ); > } > if ( this['cannot_be_toggled'] == "1" ) { >- excluded_ids.push( id ); >+ excluded_ids.push( used_id ); > } > id++; > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt >index cb799f7..182f3dd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt >@@ -12,10 +12,15 @@ > [% SET tables = module %] > [% IF tables.$pagename.keys and tables.$pagename.keys.size > 0 %] > [% FOR tablename IN tables.$pagename.keys.sort %] >+ [% IF pagename == 'additem' AND tablename == 'itemst' %] >+ <div class="alert">Saving changes to column visibility here will override framework visibility settings for the table of items.</div> >+ [% END %] > <table> > <caption> > [% IF tablename == 'currencies-table' %] > Currency >+ [% ELSIF pagename == 'additem' AND tablename == 'itemst' %] >+ Items Editor > [% END %] > (id=[% tablename %]) > </caption> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >index 5028251..988d1ec 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >@@ -1,9 +1,12 @@ >+[% USE ColumnsSettings %] >+ > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Cataloging › [% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %]) › Items</title> > <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> > [% INCLUDE 'doc-head-close.inc' %] > [% INCLUDE 'datatables.inc' %] > <script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script> >+[% INCLUDE 'columns_settings.inc' %] > [% INCLUDE 'browser-strings.inc' %] > <!--[if lt IE 9]> > <script type="text/javascript" src="[% interface %]/lib/shims/json2.min.js"></script> >@@ -45,14 +48,18 @@ $(document).ready(function(){ > }); > }); > >- var itemst = $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, { >+ var columns_settings = [% ColumnsSettings.GetColumns( 'cataloguing', 'additem', 'itemst', 'json' ) %] >+ // Skip the first column >+ columns_settings.unshift( { cannot_be_toggled: "1" } ); >+ >+ var itemst = KohaTable("#itemst", { > "aoColumnDefs": [ > { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, > ], > 'bPaginate': false, > 'bInfo': false, > "bAutoWidth": false >- } ) ); >+ }, columns_settings); > > }); > function Check(f) { >@@ -134,9 +141,13 @@ function confirm_deletion() { > <thead> > <tr> > <th> </th> >- [% FOREACH item_header_loo IN item_header_loop %] >- <th> >- [% item_header_loo.header_value %] >+ [% FOREACH item_header IN item_header_loop %] >+ [% IF item_header.column_name %] >+ <th data-colname="[% item_header.column_name %]"> >+ [% ELSE %] >+ <th> >+ [% END %] >+ [% item_header.header_value %] > </th> > [% END %] > </tr> >-- >2.1.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 14510
:
40977
|
41418
|
41419
|
41800
|
42353
|
42379
|
42624
| 42628 |
42629
|
42630
|
42631
|
42632
|
42633