mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Ring Groups: Database class integration.
This commit is contained in:
@@ -28,29 +28,41 @@
|
||||
if ($domains_processed == 1) {
|
||||
|
||||
//select ring groups with an empty context
|
||||
$sql = "select * from v_ring_groups where ring_group_context is null ";
|
||||
$sql = "select * from v_ring_groups ";
|
||||
$sql .= "where ring_group_context is null ";
|
||||
$database = new database;
|
||||
$ring_groups = $database->select($sql, null, 'all');
|
||||
if (is_array($ring_groups)) {
|
||||
if (is_array($ring_groups) && @sizeof($ring_groups) != 0) {
|
||||
//get the domain list
|
||||
$sql = "select * from v_domains ";
|
||||
$domains = $database->select($sql, null, 'all');
|
||||
|
||||
//update the ring group context
|
||||
$x = 0;
|
||||
foreach ($ring_groups as $row) {
|
||||
foreach ($domains as $domain) {
|
||||
if ($row['domain_uuid'] == $domain['domain_uuid']) {
|
||||
$sql = "update v_ring_groups set ring_group_context = :domain_name \n";
|
||||
$sql .= "where ring_group_uuid = :ring_group_uuid \n";
|
||||
$parameters['domain_name'] = $domain['domain_name'];
|
||||
$parameters['ring_group_uuid'] = $row['ring_group_uuid'];
|
||||
$database->execute($sql, $parameters);
|
||||
unset($parameters);
|
||||
$array['ring_groups'][$x]['ring_group_uuid'] = $row['ring_group_uuid'];
|
||||
$array['ring_groups'][$x]['ring_group_context'] = $domain['domain_name'];
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p->add('ring_group_edit', 'temp');
|
||||
//execute update
|
||||
$database = new database;
|
||||
$database->app_name = 'ring_groups';
|
||||
$database->app_uuid = '1d61fb65-1eec-bc73-a6ee-a6203b4fe6f2';
|
||||
$database->save($array);
|
||||
unset($array);
|
||||
//revoke temporary permissions
|
||||
$p->delete('ring_group_edit', 'temp');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user