Remove unused $toggle code

Some trivial other cleanups also.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
Joe Atzberger 2009-04-30 12:15:12 -05:00 committed by Galen Charlton
parent 7c5ab1411b
commit 7a8e256263

View file

@ -33,8 +33,7 @@ use ZOOM;
my $input = new CGI; my $input = new CGI;
my $dbh = C4::Context->dbh; my $dbh = C4::Context->dbh;
my $error = $input->param('error'); my $error = $input->param('error');
my $biblionumber = $input->param('biblionumber'); my $biblionumber = $input->param('biblionumber') || 0;
$biblionumber = 0 unless $biblionumber;
my $frameworkcode = $input->param('frameworkcode'); my $frameworkcode = $input->param('frameworkcode');
my $title = $input->param('title'); my $title = $input->param('title');
my $author = $input->param('author'); my $author = $input->param('author');
@ -43,9 +42,8 @@ my $issn = $input->param('issn');
my $lccn = $input->param('lccn'); my $lccn = $input->param('lccn');
my $subject = $input->param('subject'); my $subject = $input->param('subject');
my $dewey = $input->param('dewey'); my $dewey = $input->param('dewey');
my $random = $input->param('random'); my $random = $input->param('random') || rand(1000000000); # this var is not useful anymore just kept for rel2_2 compatibility
my $op = $input->param('op'); my $op = $input->param('op');
my $noconnection;
my $numberpending; my $numberpending;
my $attr = ''; my $attr = '';
my $term; my $term;
@ -57,7 +55,6 @@ my $marcdata;
my @encoding; my @encoding;
my @results; my @results;
my $count; my $count;
my $toggle;
my $record; my $record;
my $oldbiblio; my $oldbiblio;
my $errmsg; my $errmsg;
@ -68,21 +65,14 @@ my @breeding_loop = ();
my $DEBUG = 0; # if set to 1, many debug message are send on syslog. my $DEBUG = 0; # if set to 1, many debug message are send on syslog.
unless ($random) my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
{ # this var is not useful anymore just kept to keep rel2_2 compatibility
$random = rand(1000000000);
}
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "cataloguing/z3950_search.tmpl", template_name => "cataloguing/z3950_search.tmpl",
query => $input, query => $input,
type => "intranet", type => "intranet",
authnotrequired => 1, authnotrequired => 1,
flagsrequired => { catalogue => 1 }, flagsrequired => { catalogue => 1 },
debug => 1, debug => 1,
} });
);
$template->param( frameworkcode => $frameworkcode, ); $template->param( frameworkcode => $frameworkcode, );
@ -149,14 +139,12 @@ warn "query ".$query if $DEBUG;
$sth->execute($servid); $sth->execute($servid);
while ( $server = $sth->fetchrow_hashref ) { while ( $server = $sth->fetchrow_hashref ) {
warn "serverinfo ".join(':',%$server) if $DEBUG; warn "serverinfo ".join(':',%$server) if $DEBUG;
my $noconnection = 0;
my $option1 = new ZOOM::Options(); my $option1 = new ZOOM::Options();
$option1->option('async' => 1); $option1->option('async' => 1);
$option1->option('elementSetName', 'F'); $option1->option('elementSetName', 'F');
$option1->option('databaseName', $server->{db}); $option1->option('databaseName', $server->{db});
$option1->option('user', $server->{userid} ) if $server->{userid}; $option1->option('user', $server->{userid} ) if $server->{userid};
$option1->option( 'password', $server->{password} ) $option1->option('password', $server->{password}) if $server->{password};
if $server->{password};
$option1->option('preferredRecordSyntax', $server->{syntax}); $option1->option('preferredRecordSyntax', $server->{syntax});
$oConnection[$s] = create ZOOM::Connection($option1) $oConnection[$s] = create ZOOM::Connection($option1)
|| $DEBUG || $DEBUG
@ -203,21 +191,14 @@ warn "query ".$query if $DEBUG;
if ($error =~ m/^(10000|10007)$/ ) { if ($error =~ m/^(10000|10007)$/ ) {
push(@errconn, {'server' => $serverhost[$k]}); push(@errconn, {'server' => $serverhost[$k]});
} }
warn "$k $serverhost[$k] error $query: $errmsg ($error) $addinfo\n" $DEBUG and warn "$k $serverhost[$k] error $query: $errmsg ($error) $addinfo\n";
if $DEBUG;
} }
else { else {
my $numresults = $oResult[$k]->size(); my $numresults = $oResult[$k]->size();
my $i; my $i;
my $result = ''; my $result = '';
if ( $numresults > 0 ) { if ( $numresults > 0 ) {
for ( for ($i = 0; $i < (($numresults < 20) ? $numresults : 20); $i++) {
$i = 0 ;
$i < ( ( $numresults < 20 ) ? ($numresults) : (20) ) ;
$i++
)
{
my $rec = $oResult[$k]->record($i); my $rec = $oResult[$k]->record($i);
if ($rec) { if ($rec) {
my $marcrecord; my $marcrecord;
@ -239,13 +220,7 @@ warn "query ".$query if $DEBUG;
) )
= ImportBreeding( $marcdata, 2, $serverhost[$k], $encoding[$k], $random, 'z3950' ); = ImportBreeding( $marcdata, 2, $serverhost[$k], $encoding[$k], $random, 'z3950' );
my %row_data; my %row_data;
if ( $i % 2 ) { $row_data{toggle} = ($i % 2) ? 1 : 0;
$toggle = 1;
}
else {
$toggle = 0;
}
$row_data{toggle} = $toggle;
$row_data{server} = $servername[$k]; $row_data{server} = $servername[$k];
$row_data{isbn} = $oldbiblio->{isbn}; $row_data{isbn} = $oldbiblio->{isbn};
$row_data{lccn} = $oldbiblio->{lccn}; $row_data{lccn} = $oldbiblio->{lccn};
@ -256,9 +231,9 @@ warn "query ".$query if $DEBUG;
push( @breeding_loop, \%row_data ); push( @breeding_loop, \%row_data );
} else { } else {
push(@breeding_loop,{'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1,'biblionumber'=>-1}); push(@breeding_loop,{'toggle'=>($i % 2)?1:0,'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1,'biblionumber'=>-1});
} # $rec } # $rec
} # upto 20 results }
} #$numresults } #$numresults
} }
} # if $k !=0 } # if $k !=0