diff --git a/app/call_block/app_defaults.php b/app/call_block/app_defaults.php index d1ca2c7cec..63eeb3e0a3 100644 --- a/app/call_block/app_defaults.php +++ b/app/call_block/app_defaults.php @@ -26,19 +26,6 @@ if ($domains_processed == 1) { - //create a view for call block - $database->execute("DROP VIEW view_call_block;", null); - $sql = "CREATE VIEW view_call_block AS ( \n"; - $sql .= " select c.domain_uuid, call_block_uuid, c.call_block_direction, c.extension_uuid, c.call_block_name, c.call_block_country_code, \n"; - $sql .= " c.call_block_number, e.extension, e.number_alias, c.call_block_count, c.call_block_app, c.call_block_data, c.date_added, \n"; - $sql .= " c.call_block_enabled, c.call_block_description, c.insert_date, c.insert_user, c.update_date, c.update_user \n"; - $sql .= " from v_call_block as c \n"; - $sql .= " left join v_extensions as e \n"; - $sql .= " on c.extension_uuid = e.extension_uuid \n"; - $sql .= "); \n"; - $database->execute($sql, null); - unset($sql); - //set call blocks to inbound if no direction defined $sql = "update v_call_block set call_block_direction = 'inbound' where call_block_direction is null "; $database->execute($sql, null); diff --git a/app/call_recordings/app_defaults.php b/app/call_recordings/app_defaults.php index 2a8f3e7e44..4ddf85b2b7 100644 --- a/app/call_recordings/app_defaults.php +++ b/app/call_recordings/app_defaults.php @@ -26,22 +26,6 @@ if ($domains_processed == 1) { - //create the user view combines username, organization, contact first and last name - $database->execute("DROP VIEW view_call_recordings;", null); - $sql = "CREATE VIEW view_call_recordings AS ( \n"; - $sql .= " select domain_uuid, xml_cdr_uuid as call_recording_uuid, \n"; - $sql .= " caller_id_name, caller_id_number, caller_destination, destination_number, \n"; - $sql .= " record_name as call_recording_name, record_path as call_recording_path, \n"; - $sql .= " record_transcription as call_recording_transcription, \n"; - $sql .= " duration as call_recording_length, start_stamp as call_recording_date, direction as call_direction \n"; - $sql .= " from v_xml_cdr \n"; - $sql .= " where record_name is not null \n"; - $sql .= " and record_path is not null \n"; - $sql .= " order by start_stamp desc \n"; - $sql .= "); \n"; - $database->execute($sql, null); - unset($sql); - } ?> \ No newline at end of file diff --git a/core/groups/app_defaults.php b/core/groups/app_defaults.php index f829085e4d..e789fc42c7 100644 --- a/core/groups/app_defaults.php +++ b/core/groups/app_defaults.php @@ -101,21 +101,6 @@ if ($domains_processed == 1) { $database->execute($sql, $parameters); unset($sql, $parameters); - //drop the view_groups - $database->execute("DROP VIEW view_groups;", null); - - //add or update the view - $sql = "CREATE VIEW view_groups AS ("; - $sql .= " select domain_uuid, group_uuid, group_name, "; - $sql .= " (select domain_name from v_domains where domain_uuid = g.domain_uuid) as domain_name, "; - $sql .= " (select count(*) from v_group_permissions where group_uuid = g.group_uuid) as group_permissions, "; - $sql .= " (select count(*) from v_user_groups where group_uuid = g.group_uuid) as group_members, "; - $sql .= " group_level, group_protected, group_description "; - $sql .= " from v_groups as g "; - $sql .= ");"; - $database->execute($sql, null); - unset($sql); - //group permissions $database->execute("update v_group_permissions set permission_protected = 'false' where permission_protected is null;", null); $database->execute("update v_group_permissions set permission_assigned = 'true' where permission_assigned is null;", null); diff --git a/core/users/app_defaults.php b/core/users/app_defaults.php index 62138c0954..ec329d5b97 100644 --- a/core/users/app_defaults.php +++ b/core/users/app_defaults.php @@ -30,50 +30,6 @@ if ($domains_processed == 1) { $group = new groups; $group->defaults(); - //create the user view combines username, organization, contact first and last name - $database->execute("DROP VIEW view_users;", null); - - $sql = "CREATE VIEW view_users AS ( \n"; - $sql .= " select u.domain_uuid, u.user_uuid, d.domain_name, u.username, u.user_status, u.user_enabled, u.add_date, \n"; - $sql .= " c.contact_uuid, c.contact_organization, c.contact_name_given ||' '|| c.contact_name_family as contact_name, c.contact_name_given, c.contact_name_family, c.contact_note, \n"; - $sql .= " ( \n"; - $sql .= " select \n"; - $sql .= " string_agg(g.group_name, ', ') \n"; - $sql .= " from \n"; - $sql .= " v_user_groups as ug, \n"; - $sql .= " v_groups as g \n"; - $sql .= " where \n"; - $sql .= " ug.group_uuid = g.group_uuid \n"; - $sql .= " and u.user_uuid = ug.user_uuid \n"; - $sql .= " ) AS group_names, \n"; - $sql .= " ( \n"; - $sql .= " select \n"; - $sql .= " string_agg(g.group_uuid::text, ', ') \n"; - //$sql .= " array_agg(g.group_uuid::text) \n"; - $sql .= " from \n"; - $sql .= " v_user_groups as ug, \n"; - $sql .= " v_groups as g \n"; - $sql .= " where \n"; - $sql .= " ug.group_uuid = g.group_uuid \n"; - $sql .= " and u.user_uuid = ug.user_uuid \n"; - $sql .= " ) AS group_uuids, \n"; - $sql .= " ( \n"; - $sql .= " SELECT group_level \n"; - $sql .= " FROM v_user_groups ug, v_groups g \n"; - $sql .= " WHERE (ug.group_uuid = g.group_uuid) \n"; - $sql .= " AND (u.user_uuid = ug.user_uuid) \n"; - $sql .= " ORDER BY group_level DESC \n"; - $sql .= " LIMIT 1 \n"; - $sql .= " ) AS group_level \n"; - $sql .= " from v_contacts as c \n"; - $sql .= " right join v_users u on u.contact_uuid = c.contact_uuid \n"; - $sql .= " inner join v_domains as d on d.domain_uuid = u.domain_uuid \n"; - $sql .= " where 1 = 1 \n"; - $sql .= " order by u.username asc \n"; - $sql .= "); \n"; - $database->execute($sql, null); - unset($sql); - //find rows that have a null group_uuid and set the correct group_uuid $sql = "select * from v_user_groups "; $sql .= "where group_uuid is null; ";