Changeset 814 for trunk


Ignore:
Timestamp:
03/08/16 16:51:06 (8 years ago)
Author:
Kris Deugau
Message:

/trunk

Updates to getBlockData() for several new logical data arrangements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r812 r814  
    31613161
    31623162  # Note city, vrf, parent_id and master_id removed due to JOIN uncertainty for block allocations
    3163   my $commonfields = q(custid, type, circuitid, description, notes, modifystamp AS lastmod,
    3164         privdata, vlan, rdns);
     3163  my $commonfields = q(a.custid, a.type, a.circuitid, a.description, a.notes, a.modifystamp AS lastmod,
     3164        a.privdata, a.vlan, a.rdns);
    31653165  my $bkfields = q(b.backup_id AS hasbk, b.bkbrand, b.bkmodel, b.bktype, b.bkport, b.bksrc,
    31663166        b.bkuser, b.bkvpass, b.bkepass, b.bkip);
     
    31683168  if ($type eq 'i') {
    31693169    my $binfo = $dbh->selectrow_hashref(qq(
    3170         SELECT p.id, p.ip AS block, p.city, p.vrf, p.parent_id, p.master_id, $commonfields,
    3171                 d.zone >> p.ip AS revavail,
    3172                 $bkfields
    3173         FROM poolips p
    3174         LEFT JOIN dnsavail d ON p.master_id = d.parent_alloc AND p.ip << d.zone
    3175         LEFT JOIN backuplist b ON p.backup_id = b.backup_id
    3176         WHERE id = ?
     3170        SELECT a.id, a.ip AS block, a.city, a.vrf, a.parent_id, a.master_id, $commonfields,
     3171                d.zone >> a.ip AS revavail,
     3172                $bkfields,
     3173                v.location
     3174        FROM poolips a
     3175        LEFT JOIN dnsavail d ON a.master_id = d.parent_alloc AND a.ip << d.zone
     3176        LEFT JOIN backuplist b ON a.backup_id = b.backup_id
     3177        JOIN allocations m ON a.master_id = m.id JOIN vrfs v ON m.vrf = v.vrf
     3178        WHERE a.id = ?
    31773179        ), undef, ($id) );
    31783180    return $binfo;
    31793181  } else {
    31803182    my $binfo = $dbh->selectrow_hashref(qq(
    3181         SELECT a.id, a.cidr AS block, a.city, a.vrf, a.parent_id, a.master_id, swip, $commonfields,
     3183        SELECT a.id, a.cidr AS block, a.city, a.vrf, a.parent_id, a.master_id, a.swip, $commonfields,
    31823184                f.cidr AS reserve, f.id as reserve_id,
    31833185                d.zone >>= a.cidr AS revavail, d.zone << a.cidr AS revpartial,
    3184                 $bkfields
     3186                $bkfields,
     3187                v.location
    31853188        FROM allocations a
    31863189        LEFT JOIN freeblocks f ON a.id=f.reserve_for
    31873190        LEFT JOIN dnsavail d ON a.master_id = d.parent_alloc AND (a.cidr <<= d.zone OR a.cidr >> d.zone)
    31883191        LEFT JOIN backuplist b ON a.backup_id = b.backup_id
     3192        JOIN allocations m ON a.master_id = m.id JOIN vrfs v ON m.vrf = v.vrf
    31893193        WHERE a.id = ?
    31903194        ), undef, ($id) );
Note: See TracChangeset for help on using the changeset viewer.