[Koha-cvs] CVS: koha/C4 SearchMarc.pm,1.36.2.4,1.36.2.5 Search.pm,1.99.2.3,1.99.2.4

Paul POULAIN tipaul at users.sourceforge.net
Mon Feb 28 15:25:22 CET 2005


Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22701/C4

Modified Files:
      Tag: rel_2_2
	SearchMarc.pm Search.pm 
Log Message:
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)


Index: SearchMarc.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/SearchMarc.pm,v
retrieving revision 1.36.2.4
retrieving revision 1.36.2.5
diff -C2 -r1.36.2.4 -r1.36.2.5
*** SearchMarc.pm	24 Feb 2005 13:52:33 -0000	1.36.2.4
--- SearchMarc.pm	28 Feb 2005 14:25:19 -0000	1.36.2.5
***************
*** 196,200 ****
  # 		$_=~ s/\,/ /g;
  # 	}
! 	
  	for(my $i = 0 ; $i <= $#{$value} ; $i++)
  	{
--- 196,214 ----
  # 		$_=~ 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++)
  	{
***************
*** 375,378 ****
--- 389,393 ----
  			$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;
***************
*** 383,386 ****
--- 398,408 ----
  		%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;

Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.99.2.3
retrieving revision 1.99.2.4
diff -C2 -r1.99.2.3 -r1.99.2.4
*** Search.pm	17 Feb 2005 12:46:41 -0000	1.99.2.3
--- Search.pm	28 Feb 2005 14:25:19 -0000	1.99.2.4
***************
*** 1318,1324 ****
  	while (my $data=$sth->fetchrow_hashref){
  		my $datedue = '';
! 		my $isth=$dbh->prepare("Select * from issues where itemnumber = ? and returndate is null");
  		$isth->execute($data->{'itemnumber'});
  		if (my $idata=$isth->fetchrow_hashref){
  		$datedue = format_date($idata->{'date_due'});
  		}
--- 1318,1326 ----
  	while (my $data=$sth->fetchrow_hashref){
  		my $datedue = '';
! 		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'});
  		}
***************
*** 1346,1356 ****
  			$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;
  		$results[$i]=$data;
  		$i++;
--- 1348,1364 ----
  			$data->{'branchname'} = $bdata->{'branchname'};
  		}
  		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++;





More information about the Koha-cvs mailing list