'That quote no longer exists.'])); } $quote_prefix = escapeHtml($row['quote_prefix']); $quote_number = intval($row['quote_number']); $quote_status = escapeHtml($row['quote_status']); $client_id = intval($row['quote_client_id']); enforceClientAccess(); $doc = billingRow('quote', $quote_id); // Wider than the invoice picker - see documentContactFilterSql(). A quote is // read by whoever scoped the work as often as by whoever signs it. $sql_contacts = mysqli_query( $mysqli, "SELECT contact_billing, contact_email, contact_id, contact_photo, contact_important, contact_name, contact_primary, contact_technical, contact_title FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL AND contact_email IS NOT NULL AND contact_email != '' " . documentContactFilterSql('quote') . " ORDER BY contact_primary DESC, contact_billing DESC, contact_technical DESC, contact_name ASC" ); $contact_count = mysqli_num_rows($sql_contacts); // Which boxes open ticked. Read from the same helper Quick Send uses, so the // modal and the one-click path can never disagree about who "the defaults" are. $default_contact_ids = []; $sql_defaults = mysqli_query( $mysqli, "SELECT contact_id FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL AND contact_email IS NOT NULL AND contact_email != '' " . documentDefaultContactFilterSql('quote') ); while ($row = mysqli_fetch_assoc($sql_defaults)) { $default_contact_ids[] = intval($row['contact_id']); } ob_start(); ?>