Nothing to see here

Go Back"; } else { $client_id = $vendor_client_id; if ($client_id) { enforceUserPermission('module_client'); enforceClientAccess(); } $is_ours = !$client_id; $vendor_name = escapeHtml($vendor['vendor_name']); $vendor_description = escapeHtml($vendor['vendor_description']); $vendor_archived_at = escapeHtml($vendor['vendor_archived_at']); $vendor_created_at = escapeHtml($vendor['vendor_created_at']); $vendor_favorite = intval($vendor['vendor_favorite']); $vendor_phone = contactPhoneLink($vendor['vendor_phone'], $vendor['vendor_phone_country_code'], $vendor['vendor_extension']); $vendor_phone_text = $vendor['vendor_phone'] ? formatPhoneNumber($vendor['vendor_phone'], $vendor['vendor_phone_country_code']) : ''; $vendor_dial = vendorDialNumber($vendor['vendor_phone'], $vendor['vendor_phone_country_code']); $vendor_email = escapeHtml($vendor['vendor_email']); $vendor_website_url = vendorWebsiteUrl($vendor['vendor_website']); $vendor_website_label = escapeHtml(vendorWebsiteLabel($vendor['vendor_website'])); $vendor_status_url = vendorWebsiteUrl($vendor['vendor_status_page']); $vendor_portal_url = vendorWebsiteUrl($vendor['vendor_portal']); $vendor_hours = escapeHtml($vendor['vendor_hours']); $vendor_sla = escapeHtml($vendor['vendor_sla']); $vendor_account = escapeHtml($vendor['vendor_account_number']); $vendor_pin = vendorSecretHtml($vendor['vendor_code']); $vendor_notes = escapeHtml($vendor['vendor_notes']); $manager_name = escapeHtml($vendor['vendor_contact_name']); $manager_phone = contactPhoneLink($vendor['vendor_contact_phone'], $vendor['vendor_contact_phone_country_code']); $manager_email = escapeHtml($vendor['vendor_contact_email']); $can_edit = vendorCan($client_id, 2); $can_delete = vendorCan($client_id, 3) && !empty($config_destructive_deletes_enable); $can_support = lookupUserPermission('module_support') >= 1; $can_support_edit = lookupUserPermission('module_support') >= 2; $can_credentials = lookupUserPermission('module_credential') >= 1; $can_credentials_edit = lookupUserPermission('module_credential') >= 2; $can_financial = lookupUserPermission('module_financial') >= 1; $can_financial_edit = lookupUserPermission('module_financial') >= 2; // A client's vendor can be linked to that client's services $can_link_services = !$is_ours && $can_support_edit && !$vendor_archived_at; // Override Tab Title // No Sanitizing needed as this var will only be used in the tab title $page_title = $vendor['vendor_name']; $list_url = $is_ours ? 'vendors.php' : "vendors.php?client_id=$client_id"; $vendor_tags_display = tagPills('vendor', $vendor_id, tagsForRecord('vendor', $vendor_id), ($is_ours ? 'vendors.php?' : "vendors.php?client_id=$client_id&"), $can_edit); // Cases - every open one, then the most recent closed ones $cases = []; $case_count = $case_open_count = 0; $licenses = $assets = $domains = $services = $logins = $documents = $files = []; if ($can_support) { [$case_count, $case_open_count] = ticketCounts("tickets.ticket_client_id = $client_id AND tickets.ticket_vendor_id = $vendor_id"); $cases = ticketRows("tickets.ticket_client_id = $client_id AND tickets.ticket_vendor_id = $vendor_id", max(25, $case_open_count)); if (!$is_ours) { $sql = mysqli_query($mysqli, "SELECT software_id AS id, software_name AS name, software_type, software_version, software_license_type, software_seats, software_expire, software_purchase_reference, " . softwareSeatsUsedSql('software.software_id') . " AS seats_used FROM software WHERE software_client_id = $client_id AND software_vendor_id = $vendor_id AND software_archived_at IS NULL ORDER BY software_expire IS NULL, software_expire ASC, software_name ASC"); while ($row = mysqli_fetch_assoc($sql)) { $licenses[] = $row; } $sql = mysqli_query($mysqli, "SELECT asset_id, asset_name, asset_type, asset_make, asset_model, asset_serial, asset_purchase_date, asset_purchase_reference, asset_warranty_expire FROM assets WHERE asset_client_id = $client_id AND asset_vendor_id = $vendor_id AND asset_archived_at IS NULL ORDER BY asset_warranty_expire IS NULL, asset_warranty_expire ASC, asset_name ASC"); while ($row = mysqli_fetch_assoc($sql)) { $assets[] = $row; } $services = servicesFor('vendor', $vendor_id); $documents = linkedRecords('vendor', $vendor_id, 'document'); $files = linkedRecords('vendor', $vendor_id, 'file'); } // Domains they register or host - the client's, or for one of ours (DNS or // mail we run for clients), every client's that the agent can see $sql = mysqli_query($mysqli, "SELECT domain_id, domain_name, domain_description, domain_expire, domain_auto_renew, domain_registrar, domain_webhost, domain_dnshost, domain_mailhost, domain_client_id, client_name FROM domains LEFT JOIN clients ON client_id = domain_client_id WHERE domain_archived_at IS NULL AND $vendor_id IN (domain_registrar, domain_webhost, domain_dnshost, domain_mailhost) " . ($is_ours ? "AND client_archived_at IS NULL " . clientScopeSql('domain_client_id') : "AND domain_client_id = $client_id") . " ORDER BY client_name ASC, domain_name ASC"); while ($row = mysqli_fetch_assoc($sql)) { $domains[] = $row; } } if ($can_credentials && !$is_ours) { // The whole credential, so the password and 2FA code are right there to use $logins = credentialRows("credential_id IN (SELECT credential_id FROM vendor_credentials WHERE vendor_id = $vendor_id)"); } // What we spend with one of ours $expenses = $recurring = []; $spend = null; if ($is_ours && $can_financial) { $spend = vendorSpend($vendor_id); $sql = mysqli_query($mysqli, "SELECT expense_id, expense_date, expense_amount, expense_currency_code, expense_description, expense_reference, expense_receipt, category_name, account_name, expense_paid_by, (SELECT payer.user_name FROM users AS payer WHERE payer.user_id = expense_paid_by) AS paid_by_name FROM expenses LEFT JOIN categories ON category_id = expense_category_id LEFT JOIN accounts ON account_id = expense_account_id WHERE expense_vendor_id = $vendor_id AND expense_archived_at IS NULL " . clientScopeSql('expense_client_id') . " ORDER BY expense_date DESC, expense_id DESC LIMIT 25"); while ($row = mysqli_fetch_assoc($sql)) { $expenses[] = $row; } $sql = mysqli_query($mysqli, "SELECT recurring_expense_id, recurring_expense_frequency, recurring_expense_anchor_day, recurring_expense_next_date, recurring_expense_end_date, recurring_expense_status, recurring_expense_amount, recurring_expense_currency_code, recurring_expense_description, category_name FROM recurring_expenses LEFT JOIN categories ON category_id = recurring_expense_category_id WHERE recurring_expense_vendor_id = $vendor_id AND recurring_expense_archived_at IS NULL " . clientScopeSql('recurring_expense_client_id') . " ORDER BY recurring_expense_status DESC, recurring_expense_next_date ASC"); while ($row = mysqli_fetch_assoc($sql)) { $recurring[] = $row; } } // What we buy from one of ours - the catalog items they supply $vendor_products = []; $can_sales = lookupUserPermission('module_sales') >= 1; if ($is_ours && $can_sales) { $sql = mysqli_query($mysqli, "SELECT product_id, product_name, product_type, product_code, product_vendor_part, product_price, product_cost, product_currency_code, product_track_stock, product_frequency, product_seat_source, " . productStockSql() . " AS product_stock FROM products WHERE product_vendor_id = $vendor_id AND product_archived_at IS NULL ORDER BY product_name ASC"); while ($row = mysqli_fetch_assoc($sql)) { $vendor_products[] = $row; } } // Kept in step with the template it was made from - where it differs; or, made by hand, a template it looks like $template_row = intval($vendor['vendor_template_id']) ? vendorTemplateInfo($vendor['vendor_template_id']) : null; $template_differences = $template_row && !$vendor_archived_at ? vendorTemplateDifferences($template_row, $vendor) : []; $template_match = !$template_row && !$vendor_archived_at && $can_edit ? vendorTemplateMatchFor($vendor) : null; $elsewhere = lookupUserPermission('module_client') >= 1 ? vendorElsewhere($vendor) : []; $history = auditLogHistory('Vendor', $vendor_id); if ($is_ours) { $vendor_tabs = [ 'expenses' => ['label' => 'Expenses', 'icon' => 'fa-receipt', 'count' => $spend ? $spend['count'] : 0], 'recurring' => ['label' => 'Recurring', 'icon' => 'fa-redo-alt', 'count' => count($recurring)], 'products' => ['label' => 'Products', 'icon' => 'fa-box-open', 'count' => count($vendor_products)], 'cases' => ['label' => 'Cases', 'icon' => 'fa-life-ring', 'count' => $case_count, 'badge' => $case_open_count], 'domains' => ['label' => 'Client domains', 'icon' => 'fa-globe', 'count' => count($domains)], 'history' => ['label' => 'History', 'icon' => 'fa-history', 'count' => $history['count']], ]; if (!$domains) { unset($vendor_tabs['domains']); } if (!$can_financial) { unset($vendor_tabs['expenses'], $vendor_tabs['recurring']); } if (!$can_sales) { unset($vendor_tabs['products']); } if (!$case_count) { unset($vendor_tabs['cases']); } } else { $vendor_tabs = [ 'cases' => ['label' => 'Cases', 'icon' => 'fa-life-ring', 'count' => $case_count, 'badge' => $case_open_count], 'licenses' => ['label' => 'Licenses', 'icon' => 'fa-cube', 'count' => count($licenses)], 'assets' => ['label' => 'Assets', 'icon' => 'fa-desktop', 'count' => count($assets)], 'domains' => ['label' => 'Domains', 'icon' => 'fa-globe', 'count' => count($domains)], 'services' => ['label' => 'Services', 'icon' => 'fa-stream', 'count' => count($services)], 'logins' => ['label' => 'Logins', 'icon' => 'fa-key', 'count' => count($logins)], 'documents' => ['label' => 'Documents', 'icon' => 'fa-file-alt', 'count' => count($documents)], 'files' => ['label' => 'Files', 'icon' => 'fa-paperclip', 'count' => count($files)], 'history' => ['label' => 'History', 'icon' => 'fa-history', 'count' => $history['count']], ]; if (!$can_support) { unset($vendor_tabs['cases'], $vendor_tabs['licenses'], $vendor_tabs['assets'], $vendor_tabs['domains'], $vendor_tabs['services'], $vendor_tabs['documents'], $vendor_tabs['files']); } if (!$can_credentials) { 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']; }; $new_case_url = "modals/ticket/ticket_add.php?client_id=$client_id&vendor_id=$vendor_id"; $can_new = !$vendor_archived_at && (($is_ours && $can_financial_edit) || (!$is_ours && ($can_support_edit || $can_credentials_edit))); ?>

Our vendor Archived

Differs from the template it was made from in its - its own, or the template changed since.
Looks like the vendor template. Link it, and it counts as made from it and is kept in step with it - nothing here changes unless you say so.

Support

Phone
Not recorded
Hours
Not recorded' ?>
SLA
Email
Site
Status
Portal

Account

Account
' . $vendor_account . '' : 'Not recorded' ?>
PIN
Not recorded' ?>
Manager
Not recorded
Added

Notes

Also used by