Changeset 293


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

/trunk

Merge bugfix from /branches/stable r292

File:
1 edited

Legend:

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

    r284 r293  
    181181<td class="center" colspan="2"><input type="submit" value="  Assign  "></td>
    182182<input type="hidden" name="action" value="confirm">
     183</form>
    183184</tr>
    184185</table>
     
    194195    printError("Invalid customer location!  Go back and select customer's location.");
    195196  } else {
    196     my ($retcode,$msg) = allocateBlock($ip_dbh, $webvar{cidr}, $webvar{alloc_from},
     197    if ($webvar{alloctype} =~ /^.i$/) {
     198      $sth = $ip_dbh->prepare("update poolips set available='n', custid='$webvar{custid}', ".
     199        "city='$webvar{city}', description='$webvar{desc}', notes='$webvar{notes}' ".
     200        "where ip='$webvar{cidr}'");
     201      $sth->execute;
     202      if ($sth->err) {
     203        print "Allocation failed!  DBI said:\n".$sth->errstr."\n";
     204        syslog "err", "($authuser) Allocation of '$webvar{cidr}' to '$webvar{custid}' as ".
     205                "'$webvar{alloctype}' failed: '".$sth->errstr."'";
     206      } else {
     207        print "Allocation OK!\n";
     208        syslog "notice", "$authuser allocated '$webvar{cidr}' to '$webvar{custid}' as ".
     209                "'$webvar{alloctype}'";
     210        # Notify tech@example.com
     211        mailNotify('tech@example.com',"$disp_alloctypes{$webvar{alloctype}} allocation",
     212          "$disp_alloctypes{$webvar{alloctype}} $msg allocated to customer $webvar{custid}\n".
     213          "Description: $webvar{desc}\n\nAllocated by: $authuser\n");
     214      }
     215    } else {
     216      my ($retcode,$msg) = allocateBlock($ip_dbh, $webvar{cidr}, $webvar{alloc_from},
    197217        $webvar{custid}, $webvar{alloctype}, $webvar{city}, $webvar{desc}, $webvar{notes},
    198218        $webvar{circid});
    199     if ($retcode eq 'OK') {
    200       print "Allocation OK!\n";
    201 
    202       if ($webvar{alloctype} =~ /^.i$/) {
    203         # Notify tech@example.com
    204         mailNotify('tech@example.com',"$disp_alloctypes{$webvar{alloctype}} allocation",
    205           "$disp_alloctypes{$webvar{alloctype}} $msg allocated to customer $webvar{custid}\n".
    206           "Description: $webvar{desc}\n\nAllocated by: $authuser\n");
     219      if ($retcode eq 'OK') {
     220        print "Allocation OK!\n";
     221        syslog "notice", "$authuser allocated '$webvar{cidr}' to '$webvar{custid}' as ".
     222                "'$webvar{alloctype}'";
     223      } else {
     224        print "Allocation failed!  IPDB::allocateBlock said:\n$msg\n";
     225        syslog "err", "($authuser) Allocation of '$webvar{cidr}' to '$webvar{custid}' as ".
     226                "'$webvar{alloctype}' failed: '$msg'";
    207227      }
    208       syslog "notice", "$authuser allocated '$webvar{cidr}' to '$webvar{custid}' as ".
    209         "'$webvar{alloctype}'";
    210     } else {
    211       print "Allocation failed!  IPDB::allocateBlock said:\n$msg\n";
    212       syslog "err", "($authuser) Allocation of '$webvar{cidr}' to '$webvar{custid}' as ".
    213         "'$webvar{alloctype}' failed: '$msg'";
    214     }
     228    } # static IP vs netblock
     229
    215230  } # done city check
    216231
Note: See TracChangeset for help on using the changeset viewer.