Changeset 315 for branches/stable


Ignore:
Timestamp:
03/31/06 13:48:28 (18 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Billing raduser crosslink:

Merge /trunk r297, r299, clean
Merge first two segments of /trunk r300 as-is (clean);

manually update code for third segment because merge is not clean

Merge first two segments of /trunk r301 as-is (clean);

third segment is a tweak on the dev version of the CustID check
and should be ignored

Merge /trunk r302, clean
Merge /trunk r312, 313, and 314, clean

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/cgi-bin/main.cgi

    r296 r315  
    754754            " chose a smaller blocksize.";
    755755        }
    756         if ($webvar{allocfrom} ne '-') {
     756        if (defined $webvar{allocfrom} && $webvar{allocfrom} ne '-') {
    757757          $sql = "select cidr from freeblocks where city='$city' and maskbits<=$webvar{maskbits}".
    758758                " and cidr <<= '$webvar{allocfrom}' and routed='".
     
    827827    $i++;
    828828  }
     829# We're going to abuse $$PRIVDATA$$ to stuff in some stuff for billing.
     830  $privdata .= "<input type=hidden name=billinguser value=$webvar{userid}>\n"
     831        if $webvar{userid};
    829832  $html =~ s/\$\$PRIVDATA\$\$/$privdata/g;
    830833
     
    858861  if ($code eq 'OK') {
    859862    if ($webvar{alloctype} =~ /^.i$/) {
    860       print qq(<div class="center"><div class="heading">The IP $msg has been allocated to customer $webvar{custid}</div></div>);
     863      $msg =~ s|/32||;
     864      print qq(<div class="center"><div class="heading">The IP $msg has been allocated to customer $webvar{custid}</div>).
     865        ( ($webvar{alloctype} eq 'di' && $webvar{billinguser}) ?
     866                qq(<div><a href="https://billing.example.com/extserv.pl?).
     867                "action=new_radius_user&custid=$webvar{custid}&userid=$webvar{billinguser}".
     868                qq(&ipdb=1&ip=$msg">Add this IP to RADIUS user table</a></div>)
     869        : "</div>");
    861870      # Notify tech@example.com
    862871      mailNotify('tech@example.com',"ADDED: $disp_alloctypes{$webvar{alloctype}} allocation",
     
    864873        "Description: $webvar{desc}\n\nAllocated by: $authuser\n");
    865874    } else {
     875      my $netblock = new NetAddr::IP $webvar{fullcidr};
    866876      print qq(<div class="center"><div class="heading">The block $webvar{fullcidr} was ).
    867         "sucessfully added as: $disp_alloctypes{$webvar{alloctype}}</div></div>";
     877        "sucessfully added as: $disp_alloctypes{$webvar{alloctype}}</div>".
     878        ( ($webvar{alloctype} eq 'pr' && $webvar{billinguser}) ?
     879                qq(<div><a href="https://billing.example.com/extserv.pl?).
     880                "action=new_radius_user&custid=$webvar{custid}&userid=$webvar{billinguser}".
     881                "&route_subnet=".$netblock->addr."&subnet_slash=".$netblock->masklen.
     882                "&include_routed_subnet=1&ipdb=1".
     883                qq(">Add this netblock to RADIUS user table</a></div>)
     884        : "</div>");
    868885    }
    869886    syslog "notice", "$authuser allocated '$webvar{fullcidr}' to '$webvar{custid}' as ".
     
    942959  } else {
    943960    $flag = 'n';
    944     if ($webvar{alloctype} =~ /w./) {
    945       $webvar{pop} = "Sudbury";
    946     } elsif ($webvar{pop} =~ /^-$/) {
     961    if ($webvar{alloctype} =~ /[wp][cr]|[ds][pi]/) {
     962      # Set this forcibly rather than messing around elsewhere.  Yes, this *is* a hack.  PTHBTT!!
     963      $webvar{pop} = 'Sudbury';
     964    }
     965    if ($webvar{pop} =~ /^-$/) {
    947966      $flag = 'to route the block from/through';
    948967    }
Note: See TracChangeset for help on using the changeset viewer.