Replace Function getFallBack with valueOrDash()

This commit is contained in:
johnnyq
2026-07-14 18:00:12 -04:00
parent 71f7299337
commit 746e919aff
4 changed files with 13 additions and 13 deletions

View File

@@ -73,7 +73,7 @@
$document_template_content = escapeHtml($row['document_template_content']);
$document_template_created_by_name = escapeHtml($row['user_name']);
$document_template_created_at = escapeHtml($row['document_template_created_at']);
$document_template_updated_at = escapeHtml(getFallback($row['document_template_updated_at']));
$document_template_updated_at = escapeHtml(valueOrDash($row['document_template_updated_at']));
?>

View File

@@ -37,7 +37,7 @@ ob_start();
<i class="fas fa-fw fa-building fa-2x mr-3"></i>
<div>
<h5 class="modal-title mb-0"><?php echo $name; ?></h5>
<div class="text-muted"><?php echo getFallback($description); ?></div>
<div class="text-muted"><?php echo valueOrDash($description); ?></div>
</div>
</div>
<button type="button" class="close text-white" data-dismiss="modal">
@@ -53,12 +53,12 @@ ob_start();
<h6 class="text-secondary"><i class="fas fa-info-circle mr-2"></i>Vendor Details</h6>
<div class="row">
<div class="col-sm-6">
<div><strong>Account Number:</strong> <?php echo getFallback($account_number); ?></div>
<div><strong>Hours:</strong> <?php echo getFallback($hours); ?></div>
<div><strong>SLA:</strong> <?php echo getFallback($sla); ?></div>
<div><strong>Account Number:</strong> <?php echo valueOrDash($account_number); ?></div>
<div><strong>Hours:</strong> <?php echo valueOrDash($hours); ?></div>
<div><strong>SLA:</strong> <?php echo valueOrDash($sla); ?></div>
</div>
<div class="col-sm-6">
<div><strong>Code:</strong> <?php echo getFallback($code); ?></div>
<div><strong>Code:</strong> <?php echo valueOrDash($code); ?></div>
<div><strong>Website:</strong> <?php echo !empty($website) ? '<a href="' . $website . '" target="_blank" class="text-primary">' . $website . '</a>' : '<span class="text-muted">Not Available</span>'; ?></div>
</div>
</div>
@@ -71,8 +71,8 @@ ob_start();
<h6 class="text-secondary"><i class="fas fa-user mr-2"></i>Contact Information</h6>
<div class="row">
<div class="col-sm-6">
<div><strong>Contact Name:</strong> <?php echo getFallback($contact_name); ?></div>
<div><strong>Phone:</strong> <?php echo getFallback($phone); ?></div>
<div><strong>Contact Name:</strong> <?php echo valueOrDash($contact_name); ?></div>
<div><strong>Phone:</strong> <?php echo valueOrDash($phone); ?></div>
</div>
<div class="col-sm-6">
<div><strong>Email:</strong> <?php echo !empty($email) ? '<a href="mailto:' . $email . '" class="text-primary">' . $email . '</a>' : '<span class="text-muted">Not Available</span>'; ?></div>
@@ -86,7 +86,7 @@ ob_start();
<div class="card-body">
<h6 class="text-secondary"><i class="fas fa-sticky-note mr-2"></i>Notes</h6>
<div>
<?php echo getFallback($notes); ?>
<?php echo valueOrDash($notes); ?>
</div>
</div>
</div>

View File

@@ -1608,11 +1608,11 @@ if (isset($_POST["export_client_pdf"])) {
<tbody>";
while ($row = mysqli_fetch_assoc($sql_credentials)) {
$credential_name = escapeHtml($row["credential_name"]);
$credential_description = getFallback(escapeHtml($row["credential_description"]));
$credential_description = valueOrDash(escapeHtml($row["credential_description"]));
$credential_username = escapeHtml(decryptCredentialEntry($row["credential_username"]));
$credential_password = escapeHtml(decryptCredentialEntry($row["credential_password"]));
$credential_totp_secret = getFallback(escapeHtml($row['credential_otp_secret']));
$credential_uri = getFallback(escapeHtml($row["credential_uri"]));
$credential_totp_secret = valueOrDash(escapeHtml($row['credential_otp_secret']));
$credential_uri = valueOrDash(escapeHtml($row["credential_uri"]));
$html .= "
<tr>
<td>$credential_name</td>

View File

@@ -75,7 +75,7 @@ function getTicketStatusName($ticket_status) {
}
// Helper function for missing data fallback
function getFallback($data) {
function valueOrDash($data) {
return !empty($data) ? $data : '-';
}