This patch changes all $foo eq undef's to !defined($foo). It also makes misc/spellcheck_suggest/build_spellcheck_suggest.pl have proper syntax.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
}
}
- if ( ref($record) eq undef ) {
+ if ( !defined(ref($record)) ) {
return -1;
}
else {
$rand[$randnum] = shift(@array);
while (1) {
my $randnum = int(rand($seed));
- if ($rand[$randnum] eq undef) {
+ if (!defined($rand[$randnum])) {
$rand[$randnum] = shift(@array);
}
last if ($#array == -1);
# and uncomment the one after it, adding your site info (check out GRANT
# syntax in the mysql manual if you're unsure how enable authentication)
#
-my dbh2 = C4::Context->dbh;
+my $dbh2 = C4::Context->dbh;
#
#my $dbh2=DBI->connect("DBI:mysql:<add your database name here>:localhost","<add your mysql user here>","<add your password here>");
########################################################################
print "Step 1 of 5: Checking to make sure suggest tables exist\n";
my $check_tables_query = "select distinct resultcount from ?";
my @tables = ("notdistinctspchk", "notdistinctsugg", "spellcheck", "suggestions");
-my %tables = ( notdistinctspchk => "( display varchar(40) not null default,
- suggestion varchar(40) not null default,
foreach my $table (@tables) {
my $sth_check=$dbh2->prepare($check_tables_query) || die "cant prepare query: $DBI::errstr";
my $rv = $sth_check->execute($table);
- if($rv eq undef) {
+ if(!defined($rv)) {
print "$table missing ... creating it now\n";
my $create_this = "CREATE TABLE \'$table\' \(
display varchar\(40\) NOT NULL default \'\',
while ( my ( $row, $col, $value ) = $dbcalc->fetchrow ) {
next if ($row eq undef || $col eq undef);
#warn "filling table $row / $col / $value ";
- $emptycol = 1 if ( $col eq undef );
- $col = "zzEMPTY" if ( $col eq undef );
- $row = "zzEMPTY" if ( $row eq undef );
+ $emptycol = 1 if ( !defined($col) );
+ $col = "zzEMPTY" if ( !defined($col) );
+ $row = "zzEMPTY" if ( !defined($row) );
$table{$row}->{$col} += $value;
$table{$row}->{totalrow} += $value;
# )
while (my @data = $dbcalc->fetchrow) {
my ($row, $rank, $id, $col) = @data;
- $col = "zzEMPTY" if ($col eq undef);
+ $col = "zzEMPTY" if (!defined($col));
unless ($patrons{$id}) {
$patrons{$id} = {name=>$row, allcols=>{}, newcols=>{}, oldcols=>{}};
}
$debug and print DEBUG "rows: ", $dbcalc->rows, "\n";
while (my @data = $dbcalc->fetchrow) {
my ($row, $rank, $id, $col) = @data;
- $col = "zzEMPTY" if ($col eq undef);
+ $col = "zzEMPTY" if (!defined($col));
unless ($patrons{$id}) {
$patrons{$id} = {name=>$row, allcols=>{}, newcols=>{}, oldcols=>{}};
}
$i=1;
while (my @data = $dbcalc->fetchrow) {
my ($row, $col )=@data;
- $col = "zzEMPTY" if ($col eq undef);
+ $col = "zzEMPTY" if (!defined($col));
$i=1 if (($previous_col) and not($col eq $previous_col));
$table[$i]->{$col}=$row;
# warn " $i $col $row";
my $emptycol;
while (my ($row, $col, $value) = $dbcalc->fetchrow) {
# warn "filling table $row / $col / $value ";
- $emptycol = 1 if ($col eq undef);
- $col = "zzEMPTY" if ($col eq undef);
- $row = "zzEMPTY" if ($row eq undef);
+ $emptycol = 1 if (!defined($col));
+ $col = "zzEMPTY" if (!defined($col));
+ $row = "zzEMPTY" if (!defined($row));
$table{$row}->{$col}+=$value;
$table{$row}->{totalrow}+=$value;
my %indice;
while (my @data = $dbcalc->fetchrow) {
my ($row, $rank, $id, $col )=@data;
- $col = "zzEMPTY" if ($col eq undef);
+ $col = "zzEMPTY" if (!defined($col));
$indice{$col}=1 if (not($indice{$col}));
$table[$indice{$col}]->{$col}->{'name'}=$row;
$table[$indice{$col}]->{$col}->{'count'}=$rank;
my $emptycol;
while (my ($row, $col, $value) = $dbcalc->fetchrow) {
# warn "filling table $row / $col / $value ";
- $emptycol = 1 if ($col eq undef);
- $col = "zzEMPTY" if ($col eq undef);
- $row = "zzEMPTY" if ($row eq undef);
+ $emptycol = 1 if (!defined($col));
+ $col = "zzEMPTY" if (!defined($col));
+ $row = "zzEMPTY" if (!defined($row));
$table{$row}->{$col}+=$value;
$table{$row}->{totalrow}+=$value;
while (my @data = $dbcalc->fetchrow) {
my ($row, $col, $issuedate, $returndate, $weight)=@data;
# warn "filling table $row / $col / $issuedate / $returndate /$weight";
- $emptycol=1 if ($col eq undef);
- $col = "zzEMPTY" if ($col eq undef);
- $row = "zzEMPTY" if ($row eq undef);
+ $emptycol=1 if (!defined($col));
+ $col = "zzEMPTY" if (!defined($col));
+ $row = "zzEMPTY" if (!defined($row));
# fill returndate to avoid an error with date calc (needed for all non returned issues)
$returndate= join '-',Date::Calc::Today if $returndate eq '0000-00-00';
# DateCalc returns => 0:0:WK:DD:HH:MM:SS the weeks, days, hours, minutes,