item status (opac & librarian interfaces) The item status has been improved : It now can be :

- on order (= item has been ordered, but not yet arrived at the library)
- not for loan : if the "notforloan" field is mapped to an authorised value list, the right value is shown. Thus, an item can be "lost" or "being repaired", or whatever you put in the authorised values list. (reminder : the "notforloan" field, when 0 means 'ok, book can be issued', and all other values means 'nok, book can't be issued' (whatever the reason, that can be in the authorised value table)
This commit is contained in:
tipaul 2005-02-28 14:25:19 +00:00
parent 8452baf22d
commit 9110e9edef
2 changed files with 36 additions and 6 deletions

View File

@ -1317,9 +1317,11 @@ sub ItemInfo {
my @results;
while (my $data=$sth->fetchrow_hashref){
my $datedue = '';
my $isth=$dbh->prepare("Select * from issues where itemnumber = ? and returndate is null");
my $isth=$dbh->prepare("Select issues.*,borrowers.cardnumber from issues,borrowers where itemnumber = ? and returndate is null and issues.borrowernumber=borrowers.borrowernumber");
$isth->execute($data->{'itemnumber'});
if (my $idata=$isth->fetchrow_hashref){
$data->{borrowernumber} = $idata->{borrowernumber};
$data->{cardnumber} = $idata->{cardnumber};
$datedue = format_date($idata->{'date_due'});
}
if ($data->{'itemlost'} eq '2'){
@ -1345,13 +1347,19 @@ sub ItemInfo {
if (my $bdata=$bsth->fetchrow_hashref){
$data->{'branchname'} = $bdata->{'branchname'};
}
# $results[$i]="$data->{'title'}\t$data->{'barcode'}\t$datedue\t$data->{'branchname'}\t$data->{'dewey'}";
# FIXME - If $data->{'datelastseen'} is NULL, perhaps it'd be prettier
# to leave it empty, rather than convert it to "//".
# Also ideally this should use the local format for displaying dates.
my $date=format_date($data->{'datelastseen'});
$data->{'datelastseen'}=$date;
$data->{'datedue'}=$datedue;
# get notforloan complete status if applicable
my $sthnflstatus = $dbh->prepare('select authorised_value from marc_subfield_structure where kohafield="items.notforloan"');
$sthnflstatus->execute;
my ($authorised_valuecode) = $sthnflstatus->fetchrow;
if ($authorised_valuecode) {
$sthnflstatus = $dbh->prepare("select lib from authorised_values where category=? and authorised_value=?");
$sthnflstatus->execute($authorised_valuecode,$data->{itemnotforloan});
my ($lib) = $sthnflstatus->fetchrow;
$data->{notforloan} = $lib;
}
$results[$i]=$data;
$i++;
}

View File

@ -195,7 +195,21 @@ sub catalogsearch {
# $_=~ s/\'/ /g;
# $_=~ s/\,/ /g;
# }
# the item.notforloan contains an integer. Every value <>0 means "book unavailable for loan".
# but each library can have it's own table of meaning for each value. Get them
# 1st search if there is a list of authorised values connected to items.notforloan
my $sth = $dbh->prepare('select authorised_value from marc_subfield_structure where kohafield="items.notforloan"');
$sth->execute;
my %notforloanstatus;
my ($authorised_valuecode) = $sth->fetchrow;
if ($authorised_valuecode) {
$sth = $dbh->prepare("select authorised_value,lib from authorised_values where category=?");
$sth->execute($authorised_valuecode);
while (my ($authorised_value,$lib) = $sth->fetchrow) {
$notforloanstatus{$authorised_value} = $lib?$lib:$authorised_value;
}
}
for(my $i = 0 ; $i <= $#{$value} ; $i++)
{
# replace * by %
@ -374,6 +388,7 @@ sub catalogsearch {
$lineCN{itemcallnumber} = $item->{itemcallnumber};
$lineCN{location} = $item->{location};
$lineCN{date_due} = format_date($date_due);
$lineCN{notforloan} = $notforloanstatus{$item->{notforloan}} if ($item->{notforloan});
$notforloan=0 unless ($item->{notforloan} or $item->{wthdrawn} or $item->{itemlost});
push @CNresults,\%lineCN;
$totalitems++;
@ -382,6 +397,13 @@ sub catalogsearch {
my %newline;
%newline = %$line;
$newline{totitem} = $totalitems;
# if $totalitems == 0, check if it's being ordered.
if ($totalitems == 0) {
my $sth = $dbh->prepare("select count(*) from aqorders where biblionumber=?");
$sth->execute($biblionumber);
my ($ordered) = $sth->fetchrow;
$newline{onorder} = 1 if $ordered;
}
$newline{biblionumber} = $biblionumber;
$newline{norequests} = 0;
$newline{norequests} = 1 if ($line->{notforloan}); # itemtype not issuable