Fix a bug that affected dialplan entries for ring groups when using MySQL. Add additional exception handling.
This commit is contained in:
@@ -253,13 +253,11 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
$sql = "select count(*) as num_rows from v_dialplans ";
|
$sql = "select count(*) as num_rows from v_dialplans ";
|
||||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||||
$sql .= "and dialplan_uuid = '".$dialplan_uuid."' ";
|
$sql .= "and dialplan_uuid = '".$dialplan_uuid."' ";
|
||||||
$db->exec(check_sql($sql));
|
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
if ($prep_statement) {
|
if ($prep_statement) {
|
||||||
$prep_statement->execute();
|
$prep_statement->execute();
|
||||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
$row = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||||
if ($row['num_rows'] == 0) {
|
if ($row['num_rows'] == 0) {
|
||||||
|
|
||||||
//add the dialplan
|
//add the dialplan
|
||||||
require_once "includes/classes/database.php";
|
require_once "includes/classes/database.php";
|
||||||
$database = new database;
|
$database = new database;
|
||||||
@@ -313,7 +311,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
|
|
||||||
//apply settings reminder
|
//apply settings reminder
|
||||||
$_SESSION["reload_xml"] = true;
|
$_SESSION["reload_xml"] = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,6 @@ include "root.php";
|
|||||||
}
|
}
|
||||||
unset ($file_contents, $sql);
|
unset ($file_contents, $sql);
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
if (is_writable($this->path.'/'.$this->name)) {
|
if (is_writable($this->path.'/'.$this->name)) {
|
||||||
//is writable - use database in current location
|
//is writable - use database in current location
|
||||||
}
|
}
|
||||||
@@ -429,8 +428,22 @@ include "root.php";
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
$this->sql = $sql;
|
//execute the query, show exceptions
|
||||||
$this->db->exec($sql);
|
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
try {
|
||||||
|
$this->sql = $sql;
|
||||||
|
$this->db->exec($sql);
|
||||||
|
}
|
||||||
|
catch(PDOException $e) {
|
||||||
|
echo "<b>Error:</b><br />\n";
|
||||||
|
echo "<table>\n";
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo "<td>\n";
|
||||||
|
echo $e->getMessage();
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
echo "</table>\n";
|
||||||
|
}
|
||||||
unset($this->fields);
|
unset($this->fields);
|
||||||
unset($sql);
|
unset($sql);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user