Changeset 5186

Show
Ignore:
Timestamp:
11/02/07 17:35:24 (4 years ago)
Author:
p_lindheimer
Message:

#2411, #2402 - fix bug so editing a device does not logout the user, and add default_user field along with fix to macro-user-logoff so that default user information is retained when a user logs off, and fix issue that was allowing a blank extension to be created when javascript was disabled or bugs existed which would make extensions stop working on a system

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.3/core/etc/extensions.conf

    r5157 r5186  
    910910exten => s,7,Set(DB(AMPUSER/${DEVAMPUSER}/device)=${AMPUSERDEVICES}) 
    911911; reset device -> user mapping 
    912 exten => s,8,Set(DB(DEVICE/${CALLERID(number)}/user)=none) 
    913 exten => s,9,Playback(vm-goodbye) 
     912exten => s,8,Set(DEFAULTUSER=${DB(DEVICE/${CALLERID(number)}/default_user)}) 
     913exten => s,9,Set(DB(DEVICE/${CALLERID(number)}/user)=${IF($["${DEFAULTUSER}"=""]?none:${DEFAULTUSER})}) 
     914exten => s,10,Playback(vm-goodbye) 
    914915 
    915916exten => s-FIXED,1,NoOp(Device is FIXED and cannot be logged out of) 
  • modules/branches/2.3/core/functions.inc.php

    r5185 r5186  
    736736 
    737737 
    738 function core_devices_add($id,$tech,$dial,$devicetype,$user,$description,$emergency_cid=null){ 
     738function core_devices_add($id,$tech,$dial,$devicetype,$user,$description,$emergency_cid=null,$editmode=false){ 
    739739  global $amp_conf; 
    740740  global $currentFile; 
     
    742742 
    743743  $display = isset($_REQUEST['display'])?$_REQUEST['display']:''; 
     744 
     745  if (trim($id) == '' ) { 
     746    if ($display != 'extensions') { 
     747      echo "<script>javascript:alert('"._("You must put in a device id")."');</script>"; 
     748    } 
     749    return false; 
     750  } 
    744751   
    745752  //ensure this id is not already in use 
     
    789796    $astman->database_put("DEVICE",$id."/dial",$dial); 
    790797    $astman->database_put("DEVICE",$id."/type",$devicetype); 
    791     $astman->database_put("DEVICE",$id."/user",$user); 
     798    if (!$editmode) { 
     799      $astman->database_put("DEVICE",$id."/user",$user); 
     800    } 
     801    $astman->database_put("DEVICE",$id."/default_user",$user); 
    792802    if(!empty($emergency_cid)) 
    793803      $astman->database_put("DEVICE",$id."/emergency_cid","\"".$emergency_cid."\""); 
     
    837847} 
    838848 
    839 function core_devices_del($account){ 
     849function core_devices_del($account,$editmode=false){ 
    840850  global $amp_conf; 
    841851  global $currentFile; 
     
    870880    $astman->database_del("DEVICE",$account."/dial"); 
    871881    $astman->database_del("DEVICE",$account."/type"); 
    872     $astman->database_del("DEVICE",$account."/user"); 
     882    if (! $editmode) { 
     883      $astman->database_del("DEVICE",$account."/user"); 
     884    } 
     885    $astman->database_del("DEVICE",$account."/default_user"); 
    873886    $astman->database_del("DEVICE",$account."/emergency_cid"); 
    874887 
     
    13011314 
    13021315  $thisexten = isset($thisexten) ? $thisexten : ''; 
     1316 
     1317  if (trim($thisexten) == '' ) { 
     1318    echo "<script>javascript:alert('"._("You must put in an extension (or user) number")."');</script>"; 
     1319    return false; 
     1320  } 
    13031321 
    13041322  //ensure this id is not already in use 
     
    31753193      // really bad hack - but if core_users_edit fails, want to stop core_devices_edit 
    31763194      if (!isset($GLOBALS['abort']) || $GLOBALS['abort'] !== true) { 
    3177         core_devices_del($extdisplay); 
    3178         core_devices_add($deviceid,$tech,$devinfo_dial,$devicetype,$deviceuser,$description,$emergency_cid); 
     3195        core_devices_del($extdisplay,true); 
     3196        core_devices_add($deviceid,$tech,$devinfo_dial,$devicetype,$deviceuser,$description,$emergency_cid,true); 
    31793197        needreload(); 
    31803198        redirect_standard_continue('extdisplay');