Bug 22649: Add itemtype to item search results and CSV file
authorKatrin Fischer <katrin.fischer.83@web.de>
Sat, 6 Apr 2019 12:42:39 +0000 (12:42 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 19 Apr 2019 14:34:08 +0000 (14:34 +0000)
The itemtype can be searched for in the item search form, but
it is not displayed in the result list.
This patch adds the itemtype to the display and the CSV export
file.

To test:
- Try different item searches
- Verify that the itemtype now shows in the result list
- Export to CSV
- Verify that the itemtype shows there correctly as well

Signed-off-by: Axel Amghar <axel.amghar@gmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

catalogue/itemsearch.pl
koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc
koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.json.inc
koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/catalogue/itemsearch.tt
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt

index ab833db..ed6abc9 100755 (executable)
@@ -63,7 +63,7 @@ if (defined $format and $format eq 'json') {
                 push @f, $columns[$i];
                 push @c, 'and';
 
-                if ( grep /^$columns[$i]$/, qw( ccode homebranch holdingbranch location notforloan ) ) {
+                if ( grep /^$columns[$i]$/, qw( ccode homebranch holdingbranch location itype notforloan ) ) {
                     push @q, "$word";
                     push @op, '=';
                 } else {
index e0be353..93379a9 100644 (file)
@@ -1,5 +1,6 @@
 [%- USE Branches -%]
 [%- USE Koha -%]
+[%- USE ItemTypes -%]
 [%- SET biblio = item.biblio -%]
 [%- SET biblioitem = item.biblioitem -%]
-"[% biblio.title | html %] [% IF ( Koha.Preference( 'marcflavour' ) == 'UNIMARC' && biblio.author ) %]by [% END %][% biblio.author | html %]", "[% (biblioitem.publicationyear || biblio.copyrightdate) | html %]", "[% biblioitem.publishercode | html %]", "[% biblioitem.collectiontitle | html %]", "[% item.barcode | html %]", "[% item.itemcallnumber | html %]", "[% Branches.GetName(item.homebranch) | html %]", "[% Branches.GetName(item.holdingbranch) | html %]", "[% item.location | html %]", "[% item.stocknumber | html %]", "[% item.status | html %]", "[% (item.issues || 0) | html %]"
+"[% biblio.title | html %] [% IF ( Koha.Preference( 'marcflavour' ) == 'UNIMARC' && biblio.author ) %]by [% END %][% biblio.author | html %]", "[% (biblioitem.publicationyear || biblio.copyrightdate) | html %]", "[% biblioitem.publishercode | html %]", "[% biblioitem.collectiontitle | html %]", "[% item.barcode | html %]", "[% item.itemcallnumber | html %]", "[% Branches.GetName(item.homebranch) | html %]", "[% Branches.GetName(item.holdingbranch) | html %]", "[% item.location | html %]", "[% ItemTypes.GetDescription(item.itype) | html %]", "[% item.stocknumber | html %]", "[% item.status | html %]", "[% (item.issues || 0) | html %]"
index 45b43f6..0207f6b 100644 (file)
@@ -1,5 +1,6 @@
 [%- USE Branches -%]
 [%- USE Koha -%]
+[%- USE ItemTypes -%]
 [% USE AuthorisedValues %]
 [%- biblio = item.biblio -%]
 [%- biblioitem = item.biblioitem -%]
@@ -17,6 +18,7 @@
   "[% Branches.GetName(item.homebranch) | html %]",
   "[% Branches.GetName(item.holdingbranch) | html %]",
   "[% item.location | html %]",
+  "[% ItemTypes.GetDescription(item.itype) | html %]",
   "[% item.stocknumber | html %]",
   "[% item.status | html %]",
   "[% (item.issues || 0) | html %]",
index 8add507..8659836 100644 (file)
@@ -1 +1 @@
-[%- BLOCK -%]Title, Publication date, Publisher, Collection, Barcode, Call number, Home library, Current location, Shelving location, Inventory number, Status, Checkouts[%- END -%]
+[%- BLOCK -%]Title, Publication date, Publisher, Collection, Barcode, Call number, Home library, Current location, Shelving location, Itemtype, Inventory number, Status, Checkouts[%- END -%]
index c7c3668..a3309fe 100644 (file)
                 + '      <th id="items_homebranch">' + _("Home library") + '</th>'
                 + '      <th id="items_holdingbranch">' + _("Current location") + '</th>'
                 + '      <th id="items_location">' + _("Shelving location") + '</th>'
+                + '      <th id="items_itype">' + _("Itemtype") + '</th>'
                 + '      <th id="item_inventoryno">' + _("Inventory number") + '</th>'
                 + '      <th id="items_status">' + _("Status") + '</th>'
                 + '      <th id="items_checkouts">' + _("Checkouts") + '</th>'
                     { 'sName': 'homebranch' },
                     { 'sName': 'holdingbranch' },
                     { 'sName': 'location' },
+                    { 'sName': 'itype'},
                     { 'sName': 'stocknumber' },
                     { 'sName': 'notforloan' },
                     { 'sName': 'issues' },
                     [% ELSE %]
                         null,
                     [% END %]
+                    [% IF itemtypes.size %]
+                        { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => itemtypes %] },
+                    [% ELSE %]
+                        null,
+                    [% END %]
                     { 'type': 'text' },
                     [% IF notforloans.size %]
                         { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => notforloans %] },