Skip to content

Commit

Permalink
Guest Link Sharing
Browse files Browse the repository at this point in the history
- Allow links to be emailed to non-contacts by typing their email
- Don't show archived contacts on the dropdown
- Removed unused email send check (handled via queue now)
  • Loading branch information
wrongecho committed Sep 11, 2024
1 parent 2e202df commit 0ad0c2c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
7 changes: 1 addition & 6 deletions ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,7 @@
]
];

$mail = addToMailQueue($mysqli, $data);

if ($mail !== true) {
mysqli_query($mysqli,"INSERT INTO notifications SET notification_type = 'Mail', notification = 'Failed to send email to $item_email'");
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Mail', log_action = 'Error', log_description = 'Failed to send email to $item_email regarding $subject. $item_mail', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
}
addToMailQueue($mysqli, $data);

}

Expand Down
8 changes: 8 additions & 0 deletions js/share_modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ function populateShareModal(client_id, item_type, item_ref_id) {
// Show form and generate button
document.getElementById("div_share_link_form").hidden = false;
document.getElementById("div_share_link_generate").hidden = false;

$(document).ready(function() {
$('#share_email').select2({
tags: true,
placeholder: 'Select or type a value',
allowClear: true
});
});
}

function generateShareLink() {
Expand Down
3 changes: 2 additions & 1 deletion share_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<option value="">-Select a contact-</option>
<?php

$sql_client_contacts_select = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = $client_id AND contact_email <> '' ORDER BY contact_name ASC");
$sql_client_contacts_select = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = $client_id AND contact_email <> '' AND contact_archived_at IS NULL ORDER BY contact_name ASC");
while ($row = mysqli_fetch_array($sql_client_contacts_select)) {
$contact_id_select = intval($row['contact_id']);
$contact_name_select = nullable_htmlentities($row['contact_name']);
Expand Down Expand Up @@ -91,3 +91,4 @@
</div>
</div>
</div>

0 comments on commit 0ad0c2c

Please sign in to comment.