Bug 15668: Add column configuration to the items table in staff detail pages
authorLucas Gass <lucas@bywatersolutions.com>
Thu, 12 Mar 2020 14:50:57 +0000 (14:50 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 4 May 2020 08:44:42 +0000 (09:44 +0100)
To test:
1 - Apply patches
2 - View biblio details in staff client
3 - Should be able to toggle columns
4 - Go to admin columns settings
5 - Change some settings, verify they work
6 - Enable SeparateHoldings
7 - Go to a record that has holdings from 2 different branches
8 - Change some settings, verify they work.
9 - Check the Other Holdings Tabs, change some settings make sure they work.
10. - Test all the dataTable functions like the search box, columns, export. make sure they on both tabs

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

admin/columns_settings.yml
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt

index 19e0beb..027528b 100644 (file)
@@ -249,9 +249,108 @@ modules:
           cannot_be_toggled: 1
           cannot_be_modified: 1
 
-
   catalogue:
     detail:
+      holdings_table:
+        -
+          columnname: holdings_checkbox
+          cannot_be_toggled: 1
+          cannot_be_modified: 1
+        -
+          columnname: holdings_itype
+        -
+          columnname: holdings_holdingbranch
+        -
+          columnname: holdings_homebranch
+        -
+          columnname: holdings_ccode
+        -
+          columnname: holdings_itemcallnumber
+        -
+          columnname: holdings_status
+        -
+          columnname: holdings_lastseen
+        -
+          columnname: holdings_barcode
+        -
+          columnname: holdings_enumchron
+        -
+          columnname: holdings_uri
+        -
+          columnname: holdings_copynumber
+        -
+          columnname: holdings_stocknumber
+        -
+          columnname: holdings_materials
+        -
+          columnname: holdings_itemnotes
+        -
+          columnname: holdings_itemnotes_nonpublic
+        -
+          columnname: holdings_hostrecord
+        -
+          columnname: holdings_usedin
+        -
+          columnname: holdings_usedin_col
+        -
+          columnname: holdings_course_reserves
+        -
+          columnname: holdings_spinelabel
+        -
+          columnname: holdings_actions
+          cannot_be_toggled: 1
+          cannot_be_modified: 1
+
+      otherholdings_table:
+        -
+          columnname: otherholdings_checkbox
+          cannot_be_toggled: 1
+          cannot_be_modified: 1
+        -
+          columnname: otherholdings_itype
+        -
+          columnname: otherholdings_holdingbranch
+        -
+          columnname: otherholdings_homebranch
+        -
+          columnname: otherholdings_ccode
+        -
+          columnname: otherholdings_itemcallnumber
+        -
+          columnname: otherholdings_status
+        -
+          columnname: otherholdings_lastseen
+        -
+          columnname: otherholdings_barcode
+        -
+          columnname: otherholdings_enumchron
+        -
+          columnname: otherholdings_uri
+        -
+          columnname: otherholdings_copynumber
+        -
+          columnname: otherholdings_stocknumber
+        -
+          columnname: otherholdings_materials
+        -
+          columnname: otherholdings_itemnotes
+        -
+          columnname: otherholdings_itemnotes_nonpublic
+        -
+          columnname: otherholdings_hostrecord
+        -
+          columnname: otherholdings_usedin
+        -
+          columnname: otherholdings_usedin_col
+        -
+          columnname: otherholdings_course_reserves
+        -
+          columnname: otherholdings_spinelabel
+        -
+          columnname: otherholdings_actions
+          cannot_be_toggled: 1
+          cannot_be_modified: 1
+
       acquisitiondetails-table:
         -
           columnname: vendor
index 1091b50..1d90413 100644 (file)
     <table class="items_table" id="[% tab | html %]_table">
         <thead>
             <tr>
-                [% IF (StaffDetailItemSelection) %]<th class="NoSort"></th>[% END %]
-                [% IF ( item_level_itypes ) %]<th>Item type</th>[% END %]
-                <th>Current location</th>
-                <th>Home library</th>
-                [% IF ( itemdata_ccode ) %]<th>Collection</th>[% END %]
-                <th>Call number</th>
+                [% IF (StaffDetailItemSelection) %]<th id="[% tab | html %]_checkbox" data-colname="[% tab | html %]_checkbox" class="NoSort"></th>[% END %]
+                [% IF ( item_level_itypes ) %]<th id="[% tab | html %]_itype" data-colname="[% tab | html %]_itype">Item type</th>[% END %]
+                <th id="[% tab | html %]_holdingbranch" data-colname="[% tab | html %]_holdingbranch">Current location</th>
+                <th id="[% tab | html %]_homebranch" data-colname="[% tab | html %]_homebranch">Home library</th>
+                [% IF ( itemdata_ccode ) %]<th id="[% tab | html %]_ccode" data-colname="[% tab | html %]_ccode">Collection</th>[% END %]
+                <th id="[% tab | html %]_itemcallnumber" data-colname="[% tab | html %]_itemcallnumber">Call number</th>
                 [% IF volinfo %]
-                    [% IF itemdata_publisheddate #If there is at least one published date, use it for sorting%]
-                        <th class="title-string">Serial enumeration / chronology</th>
+                [% IF itemdata_publisheddate #If there is at least one published date, use it for sorting%]
+                        <th id="[% tab | html %]_enumchron" data-colname="[% tab | html %]_enumchron" class="title-string">Serial enumeration / chronology</th>
                     [% ELSE %]
-                        <th>Serial enumeration / chronology</th>
+                        <th id="[% tab | html %]_enumchron" data-colname="[% tab | html %]_enumchron">Serial enumeration / chronology</th>
                     [% END %]
                 [% END %]
-                <th>Status</th>
-                <th class="title-string">Last seen</th>
-                <th class="title-string">Date accessioned</th>
-                <th>Barcode</th>
-                [% IF ( itemdata_uri ) %]<th>URL</th>[% END %]
-                [% IF ( itemdata_copynumber ) %]<th>Copy number</th>[% END %]
-                [% IF ( itemdata_stocknumber ) %]<th>Inventory number</th>[% END %]
-                [% IF materials %]<th>Materials specified</th>[% END %]
-                [% IF ( itemdata_itemnotes ) %]<th>Public notes</th>[% END %]
-                [% IF ( itemdata_nonpublicnotes ) %]<th>Non-public notes</th>[% END %]
-                [% IF ( hostrecords ) %]<th>Host records</th>[% END %]
-                [% IF ( analyze ) %]<th>Used in</th><th></th>[% END %]
-                [% IF ( ShowCourseReserves ) %]<th>Course Reserves</th>[% END %]
-                [% IF ( SpineLabelShowPrintOnBibDetails ) %]<th class="NoSort">Spine label</th>[% END %]
-                [% IF ( CAN_user_editcatalogue_edit_items ) %]<th class="NoSort">&nbsp;</th>[% END %]
+                <th id="[% tab | html %]_status" data-colname="[% tab | html %]_status">Status</th>
+                <th id="[% tab | html %]_lastseen" data-colname="[% tab | html %]_lastseen" class="title-string">Last seen</th>
+                <th id="[% tab | html %]_datesccessioned" date-colname="[% tab | html %]_datesccessioned" class="title-string">Date accessioned</th>
+                <th id="[% tab | html %]_barcode" data-colname="[% tab | html %]_barcode">Barcode</th>
+                [% IF ( itemdata_uri ) %]<th id="[% tab | html %]_uri" data-colname="[% tab | html %]_uri">URL</th>[% END %]
+                [% IF ( itemdata_copynumber ) %]<th id="[% tab | html %]_copynumber" data-colname="[% tab | html %]_copynumber">Copy number</th>[% END %]
+                [% IF ( itemdata_stocknumber ) %]<th id="[% tab | html %]_stocknumber" data-colname="[% tab | html %]_stocknumber">Inventory number</th>[% END %]
+                [% IF materials %]<th id="[% tab | html %]_materials" data-colname="[% tab | html %]_materials">Materials specified</th>[% END %]
+                [% IF ( itemdata_itemnotes ) %]<th id="[% tab | html %]_itemnotes" data-colname="[% tab | html %]_itemnotes">Public notes</th>[% END %]
+                [% IF ( itemdata_nonpublicnotes ) %]<th id="[% tab | html %]_itemnotes_nonpublic" data-colname="[% tab | html %]_itemnotes_nonpublic">Non-public notes</th>[% END %]
+                [% IF ( hostrecords ) %]<th id="[% tab | html %]_hostrecord" data-colname="[% tab | html %]_hostrecord">Host records</th>[% END %]
+                [% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="[% tab | html %]_usedin">Used in</th><th></th>[% END %]
+                [% IF ( ShowCourseReserves ) %]<th id="[% tab | html %]_course_reserves" data-colname="[% tab | html %]_course_reserves">Course Reserves</th>[% END %]
+                [% IF ( SpineLabelShowPrintOnBibDetails ) %]<th id="[% tab | html %]_spinelabel" data-colname="[% tab | html %]_spinelabel" class="NoSort">Spine label</th>[% END %]
+                [% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="[% tab | html %]_actions"class="NoSort">&nbsp;</th>[% END %]
             </tr>
         </thead>
         <tbody>
@@ -1115,7 +1115,7 @@ Note that permanent location is a code, and location may be an authval.
 
         $(document).ready(function() {
             var ids = ['holdings_table', 'otherholdings_table'];
-
+            var columns_settings = [ [% ColumnsSettings.GetColumns('catalogue', 'detail','holdings_table','json') | $raw %], [% ColumnsSettings.GetColumns('catalogue', 'detail','otherholdings_table','json')  | $raw %] ];
             for (var i in ids) {
                 var id = ids[i];
                 var dt_parameters = {
@@ -1125,9 +1125,11 @@ Note that permanent location is a code, and location may be an authval.
                     "aoColumnDefs": [
                         { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
                         { "sType": "title-string", "aTargets" : [ "title-string" ] }
-                    ]
+                    ],
+                    "bKohaColumnsUseNames": true,
+                    "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
                 };
-                var table = KohaTable(id, dt_parameters, null, 'with_filters');
+                var table = KohaTable(id, dt_parameters, columns_settings[i], 'with_filters');
             }
 
             [% IF Koha.Preference('AcquisitionDetails') %]