Order contacts by last modified date by default.
This commit is contained in:
@@ -59,75 +59,87 @@ 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"]);
|
||||
}
|
||||
//get the primary id for the contact note
|
||||
if ($action == "update") {
|
||||
$contact_note_uuid = check_str($_POST["contact_note_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/persist_form_var.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
}
|
||||
//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";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add") {
|
||||
$contact_note_uuid = uuid();
|
||||
$sql = "insert into v_contact_notes ";
|
||||
$sql .= "(";
|
||||
$sql .= "contact_note_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "contact_note, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "last_mod_date, ";
|
||||
$sql .= "last_mod_user ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$contact_note_uuid', ";
|
||||
$sql .= "'$contact_uuid', ";
|
||||
$sql .= "'$contact_note', ";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "now(), ";
|
||||
$sql .= "'".$_SESSION['username']."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
//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);
|
||||
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
//add the note
|
||||
if ($action == "add") {
|
||||
$contact_note_uuid = uuid();
|
||||
$sql = "insert into v_contact_notes ";
|
||||
$sql .= "(";
|
||||
$sql .= "contact_note_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "contact_note, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "last_mod_date, ";
|
||||
$sql .= "last_mod_user ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$contact_note_uuid', ";
|
||||
$sql .= "'$contact_uuid', ";
|
||||
$sql .= "'$contact_note', ";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "now(), ";
|
||||
$sql .= "'".$_SESSION['username']."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_notes set ";
|
||||
$sql .= "contact_uuid = '$contact_uuid', ";
|
||||
$sql .= "contact_note = '$contact_note', ";
|
||||
$sql .= "last_mod_date = now(), ";
|
||||
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and contact_note_uuid = '$contact_note_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
//update the note
|
||||
if ($action == "update") {
|
||||
$sql = "update v_contact_notes set ";
|
||||
$sql .= "contact_uuid = '$contact_uuid', ";
|
||||
$sql .= "contact_note = '$contact_note', ";
|
||||
$sql .= "last_mod_date = now(), ";
|
||||
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and contact_note_uuid = '$contact_note_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
|
||||
Reference in New Issue
Block a user