Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Client Access Permissions #1009

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion project_add_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
<select class="form-control select2" name="client_id" required>
<option value="">- Client -</option>
<?php
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL $access_permission_query ORDER BY client_name ASC");
while ($row = mysqli_fetch_array($sql)) {
$client_id = intval($row['client_id']);
$client_name = nullable_htmlentities($row['client_name']);
Expand Down
6 changes: 6 additions & 0 deletions projects.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
$status_query = "IS NULL";
}

// Ticket client access snippet
$project_permission_snippet = '';
if (!empty($client_access_string)) {
$project_permission_snippet = "AND project_client_id IN ($client_access_string)";
}

//Rebuild URL
$url_query_strings_sort = http_build_query($get_copy);
Expand All @@ -33,6 +38,7 @@
AND (project_name LIKE '%$q%' OR project_description LIKE '%$q%' OR user_name LIKE '%$q%')
AND project_archived_at IS NULL
AND project_completed_at $status_query
$project_permission_snippet
ORDER BY $sort $order LIMIT $record_from, $record_to"
);

Expand Down
2 changes: 1 addition & 1 deletion recurring_ticket_add_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<option value="">- Client -</option>
<?php

$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL $access_permission_query ORDER BY client_name ASC");
while ($row = mysqli_fetch_array($sql)) {
$selectable_client_id = intval($row['client_id']);
$client_name = nullable_htmlentities($row['client_name']); ?>
Expand Down
6 changes: 6 additions & 0 deletions recurring_tickets.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

require_once "inc_all.php";

// Ticket client access snippet
$rec_ticket_permission_snippet = '';
if (!empty($client_access_string)) {
$rec_ticket_permission_snippet = "AND scheduled_ticket_client_id IN ($client_access_string)";
}

//Rebuild URL
$url_query_strings_sort = http_build_query($get_copy);
Expand All @@ -16,6 +21,7 @@
"SELECT SQL_CALC_FOUND_ROWS * FROM scheduled_tickets
LEFT JOIN clients on scheduled_ticket_client_id = client_id
WHERE scheduled_tickets.scheduled_ticket_subject LIKE '%$q%'
$rec_ticket_permission_snippet
ORDER BY $sort $order LIMIT $record_from, $record_to"
);

Expand Down
2 changes: 1 addition & 1 deletion ticket_add_from_template_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<option value="">- Client -</option>
<?php

$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL $access_permission_query ORDER BY client_name ASC");
while ($row = mysqli_fetch_array($sql)) {
$client_id = intval($row['client_id']);
$client_name = nullable_htmlentities($row['client_name']); ?>
Expand Down
2 changes: 1 addition & 1 deletion ticket_add_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<option value="">- Client -</option>
<?php

$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL $access_permission_query ORDER BY client_name ASC");
while ($row = mysqli_fetch_array($sql)) {
$client_id = intval($row['client_id']);
$client_name = nullable_htmlentities($row['client_name']); ?>
Expand Down
Loading