Index: /trunk/cgi-bin/IPDB.pm
===================================================================
--- /trunk/cgi-bin/IPDB.pm	(revision 728)
+++ /trunk/cgi-bin/IPDB.pm	(revision 729)
@@ -2081,4 +2081,7 @@
   my @retlist;
 
+  local $dbh->{AutoCommit} = 0;
+  local $dbh->{RaiseError} = 1;
+
   # Want to do all of the DB stuff in a transaction, to minimize data changing underfoot
   eval {
@@ -2105,17 +2108,4 @@
         });
 
-    # Convert a bunch of pool IP allocations into "normal" netblock allocations
-    my $pool2alloc = $dbh->prepare(q{
-        INSERT INTO allocations (
-                cidr,type,city, description, notes, circuitid, createstamp, modifystamp,
-                privdata, custid, vrf, vlan, rdns, parent_id, master_id
-            )
-        SELECT
-                ip, ? AS type, city, description, notes, circuitid, createstamp, modifystamp,
-                privdata, custid, vrf, vlan, rdns, parent_id, master_id
-            FROM poolips
-            WHERE parent_id = ? AND available = 'n'
-        });
-
     # Common actions
     my $peersth = $dbh->prepare("SELECT cidr,id,type,master_id FROM allocations WHERE parent_id = ? AND cidr <<= ?");
@@ -2132,4 +2122,15 @@
     if ($args{newtype} =~ /.[cm]/) {
       ## Container
+
+      # In case of merging a master block
+      my $mfbsth = $dbh->prepare("UPDATE freeblocks SET master_id = ? WHERE master_id = ?");
+
+      if ($args{scope} eq 'keepall') {
+      } elsif ($args{scope} =~ /^clear/) {
+      } elsif ($args{scope} eq 'mergepeer') { # should this just be an else?
+      } # scope
+
+      # Clean up free blocks
+      _compactFree($dbh, $prime);
 
     } elsif ($args{newtype} =~ /.[dp]/) {
