Add Quick Send Quote / Invoice to replicate the old single click to Send Email

This commit is contained in:
johnnyq
2026-08-28 14:40:25 -04:00
parent 68b15ca49b
commit 86ba041cdc
9 changed files with 222 additions and 47 deletions

View File

@@ -246,9 +246,13 @@ if (isset($_GET['invoice_id'])) {
</button>
<div class="dropdown-menu">
<?php if (!empty($config_smtp_provider) && $emailable_contacts > 0) { ?>
<button type="submit" class="dropdown-item" form="quickSendInvoice"
name="invoice_id" value="<?= $invoice_id ?>">
<i class="fas fa-fw fa-bolt me-2"></i>Quick Send
</button>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/invoice/invoice_email.php?invoice_id=<?= $invoice_id ?>">
<i class="fas fa-fw fa-paper-plane me-2"></i>Send Email
<i class="fas fa-fw fa-paper-plane me-2"></i>Send Email<span class="text-muted">...</span>
</a>
<div class="dropdown-divider"></div>
<?php } ?>
@@ -314,9 +318,13 @@ if (isset($_GET['invoice_id'])) {
<i class="fa fa-fw fa-box-open text-secondary me-2"></i>Packing Slip
</a>
<?php if (!empty($config_smtp_provider) && $emailable_contacts > 0) { ?>
<button type="submit" class="dropdown-item" form="quickSendInvoice"
name="invoice_id" value="<?= $invoice_id ?>">
<i class="fa fa-fw fa-bolt text-secondary me-2"></i>Quick Send
</button>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/invoice/invoice_email.php?invoice_id=<?= $invoice_id ?>">
<i class="fa fa-fw fa-paper-plane text-secondary me-2"></i>Send Email
<i class="fa fa-fw fa-paper-plane text-secondary me-2"></i>Send Email<span class="text-muted">...</span>
</a>
<?php } ?>
<a class="dropdown-item clipboardjs" href="#" data-clipboard-text="https://<?= $config_base_url ?>/guest/guest_view_invoice.php?invoice_id=<?= "$invoice_id&url_key=$invoice_url_key" ?>">
@@ -758,6 +766,25 @@ if (isset($_GET['invoice_id'])) {
</div>
</div>
</div>
<?php if (lookupUserPermission("module_sales") >= 2 && !empty($config_smtp_provider) && $emailable_contacts > 0) { ?>
<?php
/*
* One hidden form for the page, targeted by the Quick Send buttons via
* their form="" attribute, so a button can sit inside a dropdown
* without needing a form of its own. The button carries the id as its
* own name/value, which a submit button contributes to the submission.
*
* Must stay inside this block - $emailable_contacts is only set on the
* path where the document was found.
*/
?>
<form id="quickSendInvoice" action="post.php" method="post" class="d-none">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<input type="hidden" name="email_invoice" value="1">
<input type="hidden" name="quick_send" value="1">
</form>
<?php } ?>
<?php
include_once "modals/invoice/invoice_add_ticket.php";