Changeset 521


Ignore:
Timestamp:
10/19/12 16:38:06 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Patch up search.cgi so that it at least provides results and doesn't
spew errors all over the place. See #31, #4 (sort of).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/search.cgi

    r520 r521  
    146146  my $cols = "cidr,custid,type,city,description";
    147147
     148  # hack fix for undefined variables
     149  $webvar{custid} = '' if !$webvar{custid};
     150  $webvar{desc}   = '' if !$webvar{desc};
     151  $webvar{notes}  = '' if !$webvar{notes};
     152  $webvar{custexclude}  = '' if !$webvar{custexclude};
     153  $webvar{descexclude}  = '' if !$webvar{descexclude};
     154  $webvar{notesexclude} = '' if !$webvar{notesexclude};
     155
    148156  # First chunk of SQL.  Filter on custid, description, and notes as necessary.
    149   my $sql = "(select $cols from searchme where".
    150         " $webvar{custexclude} (custid ilike '%$webvar{custid}%'".
    151         " $sqlconcat (select $cols from searchme where $webvar{descexclude} description ilike '%$webvar{desc}%')".
    152         " $sqlconcat (select $cols from searchme where $webvar{notesexclude} notes ilike '%$webvar{notes}%')";
     157  my $sql = qq(SELECT $cols FROM searchme\n);
     158  $sql .= " WHERE $webvar{custexclude} (custid ~ '$webvar{custid}')\n";
     159  $sql .= " $sqlconcat (select $cols from searchme where $webvar{descexclude} description ~ '$webvar{desc}')\n";
     160  $sql .= " $sqlconcat (select $cols from searchme where $webvar{notesexclude} notes ~ '$webvar{notes}')";
    153161
    154162  # If we're not supposed to search for all types, search for the selected types.
Note: See TracChangeset for help on using the changeset viewer.