Changeset 6361

Show
Ignore:
Timestamp:
08/12/08 16:00:33 (5 years ago)
Author:
p_lindheimer
Message:

fixes #3047 fixes bug that was supplying an existing trunk id when a new trunk was added in certain circumstances where there had been trunks deleted in the sequence

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.5/core/functions.inc.php

    r6347 r6361  
    28762876  // find the next available ID 
    28772877  $trunknum = 1; 
     2878 
     2879  // This is pretty ugle, will fix when we redo trunks and routes with proper uniqueids. 
     2880  // get the list, sort them, then look for a hole and use it, or overflow to the end if 
     2881  // not and use that 
     2882  // 
     2883  $trunk_hash = array(); 
    28782884  foreach(core_trunks_list() as $trunk) { 
    2879     if ($trunknum == ltrim($trunk[0],"OUT_")) {  
    2880       $trunknum++; 
    2881     } 
     2885    $trunknum = ltrim($trunk[0],"OUT_"); 
     2886    $trunk_hash[] = $trunknum; 
     2887  } 
     2888  sort($trunk_hash); 
     2889  $trunknum = 1; 
     2890  foreach ($trunk_hash as $trunk_id) { 
     2891    if ($trunk_id != $trunknum) { 
     2892      break; 
     2893    } 
     2894    $trunknum++; 
    28822895  } 
    28832896