Skip to content

Commit

Permalink
fix to handle notforloan authorised values (we now handle wthdrawn, i…
Browse files Browse the repository at this point in the history
…temlost, damaged AND notforloan fields)

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
  • Loading branch information
Paul POULAIN authored and Joshua Ferraro committed Dec 26, 2007
1 parent 6686dda commit a553ea8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions C4/Search.pm
Expand Up @@ -1001,6 +1001,10 @@ sub searchResults {
$sth->execute;
my ($itemtag) = $sth->fetchrow;

# get notforloan authorised value list
$sth = $dbh->prepare("SELECT authorised_value FROM `marc_subfield_structure` WHERE kohafield = 'items.notforloan' AND frameworkcode=''");
$sth->execute;
my ($notforloan_authorised_value) = $sth->fetchrow;
## find column names of items related to MARC
my $sth2 = $dbh->prepare("SHOW COLUMNS FROM items");
$sth2->execute;
Expand Down Expand Up @@ -1171,15 +1175,18 @@ sub searchResults {
}

# item is withdrawn, lost or damaged
if ( $item->{wthdrawn} || $item->{itemlost} || $item->{damaged} ) {
if ( $item->{wthdrawn} || $item->{itemlost} || $item->{damaged} || $item->{notforloan} ) {
$wthdrawn_count++ if $item->{wthdrawn};
$itemlost_count++ if $item->{itemlost};
$itemdamaged_count++ if $item->{damaged};
$item->{status} = $item->{wthdrawn}."-".$item->{itemlost}."-".$item->{damaged};
$item->{status} = $item->{wthdrawn}."-".$item->{itemlost}."-".$item->{damaged}."-".$item->{notforloan};
$other_count++;

$other_items->{ $item->{'homebranch'}.'--'.$item->{location}.$item->{'itemcallnumber'}.$item->{status} }->{wthdrawn} = $item->{wthdrawn};
$other_items->{ $item->{'homebranch'}.'--'.$item->{location}.$item->{'itemcallnumber'}.$item->{status} }->{itemlost} = $item->{itemlost};
$other_items->{ $item->{'homebranch'}.'--'.$item->{location}.$item->{'itemcallnumber'}.$item->{status} }->{damaged} = $item->{damaged};
$other_items->{ $item->{'homebranch'}.'--'.$item->{location}.$item->{'itemcallnumber'}.$item->{status} }->{notforloan} = GetAuthorisedValueDesc('','',$item->{notforloan},'','',$notforloan_authorised_value) if $notforloan_authorised_value;

$other_items->{ $item->{'homebranch'}.'--'.$item->{location}.$item->{'itemcallnumber'}.$item->{status} }->{count}++ if $item->{'homebranch'};
$other_items->{ $item->{'homebranch'}.'--'.$item->{location}.$item->{'itemcallnumber'}.$item->{status} }->{branchname} = $item->{'branchname'};
$other_items->{ $item->{'homebranch'}.'--'.$item->{location}.$item->{'itemcallnumber'}.$item->{status} }->{location} = $locations{$item->{location}};
Expand Down
Expand Up @@ -341,6 +341,7 @@ $(window).load(function() {
<!-- TMPL_IF NAME="wthdrawn" -->(Withdrawn)<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="itemlost" -->(Lost)<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="damaged" -->(Damaged)<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="notforloan" --><!-- TMPL_VAR name="notforloan" --><!-- /TMPL_IF -->
(<!-- TMPL_VAR NAME="count" -->)</li>
<!-- /TMPL_LOOP --></ul>
<!-- /TMPL_IF -->
Expand Down

0 comments on commit a553ea8

Please sign in to comment.