Changeset 592


Ignore:
Timestamp:
May 14, 2013, 5:45:17 PM (8 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Merge /trunk changes up to r516

Location:
branches/stable
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/stable

  • branches/stable/cgi-bin/IPDB.pm

    r550 r592  
    321321  my $alloc_from = new NetAddr::IP $_[2];
    322322  my $sth;
     323
     324  $desc = '' if !$desc;
     325  $notes = '' if !$notes;
     326  $circid = '' if !$circid;
     327  $privdata = '' if !$privdata;
    323328
    324329  # Snag the "type" of the freeblock (alloc_from) "just in case"
     
    591596    # have to insert all pool IPs into poolips table as "unallocated".
    592597    $sth = $dbh->prepare("insert into poolips (pool,ip,custid,city,type)".
    593         " values ('$pool', ?, '$defcustid', '$city', '$type')");
     598        " values ('$pool', ?, '$defcustid', ?, '$type')");
    594599    my @poolip_list = $pool->hostenum;
    595600    if ($class eq 'all') { # (DSL-ish block - *all* IPs available
    596601      if ($pool->addr !~ /\.0$/) {      # .0 causes weirdness.
    597         $sth->execute($pool->addr);
     602        $sth->execute($pool->addr, $city);
    598603      }
    599604      for (my $i=0; $i<=$#poolip_list; $i++) {
    600         $sth->execute($poolip_list[$i]->addr);
     605        $sth->execute($poolip_list[$i]->addr, $city);
    601606      }
    602607      $pool--;
    603608      if ($pool->addr !~ /\.255$/) {    # .255 can cause weirdness.
    604         $sth->execute($pool->addr);
     609        $sth->execute($pool->addr, $city);
    605610      }
    606611    } else { # (real netblock)
    607612      for (my $i=1; $i<=$#poolip_list; $i++) {
    608         $sth->execute($poolip_list[$i]->addr);
     613        $sth->execute($poolip_list[$i]->addr, $city);
    609614      }
    610615    }
    611616  };
    612617  if ($@) {
    613     $msg = "'".$sth->errstr."'";
     618    $msg = $@." '".$sth->errstr."'";
    614619    eval { $dbh->rollback; };
    615620    return ('FAIL',$msg);
     
    847852  my ($action,$subj,$message) = @_;
    848853
    849   return if $domain eq 'example.com';   # no point being obnoxious if we're still stuck with defaults.
     854  return if $smtphost eq 'smtp.example.com';   # do nothing if still using default SMTP host.
    850855
    851856##fixme: need to redesign the breakdown/processing for $action for proper handling of all cases
  • branches/stable/cgi-bin/admin.cgi

    r507 r592  
    1717use DBI;
    1818use CommonWeb qw(:ALL);
    19 use CustIDCK;
    2019#use POSIX qw(ceil);
    2120use NetAddr::IP;
     
    2625##uselib##
    2726
     27use CustIDCK;
    2828use MyIPDB;
    2929
     
    254254        syslog "notice", "$authuser allocated '$webvar{cidr}' to '$webvar{custid}' as ".
    255255                "'$webvar{alloctype}'";
    256         mailNotify($ip_dbh, "a$webvar{alloctype}",
    257           "$disp_alloctypes{$webvar{alloctype}} $webvar{cidr} allocated to customer".
    258           " $webvar{custid}\n".
     256        mailNotify($ip_dbh, "a$webvar{alloctype}", "ADDED: $disp_alloctypes{$webvar{alloctype}} allocation",
     257          "$disp_alloctypes{$webvar{alloctype}} $webvar{cidr} allocated to customer $webvar{custid}\n".
    259258          "Description: $webvar{desc}\n\nAllocated by: $authuser\n");
    260259      }
  • branches/stable/cgi-bin/ipdb.psql

    r507 r592  
    4747        "pool" cidr DEFAULT '255.255.255.255/32' NOT NULL,
    4848        "ip" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY,
    49         "oldcustid" character varying(16) DEFAULT '' NOT NULL,
    5049        "city" character varying(30) DEFAULT '' NOT NULL,
    5150        "type" character(2) DEFAULT '' NOT NULL,
     
    6362CREATE TABLE "allocations" (
    6463        "cidr" cidr DEFAULT '255.255.255.255/32' NOT NULL PRIMARY KEY,
    65         "oldcustid" character varying(16) DEFAULT '',
    6664        "type" character(2) DEFAULT '',
    6765        "city" character varying(30) DEFAULT '',
     
    7775);
    7876
    79 CREATE VIEW "searchme" as SELECT allocations.cidr, allocations.custid, allocations."type", allocations.city, allocations.description, allocations.notes, allocations.oldcustid, allocations.circuitid FROM allocations UNION SELECT poolips.ip, poolips.custid, poolips.type, poolips.city, poolips.description, poolips.notes, poolips.oldcustid, poolips.circuitid FROM poolips;
     77CREATE VIEW "searchme" as SELECT allocations.cidr, allocations.custid, allocations."type", allocations.city, allocations.description, allocations.notes, allocations.circuitid FROM allocations UNION SELECT poolips.ip, poolips.custid, poolips.type, poolips.city, poolips.description, poolips.notes, poolips.circuitid FROM poolips;
    8078
    8179CREATE TABLE "alloctypes" (
  • branches/stable/cgi-bin/main.cgi

    r550 r592  
    1414use DBI;
    1515use CommonWeb qw(:ALL);
    16 use CustIDCK;
    1716use POSIX qw(ceil);
    1817use NetAddr::IP;
     
    2322##uselib##
    2423
     24use CustIDCK;
    2525use MyIPDB;
    2626
     
    10451045  # because I'm lazy, we'll try to make the SELECT's bring out identical)ish) data
    10461046  if ($webvar{block} =~ /\/32$/ && !$webvar{reallyblock}) {
    1047     $sql = "select ip,custid,type,city,circuitid,description,notes,modifystamp,privdata,oldcustid from poolips where ip='$webvar{block}'";
     1047    $sql = "select ip,custid,type,city,circuitid,description,notes,modifystamp,privdata from poolips where ip='$webvar{block}'";
    10481048  } else {
    1049     $sql = "select cidr,custid,type,city,circuitid,description,notes,modifystamp,privdata,oldcustid,swip from allocations where cidr='$webvar{block}'"
     1049    $sql = "select cidr,custid,type,city,circuitid,description,notes,modifystamp,privdata,swip from allocations where cidr='$webvar{block}'"
    10501050  }
    10511051
     
    11221122  }
    11231123## end node hack
    1124     $html =~ s/\$\$OLDCUSTID\$\$/$data[9]/g;
    11251124    $html =~ s/\$\$CITY\$\$/<input type=text name=city value="$data[3]">/g;
    11261125    $html =~ s/\$\$CIRCID\$\$/<input type="text" name="circid" value="$data[4]" maxlength=64 size=64 class="regular">/g;
     
    11401139## end node hack
    11411140    $html =~ s/\$\$CUSTID\$\$/$data[1]/g;
    1142     $html =~ s/\$\$OLDCUSTID\$\$/$data[9]/g;
    11431141    $html =~ s/\$\$TYPESELECT\$\$/$disp_alloctypes{$data[2]}/g;
    11441142    $html =~ s/\$\$CITY\$\$/$data[3]/g;
  • branches/stable/cgi-bin/search.cgi

    r507 r592  
    128128  my $sql = "(select $cols from searchme where".
    129129        " $webvar{custexclude} (custid ilike '%$webvar{custid}%'".
    130         " OR $webvar{custexclude} oldcustid ilike '%$webvar{custid}%'))".
    131130        " $sqlconcat (select $cols from searchme where $webvar{descexclude} description ilike '%$webvar{desc}%')".
    132131        " $sqlconcat (select $cols from searchme where $webvar{notesexclude} notes ilike '%$webvar{notes}%')";
     
    336335    # Query for a customer ID.  Note that we can't restrict to "numeric-only"
    337336    # as we have non-numeric custIDs in the legacy data.  :/
    338     $sql = "select $cols from searchme where custid ilike '%$query%' or oldcustid ilike '%$query%' or description like '%$query%'";
     337    $sql = "select $cols from searchme where custid ilike '%$query%' or description like '%$query%'";
    339338    my $count = countRows($sql);
    340339    $sql .= " order by cidr limit $RESULTS_PER_PAGE offset $offset";
  • branches/stable/editDisplay.html

    r394 r592  
    1515
    1616<tr class="color2"><td class=heading>CustID:</td><td class="regular">$$CUSTID$$</td></tr>
    17 <tr class="color2"><td class=heading>Old CustID:</td><td class="regular">$$OLDCUSTID$$</td></tr>
    1817
    1918<tr class="color2"><td class=heading>SWIPed?:</td><td class=regular>$$SWIP$$</td></tr>
Note: See TracChangeset for help on using the changeset viewer.