CM91 - RMA update

This commit is contained in:
“VeLiTi”
2024-12-10 11:49:04 +01:00
parent d2cb68ace4
commit b72f329154
16 changed files with 839 additions and 343 deletions

1
.gitignore vendored
View File

@@ -1,5 +1,6 @@
dev.php
test.php
migration.php
log_21.txt
log_22.txt
marketing/

View File

@@ -61,7 +61,7 @@ if(isset($get_content) && $get_content!=''){
$v = explode("=", $y);
//INCLUDE VARIABLES IN ARRAY
$criterias[$v[0]] = $v[1];
if ($v[0] == 'page' || $v[0] =='p' || $v[0] =='products' || $v[0] =='totals' || $v[0] =='history' || $v[0] =='success_msg' || $v[0] =='download' || $v[0] =='sort'){
if ($v[0] == 'page' || $v[0] =='p' || $v[0] =='products' || $v[0] =='list' || $v[0] =='totals' || $v[0] =='history' || $v[0] =='success_msg' || $v[0] =='download' || $v[0] =='sort'){
//do nothing
}
elseif ($v[0] == 'equipmentid') {
@@ -188,6 +188,10 @@ elseif (isset($criterias['products']) && $criterias['products'] ==''){
//Request for all products in equipment view
$sql = 'SELECT distinct(p.productcode), p.productname from equipment e LEFT JOIN products p ON e.productrowid = p.rowID '.$whereclause.' ORDER BY p.productcode';
}
elseif (isset($criterias['list']) && $criterias['list'] =='') {
//SQL for Paging
$sql = 'SELECT e.rowID, e.serialnumber FROM equipment e '.$whereclause.'';
}
elseif (isset($criterias['totals']) && $criterias['totals'] =='' && isset($criterias['type'])){
//Request for total rows for history reports
$sql ='SELECT count(*) as count FROM equipment_history h LEFT JOIN equipment e ON h.equipmentid = e.rowID '.$whereclause.'';
@@ -320,7 +324,7 @@ if(isset($criterias['totals']) && $criterias['totals']==''){
$messages = $stmt->fetch();
$messages = $messages[0];
}
elseif ((isset($criterias['history']) && $criterias['history'] !='') || (isset($criterias['products']) && $criterias['products'] =='') || (isset($criterias['download']) && $criterias['download'] =='')){
elseif ((isset($criterias['history']) && $criterias['history'] !='') || (isset($criterias['list']) && $criterias['list']=='') || (isset($criterias['products']) && $criterias['products'] =='') || (isset($criterias['download']) && $criterias['download'] =='')){
//Excute Query
$stmt->execute();
//Get results

View File

@@ -34,7 +34,7 @@ if(isset($get_content) && $get_content!=''){
$ye = ((isset($criterias['year']) && $criterias['year'] !='' )? $criterias['year'] : $curYear);
$mo = ((isset($criterias['month']) && $criterias['month'] !='')? $criterias['month'] : $curMonth);
$qu = ((isset($criterias['month']) ? (int)ceil($mo / 3): $curQuarter));
$da = $ye.'-'.$mo.'-01';
$da = $ye.'-'.$mo.'-'.date("d");
//CALL TO API TO GET ALL ACTIVE CONTRACTS
$api_url = '/v2/contracts/'.$GET_VALUES;

View File

@@ -60,7 +60,7 @@ if(isset($get_content) && $get_content!=''){
$v = explode("=", $y);
//INCLUDE VARIABLES IN ARRAY
$criterias[$v[0]] = $v[1];
if ($v[0] == 'page' || $v[0] =='p' || $v[0] =='products' || $v[0] =='totals' || $v[0] =='history' || $v[0] =='success_msg' || $v[0] =='download' || $v[0] =='sort'){
if ($v[0] == 'page' || $v[0] =='p' || $v[0] =='products' || $v[0] =='list' || $v[0] =='totals' || $v[0] =='history' || $v[0] =='success_msg' || $v[0] =='download' || $v[0] =='sort'){
//do nothing
}
elseif ($v[0] == 'equipmentid') {
@@ -179,6 +179,10 @@ elseif (isset($criterias['totals']) && $criterias['totals'] =='' && !isset($crit
//Request for total rows
$sql = 'SELECT count(*) as count from equipment e LEFT JOIN products p ON e.productrowid = p.rowID '.$whereclause.'';
}
elseif (isset($criterias['list']) && $criterias['list'] =='') {
//SQL for Paging
$sql = 'SELECT e.rowID, e.serialnumber FROM equipment e '.$whereclause.'';
}
elseif (isset($criterias['products']) && $criterias['products'] ==''){
//Request for all products in equipment view
$sql = 'SELECT distinct(p.productcode), p.productname from equipment e LEFT JOIN products p ON e.productrowid = p.rowID '.$whereclause.' ORDER BY p.productcode';
@@ -315,7 +319,7 @@ if(isset($criterias['totals']) && $criterias['totals']==''){
$messages = $stmt->fetch();
$messages = $messages[0];
}
elseif ((isset($criterias['history']) && $criterias['history'] !='') || (isset($criterias['products']) && $criterias['products'] =='') || (isset($criterias['download']) && $criterias['download'] =='')){
elseif ((isset($criterias['history']) && $criterias['history'] !='') || (isset($criterias['list']) && $criterias['list']=='') || (isset($criterias['products']) && $criterias['products'] =='') || (isset($criterias['download']) && $criterias['download'] =='')){
//Excute Query
$stmt->execute();
//Get results

View File

@@ -69,6 +69,10 @@ if(isset($get_content) && $get_content!=''){
$filter_key_2 = '"ServiceReport"';
$clause .= ' AND h.type = '.$filter_key_2.' AND h.description like '.$filter_key_1;
}
elseif ($v[0] == 'created') {
//build up search
$clause .= ' AND h.created > :'.$v[0];
}
else {//create clause
$clause .= ' AND '.$v[0].' = :'.$v[0];
}

View File

@@ -15,7 +15,6 @@ $whereclause = '';
//SET PARAMETERS FOR QUERY
$id = $post_content['rowID'] ?? ''; //check for rowID
$rma_id = $post_content['rmaID'] ?? 0; //check for rmaID
$command = ($id == '')? 'insert' : 'update'; //IF rowID = empty then INSERT
if (isset($post_content['delete'])){$command = 'delete';} //change command to delete
@@ -44,10 +43,14 @@ if ($command == 'insert'){
$post_content['createdby'] = $username;
}
//ENCODE HEADER AND QUESTIONS
if (isset($post_content['header'])){$post_content['header'] = json_encode($post_content['header'], JSON_UNESCAPED_UNICODE);}
if (isset($post_content['questions'])){$post_content['questions'] = json_encode($post_content['questions'], JSON_UNESCAPED_UNICODE);}
//CREAT NEW ARRAY AND MAP TO CLAUSE
if(isset($post_content) && $post_content!=''){
foreach ($post_content as $key => $var){
if ($key == 'submit' || $key == 'delete' || $key == 'rowID'){
if ($key == 'save' ||$key == 'submit' || $key == 'delete' || $key == 'rowID'){
//do nothing
}
else {
@@ -66,13 +69,13 @@ $clause_insert = substr($clause_insert, 2); //Clean clause - remove first comma
$input_insert = substr($input_insert, 1); //Clean clause - remove first comma
//QUERY AND VERIFY ALLOWED
if ($command == 'update' && $rma_id !=0 && isAllowed('rma',$profile,$permission,'U') === 1){
if ($command == 'update' && isAllowed('rma',$profile,$permission,'U') === 1){
$sql = 'UPDATE rma SET '.$clause.' WHERE rowID = ? '.$whereclause.'';
$execute_input[] = $id;
$stmt = $pdo->prepare($sql);
$stmt->execute($execute_input);
}
elseif ($command == 'insert' && $rma_id !=0 && isAllowed('rma',$profile,$permission,'C') === 1){
elseif ($command == 'insert' && isAllowed('rma',$profile,$permission,'C') === 1){
$sql = 'INSERT INTO rma ('.$clause_insert.') VALUES ('.$input_insert.')';
$stmt = $pdo->prepare($sql);
$stmt->execute($execute_input);

BIN
assets/images/tss-green.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -5,8 +5,11 @@ defined($security_key) or exit;
//------------------------------------------
$newuser_subject = 'CustomerPortal user created';
$newuser_header = 'Dear CustomerPortal user';
$newuser_text = 'Your CustomerPortal administrator has provided access to the CustomerPortal. To complete your account you need to update your password via the link below.';
$newuser_credential_label = 'Link to portal:';
$newuser_text = 'Your administrator has provided access to the CustomerPortal.';
$newuser_credential_text_1 = 'Your account has been created with username ';
$newuser_credential_text_2 = 'Please click the button below to complete your registration.';
$newuser_closure = 'For security reasons this link is only active for 10 minutes.';
//------------------------------------------
@@ -15,33 +18,77 @@ $newuser_closure = 'For security reasons this link is only active for 10 minutes
$subject = $newuser_subject;
$message = '
<html>
<head>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>' . $subject . '</title>
</head>
<body>
' . $newuser_header . ',
<br>
<br>
' . $newuser_text . '
<h4>' . $newuser_credential_label . '</h4>
<ul><li>user: '.$post_content['username'].'</li>
<li style="margin-top: 10px;list-style-type: none;">
<a href="https://' . $portalURL . '/reset.php?resetkey='.$resetkey.'" style="background-color: ' . $color . ';border: 1px solid;color: #fff;padding: 10px;text-align: center;text-decoration: none;font-size: 12px;border-radius: 5px;">
Reset Password
</a>
</li>
</ul>
<br>
' . $newuser_closure . '
<br>
<br>
Kind regards,<br>
<br>
<br>
<a href="https://'.$portalURL.'"><img src="https://'.$portalURL.emaillogo.'" alt="logo" width="10%" height="10%"/></a>
<br>
</body>
</html>
';
<style>
@media screen and (max-width: 600px) {
.content {
width: 100% !important;
display: block !important;
padding: 10px !important;
}
.header, .body, .footer {
padding: 20px !important;
}
}
</style>
</head>
<body style="font-family: Arial, sans-serif">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" style="padding: 20px;">
<table class="content" width="600" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse; border: 1px solid #cccccc;">
<!-- Header -->
<tr>
<td class="header" style="background-color:#005655; padding: 40px; text-align: center; color: white; font-size: 24px;">
CustomerPortal
</td>
</tr>
<!-- Body -->
<tr>
<td class="body" style="padding: 40px; text-align: left; font-size: 16px; line-height: 1.6;">
' . $newuser_header . ',
<br>
<br>
'.$newuser_text.' '.$newuser_credential_text_1.'<b>'.$post_content['username'].'</b>
<br>
<br>
'.$newuser_credential_text_2.'
</td>
</tr>
<!-- Call to action Button -->
<tr>
<td style="padding: 0px 40px 0px 40px; text-align: center;">
<!-- CTA Button -->
<table cellspacing="0" cellpadding="0" style="margin: auto;">
<tr>
<td align="center" style="background-color: #008685; padding: 10px 20px; border-radius: 5px;">
<a href="https://' . $portalURL . '/reset.php?resetkey='.$resetkey.'" target="_blank" style="color: #ffffff; text-decoration: none; font-weight: bold;">Reset Password</a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="body" style="padding: 40px; text-align: left; font-size: 16px; line-height: 1.6;">
' . $newuser_closure . '
</td>
</tr>
<!-- Footer -->
<tr>
<td class="footer" style="background: url(\'https://'.$portalURL.emaillogo.'\');background-position: center center;background-repeat:no-repeat;background-size:contain;background-color: #005655; padding: 40px;">
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
';

323
rma.php
View File

@@ -6,10 +6,68 @@ if (debug && debug_id == $_SESSION['id']){
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
}
//__________________________________________
//MOVE TO TRANSLATION FILES:
//__________________________________________
$button_create_rma = 'Create RMA';
//RMA
$rmas_h2 = 'Return Material';
$rmas_p = 'View, manage, and search RMA details.';
$rma_h2 = 'Return Material Request';
$message_rma_1 = 'RMA created successfully!';
$message_rma_2 = 'RMA updated successfully!';
$message_rma_3 = 'RMA deleted successfully!';
$message_no_rma = 'There is no RMA';
$rma_search = 'Search RMA...';
$rma_rowID = 'Request number';
$rma_status = 'Status';
$rma_status0_text = '1';
$rma_status1_text = '2';
$rma_status2_text = '3';
$rma_status3_text = '4';
$rma_status4_text = '5';
$rma_sw_version_latest = 'Latest software version';
$rma_servicereport_latest = 'Servicereport created last 7days';
$rma_information = 'RMA information';
$rma_return_reason = 'Return reason';
$rma_return_reason0_text = '';
$rma_return_reason1_text = '';
$rma_return_reason2_text = '';
$rma_return_reason3_text = '';
$rma_return_reason4_text = '';
$rma_return_reason5_text = '';
$rma_return_reasons_notes = 'Return reason notes';
$rma_return_tab1 = 'Return reason';
$rma_return_tab2 = 'Questions';
$rma_question_allowed_label1 = 'Yes';
$rma_question_allowed_label2 = 'No';
$rma_question_header_1 = '';
$rma_question_1 = 'Batteries working?';
$rma_question_2 = 'Button correctly working';
$rma_question_3 = '';
$rma_question_4 = '';
$rma_question_5 = '';
$rma_question_6 = '';
$rma_question_7 = '';
//__________________________________________
//__________________________________________
//__________________________________________
include_once './assets/functions.php';
include_once './settings/settings.php';
include_once './settings/systemrma.php';
$page = 'rmas';
$page = 'rma';
//Check if allowed
if (isAllowed($page,$_SESSION['profile'],$_SESSION['permission'],'R') === 0){
header('location: index.php');
@@ -20,154 +78,179 @@ $update_allowed = isAllowed($page ,$_SESSION['profile'],$_SESSION['permission'],
$delete_allowed = isAllowed($page ,$_SESSION['profile'],$_SESSION['permission'],'D');
$create_allowed = isAllowed($page ,$_SESSION['profile'],$_SESSION['permission'],'C');
$view_product = isAllowed('product' ,$_SESSION['profile'],$_SESSION['permission'],'R');
$view_history = isAllowed('history' ,$_SESSION['profile'],$_SESSION['permission'],'C');
//GET PARAMETERS
$pagination_page = isset($_GET['p']) ? $_GET['p'] : 1;
$search = isset($_GET['search']) ? '&search='.$_GET['search'] : '';
$rowID = $_GET['rowID'] ?? '';
// Determine the URL
$url = 'index.php?page='.$page.$search;
//GET Details from URL
$GET_VALUES = urlGETdetails($_GET) ?? '';
if ($rowID !=''){
$url = 'index.php?page=rma&rowID='.$rowID.'';
} else {
$url = 'index.php?page=rmas';
}
// ID param exists, edit an existing product
//CALL TO API
$api_url = '/v2/rma/'.$GET_VALUES;
$api_url = '/v2/rma/rowID='.$_GET['rowID'];
$responses = ioServer($api_url,'');
//Decode Payload
if (!empty($responses)){$responses = json_decode($responses,true);}else{$responses = null;}
$rma = json_decode(json_encode($responses[0]), true);
//GET DETAILS
$rma_header = json_decode($rma['header'],true) ?? '';
$rma_questions = json_decode($rma['questions'],true) ?? '';
//------------------------------
//Variables
//------------------------------
$status_text = 'rma_status'.$rma['status'].'_text';
//Return QueryTotal from API
$api_url = '/v2/rma/'.$GET_VALUES.'&totals=';
$query_total = ioServer($api_url,'');
//Decode Payload
if (!empty($query_total)){$query_total = json_decode($query_total,true);}else{$query_total = null;}
// Handle success messages
if (isset($_GET['success_msg'])) {
if ($_GET['success_msg'] == 1) {
$success_msg = $message_ct_1;
$success_msg = $message_rma_1;
}
if ($_GET['success_msg'] == 2) {
$success_msg = $message_ct_2;
$success_msg = $message_rma_2;
}
if ($_GET['success_msg'] == 3) {
$success_msg = $message_ct_3;
$success_msg = $message_rma_3;
}
}
}
if (isset($_GET['download'])){
downloadToExcel('rma',$responses);
}
template_header('RMA', 'rma','manage');
template_header('rma', 'rma' ,'view');
$view = '
<div class="content-title">
<div class="title">
<i class="fa-solid fa-car"></i>
<div class="txt">
<h2>'.$rma_h2.' ('.$query_total.')</h2>
<p>'.$rma_p.'</p>
</div>
</div>
</div>';
<div class="content-title responsive-flex-wrap responsive-pad-bot-3">
<h2 class="responsive-width-100">'.($rma_h2 ?? 'Return Material Request').' - '.$_GET['rowID'].'</h2>
<a href="index.php?page=rms" class="btn alt mar-right-2">'.$button_cancel.'</a>
';
if ($update_allowed === 1){
$view .= '<a href="index.php?page=rma_manage&rowID='.$_GET['rowID'].'" class="btn">Edit</a>';
}
$view .= '</div>';
if (isset($success_msg)){
$view .= ' <div class="msg success">
<i class="fas fa-check-circle"></i>
<p>'.$success_msg.'</p>
<i class="fas fa-times"></i>
</div>';
$view .= ' <div class="msg success">
<i class="fas fa-check-circle"></i>
<p>'.$success_msg.'</p>
<i class="fas fa-times"></i>
</div>';
}
$view .= '
<div class="content-header responsive-flex-column pad-top-5">';
if ($create_allowed ===1){
$view .= '<a href="index.php?page=rma_manage" class="btn">'.$button_create_rma.'</a>';
}
$view .= '
<form action="" method="get">
<input type="hidden" name="page" value="rma">
<div class="filters">
<a href="#"><i class="fa-solid fa-filter"></i>'.$general_filters.'</a>
<div class="list">
<select name="status">
<option value="" disabled selected>Active</option>
<option value="0">'.$disabled.'</option>
<option value="1">'.$enabled.'</option>
</select>
<button type="submit">'.$button_apply.'</button>
$view .= '<div class="content-block-wrapper">';
$view .= ' <div class="content-block order-details">
<div class="block-header">
<i class="fa-solid fa-circle-info"></i></i>'.($rma_information ?? 'RMA details').'
</div>
<div class="order-detail">
<h3>'.$equipment_label3.'</h3>
<p><span class="status id'.$rma['status'].'">'.$$status_text.'</span></p>
</div>
<div class="order-detail">
<h3>'.$equipment_label2.'</h3>
<p>'.$rma_header['serialnumber'].'</p>
</div>
<div class="order-detail">
<h3>'.$product_code.'</h3>
<p>'.(($view_product == 1)? '<a href="index.php?page=product&rowID='.$rma_header['productrowid'].'" class="btn2">'.$rma_header['productcode'].'</a>':'<input type="text" name="header[productcode]" value="'.$rma_header['productcode'].'">').'</p>
</div>
<div class="order-detail">
<h3>'.$product_name.'</h3>
<p>'.(($view_product == 1)? '<a href="index.php?page=product&rowID='.$rma_header['productrowid'].'" class="btn2">'.$rma_header['productname'].'</a>':'<input type="text" name="header[productname]" value="'.$rma_header['productname'].'">').'</p>
</div>
<div class="order-detail">
<h3>'.$equipment_label10.'</h3>
<p><input type="text" name="header[rowID]" value="'.$rma_header['rowID'].'"></p>
</div>
<div class="order-detail">
<h3>'.($rma_sw_version_latest ?? 'Latest software version').'</h3>
<p><select id="sw_version_latest" name="header[sw_version_latest]">
<option value="0" '.($rma_header['sw_version_latest']==0?' selected':'').'>'.$general_no .'</option>
<option value="1" '.($rma_header['sw_version_latest']==1?' selected':'').'>'.$general_yes .'</option>
</select>
</p>
</div>
<div class="order-detail">
<h3>'.($rma_servicereport_latest ?? 'Servicereport created last 7days').'</h3>
<p><select id="servicereport_available" name="header[servicereport_available]">
<option value="0" '.($rma_header['servicereport_available']==0?' selected':'').'>'.$general_no .'</option>
<option value="1" '.($rma_header['servicereport_available']==1?' selected':'').'>'.$general_yes .'</option>
</select>
</p>
</div>
';
$view .='
</div>
';
$view .='<div class="content-block order-details">
<div class="block-header">
<i class="fa-solid fa-user fa-sm"></i>'.$view_asset_partners.'
</div>
<div class="order-detail">
<h3>'.$general_soldto.'</h3>
<p><input type="text" name="header[soldto]" value="'.($rma_header['soldto'] ?? '').'"></p>
</div>
<div class="order-detail">
<h3>'.$general_shipto.'</h3>
<p><input type="text" name="header[shipto]" value="'.($rma_header['shipto'] ?? '').'"></p>
</div>
<div class="order-detail">
<h3>'.$general_location.'</h3>
<p><input type="text" name="header[location]" value="'.($rma_header['location'] ?? '').'"></p>
</div>
</div>';
//SHOW DOWNLOAD TO EXCELL OPTION ONLY TO ADMIN USERS
if ($_SESSION['permission'] == 3 || $_SESSION['permission'] == 4){
$view .='<div class="filters">
<a href="index.php?page=rma&download="><i class="fa-solid fa-download"></i></a>
</div>';
}
$view .= '<div class="search">
<label for="search">
<input id="search" type="text" name="search" placeholder="'.$rma_search.'" value="" class="responsive-width-100">
<i class="fas fa-search"></i>
</label>
$view .= '</div>';
// -------------------------------
//BUILD TO INPUT FORM BASED ON ARRAY
// ------------------------------
//
$view .='<div class="tabs">
<a href="#" class="active">'.($rma_return_tab1 ?? 'Return reason').'</a>';
if($rma_header['servicereport_available'] == 0 ){
$view .='<a href="#">'.($rma_return_tab2 ?? 'Questions').'</a>';
}
$view .= '</div>';
$view .= '<div class="content-block tab-content active">
<div class="form responsive-width-100">
<div class="order-detail">
<h3>'.($rma_return_reason ?? 'Return reason').'</h3>
<p><select id="return_reason" name="header[return_reason]">
<option value="0" '.($rma_header['return_reason']==0?' selected':'').'>'.$status0_text .'</option>
</select>
</p>
</div>
<div class="order-detail">
<h3>'.($rma_return_reason_note ?? 'Return reason note').'</h3>
<p><textarea id="return_reason_note" name="header[return_reason_note]" placeholder="'.($rma_return_reasons_notes ?? 'Return reason note').'" style="width: 100%;height: 150px;">'.$rma_header['return_reason_note'].'</textarea>
</p>
</div>
</div>
</div>';
$view .= '<div class="content-block tab-content">
<div class="form responsive-width-100">';
$view .= ' </div>
</div>
</form>
</div>
';
</form>';
$view .= '
<div class="content-block">
<div class="table">
<table class="sortable">
<thead>
<tr>
<th class="responsive-hidden">'.$rma_rowID.'</th>
<th>'.$rma_carbrand.'</th>
<th>'.$rma_cartype.'</th>
<th>'.$general_createdby.'</th>
<th>'.$general_actions.'</th>
</tr>
</thead>
<tbody>
';
if (empty($responses)){
$view .= '
<tr>
<td colspan="8" style="text-align:center;">'.$message_no_ct.'</td>
</tr>';
}
else {
foreach ($responses as $response){
$view .= '
<tr>
<td class="responsive-hidden">'.$response->rowID.'</td>
<td>'.$response->carbrand.'</td>
<td>'.$response->cartype.'</td>
<td>'.$response->createdby.'</td>
<td><a href="index.php?page=rma&rowID='.$response->rowID.'" class="btn_link">'.$general_view.'</a></td>
</tr>
';
}
}
$view .= '
</tbody>
</table>
</div>
</div>
</div>
';
$view.='<div class="pagination">';
if ($pagination_page > 1) {
$page = $pagination_page-1;
$view .= '<a href="'.$url.'&p=1">'.$general_first.'</a>';
$view .= '<a href="'.$url.'&p='.$page.'">'.$general_prev.'</a>';
}
$totals = ceil($query_total / $page_rows_rma) == 0 ? 1 : ceil($query_total / $page_rows_rma);
$view .= '<span> '.$general_page.$pagination_page.$general_page_of.$totals.'</span>';
if ($pagination_page * $page_rows_rma < $query_total){
$page = $pagination_page+1;
$view .= '<a href="'.$url.'&p='.$page.'">'.$general_next.'</a>';
$view .= '<a href="'.$url.'&p='.$totals.'">'.$general_last.'</a>';
}
$view .= '</div>';
//OUTPUT
echo $view;

458
rma_manage.php Normal file
View File

@@ -0,0 +1,458 @@
<?php
defined(page_security_key) or exit;
if (debug && debug_id == $_SESSION['id']){
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
}
//__________________________________________
//MOVE TO TRANSLATION FILES:
//__________________________________________
$button_create_rma = 'Create RMA';
//RMA
$rmas_h2 = 'Return Material';
$rmas_p = 'View, manage, and search RMA details.';
$rma_h2 = 'Return Material Request';
$message_rma_1 = 'RMA created successfully!';
$message_rma_2 = 'RMA updated successfully!';
$message_rma_3 = 'RMA deleted successfully!';
$message_no_rma = 'There is no RMA';
$rma_search = 'Search RMA...';
$rma_rowID = 'Request number';
$rma_status = 'Status';
$rma_sw_version_latest = 'Latest software version';
$rma_servicereport_latest = 'Servicereport created last 7days';
$rma_status0_text = '1';
$rma_status1_text = '2';
$rma_status2_text = '3';
$rma_status3_text = '4';
$rma_status4_text = '5';
$rma_information = 'RMA information';
$rma_return_reason = 'Return reason';
$rma_return_reason0_text = '';
$rma_return_reason1_text = '';
$rma_return_reason2_text = '';
$rma_return_reason3_text = '';
$rma_return_reason4_text = '';
$rma_return_reason5_text = '';
$rma_return_reasons_notes = 'Return reason notes';
$rma_return_tab1 = 'Return reason';
$rma_return_tab2 = 'Questions';
$rma_question_allowed_label1 = 'Yes';
$rma_question_allowed_label2 = 'No';
$rma_question_header_1 = '';
$rma_question_1 = 'Batteries working?';
$rma_question_2 = 'Button correctly working';
$rma_question_3 = '';
$rma_question_4 = '';
$rma_question_5 = '';
$rma_question_6 = '';
$rma_question_7 = '';
//__________________________________________
//__________________________________________
//__________________________________________
include_once './assets/functions.php';
include_once './settings/settings.php';
include_once './settings/systemrma.php';
$page = 'rma_manage';
//Check if allowed
if (isAllowed($page,$_SESSION['profile'],$_SESSION['permission'],'R') === 0){
header('location: index.php');
exit;
}
//PAGE Security
$update_allowed = isAllowed($page ,$_SESSION['profile'],$_SESSION['permission'],'U');
$delete_allowed = isAllowed($page ,$_SESSION['profile'],$_SESSION['permission'],'D');
$create_allowed = isAllowed($page ,$_SESSION['profile'],$_SESSION['permission'],'C');
$view_product = isAllowed('product' ,$_SESSION['profile'],$_SESSION['permission'],'R');
$view_history = isAllowed('history' ,$_SESSION['profile'],$_SESSION['permission'],'C');
$rowID = $_GET['rowID'] ?? '';
if ($rowID !=''){
$url = 'index.php?page=rma&rowID='.$rowID.'';
} else {
$url = 'index.php?page=rmas';
}
// Default input product values
$serial_input = '';
$rma = [
'rowID' => '',
'status' => 0,
'header' => [
'rowID'=> '',
'accounthierarchy'=> '',
'serialnumber'=>'',
'hw_version'=>'',
'sw_version'=>'',
'service_date'=>'',
'warranty_date'=> '',
'order_ref'=>'',
'sw_version_latest'=>'',
'servicereport_available' => '',
'productrowid' => '',
'productcode'=> '',
'productname'=> '',
'return_reason' => '',
'return_reason_note' => ''
],
'questions' => [],
'created' => '',
'createdby' => '',
'updated' => '',
'updatedby' => '',
'accounthierarchy' => ''
];
if (isset($_GET['rowID'])) {
// ID param exists, edit an existing product
//CALL TO API
$api_url = '/v2/rma/rowID='.$_GET['rowID'];
$responses = ioServer($api_url,'');
//Decode Payload
if (!empty($responses)){$responses = json_decode($responses,true);}else{$responses = null;}
$rma = json_decode(json_encode($responses[0]), true);
//GET DETAILS
$rma['header'] = json_decode($rma['header'],true) ?? '';
$rma['questions'] = json_decode($rma['questions'],true) ?? '';
$serial_input = '<input type="text" name="header[serialnumber]" value="'.$rma['header']['serialnumber'].'">';
if ($update_allowed === 1){
if (isset($_POST['save'])) {
//UPLOAD ALL PICTURES
foreach ($_FILES["fileToUpload"]["name"] as $key => $value){
//ONLY UPDATE PICTURES IF SOMETHING IS RETURNED
if($value !='' || !empty($value)){
uploadrequest($key);
}
}
//GET ALL POST DATA
$payload = json_encode($_POST, JSON_UNESCAPED_UNICODE);
//API call
$responses = ioServer('/v2/rma', $payload);
if ($responses === 'NOK'){
} else {
header('Location: index.php?page=rma&rowID='.$_GET['rowID'].'&success_msg=2');
exit;
}
}
}
if ($delete_allowed === 1){
if (isset($_POST['delete'])) {
//GET ALL POST DATA
$payload = json_encode($_POST , JSON_UNESCAPED_UNICODE);
//API call
$responses = ioServer('/v2/rma', $payload);
// Redirect and delete equipment
if ($responses === 'NOK'){
} else {
header('Location: index.php?page=rmas&success_msg=3');
exit;
}
}
}
} else {
if (isset($_POST['assetID'])){
//GET RELATED DATA
$api_url = '/v2/equipments/serialnumber='.$_POST['assetID'];
$equipment = ioServer($api_url,'');
//Decode Payload
if (!empty($equipment)){$equipment = json_decode( $equipment,true);}else{$equipment = null;}
if (isset($equipment[0]['rowID'])){
//CHECK FOR LATEST SERVICEREPORT
$servicereport_date = date("Y-m-d", strtotime("-7 days"));
$api_url = '/v2/history/equipmentid='.$equipment[0]['rowID'].'&type=servicereport&created='.$servicereport_date.'&totals=';
$servicereport = ioServer($api_url,'');
//Decode Payload
if (!empty($servicereport)){$servicereport = json_decode( $servicereport,true);}else{$servicereport = null;}
//GetPartnerDetails
$partner_data = json_decode($equipment[0]['accounthierarchy'],true) ?? '';
if (is_array($partner_data)){
$soldto = getPartnerName($partner_data['soldto']) ?? '-';
$shipto = getPartnerName($partner_data['shipto']) ?? '-';
$location = getPartnerName($partner_data['location']) ?? '-';
}
$rma = [
'rowID' => '',
'status' => 0,
'header' => [
'rowID'=> $equipment[0]['rowID'],
'serialnumber'=> $equipment[0]['serialnumber'],
'hw_version'=> $equipment[0]['hw_version'],
'sw_version'=>$equipment[0]['sw_version'],
'service_date'=> date('Y-m-d', strtotime($equipment[0]['service_date']. ' + 365 days')),
'warranty_date'=> date('Y-m-d', strtotime($equipment[0]['warranty_date']. ' + 365 days')),
'order_ref'=>$equipment[0]['order_ref'],
'sw_version_latest'=>$equipment[0]['sw_version_latest'],
'servicereport_available' => (($servicereport !=0) ? 1 : 0),
'productrowid'=> $equipment[0]['productrowid'],
'productcode'=> $equipment[0]['productcode'],
'productname'=> $equipment[0]['productname'],
'return_reason' => '',
'return_reason_note' => '',
'soldto'=> $soldto,
'shipto'=> $shipto,
'location'=> $location
],
'questions' => [],
'created' => '',
'createdby' => '',
'updated' => '',
'updatedby' => '',
'accounthierarchy' => ''
];
$serial_input = '<input type="text" name="header[serialnumber]" value="'.$rma['header']['serialnumber'].'">';
} else {
$serial_input = '<input type="text" name="header[serialnumber]" value="'.$_POST['assetID'].'">';
}
} else {
//GET RELATED SERIALNUMBERS
//CALL TO API
$api_url = '/v2/equipments/list=';
$assets_keys = ioServer($api_url,'');
//Decode Payload
if (!empty($assets_keys)){$assets_keys = json_decode($assets_keys,true);}else{$assets_keys = null;}
//CREATE SERIALNUMBER DROPDOWN
$serial_input ='<input type="text" list="serialnumbers" name="assetID" class="datalist" onchange="this.form.submit();">
<datalist id="serialnumbers">';
foreach ($assets_keys as $assets_key) {
$serial_input .= '<option>'.$assets_key['serialnumber'].'</option>';
}
$serial_input .= '</datalist>';
//END DROPDOWN
}
// Create a new equipment
if (isset($_POST['save'])) {
//UPLOAD ALL PICTURES
foreach ($_FILES["fileToUpload"]["name"] as $key => $value){
//ONLY UPDATE PICTURES IF SOMETHING IS RETURNED
if($value !='' || !empty($value)){
uploadrequest($key);
}
}
//GET ALL POST DATA
$payload = json_encode($_POST, JSON_UNESCAPED_UNICODE);
var_dump($payload);
//API call
$responses = ioServer('/v2/rma', $payload);
if ($responses === 'NOK'){
} else {
header('Location: index.php?page=rmas&success_msg=1');
exit;
}
}
}
template_header('RMA', 'rma','manage');
$view ='
<form action="" method="post" enctype="multipart/form-data">
<div class="content-title responsive-flex-wrap responsive-pad-bot-3">
<h2 class="responsive-width-100"><?=$page?>'.($rma_h2 ?? 'Return Material Request').'</h2>
<a href="'.$url .'" class="btn alt mar-right-2">'.$button_cancel.'</a>
';
if ($delete_allowed === 1){
$view .= '<input type="submit" name="delete" value="Delete" class="btn red mar-right-2" onclick="return confirm(\'Are you sure you want to delete this request?\')">';
}
if ($update_allowed === 1){
$view .= '<input type="submit" name="save" value="Save" class="btn">';
}
$view .= '</div>';
$view .= '<div class="content-block-wrapper">';
$view .= ' <div class="content-block order-details">
<div class="block-header">
<i class="fa-solid fa-circle-info"></i></i>'.($rma_information ?? 'RMA details').'
</div>
<div class="order-detail">
<h3>'.$equipment_label3.'</h3>
<p><select id="status" name="status" >
<option value="0" '.($rma['status']==0?' selected':'').'>'.$rma_status0_text .'</option>
<option value="1" '.($rma['status']==1?' selected':'').'>'.$rma_status1_text .'</option>
<option value="2" '.($rma['status']==2?' selected':'').'>'.$rma_status2_text .'</option>
<option value="3" '.($rma['status']==3?' selected':'').'>'.$rma_status3_text .'</option>
<option value="4" '.($rma['status']==4?' selected':'').'>'.$rma_status4_text .'</option>
</select></p>
</div>
<div class="order-detail">
<h3>'.$equipment_label2.'</h3>
<p>'.$serial_input.'</p>
</div>
<div class="order-detail">
<h3>'.$product_code.'</h3>
<p>'.(($view_product == 1)? '<a href="index.php?page=product&rowID='.$rma['header']['productrowid'].'" class="btn2">'.$rma['header']['productcode'].'</a>':'<input type="text" name="header[productcode]" value="'.$rma['header']['productcode'].'">').'</p>
</div>
<div class="order-detail">
<h3>'.$product_name.'</h3>
<p>'.(($view_product == 1)? '<a href="index.php?page=product&rowID='.$rma['header']['productrowid'].'" class="btn2">'.$rma['header']['productname'].'</a>':'<input type="text" name="header[productname]" value="'.$rma['header']['productname'].'">').'</p>
</div>
<div class="order-detail">
<h3>'.$equipment_label10.'</h3>
<p><input type="text" name="header[rowID]" value="'.$rma['header']['rowID'].'"></p>
</div>
<div class="order-detail">
<h3>'.($rma_sw_version_latest ?? 'Latest software version').'</h3>
<p><select id="sw_version_latest" name="header[sw_version_latest]">
<option value="0" '.($rma['header']['sw_version_latest']==0?' selected':'').'>'.$general_no .'</option>
<option value="1" '.($rma['header']['sw_version_latest']==1?' selected':'').'>'.$general_yes .'</option>
</select>
</p>
</div>
<div class="order-detail">
<h3>'.($rma_servicereport_latest ?? 'Servicereport created last 7days').'</h3>
<p><select id="servicereport_available" name="header[servicereport_available]">
<option value="0" '.($rma['header']['servicereport_available']==0?' selected':'').'>'.$general_no .'</option>
<option value="1" '.($rma['header']['servicereport_available']==1?' selected':'').'>'.$general_yes .'</option>
</select>
</p>
</div>
<input type="hidden" name="header[productrowid]" value="'.$rma['header']['productrowid'].'" readonly>
<input type="hidden" name="header[rowID]" value="'.$rma['header']['rowID'].'" readonly>
<input type="hidden" name="header[productcode]" value="'.$rma['header']['productcode'].'" readonly>
<input type="hidden" name="header[productname]" value="'.$rma['header']['productname'].'" readonly>
<input type="hidden" name="rowID" value="'.$rma['rowID'].'" readonly>
';
$view .='
</div>
';
$view .='<div class="content-block order-details">
<div class="block-header">
<i class="fa-solid fa-user fa-sm"></i>'.$view_asset_partners.'
</div>
<div class="order-detail">
<h3>'.$general_soldto.'</h3>
<p><input type="text" name="header[soldto]" value="'.($rma['header']['soldto'] ?? '').'"></p>
</div>
<div class="order-detail">
<h3>'.$general_shipto.'</h3>
<p><input type="text" name="header[shipto]" value="'.($rma['header']['shipto'] ?? '').'"></p>
</div>
<div class="order-detail">
<h3>'.$general_location.'</h3>
<p><input type="text" name="header[location]" value="'.($rma['header']['location'] ?? '').'"></p>
</div>
</div>';
$view .= '</div>';
// -------------------------------
//BUILD TO INPUT FORM BASED ON ARRAY
// ------------------------------
//
$view .='<div class="tabs">
<a href="#" class="active">'.($rma_return_tab1 ?? 'Return reason').'</a>';
if($rma['header']['servicereport_available'] == 0 ){
$view .='<a href="#">'.($rma_return_tab2 ?? 'Questions').'</a>';
}
$view .= '</div>';
$view .= '<div class="content-block tab-content active">
<div class="form responsive-width-100">
<div class="order-detail">
<h3>'.($rma_return_reason ?? 'Return reason').'</h3>
<p><select id="return_reason" name="header[return_reason]">
<option value="0" '.($rma['header']['return_reason']==0?' selected':'').'>'.$status0_text .'</option>
</select>
</p>
</div>
<div class="order-detail">
<h3>'.($rma_return_reason_note ?? 'Return reason note').'</h3>
<p><textarea id="return_reason_note" name="header[return_reason_note]" placeholder="'.($rma_return_reasons_notes ?? 'Return reason note').'" style="width: 100%;height: 150px;">'.$rma['header']['return_reason_note'].'</textarea>
</p>
</div>
</div>
</div>';
$view .= '<div class="content-block tab-content">
<div class="form responsive-width-100">';
if($rma['header']['servicereport_available'] == 0 ){
foreach($arrayQuestions_rma as $group){
foreach($group['Questions_in_group'] as $question){
switch ($question['Type']) {
case 'dropdown':
$view .= '<label for="" id="'.$question['QuestionID'].'">'.$question['Question'].'</label>';
$view .= '<select id="" name="questions['.$question['QuestionID'].']" required>';
$view .= '<option value=>'.$cartest_allowed_label0.'</option>';
foreach ($question['Response'] as $response){
$view .= '<option value="'.$response['responseID'].'" '.((isset($cartest['questions'][$question['QuestionID']]) && $cartest['questions'][$question['QuestionID']] == $response['responseID'])? 'selected':'').'>'.$response['Response'].'</option>';
}
$view .= '</select>';
break;
case 'textarea':
$view .= '<label for="" id="'.$question['QuestionID'].'">'.$question['Question'].'</label>';
$view .= '<textarea id="QuestionID" name="questions['.$question['QuestionID'].']" placeholder="">'.(isset($cartest['questions'][$question['QuestionID']])?$cartest['questions'][$question['QuestionID']]:'').'</textarea>';
break;
case 'file';
$view .= '<label for="" id="">'.$question['Question'].'</label>';
if ($question['QuestionID'] !=''){
$view .= '<input type="hidden" name="questions['.$question['QuestionID'].']" value="'.$cartest['questions'][$question['QuestionID']].'" />
<input type="file" name="fileToUpload['.$question['QuestionID'].']" onchange="preview('.$question['QuestionID'].')" style="width: 30%;padding: 50px 0 0 0;height: 10px;"><img id="'.$question['QuestionID'].'" src="'.$cartest['questions'][$question['QuestionID']].'" width="150px"/>';
} else {
$view .= '<input type="file" name="fileToUpload['.$question['QuestionID'].']" onchange="preview('.$question['QuestionID'].')" style="width: 30%;padding: 50px 0 0 0;height: 10px;" required><img id="'.$question['QuestionID'].'" src="" width="150px"/>';
}
break;
}
}
}
}
$view .= ' </div>
</div>
</form>';
$view .= '
</div>
</div>
';
//OUTPUT
echo $view;
template_footer();
?>

View File

@@ -4,12 +4,13 @@ defined(page_security_key) or exit;
//__________________________________________
//MOVE TO TRANSLATION FILES:
//__________________________________________
$button_create_rma = 'Create RMA';
//RMA
$rmas_h2 = 'Return Material';
$rmas_p = 'View, manage, and search RMA details.';
$rma_h2 = 'RMA';
$rma_h2 = 'Return Material Request';
$message_rma_1 = 'RMA created successfully!';
$message_rma_2 = 'RMA updated successfully!';
@@ -20,8 +21,40 @@ $rma_search = 'Search RMA...';
$rma_rowID = 'Request number';
$rma_status = 'Status';
$rma_sw_version_latest = 'Latest software version';
$rma_servicereport_latest = 'Servicereport created last 7days';
$rma_status0_text = '1';
$rma_status1_text = '2';
$rma_status2_text = '3';
$rma_status3_text = '4';
$rma_status4_text = '5';
$rma_information = 'RMA information';
$rma_return_reason = 'Return reason';
$rma_return_reason0_text = '';
$rma_return_reason1_text = '';
$rma_return_reason2_text = '';
$rma_return_reason3_text = '';
$rma_return_reason4_text = '';
$rma_return_reason5_text = '';
$rma_return_reasons_notes = 'Return reason notes';
$rma_return_tab1 = 'Return reason';
$rma_return_tab2 = 'Questions';
$rma_question_allowed_label1 = 'Yes';
$rma_question_allowed_label2 = 'No';
$rma_question_header_1 = '';
$rma_question_1 = 'Batteries working?';
$rma_question_2 = 'Button correctly working';
$rma_question_3 = '';
$rma_question_4 = '';
$rma_question_5 = '';
$rma_question_6 = '';
$rma_question_7 = '';
//__________________________________________
//__________________________________________
//__________________________________________
@@ -58,6 +91,7 @@ $GET_VALUES = urlGETdetails($_GET) ?? '';
//CALL TO API
$api_url = '/v2/rma/'.$GET_VALUES;
$responses = ioServer($api_url,'');
//Decode Payload
if (!empty($responses)){$responses = json_decode($responses,true);}else{$responses = null;}
@@ -163,10 +197,15 @@ $view .= '
}
else {
foreach ($responses as $response){
//------------------------------
//Variables
//------------------------------
$status_text = 'rma_status'.$response['status'].'_text';
$view .= '
<tr>
<td class="responsive-hidden">'.$response['rowID'].'</td>
<td>'.$response['status'].'</td>
<td>'.$$status_text.'</td>
<td>'.$response['created'].'</td>
<td>'.$response['createdby'].'</td>
<td>'.$response['updated'].'</td>

View File

@@ -8,7 +8,7 @@
// into translation files and corresponding profile
//------------------------------------------
//Menu Setup
$main_menu = array ('dashboard','sales','build','cartests','marketing','equipments','products','reporting','admin','settings');
$main_menu = array ('dashboard','sales','buildtool','cartests','marketing','equipments','products','reporting','admin','settings');
//Sub menus
$equipments_sub = array('equipments','servicereports','rmas','histories','firmwaretool','equipments_mass_update');
@@ -152,7 +152,7 @@ $urls = array(
"icon" => "fas fa-tachometer-alt",
"name" => "menu_marketing"
),
"build" => array(
"buildtool" => array(
"url" => "buildtool",
"selected" => "buildtool",
"icon" => "fas fa-tachometer-alt",

View File

@@ -6,9 +6,9 @@ define('superuser_profile','dashboard,profile,assets,equipments,equipment,equipm
/*Admin*/
define('admin_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,buildtool,products,products_versions,products_software,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_contracts_billing,report_healthindex,changelog,application');
/*AdminPlus*/
define('adminplus_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,buildtool,products,products_versions,products_software,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_contracts_billing,report_healthindex,report_usage,config,settings,logfile,changelog,language,application,maintenance,profiles,vin');
define('adminplus_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,rmas,rma,rma_manage,rma_history,rma_history_manage,buildtool,products,products_versions,products_software,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_contracts_billing,report_healthindex,report_usage,config,settings,logfile,changelog,language,application,maintenance,profiles,vin');
/*Build*/
define('build','buildtool,firmwaretool,buildtool,products_software,application');
define('build','dashboard,profile,buildtool,firmwaretool,buildtool,products_software,application');
/*Distribution*/
define('distribution','dashboard,profile,assets,equipments,equipment,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,products,products_versions,products_software,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,marketing,application');
/*Firmware*/

View File

@@ -13,6 +13,7 @@ $all_views = [
"contracts",
"contract",
"contract_manage",
"billing",
"cartests",
"cartest",
"cartest_manage",

30
settings/systemrma.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
//=================================================================
// RMA allowed responses ===================================
//=================================================================
$allowedResponse_1 = array(
array("responseID" => "1", "Response" => $rma_question_allowed_label1),
array("responseID" => "2", "Response" => $rma_question_allowed_label2)
);
//=================================================================
// RMA Tool questions ===================================
//=================================================================
$arrayQuestions_rma = array(
array("Group" => $rma_question_header_1,
"Group_sequence" => '1',
"Questions_in_group" => array(
array("Question_sequence" => '1',"QuestionID" => "rma_1","Question" => $rma_question_1, "Type" => 'dropdown', "Response" => $allowedResponse_1),
array("Question_sequence" => '2',"QuestionID" => "rma_2","Question" => $rma_question_2, "Type" => 'dropdown', "Response" => $allowedResponse_1),
array("Question_sequence" => '3',"QuestionID" => "rma_3","Question" => $rma_question_3, "Type" => 'dropdown', "Response" => $allowedResponse_1),
array("Question_sequence" => '4',"QuestionID" => "rma_4","Question" => $rma_question_4, "Type" => 'dropdown', "Response" => $allowedResponse_1)
)
)
);
//=================================================================
// ===================================
//=================================================================

View File

@@ -96,182 +96,4 @@ $init = array(
)
);
//=================================================================
//SERVICE Tool allowed responses===================================
//=================================================================
$allowedResponseRadio = array(
array("responseID" => "1", "Response" => $service_allowed_label1),
array("responseID" => "2", "Response" => $service_allowed_label2)
);
$allowedResponseDropdownDamage = array(
array("responseID" => "5", "Response" => $service_allowed_label5),
array("responseID" => "4", "Response" => $service_allowed_label4),
array("responseID" => "3", "Response" => $service_allowed_label3),
array("responseID" => "9", "Response" => $service_allowed_label9)
);
$allowedResponseDropdownCorrosion = array(
array("responseID" => "6", "Response" => $service_allowed_label1),
array("responseID" => "7", "Response" => $service_allowed_label2)
);
// Negative answers
$negative_results = array("2","3","6");
//=================================================================
//SERVICE Tool Visual Inspection===================================
//=================================================================
$arrayQuestions_visual = array(
array("Group" => $group_header_1,
"Group_sequence" => '1',
"Questions_in_group" => array(
array("Question_sequence" => '1',"QuestionID" => "service_visual_1","Question" => $service_visual_1, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '2',"QuestionID" => "service_visual_2","Question" => $service_visual_2, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '3',"QuestionID" => "service_visual_3","Question" => $service_visual_3, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '4',"QuestionID" => "service_visual_4","Question" => $service_visual_4, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio)
)
),
array("Group" => $group_header_2,
"Group_sequence" => '2',
"Questions_in_group" => array(
array("Question_sequence" => '1',"QuestionID" => "service_visual_5", "Question" => $service_visual_5, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '2',"QuestionID" => "service_visual_6", "Question" => $service_visual_6, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '3',"QuestionID" => "service_visual_7", "Question" => $service_visual_7, "Type" => 'Radiobutton', "Response" => $allowedResponseDropdownCorrosion),
array("Question_sequence" => '4',"QuestionID" => "service_visual_8", "Question" => $service_visual_8, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownDamage)
)
),
array("Group" => $group_header_3,
"Group_sequence" => '3',
"Questions_in_group" => array(
array("Question_sequence" => '1',"QuestionID" => "service_visual_9", "Question" => $service_visual_9, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '2',"QuestionID" => "service_visual_10", "Question" => $service_visual_10, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '3',"QuestionID" => "service_visual_11", "Question" => $service_visual_11, "Type" => 'Radiobutton', "Response" => $allowedResponseDropdownCorrosion),
array("Question_sequence" => '4',"QuestionID" => "service_visual_12", "Question" => $service_visual_12, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownDamage)
)
),
array("Group" => $group_header_4,
"Group_sequence" => '4',
"Questions_in_group" => array(
array("Question_sequence" => '1',"QuestionID" => "service_visual_13", "Question" => $service_visual_13, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '2',"QuestionID" => "service_visual_14", "Question" => $service_visual_14, "Type" => 'Radiobutton', "Response" => $allowedResponseDropdownCorrosion),
array("Question_sequence" => '2',"QuestionID" => "service_visual_15", "Question" => $service_visual_15, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '2',"QuestionID" => "service_visual_16", "Question" => $service_visual_16, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '2',"QuestionID" => "service_visual_17", "Question" => $service_visual_17, "Type" => 'Radiobutton', "Response" => $allowedResponseDropdownCorrosion),
array("Question_sequence" => '2',"QuestionID" => "service_visual_18", "Question" => $service_visual_18, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio)
)
),
array("Group" => $group_header_5,
"Group_sequence" => '5',
"Questions_in_group" => array(
array("Question_sequence" => '1',"QuestionID" => "service_visual_19", "Question" => $service_visual_19, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '2',"QuestionID" => "service_visual_20", "Question" => $service_visual_20, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownDamage),
array("Question_sequence" => '3',"QuestionID" => "service_visual_21", "Question" => $service_visual_21, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownDamage),
array("Question_sequence" => '4',"QuestionID" => "service_visual_22", "Question" => $service_visual_22, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownDamage)
)
)
);
//=================================================================
//SERVICE Tool Finalize ===================================
//=================================================================
$arrayQuestions_finalize = array(
array("Group" => $group_header_6,
"Group_sequence" => '1',
"Questions_in_group" => array(
array("Question_sequence" => '1',"QuestionID" => "service_action_clean", "Question" => $service_action_clean, "Type" => 'Checkbox', "Response" => ""),
array("Question_sequence" => '2',"QuestionID" => "service_action_battery", "Question" => $service_action_battery, "Type" => 'Checkbox', "Response" => "")
)
),
array("Group" => $group_header_7,
"Group_sequence" => '1',
"Questions_in_group" => array(
array("Question_sequence" => '1',"QuestionID" => "service_notes", "Question" => $service_notes, "Type" => 'Textarea', "Response" => "")
)
),
array("Group" => $group_header_8,
"Group_sequence" => '3',
"Questions_in_group" => array(
array("Question_sequence" => '1',"QuestionID" => "service_action_serial", "Question" => $service_action_serial, "Type" => 'Checkbox', "Response" => ""),
array("Question_sequence" => '2',"QuestionID" => "service_action_cover", "Question" => $service_action_cover, "Type" => 'Checkbox', "Response" => ""),
array("Question_sequence" => '3',"QuestionID" => "service_action_spudger", "Question" => $service_action_spudger, "Type" => 'Checkbox', "Response" => ""),
array("Question_sequence" => '4',"QuestionID" => "service_action_case", "Question" => $service_action_case, "Type" => 'Checkbox', "Response" => ""),
array("Question_sequence" => '5',"QuestionID" => "service_action_instructions", "Question" => $service_action_instructions, "Type" => 'Checkbox', "Response" => "")
)
),
array("Group" => $group_header_9,
"Group_sequence" => '4',
"Questions_in_group" => array(
array("Question_sequence" => '1',"QuestionID" => "service_mandatory_question", "Question" => $service_mandatory_question, "Type" => 'Checkbox', "Response" => "")
)
)
);
$arrayQuestions_legacy = array(
array("Group" => $group_header_legacy_1,
"Group_sequence" => '1',
"Questions_in_group" => array(
array("Question_sequence" => '1',"QuestionID" => "question1","Question" => $question1, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '2',"QuestionID" => "question2","Question" => $question2, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '3',"QuestionID" => "question3","Question" => $question3, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '4',"QuestionID" => "question4","Question" => $question4, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio)
)
),
array("Group" => $group_header_legacy_2,
"Group_sequence" => '2',
"Questions_in_group" => array(
array("Question_sequence" => '1',"QuestionID" => "question5", "Question" => $question5, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio)
)
),
array("Group" => $group_header_legacy_3,
"Group_sequence" => '3',
"Questions_in_group" => array(
array("Question_sequence" => '1',"QuestionID" => "question6", "Question" => $question6, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '2',"QuestionID" => "question7", "Question" => $question7, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '3',"QuestionID" => "question8", "Question" => $question8, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '4',"QuestionID" => "question9", "Question" => $question9, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio)
)
),
array("Group" => $group_header_legacy_4,
"Group_sequence" => '4',
"Questions_in_group" => array(
array("Question_sequence" => '1',"QuestionID" => "question11a", "Question" => $question11, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownCorrosion),
array("Question_sequence" => '2',"QuestionID" => "question12a", "Question" => $question12, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownCorrosion),
array("Question_sequence" => '3',"QuestionID" => "question13a", "Question" => $question13, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownCorrosion),
array("Question_sequence" => '4',"QuestionID" => "question14a", "Question" => $question14, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownCorrosion),
array("Question_sequence" => '5',"QuestionID" => "question18a", "Question" => $question18, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownCorrosion)
)
),
array("Group" => $group_header_legacy_5,
"Group_sequence" => '5',
"Questions_in_group" => array(
array("Question_sequence" => '1',"QuestionID" => "question10", "Question" => $question10, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownDamage),
array("Question_sequence" => '2',"QuestionID" => "question11", "Question" => $question11, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownDamage),
array("Question_sequence" => '3',"QuestionID" => "question12", "Question" => $question12, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownDamage),
array("Question_sequence" => '4',"QuestionID" => "question13", "Question" => $question13, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownDamage),
array("Question_sequence" => '5',"QuestionID" => "question14", "Question" => $question14, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownDamage),
array("Question_sequence" => '6',"QuestionID" => "question15", "Question" => $question15, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownDamage),
array("Question_sequence" => '7',"QuestionID" => "question16", "Question" => $question16, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownDamage),
array("Question_sequence" => '8',"QuestionID" => "question17", "Question" => $question17, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownDamage),
array("Question_sequence" => '9',"QuestionID" => "question18", "Question" => $question18, "Type" => 'Dropdown', "Response" => $allowedResponseDropdownDamage)
)
),
array("Group" => $group_header_legacy_6,
"Group_sequence" => '6',
"Questions_in_group" => array(
array("Question_sequence" => '1',"QuestionID" => "question20", "Question" => $question20, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '2',"QuestionID" => "question22", "Question" => $question22, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio)
)
),
array("Group" => $group_header_legacy_7,
"Group_sequence" => '7',
"Questions_in_group" => array(
array("Question_sequence" => '1',"QuestionID" => "question21", "Question" => $question21, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '2',"QuestionID" => "question23", "Question" => $question23, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio),
array("Question_sequence" => '3',"QuestionID" => "question24", "Question" => $question24, "Type" => 'Radiobutton', "Response" => $allowedResponseRadio)
)
),
);
?>