Bugzilla – Attachment 68085 Details for
Bug 9573
Ability to download items lost report
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9573: Lost items report - Add items.notforloan as a filter
Bug-9573-Lost-items-report---Add-itemsnotforloan-a.patch (text/plain), 7.95 KB, created by
Jonathan Druart
on 2017-10-13 18:03:59 UTC
(
hide
)
Description:
Bug 9573: Lost items report - Add items.notforloan as a filter
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-10-13 18:03:59 UTC
Size:
7.95 KB
patch
obsolete
>From 2c667a44f6310432f4b84a14602a9295071e91e7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 5 Oct 2017 13:02:58 -0300 >Subject: [PATCH] Bug 9573: Lost items report - Add items.notforloan as a > filter > >This patch adds a new "Not for loan" status filter to the lost items >report. > >Test plan: >0/ Apply all patches from this patch set >1/ Use the new "Not for loan" filter to search lost items >2/ The table result must be consistent and a new "Not for loan" column >should be there >3/ Confirm that you are able to hide/show this column with the column >settings tool. >--- > Koha/Template/Plugin/AuthorisedValues.pm | 30 +++++++++++++++++ > admin/columns_settings.yml | 2 ++ > .../prog/en/modules/reports/itemslost.tt | 39 +++++++++++++++++----- > reports/itemslost.pl | 14 +++++--- > 4 files changed, 71 insertions(+), 14 deletions(-) > >diff --git a/Koha/Template/Plugin/AuthorisedValues.pm b/Koha/Template/Plugin/AuthorisedValues.pm >index 7e0ef5d50c..2692c15a06 100644 >--- a/Koha/Template/Plugin/AuthorisedValues.pm >+++ b/Koha/Template/Plugin/AuthorisedValues.pm >@@ -68,6 +68,28 @@ sub GetCategories { > ]; > } > >+sub GetDescriptionsByKohaField { >+ my ( $self, $params ) = @_; >+ return Koha::AuthorisedValues->get_descriptions_by_koha_field( >+ { kohafield => $params->{kohafield} } ); >+} >+ >+sub GetDescriptionByKohaField { >+ my ( $self, $params ) = @_; >+ my $av = Koha::AuthorisedValues->get_description_by_koha_field( >+ { >+ kohafield => $params->{kohafield}, >+ authorised_value => $params->{authorised_value}, >+ } >+ ); >+ return %$av >+ ? $params->{opac} >+ ? $av->{opac_description} >+ : $av->{lib} >+ : ''; # Maybe we should return $params->{authorised_value}? >+ >+} >+ > 1; > > =head1 NAME >@@ -93,6 +115,14 @@ the following TT code: [% AuthorisedValues.GetByCode( 'CATEGORY', 'AUTHORISED_VA > > The parameters are identical to those used by the subroutine C4::Koha::GetAuthValueDropbox > >+=head2 GetDescriptionsByKohaField >+ >+The parameters are identical to those used by the subroutine Koha::AuthorisedValues->get_descriptions_by_koha_field >+ >+=head2 GetDescriptionByKohaField >+ >+The parameters are identical to those used by the subroutine Koha::AuthorisedValues->get_description_by_koha_field >+ > =head1 AUTHOR > > Kyle M Hall <kyle@bywatersolutions.com> >diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml >index 5198c0d20e..d2f377f0c8 100644 >--- a/admin/columns_settings.yml >+++ b/admin/columns_settings.yml >@@ -285,6 +285,8 @@ modules: > - > columnname: location > - >+ columnname: notforloan >+ - > columnname: notes > > circ: >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt >index e3b8e2684b..327fe8e145 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt >@@ -67,6 +67,7 @@ > <th>Item type</th> > <th>Current location</th> > <th>Location</th> >+ <th>Not for loan status</th> > <th>Notes</th> > </tr> > </thead> >@@ -77,7 +78,7 @@ > <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.biblionumber %]" title="[% item.itemnotes %]">[% item.biblio.title |html %]</a> > </td> > <td>[% item.biblio.author %]</td> >- <td>[% AuthorisedValues.GetByCode( 'LOST', item.itemlost ) %]</td> >+ <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost ) %] > <td> > <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% item.biblionumber %]" title="[% item.itemnotes %]">[% item.barcode %]</a> > </td> >@@ -89,6 +90,7 @@ > <td>[% item.effective_itemtype %]</td> > <td>[% Branches.GetName(item.holdingbranch) %]</td> > <td>[% item.location %]</td> >+ <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) %] > <td>[% item.itemnotes %]</td> > </tr> > [% END %] >@@ -113,15 +115,34 @@ > [% END %] > </select></li> > >- <li><label for="loststatusfilter">Lost status: </label><select name="loststatusfilter" id="loststatusfilter"> >- <option value="">All</option> >- [% FOREACH loststatusloo IN loststatusloop %] >- [% IF ( loststatusloo.selected ) %]<option value="[% loststatusloo.authorised_value %]" selected="selected">[% loststatusloo.lib %]</option> >- [% ELSE %] >- <option value="[% loststatusloo.authorised_value %]">[% loststatusloo.lib %]</option> >- [% END %] >+ <li> >+ <label for="loststatusfilter">Lost status: </label> >+ <select name="loststatusfilter" id="loststatusfilter"> >+ <option value="">All</option> >+ [% FOREACH l IN AuthorisedValues.GetDescriptionsByKohaField( kohafield => 'items.itemlost') %] >+ [% IF l.authorised_value == lostfilter %] >+ <option value="[% l.authorised_value %]" selected="selected">[% l.lib %]</option> >+ [% ELSE %] >+ <option value="[% l.authorised_value %]">[% l.lib %]</option> > [% END %] >- </select></li> >+ [% END %] >+ </select> >+ </li> >+ >+ <li> >+ <label for="notforloanfilter">Not for loan: </label> >+ <select name="notforloanfilter" id="notforloanfilter"> >+ <option value="">All</option> >+ [% FOREACH n IN AuthorisedValues.GetDescriptionsByKohaField( kohafield => 'items.notforloan') %] >+ [% IF n.authorised_value == notforloanfilter %] >+ <option value="[% n.authorised_value %]" selected="selected">[% n.lib %]</option> >+ [% ELSE %] >+ <option value="[% n.authorised_value %]">[% n.lib %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ > </ol></fieldset> > <fieldset class="action"> <input type="submit" value="Submit" /> > <input type="hidden" name="get_items" value="1" /></fieldset> >diff --git a/reports/itemslost.pl b/reports/itemslost.pl >index 75bb067c77..41de7dd0bd 100755 >--- a/reports/itemslost.pl >+++ b/reports/itemslost.pl >@@ -33,6 +33,8 @@ use C4::Auth; > use C4::Output; > use C4::Biblio; > use C4::Items; >+ >+use Koha::AuthorisedValues; > use Koha::DateUtils; > > my $query = new CGI; >@@ -55,6 +57,7 @@ if ($get_items) { > my $barcodefilter = $params->{'barcodefilter'} || undef; > my $itemtypesfilter = $params->{'itemtypesfilter'} || undef; > my $loststatusfilter = $params->{'loststatusfilter'} || undef; >+ my $notforloanfilter = $params->{'notforloanfilter'} || undef; > > my $params = { > ( $branchfilter ? ( homebranch => $branchfilter ) : () ), >@@ -63,6 +66,11 @@ if ($get_items) { > ? ( itemlost => $loststatusfilter ) > : ( itemlost => { '!=' => 0 } ) > ), >+ ( >+ $notforloanfilter >+ ? ( notforloan => $notforloanfilter ) >+ : () >+ ), > ( $barcodefilter ? ( barcode => { like => "%$barcodefilter%" } ) : () ), > }; > >@@ -89,12 +97,8 @@ if ($get_items) { > # getting all itemtypes > my $itemtypes = Koha::ItemTypes->search_with_localization; > >-# get lost statuses >-my $lost_status_loop = C4::Koha::GetAuthorisedValues( 'LOST' ); >- > $template->param( >- itemtypes => $itemtypes, >- loststatusloop => $lost_status_loop, >+ itemtypes => $itemtypes, > ); > > # writing the template >-- >2.11.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 9573
:
68085
|
68086
|
68087
|
68088
|
68089
|
68090
|
68184
|
68283
|
68351
|
68352
|
68353
|
68354
|
68355
|
68356
|
68357
|
68358
|
68398
|
68399
|
68400
|
68401
|
68402
|
68403
|
68404
|
68405
|
71275
|
71276
|
71277
|
71278
|
71279
|
71280
|
71281
|
71282
|
71872
|
71873
|
71874
|
71875
|
71876
|
71877
|
71878
|
71879
|
71880
|
71887
|
71888
|
71889
|
71890
|
71891
|
71892
|
71893
|
71894
|
71895