Hi,
It have bug in core function on change adhoc device. This BUG is present from 2.5 to 2.10 (I dont'have FREEPBX before 2.5 but I think this bug is present to).
You create adhoc device with defaut user .
You log an other user (not default) on this device with *11.
You go on device definition and you chane (example) the description of this device and you submit.
After this submit you see AMPUSER/<logged in user>/device ins ASTDB and this entry is deleted. But
the entry of AMPUSER/<default user>/device is populated with device id.
The bug is in functions.inc.php in core the patch for core version 2.10.0.8 (but same patch for old freepbx version)
Best regards Bernard
--- functions.inc.php.orig 2012-06-01 12:34:38.000000000 +0200
+++ functions.inc.php.new 2012-06-01 15:20:06.000000000 +0200
@@ -4423,16 +4423,19 @@
$astman->database_del("DEVICE",$id."/emergency_cid");
}
- if ($user != "none") {
- $existingdevices = $astman->database_get("AMPUSER",$user."/device");
+ // TNE-BME 2012/06/01 Problem with adhoc phone loggedin on users before this change
+ // If not test on defaut user but on DEVICE/$id/user
+ $connecteduser=$astman->database_get("DEVICE",$id."/user");
+ if ($connecteduser != "none") {
+ $existingdevices = $astman->database_get("AMPUSER",$connecteduser."/device");
if (empty($existingdevices)) {
- $astman->database_put("AMPUSER",$user."/device",$id);
+ $astman->database_put("AMPUSER",$connecteduser."/device",$id);
} else {
$existingdevices_array = explode('&',$existingdevices);
if (!in_array($id, $existingdevices_array)) {
$existingdevices_array[]=$id;
$existingdevices = implode('&',$existingdevices_array);
- $astman->database_put("AMPUSER",$user."/device",$existingdevices);
+ $astman->database_put("AMPUSER",$connecteduser."/device",$existingdevices);
}
}
}