Changeset 638 for trunk/cgi-bin/main.cgi


Ignore:
Timestamp:
10/09/14 18:13:22 (10 years ago)
Author:
Kris Deugau
Message:

/trunk

Commit 10/mumble for work done intermittently over the past ~year.
See #5, comment 25:

  • Update block delete. Includes a little current work to fix outstanding edge case issues
File:
1 edited

Legend:

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

    r634 r638  
    821821
    822822  my $blockdata;
    823 
    824   if ($webvar{rdepth} == 0) {   # $webvar{alloctype} eq 'mm'
    825 
    826     $blockdata->{block} = $webvar{block};
     823  $blockdata = getBlockData($ip_dbh, $webvar{block}, $webvar{basetype});
     824
     825  if ($blockdata->{parent_id} == 0) {   # $webvar{alloctype} eq 'mm'
    827826    $blockdata->{city} = "N/A";
    828827    $blockdata->{custid} = "N/A";
    829     $blockdata->{type} = 'mm';
    830828    $blockdata->{circuitid} = "N/A";
    831829    $blockdata->{description} = "N/A";
    832830    $blockdata->{notes} = "N/A";
    833831    $blockdata->{privdata} = "N/A";
    834     $blockdata->{rdepth} = 0;
    835 
    836   } else {
    837 
    838     $blockdata = getBlockData($ip_dbh, $webvar{block}, $webvar{rdepth});
    839 
    840832  } # end cases for different alloctypes
    841833
     834  $page->param(blockid => $webvar{block});
     835  $page->param(basetype => $webvar{basetype});
     836
    842837  $page->param(block => $blockdata->{block});
    843 
    844838  $page->param(rdns => $blockdata->{rdns});
    845839
     
    853847  }
    854848
    855   $page->param(rdepth => $blockdata->{rdepth});
    856849  $page->param(disptype => $disp_alloctypes{$blockdata->{type}});
    857 #  $page->param(type => $blockdata->{type});
    858850  $page->param(city => $blockdata->{city});
    859851  $page->param(custid => $blockdata->{custid});
     
    883875
    884876  # need to retrieve block data before deleting so we can notify on that
    885   my $blockinfo = getBlockData($ip_dbh, $webvar{block}, $webvar{rdepth});
    886 
    887   my ($code,$msg) = deleteBlock($ip_dbh, $webvar{block}, $webvar{rdepth}, $webvar{vrf}, $webvar{delforward}, $authuser);
    888 
    889   $page->param(block => $webvar{block});
    890   $page->param(delparent => $blockinfo->{parent}) if $webvar{rdepth};
    891   $page->param(prdepth => $webvar{rdepth});
     877  my $blockinfo = getBlockData($ip_dbh, $webvar{block}, $webvar{basetype});
     878  my $pinfo = getBlockData($ip_dbh, $blockinfo->{parent_id}, 'b');
     879
     880  my ($code,$msg) = deleteBlock($ip_dbh, $webvar{block}, $webvar{basetype}, $webvar{delforward}, $authuser);
     881
     882  $page->param(block => $blockinfo->{block});
     883  $page->param(delparent_id => $blockinfo->{parent_id});# if $webvar{rdepth};
     884  $page->param(delparent => $pinfo->{block});
     885  $page->param(returnpool => ($webvar{basetype} eq 'i') );
    892886  if ($code =~ /^WARN(POOL|MERGE)/) {
    893     my ($bp,$bd) = split /,/, $msg;
    894     $page->param(bparent => $bp);
    895     $page->param(brdepth => $bd);
     887    my ($pid,$pcidr) = split /,/, $msg;
     888    $page->param(parent_id => $pid);
     889    $page->param(parent => $pcidr);
    896890    $page->param(mergeip => $code eq 'WARNPOOL');
    897891  }
     
    901895  }
    902896  if ($code eq 'OK' || $code =~ /^WARN/) {
    903     syslog "notice", "$authuser deallocated '$webvar{alloctype}'-type netblock $webvar{block} ".
     897    syslog "notice", "$authuser deallocated '".$blockinfo->{type}."'-type netblock $webvar{block} ".
    904898        $blockinfo->{custid}.", ".$blockinfo->{city}.", desc='".$blockinfo->{description}."'";
    905     mailNotify($ip_dbh, 'da', "REMOVED: $disp_alloctypes{$webvar{alloctype}} $webvar{block}",
    906         "$disp_alloctypes{$webvar{alloctype}} $webvar{block} deallocated by $authuser\n".
     899    mailNotify($ip_dbh, 'da', "REMOVED: ".$disp_alloctypes{$blockinfo->{type}}." $webvar{block}",
     900        $disp_alloctypes{$blockinfo->{type}}." $webvar{block} deallocated by $authuser\n".
    907901        "CustID: ".$blockinfo->{custid}."\nCity: ".$blockinfo->{city}.
    908902        "\nDescription: ".$blockinfo->{description}."\n");
Note: See TracChangeset for help on using the changeset viewer.