Add Primary Location / Contact if missing link modals

This commit is contained in:
johnnyq
2026-08-28 00:26:40 -04:00
parent 6d13237a17
commit 097891ed96
4 changed files with 51 additions and 5 deletions

View File

@@ -458,7 +458,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</td>
<td>
<?php
if (empty($contact_name) && empty($contact_phone) && empty($contact_mobile) && empty($client_email)) {
/* contact_id is the LEFT JOIN on contact_primary = 1, so empty
means no primary contact at all. The wider test below stays as
it was: it also covers a primary contact that exists but has
nothing worth printing. */
if (empty($contact_id) && lookupUserPermission("module_client") >= 2) { ?>
<a class="ajax-modal" href="#" data-modal-url="modals/contact/contact_add.php?client_id=<?= $client_id ?>&primary=1">
Add Primary Contact
</a>
<?php } elseif (empty($contact_name) && empty($contact_phone) && empty($contact_mobile) && empty($client_email)) {
echo "-";
}
@@ -491,7 +499,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<?php } ?>
</td>
<td><?= $full_address ?></td>
<td>
<?php if (empty($location_id) && lookupUserPermission("module_client") >= 2) { ?>
<a class="ajax-modal" href="#" data-modal-url="modals/location/location_add.php?client_id=<?= $client_id ?>&primary=1">
Add Primary Location
</a>
<?php } else {
echo $full_address;
} ?>
</td>
<!-- Show Billing if perms & if accounting module is enabled -->
<?php if ((lookupUserPermission("module_financial") >= 1) && $config_module_enable_accounting == 1) { ?>
<td class="text-end">