CIM77 - Service reports alleen laatste 5
This commit is contained in:
@@ -119,9 +119,26 @@ elseif (isset($criterias['totals']) && $criterias['totals'] =='' && isset($crite
|
|||||||
//Request for total rows for history reports
|
//Request for total rows for history reports
|
||||||
$sql ='SELECT count(*) as count from history h LEFT JOIN equipment e ON h.equipmentid = e.rowID '.$whereclause.'';
|
$sql ='SELECT count(*) as count from history h LEFT JOIN equipment e ON h.equipmentid = e.rowID '.$whereclause.'';
|
||||||
}
|
}
|
||||||
elseif (isset($criterias['history']) && $criterias['history'] ==''){
|
elseif (isset($criterias['history']) && $criterias['history'] != ''){
|
||||||
|
|
||||||
|
//History INDICATOR
|
||||||
|
/*
|
||||||
|
0 Show All
|
||||||
|
1 Created DESC, LIMIT 5
|
||||||
|
*/
|
||||||
|
|
||||||
|
switch ($criterias['history']) {
|
||||||
|
case 1:
|
||||||
|
$sort = ' ORDER BY h.created DESC LIMIT 0,'.$page_rows_equipment_servicereporst;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$sort = '';
|
||||||
|
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.'';
|
$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
|
||||||
@@ -205,6 +222,14 @@ if (!empty($criterias)){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------
|
||||||
|
// Debuglog
|
||||||
|
//------------------------------------------
|
||||||
|
if (debug){
|
||||||
|
$message = $date.';'.$sql.';'.$username;
|
||||||
|
debuglog($message);
|
||||||
|
}
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
//Add paging details
|
//Add paging details
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
@@ -213,7 +238,7 @@ if(isset($criterias['totals']) && $criterias['totals']==''){
|
|||||||
$messages = $stmt->fetch();
|
$messages = $stmt->fetch();
|
||||||
$messages = $messages[0];
|
$messages = $messages[0];
|
||||||
}
|
}
|
||||||
elseif ((isset($criterias['history']) && $criterias['history'] =='') || (isset($criterias['download']) && $criterias['download'] =='')){
|
elseif ((isset($criterias['history']) && $criterias['history'] !='') || (isset($criterias['download']) && $criterias['download'] =='')){
|
||||||
//Excute Query
|
//Excute Query
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
//Get results
|
//Get results
|
||||||
|
|||||||
@@ -900,16 +900,22 @@ function serviceEvents ($messages){
|
|||||||
<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>';
|
||||||
}
|
}
|
||||||
$view_data .= '</tbody>';
|
|
||||||
|
}
|
||||||
|
//CHECK IF OUTPUT IS MORE THAN X (config setting)
|
||||||
|
if (count($messages) == $page_rows_equipment_servicereporst){
|
||||||
|
$view_data .= '<tr>
|
||||||
|
<td><a href="index.php?page=servicereports&search='.$message->h_equipmentid.'" class="btn_link">'.$general_actions_more.'</a></td>
|
||||||
|
</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($view_data == ''){
|
if ($view_data == ''){
|
||||||
$view_data = '<tr>
|
$view_data = '<tr>
|
||||||
<td colspan="4" style="text-align:center;">'.$service_report_no_text.'</td>
|
<td colspan="4" style="text-align:center;">'.$service_report_no_text.'</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$view_data .= '</tbody>';
|
||||||
$view_footer = '</table>';
|
$view_footer = '</table>';
|
||||||
|
|
||||||
$view = $view_header.$view_data.$view_footer;
|
$view = $view_header.$view_data.$view_footer;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ if (!empty($responses)){$responses = decode_payload($responses);}else{$responses
|
|||||||
$responses = $responses[0];
|
$responses = $responses[0];
|
||||||
|
|
||||||
//CALL TO API FOR History
|
//CALL TO API FOR History
|
||||||
$api_url = '/v1/equipments/equipmentID='.$_GET['equipmentID'].'&type=ServiceReport&history=';
|
$api_url = '/v1/equipments/equipmentID='.$_GET['equipmentID'].'&type=ServiceReport&history=1';
|
||||||
$history = ioServer($api_url,'');
|
$history = ioServer($api_url,'');
|
||||||
|
|
||||||
//Decode Payload
|
//Decode Payload
|
||||||
|
|||||||
@@ -8,8 +8,15 @@ defined(page_security_key) or exit;
|
|||||||
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 = $_SESSION['prev_origin_equipment'] ?? '';
|
||||||
|
$page = 'servicereports';
|
||||||
|
|
||||||
|
//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('servicereports',$_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;
|
||||||
}
|
}
|
||||||
@@ -24,7 +31,7 @@ $url = 'index.php?page=servicereports'.$status.$search;
|
|||||||
//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=';
|
$api_url = '/v1/equipments/type=ServiceReport&'.$GET_VALUES.'&history=0';
|
||||||
$history = ioServer($api_url,'');
|
$history = ioServer($api_url,'');
|
||||||
|
|
||||||
//Decode Payload
|
//Decode Payload
|
||||||
@@ -46,6 +53,7 @@ $view = '
|
|||||||
<p>'.$servicereports_p.'</p>
|
<p>'.$servicereports_p.'</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
'.$back_btn_orgin.'
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
$view .= '
|
$view .= '
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ $general_first = '↤'; // <-First;
|
|||||||
|
|
||||||
$general_view = 'Bekijk';
|
$general_view = 'Bekijk';
|
||||||
$general_actions = 'Acties';
|
$general_actions = 'Acties';
|
||||||
|
$general_actions_more = 'Meer resultaten';
|
||||||
|
|
||||||
$general_profile = 'Profiel';
|
$general_profile = 'Profiel';
|
||||||
$general_logout = 'Uitloggen';
|
$general_logout = 'Uitloggen';
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ $general_first = '↤'; // <-First;
|
|||||||
|
|
||||||
$general_view = 'View';
|
$general_view = 'View';
|
||||||
$general_actions = 'Actions';
|
$general_actions = 'Actions';
|
||||||
|
$general_actions_more = 'Show more';
|
||||||
|
|
||||||
$general_profile = 'Profile';
|
$general_profile = 'Profile';
|
||||||
$general_logout = 'Logout';
|
$general_logout = 'Logout';
|
||||||
@@ -240,7 +241,6 @@ $product_serialized = 'Serialized';
|
|||||||
$product_build = 'Build';
|
$product_build = 'Build';
|
||||||
$product_sales = 'Sales';
|
$product_sales = 'Sales';
|
||||||
|
|
||||||
|
|
||||||
$part_type1 = 'Product';
|
$part_type1 = 'Product';
|
||||||
$part_type2 = 'Sparepart';
|
$part_type2 = 'Sparepart';
|
||||||
$part_type3 = 'Loose_item';
|
$part_type3 = 'Loose_item';
|
||||||
@@ -277,7 +277,6 @@ $User_pw_reset = 'Password reset';
|
|||||||
$User_pw_login_count = 'Failed login attempts';
|
$User_pw_login_count = 'Failed login attempts';
|
||||||
$User_block = 'Blocked';
|
$User_block = 'Blocked';
|
||||||
|
|
||||||
|
|
||||||
$reset_message = 'Password reset started => See your email inbox for further instructions, you will be redirected to the login page.';
|
$reset_message = 'Password reset started => See your email inbox for further instructions, you will be redirected to the login page.';
|
||||||
$reset_message2 = 'Resettoken not valid, you will be redirected';
|
$reset_message2 = 'Resettoken not valid, you will be redirected';
|
||||||
$reset_message3 = 'Password minimal length of 6 characters';
|
$reset_message3 = 'Password minimal length of 6 characters';
|
||||||
|
|||||||
Reference in New Issue
Block a user