Correct del extension to remove all associated buttons

This commit is contained in:
steve-lad 2021-07-29 16:28:05 +02:00
parent 1f910c7e97
commit f2d15ebd5e
2 changed files with 7 additions and 3 deletions

View file

@ -213,7 +213,7 @@ $(document).ready(function () {
} }
e.preventDefault(); e.preventDefault();
}); });
// Set focus on the mac entry field. It will not stay but ensures that focusout brings it back
$('#sccp_hw_mac').focus(); $('#sccp_hw_mac').focus();
$('#sccp_hw_mac').focusout(function() { $('#sccp_hw_mac').focusout(function() {

View file

@ -187,8 +187,12 @@ class Sccp extends \FreePBX\modules\Core\Driver {
public function delDevice($id) { public function delDevice($id) {
//Required by FreePBX. //Required by FreePBX.
// Delete associated default line buttons or will leave orphans // Delete associated default line buttons or will leave orphans
$sth = $this->database->prepare("DELETE FROM sccpbuttonconfig WHERE ref = ? AND instance = 1 AND buttontype = 'line'"); foreach (array($id) as $openId) {
$sth->execute(array($id)); $sth = $this->database->prepare("DELETE FROM sccpbuttonconfig WHERE name LIKE :openID AND buttontype = 'line'");
$openId = "{$openId}%";
$sth->bindParam(':openID', $openId);
$sth->execute();
}
$sth = $this->database->prepare("DELETE FROM sccpline WHERE name = ?"); $sth = $this->database->prepare("DELETE FROM sccpline WHERE name = ?");
$sth->execute(array($id)); $sth->execute(array($id));