[Koha-cvs] koha/C4 SearchMarc.pm [rel_2_2]

Joshua Ferraro jmf at kados.org
Fri Jul 7 23:10:13 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_2_2
Changes by:	Joshua Ferraro <kados>	06/07/07 21:10:13

Modified files:
	C4             : SearchMarc.pm 

Log message:
	several code cleanups. Adds support for hiding lost items in OPAC and
	also hide notforloan items from the OPAC.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/SearchMarc.pm?cvsroot=koha&only_with_tag=rel_2_2&r1=1.36.2.29&r2=1.36.2.30

Patches:
Index: SearchMarc.pm
===================================================================
RCS file: /sources/koha/koha/C4/SearchMarc.pm,v
retrieving revision 1.36.2.29
retrieving revision 1.36.2.30
diff -u -b -r1.36.2.29 -r1.36.2.30
--- SearchMarc.pm	13 Jun 2006 09:36:51 -0000	1.36.2.29
+++ SearchMarc.pm	7 Jul 2006 21:10:13 -0000	1.36.2.30
@@ -177,10 +177,6 @@
 	#		where m1.bibid=m2.bibid and
 	#		(m1.subfieldvalue like "Des%" and m2.subfieldvalue like "27%")
 
-	# last minute stripping out of stuff
-	# doesn't work @$value =~ s/\'/ /;
-	# @$value = map { $_ =~ s/\'/ /g } @$value;
-	
 	# "Normal" statements
 	my @normal_tags = ();
 	my @normal_and_or = ();
@@ -194,16 +190,10 @@
 	my $any_not = 0;
 	$orderby = "biblio.title" unless $orderby;
 	$desc_or_asc = "ASC" unless $desc_or_asc;
-	#last minute stripping out of ' and ,
-# paul : quoting, it's done a few lines lated.
-# 	foreach $_ (@$value) {
-# 		$_=~ 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
+
+	# 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;
@@ -215,8 +205,7 @@
 			$notforloanstatus{$authorised_value} = $lib?$lib:$authorised_value;
 		}
 	}
-	for(my $i = 0 ; $i <= $#{$value} ; $i++)
-	{
+	for(my $i = 0 ; $i <= $#{$value} ; $i++) {
 		# replace * by %
 		@$value[$i] =~ s/\*/%/g;
 		# remove % at the beginning
@@ -346,10 +335,6 @@
 # sort by it ...
 # or maybe you just quer marc_subfield_table in the origiinal query.
 #
-#
-#
-#
-#
         if ($orderby eq "biblio.title") {    #don't sort by title if another orderby is specified
         		my ($tag,$subfieldcode) = MARCfind_marc_from_kohafield($dbh,'biblio.title','');
                 my $tsth = $dbh->prepare("SELECT title, tag_indicator FROM marc_biblio, marc_subfield_table, biblio
@@ -407,11 +392,12 @@
 	my $oldline;
 	my ($oldbibid, $oldauthor, $oldtitle);
 	my $sth_itemCN;
-	if (C4::Context->preference('hidelostitem')) {
+	if (C4::Context->preference('hidelostitems')) {
 		$sth_itemCN = $dbh->prepare("
-  SELECT items.holdingbranch, items.location, items.itemcallnumber, count(*) AS cnt 
+  SELECT items.holdingbranch, items.location, items.itemcallnumber, count(*) AS cnt, items.itemnumber, items.notforloan
   FROM items 
-  WHERE biblionumber=? AND (itemlost = 0 OR itemlost IS NULL) 
+  WHERE biblionumber=? AND (itemlost = 0 OR itemlost IS NULL) AND (notforloan = 0 OR notforloan IS NULL)
+  GROUP BY items.holdingbranch, items.location, items.itemcallnumber
   ORDER BY homebranch");
 	} else {
 		$sth_itemCN = $dbh->prepare("





More information about the Koha-cvs mailing list