[Koha-cvs] CVS: koha/acqui.simple isbnsearch.pl,1.10,1.11

Paul POULAIN tipaul at users.sourceforge.net
Wed Mar 19 22:01:12 CET 2003


Update of /cvsroot/koha/koha/acqui.simple
In directory sc8-pr-cvs1:/tmp/cvs-serv12799/acqui.simple

Modified Files:
	isbnsearch.pl 
Log Message:
fixing bug when a search gets more than 10 biblios : now, user can reach biblio 10, 20, 30...

Index: isbnsearch.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/isbnsearch.pl,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** isbnsearch.pl	2 Feb 2003 07:18:38 -0000	1.10
--- isbnsearch.pl	19 Mar 2003 21:01:04 -0000	1.11
***************
*** 38,52 ****
  my $count;
  my @results;
- my ($template, $loggedinuser, $cookie)
-     = get_template_and_user({template_name => "acqui.simple/isbnsearch.tmpl",
- 			     query => $input,
- 			     type => "intranet",
- 			     authnotrequired => 0,
- 			     flagsrequired => {catalogue => 1},
- 			     debug => 1,
- 			     });
  if (! $isbn && !$title) {
  	print $input->redirect('addbooks.pl');
  } else {
  	# fill with books in ACTIVE DB (biblio)
  	if (! $offset) {
--- 38,52 ----
  my $count;
  my @results;
  if (! $isbn && !$title) {
  	print $input->redirect('addbooks.pl');
  } else {
+ 	my ($template, $loggedinuser, $cookie)
+ 	= get_template_and_user({template_name => "acqui.simple/isbnsearch.tmpl",
+ 					query => $input,
+ 					type => "intranet",
+ 					authnotrequired => 0,
+ 					flagsrequired => {catalogue => 1},
+ 					debug => 1,
+ 					});
  	# fill with books in ACTIVE DB (biblio)
  	if (! $offset) {
***************
*** 79,90 ****
  		push(@loop_data, \%row_data);
  	}
! 	my @loop_links = ();
! 	for (my $i = 0; ($i * $num) < $count; $i++) {
! 		my %row_data;
! 		$row_data{newoffset} = $i * $num;
! 		$row_data{shownumber} = $i + 1;
! 		$row_data{num} = $num;
! 		push (@loop_links,\%row_data);
! 	} # for
  	# fill with books in breeding farm
  	($count, @results) = breedingsearch($title,$isbn);
--- 79,113 ----
  		push(@loop_data, \%row_data);
  	}
! 	$template->param(startfrom => $offset+1);
! 	($offset+$num<=$count) ? ($template->param(endat => $offset+$num)) : ($template->param(endat => $count));
! 	$template->param(numrecords => $count);
! 	my $nextstartfrom=($offset+$num<$count) ? ($offset+$num) : (-1);
! 	my $prevstartfrom=($offset-$num>=0) ? ($offset-$num) : (-1);
! 	$template->param(nextstartfrom => $nextstartfrom);
! 	my $displaynext=1;
! 	my $displayprev=0;
! 	($nextstartfrom==-1) ? ($displaynext=0) : ($displaynext=1);
! 	($prevstartfrom==-1) ? ($displayprev=0) : ($displayprev=1);
! 	$template->param(displaynext => $displaynext);
! 	$template->param(displayprev => $displayprev);
! 	my @numbers = ();
! 	my $term;
! 	my $value;
! 	if ($isbn) {
! 		$term = "isbn";
! 		$value=$isbn;
! 	} else {
! 		$term ="title";
! 		$value=$title;
! 	}
! 	if ($count>10) {
! 		for (my $i=1; $i<$count/10+1; $i++) {
! 			if ($i<16) {
! 				my $highlight=0;
! 				($offset==($i-1)*10) && ($highlight=1);
! 				push @numbers, { number => $i, highlight => $highlight , term => $term, value => $value, startfrom => ($i-1)*10};
! 			}
! 		}
! 	}
  	# fill with books in breeding farm
  	($count, @results) = breedingsearch($title,$isbn);
***************
*** 92,95 ****
--- 115,124 ----
  	for (my $i=0; $i <= $#results; $i++) {
  		my %row_data;
+ 		if ($i % 2) {
+ 			$toggle="#ffffcc";
+ 	  	} else {
+ 			$toggle="white";
+ 	  	}
+ 		$row_data{toggle} = $toggle;
  		$row_data{id} = $results[$i]->{'id'};
  		$row_data{isbn} = $results[$i]->{'isbn'};
***************
*** 100,103 ****
--- 129,133 ----
  	}
  	$template->param(isbn => $isbn,
+ 							title => $title,
  							showoffset => $showoffset,
  							total => $total,
***************
*** 105,109 ****
  							loop => \@loop_data,
  							breeding_loop => \@breeding_loop,
! 							loop_links => \@loop_links);
  
  	print $input->header(
--- 135,142 ----
  							loop => \@loop_data,
  							breeding_loop => \@breeding_loop,
! 							numbers => \@numbers,
! 							term => $term,
! 							value => $value,
! 							);
  
  	print $input->header(





More information about the Koha-cvs mailing list