From 8f091c6a3c1413f62ec29e3489d1947bf413def2 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sun, 9 Dec 2012 05:09:22 +0000 Subject: [PATCH] Add a contact extension number. --- app/contacts/app_config.php | 7 +++-- app/contacts/contact_phones_edit.php | 44 +++++++++++++++++----------- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/app/contacts/app_config.php b/app/contacts/app_config.php index 592c1604a7..f1cce385cc 100644 --- a/app/contacts/app_config.php +++ b/app/contacts/app_config.php @@ -226,12 +226,15 @@ $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'phone_type'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the telephone type.'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the phone type.'; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = 'phone_number'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the telephone number.'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the phone number.'; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'phone_extension'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the extension.'; $y = 3; //table array index $apps[$x]['db'][$y]['table'] = 'v_contact_notes'; diff --git a/app/contacts/contact_phones_edit.php b/app/contacts/contact_phones_edit.php index 8ea657b46b..6cacc7d1fe 100644 --- a/app/contacts/contact_phones_edit.php +++ b/app/contacts/contact_phones_edit.php @@ -51,6 +51,7 @@ if (strlen($_GET["contact_uuid"]) > 0) { if (count($_POST)>0) { $phone_type = check_str($_POST["phone_type"]); $phone_number = check_str($_POST["phone_number"]); + $phone_extension = check_str($_POST["phone_extension"]); //remove any phone number formatting $phone_number = preg_replace('{\D}', '', $phone_number); @@ -90,7 +91,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "contact_uuid, "; $sql .= "contact_phone_uuid, "; $sql .= "phone_type, "; - $sql .= "phone_number "; + $sql .= "phone_number, "; + $sql .= "phone_extension "; $sql .= ")"; $sql .= "values "; $sql .= "("; @@ -98,7 +100,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "'$contact_uuid', "; $sql .= "'$contact_phone_uuid', "; $sql .= "'$phone_type', "; - $sql .= "'$phone_number' "; + $sql .= "'$phone_number', "; + $sql .= "'$phone_extension' "; $sql .= ")"; $db->exec(check_sql($sql)); unset($sql); @@ -116,7 +119,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql = "update v_contact_phones set "; $sql .= "contact_uuid = '$contact_uuid', "; $sql .= "phone_type = '$phone_type', "; - $sql .= "phone_number = '$phone_number' "; + $sql .= "phone_number = '$phone_number', "; + $sql .= "phone_extension = '$phone_extension' "; $sql .= "where domain_uuid = '$domain_uuid'"; $sql .= "and contact_phone_uuid = '$contact_phone_uuid'"; $db->exec(check_sql($sql)); @@ -136,8 +140,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true") { $contact_phone_uuid = $_GET["id"]; - $sql = ""; - $sql .= "select * from v_contact_phones "; + $sql = "select * from v_contact_phones "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and contact_phone_uuid = '$contact_phone_uuid' "; $prep_statement = $db->prepare(check_sql($sql)); @@ -146,7 +149,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { foreach ($result as &$row) { $phone_type = $row["phone_type"]; $phone_number = $row["phone_number"]; - break; //limit to 1 row + $phone_extension = $row["phone_extension"]; } unset ($prep_statement); } @@ -165,23 +168,18 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "
\n"; echo "\n"; echo "\n"; - if ($action == "add") { - echo "\n"; - } - if ($action == "update") { - echo "\n"; - } + echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo " \n"; echo "
Contacts Phone AddContacts Phone EditContacts Phone
\n"; - echo "Telephone Numbers

\n"; + //echo "Phone Numbers

\n"; echo "
\n"; - echo " Telephone Type.:\n"; + echo " Type.:\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Enter the telephone type.\n"; + echo "Enter the phone type.\n"; echo "
\n"; - echo " Telephone Number:\n"; + echo " Phone Number:\n"; echo "\n"; echo " \n"; echo "
\n"; - echo "Enter the telephone number.\n"; + echo "Enter the phone number.\n"; echo "
\n"; + echo " Extension:\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo "Enter the extension.\n"; + echo "
\n"; echo " \n";