diff --git a/app/contacts/contact_time_edit.php b/app/contacts/contact_time_edit.php index cab8a0f4fa..5055f73aec 100644 --- a/app/contacts/contact_time_edit.php +++ b/app/contacts/contact_time_edit.php @@ -97,7 +97,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= ") "; $sql .= "values "; $sql .= "( "; - $sql .= "'".$_SESSION['domain_uuid']."', "; + $sql .= "'".$domain_uuid."', "; $sql .= "'".$contact_time_uuid."', "; $sql .= "'".$contact_uuid."', "; $sql .= "'".$_SESSION["user"]["user_uuid"]."', "; @@ -121,7 +121,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "time_description = '".$time_description."' "; $sql .= "where "; $sql .= "contact_time_uuid = '".$contact_time_uuid."' "; - $sql .= "and domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and domain_uuid = '".$domain_uuid."' "; $sql .= "and contact_uuid = '".$contact_uuid."' "; $sql .= "and user_uuid = '".$_SESSION["user"]["user_uuid"]."' "; $db->exec(check_sql($sql)); @@ -140,11 +140,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql = "select ct.*, u.username "; $sql .= "from v_contact_times as ct, v_users as u "; $sql .= "where ct.user_uuid = u.user_uuid "; - $sql .= "and ct.domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and u.domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and ct.domain_uuid = '".$domain_uuid."' "; $sql .= "and ct.contact_uuid = '".$contact_uuid."' "; + $sql .= "and ct.user_uuid = '".$_SESSION["user"]["user_uuid"]."' "; $sql .= "and contact_time_uuid = '".$contact_time_uuid."' "; - $sql .= "order by ct.time_start desc "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetch(PDO::FETCH_NAMED); diff --git a/app/contacts/contact_times.php b/app/contacts/contact_times.php index 2849c18064..619cfc454c 100644 --- a/app/contacts/contact_times.php +++ b/app/contacts/contact_times.php @@ -43,11 +43,10 @@ else { echo "\n"; //get the contact list - $sql = "select ct.*, u.username "; + $sql = "select ct.*, u.username, u.domain_uuid as user_domain_uuid "; $sql .= "from v_contact_times as ct, v_users as u "; $sql .= "where ct.user_uuid = u.user_uuid "; $sql .= "and ct.domain_uuid = '".$domain_uuid."' "; - $sql .= "and u.domain_uuid = '".$domain_uuid."' "; $sql .= "and ct.contact_uuid = '".$contact_uuid."' "; $sql .= "order by ct.time_start desc "; $prep_statement = $db->prepare(check_sql($sql)); @@ -83,9 +82,7 @@ else { echo "
| ".$row["username"]." | \n"; + echo "".$row["username"]." | \n"; echo "".$time_start." | \n"; echo "".$time." | \n"; echo " \n"; echo ""; if (permission_exists('contact_time_edit')) { - echo "$v_link_label_edit"; + if ($row['user_uuid'] == $_SESSION["user"]["user_uuid"]) { + echo "".$v_link_label_edit.""; + } + else { + echo "".str_replace("list_control_icon", "list_control_icon_disabled", $v_link_label_edit).""; + } } if (permission_exists('contact_time_delete')) { - echo "$v_link_label_delete"; + if ($row['user_uuid'] == $_SESSION["user"]["user_uuid"]) { + echo "".$v_link_label_delete.""; + } + else { + echo "".str_replace("list_control_icon", "list_control_icon_disabled", $v_link_label_delete).""; + } } echo " | \n"; echo "