[Koha-cvs] CVS: koha/acqui newbasket2.pl,1.8,1.9

Paul POULAIN tipaul at users.sourceforge.net
Tue Jan 28 16:01:52 CET 2003


Update of /cvsroot/koha/koha/acqui
In directory sc8-pr-cvs1:/tmp/cvs-serv8772a/acqui

Modified Files:
	newbasket2.pl 
Log Message:
Now uses get_template_and_user, and non iso-5589-1 code from Ambrose

Index: newbasket2.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui/newbasket2.pl,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** newbasket2.pl	4 Nov 2002 09:31:21 -0000	1.8
--- newbasket2.pl	28 Jan 2003 15:01:42 -0000	1.9
***************
*** 28,31 ****
--- 28,33 ----
  use C4::Biblio;
  use HTML::Template;
+ use C4::Auth;
+ use C4::Charset;
  
  my $env;
***************
*** 75,103 ****
  #print $sub;
  my ($count, at booksellers)=bookseller($id);
  
! my $template = gettemplate("acqui/newbasket2.tmpl");
  #print startpage();
  #print startmenu('acquisitions');
  
  my $testdonation = ($donation ne 'yes'); #tests if donation = true
! 
!     if ($keyword ne ''){
!       ($count, at results)=KeywordSearch(undef,'intra',\%search,$num,$offset);
!     } elsif ($search{'front'} ne '') {
!     ($count, at results)=FrontSearch(undef,'intra',\%search,$num,$offset);
!     }else {
!       ($count, at results)=CatSearch(undef,'loose',\%search,$num,$offset);
!     }
  
  my @loopsearch;
  
  while ( my ($key, $value) = each %search) {
!   if ($value ne ''){
! 	my %linesearch;
! 	$value=~ s/\\//g;
! 	$linesearch{key}=$key;
! 	$linesearch{value}=$value;
! 	push(@loopsearch,\%linesearch);
!   }
  }
  
--- 77,112 ----
  #print $sub;
  my ($count, at booksellers)=bookseller($id);
+ my ($template, $loggedinuser, $cookie)
+     = get_template_and_user({template_name => "acqui/newbasket2.tmpl",
+ 			     query => $input,
+ 			     type => "intranet",
+ 			     authnotrequired => 0,
+ 			     flagsrequired => {superlibrarian => 1},
+ 			     debug => 1,
+ 			     });
  
! #my $template = gettemplate("acqui/newbasket2.tmpl");
  #print startpage();
  #print startmenu('acquisitions');
  
  my $testdonation = ($donation ne 'yes'); #tests if donation = true
! if ($keyword ne ''){
! 	($count, at results)=KeywordSearch(undef,'intra',\%search,$num,$offset);
! } elsif ($search{'front'} ne '') {
! 	($count, at results)=FrontSearch(undef,'intra',\%search,$num,$offset);
! }else {
! 	($count, at results)=CatSearch(undef,'loose',\%search,$num,$offset);
! }
  
  my @loopsearch;
  
  while ( my ($key, $value) = each %search) {
! 	if ($value ne ''){
! 		my %linesearch;
! 		$value=~ s/\\//g;
! 		$linesearch{key}=$key;
! 		$linesearch{value}=$value;
! 		push(@loopsearch,\%linesearch);
! 	}
  }
  
***************
*** 111,120 ****
  my $count2=@results;
  if ($keyword ne '' && $offset > 0){
!   $count2=$count-$offset;
!   if ($count2 > 10){
!     $count2=10;
!   }
  }
- #print $count2;
  my $i=0;
  my $colour=0;
--- 120,128 ----
  my $count2=@results;
  if ($keyword ne '' && $offset > 0){
! 	$count2=$count-$offset;
! 	if ($count2 > 10){
! 		$count2=10;
! 	}
  }
  my $i=0;
  my $colour=0;
***************
*** 123,212 ****
  
  while ($i < $count2){
! #    print $results[$i]."\n";
! #    my @stuff=split('\t',$results[$i]);
! 
! 	my %lineres;
! 	my $coltab;
  
!     my $result=$results[$i];
!     $result->{'title'}=~ s/\`/\\\'/g;
!     my $title2=$result->{'title'};
!     my $author2=$result->{'author'};
!     $author2=~ s/ /%20/g;
!     $title2=~ s/ /%20/g;
!     $title2=~ s/\#/\&\#x23;/g;
!     $title2=~ s/\"/\&quot\;/g;
! 
! 	my $itemcount;
!     my $location='';
!     my $word=$result->{'author'};
!       $word=~ s/([a-z]) +([a-z])/$1%20$2/ig;
!       $word=~ s/  //g;
!       $word=~ s/ /%20/g;
!       $word=~ s/\,/\,%20/g;
!       $word=~ s/\n//g;
! 	  $lineres{word}=$word;
! 	  $lineres{type}=$type;
! 
!       my ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit)=C4::Search::itemcount($env,$result->{'biblionumber'},$type);
!       if ($nacount > 0){
!         $location .= "On Loan";
! 	if ($nacount >1 ){
! 	  $location .= " ($nacount)";
!          }
! 	 $location.=" ";
!       }
!       if ($lcount > 0){
!          $location .= "Levin";
!          if ($lcount >1 ){
! 	  $location .= " ($lcount)";
!          }
! 	 $location.=" ";
!       }
!       if ($fcount > 0){
!         $location .= "Foxton";
!          if ($fcount >1 ){
! 	  $location .= " ($fcount)";
!          }
! 	 $location.=" ";
!       }
!       if ($scount > 0){
!         $location .= "Shannon";
!          if ($scount >1 ){
! 	  $location .= " ($scount)";
!          }
! 	 $location.=" ";
!       }
!       if ($lostcount > 0){
!         $location .= "Lost";
!          if ($lostcount >1 ){
! 	  $location .= " ($lostcount)";
!          }
! 	 $location.=" ";
!       }
!       if ($mending > 0){
!         $location .= "Mending";
!          if ($mending >1 ){
! 	  $location .= " ($mending)";
!          }
! 	 $location.=" ";
!       }
!       if ($transit > 0){
!         $location .= "In Transit";
!          if ($transit >1 ){
! 	  $location .= " ($transit)";
!          }
! 	 $location.=" ";
!       }
! 	if ($colour == 1){
! 		$coltab=$secondary;
! 		$colour=0;
!     } else{
! 		$coltab=$main;
! 		$colour=1;
!     }
!     $lineres{author2}=$author2;
!     $lineres{title2}=$title2;
!     $lineres{copyright}=$result->{'copyrightdate'};
  	$lineres{id}=$id;
  	$lineres{basket}=$basket;
--- 131,217 ----
  
  while ($i < $count2){
! 		my %lineres;
! 		my $coltab;
  
! 	my $result=$results[$i];
! 	$result->{'title'}=~ s/\`/\\\'/g;
! 	my $title2=$result->{'title'};
! 	my $author2=$result->{'author'};
! 	$author2=~ s/ /%20/g;
! 	$title2=~ s/ /%20/g;
! 	$title2=~ s/\#/\&\#x23;/g;
! 	$title2=~ s/\"/\&quot\;/g;
! 
! 		my $itemcount;
! 	my $location='';
! 	my $word=$result->{'author'};
! 		$word=~ s/([a-z]) +([a-z])/$1%20$2/ig;
! 		$word=~ s/  //g;
! 		$word=~ s/ /%20/g;
! 		$word=~ s/\,/\,%20/g;
! 		$word=~ s/\n//g;
! 		$lineres{word}=$word;
! 		$lineres{type}=$type;
! 
! 		my ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit)=C4::Search::itemcount($env,$result->{'biblionumber'},$type);
! 		if ($nacount > 0){
! 			$location .= "On Loan";
! 			if ($nacount >1 ){
! 				$location .= " ($nacount)";
! 			}
! 			$location.=" ";
! 		}
! 		if ($lcount > 0){
! 			$location .= "Levin";
! 			if ($lcount >1 ){
! 				$location .= " ($lcount)";
! 			}
! 			$location.=" ";
! 		}
! 		if ($fcount > 0){
! 			$location .= "Foxton";
! 			if ($fcount >1 ){
! 				$location .= " ($fcount)";
! 			}
! 			$location.=" ";
! 		}
! 		if ($scount > 0){
! 			$location .= "Shannon";
! 			if ($scount >1 ){
! 				$location .= " ($scount)";
! 			}
! 			$location.=" ";
! 		}
! 		if ($lostcount > 0){
! 			$location .= "Lost";
! 			if ($lostcount >1 ){
! 				$location .= " ($lostcount)";
! 			}
! 			$location.=" ";
! 		}
! 		if ($mending > 0){
! 			$location .= "Mending";
! 			if ($mending >1 ){
! 				$location .= " ($mending)";
! 			}
! 			$location.=" ";
! 		}
! 		if ($transit > 0){
! 			$location .= "In Transit";
! 			if ($transit >1 ){
! 				$location .= " ($transit)";
! 			}
! 			$location.=" ";
! 		}
! 		if ($colour == 1){
! 			$coltab=$secondary;
! 			$colour=0;
! 	} else{
! 			$coltab=$main;
! 			$colour=1;
! 	}
! 	$lineres{author2}=$author2;
! 	$lineres{title2}=$title2;
! 	$lineres{copyright}=$result->{'copyrightdate'};
  	$lineres{id}=$id;
  	$lineres{basket}=$basket;
***************
*** 214,230 ****
  	$lineres{biblionumber}=$result->{biblionumber};
  	$lineres{title}=$result->{title};
!     $lineres{author}=$result->{author};
  	$lineres{coltab}=$coltab;
  	$lineres{itemcount}=$count;
  	$lineres{location}=$location;
  	push(@loopresult,\%lineres);
!     $i++;
  }
  
  $offset=$num+$offset;
- 
- #print mktablerow(6,$main,' &nbsp; ',' &nbsp; ',' &nbsp;',' &nbsp;','','','/images/background-mem.gif');
- 
- #print mktableft();
  $template->param(	bookselname => $booksellers[0]->{'name'},
  								id => $id,
--- 219,231 ----
  	$lineres{biblionumber}=$result->{biblionumber};
  	$lineres{title}=$result->{title};
! 	$lineres{author}=$result->{author};
  	$lineres{coltab}=$coltab;
  	$lineres{itemcount}=$count;
  	$lineres{location}=$location;
  	push(@loopresult,\%lineres);
! 	$i++;
  }
  
  $offset=$num+$offset;
  $template->param(	bookselname => $booksellers[0]->{'name'},
  								id => $id,
***************
*** 246,249 ****
  								loopresult =>\@loopresult);
  
! 
! print "Content-Type: text/html\n\n", $template->output;
--- 247,252 ----
  								loopresult =>\@loopresult);
  
! print $input->header(
! -type => guesstype($template->output),
! -cookie => $cookie
! ),$template->output;





More information about the Koha-cvs mailing list