Correct del extension to remove all associated buttons
This commit is contained in:
		
							parent
							
								
									1f910c7e97
								
							
						
					
					
						commit
						f2d15ebd5e
					
				| 
						 | 
					@ -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() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue