- Updated authorization checks in product management, product attributes, configurations, software, and user management files to use 'permissions' for consistency. - Ensured that all relevant pages correctly check user permissions for read, update, delete, and create actions. - Adjusted session variable references to align with the new permissions structure across various modules.
180 lines
6.4 KiB
PHP
180 lines
6.4 KiB
PHP
<?php
|
|
defined(page_security_key) or exit;
|
|
|
|
if (debug && debug_id == $_SESSION['authorization']['id']){
|
|
ini_set('display_errors', '1');
|
|
ini_set('display_startup_errors', '1');
|
|
error_reporting(E_ALL);
|
|
}
|
|
include_once './assets/functions.php';
|
|
include_once './settings/settings_redirector.php';
|
|
|
|
//SET ORIGIN FOR NAVIGATION
|
|
$prev_page = $_SESSION['prev_origin'] ?? '';
|
|
$page = 'products_software_version';
|
|
|
|
//create backbutton to prev_origin
|
|
$back_btn_orgin = ($prev_page != '')? '<a href="'.$prev_page.'" class="btn alt mar-right-2">Back</a>':'';
|
|
|
|
// Fallback translations
|
|
if (!isset($button_cancel)) $button_cancel = 'Cancel';
|
|
|
|
//Check if allowed
|
|
if (isAllowed($page,$_SESSION['authorization']['permissions'],$_SESSION['authorization']['permission'],'R') === 0){
|
|
header('location: index.php');
|
|
exit;
|
|
}
|
|
|
|
//GET PARAMETERS && STORE in SESSION for FURTHER USE/NAVIGATION
|
|
$pagination_page = $_SESSION['p'] = isset($_GET['p']) ? $_GET['p'] : 1;
|
|
|
|
//PAGE Security
|
|
$page_manage = 'products_software_version_manage';
|
|
$update_allowed = isAllowed($page ,$_SESSION['authorization']['permissions'],$_SESSION['authorization']['permission'],'U');
|
|
$update_allowed_edit = isAllowed($page_manage ,$_SESSION['authorization']['permissions'],$_SESSION['authorization']['permission'],'U');
|
|
$delete_allowed = isAllowed($page_manage ,$_SESSION['authorization']['permissions'],$_SESSION['authorization']['permission'],'D');
|
|
$create_allowed = isAllowed($page_manage ,$_SESSION['authorization']['permissions'],$_SESSION['authorization']['permission'],'C');
|
|
|
|
//GET Details from URL
|
|
$GET_VALUES = urlGETdetails($_GET) ?? '';
|
|
|
|
//CALL TO API FOR General information
|
|
$api_url = '/v2/products_software_versions/'.$GET_VALUES;
|
|
$responses = ioServer($api_url,'');
|
|
//Decode Payload
|
|
if (!empty($responses)){$responses = json_decode($responses);}else{$responses = null;}
|
|
$responses = $responses[0];
|
|
|
|
//CALL TO API FOR Related Licenses
|
|
$api_url = '/v2/products_software_licenses/version_id='.$_GET['rowID'];
|
|
$licenses = ioServer($api_url,'');
|
|
//Decode Payload
|
|
if (!empty($licenses)){$licenses = json_decode($licenses);}else{$licenses = null;}
|
|
|
|
//CALL TO API FOR Upgrade Paths
|
|
$api_url = '/v2/products_software_upgrade_paths/from_version_id='.$_GET['rowID'];
|
|
$upgrade_paths_from = ioServer($api_url,'');
|
|
//Decode Payload
|
|
if (!empty($upgrade_paths_from)){$upgrade_paths_from = json_decode($upgrade_paths_from);}else{$upgrade_paths_from = null;}
|
|
|
|
$api_url = '/v2/products_software_upgrade_paths/to_version_id='.$_GET['rowID'];
|
|
$upgrade_paths_to = ioServer($api_url,'');
|
|
//Decode Payload
|
|
if (!empty($upgrade_paths_to)){$upgrade_paths_to = json_decode($upgrade_paths_to);}else{$upgrade_paths_to = null;}
|
|
|
|
// Fetch all software versions for mapping
|
|
$api_url = '/v2/products_software_versions/list';
|
|
$all_versions_response = ioServer($api_url,'');
|
|
$version_map = [];
|
|
if (!empty($all_versions_response)) {
|
|
$all_versions = json_decode($all_versions_response);
|
|
foreach ($all_versions as $ver) {
|
|
$version_map[$ver->rowID] = $ver->name . ' (' . $ver->version . ')';
|
|
}
|
|
}
|
|
|
|
template_header('Software Version Details', 'products_software_version','view');
|
|
|
|
$view = '
|
|
<div class="content-title">
|
|
<div class="title">
|
|
<i class="fa-solid fa-code-branch"></i>
|
|
<div class="txt">
|
|
<h2>Software Version: '.$responses->name.' ('.$responses->version.')</h2>
|
|
<p>Details and related information.</p>
|
|
</div>
|
|
</div>
|
|
<div class="action">
|
|
<a href="index.php?page='.$_SESSION['origin'].'&p='.$_SESSION['p'].'" class="btn alt mar-right-2">←</a>
|
|
'.($update_allowed_edit ? '<a href="index.php?page=products_software_version_manage&id='.$responses->rowID.'" class="btn">✏️</a>' : '').'
|
|
</div>
|
|
</div>
|
|
|
|
<div class="content-block order-details">
|
|
<div class="block-header">
|
|
<i class="fa-solid fa-circle-info"></i>Version Details
|
|
</div>
|
|
<div class="order-detail">
|
|
<h3>Name</h3>
|
|
<p>'.$responses->name.'</p>
|
|
</div>
|
|
<div class="order-detail">
|
|
<h3>Version</h3>
|
|
<p>'.$responses->version.'</p>
|
|
</div>
|
|
<div class="order-detail">
|
|
<h3>Description</h3>
|
|
<p>'.$responses->description.'</p>
|
|
</div>
|
|
<div class="order-detail">
|
|
<h3>HW Version</h3>
|
|
<p>'.$responses->hw_version.'</p>
|
|
</div>
|
|
<div class="order-detail">
|
|
<h3>Mandatory</h3>
|
|
<p>'.($responses->mandatory ? 'Yes' : 'No').'</p>
|
|
</div>
|
|
<div class="order-detail">
|
|
<h3>Latest</h3>
|
|
<p>'.($responses->latest ? 'Yes' : 'No').'</p>
|
|
</div>
|
|
<div class="order-detail">
|
|
<h3>Status</h3>
|
|
<p>'.($responses->status ? 'Active' : 'Inactive').'</p>
|
|
</div>
|
|
<div class="order-detail">
|
|
<h3>File Path</h3>
|
|
<p>'.$responses->file_path.'</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="content-block">
|
|
<div class="block-header">
|
|
<i class="fa-solid fa-bars fa-sm"></i>Upgrade Paths
|
|
<a href="index.php?page=products_software_upgrade_paths_manage&id=' . $_GET['rowID'] . '" class="btn2"> + </a>
|
|
</div>
|
|
<div class="table">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>From Version</th>
|
|
<th>To Version</th>
|
|
<th>Price</th>
|
|
<th>Currency</th>
|
|
<th>Description</th>
|
|
<th>Active</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
';
|
|
|
|
$all_paths = array_merge($upgrade_paths_from ?: [], $upgrade_paths_to ?: []);
|
|
if (empty($all_paths)){
|
|
$view .= '<tr><td colspan="6">No upgrade paths found.</td></tr>';
|
|
} else {
|
|
foreach ($all_paths as $path){
|
|
$view .= '
|
|
<tr onclick="window.location.href=\'index.php?page=products_software_upgrade_paths_manage&path_id='.$path->rowID.'\'" style="cursor: pointer;">
|
|
<td>' . ($version_map[$path->from_version_id] ?? $path->from_version_id) . '</td>
|
|
<td>' . ($version_map[$path->to_version_id] ?? $path->to_version_id) . '</td>
|
|
<td>'.$path->price.'</td>
|
|
<td>'.$path->currency.'</td>
|
|
<td>'.$path->description.'</td>
|
|
<td>'.($path->is_active ? 'Yes' : 'No').'</td>
|
|
</tr>
|
|
';
|
|
}
|
|
}
|
|
|
|
$view .= '
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
';
|
|
|
|
//OUTPUT
|
|
echo $view;
|
|
|
|
template_footer();
|
|
?>
|