Bugzilla – Attachment 44772 Details for
Bug 14393
Add collection code filter to inventory
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14393 - Add collection code filter to inventory
Bug-14393---Add-collection-code-filter-to-inventor.patch (text/plain), 9.74 KB, created by
Frédéric Demians
on 2015-11-11 16:15:25 UTC
(
hide
)
Description:
Bug 14393 - Add collection code filter to inventory
Filename:
MIME Type:
Creator:
Frédéric Demians
Created:
2015-11-11 16:15:25 UTC
Size:
9.74 KB
patch
obsolete
>From b4a042f254d09d0cab38e494ddad7a92a9e177a8 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Wed, 17 Jun 2015 14:50:14 +1000 >Subject: [PATCH] Bug 14393 - Add collection code filter to inventory > >This patch adds the ability to do inventory by collection. > >_TEST PLAN_ > >Before applying: >1) Go to "Tools > Inventory/stocktaking" >2) Note that there is no "Collection code:" option > >Optionally: >2b) You can create a Barcode file with a single barcode >2c) Don't select anything from "Select items you want to check" (or filter if you know >how to filter to make it faster... doesn't matter) >2d) Click "Submit" at the bottom of the screen >2e) Note that there is no "Collection code" column in the screen output or CSV output >(ie with/without the "Export to CSV file" box ticked before submitting) > >Apply the patch. > >After applying: >3) Note that there is a "Collection code" filter on the main inventory screen >4) Create a Barcode file with a single barcode for an item with a collection >and upload it using the "Choose file" button. >5) Select that item's collection code from the "Collection code" filter >6) Click "Submit" >7) Note that the screen output and the CSV output contains a "Collection code" column >(ie with/without the "Export to CSV file" box ticked before submitting) > >Note: Collection code isn't displayed on Inventory filter & result if ccode >isn't used in items. > >Signed-off-by: Frederic Demians <f.demians@tamil.fr> >--- > C4/Items.pm | 8 ++++++- > .../prog/en/modules/tools/inventory.tt | 21 +++++++++++++++++ > tools/inventory.pl | 27 ++++++++++++++++++---- > 3 files changed, 51 insertions(+), 5 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index c8078b0..9c6b0c9 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -1068,12 +1068,13 @@ sub GetItemsForInventory { > my $size = $parameters->{'size'} // ''; > my $statushash = $parameters->{'statushash'} // ''; > my $interface = $parameters->{'interface'} // ''; >+ my $ccode = $parameters->{'ccode'} // ''; > > my $dbh = C4::Context->dbh; > my ( @bind_params, @where_strings ); > > my $select_columns = q{ >- SELECT items.itemnumber, barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber >+ SELECT items.itemnumber, barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber, ccode > }; > my $select_count = q{SELECT COUNT(*)}; > my $query = q{ >@@ -1090,6 +1091,11 @@ sub GetItemsForInventory { > } > } > >+ if ($ccode){ >+ push @where_strings, 'ccode = ?'; >+ push @bind_params, $ccode; >+ } >+ > if ($minlocation) { > push @where_strings, 'itemcallnumber >= ?'; > push @bind_params, $minlocation; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >index 5143b3c..6c4c681 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >@@ -14,6 +14,7 @@ function checkForm() { > if ( !( > $('#branchloop').val() || > $('#locationloop').val() || >+ $('#ccodeloop').val() || > $('#minlocation').val() || > $('#maxlocation').val() || > $('#statuses input:checked').length >@@ -162,6 +163,21 @@ $(document).ready(function(){ > [% END %] > </select> </li> > [% END %] >+ [% IF ( ccode_list ) %] >+ <li> >+ <label for="ccode">Collection code: </label> >+ <select id="ccodeloop" name="ccode"> >+ <option value="">Filter collection code</option> >+ [% FOREACH ccode_value IN ccode_list %] >+ [% IF (ccode == ccode_value) %] >+ <option value="[% ccode_value.authorised_value %]" selected="selected">[% ccode_value.lib %]</option> >+ [% ELSE %] >+ <option value="[% ccode_value.authorised_value %]">[% ccode_value.lib %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ [% END %] > <li> > <label for="minlocation">Item callnumber between: </label> > <input type="text" name="minlocation" id="minlocation" value="[% minlocation %]" /> (items.itemcallnumber) </li> >@@ -235,6 +251,7 @@ $(document).ready(function(){ > <input type="hidden" name="location" value="[% location %]" /> > <input type="hidden" name="branchcode" value="[% branchcode %]" /> > <input type="hidden" name="datelastseen" value="[% datelastseen %]" /> >+ <input type="hidden" name="ccode" value="[% ccode %]" /> > > [% UNLESS compareinv2barcd %] > <div><a href="#" class="checkall">[Select all]</a> <a href="#" class="clearall">[Clear all]</a></div> >@@ -246,6 +263,7 @@ $(document).ready(function(){ > [% UNLESS compareinv2barcd %]<th>Seen</th>[% END %] > <th>Barcode</th> > <th>Library</th> >+ [% IF ( ccode_list ) %]<th>Collection code</th>[% END %] > <th>Title</th> > <th>Status</th> > <th>Lost</th> >@@ -271,6 +289,9 @@ $(document).ready(function(){ > [% result.location | html %] [% IF ( result.itemcallnumber ) %][[% result.itemcallnumber | html %]][% ELSE %][% END %] > </td> > <td> >+ [% IF ( ccode_list ) %][% result.ccode | html %][% END %] >+ </td> >+ <td> > <p><a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=[% result.biblionumber %]" class="openWin">[% result.title | html %]</a></p><p>[% result.author | html %]</p> > </td> > <td> >diff --git a/tools/inventory.pl b/tools/inventory.pl >index 2192dbd..6cc096e 100755 >--- a/tools/inventory.pl >+++ b/tools/inventory.pl >@@ -53,6 +53,7 @@ my $branch = $input->param('branch'); > my $op = $input->param('op'); > my $compareinv2barcd = $input->param('compareinv2barcd'); > my $dont_checkin = $input->param('dont_checkin'); >+my $ccode = $input->param('ccode'); > > my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > { template_name => "tools/inventory.tt", >@@ -80,6 +81,9 @@ my $authorisedvalue_categories = ''; > my $frameworks = getframeworks(); > $frameworks->{''} = {frameworkcode => ''}; # Add the default framework > >+my @collections = (); >+my @collection_codes = (); >+ > for my $fwk (keys %$frameworks){ > my $fwkcode = $frameworks->{$fwk}->{'frameworkcode'}; > my $authcode = GetAuthValCode('items.location', $fwkcode); >@@ -91,7 +95,19 @@ for my $fwk (keys %$frameworks){ > } > push @authorised_value_list,@$data; > } >+ >+ my $collection_authorised_value = C4::Koha::GetAuthValCode("items.ccode", $fwkcode); >+ if ($collection_authorised_value && (! grep { $collection_authorised_value eq $_ } @collection_codes) ) { >+ #Add authorised value category to array >+ push (@collection_codes,$collection_authorised_value); >+ my $collection_values = C4::Koha::GetAuthorisedValues($collection_authorised_value); >+ if (ref $collection_values eq 'ARRAY' && @$collection_values){ >+ #Add authorised values to array >+ push(@collections,@$collection_values); >+ } >+ } > } >+$template->param( ccode_list => \@collections ); > > my $statuses = []; > for my $statfield (qw/items.notforloan items.itemlost items.withdrawn items.damaged/){ >@@ -139,7 +155,8 @@ $template->param( > branch => $branch, > datelastseen => $datelastseen, > compareinv2barcd => $compareinv2barcd, >- notforloanlist => $notforloanlist >+ notforloanlist => $notforloanlist, >+ ccode => $ccode, > ); > > my @notforloans; >@@ -256,9 +273,10 @@ if ( $markseen or $op ) { > size => undef, > statushash => $staton, > interface => 'staff', >+ ccode => $ccode, > } ); > >- # For the items that may be marked as "wrong place", we only check the location (callnumbers, location and branch) >+ # For the items that may be marked as "wrong place", we only check the location (callnumbers, location, ccode and branch) > ($wrongplacelist, $totalrecords) = GetItemsForInventory( { > minlocation => $minlocation, > maxlocation => $maxlocation, >@@ -272,6 +290,7 @@ if ( $markseen or $op ) { > size => undef, > statushash => undef, > interface => 'staff', >+ ccode => $ccode, > } ); > > } >@@ -385,7 +404,7 @@ if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){ > my @translated_keys; > for my $key (qw / biblioitems.title biblio.author > items.barcode items.itemnumber >- items.homebranch items.location >+ items.homebranch items.location items.ccode > items.itemcallnumber items.notforloan > items.itemlost items.damaged > items.withdrawn items.stocknumber >@@ -397,7 +416,7 @@ if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){ > $csv->combine(@translated_keys); > print $csv->string, "\n"; > >- my @keys = qw / title author barcode itemnumber homebranch location itemcallnumber notforloan lost damaged withdrawn stocknumber /; >+ my @keys = qw / title author barcode itemnumber homebranch location ccode itemcallnumber notforloan lost damaged withdrawn stocknumber /; > for my $item ( @results ) { > my @line; > for my $key (@keys) { >-- >2.6.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 14393
:
40209
|
40255
|
40958
|
44772
|
131025
|
131627
|
131628
|
132791
|
132792