Changeset 292 for branches


Ignore:
Timestamp:
10/14/05 11:15:48 (19 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Bugfix for broken "Allocate *THIS* IP" functionality in admin tools

File:
1 edited

Legend:

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

    r286 r292  
    197197<td class="center" colspan="2"><input type="submit" value="  Assign  "></td>
    198198<input type="hidden" name="action" value="confirm">
     199</form>
    199200</tr>
    200201</table>
     
    210211    printError("Invalid customer location!  Go back and select customer's location.");
    211212  } else {
    212     my ($retcode,$msg) = allocateBlock($ip_dbh, $webvar{cidr}, $webvar{alloc_from},
     213    if ($webvar{alloctype} =~ /^.i$/) {
     214      $sth = $ip_dbh->prepare("update poolips set available='n', custid='$webvar{custid}', ".
     215        "city='$webvar{city}', description='$webvar{desc}', notes='$webvar{notes}' ".
     216        "where ip='$webvar{cidr}'");
     217      $sth->execute;
     218      if ($sth->err) {
     219        print "Allocation failed!  DBI said:\n".$sth->errstr."\n";
     220        syslog "err", "($authuser) Allocation of '$webvar{cidr}' to '$webvar{custid}' as ".
     221                "'$webvar{alloctype}' failed: '".$sth->errstr."'";
     222      } else {
     223        print "Allocation OK!\n";
     224        syslog "notice", "$authuser allocated '$webvar{cidr}' to '$webvar{custid}' as ".
     225                "'$webvar{alloctype}'";
     226        # Notify tech@example.com
     227        mailNotify('tech@example.com',"$disp_alloctypes{$webvar{alloctype}} allocation",
     228          "$disp_alloctypes{$webvar{alloctype}} $msg allocated to customer $webvar{custid}\n".
     229          "Description: $webvar{desc}\n\nAllocated by: $authuser\n");
     230      }
     231    } else {
     232      my ($retcode,$msg) = allocateBlock($ip_dbh, $webvar{cidr}, $webvar{alloc_from},
    213233        $webvar{custid}, $webvar{alloctype}, $webvar{city}, $webvar{desc}, $webvar{notes},
    214234        $webvar{circid});
    215     if ($retcode eq 'OK') {
    216       print "Allocation OK!\n";
    217 
    218       if ($webvar{alloctype} =~ /^.i$/) {
    219         # Notify tech@example.com
    220         mailNotify('tech@example.com',"$disp_alloctypes{$webvar{alloctype}} allocation",
    221           "$disp_alloctypes{$webvar{alloctype}} $msg allocated to customer $webvar{custid}\n".
    222           "Description: $webvar{desc}\n\nAllocated by: $authuser\n");
     235      if ($retcode eq 'OK') {
     236        print "Allocation OK!\n";
     237        syslog "notice", "$authuser allocated '$webvar{cidr}' to '$webvar{custid}' as ".
     238                "'$webvar{alloctype}'";
     239      } else {
     240        print "Allocation failed!  IPDB::allocateBlock said:\n$msg\n";
     241        syslog "err", "($authuser) Allocation of '$webvar{cidr}' to '$webvar{custid}' as ".
     242                "'$webvar{alloctype}' failed: '$msg'";
    223243      }
    224       syslog "notice", "$authuser allocated '$webvar{cidr}' to '$webvar{custid}' as ".
    225         "'$webvar{alloctype}'";
    226     } else {
    227       print "Allocation failed!  IPDB::allocateBlock said:\n$msg\n";
    228       syslog "err", "($authuser) Allocation of '$webvar{cidr}' to '$webvar{custid}' as ".
    229         "'$webvar{alloctype}' failed: '$msg'";
    230     }
     244    } # static IP vs netblock
     245
    231246  } # done city check
    232247
Note: See TracChangeset for help on using the changeset viewer.