Email Invoice Only shows Billing and Primary, Quote shows Important Billing, Primary and Technical contacts that can be selected

This commit is contained in:
johnnyq
2026-08-28 13:43:51 -04:00
parent 72e6f23e19
commit 68b15ca49b
5 changed files with 63 additions and 21 deletions

View File

@@ -106,15 +106,15 @@ if (isset($_GET['invoice_id'])) {
}
$company_logo = escapeHtml($row['company_logo']);
// Send Email used to be gated on the PRIMARY contact having an email, which
// hid the button on a client whose only emailable contact was a billing or
// secondary one. The modal can send to any of them, so gate on whether the
// client has anybody reachable at all.
// Must use the same rule as the Send Email picker in
// modals/invoice/invoice_email.php, or the button offers a modal that then
// reports there is nobody to send to.
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT(contact_id) AS emailable_contacts FROM contacts
WHERE contact_client_id = $client_id
AND contact_archived_at IS NULL
AND contact_email IS NOT NULL
AND contact_email != ''"));
AND contact_email != ''
" . documentContactFilterSql('invoice')));
$emailable_contacts = intval($row['emailable_contacts']);
$sql_history = mysqli_query($mysqli, "SELECT history_created_at, history_description, history_status FROM history WHERE history_invoice_id = $invoice_id ORDER BY history_id DESC");