mirror of
https://github.com/itflow-org/itflow
synced 2026-07-26 10:17:15 +00:00
Replaces the duplicated primary/billing/technical checks across portal pages, post.php handlers, nav, and dashboard with contactCan()/enforceContactCan(). Same behavior, but the rules now live in one place instead of being copy-pasted, which is what let them drift before. file.php keeps its 404 response; ticket-visibility and approval-routing checks are intentionally left as-is.
92 lines
3.5 KiB
PHP
92 lines
3.5 KiB
PHP
<?php
|
|
/*
|
|
* Client Portal
|
|
* Contact management for PTC / technical contacts
|
|
*/
|
|
|
|
header("Content-Security-Policy: default-src 'self'");
|
|
|
|
require_once "includes/inc_all.php";
|
|
|
|
enforceContactCan('itdoc');
|
|
|
|
$assets_sql = mysqli_query($mysqli, "SELECT * FROM assets LEFT JOIN contacts ON asset_contact_id = contact_id WHERE asset_client_id = $session_client_id AND asset_archived_at IS NULL ORDER BY asset_type ASC, asset_name ASC");
|
|
?>
|
|
|
|
<div class="row">
|
|
<div class="col">
|
|
<h3>Assets</h3>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
|
|
|
<table class="table tabled-bordered border border-dark">
|
|
<thead class="thead-dark">
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Type</th>
|
|
<th>Model</th>
|
|
<th>Serial</th>
|
|
<th>Assigned</th>
|
|
<th>Purchase</th>
|
|
<th>Warranty</th>
|
|
<th>Status</th>
|
|
<th>URI</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
<?php
|
|
while ($row = mysqli_fetch_assoc($assets_sql)) {
|
|
$asset_id = intval($row['asset_id']);
|
|
$asset_name = escapeHtml($row['asset_name']);
|
|
$asset_description = escapeHtml($row['asset_description']);
|
|
$asset_type = escapeHtml($row['asset_type']);
|
|
$asset_make = escapeHtml($row['asset_make']);
|
|
$asset_model = escapeHtml($row['asset_model']);
|
|
$asset_serial = escapeHtml($row['asset_serial']);
|
|
$asset_purchase_date = escapeHtml($row['asset_purchase_date'] ?? "-");
|
|
$asset_warranty_expire = escapeHtml($row['asset_warranty_expire'] ?? "-");
|
|
$assigned_to = escapeHtml($row['contact_name'] ?? "-");
|
|
$asset_status = escapeHtml($row['asset_status']);
|
|
$asset_uri_client = escapeUrl($row['asset_uri_client']);
|
|
|
|
?>
|
|
|
|
<tr>
|
|
<td>
|
|
<a href="#"><?php echo $asset_name ?></a>
|
|
<br>
|
|
<small class="text-secondary"><?php echo $asset_description; ?></small>
|
|
</td>
|
|
<td><?php echo $asset_type; ?></td>
|
|
<td><?php echo "$asset_make<br><span class='text-secondary'>$asset_model</span>"; ?></td>
|
|
<td><?php echo $asset_serial; ?></td>
|
|
<td><?php echo $assigned_to; ?></td>
|
|
<td><?php echo $asset_purchase_date; ?></td>
|
|
<td><?php echo $asset_warranty_expire; ?></td>
|
|
<td><?php echo $asset_status; ?></td>
|
|
<td>
|
|
<?php if ($asset_uri_client) { ?>
|
|
<i class="fa fa-fw fa-link text-secondary mr-1"></i><a href="<?php echo $asset_uri_client; ?>" target="_blank" title="<?php echo $asset_uri_client; ?>"><?php echo truncate($asset_uri_client, 40); ?></a>
|
|
<?php } else { ?>
|
|
-
|
|
<?php } ?>
|
|
</td>
|
|
</tr>
|
|
|
|
<?php } ?>
|
|
|
|
</tbody>
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
require_once "includes/footer.php";
|