CIM77 - Update
This commit is contained in:
@@ -133,12 +133,13 @@ elseif (isset($criterias['history']) && $criterias['history'] != ''){
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$sort = '';
|
$current_page = isset($criterias['p']) && is_numeric($criterias['p']) ? (int)$criterias['p'] : 1;
|
||||||
|
$start_page = ($current_page - 1) * $page_rows_history;
|
||||||
|
$sort = ' ORDER BY h.created DESC LIMIT '.$start_page.','.$page_rows_history;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//request history
|
//request history
|
||||||
$sql ='SELECT h.rowID as historyID, e.rowID as equipmentID, h.equipmentid as h_equipmentid, e.serialnumber, h.type, h.description, h.created, h.createdby from history h LEFT JOIN equipment e ON h.equipmentid = e.rowID '.$whereclause.$sort;
|
$sql ='SELECT h.rowID as historyID, e.rowID as equipmentID, h.equipmentid as h_equipmentid, e.serialnumber, h.type, h.description, h.created, h.createdby from history h LEFT JOIN equipment e ON h.equipmentid = e.rowID '.$whereclause.$sort;
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// GET SORT INDICATOR
|
// GET SORT INDICATOR
|
||||||
|
|||||||
@@ -63,6 +63,12 @@ if(isset($get_content) && $get_content!=''){
|
|||||||
//build up search
|
//build up search
|
||||||
$clause .= ' AND (h.rowID like :'.$v[0].' OR h.createdby like :'.$v[0].')';
|
$clause .= ' AND (h.rowID like :'.$v[0].' OR h.createdby like :'.$v[0].')';
|
||||||
}
|
}
|
||||||
|
elseif ($v[0] == 'type' && $v[1] == 'servicereport') {
|
||||||
|
//Filter out only relevant servicereports
|
||||||
|
$filter_key_1 = '"%serialnumber%"';
|
||||||
|
$filter_key_2 = '"ServiceReport"';
|
||||||
|
$clause .= ' AND h.type = '.$filter_key_2.' AND h.description like '.$filter_key_1;
|
||||||
|
}
|
||||||
else {//create clause
|
else {//create clause
|
||||||
$clause .= ' AND '.$v[0].' = :'.$v[0];
|
$clause .= ' AND '.$v[0].' = :'.$v[0];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -826,7 +826,7 @@ function availableFirmware($sw_version, $hw_version){
|
|||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
// show serviceEvents available
|
// show serviceEvents available
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
function serviceEvents ($messages){
|
function serviceEvents ($messages,$page){
|
||||||
|
|
||||||
include dirname(__FILE__,2).'/settings/settings.php';
|
include dirname(__FILE__,2).'/settings/settings.php';
|
||||||
|
|
||||||
@@ -896,16 +896,16 @@ function serviceEvents ($messages){
|
|||||||
<td>'.$service_date.'</td>
|
<td>'.$service_date.'</td>
|
||||||
<td>'.$service_renewal_date.'</td>
|
<td>'.$service_renewal_date.'</td>
|
||||||
<td>'.$service_status.'</td>
|
<td>'.$service_status.'</td>
|
||||||
<td><a href="index.php?page=servicereport&equipmentID='.$message->h_equipmentid.'&historyID='.$message->historyID.'" class="btn_link">'.$general_view.'</a></td>
|
<td><a href="index.php?page=servicereport&equipmentID='.$message->equipmentID.'&historyID='.$message->historyID.'" class="btn_link">'.$general_view.'</a></td>
|
||||||
<td><a href="index.php?page=render_service_report&historyID='.$message->historyID.'" class="btn_link">PDF</a></td>
|
<td><a href="index.php?page=render_service_report&historyID='.$message->historyID.'" class="btn_link">PDF</a></td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//CHECK IF OUTPUT IS MORE THAN X (config setting)
|
//CHECK IF OUTPUT IS MORE THAN X (config setting)
|
||||||
if (count($messages) == $page_rows_equipment_servicereporst){
|
if (count($messages) == $page_rows_equipment_servicereporst && $page == 'equipment'){
|
||||||
$view_data .= '<tr>
|
$view_data .= '<tr>
|
||||||
<td><a href="index.php?page=servicereports&search='.$message->h_equipmentid.'" class="btn_link">'.$general_actions_more.'</a></td>
|
<td><a href="index.php?page=servicereports&equipmentid='.$message->h_equipmentid.'" class="btn_link">'.$general_actions_more.'</a></td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ if (!empty($responses->geolocation) || $responses->geolocation != ''){
|
|||||||
|
|
||||||
//Get all related service events
|
//Get all related service events
|
||||||
if (isAllowed('servicereports',$_SESSION['profile'],$_SESSION['permission'],'R') === 1){
|
if (isAllowed('servicereports',$_SESSION['profile'],$_SESSION['permission'],'R') === 1){
|
||||||
$service_events = serviceEvents($history);
|
$service_events = serviceEvents($history,$page);
|
||||||
|
|
||||||
$view .= '<div class="content-block">
|
$view .= '<div class="content-block">
|
||||||
<div class="block-header">
|
<div class="block-header">
|
||||||
|
|||||||
@@ -10,8 +10,16 @@ if (debug && debug_id == $_SESSION['id']){
|
|||||||
include_once './assets/functions.php';
|
include_once './assets/functions.php';
|
||||||
include_once './settings/settings.php';
|
include_once './settings/settings.php';
|
||||||
|
|
||||||
|
//SET PAGE ORIGIN FOR NAVIGATION AND SECURITY
|
||||||
|
$prev_page = (isset($_SESSION['origin']) && $_SESSION['origin'] == 'equipments') ? $_SESSION['prev_origin_equipment'] : $_SESSION['prev_origin_servicereport'];
|
||||||
|
$page = 'servicereport';
|
||||||
|
|
||||||
|
//create backbutton to prev_origin
|
||||||
|
$back_btn_orgin = ($prev_page != '')? '<a href="'.$prev_page.'" class="btn alt mar-right-2">'.$button_back.'</a>':'';
|
||||||
|
|
||||||
|
|
||||||
//Check if allowed
|
//Check if allowed
|
||||||
if (isAllowed('servicereport',$_SESSION['profile'],$_SESSION['permission'],'R') === 0){
|
if (isAllowed($page,$_SESSION['profile'],$_SESSION['permission'],'R') === 0){
|
||||||
header('location: index.php');
|
header('location: index.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -35,14 +43,9 @@ $view = '
|
|||||||
<p>'.$servicereport_p.'</p>
|
<p>'.$servicereport_p.'</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
'.$back_btn_orgin.'
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
$view .= '
|
|
||||||
<div class="content-header responsive-flex-column pad-top-5">
|
|
||||||
<a href="index.php?page=equipment&equipmentID='.$_GET['equipmentID'].'" class="btn">'.$button_cancel.'</a>
|
|
||||||
</div>
|
|
||||||
';
|
|
||||||
|
|
||||||
//Get all related service events
|
//Get all related service events
|
||||||
if (empty($history)){
|
if (empty($history)){
|
||||||
$service_events = '
|
$service_events = '
|
||||||
|
|||||||
@@ -9,8 +9,9 @@ include_once './assets/functions.php';
|
|||||||
include_once './settings/settings.php';
|
include_once './settings/settings.php';
|
||||||
|
|
||||||
//SET PAGE ORIGIN FOR NAVIGATION AND SECURITY
|
//SET PAGE ORIGIN FOR NAVIGATION AND SECURITY
|
||||||
$prev_page = $_SESSION['prev_origin_equipment'] ?? '';
|
$_SESSION['prev_origin_servicereport'] = $_SERVER['REQUEST_URI'];
|
||||||
$page = 'servicereports';
|
$prev_page = (isset($_SESSION['prev_origin_equipment'])) ? $_SESSION['prev_origin_equipment'] : $_SESSION['prev_origin'];
|
||||||
|
$page = $_SESSION['origin'] = 'servicereports';
|
||||||
|
|
||||||
//create backbutton to prev_origin
|
//create backbutton to prev_origin
|
||||||
$back_btn_orgin = ($prev_page != '')? '<a href="'.$prev_page.'" class="btn alt mar-right-2">'.$button_back.'</a>':'';
|
$back_btn_orgin = ($prev_page != '')? '<a href="'.$prev_page.'" class="btn alt mar-right-2">'.$button_back.'</a>':'';
|
||||||
@@ -25,20 +26,20 @@ if (isAllowed($page,$_SESSION['profile'],$_SESSION['permission'],'R') === 0){
|
|||||||
$pagination_page = isset($_GET['p']) ? $_GET['p'] : 1;
|
$pagination_page = isset($_GET['p']) ? $_GET['p'] : 1;
|
||||||
$status = isset($_GET['status']) ? '&status='.$_GET['status'] : '';
|
$status = isset($_GET['status']) ? '&status='.$_GET['status'] : '';
|
||||||
$search = isset($_GET['search']) ? '&search='.$_GET['search'] : '';
|
$search = isset($_GET['search']) ? '&search='.$_GET['search'] : '';
|
||||||
|
$equipmentid = isset($_GET['equipmentid']) ? '&equipmentid='.$_GET['equipmentid'] : '';
|
||||||
|
|
||||||
// Determine the URL
|
// Determine the URL
|
||||||
$url = 'index.php?page=servicereports'.$status.$search;
|
$url = 'index.php?page=servicereports'.$status.$search.$equipmentid;
|
||||||
//GET Details from URL
|
//GET Details from URL
|
||||||
$GET_VALUES = urlGETdetails($_GET) ?? '';
|
$GET_VALUES = urlGETdetails($_GET) ?? '';
|
||||||
//CALL TO API FOR History
|
//CALL TO API FOR History
|
||||||
$api_url = '/v1/equipments/type=ServiceReport&'.$GET_VALUES.'&history=0';
|
$api_url = '/v1/history/type=ServiceReport&'.$GET_VALUES.'';
|
||||||
$history = ioServer($api_url,'');
|
$history = ioServer($api_url,'');
|
||||||
|
|
||||||
//Decode Payload
|
//Decode Payload
|
||||||
if (!empty($history)){$history = decode_payload($history);}else{$history = null;}
|
if (!empty($history)){$history = decode_payload($history);}else{$history = null;}
|
||||||
|
|
||||||
//Return QueryTotal from API
|
//Return QueryTotal from API
|
||||||
$api_url = '/v1/equipments/type=ServiceReport&'.$GET_VALUES.'&totals=';
|
$api_url = '/v1/history/type=ServiceReport&'.$GET_VALUES.'&totals=';
|
||||||
$query_total = ioServer($api_url,'');
|
$query_total = ioServer($api_url,'');
|
||||||
//Decode Payload
|
//Decode Payload
|
||||||
if (!empty($query_total)){$query_total = decode_payload($query_total);}else{$query_total = null;}
|
if (!empty($query_total)){$query_total = decode_payload($query_total);}else{$query_total = null;}
|
||||||
@@ -76,7 +77,7 @@ if (empty($history)){
|
|||||||
<td colspan="8" style="text-align:center;">'.$servicereports_no_history.'</td>
|
<td colspan="8" style="text-align:center;">'.$servicereports_no_history.'</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
} else {
|
} else {
|
||||||
$service_events = serviceEvents($history);
|
$service_events = serviceEvents($history,$page);
|
||||||
}
|
}
|
||||||
|
|
||||||
$view .= '<div class="content-block">
|
$view .= '<div class="content-block">
|
||||||
|
|||||||
Reference in New Issue
Block a user