Changeset 788 for trunk/cgi-bin/IPDB.pm
- Timestamp:
- 10/08/15 17:49:27 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r785 r788 1841 1841 my ($code,$rmsg) = initPool($dbh, "$newblock", $binfo->{type}, $binfo->{city}, 'normal', $args{block}); 1842 1842 die $rmsg if $code eq 'FAIL'; 1843 } 1844 } 1845 1846 # check on the backup data first. we may need to tweak the main update's parameters. 1847 if (!defined($args{ignorebk})) { 1848 if ($args{backupfields}) { 1849 my @bkfields; 1850 my @bkvals; 1851 for my $bk (qw(brand model type src user vpass epass)) { 1852 if ($binfo->{"bk$bk"} ne $args{"bk$bk"}) { 1853 push @bkfields, "bk$bk = ?"; 1854 push @bkvals, $args{"bk$bk"}; 1855 } 1856 } 1857 $dbh->do("UPDATE backuplist SET ".join(',', @bkfields)." WHERE backup_id = ?", 1858 undef, @bkvals, $binfo->{hasbk}) 1859 if @bkfields; 1860 ##todo: keep historic changes for $timeperiod, by adding a backref ID field, and on updates adding a new backup 1861 # record instead of updating the existing one. should probably check if new==old so we don't do needless updates 1862 # in that case... 1863 } else { 1864 if ($binfo->{hasbk}) { 1865 # had backup data, no longer checked - delete backup entry 1866 $dbh->do("DELETE FROM backuplist WHERE backup_id = ?", undef, $binfo->{hasbk}); 1867 $sql .= " = ?, backup_id"; 1868 push @vallist, 0; 1869 } 1843 1870 } 1844 1871 } … … 2740 2767 $msg = "Unable to deallocate $disp_alloctypes{$binfo->{type}} $cidr"; 2741 2768 $pinfo = getBlockData($dbh, $binfo->{parent_id}, 'b'); 2742 ##fixme: VRF and rdepth2743 2769 $dbh->do("UPDATE poolips SET custid = ?, available = 'y',". 2744 2770 "city = (SELECT city FROM allocations WHERE id = ?),". 2745 "description = '', notes = '', circuitid = '', vrf = ? WHERE id = ?", undef, 2771 "description = '', notes = '', circuitid = '', vrf = ?, backup_id = 0". 2772 " WHERE id = ?", undef, 2746 2773 ($pinfo->{custid}, $binfo->{parent_id}, $pinfo->{vrf}, $id) ); 2774 $dbh->do("DELETE FROM backuplist WHERE backup_id = ?", undef, $binfo->{hasbk}) 2775 if $binfo->{hasbk}; 2747 2776 $dbh->commit; 2748 2777 };
Note:
See TracChangeset
for help on using the changeset viewer.