Refactor API endpoints and update invoice generation
- Updated API calls in equipment.php, equipment_manage.php, and equipments_mass_update.php to use v2 endpoints. - Changed payload decoding from decode_payload to json_decode for consistency. - Enhanced invoice generation in factuur.php and webhook files to use a new email template and PDF structure. - Added new email and PDF templates for invoices to improve formatting and readability. - Improved marketing folder handling in marketing.php with better payload management. - Updated CSS for marketing to enhance UI interactions. - Added JavaScript checks for browser compatibility in softwaretool.php. - Adjusted user permissions in settingsprofiles.php to reflect new features.
This commit is contained in:
@@ -54,11 +54,11 @@ $history = ioServer($api_url,'');
|
||||
if (!empty($history)){$history = json_decode($history);}else{$history = null;}
|
||||
|
||||
//CALL TO API FOR EQUIPMENT DATA
|
||||
$api_url = '/v1/equipment_data/equipmentid='.$responses->equipmentID;
|
||||
$api_url = '/v2/equipment_data/equipmentid='.$responses->equipmentID;
|
||||
$equipment_data = ioServer($api_url,'');
|
||||
|
||||
//Decode Payload
|
||||
if (!empty($equipment_data )){$equipment_data = decode_payload($equipment_data );}else{$equipment_data = null;}
|
||||
if (!empty($equipment_data )){$equipment_data = json_decode($equipment_data );}else{$equipment_data = null;}
|
||||
|
||||
//CALL TO API FOR CUSTOMER AND WARRANTY DATA (type = customer,Warranty in history)
|
||||
$api_url = '/v2/history/equipmentID='.$responses->equipmentID.'&type=customer,Warranty';
|
||||
@@ -83,10 +83,10 @@ if (is_array($registration_data) && count($registration_data) > 0) {
|
||||
}
|
||||
|
||||
//GET PRODUCTS_SOFTWARE
|
||||
$api_url = '/v1/products_software/productrowid='.$responses->productrowid.'&status=1';
|
||||
$api_url = '/v2/products_software_versions/hw_version='.$responses->hw_version.'&status=1';
|
||||
$products_software = ioServer($api_url,'');
|
||||
//Decode Payload
|
||||
if (!empty($products_software)){$products_software = decode_payload($products_software);}else{$products_software = null;}
|
||||
if (!empty($products_software)){$products_software = json_decode($products_software);}else{$products_software = null;}
|
||||
|
||||
//------------------------------
|
||||
//Variables
|
||||
@@ -96,6 +96,17 @@ $warrantydate = warrantyStatus($responses->warranty_date);
|
||||
$service_date_due = serviceStatus($responses->service_date);
|
||||
$firmware_status = availableFirmware($responses->sw_version, $responses->sw_version_latest);
|
||||
|
||||
// Get upgrade version text if exists
|
||||
$sw_version_upgrade_text = '';
|
||||
if (!empty($responses->sw_version_upgrade) && isset($products_software) && $products_software != '') {
|
||||
foreach ($products_software as $products_soft) {
|
||||
if ($products_soft->rowID == $responses->sw_version_upgrade) {
|
||||
$sw_version_upgrade_text = $products_soft->version;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Calculate Healthindex based on last test
|
||||
$total_score = assetHealthIndex($_SESSION['profile'],$_SESSION['permission'],$equipment_data,0);
|
||||
|
||||
@@ -117,15 +128,12 @@ if ($update_allowed === 1){
|
||||
//GET ALL POST DATA
|
||||
$data = json_encode($_POST, JSON_UNESCAPED_UNICODE);
|
||||
|
||||
//Secure data
|
||||
$payload = generate_payload($data);
|
||||
|
||||
//API call
|
||||
$responses = ioServer('/v1/history', $payload);
|
||||
$responses = ioServer('/v2/history', $data);
|
||||
if ($responses === 'NOK'){
|
||||
|
||||
} else {
|
||||
header('Location: index.php?page=equipment&equipmentID='.$_POST['equipmentid'].'&success_msg=2');
|
||||
header('Location: index.php?page=equipment&equipmentID='.$_POST['equipmentid'].'&success_msg=2');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -261,7 +269,7 @@ $view .= '<div class="content-block">
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:25%;">'.$software_status.'</td>
|
||||
<td>'.$firmware_status.'</td>
|
||||
<td>'.$firmware_status.((!empty($responses->sw_version_upgrade)) ? ' <i class="fa-solid fa-wrench" style="color: #ff9800;" title="Software override: '.htmlspecialchars($sw_version_upgrade_text).'"></i>' : '').'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:25%;">'.$equipment_label5.'</td>
|
||||
|
||||
Reference in New Issue
Block a user