Changeset 5196

Show
Ignore:
Timestamp:
11/03/07 11:33:45 (4 years ago)
Author:
p_lindheimer
Message:

fix to r5186 (#2411, #2402): when editing device into a fixed device, reset user. When changing a device from a fixed to adhoc, reset user

Files:

Legend:

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

    r5186 r5196  
    794794  //add details to astdb 
    795795  if ($astman) { 
     796    // if adding or editting a fixed device, user property should always be set 
     797    if ($devicetype == 'fixed' || !$editmode) { 
     798      $astman->database_put("DEVICE",$id."/user",$user); 
     799    } 
     800    // If changing from a fixed to an adhoc, the user property should be intialized 
     801    // to the new default, not remain as the previous fixed user 
     802    if ($editmode) { 
     803      $previous_type = $astman->database_get("DEVICE",$id."/type"); 
     804      if ($previous_type == 'fixed' && $devicetype == 'adhoc') { 
     805        $astman->database_put("DEVICE",$id."/user",$user); 
     806      } 
     807    } 
    796808    $astman->database_put("DEVICE",$id."/dial",$dial); 
    797809    $astman->database_put("DEVICE",$id."/type",$devicetype); 
    798     if (!$editmode) { 
    799       $astman->database_put("DEVICE",$id."/user",$user); 
    800     } 
    801810    $astman->database_put("DEVICE",$id."/default_user",$user); 
    802811    if(!empty($emergency_cid)) 
     
    878887      } 
    879888    } 
    880     $astman->database_del("DEVICE",$account."/dial"); 
    881     $astman->database_del("DEVICE",$account."/type"); 
    882889    if (! $editmode) { 
     890      $astman->database_del("DEVICE",$account."/dial"); 
     891      $astman->database_del("DEVICE",$account."/type"); 
    883892      $astman->database_del("DEVICE",$account."/user"); 
    884     } 
    885     $astman->database_del("DEVICE",$account."/default_user"); 
    886     $astman->database_del("DEVICE",$account."/emergency_cid"); 
     893    $astman->database_del("DEVICE",$account."/default_user"); 
     894    $astman->database_del("DEVICE",$account."/emergency_cid"); 
     895    } 
    887896 
    888897    //delete from devices table