Removed valueOrDash Function was able to replace with ?: '-'

This commit is contained in:
johnnyq
2026-07-14 18:13:34 -04:00
parent 746e919aff
commit 2181e92e44
4 changed files with 14 additions and 19 deletions

View File

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

View File

@@ -28,8 +28,8 @@ $credential_created_at = escapeHtml($row['credential_created_at']);
enforceClientAccess(); enforceClientAccess();
// Generate the HTML form content using output buffering.
ob_start(); ob_start();
?> ?>
<div class="modal-header bg-dark text-white"> <div class="modal-header bg-dark text-white">
@@ -37,7 +37,7 @@ ob_start();
<i class="fas fa-fw fa-building fa-2x mr-3"></i> <i class="fas fa-fw fa-building fa-2x mr-3"></i>
<div> <div>
<h5 class="modal-title mb-0"><?php echo $name; ?></h5> <h5 class="modal-title mb-0"><?php echo $name; ?></h5>
<div class="text-muted"><?php echo valueOrDash($description); ?></div> <div class="text-muted"><?php echo $description ?: '-'; ?></div>
</div> </div>
</div> </div>
<button type="button" class="close text-white" data-dismiss="modal"> <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> <h6 class="text-secondary"><i class="fas fa-info-circle mr-2"></i>Vendor Details</h6>
<div class="row"> <div class="row">
<div class="col-sm-6"> <div class="col-sm-6">
<div><strong>Account Number:</strong> <?php echo valueOrDash($account_number); ?></div> <div><strong>Account Number:</strong> <?php echo $account_number ?: '-'; ?></div>
<div><strong>Hours:</strong> <?php echo valueOrDash($hours); ?></div> <div><strong>Hours:</strong> <?php echo $hours ?: '-'; ?></div>
<div><strong>SLA:</strong> <?php echo valueOrDash($sla); ?></div> <div><strong>SLA:</strong> <?php echo $sla ?: '-'; ?></div>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div><strong>Code:</strong> <?php echo valueOrDash($code); ?></div> <div><strong>Code:</strong> <?php echo $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><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>
</div> </div>
@@ -71,8 +71,8 @@ ob_start();
<h6 class="text-secondary"><i class="fas fa-user mr-2"></i>Contact Information</h6> <h6 class="text-secondary"><i class="fas fa-user mr-2"></i>Contact Information</h6>
<div class="row"> <div class="row">
<div class="col-sm-6"> <div class="col-sm-6">
<div><strong>Contact Name:</strong> <?php echo valueOrDash($contact_name); ?></div> <div><strong>Contact Name:</strong> <? $contact_name ?: '-'; ?></div>
<div><strong>Phone:</strong> <?php echo valueOrDash($phone); ?></div> <div><strong>Phone:</strong> <?= $phone ?: '-'; ?></div>
</div> </div>
<div class="col-sm-6"> <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> <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"> <div class="card-body">
<h6 class="text-secondary"><i class="fas fa-sticky-note mr-2"></i>Notes</h6> <h6 class="text-secondary"><i class="fas fa-sticky-note mr-2"></i>Notes</h6>
<div> <div>
<?php echo valueOrDash($notes); ?> <?= $notes ?: '-'; ?>
</div> </div>
</div> </div>
</div> </div>

View File

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

View File

@@ -74,11 +74,6 @@ function getTicketStatusName($ticket_status) {
} }
// Helper function for missing data fallback
function valueOrDash($data) {
return !empty($data) ? $data : '-';
}
/** /**
* Retrieves a specified field's value from a table based on the record's id. * Retrieves a specified field's value from a table based on the record's id.
* It validates the table and field names, automatically determines the primary key (or uses the first column as fallback), * It validates the table and field names, automatically determines the primary key (or uses the first column as fallback),
@@ -312,7 +307,7 @@ function createiCalStr($datetime, $title, $description, $location)
} }
function createiCalStrCancel($originaliCalStr) { function createiCalStrCancel($originaliCalStr) {
require_once "plugins/zapcal/zapcallib.php"; require_once "libs/zapcal/zapcallib.php";
// Import the original iCal string // Import the original iCal string
$cal_event = new ZCiCal($originaliCalStr); $cal_event = new ZCiCal($originaliCalStr);