mirror of
https://github.com/itflow-org/itflow
synced 2026-11-21 11:57:25 +00:00
Link opens the standard picker under the button instead of a window - linked records ticked, tick to link and untick to unlink, saved when the picker closes with one message - for every record link, contact and asset credentials, a contact's assets, project and service tickets, a ticket's services and related tickets, with a document's or file's Link grouped by kind and quick looks reloading in place; the old link windows and the handlers only they used are removed
This commit is contained in:
@@ -97,6 +97,36 @@ if (isset($_GET['certificate_check'])) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Link picker (js/link_picker.js, functions/link_picker.php) - replaces the
|
||||
* Link windows. GET what a record can be linked to, the linked ones ticked;
|
||||
* POST what was ticked and unticked, as the picker closes. With flash=1 the
|
||||
* message is kept for the page the picker reloads, as a post handler's is.
|
||||
*/
|
||||
if (isset($_GET['link_picker'])) {
|
||||
header('Content-Type: application/json');
|
||||
$answer = linkPickerOptions((string) ($_GET['from'] ?? ''), intval($_GET['id'] ?? 0), (string) ($_GET['to'] ?? ''));
|
||||
if (isset($answer['error'])) {
|
||||
http_response_code(403);
|
||||
}
|
||||
echo json_encode($answer);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['link_picker_save'])) {
|
||||
validateCSRFToken();
|
||||
header('Content-Type: application/json');
|
||||
$answer = linkPickerSave((string) ($_POST['from'] ?? ''), intval($_POST['id'] ?? 0), (string) ($_POST['to'] ?? ''),
|
||||
(array) ($_POST['add'] ?? []), (array) ($_POST['remove'] ?? []));
|
||||
if (isset($answer['error'])) {
|
||||
http_response_code(403);
|
||||
} elseif (!empty($_POST['flash'])) {
|
||||
flashAlert($answer['message'], $answer['type']);
|
||||
}
|
||||
echo json_encode($answer);
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Tag picker (js/tag_picker.js) - replaces the "Assign Tags" modals.
|
||||
*
|
||||
|
||||
@@ -362,23 +362,13 @@ if (mysqli_num_rows($sql) == 0) {
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown"><i class="fas fa-link me-2"></i>Link</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/link/link.php?from=asset&id=<?= $asset_id ?>&to=software">
|
||||
<i class="fa fa-fw fa-cube text-secondary me-2"></i>License
|
||||
</a>
|
||||
<?= linkPickerButton('asset', $asset_id, 'software', 'License', 'dropdown-item', 'fa fa-fw fa-cube text-secondary me-2') ?>
|
||||
<?php if ($can_credentials_edit) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/asset/asset_link_credential.php?id=<?= $asset_id ?>">
|
||||
<i class="fa fa-fw fa-key text-secondary me-2"></i>Credential
|
||||
</a>
|
||||
<?= linkPickerButton('asset', $asset_id, 'credential', 'Credential', 'dropdown-item', 'fa fa-fw fa-key text-secondary me-2') ?>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/asset/asset_link_service.php?id=<?= $asset_id ?>">
|
||||
<i class="fa fa-fw fa-stream text-secondary me-2"></i>Service
|
||||
</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/asset/asset_link_document.php?id=<?= $asset_id ?>">
|
||||
<i class="fa fa-fw fa-file-alt text-secondary me-2"></i>Document
|
||||
</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/asset/asset_link_file.php?id=<?= $asset_id ?>">
|
||||
<i class="fa fa-fw fa-paperclip text-secondary me-2"></i>File
|
||||
</a>
|
||||
<?= linkPickerButton('asset', $asset_id, 'service', 'Service', 'dropdown-item', 'fa fa-fw fa-stream text-secondary me-2') ?>
|
||||
<?= linkPickerButton('asset', $asset_id, 'document', 'Document', 'dropdown-item', 'fa fa-fw fa-file-alt text-secondary me-2') ?>
|
||||
<?= linkPickerButton('asset', $asset_id, 'file', 'File', 'dropdown-item', 'fa fa-fw fa-paperclip text-secondary me-2') ?>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn btn-outline-secondary ajax-modal" data-modal-size="lg" data-modal-url="modals/asset/asset_edit.php?id=<?= $asset_id ?>">
|
||||
@@ -907,9 +897,7 @@ if (mysqli_num_rows($sql) == 0) {
|
||||
<span class="text-body-secondary small">Logins for this asset. Passwords and codes are fetched only when you ask for them.</span>
|
||||
<?php if ($can_edit && $can_credentials_edit) { ?>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="modals/asset/asset_link_credential.php?id=<?= $asset_id ?>">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('asset', $asset_id, 'credential', 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<button type="button" class="btn btn-sm btn-primary ajax-modal" data-modal-size="lg" data-modal-url="modals/credential/credential_add.php?<?= $client_url ?>asset_id=<?= $asset_id ?>">
|
||||
<i class="fas fa-plus me-2"></i>New Credential
|
||||
</button>
|
||||
@@ -1027,9 +1015,7 @@ if (mysqli_num_rows($sql) == 0) {
|
||||
<span class="text-body-secondary small">Licenses this asset holds a seat on, and the key to install.</span>
|
||||
<?php if ($can_edit) { ?>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="modals/link/link.php?from=asset&id=<?= $asset_id ?>&to=software">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('asset', $asset_id, 'software', 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<button type="button" class="btn btn-sm btn-primary ajax-modal" data-modal-size="lg" data-modal-url="modals/software/software_add.php?client_id=<?= $client_id ?>&asset_id=<?= $asset_id ?>">
|
||||
<i class="fas fa-plus me-2"></i>New License
|
||||
</button>
|
||||
@@ -1049,9 +1035,7 @@ if (mysqli_num_rows($sql) == 0) {
|
||||
<span class="text-body-secondary small">Runbooks, configs and how-tos for this asset.</span>
|
||||
<?php if ($can_edit) { ?>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="modals/asset/asset_link_document.php?id=<?= $asset_id ?>">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('asset', $asset_id, 'document', 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<button type="button" class="btn btn-sm btn-primary ajax-modal" data-modal-size="xl" data-modal-url="modals/document/document_add.php?<?= $client_url ?>&asset_id=<?= $asset_id ?>">
|
||||
<i class="fas fa-plus me-2"></i>New Document
|
||||
</button>
|
||||
@@ -1111,9 +1095,7 @@ if (mysqli_num_rows($sql) == 0) {
|
||||
<span class="text-body-secondary small">Configs, photos, invoices, exports.</span>
|
||||
<?php if ($can_edit) { ?>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="modals/asset/asset_link_file.php?id=<?= $asset_id ?>">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('asset', $asset_id, 'file', 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<button type="button" class="btn btn-sm btn-primary ajax-modal" data-modal-url="modals/file/file_upload.php?<?= $client_url ?>&asset_id=<?= $asset_id ?>">
|
||||
<i class="fas fa-upload me-2"></i>Upload
|
||||
</button>
|
||||
@@ -1169,9 +1151,7 @@ if (mysqli_num_rows($sql) == 0) {
|
||||
<div class="itflow-asset-pane-bar">
|
||||
<span class="text-body-secondary small">Services that run on it - when it is down, so are they.</span>
|
||||
<?php if ($can_edit) { ?>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="modals/asset/asset_link_service.php?id=<?= $asset_id ?>">
|
||||
<i class="fas fa-link me-2"></i>Link Service
|
||||
</button>
|
||||
<?= linkPickerButton('asset', $asset_id, 'service', 'Link Service', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php if ($service_count) { ?>
|
||||
|
||||
@@ -293,30 +293,18 @@ if (!$can_support) {
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown"><i class="fas fa-link me-2"></i>Link</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/contact/contact_link_asset.php?id=<?= $contact_id ?>">
|
||||
<i class="fa fa-fw fa-desktop text-secondary me-2"></i>Asset
|
||||
</a>
|
||||
<?= linkPickerButton('contact', $contact_id, 'asset', 'Asset', 'dropdown-item', 'fa fa-fw fa-desktop text-secondary me-2') ?>
|
||||
<?php if ($can_credentials_edit) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/contact/contact_link_credential.php?id=<?= $contact_id ?>">
|
||||
<i class="fa fa-fw fa-key text-secondary me-2"></i>Credential
|
||||
</a>
|
||||
<?= linkPickerButton('contact', $contact_id, 'credential', 'Credential', 'dropdown-item', 'fa fa-fw fa-key text-secondary me-2') ?>
|
||||
<?php } ?>
|
||||
<?php if ($can_support_edit) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/link/link.php?from=contact&id=<?= $contact_id ?>&to=software">
|
||||
<i class="fa fa-fw fa-cube text-secondary me-2"></i>License
|
||||
</a>
|
||||
<?= linkPickerButton('contact', $contact_id, 'software', 'License', 'dropdown-item', 'fa fa-fw fa-cube text-secondary me-2') ?>
|
||||
<?php } ?>
|
||||
<?php if ($can_support_edit) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/contact/contact_link_service.php?id=<?= $contact_id ?>">
|
||||
<i class="fa fa-fw fa-stream text-secondary me-2"></i>Service
|
||||
</a>
|
||||
<?= linkPickerButton('contact', $contact_id, 'service', 'Service', 'dropdown-item', 'fa fa-fw fa-stream text-secondary me-2') ?>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/contact/contact_link_document.php?id=<?= $contact_id ?>">
|
||||
<i class="fa fa-fw fa-file-alt text-secondary me-2"></i>Document
|
||||
</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/contact/contact_link_file.php?id=<?= $contact_id ?>">
|
||||
<i class="fa fa-fw fa-paperclip text-secondary me-2"></i>File
|
||||
</a>
|
||||
<?= linkPickerButton('contact', $contact_id, 'document', 'Document', 'dropdown-item', 'fa fa-fw fa-file-alt text-secondary me-2') ?>
|
||||
<?= linkPickerButton('contact', $contact_id, 'file', 'File', 'dropdown-item', 'fa fa-fw fa-paperclip text-secondary me-2') ?>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn btn-outline-secondary ajax-modal" data-modal-size="lg" data-modal-url="modals/contact/contact_edit.php?id=<?= $contact_id ?>">
|
||||
@@ -513,9 +501,7 @@ if (!$can_support) {
|
||||
<span class="text-body-secondary small">Assets assigned to <?= $contact_name ?>.</span>
|
||||
<?php if ($can_edit) { ?>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="modals/contact/contact_link_asset.php?id=<?= $contact_id ?>">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('contact', $contact_id, 'asset', 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<?php if ($can_support_edit) { ?>
|
||||
<button type="button" class="btn btn-sm btn-primary ajax-modal" data-modal-size="lg" data-modal-url="modals/asset/asset_add.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>">
|
||||
<i class="fas fa-plus me-2"></i>New Asset
|
||||
@@ -594,9 +580,7 @@ if (!$can_support) {
|
||||
<span class="text-body-secondary small">Their logins. Passwords and codes are fetched only when you ask for them.</span>
|
||||
<?php if ($can_edit && $can_credentials_edit) { ?>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="modals/contact/contact_link_credential.php?id=<?= $contact_id ?>">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('contact', $contact_id, 'credential', 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<button type="button" class="btn btn-sm btn-primary ajax-modal" data-modal-size="lg" data-modal-url="modals/credential/credential_add.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>">
|
||||
<i class="fas fa-plus me-2"></i>New Credential
|
||||
</button>
|
||||
@@ -703,9 +687,7 @@ if (!$can_support) {
|
||||
<span class="text-body-secondary small">Licenses they hold a seat on, and the key they were given.</span>
|
||||
<?php if ($can_support_edit) { ?>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="modals/link/link.php?from=contact&id=<?= $contact_id ?>&to=software">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('contact', $contact_id, 'software', 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<button type="button" class="btn btn-sm btn-primary ajax-modal" data-modal-size="lg" data-modal-url="modals/software/software_add.php?client_id=<?= $client_id ?>&contact_id=<?= $contact_id ?>">
|
||||
<i class="fas fa-plus me-2"></i>New License
|
||||
</button>
|
||||
@@ -727,9 +709,7 @@ if (!$can_support) {
|
||||
<span class="text-body-secondary small">Documentation about or for them.</span>
|
||||
<?php if ($can_edit) { ?>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="modals/contact/contact_link_document.php?id=<?= $contact_id ?>">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('contact', $contact_id, 'document', 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<?php if ($can_support_edit) { ?>
|
||||
<button type="button" class="btn btn-sm btn-primary ajax-modal" data-modal-size="xl" data-modal-url="modals/document/document_add.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>">
|
||||
<i class="fas fa-plus me-2"></i>New Document
|
||||
@@ -768,9 +748,7 @@ if (!$can_support) {
|
||||
<span class="text-body-secondary small">Files linked to them.</span>
|
||||
<?php if ($can_edit) { ?>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="modals/contact/contact_link_file.php?id=<?= $contact_id ?>">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('contact', $contact_id, 'file', 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<?php if ($can_support_edit) { ?>
|
||||
<button type="button" class="btn btn-sm btn-primary ajax-modal" data-modal-url="modals/file/file_upload.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>">
|
||||
<i class="fas fa-upload me-2"></i>Upload
|
||||
@@ -806,9 +784,7 @@ if (!$can_support) {
|
||||
<div class="itflow-asset-pane-bar">
|
||||
<span class="text-body-secondary small">Services they own or are the contact for at the client.</span>
|
||||
<?php if ($can_support_edit) { ?>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="modals/contact/contact_link_service.php?id=<?= $contact_id ?>">
|
||||
<i class="fas fa-link me-2"></i>Link Service
|
||||
</button>
|
||||
<?= linkPickerButton('contact', $contact_id, 'service', 'Link Service', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php if ($service_count) { ?>
|
||||
|
||||
@@ -134,7 +134,7 @@ $page_title = $row['document_name'];
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/document/document_rename.php?id=<?= $document_id ?>"><i class="fas fa-fw fa-pen me-2"></i>Rename</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/document/document_move.php?id=<?= $document_id ?>"><i class="fas fa-fw fa-folder-open me-2"></i>Move</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/document/document_copy.php?id=<?= $document_id ?>" title="For this client or another"><i class="fas fa-fw fa-copy me-2"></i>Copy</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/link/link.php?from=document&id=<?= $document_id ?>"><i class="fas fa-fw fa-link me-2"></i>Link</a>
|
||||
<?= linkPickerButton('document', $document_id, '', 'Link', 'dropdown-item', 'fas fa-fw fa-link me-2') ?>
|
||||
<a class="dropdown-item" href="post.php?toggle_document_favorite=<?= $document_id ?>&csrf_token=<?= $csrf ?>" title="Favorites show on the client's overview"><i class="<?= intval($row['document_favorite']) ? 'far' : 'fas' ?> fa-fw fa-star me-2"></i><?= intval($row['document_favorite']) ? 'Unfavorite' : 'Favorite' ?></a>
|
||||
<?php if ($config_client_portal_enable) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/document/document_edit_visibility.php?document_id=<?= $document_id ?>"><i class="fas fa-fw fa-eye<?= $document_visible ? '-slash' : '' ?> me-2"></i><?= $document_visible ? 'Hide from' : 'Show in' ?> client portal</a>
|
||||
@@ -205,7 +205,7 @@ $page_title = $row['document_name'];
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<h3 class="card-title mb-0 me-auto"><i class="fas fa-fw fa-link me-2 text-body-secondary"></i>Linked</h3>
|
||||
<?php if ($can_edit && !$document_archived) { ?>
|
||||
<a class="small ajax-modal" href="#" data-modal-url="modals/link/link.php?from=document&id=<?= $document_id ?>"><i class="fas fa-plus me-1"></i>Link</a>
|
||||
<?= linkPickerButton('document', $document_id, '', 'Link', 'small', 'fas fa-plus me-1') ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
@@ -244,7 +244,7 @@ function filesItemMenu($item) {
|
||||
$html .= '<div class="dropdown-divider"></div>';
|
||||
$html .= "<a class=\"dropdown-item ajax-modal\" href=\"#\" data-modal-url=\"modals/file/file_rename.php?id=$id\"><i class=\"fas fa-fw fa-pen me-2\"></i>Rename</a>";
|
||||
$html .= "<a class=\"dropdown-item ajax-modal\" href=\"#\" data-modal-url=\"modals/file/file_move.php?id=$id\"><i class=\"fas fa-fw fa-folder-open me-2\"></i>Move</a>";
|
||||
$html .= "<a class=\"dropdown-item ajax-modal\" href=\"#\" data-modal-url=\"modals/link/link.php?from=file&id=$id\"><i class=\"fas fa-fw fa-link me-2\"></i>Link</a>";
|
||||
$html .= linkPickerButton('file', $id, '', 'Link', 'dropdown-item', 'fas fa-fw fa-link me-2');
|
||||
}
|
||||
$archive_name = 'file';
|
||||
} else {
|
||||
@@ -262,7 +262,7 @@ function filesItemMenu($item) {
|
||||
$favorite = !empty($item['row']['document_favorite']);
|
||||
$html .= "<a class=\"dropdown-item\" href=\"post.php?toggle_document_favorite=$id&csrf_token=$csrf\" title=\"Favorites show on the client's overview\"><i class=\"" . ($favorite ? 'far' : 'fas') . " fa-fw fa-star me-2\"></i>" . ($favorite ? 'Unfavorite' : 'Favorite') . "</a>";
|
||||
$html .= "<a class=\"dropdown-item ajax-modal\" href=\"#\" data-modal-url=\"modals/document/document_move.php?id=$id\"><i class=\"fas fa-fw fa-folder-open me-2\"></i>Move</a>";
|
||||
$html .= "<a class=\"dropdown-item ajax-modal\" href=\"#\" data-modal-url=\"modals/link/link.php?from=document&id=$id\"><i class=\"fas fa-fw fa-link me-2\"></i>Link</a>";
|
||||
$html .= linkPickerButton('document', $id, '', 'Link', 'dropdown-item', 'fas fa-fw fa-link me-2');
|
||||
}
|
||||
$archive_name = 'document';
|
||||
}
|
||||
|
||||
@@ -100,8 +100,6 @@ if (!$license || ($client_url && intval($license['software_client_id']) !== intv
|
||||
$license['software_purchase_reference'] ? 'Last order: ' . $license['software_purchase_reference'] : '',
|
||||
]));
|
||||
$renewal_ticket_url = 'modals/ticket/ticket_add.php?' . http_build_query(['client_id' => $client_id, 'subject' => $renewal_subject, 'details' => $renewal_details]);
|
||||
|
||||
$link_url = "modals/link/link.php?from=software&id=$software_id&to=";
|
||||
$unlink_url = function ($to, $other_id) use ($software_id) {
|
||||
return "post.php?unlink_item&from=software&id=$software_id&to=$to&other=" . intval($other_id) . "&csrf_token=" . $_SESSION['csrf_token'];
|
||||
};
|
||||
@@ -170,13 +168,13 @@ if (!$license || ($client_url && intval($license['software_client_id']) !== intv
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown"><i class="fas fa-link me-2"></i>Link</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $link_url ?>asset"><i class="fa fa-fw fa-desktop text-secondary me-2"></i>Device</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $link_url ?>contact"><i class="fa fa-fw fa-user text-secondary me-2"></i>User</a>
|
||||
<?= linkPickerButton('software', $software_id, 'asset', 'Device', 'dropdown-item', 'fa fa-fw fa-desktop text-secondary me-2') ?>
|
||||
<?= linkPickerButton('software', $software_id, 'contact', 'User', 'dropdown-item', 'fa fa-fw fa-user text-secondary me-2') ?>
|
||||
<?php if ($can_link_credentials) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $link_url ?>credential"><i class="fa fa-fw fa-lock text-secondary me-2"></i>Credential</a>
|
||||
<?= linkPickerButton('software', $software_id, 'credential', 'Credential', 'dropdown-item', 'fa fa-fw fa-lock text-secondary me-2') ?>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $link_url ?>document"><i class="fa fa-fw fa-file-alt text-secondary me-2"></i>Document</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $link_url ?>file"><i class="fa fa-fw fa-paperclip text-secondary me-2"></i>File</a>
|
||||
<?= linkPickerButton('software', $software_id, 'document', 'Document', 'dropdown-item', 'fa fa-fw fa-file-alt text-secondary me-2') ?>
|
||||
<?= linkPickerButton('software', $software_id, 'file', 'File', 'dropdown-item', 'fa fa-fw fa-paperclip text-secondary me-2') ?>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn btn-outline-secondary ajax-modal" data-modal-size="lg" data-modal-url="modals/software/software_edit.php?id=<?= $software_id ?>">
|
||||
@@ -507,9 +505,7 @@ if (!$license || ($client_url && intval($license['software_client_id']) !== intv
|
||||
<div class="itflow-asset-pane-bar">
|
||||
<span class="text-body-secondary small">Logins that go with it - the vendor portal, the admin console. Passwords are fetched only when you ask.</span>
|
||||
<?php if ($can_link_credentials) { ?>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="<?= $link_url ?>credential">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('software', $software_id, 'credential', 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php if ($credentials) { ?>
|
||||
@@ -533,9 +529,7 @@ if (!$license || ($client_url && intval($license['software_client_id']) !== intv
|
||||
<span class="text-body-secondary small"><?= $hint ?></span>
|
||||
<?php if ($can_edit) { ?>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="<?= $link_url . $to ?>">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('software', $software_id, $to, 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<?php if ($to === 'document') { ?>
|
||||
<button type="button" class="btn btn-sm btn-primary ajax-modal" data-modal-size="xl" data-modal-url="modals/document/document_add.php?client_id=<?= $client_id ?>&software_id=<?= $software_id ?>">
|
||||
<i class="fas fa-plus me-2"></i>New Document
|
||||
|
||||
@@ -135,7 +135,6 @@ if (!$location || ($client_url && intval($location['location_client_id']) !== in
|
||||
$unset_url = function ($kind, $id) use ($location_id) {
|
||||
return "post.php?unset_location_record=" . intval($id) . "&location_id=$location_id&kind=$kind&csrf_token=" . $_SESSION['csrf_token'];
|
||||
};
|
||||
$link_url = "modals/link/link.php?from=location&id=$location_id&to=";
|
||||
|
||||
?>
|
||||
|
||||
@@ -241,7 +240,7 @@ if (!$location || ($client_url && intval($location['location_client_id']) !== in
|
||||
<?php } ?>
|
||||
<?php if ($can_support_edit) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $link_url ?>document"><i class="fa fa-fw fa-link text-secondary me-2"></i>Link a document or file</a>
|
||||
<?= linkPickerButton('location', $location_id, '', 'Link a document or file', 'dropdown-item', 'fa fa-fw fa-link text-secondary me-2') ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -585,9 +584,7 @@ if (!$location || ($client_url && intval($location['location_client_id']) !== in
|
||||
<span class="text-body-secondary small"><?= $hint ?></span>
|
||||
<?php if ($can_support_edit && !$location_archived_at) { ?>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="<?= $link_url . $to ?>">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('location', $location_id, $to, 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<?php if ($to === 'document') { ?>
|
||||
<button type="button" class="btn btn-sm btn-primary ajax-modal" data-modal-size="xl" data-modal-url="modals/document/document_add.php?client_id=<?= $client_id ?>&location_id=<?= $location_id ?>">
|
||||
<i class="fas fa-plus me-2"></i>New Document
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Link one of the client's credentials to an asset. A credential sits on one
|
||||
* asset, so picking one that is on another asset moves it here - the picker
|
||||
* says where each one is now. Ones whose asset was deleted count as free.
|
||||
*/
|
||||
|
||||
require_once '../../../includes/modal_header.php';
|
||||
|
||||
enforceUserPermission('module_support', 2);
|
||||
enforceUserPermission('module_credential', 2);
|
||||
|
||||
$asset_id = intval($_GET['id'] ?? 0);
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT asset_client_id, asset_name FROM assets WHERE asset_id = $asset_id LIMIT 1"));
|
||||
if (!$row) {
|
||||
echo json_encode(['error' => 'That asset no longer exists.']);
|
||||
exit;
|
||||
}
|
||||
$asset_name = escapeHtml($row['asset_name']);
|
||||
$client_id = intval($row['asset_client_id']);
|
||||
|
||||
enforceClientAccess();
|
||||
|
||||
$choices = credentialRows("credential_client_id = $client_id AND credential_asset_id <> $asset_id");
|
||||
// Free ones first, then the ones that would move from another asset
|
||||
uasort($choices, function ($a, $b) {
|
||||
return [empty($a['asset_id']) ? 0 : 1, strtolower($a['credential_name'])] <=> [empty($b['asset_id']) ? 0 : 1, strtolower($b['credential_name'])];
|
||||
});
|
||||
|
||||
ob_start();
|
||||
|
||||
?>
|
||||
|
||||
<div class="modal-header bg-dark">
|
||||
<h5 class="modal-title text-truncate"><i class="fa fa-fw fa-key me-2"></i>Link a credential to <strong><?= $asset_name ?></strong></h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="asset_id" value="<?= $asset_id ?>">
|
||||
<div class="modal-body">
|
||||
<?php if ($choices) { ?>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
||||
<select class="form-select select2" name="credential_id" required data-placeholder="Pick a credential">
|
||||
<option value=""></option>
|
||||
<?php foreach ($choices as $credential_id => $choice) {
|
||||
$where_now = !empty($choice['asset_id']) ? 'On ' . $choice['asset_name'] . ' - moves here' : ($choice['credential_description'] ?: $choice['credential_uri']); ?>
|
||||
<option value="<?= $credential_id ?>"<?= selectOptionCredential($choice, $where_now) ?>><?= escapeHtml($choice['credential_name']) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-text">A credential belongs to one asset - one already on another asset moves here.</div>
|
||||
<?php } else { ?>
|
||||
<p class="text-body-secondary mb-0">This client has no other credentials to link - make a new one instead.</p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<?php if ($choices) { ?>
|
||||
<button type="submit" name="link_asset_to_credential" class="btn btn-primary text-bold"><i class="fa fa-check me-2"></i>Link</button>
|
||||
<?php } ?>
|
||||
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fa fa-times me-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
require_once '../../../includes/modal_footer.php';
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Kept so existing links keep working. Every pair is linked in
|
||||
* agent/modals/link/link.php, here opened on its Documents tab.
|
||||
*/
|
||||
|
||||
$_GET['from'] = 'asset';
|
||||
$_GET['id'] = intval($_GET['id'] ?? 0);
|
||||
$_GET['to'] = 'document';
|
||||
|
||||
require __DIR__ . '/../link/link.php';
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Kept so existing links keep working. Every pair is linked in
|
||||
* agent/modals/link/link.php, here opened on its Files tab.
|
||||
*/
|
||||
|
||||
$_GET['from'] = 'asset';
|
||||
$_GET['id'] = intval($_GET['id'] ?? 0);
|
||||
$_GET['to'] = 'file';
|
||||
|
||||
require __DIR__ . '/../link/link.php';
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Kept so existing links keep working. Every pair is linked in
|
||||
* agent/modals/link/link.php, here opened on its Services tab.
|
||||
*/
|
||||
|
||||
$_GET['from'] = 'asset';
|
||||
$_GET['id'] = intval($_GET['id'] ?? 0);
|
||||
$_GET['to'] = 'service';
|
||||
|
||||
require __DIR__ . '/../link/link.php';
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Kept so existing links keep working. Every pair is linked in
|
||||
* agent/modals/link/link.php, here opened on its Licenses tab - every license
|
||||
* the client has, with how many seats each has left.
|
||||
*/
|
||||
|
||||
$_GET['from'] = 'asset';
|
||||
$_GET['id'] = intval($_GET['id'] ?? 0);
|
||||
$_GET['to'] = 'software';
|
||||
|
||||
require __DIR__ . '/../link/link.php';
|
||||
@@ -176,7 +176,7 @@ ob_start();
|
||||
<div class="d-flex align-items-center mt-1 mb-1">
|
||||
<span class="small text-body-secondary fw-semibold text-uppercase me-auto">Services that use it</span>
|
||||
<?php if ($can_edit) { ?>
|
||||
<a class="small ajax-modal" href="#" data-modal-url="modals/link/link.php?from=certificate&id=<?= $certificate_id ?>&to=service"><i class="fas fa-link me-1"></i>Link a service</a>
|
||||
<?= linkPickerButton('certificate', $certificate_id, 'service', 'Link a service', 'small', 'fas fa-link me-1') ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php if ($services) { ?>
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once '../../../includes/modal_header.php';
|
||||
|
||||
$contact_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT contact_client_id, contact_name FROM contacts
|
||||
WHERE contact_id = $contact_id
|
||||
LIMIT 1
|
||||
");
|
||||
|
||||
$row = mysqli_fetch_assoc($sql);
|
||||
$contact_name = escapeHtml($row['contact_name']);
|
||||
$client_id = intval($row['contact_client_id']);
|
||||
|
||||
enforceClientAccess();
|
||||
|
||||
ob_start();
|
||||
|
||||
?>
|
||||
|
||||
<div class="modal-header bg-dark">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-desktop me-2"></i>Link Asset to <strong><?= $contact_name ?></strong></h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="contact_id" value="<?= $contact_id ?>">
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
||||
<select class="form-select select2" name="asset_id">
|
||||
<option value="">- Select an Asset -</option>
|
||||
<?php
|
||||
$sql_assets_select = mysqli_query($mysqli, "
|
||||
SELECT asset_id, asset_name, asset_type, asset_make, asset_model
|
||||
FROM assets
|
||||
WHERE asset_client_id = $client_id
|
||||
AND asset_contact_id = 0
|
||||
AND asset_archived_at IS NULL
|
||||
ORDER BY asset_name ASC
|
||||
");
|
||||
while ($row = mysqli_fetch_assoc($sql_assets_select)) {
|
||||
$asset_id = intval($row['asset_id']);
|
||||
$asset_name = escapeHtml($row['asset_name']);
|
||||
?>
|
||||
<option value="<?= $asset_id ?>"<?= selectOptionAsset($row['asset_type'] ?? '', trim(($row['asset_make'] ?? '') . ' ' . ($row['asset_model'] ?? ''))) ?>><?= $asset_name ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" name="link_contact_to_asset" class="btn btn-primary text-bold"><i class="fa fa-check me-2"></i>Link</button>
|
||||
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fa fa-times me-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once '../../../includes/modal_footer.php';
|
||||
?>
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Link one of the client's credentials to a contact - whose login it is. A
|
||||
* credential belongs to one contact, so picking one that is someone else's
|
||||
* moves it - the picker says whose each one is now.
|
||||
*/
|
||||
|
||||
require_once '../../../includes/modal_header.php';
|
||||
|
||||
enforceUserPermission('module_client', 2);
|
||||
enforceUserPermission('module_credential', 2);
|
||||
|
||||
$contact_id = intval($_GET['id'] ?? 0);
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT contact_client_id, contact_name FROM contacts WHERE contact_id = $contact_id LIMIT 1"));
|
||||
if (!$row) {
|
||||
echo json_encode(['error' => 'That contact no longer exists.']);
|
||||
exit;
|
||||
}
|
||||
$contact_name = escapeHtml($row['contact_name']);
|
||||
$client_id = intval($row['contact_client_id']);
|
||||
|
||||
enforceClientAccess();
|
||||
|
||||
$choices = credentialRows("credential_client_id = $client_id AND credential_contact_id <> $contact_id");
|
||||
// Nobody's first, then the ones that would move from someone else
|
||||
uasort($choices, function ($a, $b) {
|
||||
return [empty($a['contact_id']) ? 0 : 1, strtolower($a['credential_name'])] <=> [empty($b['contact_id']) ? 0 : 1, strtolower($b['credential_name'])];
|
||||
});
|
||||
|
||||
ob_start();
|
||||
|
||||
?>
|
||||
|
||||
<div class="modal-header bg-dark">
|
||||
<h5 class="modal-title text-truncate"><i class="fa fa-fw fa-key me-2"></i>Link a credential to <strong><?= $contact_name ?></strong></h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="contact_id" value="<?= $contact_id ?>">
|
||||
<div class="modal-body">
|
||||
<?php if ($choices) { ?>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
||||
<select class="form-select select2" name="credential_id" required data-placeholder="Pick a credential">
|
||||
<option value=""></option>
|
||||
<?php foreach ($choices as $credential_id => $choice) {
|
||||
$whose_now = !empty($choice['contact_id']) ? $choice['contact_name'] . "'s - moves to " . html_entity_decode($contact_name, ENT_QUOTES, 'UTF-8') : ($choice['credential_description'] ?: $choice['credential_uri']); ?>
|
||||
<option value="<?= $credential_id ?>"<?= selectOptionCredential($choice, $whose_now) ?>><?= escapeHtml($choice['credential_name']) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-text">A credential belongs to one person - one that is someone else's moves to <?= $contact_name ?>.</div>
|
||||
<?php } else { ?>
|
||||
<p class="text-body-secondary mb-0">This client has no other credentials to link - make a new one instead.</p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<?php if ($choices) { ?>
|
||||
<button type="submit" name="link_contact_to_credential" class="btn btn-primary text-bold"><i class="fa fa-check me-2"></i>Link</button>
|
||||
<?php } ?>
|
||||
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fa fa-times me-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
require_once '../../../includes/modal_footer.php';
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Kept so existing links keep working. Every pair is linked in
|
||||
* agent/modals/link/link.php, here opened on its Documents tab.
|
||||
*/
|
||||
|
||||
$_GET['from'] = 'contact';
|
||||
$_GET['id'] = intval($_GET['id'] ?? 0);
|
||||
$_GET['to'] = 'document';
|
||||
|
||||
require __DIR__ . '/../link/link.php';
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Kept so existing links keep working. Every pair is linked in
|
||||
* agent/modals/link/link.php, here opened on its Files tab.
|
||||
*/
|
||||
|
||||
$_GET['from'] = 'contact';
|
||||
$_GET['id'] = intval($_GET['id'] ?? 0);
|
||||
$_GET['to'] = 'file';
|
||||
|
||||
require __DIR__ . '/../link/link.php';
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Kept so existing links keep working. Every pair is linked in
|
||||
* agent/modals/link/link.php, here opened on its Services tab.
|
||||
*/
|
||||
|
||||
$_GET['from'] = 'contact';
|
||||
$_GET['id'] = intval($_GET['id'] ?? 0);
|
||||
$_GET['to'] = 'service';
|
||||
|
||||
require __DIR__ . '/../link/link.php';
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Kept so existing links keep working. Every pair is linked in
|
||||
* agent/modals/link/link.php, here opened on its Licenses tab - every license
|
||||
* the client has, with how many seats each has left.
|
||||
*/
|
||||
|
||||
$_GET['from'] = 'contact';
|
||||
$_GET['id'] = intval($_GET['id'] ?? 0);
|
||||
$_GET['to'] = 'software';
|
||||
|
||||
require __DIR__ . '/../link/link.php';
|
||||
@@ -113,7 +113,7 @@ ob_start();
|
||||
<div class="d-flex align-items-center mt-3 mb-1">
|
||||
<span class="small text-body-secondary fw-semibold text-uppercase me-auto">For</span>
|
||||
<?php if ($can_edit && $link_types) { ?>
|
||||
<a class="small ajax-modal" href="#" data-modal-url="modals/link/link.php?from=credential&id=<?= $credential_id ?>&to=vendor"><i class="fas fa-link me-1"></i>Link a vendor, license or service</a>
|
||||
<?= linkPickerButton('credential', $credential_id, '', 'Link a vendor, license or service', 'small', 'fas fa-link me-1') ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<ul class="list-unstyled mb-0 itflow-links">
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Kept so existing links keep working. Every pair is linked in
|
||||
* agent/modals/link/link.php, here opened on its Assets tab.
|
||||
*/
|
||||
|
||||
$_GET['from'] = 'document';
|
||||
$_GET['id'] = intval($_GET['document_id'] ?? 0);
|
||||
$_GET['to'] = 'asset';
|
||||
|
||||
require __DIR__ . '/../link/link.php';
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Kept so existing links keep working. Every pair is linked in
|
||||
* agent/modals/link/link.php, here opened on its Contacts tab.
|
||||
*/
|
||||
|
||||
$_GET['from'] = 'document';
|
||||
$_GET['id'] = intval($_GET['document_id'] ?? 0);
|
||||
$_GET['to'] = 'contact';
|
||||
|
||||
require __DIR__ . '/../link/link.php';
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Kept so existing links keep working. Every pair is linked in
|
||||
* agent/modals/link/link.php, here opened on its Files tab.
|
||||
*/
|
||||
|
||||
$_GET['from'] = 'document';
|
||||
$_GET['id'] = intval($_GET['document_id'] ?? 0);
|
||||
$_GET['to'] = 'file';
|
||||
|
||||
require __DIR__ . '/../link/link.php';
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Kept so existing links keep working. Every pair is linked in
|
||||
* agent/modals/link/link.php, here opened on its Licenses tab.
|
||||
*/
|
||||
|
||||
$_GET['from'] = 'document';
|
||||
$_GET['id'] = intval($_GET['document_id'] ?? 0);
|
||||
$_GET['to'] = 'software';
|
||||
|
||||
require __DIR__ . '/../link/link.php';
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Kept so existing links keep working. Every pair is linked in
|
||||
* agent/modals/link/link.php, here opened on its Vendors tab.
|
||||
*/
|
||||
|
||||
$_GET['from'] = 'document';
|
||||
$_GET['id'] = intval($_GET['document_id'] ?? 0);
|
||||
$_GET['to'] = 'vendor';
|
||||
|
||||
require __DIR__ . '/../link/link.php';
|
||||
@@ -165,7 +165,7 @@ ob_start();
|
||||
<div class="d-flex align-items-center mt-3 mb-1">
|
||||
<span class="small text-body-secondary fw-semibold text-uppercase me-auto">Services that use it</span>
|
||||
<?php if ($can_edit) { ?>
|
||||
<a class="small ajax-modal" href="#" data-modal-url="modals/link/link.php?from=domain&id=<?= $domain_id ?>&to=service"><i class="fas fa-link me-1"></i>Link a service</a>
|
||||
<?= linkPickerButton('domain', $domain_id, 'service', 'Link a service', 'small', 'fas fa-link me-1') ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php if ($services) { ?>
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Kept so existing links keep working. Every pair is linked in
|
||||
* agent/modals/link/link.php, here opened on its Assets tab.
|
||||
*/
|
||||
|
||||
$_GET['from'] = 'file';
|
||||
$_GET['id'] = intval($_GET['id'] ?? 0);
|
||||
$_GET['to'] = 'asset';
|
||||
|
||||
require __DIR__ . '/../link/link.php';
|
||||
@@ -1,140 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Link things to a document or a file - or a document or file to an asset or
|
||||
* contact, devices, users and credentials to a license, what a service
|
||||
* depends on to the service. One modal for every
|
||||
* pair in LINK_RELATIONS (functions/links.php):
|
||||
* ?from=document&id=81&to=asset opens on Assets; the pills along the top
|
||||
* switch to anything else this record can be linked to. Pick as many as you
|
||||
* like; only the client's own, unarchived, not-yet-linked records are offered.
|
||||
*
|
||||
* The old one-pair modals (document_link_asset.php, asset_link_file.php...)
|
||||
* are thin wrappers that set from/id/to and include this.
|
||||
*/
|
||||
|
||||
require_once '../../../includes/modal_header.php';
|
||||
|
||||
$link_from = (string) ($_GET['from'] ?? '');
|
||||
$link_id = intval($_GET['id'] ?? 0);
|
||||
$link_source = linkRecord($link_from, $link_id);
|
||||
if (!$link_source) {
|
||||
echo json_encode(['error' => 'That record no longer exists.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$client_id = intval($link_source['client_id']);
|
||||
enforceClientAccess();
|
||||
|
||||
// Only the kinds this agent may change
|
||||
$link_types = array_values(array_filter(linkTypesFor($link_from), function ($to) use ($link_from) {
|
||||
return linkCanEdit($link_from, $to);
|
||||
}));
|
||||
if (!$link_types) {
|
||||
echo json_encode(['error' => 'You do not have permission to change these links.']);
|
||||
exit;
|
||||
}
|
||||
$link_to = in_array($_GET['to'] ?? '', $link_types, true) ? $_GET['to'] : $link_types[0];
|
||||
|
||||
$from_entity = LINK_ENTITIES[$link_from];
|
||||
$link_name = escapeHtml($link_source['name']);
|
||||
|
||||
$panes = [];
|
||||
foreach ($link_types as $to) {
|
||||
$panes[$to] = [
|
||||
'entity' => LINK_ENTITIES[$to],
|
||||
'linked' => count(linkedRecords($link_from, $link_id, $to)),
|
||||
'candidates' => linkCandidates($link_from, $link_id, $to, $client_id),
|
||||
];
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
?>
|
||||
|
||||
<div class="modal-header bg-dark">
|
||||
<h5 class="modal-title text-truncate"><i class="fas fa-fw fa-link me-2"></i>Link to <strong><?= $link_name ?></strong></h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off" data-link-form>
|
||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="from" value="<?= escapeHtml($link_from) ?>">
|
||||
<input type="hidden" name="id" value="<?= $link_id ?>">
|
||||
<input type="hidden" name="to" value="<?= escapeHtml($link_to) ?>" data-link-to>
|
||||
|
||||
<div class="modal-body">
|
||||
|
||||
<?php if (count($panes) > 1) { ?>
|
||||
<nav class="nav nav-pills itflow-asset-pills itflow-link-types mb-3" role="tablist">
|
||||
<?php foreach ($panes as $to => $pane) { ?>
|
||||
<button type="button" class="nav-link <?= $to === $link_to ? 'active' : '' ?>" data-bs-toggle="pill" data-bs-target="#linkPane-<?= $to ?>" data-link-type="<?= $to ?>" role="tab">
|
||||
<i class="fas fa-fw <?= $pane['entity']['icon'] ?> me-1"></i><?= $pane['entity']['plural'] ?>
|
||||
<?php if ($pane['linked']) { ?><span class="badge rounded-pill ms-1" title="Already linked"><?= $pane['linked'] ?></span><?php } ?>
|
||||
</button>
|
||||
<?php } ?>
|
||||
</nav>
|
||||
<?php } ?>
|
||||
|
||||
<div class="tab-content">
|
||||
<?php foreach ($panes as $to => $pane) {
|
||||
$entity = $pane['entity']; ?>
|
||||
<div class="tab-pane fade <?= $to === $link_to ? 'show active' : '' ?>" id="linkPane-<?= $to ?>" role="tabpanel">
|
||||
<?php if ($pane['candidates']) { ?>
|
||||
<label class="form-label">Which <?= strtolower($entity['plural']) ?>?</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw <?= $entity['icon'] ?>"></i></span>
|
||||
<select class="form-select select2" name="ids[]" multiple data-placeholder="Pick one or more <?= strtolower($entity['plural']) ?>" <?= $to === $link_to ? '' : 'disabled' ?> data-link-select="<?= $to ?>">
|
||||
<?php foreach ($pane['candidates'] as $row) { ?>
|
||||
<option value="<?= intval($row['id']) ?>"<?= linkOptionData($to, $row, $client_id) ?>><?= escapeHtml($row['name']) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-text"><?= count($pane['candidates']) ?> <?= count($pane['candidates']) === 1 ? $entity['label'] : strtolower($entity['plural']) ?> not linked yet<?= $pane['linked'] ? ', ' . $pane['linked'] . ' already linked' : '' ?>.</div>
|
||||
<?php } else { ?>
|
||||
<div class="itflow-asset-empty py-4">
|
||||
<i class="fas <?= $entity['icon'] ?> fa-2x mb-2"></i>
|
||||
<div><?= $pane['linked'] ? 'Every ' . $entity['label'] . ' this client has is already linked.' : 'This client has no ' . strtolower($entity['plural']) . ' to link.' ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" name="link_items" class="btn btn-primary text-bold"><i class="fas fa-link me-2"></i>Link</button>
|
||||
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fa fa-times me-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
// Only the pane on show posts its picks
|
||||
var form = document.querySelector('form[data-link-form]:not([data-wired])');
|
||||
if (!form) {
|
||||
return;
|
||||
}
|
||||
form.dataset.wired = '1';
|
||||
var to = form.querySelector('[data-link-to]');
|
||||
form.querySelectorAll('[data-link-type]').forEach(function (pill) {
|
||||
pill.addEventListener('shown.bs.tab', function () {
|
||||
to.value = pill.dataset.linkType;
|
||||
form.querySelectorAll('[data-link-select]').forEach(function (select) {
|
||||
select.disabled = select.dataset.linkSelect !== to.value;
|
||||
});
|
||||
});
|
||||
});
|
||||
form.addEventListener('submit', function (e) {
|
||||
var select = form.querySelector('[data-link-select="' + to.value + '"]');
|
||||
if (!select || !select.selectedOptions.length) {
|
||||
e.preventDefault();
|
||||
if (select && select.itflowSelect) {
|
||||
select.itflowSelect.open();
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
<?php
|
||||
require_once '../../../includes/modal_footer.php';
|
||||
@@ -1,90 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Add tickets to a project - picked from its client's tickets (any client's
|
||||
* for an internal project), open ones first, then the ones closed in the
|
||||
* last 90 days; older ones by number. A ticket on another project moves.
|
||||
*/
|
||||
|
||||
require_once '../../../includes/modal_header.php';
|
||||
|
||||
$project = projectForModal($_GET['project_id'] ?? 0, 2, true);
|
||||
$project_id = intval($project['project_id']);
|
||||
$project_client_id = intval($project['project_client_id']);
|
||||
|
||||
$client_sql = $project_client_id ? "AND ticket_client_id = $project_client_id" : clientScopeSql('ticket_client_id');
|
||||
$sql = mysqli_query($mysqli, "SELECT ticket_id, ticket_prefix, ticket_number, ticket_subject, ticket_client_id, ticket_resolved_at, ticket_closed_at,
|
||||
ticket_status_name, client_name, project_id, project_prefix, project_number, project_name
|
||||
FROM tickets
|
||||
LEFT JOIN ticket_statuses ON ticket_status_id = ticket_status
|
||||
LEFT JOIN clients ON client_id = ticket_client_id
|
||||
LEFT JOIN projects ON project_id = ticket_project_id AND ticket_project_id > 0
|
||||
WHERE ticket_project_id <> $project_id AND ticket_archived_at IS NULL $client_sql
|
||||
AND (" . TICKET_OPEN_SQL . " OR COALESCE(ticket_closed_at, ticket_resolved_at) > NOW() - INTERVAL 90 DAY)
|
||||
ORDER BY " . TICKET_OPEN_SQL . " DESC, ticket_number DESC
|
||||
LIMIT 500");
|
||||
$open = [];
|
||||
$done = [];
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
if (ticketIsOpen($row)) {
|
||||
$open[] = $row;
|
||||
} else {
|
||||
$done[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
$option = function ($row) use ($project_client_id) {
|
||||
$description = array_filter([
|
||||
$row['ticket_status_name'],
|
||||
!$project_client_id ? ($row['client_name'] ?? 'Internal') : '',
|
||||
$row['project_id'] ? 'now on ' . $row['project_prefix'] . $row['project_number'] . ' - ' . $row['project_name'] : '',
|
||||
]);
|
||||
return '<option value="' . intval($row['ticket_id']) . '" data-icon="fas fa-life-ring" data-description="' . escapeHtml(implode(' · ', $description)) . '">'
|
||||
. escapeHtml(ticketReference($row) . ' - ' . $row['ticket_subject']) . '</option>';
|
||||
};
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="modal-header bg-dark">
|
||||
<h5 class="modal-title text-truncate"><i class="fas fa-fw fa-link me-2"></i>Add tickets <small class="ms-1 opacity-75"><?= escapeHtml(projectReference($project) . ' - ' . $project['project_name']) ?></small></h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="project_id" value="<?= $project_id ?>">
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tickets</label>
|
||||
<select class="form-select select2" data-placeholder="Pick tickets..." multiple name="tickets[]">
|
||||
<?php if ($open) { ?>
|
||||
<optgroup label="Open">
|
||||
<?php foreach ($open as $row) { echo $option($row); } ?>
|
||||
</optgroup>
|
||||
<?php } ?>
|
||||
<?php if ($done) { ?>
|
||||
<optgroup label="Resolved or closed in the last 90 days">
|
||||
<?php foreach ($done as $row) { echo $option($row); } ?>
|
||||
</optgroup>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<div class="form-text"><?= $project_client_id ? escapeHtml($project['client_name']) . "'s tickets" : "Any client's tickets - this is an internal project" ?>. One on another project moves to this one.</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-0">
|
||||
<label class="form-label">Or by number</label>
|
||||
<input type="text" class="form-control" name="ticket_numbers" placeholder="<?= escapeHtml($config_ticket_prefix) ?>1042, <?= escapeHtml($config_ticket_prefix) ?>1043">
|
||||
<div class="form-text">For older tickets - separate them with commas or spaces.</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="submit" name="link_ticket_to_project" class="btn btn-primary text-bold"><i class="fas fa-check me-2"></i>Add</button>
|
||||
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fas fa-times me-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once '../../../includes/modal_footer.php';
|
||||
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Link tickets already raised to a service - the outage reported before
|
||||
* anyone said which service it was. The client's tickets from the last year,
|
||||
* open ones first, not already on the service.
|
||||
*/
|
||||
|
||||
require_once '../../../includes/modal_header.php';
|
||||
|
||||
$service = serviceForModal($_GET['id'] ?? 0, 2, true);
|
||||
$service_id = intval($service['service_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT ticket_id, ticket_prefix, ticket_number, ticket_subject, ticket_created_at, ticket_resolved_at, ticket_closed_at FROM tickets
|
||||
WHERE ticket_client_id = $client_id AND ticket_archived_at IS NULL
|
||||
AND ticket_id NOT IN (SELECT ticket_id FROM service_tickets WHERE service_id = $service_id)
|
||||
AND (" . TICKET_OPEN_SQL . " OR ticket_created_at > NOW() - INTERVAL 1 YEAR)
|
||||
ORDER BY " . TICKET_OPEN_SQL . " DESC, ticket_number DESC LIMIT 300");
|
||||
$candidates = [];
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$candidates[] = $row;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
?>
|
||||
|
||||
<div class="modal-header bg-dark">
|
||||
<h5 class="modal-title text-truncate"><i class="fas fa-fw fa-life-ring me-2"></i>Tickets about <strong><?= escapeHtml($service['service_name']) ?></strong></h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="service_id" value="<?= $service_id ?>">
|
||||
<div class="modal-body">
|
||||
<?php if ($candidates) { ?>
|
||||
<label class="form-label">Which tickets?</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-life-ring"></i></span>
|
||||
<select class="form-select select2" name="ticket_ids[]" multiple required data-placeholder="Search by number or subject">
|
||||
<?php foreach ($candidates as $row) {
|
||||
$is_open = ticketIsOpen($row); ?>
|
||||
<option value="<?= intval($row['ticket_id']) ?>" data-icon="fas fa-<?= $is_open ? 'life-ring' : 'check-circle' ?>"
|
||||
data-description="<?= escapeHtml($row['ticket_prefix'] . $row['ticket_number'] . ' · ' . ($is_open ? 'Open' : 'Closed') . ' · ' . date('M j, Y', strtotime($row['ticket_created_at']))) ?>"
|
||||
data-keywords="<?= escapeHtml($row['ticket_prefix'] . $row['ticket_number']) ?>"><?= escapeHtml($row['ticket_subject']) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-text">Tickets on its assets show on the service already - this is for the rest.</div>
|
||||
<?php } else { ?>
|
||||
<div class="itflow-asset-empty py-4">
|
||||
<i class="fas fa-life-ring fa-2x mb-2"></i>
|
||||
<div>No other tickets for this client in the last year.</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<?php if ($candidates) { ?>
|
||||
<button type="submit" name="link_service_tickets" class="btn btn-primary text-bold"><i class="fas fa-link me-2"></i>Link</button>
|
||||
<?php } ?>
|
||||
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fa fa-times me-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once '../../../includes/modal_footer.php';
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Link related tickets (functions/ticket_link.php) - pick the tickets this one is about the same
|
||||
* thing as, of any client the agent can open. Posts link_tickets (agent/post/ticket_link.php).
|
||||
*/
|
||||
|
||||
require_once '../../../includes/modal_header.php';
|
||||
|
||||
enforceUserPermission('module_support', 2);
|
||||
|
||||
// The ticket, after the module and client checks - or the modal's error
|
||||
$row = ticketForModal($_GET['ticket_id'] ?? 0, 2);
|
||||
$ticket_id = intval($row['ticket_id']);
|
||||
$reference = escapeHtml(ticketReference($row));
|
||||
|
||||
$candidates = ticketLinksReady() ? ticketLinkCandidates($ticket_id) : [];
|
||||
$related_count = count(ticketRelated($ticket_id));
|
||||
|
||||
ob_start();
|
||||
|
||||
?>
|
||||
|
||||
<div class="modal-header bg-dark">
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-link me-2"></i>Link related tickets <small class="ms-1 opacity-75"><?= $reference ?></small></h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="ticket_id" value="<?= $ticket_id ?>">
|
||||
<div class="modal-body">
|
||||
|
||||
<p class="small text-body-secondary">
|
||||
Tickets about the same thing - one outage at several clients, or a problem that keeps coming back. Each shows the others, and one update or resolve can go to them all.
|
||||
<?php if ($related_count) { ?>
|
||||
<strong><?= $reference ?></strong> is related to <?= $related_count ?> already - the ones you pick join them.
|
||||
<?php } ?>
|
||||
</p>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Related to <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-life-ring"></i></span>
|
||||
<select class="form-select select2" name="related_ticket_ids[]" data-placeholder="- Pick tickets -" multiple required>
|
||||
<?php foreach ($candidates as $candidate) {
|
||||
$is_open = ticketIsOpen($candidate);
|
||||
$client = $candidate['client_name'] !== null ? $candidate['client_name'] : 'Internal'; ?>
|
||||
<option value="<?= intval($candidate['ticket_id']) ?>"<?= selectOptionData([
|
||||
'icon' => 'fas fa-life-ring',
|
||||
'description' => $client . ' · ' . ($candidate['ticket_status_name'] ?? '') . ($is_open ? '' : ' - ' . timeAgo($candidate['ticket_closed_at'] ?: $candidate['ticket_resolved_at'])),
|
||||
'keywords' => $client,
|
||||
]) ?>><?= escapeHtml(ticketReference($candidate) . ' ' . $candidate['ticket_subject']) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-text">Open tickets, and those closed in the last 90 days. Search by number, subject or client.</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" name="link_tickets" class="btn btn-primary text-bold"><i class="fas fa-link me-2"></i>Link</button>
|
||||
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fa fa-times me-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once '../../../includes/modal_footer.php';
|
||||
@@ -1,76 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Link a service to a ticket - an outage of email, a change to the backups.
|
||||
* The ticket then shows on the service's page with the tickets on its assets.
|
||||
*/
|
||||
|
||||
require_once '../../../includes/modal_header.php';
|
||||
|
||||
enforceUserPermission('module_support', 2);
|
||||
|
||||
// The ticket, after the module and client checks - or the modal's error
|
||||
$row = ticketForModal($_GET['id'] ?? 0, 2, true);
|
||||
$ticket_id = intval($row['ticket_id']);
|
||||
$client_id = intval($row['ticket_client_id']);
|
||||
$reference = escapeHtml($row['ticket_prefix'] . $row['ticket_number']);
|
||||
|
||||
if (!$client_id) {
|
||||
echo json_encode(['error' => 'A ticket with no client has no services to link.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$linked = ticketServices($ticket_id);
|
||||
$sql = mysqli_query($mysqli, "SELECT service_id, service_name, service_description, service_category, service_importance FROM services
|
||||
WHERE service_client_id = $client_id AND service_archived_at IS NULL
|
||||
AND service_id NOT IN (SELECT service_id FROM service_tickets WHERE ticket_id = $ticket_id)
|
||||
ORDER BY FIELD(service_importance, 'High', 'Medium', 'Low'), service_name");
|
||||
$candidates = [];
|
||||
while ($candidate = mysqli_fetch_assoc($sql)) {
|
||||
$candidates[] = $candidate;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
?>
|
||||
|
||||
<div class="modal-header bg-dark">
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-stream me-2"></i>Link a service <small class="ms-1 opacity-75"><?= $reference ?></small></h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="ticket_id" value="<?= $ticket_id ?>">
|
||||
<div class="modal-body">
|
||||
|
||||
<?php if ($candidates) { ?>
|
||||
<label class="form-label">Which service is this ticket about?</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-stream"></i></span>
|
||||
<select class="form-select select2" name="service_ids[]" multiple required data-placeholder="Pick one or more services">
|
||||
<?php foreach ($candidates as $candidate) {
|
||||
$via_asset = isset($linked[intval($candidate['service_id'])]); ?>
|
||||
<option value="<?= intval($candidate['service_id']) ?>"<?= selectOptionService($candidate) ?>><?= escapeHtml($candidate['service_name']) ?><?= $via_asset ? ' (through its asset)' : '' ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-text">The ticket shows on the service's page, in its Tickets tab.</div>
|
||||
<?php } else { ?>
|
||||
<div class="itflow-asset-empty py-4">
|
||||
<i class="fas fa-stream fa-2x mb-2"></i>
|
||||
<div><?= $linked ? 'Every service this client has is already linked.' : 'This client has no services yet.' ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<?php if ($candidates) { ?>
|
||||
<button type="submit" name="link_ticket_services" class="btn btn-primary text-bold"><i class="fas fa-link me-2"></i>Link</button>
|
||||
<?php } ?>
|
||||
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fa fa-times me-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once '../../../includes/modal_footer.php';
|
||||
@@ -923,49 +923,6 @@ if (isset($_POST['bulk_delete_assets'])) {
|
||||
|
||||
// Licenses are linked in post/link.php (link_software_to_asset)
|
||||
|
||||
// Right now 1 login and have many assets but not many to many
|
||||
if (isset($_POST['link_asset_to_credential'])) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
enforceUserPermission('module_support', 2);
|
||||
// It changes the credential, so it takes credential edit rights too
|
||||
enforceUserPermission('module_credential', 2);
|
||||
|
||||
$credential_id = intval($_POST['credential_id']);
|
||||
$asset_id = intval($_POST['asset_id']);
|
||||
|
||||
// Get credential Name and Client ID for logging
|
||||
$sql_credential = mysqli_query($mysqli,"SELECT credential_name, credential_client_id FROM credentials WHERE credential_id = $credential_id");
|
||||
$row = mysqli_fetch_assoc($sql_credential);
|
||||
if (!$row) {
|
||||
flashAlert("That credential no longer exists", 'error');
|
||||
redirect();
|
||||
}
|
||||
$credential_name = escapeSql($row['credential_name']);
|
||||
$client_id = intval($row['credential_client_id']);
|
||||
|
||||
enforceClientAccess();
|
||||
|
||||
// Only to one of the same client's assets
|
||||
if (!assetClientOwnedId('asset', $asset_id, $client_id)) {
|
||||
flashAlert("That asset isn't one of this client's", 'error');
|
||||
redirect();
|
||||
}
|
||||
|
||||
// Get Asset Name for logging
|
||||
$asset_name = escapeSql(getFieldById('assets', $asset_id, 'asset_name'));
|
||||
|
||||
mysqli_query($mysqli,"UPDATE credentials SET credential_asset_id = $asset_id WHERE credential_id = $credential_id");
|
||||
|
||||
logAudit("Credential", "Link", "$session_name linked credential $credential_name to asset $asset_name", $client_id, $credential_id);
|
||||
|
||||
flashAlert("Asset <strong>" . stripslashes($asset_name) . "</strong> linked with credential <strong>" . stripslashes($credential_name) . "</strong>");
|
||||
|
||||
redirect();
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['unlink_credential_from_asset'])) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
@@ -1104,46 +1104,6 @@ if (isset($_GET['delete_contact'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['link_contact_to_asset'])) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
enforceUserPermission('module_client', 2);
|
||||
|
||||
$asset_id = intval($_POST['asset_id']);
|
||||
$contact_id = intval($_POST['contact_id']);
|
||||
|
||||
// Get Asset Name and Client ID for logging
|
||||
$sql_asset = mysqli_query($mysqli,"SELECT asset_name, asset_client_id FROM assets WHERE asset_id = $asset_id");
|
||||
$row = mysqli_fetch_assoc($sql_asset);
|
||||
if (!$row) {
|
||||
flashAlert('Pick an asset to link.', 'error');
|
||||
redirect();
|
||||
}
|
||||
$asset_name = escapeSql($row['asset_name']);
|
||||
$client_id = intval($row['asset_client_id']);
|
||||
|
||||
enforceClientAccess();
|
||||
|
||||
// Only one of the same client's people - another client's contact would show on this client's asset
|
||||
if (!assetClientOwnedId('contact', $contact_id, $client_id)) {
|
||||
flashAlert("That contact isn't one of this client's", 'error');
|
||||
redirect();
|
||||
}
|
||||
|
||||
// Get Contact Name for logging
|
||||
$contact_name = escapeSql(getFieldById('contacts', $contact_id, 'contact_name'));
|
||||
|
||||
mysqli_query($mysqli,"UPDATE assets SET asset_contact_id = $contact_id WHERE asset_id = $asset_id");
|
||||
|
||||
logAudit("Asset", "Link", "$session_name linked asset $asset_name to contact $contact_name", $client_id, $asset_id);
|
||||
|
||||
flashAlert("Contact <strong>" . stripslashes($contact_name) . "</strong> linked with asset <strong>" . stripslashes($asset_name) . "</strong>");
|
||||
|
||||
redirect();
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['unlink_asset_from_contact'])) {
|
||||
|
||||
validateCSRFToken();
|
||||
@@ -1181,48 +1141,6 @@ if (isset($_GET['unlink_asset_from_contact'])) {
|
||||
|
||||
// Licenses are linked in post/link.php (link_software_to_contact)
|
||||
|
||||
if (isset($_POST['link_contact_to_credential'])) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
enforceUserPermission('module_client', 2);
|
||||
// It changes the credential, so it takes credential edit rights too
|
||||
enforceUserPermission('module_credential', 2);
|
||||
|
||||
$credential_id = intval($_POST['credential_id']);
|
||||
$contact_id = intval($_POST['contact_id']);
|
||||
|
||||
// Get credential Name and Client ID for logging
|
||||
$sql_credential = mysqli_query($mysqli,"SELECT credential_name, credential_client_id FROM credentials WHERE credential_id = $credential_id");
|
||||
$row = mysqli_fetch_assoc($sql_credential);
|
||||
if (!$row) {
|
||||
flashAlert("That credential no longer exists", 'error');
|
||||
redirect();
|
||||
}
|
||||
$credential_name = escapeSql($row['credential_name']);
|
||||
$client_id = intval($row['credential_client_id']);
|
||||
|
||||
enforceClientAccess();
|
||||
|
||||
// Only to one of the same client's people
|
||||
if (!assetClientOwnedId('contact', $contact_id, $client_id)) {
|
||||
flashAlert("That contact isn't one of this client's", 'error');
|
||||
redirect();
|
||||
}
|
||||
|
||||
// Get Contact Name for logging
|
||||
$contact_name = escapeSql(getFieldById('contacts', $contact_id, 'contact_name'));
|
||||
|
||||
mysqli_query($mysqli,"UPDATE credentials SET credential_contact_id = $contact_id WHERE credential_id = $credential_id");
|
||||
|
||||
logAudit("Credential", "Link", "$session_name linked credential $credential_name to contact $contact_name", $client_id, $credential_id);
|
||||
|
||||
flashAlert("Contact <strong>" . stripslashes($contact_name) . "</strong> linked with credential <strong>" . stripslashes($credential_name) . "</strong>");
|
||||
|
||||
redirect();
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['unlink_credential_from_contact'])) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* files about a location, and what a service depends on.
|
||||
*
|
||||
* One handler for every pair LINK_RELATIONS knows (functions/links.php):
|
||||
* link_items links any number of records at once, unlink_item drops one.
|
||||
* unlink_item drops one. Linking is the Link picker's (functions/link_picker.php).
|
||||
* The older one-pair-each names (link_asset_to_document, unlink_contact_from_file
|
||||
* and so on) are still answered here, so a link built by any page or older
|
||||
* modal keeps working - and gets the same checks: the same client, nothing
|
||||
@@ -63,11 +63,6 @@ function linkHandle($action, $from, $id, $to, $ids) {
|
||||
redirect();
|
||||
}
|
||||
|
||||
if (isset($_POST['link_items'])) {
|
||||
$ids = $_POST['ids'] ?? [];
|
||||
linkHandle('link', (string) ($_POST['from'] ?? ''), intval($_POST['id'] ?? 0), (string) ($_POST['to'] ?? ''), is_array($ids) ? $ids : [$ids]);
|
||||
}
|
||||
|
||||
if (isset($_GET['unlink_item'])) {
|
||||
linkHandle('unlink', (string) ($_GET['from'] ?? ''), intval($_GET['id'] ?? 0), (string) ($_GET['to'] ?? ''), [intval($_GET['other'] ?? 0)]);
|
||||
}
|
||||
|
||||
@@ -207,70 +207,6 @@ if (isset($_GET['delete_project'])) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Tickets onto a project - picked from its client's tickets, or typed by
|
||||
* number for older ones. Moving a ticket off another project is fine; one
|
||||
* the agent can't reach, or another client's, is skipped.
|
||||
*/
|
||||
if (isset($_POST['link_ticket_to_project'])) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
$row = projectForRequest($_POST['project_id'] ?? 0, 2);
|
||||
|
||||
if (!projectIsOpen($row)) {
|
||||
flashAlert("Project <strong>" . escapeHtml(projectReference($row)) . "</strong> isn't open - reopen it to add tickets.", 'error');
|
||||
redirect();
|
||||
}
|
||||
|
||||
$ticket_ids = array_map('intval', (array) ($_POST['tickets'] ?? []));
|
||||
|
||||
// Numbers typed in, with or without the prefix
|
||||
$not_found = [];
|
||||
foreach (preg_split('/[\s,;]+/', (string) ($_POST['ticket_numbers'] ?? ''), -1, PREG_SPLIT_NO_EMPTY) as $typed) {
|
||||
$number = intval(preg_replace('/^\D+/', '', $typed));
|
||||
$found = $number ? mysqli_fetch_row(mysqli_query($mysqli, "SELECT ticket_id FROM tickets WHERE ticket_number = $number ORDER BY ticket_id DESC LIMIT 1")) : null;
|
||||
if ($found) {
|
||||
$ticket_ids[] = intval($found[0]);
|
||||
} else {
|
||||
$not_found[] = escapeHtml($typed);
|
||||
}
|
||||
}
|
||||
|
||||
$added = 0;
|
||||
$skipped = [];
|
||||
foreach (array_unique(array_filter($ticket_ids)) as $ticket_id) {
|
||||
$ticket = ticketRow($ticket_id);
|
||||
if (!$ticket) {
|
||||
continue;
|
||||
}
|
||||
if (intval($ticket['ticket_project_id']) === intval($row['project_id'])) {
|
||||
continue;
|
||||
}
|
||||
$why_not = projectAddTicket($row, $ticket);
|
||||
if ($why_not === '') {
|
||||
$added++;
|
||||
} else {
|
||||
$skipped[] = escapeHtml(ticketReference($ticket)) . " ($why_not)";
|
||||
}
|
||||
}
|
||||
|
||||
if ($added) {
|
||||
logAudit("Project", "Edit", "$session_name added $added ticket" . ($added === 1 ? '' : 's') . " to project " . escapeSql(projectReference($row) . ' - ' . $row['project_name']), $client_id, intval($row['project_id']));
|
||||
}
|
||||
|
||||
// One message - a second flashAlert() would replace the first
|
||||
$message = array_filter([
|
||||
$added ? "<strong>$added</strong> ticket" . ($added === 1 ? '' : 's') . " added to <strong>" . escapeHtml($row['project_name']) . "</strong>" : '',
|
||||
$skipped ? 'Skipped ' . implode(', ', $skipped) : '',
|
||||
$not_found ? 'No ticket numbered ' . implode(', ', $not_found) : '',
|
||||
]);
|
||||
flashAlert($message ? implode('. ', $message) : 'Nothing to add - those tickets are on the project already.', $added ? 'success' : 'error');
|
||||
|
||||
redirect();
|
||||
|
||||
}
|
||||
|
||||
/** Tickets off a project - from its page, ticked. Only ones on this project, and the agent may reach. */
|
||||
if (isset($_POST['remove_tickets_from_project'])) {
|
||||
|
||||
|
||||
@@ -189,62 +189,6 @@ if (isset($_GET['delete_service'])) {
|
||||
|
||||
}
|
||||
|
||||
// Tickets raised about a service - from its page, or from the ticket
|
||||
if (isset($_POST['link_service_tickets'])) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
$row = serviceForRequest($_POST['service_id'] ?? 0, 2);
|
||||
|
||||
$added = serviceLinkTickets($row['service_id'], $client_id, (array) ($_POST['ticket_ids'] ?? []));
|
||||
if ($added) {
|
||||
logAudit("Service", "Link", "$session_name linked $added ticket(s) to service " . escapeSql($row['service_name']), $client_id, intval($row['service_id']));
|
||||
flashAlert("Linked <strong>$added</strong> ticket" . ($added === 1 ? '' : 's') . " to <strong>" . escapeHtml($row['service_name']) . "</strong>");
|
||||
} else {
|
||||
flashAlert("Nothing new to link to <strong>" . escapeHtml($row['service_name']) . "</strong>.", 'warning');
|
||||
}
|
||||
|
||||
redirect();
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['link_ticket_services'])) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
enforceUserPermission('module_support', 2);
|
||||
|
||||
$ticket_id = intval($_POST['ticket_id'] ?? 0);
|
||||
$ticket = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT ticket_id, ticket_prefix, ticket_number, ticket_client_id FROM tickets WHERE ticket_id = $ticket_id"));
|
||||
if (!$ticket || !intval($ticket['ticket_client_id'])) {
|
||||
flashAlert('That ticket no longer exists.', 'error');
|
||||
redirect();
|
||||
}
|
||||
$client_id = intval($ticket['ticket_client_id']);
|
||||
enforceClientAccess();
|
||||
|
||||
$names = [];
|
||||
foreach (array_unique(array_map('intval', (array) ($_POST['service_ids'] ?? []))) as $service_id) {
|
||||
$row = serviceRow($service_id);
|
||||
if (!$row || intval($row['service_client_id']) !== $client_id || $row['service_archived_at']) {
|
||||
continue;
|
||||
}
|
||||
if (serviceLinkTickets($service_id, $client_id, [$ticket_id])) {
|
||||
$names[] = $row['service_name'];
|
||||
logAudit("Service", "Link", "$session_name linked ticket " . escapeSql($ticket['ticket_prefix'] . $ticket['ticket_number']) . " to service " . escapeSql($row['service_name']), $client_id, $service_id);
|
||||
}
|
||||
}
|
||||
|
||||
if ($names) {
|
||||
flashAlert("Ticket linked to <strong>" . escapeHtml(implode(', ', $names)) . "</strong>");
|
||||
} else {
|
||||
flashAlert('Nothing new to link.', 'warning');
|
||||
}
|
||||
|
||||
redirect();
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['unlink_service_ticket'])) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
@@ -1,45 +1,13 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* ITFlow - POST handlers for related tickets (functions/ticket_link.php): the ticket page's
|
||||
* Link window and the x on each related ticket, and Link together on the tickets list.
|
||||
* ITFlow - POST handlers for related tickets (functions/ticket_link.php): the x on each related
|
||||
* ticket, and Link together on the tickets list. Linking from a ticket is its Link picker
|
||||
* (functions/link_picker.php).
|
||||
*/
|
||||
|
||||
defined('FROM_POST_HANDLER') || die("Direct file access is not allowed");
|
||||
|
||||
// From a ticket's Link window: this ticket and the ones picked, each a ticket of a client the agent can open
|
||||
if (isset($_POST['link_tickets'])) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
$row = ticketForRequest($_POST['ticket_id'] ?? 0, 2);
|
||||
$ticket_id = intval($row['ticket_id']);
|
||||
|
||||
$ids = [$ticket_id];
|
||||
foreach (array_unique(array_map('intval', (array) ($_POST['related_ticket_ids'] ?? []))) as $related_id) {
|
||||
$related = $related_id ? ticketRow($related_id) : null;
|
||||
if ($related && (!intval($related['ticket_client_id']) || hasClientAccess($related['ticket_client_id']))) {
|
||||
$ids[] = $related_id;
|
||||
}
|
||||
}
|
||||
if (count($ids) < 2) {
|
||||
flashAlert('Pick the tickets to link it with.', 'error');
|
||||
redirect();
|
||||
}
|
||||
|
||||
$joined = ticketLinkTogether($ids);
|
||||
$related_count = count(ticketRelated($ticket_id));
|
||||
|
||||
logAudit("Ticket", "Link", "$session_name linked ticket " . escapeSql(ticketReference($row)) . " with " . (count($ids) - 1) . " other ticket(s)", intval($row['ticket_client_id']), $ticket_id);
|
||||
|
||||
flashAlert($joined
|
||||
? "<strong>" . escapeHtml(ticketReference($row)) . "</strong> is related to <strong>$related_count</strong> ticket" . ($related_count === 1 ? '' : 's') . " now"
|
||||
: 'They were already related.');
|
||||
|
||||
redirect();
|
||||
|
||||
}
|
||||
|
||||
// The x on a related ticket - it comes out of the group, the rest stay related
|
||||
if (isset($_GET['unlink_ticket'])) {
|
||||
|
||||
|
||||
@@ -187,9 +187,7 @@ echo agentBannersHtml($project_client_id);
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown"><i class="fas fa-link me-2"></i>Add tickets</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/project/project_link_ticket.php?project_id=<?= $project_id ?>">
|
||||
<i class="fas fa-fw fa-life-ring text-secondary me-2"></i>Tickets already raised
|
||||
</a>
|
||||
<?= linkPickerButton('project', $project_id, 'ticket', 'Tickets already raised', 'dropdown-item', 'fas fa-fw fa-life-ring text-secondary me-2') ?>
|
||||
<?php if ($has_templates) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/project/project_apply_template.php?project_id=<?= $project_id ?>">
|
||||
<i class="fas fa-fw fa-cubes text-secondary me-2"></i>From a project template
|
||||
|
||||
@@ -132,8 +132,6 @@ if (!$service || ($client_url && intval($service['service_client_id']) !== intva
|
||||
if (!$can_credentials) {
|
||||
unset($service_tabs['logins']);
|
||||
}
|
||||
|
||||
$link_url = "modals/link/link.php?from=service&id=$service_id&to=";
|
||||
$unlink_url = function ($to, $other_id) use ($service_id) {
|
||||
return "post.php?unlink_item&from=service&id=$service_id&to=$to&other=" . intval($other_id) . "&csrf_token=" . $_SESSION['csrf_token'];
|
||||
};
|
||||
@@ -192,16 +190,16 @@ if (!$service || ($client_url && intval($service['service_client_id']) !== intva
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown"><i class="fas fa-link me-2"></i>Link</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $link_url ?>asset"><i class="fa fa-fw fa-desktop text-secondary me-2"></i>Asset it runs on</a>
|
||||
<?= linkPickerButton('service', $service_id, 'asset', 'Asset it runs on', 'dropdown-item', 'fa fa-fw fa-desktop text-secondary me-2') ?>
|
||||
<?php if ($can_link_credentials) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $link_url ?>credential"><i class="fa fa-fw fa-key text-secondary me-2"></i>Login</a>
|
||||
<?= linkPickerButton('service', $service_id, 'credential', 'Login', 'dropdown-item', 'fa fa-fw fa-key text-secondary me-2') ?>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $link_url ?>domain"><i class="fa fa-fw fa-globe text-secondary me-2"></i>Domain</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $link_url ?>certificate"><i class="fa fa-fw fa-lock text-secondary me-2"></i>Certificate</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $link_url ?>contact"><i class="fa fa-fw fa-user text-secondary me-2"></i>Person</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $link_url ?>vendor"><i class="fa fa-fw fa-building text-secondary me-2"></i>Vendor</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $link_url ?>document"><i class="fa fa-fw fa-file-alt text-secondary me-2"></i>Document</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/service/service_link_ticket.php?id=<?= $service_id ?>"><i class="fa fa-fw fa-life-ring text-secondary me-2"></i>Ticket</a>
|
||||
<?= linkPickerButton('service', $service_id, 'domain', 'Domain', 'dropdown-item', 'fa fa-fw fa-globe text-secondary me-2') ?>
|
||||
<?= linkPickerButton('service', $service_id, 'certificate', 'Certificate', 'dropdown-item', 'fa fa-fw fa-lock text-secondary me-2') ?>
|
||||
<?= linkPickerButton('service', $service_id, 'contact', 'Person', 'dropdown-item', 'fa fa-fw fa-user text-secondary me-2') ?>
|
||||
<?= linkPickerButton('service', $service_id, 'vendor', 'Vendor', 'dropdown-item', 'fa fa-fw fa-building text-secondary me-2') ?>
|
||||
<?= linkPickerButton('service', $service_id, 'document', 'Document', 'dropdown-item', 'fa fa-fw fa-file-alt text-secondary me-2') ?>
|
||||
<?= linkPickerButton('service', $service_id, 'ticket', 'Ticket', 'dropdown-item', 'fa fa-fw fa-life-ring text-secondary me-2') ?>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn btn-outline-secondary ajax-modal" data-modal-url="modals/service/service_review.php?id=<?= $service_id ?>">
|
||||
@@ -329,8 +327,8 @@ if (!$service || ($client_url && intval($service['service_client_id']) !== intva
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown"><i class="fas fa-link me-1"></i>Link</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $link_url ?>vendor"><i class="fa fa-fw fa-building text-secondary me-2"></i>Vendor</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $link_url ?>contact"><i class="fa fa-fw fa-user text-secondary me-2"></i>Person at the client</a>
|
||||
<?= linkPickerButton('service', $service_id, 'vendor', 'Vendor', 'dropdown-item', 'fa fa-fw fa-building text-secondary me-2') ?>
|
||||
<?= linkPickerButton('service', $service_id, 'contact', 'Person at the client', 'dropdown-item', 'fa fa-fw fa-user text-secondary me-2') ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
@@ -428,9 +426,7 @@ if (!$service || ($client_url && intval($service['service_client_id']) !== intva
|
||||
<div class="itflow-asset-pane-bar">
|
||||
<span class="text-body-secondary small">The servers, firewalls, NAS and other kit it runs on - when one is down, so is the service.</span>
|
||||
<?php if ($can_edit) { ?>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="<?= $link_url ?>asset">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('service', $service_id, 'asset', 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php if ($assets) { ?>
|
||||
@@ -486,7 +482,7 @@ if (!$service || ($client_url && intval($service['service_client_id']) !== intva
|
||||
<div class="itflow-asset-empty">
|
||||
<div>Nothing linked as what it runs on.</div>
|
||||
<?php if ($can_edit) { ?>
|
||||
<button type="button" class="btn btn-sm btn-outline-primary mt-3 ajax-modal" data-modal-url="<?= $link_url ?>asset"><i class="fas fa-link me-2"></i>Link assets</button>
|
||||
<?= linkPickerButton('service', $service_id, 'asset', 'Link assets', 'btn btn-sm btn-outline-primary mt-3', 'fas fa-link me-2') ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
@@ -498,9 +494,7 @@ if (!$service || ($client_url && intval($service['service_client_id']) !== intva
|
||||
<div class="itflow-asset-pane-bar">
|
||||
<span class="text-body-secondary small">Admin consoles, portals and service accounts. Passwords are fetched only when you ask.</span>
|
||||
<?php if ($can_link_credentials) { ?>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="<?= $link_url ?>credential">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('service', $service_id, 'credential', 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php if ($credentials) { ?>
|
||||
@@ -534,8 +528,8 @@ if (!$service || ($client_url && intval($service['service_client_id']) !== intva
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown"><i class="fas fa-link me-2"></i>Link</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $link_url ?>domain"><i class="fa fa-fw fa-globe text-secondary me-2"></i>Domain</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $link_url ?>certificate"><i class="fa fa-fw fa-lock text-secondary me-2"></i>Certificate</a>
|
||||
<?= linkPickerButton('service', $service_id, 'domain', 'Domain', 'dropdown-item', 'fa fa-fw fa-globe text-secondary me-2') ?>
|
||||
<?= linkPickerButton('service', $service_id, 'certificate', 'Certificate', 'dropdown-item', 'fa fa-fw fa-lock text-secondary me-2') ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
@@ -571,9 +565,7 @@ if (!$service || ($client_url && intval($service['service_client_id']) !== intva
|
||||
<span class="text-body-secondary small">Runbooks, diagrams, the restore procedure, the vendor contract.</span>
|
||||
<?php if ($can_edit) { ?>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="<?= $link_url ?>document">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('service', $service_id, 'document', 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<button type="button" class="btn btn-sm btn-primary ajax-modal" data-modal-size="xl" data-modal-url="modals/document/document_add.php?client_id=<?= $client_id ?>&service_id=<?= $service_id ?>">
|
||||
<i class="fas fa-plus me-2"></i>New Document
|
||||
</button>
|
||||
@@ -606,9 +598,7 @@ if (!$service || ($client_url && intval($service['service_client_id']) !== intva
|
||||
<span class="text-body-secondary small">Raised about it, or about what it runs on - open ones first.</span>
|
||||
<?php if ($can_edit) { ?>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="modals/service/service_link_ticket.php?id=<?= $service_id ?>">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('service', $service_id, 'ticket', 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<button type="button" class="btn btn-sm btn-primary ajax-modal" data-modal-size="lg" data-modal-url="<?= escapeHtml($report_url) ?>">
|
||||
<i class="fas fa-plus me-2"></i>Report a problem
|
||||
</button>
|
||||
|
||||
@@ -680,9 +680,7 @@ if (isset($_GET['ticket_id'])) {
|
||||
<i class="fas fa-fw fa-clone me-2"></i>Merge into another ticket
|
||||
</a>
|
||||
<?php if (ticketLinksReady()) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_link.php?ticket_id=<?= $ticket_id ?>">
|
||||
<i class="fas fa-fw fa-link me-2"></i>Link related tickets
|
||||
</a>
|
||||
<?= linkPickerButton('ticket', $ticket_id, 'ticket', 'Link related tickets', 'dropdown-item', 'fas fa-fw fa-link me-2') ?>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" id="clientChangeTicketModalLoad" data-modal-url="modals/ticket/ticket_change_client.php?ticket_id=<?= $ticket_id ?>">
|
||||
<i class="fas fa-fw fa-people-carry me-2"></i>Move to another client
|
||||
@@ -1558,7 +1556,7 @@ if (isset($_GET['ticket_id'])) {
|
||||
<h5 class="card-title mt-1"><i class="fas fa-fw fa-link me-2"></i>Related <span class="badge rounded-pill text-bg-secondary ms-1"><?= count($related) + $related_hidden ?></span></h5>
|
||||
<?php if ($can_edit_ticket) { ?>
|
||||
<div class="card-tools">
|
||||
<a class="btn btn-tool ajax-modal" href="#" data-modal-url="modals/ticket/ticket_link.php?ticket_id=<?= $ticket_id ?>" title="Link more tickets"><i class="fas fa-plus"></i></a>
|
||||
<?= linkPickerButton('ticket', $ticket_id, 'ticket', '', 'btn btn-tool', 'fas fa-plus', 'Link more tickets') ?>
|
||||
<?php if (count($related_open_ids) > 1) { ?>
|
||||
<div class="dropdown d-inline-block">
|
||||
<button class="btn btn-tool" type="button" data-bs-toggle="dropdown" title="To them all"><i class="fas fa-ellipsis-v"></i></button>
|
||||
@@ -1885,9 +1883,7 @@ if (isset($_GET['ticket_id'])) {
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_edit_project.php?id=<?= $ticket_id ?>">
|
||||
<i class="fas fa-fw fa-project-diagram me-2"></i><?= $project_id ? 'Change project' : 'Add to a project' ?>
|
||||
</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_link_service.php?id=<?= $ticket_id ?>">
|
||||
<i class="fas fa-fw fa-stream me-2"></i>Link a service
|
||||
</a>
|
||||
<?= linkPickerButton('ticket', $ticket_id, 'service', 'Link a service', 'dropdown-item', 'fas fa-fw fa-stream me-2') ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_add_watcher.php?ticket_id=<?= $ticket_id ?>">
|
||||
|
||||
@@ -215,8 +215,6 @@ if (!$vendor || (isset($_GET['client_id']) && $vendor_client_id !== intval($clie
|
||||
unset($vendor_tabs['logins']);
|
||||
}
|
||||
}
|
||||
|
||||
$link_url = "modals/link/link.php?from=vendor&id=$vendor_id&to=";
|
||||
$unlink_url = function ($to, $other_id) use ($vendor_id) {
|
||||
return "post.php?unlink_item&from=vendor&id=$vendor_id&to=$to&other=" . intval($other_id) . "&csrf_token=" . $_SESSION['csrf_token'];
|
||||
};
|
||||
@@ -664,9 +662,7 @@ if (!$vendor || (isset($_GET['client_id']) && $vendor_client_id !== intval($clie
|
||||
<div class="itflow-asset-pane-bar">
|
||||
<span class="text-body-secondary small">The client's services that depend on them - who gets the call when one breaks.</span>
|
||||
<?php if ($can_link_services) { ?>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="modals/link/link.php?from=vendor&id=<?= $vendor_id ?>&to=service">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('vendor', $vendor_id, 'service', 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php if ($services) { ?>
|
||||
@@ -691,9 +687,7 @@ if (!$vendor || (isset($_GET['client_id']) && $vendor_client_id !== intval($clie
|
||||
<span class="text-body-secondary small"><?= $hint ?></span>
|
||||
<?php if ($can_link && !$vendor_archived_at) { ?>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ajax-modal" data-modal-url="<?= $link_url . $to ?>">
|
||||
<i class="fas fa-link me-2"></i>Link
|
||||
</button>
|
||||
<?= linkPickerButton('vendor', $vendor_id, $to, 'Link', 'btn btn-sm btn-outline-secondary', 'fas fa-link me-2') ?>
|
||||
<?php if ($to === 'credential') { ?>
|
||||
<button type="button" class="btn btn-sm btn-primary ajax-modal" data-modal-size="lg" data-modal-url="modals/credential/credential_add.php?client_id=<?= $client_id ?>&vendor_id=<?= $vendor_id ?>">
|
||||
<i class="fas fa-plus me-2"></i>New Login
|
||||
|
||||
Reference in New Issue
Block a user