Bläddra i källkod

Add last_mod_date, and last_mod_user to contacts.

Mark Crane 10 år sedan
förälder
incheckning
aee5cb4320
3 ändrade filer med 23 tillägg och 14 borttagningar
  1. 5 4
      app_config.php
  2. 9 3
      contact_edit.php
  3. 9 7
      contact_note_edit.php

+ 5 - 4
app_config.php

@@ -285,13 +285,14 @@
 		$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
 		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the notes.";
 		$z++;
-		$apps[$x]['db'][$y]['fields'][$z]['name'] = "created";
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = "last_mod_date";
 		$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
-		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Date when the contact was created.";
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
 		$z++;
-		$apps[$x]['db'][$y]['fields'][$z]['name'] = "created_by";
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = "last_mod_user";
 		$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
-		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "The user that created the contact.";
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
+		$z++;
 
 		$y = 1; //table array index
 		$apps[$x]['db'][$y]['table'] = "v_contact_addresses";

+ 9 - 3
contact_edit.php

@@ -133,7 +133,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 			$sql .= "contact_category, ";
 			$sql .= "contact_role, ";
 			$sql .= "contact_time_zone, ";
-			$sql .= "contact_note ";
+			$sql .= "contact_note, ";
+			$sql .= "last_mod_date, ";
+			$sql .= "last_mod_user ";
 			$sql .= ") ";
 			$sql .= "values ";
 			$sql .= "( ";
@@ -151,7 +153,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 			$sql .= "'".$contact_category."', ";
 			$sql .= "'".$contact_role."', ";
 			$sql .= "'".$contact_time_zone."', ";
-			$sql .= "'".$contact_note."' ";
+			$sql .= "'".$contact_note."', ";
+			$sql .= "now(), ";
+			$sql .= "'".$_SESSION['username']."' ";
 			$sql .= ")";
 			$db->exec(check_sql($sql));
 			unset($sql);
@@ -216,7 +220,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 			$sql .= "contact_category = '".$contact_category."', ";
 			$sql .= "contact_role = '".$contact_role."', ";
 			$sql .= "contact_time_zone = '".$contact_time_zone."', ";
-			$sql .= "contact_note = '".$contact_note."' ";
+			$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_uuid = '".$contact_uuid."' ";
 			$db->exec(check_sql($sql));

+ 9 - 7
contact_note_edit.php

@@ -47,9 +47,10 @@ else {
 		$action = "add";
 	}
 
-if (strlen($_GET["contact_uuid"]) > 0) {
-	$contact_uuid = check_str($_GET["contact_uuid"]);
-}
+//get the primary id for the contact
+	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) {
@@ -60,10 +61,11 @@ if (strlen($_GET["contact_uuid"]) > 0) {
 
 if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
 
-	$msg = '';
-	if ($action == "update") {
-		$contact_note_uuid = check_str($_POST["contact_note_uuid"]);
-	}
+	//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
 		if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {