Order contacts by last modified date by default.

This commit is contained in:
markjcrane 2015-10-20 01:39:54 -06:00
parent 8e2dcddbaf
commit 7a776fadb8
10 changed files with 916 additions and 807 deletions

View File

@ -48,9 +48,10 @@ else {
$action = "add";
}
if (strlen($_GET["contact_uuid"]) > 0) {
//get the contact uuid
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
@ -73,14 +74,16 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$address_label = ($address_label_custom != '') ? $address_label_custom : $address_label;
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
//set the uuid
if ($action == "update") {
$contact_address_uuid = check_str($_POST["contact_address_uuid"]);
}
//check for all required data
$msg = '';
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
@ -97,6 +100,15 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//update last modified
$sql = "update v_contacts set ";
$sql .= "last_mod_date = now(), ";
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
//if primary, unmark other primary numbers
if ($address_primary) {
$sql = "update v_contact_addresses set address_primary = 0 ";
@ -180,7 +192,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -79,14 +79,16 @@ else {
$contact_note = check_str($_POST["contact_note"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
//set the uuid
if ($action == "update") {
$contact_uuid = check_str($_POST["contact_uuid"]);
}
//check for all required data
$msg = '';
//if (strlen($contact_type) == 0) { $msg .= $text['message-required'].$text['label-contact_type']."<br>\n"; }
//if (strlen($contact_organization) == 0) { $msg .= $text['message-required'].$text['label-contact_organization']."<br>\n"; }
//if (strlen($contact_name_prefix) == 0) { $msg .= $text['message-required'].$text['label-contact_name_prefix']."<br>\n"; }
@ -115,6 +117,15 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//update last modified
$sql = "update v_contacts set ";
$sql .= "last_mod_date = now(), ";
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
if ($action == "add") {
$contact_uuid = uuid();
$sql = "insert into v_contacts ";
@ -243,7 +254,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
return;
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {

View File

@ -64,14 +64,16 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$email_label = ($email_label_custom != '') ? $email_label_custom : $email_label;
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
//set the uuid
if ($action == "update") {
$contact_email_uuid = check_str($_POST["contact_email_uuid"]);
}
//check for all required data
$msg = '';
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
@ -88,6 +90,15 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//update last modified
$sql = "update v_contacts set ";
$sql .= "last_mod_date = now(), ";
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
//if primary, unmark other primary numbers
if ($email_primary) {
$sql = "update v_contact_emails set email_primary = 0 ";
@ -144,7 +155,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -59,15 +59,16 @@ else {
$last_mod_user = check_str($_POST["last_mod_user"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//get the primary id for the contact note
$msg = '';
if ($action == "update") {
$contact_note_uuid = check_str($_POST["contact_note_uuid"]);
}
//check for all required data
$msg = '';
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
@ -83,6 +84,16 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//update last modified
$sql = "update v_contacts set ";
$sql .= "last_mod_date = now(), ";
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
//add the note
if ($action == "add") {
$contact_note_uuid = uuid();
$sql = "insert into v_contact_notes ";
@ -111,6 +122,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
return;
} //if ($action == "add")
//update the note
if ($action == "update") {
$sql = "update v_contact_notes set ";
$sql .= "contact_uuid = '$contact_uuid', ";
@ -127,7 +139,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -72,14 +72,16 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$phone_label = ($phone_label_custom != '') ? $phone_label_custom : $phone_label;
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
//set thge uuid
if ($action == "update") {
$contact_phone_uuid = check_str($_POST["contact_phone_uuid"]);
}
//check for all required data
$msg = '';
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
@ -96,6 +98,15 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//update last modified
$sql = "update v_contacts set ";
$sql .= "last_mod_date = now(), ";
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
//if primary, unmark other primary numbers
if ($phone_primary) {
$sql = "update v_contact_phones set phone_primary = 0 ";
@ -167,7 +178,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -48,9 +48,10 @@ else {
$action = "add";
}
if (strlen($_GET["contact_uuid"]) > 0) {
//get the contact uuid
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
@ -66,14 +67,16 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$relation_reciprocal_label = ($relation_reciprocal_label_custom != '') ? $relation_reciprocal_label_custom : $relation_reciprocal_label;
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
//set the uuid
if ($action == "update") {
$contact_relation_uuid = check_str($_POST["contact_relation_uuid"]);
}
//check for all required data
$msg = '';
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
@ -90,6 +93,15 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//update last modified
$sql = "update v_contacts set ";
$sql .= "last_mod_date = now(), ";
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
if ($action == "add") {
$contact_relation_uuid = uuid();
$sql = "insert into v_contact_relations ";
@ -152,7 +164,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {

View File

@ -48,10 +48,13 @@ else {
$action = "add";
}
if (strlen($_GET["contact_uuid"]) > 0) {
//get the contact uuid
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
$domain_uuid = $_SESSION['domain_uuid'];
}
//set the session domain uuid as a variable
$domain_uuid = $_SESSION['domain_uuid'];
//get http post variables and set them to php variables
if (count($_POST) > 0) {
@ -64,14 +67,16 @@ $domain_uuid = $_SESSION['domain_uuid'];
$contact_setting_description = check_str($_POST["contact_setting_description"]);
}
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
//set the uuid
if ($action == "update") {
$contact_setting_uuid = check_str($_POST["contact_setting_uuid"]);
}
//check for all required data
$msg = '';
//if (strlen($domain_setting_category) == 0) { $msg .= $text['message-required'].$text['label-category']."<br>\n"; }
//if (strlen($domain_setting_subcategory) == 0) { $msg .= $text['message-required'].$text['label-subcategory']."<br>\n"; }
//if (strlen($domain_setting_name) == 0) { $msg .= $text['message-required'].$text['label-type']."<br>\n"; }
@ -94,8 +99,19 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//set the order
$contact_setting_order = ($contact_setting_order != '') ? $contact_setting_order : 'null';
//update last modified
$sql = "update v_contacts set ";
$sql .= "last_mod_date = now(), ";
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
//add the domain
if ($action == "add" && permission_exists('domain_setting_add')) {
$sql = "insert into v_contact_settings ";
@ -154,7 +170,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -47,9 +47,10 @@ else {
$action = "add";
}
if (strlen($_GET["contact_uuid"]) > 0) {
//get the contact uuid
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
@ -58,14 +59,16 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$time_description = check_str($_POST["time_description"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
//set the uuid
if ($action == "update") {
$contact_time_uuid = check_str($_POST["contact_time_uuid"]);
}
//check for all required data
$msg = '';
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
@ -82,6 +85,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//update last modified
$sql = "update v_contacts set ";
$sql .= "last_mod_date = now(), ";
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
if ($action == "add") {
$contact_time_uuid = uuid();
@ -132,7 +143,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -48,12 +48,13 @@ else {
$action = "add";
}
if (strlen($_GET["contact_uuid"]) > 0) {
//get the contact uuid
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
if (count($_POST) > 0) {
$url_label = check_str($_POST["url_label"]);
$url_label_custom = check_str($_POST["url_label_custom"]);
$url_address = check_str($_POST["url_address"]);
@ -64,14 +65,16 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$url_label = ($url_label_custom != '') ? $url_label_custom : $url_label;
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//process the form data
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
//set the uuid
if ($action == "update") {
$contact_url_uuid = check_str($_POST["contact_url_uuid"]);
}
//check for all required data
$msg = '';
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
@ -88,6 +91,15 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//update last modified
$sql = "update v_contacts set ";
$sql .= "last_mod_date = now(), ";
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
//if primary, unmark other primary numbers
if ($url_primary) {
$sql = "update v_contact_urls set url_primary = 0 ";
@ -144,7 +156,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2013
Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
@ -55,7 +55,8 @@ else {
foreach ($_SESSION['groups'] as $group_data) {
$user_group_uuids[] = $group_data['group_uuid'];
}
//add user's uuid to group uuid list to include private (non-shared) contacts
//add user's uuid to group uuid list to include private (non-shared) contacts
$user_group_uuids[] = $_SESSION["user_uuid"];
//get contact sync sources
@ -177,7 +178,7 @@ else {
$sql .= "order by ".$order_by." ".$order." ";
}
else {
$sql .= "order by contact_organization desc, contact_name_given asc, contact_name_family asc ";
$sql .= "order by last_mod_date desc ";
}
$sql .= "limit ".$rows_per_page." offset ".$offset." ";
$prep_statement = $db->prepare(check_sql($sql));