Bugzilla – Attachment 131628 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.24 KB, created by
ByWater Sandboxes
on 2022-03-11 19:51:36 UTC
(
hide
)
Description:
Bug 14393 - Add collection code filter to inventory
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2022-03-11 19:51:36 UTC
Size:
9.24 KB
patch
obsolete
>From 26680876c53294ad3b668ddb23ba4205abd769ef 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) > >Signed-off-by: kelly mcelligott <kpmcelligott@gmail.com> >--- > C4/Items.pm | 9 +++++++- > .../prog/en/modules/tools/inventory.tt | 22 +++++++++++++++++++ > tools/inventory.pl | 13 +++++++++-- > 3 files changed, 41 insertions(+), 3 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 502ccb6793..5b95042611 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -536,6 +536,7 @@ sub GetItemsForInventory { > my $statushash = $parameters->{'statushash'} // ''; > my $ignore_waiting_holds = $parameters->{'ignore_waiting_holds'} // ''; > my $itemtypes = $parameters->{'itemtypes'} || []; >+ my $ccode = $parameters->{'ccode'} // ''; > > my $dbh = C4::Context->dbh; > my ( @bind_params, @where_strings ); >@@ -544,7 +545,8 @@ sub GetItemsForInventory { > my $max_cnsort = GetClassSort($class_source,undef,$maxlocation); > > my $select_columns = q{ >- SELECT DISTINCT(items.itemnumber), barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber, items.cn_sort >+ SELECT DISTINCT(items.itemnumber), barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber, items.cn_sort, ccode >+ > }; > my $select_count = q{SELECT COUNT(DISTINCT(items.itemnumber))}; > my $query = q{ >@@ -561,6 +563,11 @@ sub GetItemsForInventory { > } > } > >+ if ($ccode){ >+ push @where_strings, 'ccode = ?'; >+ push @bind_params, $ccode; >+ } >+ > if ($minlocation) { > push @where_strings, 'items.cn_sort >= ?'; > push @bind_params, $min_cnsort; >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 782907355a..f68adcf372 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >@@ -1,5 +1,6 @@ > [% USE raw %] > [% USE Asset %] >+[% USE AuthorisedValues %] > [% USE KohaDates %] > [% USE Branches %] > [% SET footerjs = 1 %] >@@ -116,6 +117,22 @@ > [% END %] > </select> </li> > [% END %] >+ [% SET ccodes = AuthorisedValues.GetAuthValueDropbox('CCODE') %] >+ [% IF ( ccodes.count > 0 ) %] >+ <li> >+ <label for="ccode">Collection code: </label> >+ <select id="ccodeloop" name="ccode"> >+ <option value="">Filter collection</option> >+ [% FOREACH cc IN ccodes %] >+ [% IF (ccode == cc.authorised_value) %] >+ <option value="[% cc.authorised_value %]" selected="selected">[% cc.lib %]</option> >+ [% ELSE %] >+ <option value="[% cc.authorised_value %]">[% cc.lib %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ [% END %] > <li> > <label for="minlocation">Item call number between: </label> > <input type="text" name="minlocation" id="minlocation" value="[% minlocation | html %]" /> (items.itemcallnumber) </li> >@@ -229,6 +246,7 @@ > <input type="hidden" name="location" value="[% location | html %]" /> > <input type="hidden" name="branchcode" value="[% branchcode | html %]" /> > <input type="hidden" name="datelastseen" value="[% datelastseen | html %]" /> >+ <input type="hidden" name="ccode" value="[% ccode %]" /> > > [% UNLESS uploadedbarcodesflag %] > <div><a href="#" class="checkall"><i class="fa fa-check"></i> Select all</a> <a href="#" class="clearall"><i class="fa fa-remove"></i> Clear all</a></div> >@@ -241,6 +259,7 @@ > <th>Barcode</th> > <th>Call number</th> > <th>Library</th> >+ <th>Collection code</th> > <th class="anti-the">Title</th> > <th>Not for loan</th> > <th>Lost</th> >@@ -268,6 +287,9 @@ > [% Branches.GetName( result.homebranch ) | html %] > <span class="shelvingloc">[% result.location | html %]</span> > </td> >+ <td> >+ <span class="ccode">[% result.ccode | html %]</span> >+ </td> > <td> > <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% result.biblionumber | uri %]" class="openWin">[% result.title | html %]</a> > [% IF ( result.author ) %] >diff --git a/tools/inventory.pl b/tools/inventory.pl >index 3400c70d11..5be7d7fd67 100755 >--- a/tools/inventory.pl >+++ b/tools/inventory.pl >@@ -58,6 +58,7 @@ my $op = $input->param('op'); > my $compareinv2barcd = $input->param('compareinv2barcd'); > my $dont_checkin = $input->param('dont_checkin'); > my $out_of_order = $input->param('out_of_order'); >+my $ccode = $input->param('ccode'); > > my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > { template_name => "tools/inventory.tt", >@@ -73,6 +74,9 @@ my $authorisedvalue_categories = ''; > my $frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] })->unblessed; > unshift @$frameworks, { frameworkcode => '' }; > >+my @collections = (); >+my @collection_codes = (); >+ > for my $fwk ( @$frameworks ){ > my $fwkcode = $fwk->{frameworkcode}; > my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fwkcode, kohafield => 'items.location', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); >@@ -149,6 +153,7 @@ $template->param( > class_sources => \@class_sources, > pref_class => $pref_class, > itemtypes => \@itemtypes, >+ ccode => $ccode, > ); > > # Walk through uploaded barcodes, report errors, mark as seen, check in >@@ -260,12 +265,14 @@ if ( $op && ( !$uploadbarcodes || $compareinv2barcd )) { > branch => $branch, > offset => 0, > statushash => $staton, >+ ccode => $ccode, > ignore_waiting_holds => $ignore_waiting_holds, > itemtypes => \@selected_itemtypes, > }); > } > # Build rightplacelist used to check if a scanned item is in the right place. > if( @scanned_items ) { >+ # For the items that may be marked as "wrong place", we only check the location (callnumbers, location, ccode and branch) > ( $rightplacelist ) = GetItemsForInventory({ > minlocation => $minlocation, > maxlocation => $maxlocation, >@@ -279,11 +286,13 @@ if( @scanned_items ) { > statushash => undef, > ignore_waiting_holds => $ignore_waiting_holds, > itemtypes => \@selected_itemtypes, >+ ccode => $ccode, > }); > # Convert the structure to a hash on barcode > $rightplacelist = { > map { $_->{barcode} ? ( $_->{barcode}, $_ ) : (); } @$rightplacelist > }; >+ > } > > # Report scanned items that are on the wrong place, or have a wrong notforloan >@@ -394,7 +403,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 >@@ -406,7 +415,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 itemlost damaged withdrawn stocknumber /; >+ my @keys = qw/ title author barcode itemnumber homebranch location ccode itemcallnumber notforloan itemlost damaged withdrawn stocknumber /; > for my $item ( @$loop ) { > my @line; > for my $key (@keys) { >-- >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 14393
:
40209
|
40255
|
40958
|
44772
|
131025
|
131627
|
131628
|
132791
|
132792