Bugzilla – Attachment 88850 Details for
Bug 22424
Add search by all lost statuses to item search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22424: Add search by all lost statuses to item search
Bug-22424-Add-search-by-all-lost-statuses-to-item-.patch (text/plain), 10.98 KB, created by
Claire Gravely
on 2019-04-26 06:53:15 UTC
(
hide
)
Description:
Bug 22424: Add search by all lost statuses to item search
Filename:
MIME Type:
Creator:
Claire Gravely
Created:
2019-04-26 06:53:15 UTC
Size:
10.98 KB
patch
obsolete
>From 7f9cd6b4829a07e6e9b3a78104e2d4d8953b5444 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 27 Feb 2019 15:31:29 +0000 >Subject: [PATCH] Bug 22424: Add search by all lost statuses to item search > >This patch changes the item search form so that searching by lost status >includes options for all lost authorised values instead of just "yes" or >"no." > >To test you should have multiple authorized values for LOST. > > - Apply the patch and open the item search form. > - Test searches which limit by lost status. Confirm that results are > correctly limited. > - Confirm that lost statuses are correctly displayed in the search > results. > - Confirm that in the search results table, the column header for > "Lost" includes a dropdown menu for filtering by all available > authorized values for lost. > - Test the CSV export function and confirm that lost status is > correctly exported. > >Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de> >--- > catalogue/itemsearch.pl | 24 +++++++++++++++++++--- > .../en/includes/catalogue/itemsearch_item.csv.inc | 3 ++- > .../en/includes/catalogue/itemsearch_item.json.inc | 1 + > .../includes/csv_headers/catalogue/itemsearch.tt | 2 +- > .../prog/en/modules/catalogue/itemsearch.tt | 13 ++++++++++-- > 5 files changed, 36 insertions(+), 7 deletions(-) > >diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl >index ed6abc9..36e22b6 100755 >--- a/catalogue/itemsearch.pl >+++ b/catalogue/itemsearch.pl >@@ -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 itype notforloan ) ) { >+ if ( grep /^$columns[$i]$/, qw( ccode homebranch holdingbranch location itype notforloan itemlost ) ) { > push @q, "$word"; > push @op, '='; > } else { >@@ -103,6 +103,9 @@ my $notforloan_values = $mss->count ? GetAuthorisedValues($mss->next->authorised > $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.location', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); > my $location_values = $mss->count ? GetAuthorisedValues($mss->next->authorised_value) : []; > >+$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.itemlost', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); >+my $itemlost_values = $mss->count ? GetAuthorisedValues($mss->next->authorised_value) : []; >+ > if (scalar keys %params > 0) { > # Parameters given, it's a search > >@@ -111,7 +114,7 @@ if (scalar keys %params > 0) { > filters => [], > }; > >- foreach my $p (qw(homebranch holdingbranch location itype ccode issues datelastborrowed notforloan)) { >+ foreach my $p (qw(homebranch holdingbranch location itype ccode issues datelastborrowed notforloan itemlost)) { > if (my @q = $cgi->multi_param($p)) { > if ($q[0] ne '') { > my $f = { >@@ -164,7 +167,7 @@ if (scalar keys %params > 0) { > push @{ $filter->{filters} }, $f; > > # Yes/No parameters >- foreach my $p (qw(damaged itemlost)) { >+ foreach my $p (qw( damaged )) { > my $v = $cgi->param($p) // ''; > my $f = { > field => $p, >@@ -232,6 +235,12 @@ if (scalar keys %params > 0) { > $location_map->{$loc_value->{authorised_value}} = $loc_value->{lib}; > } > >+ # Get itemlost labels >+ my $itemlost_map = {}; >+ foreach my $il_value (@$itemlost_values) { >+ $itemlost_map->{$il_value->{authorised_value}} = $il_value->{lib}; >+ } >+ > foreach my $item (@$results) { > my $biblio = Koha::Biblios->find( $item->{biblionumber} ); > $item->{biblio} = $biblio; >@@ -304,6 +313,14 @@ foreach my $value (@$notforloan_values) { > }; > } > >+my @itemlosts; >+foreach my $value (@$itemlost_values) { >+ push @itemlosts, { >+ value => $value->{authorised_value}, >+ label => $value->{lib}, >+ }; >+} >+ > my @items_search_fields = GetItemSearchFields(); > > my $authorised_values = {}; >@@ -319,6 +336,7 @@ $template->param( > itemtypes => \@itemtypes, > ccodes => \@ccodes, > notforloans => \@notforloans, >+ itemlosts => \@itemlosts, > items_search_fields => \@items_search_fields, > authorised_values_json => to_json($authorised_values), > ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc >index 93379a9..965a497 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc >@@ -1,6 +1,7 @@ > [%- USE Branches -%] > [%- USE Koha -%] > [%- USE ItemTypes -%] >+[% USE AuthorisedValues %] > [%- 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 %]", "[% ItemTypes.GetDescription(item.itype) | 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 %]", "[% AuthorisedValues.GetByCode( 'CCODE', item.ccode ) | 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 %]","[% AuthorisedValues.GetByCode( 'LOST', item.itemlost ) | html %]", "[% (item.issues || 0) | html %]" >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.json.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.json.inc >index 0207f6b..98d0d20 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.json.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.json.inc >@@ -21,6 +21,7 @@ > "[% ItemTypes.GetDescription(item.itype) | html %]", > "[% item.stocknumber | html %]", > "[% item.status | html %]", >+ "[% AuthorisedValues.GetByCode( 'LOST', item.itemlost ) | html %]", > "[% (item.issues || 0) | html %]", > "[% FILTER escape_quotes ~%] > <div class="btn-group dropup"><button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fa fa-pencil"></i> Edit <span class="caret"></span> </button> <ul class="dropdown-menu"> <li><a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% item.biblionumber | uri %]&itemnumber=[% item.itemnumber | uri %]">Edit item</a></li> <li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% item.biblionumber | html %]">Edit record</a></li> </ul> </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/catalogue/itemsearch.tt >index 8659836..4e61e6e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/catalogue/itemsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/catalogue/itemsearch.tt >@@ -1 +1 @@ >-[%- BLOCK -%]Title, Publication date, Publisher, Collection, Barcode, Call number, Home library, Current location, Shelving location, Itemtype, Inventory number, Status, Checkouts[%- END -%] >+[%- BLOCK -%]Title, Publication date, Publisher, Collection, Barcode, Call number, Home library, Current location, Shelving location, Itemtype, Inventory number, Status, Lost, Checkouts[%- END -%] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >index a3309fe..1ad7838 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >@@ -155,6 +155,9 @@ > [% IF notforloans.size %] > [% INCLUDE form_field_select name="notforloan" options = notforloans empty_option = "All statuses" %] > [% END %] >+ [% IF itemlosts.size %] >+ [% INCLUDE form_field_select name="itemlost" options = itemlosts empty_option = "All statuses" %] >+ [% END %] > </fieldset> > <fieldset> > [% INCLUDE form_field_select_text %] >@@ -174,7 +177,6 @@ > <span class="hint">(inclusive)</span> > </div> > [% INCLUDE form_field_radio_yes_no name="damaged" %] >- [% INCLUDE form_field_radio_yes_no name="itemlost" %] > <div class="form-field"> > <label class="form-field-label" for="issues_op">Checkout count:</label> > <select id="issues_op" name="issues_op"> >@@ -272,6 +274,7 @@ > + ' <th id="items_itype">' + _("Itemtype") + '</th>' > + ' <th id="item_inventoryno">' + _("Inventory number") + '</th>' > + ' <th id="items_status">' + _("Status") + '</th>' >+ + ' <th id="items_itemlost">' + _("Lost") + '</th>' > + ' <th id="items_checkouts">' + _("Checkouts") + '</th>' > + ' <th id=""></th>' > + ' </tr>' >@@ -365,7 +368,7 @@ > { 'sName': 'title' }, > { 'sName': 'publicationyear' }, > { 'sName': 'publishercode' }, >- { 'sName': 'ccode' }, >+ { 'sName': 'ccode' }, > { 'sName': 'barcode' }, > { 'sName': 'itemcallnumber' }, > { 'sName': 'homebranch' }, >@@ -374,6 +377,7 @@ > { 'sName': 'itype'}, > { 'sName': 'stocknumber' }, > { 'sName': 'notforloan' }, >+ { 'sName': 'itemlost' }, > { 'sName': 'issues' }, > { 'sName': 'checkbox', 'bSortable': false } > ], >@@ -409,6 +413,11 @@ > [% ELSE %] > null, > [% END %] >+ [% IF itemlosts.size %] >+ { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => itemlosts %] }, >+ [% ELSE %] >+ null, >+ [% END %] > { 'type': 'text' }, > null > ] >-- >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 22424
:
88782
|
88850
|
89025
|
89053
|
89054