From 4f03720be662cdc5aa064cf14b27b93939524a34 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Wed, 1 May 2013 17:05:53 +0000 Subject: [PATCH] Uncomment and fix the follow me caller id prefix but only show it for people with the follow_me_cid_name_prefix. Add follow me to the app menu. --- app/calls/app_config.php | 34 +++++++------- app/calls/app_languages.php | 8 ++-- app/calls/call_edit.php | 30 +++++++----- .../resources/classes/switch_follow_me.php | 20 ++++---- app/extensions/extension_edit.php | 3 -- app/follow_me/app_config.php | 47 ++++++++++--------- 6 files changed, 76 insertions(+), 66 deletions(-) diff --git a/app/calls/app_config.php b/app/calls/app_config.php index 9c55a8011b..925c9a6f27 100644 --- a/app/calls/app_config.php +++ b/app/calls/app_config.php @@ -19,23 +19,23 @@ $apps[$x]['description']['pt-br'] = ''; //menu details - $apps[$x]['menu'][0]['title']['en-us'] = 'Calls'; - $apps[$x]['menu'][0]['title']['es-mx'] = ''; - $apps[$x]['menu'][0]['title']['de'] = ''; - $apps[$x]['menu'][0]['title']['de-ch'] = ''; - $apps[$x]['menu'][0]['title']['de-at'] = ''; - $apps[$x]['menu'][0]['title']['fr'] = ''; - $apps[$x]['menu'][0]['title']['fr-ca'] = ''; - $apps[$x]['menu'][0]['title']['fr-ch'] = ''; - $apps[$x]['menu'][0]['title']['pt-pt'] = 'Chamadas'; - $apps[$x]['menu'][0]['title']['pt-br'] = ''; - $apps[$x]['menu'][0]['uuid'] = ''; - $apps[$x]['menu'][0]['parent_uuid'] = ''; - $apps[$x]['menu'][0]['category'] = 'internal'; - $apps[$x]['menu'][0]['path'] = '/app/calls/calls.php'; - $apps[$x]['menu'][0]['groups'][] = 'user'; - $apps[$x]['menu'][0]['groups'][] = 'admin'; - $apps[$x]['menu'][0]['groups'][] = 'superadmin'; + //$apps[$x]['menu'][0]['title']['en-us'] = 'Calls'; + //$apps[$x]['menu'][0]['title']['es-mx'] = ''; + //$apps[$x]['menu'][0]['title']['de'] = ''; + //$apps[$x]['menu'][0]['title']['de-ch'] = ''; + //$apps[$x]['menu'][0]['title']['de-at'] = ''; + //$apps[$x]['menu'][0]['title']['fr'] = ''; + //$apps[$x]['menu'][0]['title']['fr-ca'] = ''; + //$apps[$x]['menu'][0]['title']['fr-ch'] = ''; + //$apps[$x]['menu'][0]['title']['pt-pt'] = 'Chamadas'; + //$apps[$x]['menu'][0]['title']['pt-br'] = ''; + //$apps[$x]['menu'][0]['uuid'] = ''; + //$apps[$x]['menu'][0]['parent_uuid'] = ''; + //$apps[$x]['menu'][0]['category'] = 'internal'; + //$apps[$x]['menu'][0]['path'] = '/app/calls/calls.php'; + //$apps[$x]['menu'][0]['groups'][] = 'user'; + //$apps[$x]['menu'][0]['groups'][] = 'admin'; + //$apps[$x]['menu'][0]['groups'][] = 'superadmin'; //permission details $apps[$x]['permissions'][1]['name'] = 'follow_me'; diff --git a/app/calls/app_languages.php b/app/calls/app_languages.php index d5a360baee..51a5710795 100644 --- a/app/calls/app_languages.php +++ b/app/calls/app_languages.php @@ -48,11 +48,11 @@ $text['label-ring-5']['en-us'] = 'Ring 5th Number'; $text['label-ring-5']['pt-pt'] = '5º Número a Tocar'; - //$text['label-cid-prefix']['en-us'] = 'CID Prefix'; - //$text['label-cid-prefix']['pt-pt'] = ''; + $text['label-cid-name-prefix']['en-us'] = 'Caller ID Prefix'; + $text['label-cid-name-prefix']['pt-pt'] = ''; - $text['description-cid-prefix']['en-us'] = 'Set the caller ID name prefix.'; - $text['description-cid-prefix']['pt-pt'] = ''; + $text['description-cid-name-prefix']['en-us'] = 'Set the caller ID name prefix.'; + $text['description-cid-name-prefix']['pt-pt'] = ''; $text['label-call-prompt']['en-us'] = 'Call Prompt'; $text['label-call-prompt']['pt-pt'] = ''; diff --git a/app/calls/call_edit.php b/app/calls/call_edit.php index 6e764d6da8..d6a5dd262c 100644 --- a/app/calls/call_edit.php +++ b/app/calls/call_edit.php @@ -93,6 +93,7 @@ else { else { foreach ($result as &$row) { $extension = $row["extension"]; + $accountcode = $row["accountcode"]; $effective_caller_id_name = $row["effective_caller_id_name"]; $effective_caller_id_number = $row["effective_caller_id_number"]; $outbound_caller_id_name = $row["outbound_caller_id_name"]; @@ -117,7 +118,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if (count($_POST)>0) { $forward_all_enabled = check_str($_POST["forward_all_enabled"]); $forward_all_destination = check_str($_POST["forward_all_destination"]); - //$cid_name_prefix = check_str($_POST["cid_name_prefix"]); + $cid_name_prefix = check_str($_POST["cid_name_prefix"]); $call_prompt = check_str($_POST["call_prompt"]); $follow_me_enabled = check_str($_POST["follow_me_enabled"]); @@ -217,6 +218,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $call_forward->domain_uuid = $_SESSION['domain_uuid']; $call_forward->domain_name = $_SESSION['domain_name']; $call_forward->extension_uuid = $extension_uuid; + $call_forward->accountcode = $accountcode; $call_forward->forward_all_destination = $forward_all_destination; $call_forward->forward_all_enabled = $forward_all_enabled; //$call_forward->set(); @@ -253,7 +255,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $follow_me->domain_name = $_SESSION['domain_name']; $follow_me->extension_uuid = $extension_uuid; $follow_me->db_type = $db_type; - //$follow_me->cid_name_prefix = $cid_name_prefix; + $follow_me->cid_name_prefix = $cid_name_prefix; $follow_me->call_prompt = $call_prompt; $follow_me->follow_me_enabled = $follow_me_enabled; @@ -365,7 +367,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { - //$cid_name_prefix = $row["cid_name_prefix"]; + $cid_name_prefix = $row["cid_name_prefix"]; $call_prompt = $row["call_prompt"]; $follow_me_enabled = $row["follow_me_enabled"]; @@ -624,16 +626,18 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; - //echo "\n"; - //echo "\n"; - //echo " ".$text['label-cid-prefix'].":\n"; - //echo "\n"; - //echo "\n"; - //echo " \n"; - //echo "
\n"; - //echo $text['description-cid-prefix']." \n"; - //echo "\n"; - //echo "\n"; + if (permission_exists('follow_me_cid_name_prefix')) { + echo "\n"; + echo "\n"; + echo " ".$text['label-cid-name-prefix'].":\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-cid-name-prefix']." \n"; + echo "\n"; + echo "\n"; + } echo "\n"; echo "\n"; diff --git a/app/calls/resources/classes/switch_follow_me.php b/app/calls/resources/classes/switch_follow_me.php index e21ee5d222..476fc2709e 100644 --- a/app/calls/resources/classes/switch_follow_me.php +++ b/app/calls/resources/classes/switch_follow_me.php @@ -30,7 +30,8 @@ include "root.php"; public $domain_uuid; public $db_type; public $follow_me_uuid; - //public $cid_name_prefix; + public $cid_name_prefix; + public $accountcode; public $call_prompt; public $follow_me_enabled; private $extension; @@ -72,7 +73,7 @@ include "root.php"; $sql .= "("; $sql .= "domain_uuid, "; $sql .= "follow_me_uuid, "; - //$sql .= "cid_name_prefix, "; + $sql .= "cid_name_prefix, "; $sql .= "call_prompt, "; $sql .= "follow_me_enabled "; $sql .= ")"; @@ -80,7 +81,7 @@ include "root.php"; $sql .= "("; $sql .= "'$this->domain_uuid', "; $sql .= "'$this->follow_me_uuid', "; - //$sql .= "'$this->cid_name_prefix', "; + $sql .= "'$this->cid_name_prefix', "; $sql .= "'$this->call_prompt', "; $sql .= "'$this->follow_me_enabled' "; $sql .= ")"; @@ -98,7 +99,7 @@ include "root.php"; //update follow me table $sql = "update v_follow_me set "; $sql .= "follow_me_enabled = '$this->follow_me_enabled', "; - //$sql .= "cid_name_prefix = '$this->cid_name_prefix', "; + $sql .= "cid_name_prefix = '$this->cid_name_prefix', "; $sql .= "call_prompt = '$this->call_prompt' "; $sql .= "where domain_uuid = '$this->domain_uuid' "; $sql .= "and follow_me_uuid = '$this->follow_me_uuid' "; @@ -269,9 +270,9 @@ include "root.php"; $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); if (count($result) > 0) { foreach ($result as &$row) { - //$cid_name_prefix = $row["cid_name_prefix"]; $follow_me_uuid = $row["follow_me_uuid"]; $this->call_prompt = $row["call_prompt"]; + $this->cid_name_prefix = $row["cid_name_prefix"]; } } unset ($prep_statement); @@ -293,9 +294,12 @@ include "root.php"; if ($this->call_prompt == "true") { $dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua"; } - //if (strlen($this->cid_name_prefix) > 0) { - // $dial_string .= ",effective_caller_id_name=".$this->cid_name_prefix."#123"; - //} + if (strlen($this->cid_name_prefix) > 0) { + $dial_string .= ",origination_caller_id_name=".$this->cid_name_prefix."#\${caller_id_name}"; + } + if (strlen($this->accountcode) > 0) { + $dial_string .= ",accountcode=".$this->accountcode."}"; + } $dial_string .= "}"; foreach ($result as &$row) { $dial_string .= "[presence_id=".$row["follow_me_destination"]."@".$_SESSION['domain_name'].","; diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index 28520a1419..ab4c54de30 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -284,7 +284,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "extension, "; $sql .= "number_alias, "; $sql .= "password, "; - //$sql .= "provisioning_list, "; $sql .= "vm_password, "; $sql .= "accountcode, "; $sql .= "effective_caller_id_name, "; @@ -334,7 +333,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "'$extension', "; $sql .= "'$number_alias', "; $sql .= "'$password', "; - //$sql .= "'$provisioning_list', "; $sql .= "'user-choose', "; $sql .= "'$accountcode', "; $sql .= "'$effective_caller_id_name', "; @@ -429,7 +427,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "extension = '$extension', "; $sql .= "number_alias = '$number_alias', "; $sql .= "password = '$password', "; - //$sql .= "provisioning_list = '$provisioning_list', "; $sql .= "vm_password = '$vm_password', "; $sql .= "accountcode = '$accountcode', "; $sql .= "effective_caller_id_name = '$effective_caller_id_name', "; diff --git a/app/follow_me/app_config.php b/app/follow_me/app_config.php index 9a7c438cb3..febbdb73d3 100644 --- a/app/follow_me/app_config.php +++ b/app/follow_me/app_config.php @@ -19,23 +19,23 @@ $apps[$x]['description']['pt-br'] = ''; //menu details - //$apps[$x]['menu'][0]['title']['en-us'] = 'Follow Me'; - //$apps[$x]['menu'][0]['title']['es-mx'] = ''; - //$apps[$x]['menu'][0]['title']['de'] = ''; - //$apps[$x]['menu'][0]['title']['de-ch'] = ''; - //$apps[$x]['menu'][0]['title']['de-at'] = ''; - //$apps[$x]['menu'][0]['title']['fr'] = ''; - //$apps[$x]['menu'][0]['title']['fr-ca'] = ''; - //$apps[$x]['menu'][0]['title']['fr-ch'] = ''; - //$apps[$x]['menu'][0]['title']['pt-pt'] = ''; - //$apps[$x]['menu'][0]['title']['pt-br'] = ''; - //$apps[$x]['menu'][0]['uuid'] = 'a1144e12-873e-4722-9818-02da1adb6ba3'; - //$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5'; - //$apps[$x]['menu'][0]['category'] = 'internal'; - //$apps[$x]['menu'][0]['path'] = '/app/follow_me/follow_me.php'; - //$apps[$x]['menu'][0]['groups'][] = 'user'; - //$apps[$x]['menu'][0]['groups'][] = 'admin'; - //$apps[$x]['menu'][0]['groups'][] = 'superadmin'; + $apps[$x]['menu'][0]['title']['en-us'] = 'Follow Me'; + $apps[$x]['menu'][0]['title']['es-mx'] = ''; + $apps[$x]['menu'][0]['title']['de'] = ''; + $apps[$x]['menu'][0]['title']['de-ch'] = ''; + $apps[$x]['menu'][0]['title']['de-at'] = ''; + $apps[$x]['menu'][0]['title']['fr'] = ''; + $apps[$x]['menu'][0]['title']['fr-ca'] = ''; + $apps[$x]['menu'][0]['title']['fr-ch'] = ''; + $apps[$x]['menu'][0]['title']['pt-pt'] = ''; + $apps[$x]['menu'][0]['title']['pt-br'] = ''; + $apps[$x]['menu'][0]['uuid'] = 'a1144e12-873e-4722-9818-02da1adb6ba3'; + $apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5'; + $apps[$x]['menu'][0]['category'] = 'internal'; + $apps[$x]['menu'][0]['path'] = '/app/calls/calls.php'; + $apps[$x]['menu'][0]['groups'][] = 'user'; + $apps[$x]['menu'][0]['groups'][] = 'admin'; + $apps[$x]['menu'][0]['groups'][] = 'superadmin'; //permission details $y = 0; @@ -57,6 +57,11 @@ $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; $apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; + $apps[$x]['permissions'][$y]['name'] = 'follow_me_cid_name_prefix'; + //$apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; + //$apps[$x]['permissions'][$y]['groups'][] = 'user'; + $y++; //schema details $y = 0; //table array index @@ -74,10 +79,10 @@ $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; $apps[$x]['db'][$y]['fields'][$z]['key'] = 'primary'; $z++; - //$apps[$x]['db'][$y]['fields'][$z]['name'] = 'cid_name_prefix'; - //$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; - //$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = ''; - //$z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'cid_name_prefix'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = ''; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'call_prompt'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';