+
+
+
@@ -490,12 +475,10 @@ ob_start();
diff --git a/agent/modals/asset/asset_documents.php b/agent/modals/asset/asset_documents.php
deleted file mode 100644
index 410dfe2c0..000000000
--- a/agent/modals/asset/asset_documents.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
diff --git a/agent/modals/contact/contact.php b/agent/modals/contact/contact.php
index c294fc106..3de111d65 100644
--- a/agent/modals/contact/contact.php
+++ b/agent/modals/contact/contact.php
@@ -124,24 +124,12 @@ $sql_linked_software = mysqli_query($mysqli, "SELECT software.software_id, softw
$software_count = mysqli_num_rows($sql_linked_software);
// Documents
-$sql_linked_documents = mysqli_query($mysqli, "SELECT documents.document_id, document_name, document_created_at, document_updated_at
- FROM contact_documents
- JOIN documents ON documents.document_id = contact_documents.document_id
- WHERE contact_documents.contact_id = $contact_id
- AND document_archived_at IS NULL
- ORDER BY document_name ASC"
-);
-$document_count = mysqli_num_rows($sql_linked_documents);
+$linked_documents = linkedRecords('contact', $contact_id, 'document');
+$document_count = count($linked_documents);
// Files
-$sql_linked_files = mysqli_query($mysqli, "SELECT files.file_id, file_name, file_ext, file_created_at
- FROM contact_files
- JOIN files ON files.file_id = contact_files.file_id
- WHERE contact_files.contact_id = $contact_id
- AND file_archived_at IS NULL
- ORDER BY file_name ASC"
-);
-$file_count = mysqli_num_rows($sql_linked_files);
+$linked_files = linkedRecords('contact', $contact_id, 'file');
+$file_count = count($linked_files);
// Notes
$sql_related_notes = mysqli_query($mysqli, "SELECT contact_note, contact_note_created_at, contact_note_type, user_name FROM contact_notes
@@ -399,13 +387,10 @@ ob_start();
@@ -413,12 +398,10 @@ ob_start();
diff --git a/agent/modals/service/service.php b/agent/modals/service/service.php
index 2c686be0a..c54b26353 100644
--- a/agent/modals/service/service.php
+++ b/agent/modals/service/service.php
@@ -89,9 +89,11 @@ $sql_contacts = mysqli_query(
// Associated Documents
$sql_docs = mysqli_query(
$mysqli,
- "SELECT documents.document_id, document_name FROM service_documents
- LEFT JOIN documents ON service_documents.document_id = documents.document_id
- WHERE service_id = $service_id"
+ "SELECT documents.document_id AS id, document_name AS name, document_description, document_created_at, document_updated_at
+ FROM service_documents
+ JOIN documents ON service_documents.document_id = documents.document_id
+ WHERE service_id = $service_id AND document_archived_at IS NULL
+ ORDER BY document_name ASC"
);
ob_start();
@@ -297,12 +299,11 @@ ob_start();
0) {
- echo "
Documents
";
+ // The same rows as a document's Linked card
+ echo "Documents
";
mysqli_data_seek($sql_docs, 0);
while ($row = mysqli_fetch_assoc($sql_docs)) {
- $document_id = intval($row['document_id']);
- $document_name = escapeHtml($row['document_name']);
- echo "- $document_name
";
+ echo '- ' . linkRowHtml('document', $row, $client_id) . '
';
}
echo "
";
}
diff --git a/agent/modals/service/service_add.php b/agent/modals/service/service_add.php
index d332fb772..90dcf4cd5 100644
--- a/agent/modals/service/service_add.php
+++ b/agent/modals/service/service_add.php
@@ -152,11 +152,11 @@ ob_start();
diff --git a/agent/modals/service/service_edit.php b/agent/modals/service/service_edit.php
index ea92ecc3f..5665ed797 100644
--- a/agent/modals/service/service_edit.php
+++ b/agent/modals/service/service_edit.php
@@ -224,18 +224,12 @@ ob_start();
$document_name";
- }
- else{
- echo "";
- }
-
+ $document_selected = in_array($document_id, $selected_ids) ? ' selected' : '';
+ echo "";
}
?>
diff --git a/agent/quote.php b/agent/quote.php
index a90f2e5de..e45fc92d8 100644
--- a/agent/quote.php
+++ b/agent/quote.php
@@ -133,7 +133,7 @@ if (isset($_GET['quote_id'])) {
// Quote File Attachments
$sql_quote_files = mysqli_query(
$mysqli,
- "SELECT file_reference_name, file_name, file_created_at FROM quote_files LEFT JOIN files ON quote_files.file_id = files.file_id WHERE quote_id = $quote_id"
+ "SELECT files.file_id, file_name, file_ext, file_size, file_created_at FROM quote_files JOIN files ON quote_files.file_id = files.file_id WHERE quote_id = $quote_id AND file_archived_at IS NULL ORDER BY file_name ASC"
);
?>
@@ -526,30 +526,31 @@ if (isset($_GET['quote_id'])) {