Bugzilla – Attachment 158406 Details for
Bug 26468
Item search should include a way to limit by damaged
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26468: Add damaged as a searchable status in item search
Bug-26468-Add-damaged-as-a-searchable-status-in-it.patch (text/plain), 11.62 KB, created by
Katrin Fischer
on 2023-11-04 23:27:18 UTC
(
hide
)
Description:
Bug 26468: Add damaged as a searchable status in item search
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2023-11-04 23:27:18 UTC
Size:
11.62 KB
patch
obsolete
>From 6d36a00c3178bfab477ed991338f7ac81b112bde Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Fri, 13 Oct 2023 21:01:58 +0000 >Subject: [PATCH] Bug 26468: Add damaged as a searchable status in item search > >This patch removes the Damaged radio box options ( Ignore, yes, no ) in favor a full damage status search option > >To test: >1. APPLY PATCH, restart services. >2. Make sure you mark some items as damaged. >3. Go to the item and search and limit by 'Damaged' >4. You should only see your 'Damaged' items. >5. Export the results as a CSV, make sure the CSV is well-formed and accurate. > >Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov> >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >Perltidied. >--- > catalogue/itemsearch.pl | 33 +++++++++++++++---- > .../catalogue/itemsearch_item.csv.inc | 2 ++ > .../catalogue/itemsearch_item.json.inc | 1 + > .../csv_headers/catalogue/itemsearch.tt | 2 +- > .../prog/en/modules/catalogue/itemsearch.tt | 13 ++++++-- > 5 files changed, 41 insertions(+), 10 deletions(-) > >diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl >index fad7d1a8ae..854aced970 100755 >--- a/catalogue/itemsearch.pl >+++ b/catalogue/itemsearch.pl >@@ -108,6 +108,14 @@ my $itemlost_values = $mss->count ? GetAuthorisedValues($mss->next->authorised_v > $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.withdrawn', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); > my $withdrawn_values = $mss->count ? GetAuthorisedValues($mss->next->authorised_value) : []; > >+$mss = Koha::MarcSubfieldStructures->search( >+ { >+ frameworkcode => '', kohafield => 'items.damaged', >+ authorised_value => [ -and => { '!=' => undef }, { '!=' => '' } ] >+ } >+); >+my $damaged_values = $mss->count ? GetAuthorisedValues( $mss->next->authorised_value ) : []; >+ > if ( Koha::MarcSubfieldStructures->search( { frameworkcode => '', kohafield => 'items.new_status' } )->count ) { > $template->param( has_new_status => 1 ); > } >@@ -120,14 +128,16 @@ if ( defined $format ) { > filters => [], > }; > >- foreach my $p (qw(homebranch holdingbranch location itype ccode issues datelastborrowed notforloan itemlost withdrawn)) { >- if (my @q = $cgi->multi_param($p)) { >- if ($q[0] ne '') { >+ foreach my $p ( >+ qw(homebranch holdingbranch location itype ccode issues datelastborrowed notforloan itemlost withdrawn damaged)) >+ { >+ if ( my @q = $cgi->multi_param($p) ) { >+ if ( $q[0] ne '' ) { > my $f = { > field => $p, > query => \@q, > }; >- if (my $op = scalar $cgi->param($p . '_op')) { >+ if ( my $op = scalar $cgi->param( $p . '_op' ) ) { > $f->{operator} = $op; > } > push @{ $filter->{filters} }, $f; >@@ -174,7 +184,7 @@ if ( defined $format ) { > push @{ $filter->{filters} }, $f; > > # Yes/No parameters >- foreach my $p (qw( damaged new_status )) { >+ foreach my $p (qw( new_status )) { > my $v = $cgi->param($p) // ''; > my $f = { > field => $p, >@@ -183,10 +193,10 @@ if ( defined $format ) { > if ( $p eq 'new_status' ) { > $f->{ifnull} = 0; > } >- if ($v eq 'yes') { >+ if ( $v eq 'yes' ) { > $f->{operator} = '!='; > push @{ $filter->{filters} }, $f; >- } elsif ($v eq 'no') { >+ } elsif ( $v eq 'no' ) { > $f->{operator} = '='; > push @{ $filter->{filters} }, $f; > } >@@ -309,6 +319,14 @@ foreach my $value (@$withdrawn_values) { > }; > } > >+my @damageds; >+foreach my $value (@$damaged_values) { >+ push @damageds, { >+ value => $value->{authorised_value}, >+ label => $value->{lib}, >+ }; >+} >+ > my @items_search_fields = GetItemSearchFields(); > > my $authorised_values = {}; >@@ -324,6 +342,7 @@ $template->param( > ccodes => \@ccodes, > itemlosts => \@itemlosts, > withdrawns => \@withdrawns, >+ damageds => \@damageds, > 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 ac91b9e2fb..e59eca534e 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 >@@ -37,6 +37,8 @@ > [%- delimiter | $raw -%] > "[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn ) || "" | replace('"', '""') | $raw %]" > [%- delimiter | $raw -%] >+"[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged ) || "" | replace('"', '""') | $raw %]" >+[%- delimiter | $raw -%] > "[% (item.issues || 0) | $raw %]" > [%- delimiter | $raw -%] > "[% IF item.checkout %][% item.checkout.date_due | $KohaDates | $raw %][% END %]" >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 dd4810592f..5ef1019911 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 >@@ -29,6 +29,7 @@ > "[% AuthorisedValues.GetDescriptionByKohaField( frameworkcode => biblio.frameworkcode, kohafield => 'items.notforloan', authorised_value => item.notforloan) | html %]", > "[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost ) || "" | html %]", > "[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn ) || "" | html %]", >+ "[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged ) || "" | html %]", > "[% (item.issues || 0) | html %]", > "[% IF item.checkout %][% item.checkout.date_due | $KohaDates %][% END %]", > "[% FILTER escape_quotes ~%] >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 cf82cb47ee..f1f4ebc79a 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 >@@ -3,5 +3,5 @@ > [%- PROCESS 'i18n.inc' -%] > [%- SET delimiter = Koha.CSVDelimiter() -%] > [%- BLOCK -%] >- "[% t("Title") | html %]"[%- delimiter | $raw -%]"[% t("Publication date") | html %]"[%- delimiter | $raw -%]"[% t("Publisher") | html %]"[%- delimiter | $raw -%]"[% t("Collection") | html %]"[%- delimiter | $raw -%]"[% t("Barcode") | html %]"[%- delimiter | $raw -%]"[% t("Serial enumeration") | html %]"[%- delimiter | $raw -%]"[% t("Call number") | html %]"[%- delimiter | $raw -%]"[% t("Home library") | html %]"[%- delimiter | $raw -%]"[% t("Current library") | html %]"[%- delimiter | $raw -%]"[% t("Shelving location") | html %]"[%- delimiter | $raw -%]"[% t("Item type") | html %]"[%- delimiter | $raw -%]"[% t("Inventory number") | html %]"[%- delimiter | $raw -%]"[% t("Not for loan status") | html %]"[%- delimiter | $raw -%]"[% t("Lost status") | html %]"[%- delimiter | $raw -%]"[% t("Withdrawn status") | html %]"[%- delimiter | $raw -%]"[% t("Checkouts") | html %]"[%- delimiter | $raw -%]"[% t("Due date") | html %]" >+ "[% t("Title") | html %]"[%- delimiter | $raw -%]"[% t("Publication date") | html %]"[%- delimiter | $raw -%]"[% t("Publisher") | html %]"[%- delimiter | $raw -%]"[% t("Collection") | html %]"[%- delimiter | $raw -%]"[% t("Barcode") | html %]"[%- delimiter | $raw -%]"[% t("Serial enumeration") | html %]"[%- delimiter | $raw -%]"[% t("Call number") | html %]"[%- delimiter | $raw -%]"[% t("Home library") | html %]"[%- delimiter | $raw -%]"[% t("Current library") | html %]"[%- delimiter | $raw -%]"[% t("Shelving location") | html %]"[%- delimiter | $raw -%]"[% t("Item type") | html %]"[%- delimiter | $raw -%]"[% t("Inventory number") | html %]"[%- delimiter | $raw -%]"[% t("Not for loan status") | html %]"[%- delimiter | $raw -%]"[% t("Lost status") | html %]"[%- delimiter | $raw -%]"[% t("Withdrawn status") | html %]"[%- delimiter | $raw -%]"[% t("Damaged status") | html %]"[%- delimiter | $raw -%]"[% t("Checkouts") | html %]"[%- delimiter | $raw -%]"[% t("Due date") | html %]" > [%- 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 f997ee31e7..0186812f0c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >@@ -26,9 +26,9 @@ > [%- CASE 'All collection codes' %]<span>All collections</span> > [%- CASE 'notforloan' %]<span>Status</span> > [%- CASE 'All statuses' %]<span>All statuses</span> >- [%- CASE 'damaged' %]<span>Damaged</span> > [%- CASE 'itemlost' %]<span>Lost</span> > [%- CASE 'withdrawn' %]<span>Withdrawn</span> >+ [%- CASE 'damaged' %]<span>Damaged</span> > [%- CASE 'new_status' %]<span>Is new</span> > [%- END -%] > [%- END -%] >@@ -204,6 +204,9 @@ > [% IF withdrawns.size %] > [% INCLUDE form_field_select name="withdrawn" options = withdrawns empty_option = "All statuses" %] > [% END %] >+ [% IF damageds.size %] >+ [% INCLUDE form_field_select name="damaged" options = damageds empty_option = "All statuses" %] >+ [% END %] > <div class="form-field"> > <label class="form-field-label">Availability:</label> > <input type="radio" name="onloan" id="onloan_indifferent" value="" checked="checked"/> >@@ -231,7 +234,6 @@ > <input type="text" id="itemcallnumber_to" name="itemcallnumber_to" value="" /> > <span class="hint">(inclusive)</span> > </div> >- [% INCLUDE form_field_radio_yes_no name="damaged" %] > [% IF ( has_new_status ) %] > [% INCLUDE form_field_radio_yes_no name="new_status" divclass='item-new-status' %] > [% END %] >@@ -383,6 +385,7 @@ > + ' <th id="items_status">' + _("Not for loan status") + '</th>' > + ' <th id="items_itemlost">' + _("Lost status") + '</th>' > + ' <th id="items_widthdrawn">' + _("Withdrawn status") + '</th>' >+ + ' <th id="items_damaged">' + _("Damaged status") + '</th>' > + ' <th id="items_checkouts">' + _("Checkouts") + '</th>' > + ' <th id="items_date_due">' + _("Due date") + '</th>' > + ' <th id=""></th>' >@@ -506,6 +509,7 @@ > { 'sName': 'notforloan' }, > { 'sName': 'itemlost' }, > { 'sName': 'withdrawn' }, >+ { 'sName': 'damaged' }, > { 'sName': 'issues' }, > { 'sName': 'date_due' }, > { 'sName': 'actions', 'bSortable': false } >@@ -558,6 +562,11 @@ > [% ELSE %] > null, > [% END %] >+ [% IF damageds.size %] >+ { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => damageds %] }, >+ [% ELSE %] >+ null, >+ [% END %] > { 'type': 'text' }, > { 'type': 'text' }, > null >-- >2.30.2
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 26468
:
157136
|
157200
| 158406