[Koha-patches] [PATCH] Bug 2094: implementing ability to select particular lost status in the lost items report

Andrew Moore andrew.moore at liblime.com
Fri May 9 21:03:27 CEST 2008


This patch adds a drop-down to the lost items report to let the user select a
particular lost status to display. Only items with that particluar lost status
will be dispolayed.

The documentation for the lost items report on the staff client will need to be slightly adjusted.
---
 .../prog/en/modules/reports/itemslost.tmpl         |   13 +++++++++-
 reports/itemslost.pl                               |   25 ++++++++++++--------
 2 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tmpl
index 4d958cd..c1d819e 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tmpl
@@ -97,7 +97,18 @@
 				<option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="description" --></option>
 				<!-- /TMPL_IF -->
                 <!-- /TMPL_LOOP -->
-            </select></li></ol></fieldset>
+            </select></li>
+
+	<li><label for="loststatusfilter">Lost Status: </label><select name="loststatusfilter" id="loststatusfilter">
+                <option value="">All</option>
+                <!-- TMPL_LOOP name="loststatusloop" -->
+                <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="authorised_value" -->" selected="selected"><!-- TMPL_VAR NAME="lib" --></option>
+		<!-- TMPL_ELSE -->
+		<option value="<!-- TMPL_VAR NAME="authorised_value" -->"><!-- TMPL_VAR NAME="lib" --></option>
+		<!-- /TMPL_IF -->
+                <!-- /TMPL_LOOP -->
+            </select></li>
+</ol></fieldset>
 <fieldset class="action">    <input type="submit" value="Submit" />
     <input type="hidden" name="get_items" value="1" /></fieldset>
 </form>
diff --git a/reports/itemslost.pl b/reports/itemslost.pl
index 52ff1f9..07b6e3c 100755
--- a/reports/itemslost.pl
+++ b/reports/itemslost.pl
@@ -47,15 +47,17 @@ my $params = $query->Vars;
 my $get_items = $params->{'get_items'};
 
 if ( $get_items ) {
-    my $orderbyfilter   = $params->{'orderbyfilter'}   || undef;
-    my $branchfilter    = $params->{'branchfilter'}    || undef;
-    my $barcodefilter   = $params->{'barcodefilter'}   || undef;
-    my $itemtypesfilter = $params->{'itemtypesfilter'} || undef;
+    my $orderbyfilter    = $params->{'orderbyfilter'}   || undef;
+    my $branchfilter     = $params->{'branchfilter'}    || undef;
+    my $barcodefilter    = $params->{'barcodefilter'}   || undef;
+    my $itemtypesfilter  = $params->{'itemtypesfilter'} || undef;
+    my $loststatusfilter = $params->{'loststatusfilter'} || undef;
 
     my %where;
-    $where{homebranch} = $branchfilter    if defined $branchfilter;
-    $where{barcode}    = $barcodefilter   if defined $barcodefilter;
-    $where{itemtype}   = $itemtypesfilter if defined $itemtypesfilter;
+    $where{'homebranch'}       = $branchfilter    if defined $branchfilter;
+    $where{'barcode'}          = $barcodefilter   if defined $barcodefilter;
+    $where{'itemtype'}         = $itemtypesfilter if defined $itemtypesfilter;
+    $where{'authorised_value'} = $loststatusfilter if defined $loststatusfilter;
 
     my $items = GetLostItems( \%where, $orderbyfilter ); 
     $template->param(
@@ -100,9 +102,12 @@ foreach my $thisitemtype ( sort keys %$itemtypes ) {
     push @itemtypesloop, \%row;
 }
 
-$template->param(
-    branchloop   => \@branchloop,
-    itemtypeloop => \@itemtypesloop,
+# get lost statuses
+my $lost_status_loop = C4::Koha::GetAuthorisedValues( 'LOST' );
+
+$template->param( branchloop     => \@branchloop,
+                  itemtypeloop   => \@itemtypesloop,
+                  loststatusloop => $lost_status_loop,
 );
 
 # writing the template
-- 
1.5.5.rc0.16.g02b00




More information about the Koha-patches mailing list