From 6bb7b2d1de4a78c7515f04dd1b0d15bc0a3ac72d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9CVeLiTi=E2=80=9D?= <“info@veliti.nl”>
Date: Mon, 2 Dec 2024 19:10:33 +0100
Subject: [PATCH 1/3] CMXX - Change history table to equipment_history
---
api/v1/post/application.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/api/v1/post/application.php b/api/v1/post/application.php
index 88b1fbb..83aefc5 100644
--- a/api/v1/post/application.php
+++ b/api/v1/post/application.php
@@ -108,7 +108,7 @@ switch ($action) {
if ($rowID){
//check if under warranty
- $warranty = getrowID($dbname,'rowID','history','equipmentid="'.$rowID['rowID'].'" && (type="'.$type9.'" || type="'.$type10.'" || type="'.$type11.'" || type="'.$type12.'")');
+ $warranty = getrowID($dbname,'rowID','equipment_history','equipmentid="'.$rowID['rowID'].'" && (type="'.$type9.'" || type="'.$type10.'" || type="'.$type11.'" || type="'.$type12.'")');
if ($warranty){
// --------------------------------------------
// Already under contract
@@ -218,7 +218,7 @@ switch ($action) {
$rowID = getrowID($dbname,'rowID','equipment','serialnumber="'.$post_content['sn'].'"');
if ($rowID){
//check if under warranty
- $warranty = getrowID($dbname,'rowID','history','equipmentid="'.$rowID['rowID'].'" && (type="'.$type9.'" || type="'.$type10.'" || type="'.$type11.'" || type="'.$type12.'")');
+ $warranty = getrowID($dbname,'rowID','equipment_history','equipmentid="'.$rowID['rowID'].'" && (type="'.$type9.'" || type="'.$type10.'" || type="'.$type11.'" || type="'.$type12.'")');
if ($warranty){
// --------------------------------------------
// Already under contract
From c0f43a5ed0ae9153cc945fcdc630174c2f096d27 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9CVeLiTi=E2=80=9D?= <“info@veliti.nl”>
Date: Mon, 2 Dec 2024 19:13:44 +0100
Subject: [PATCH 2/3] CMXX - Update history table to equipment_history
---
api/v0/post/application.php | 4 ++--
api/v1/post/application.php | 4 ++--
api/v1/post/history.php | 2 +-
api/v2/post/history.php | 6 +++---
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/api/v0/post/application.php b/api/v0/post/application.php
index 5e8c299..95b4408 100644
--- a/api/v0/post/application.php
+++ b/api/v0/post/application.php
@@ -204,7 +204,7 @@ if (!empty($post_content['sn']) && !empty($post_content['testdetails'])) {
}
else {
// Insert Equipment
- $sql = "INSERT INTO history (equipmentid,type,description,createdby ) VALUES (?,?,?,?)";
+ $sql = "INSERT INTO equipment_history (equipmentid,type,description,createdby ) VALUES (?,?,?,?)";
$stmt = $pdo->prepare($sql);
$stmt->execute([$rowID,$historytype,$testdetails,$user]);
$last_id = $pdo->lastInsertId();
@@ -322,7 +322,7 @@ if (!empty($post_content['sn']) && !empty($post_content['testdetails'])) {
if($total_servicetool != 0){
// Insert historyitem
- $sql = "INSERT INTO history (equipmentid,type,description,createdby) VALUES (?,?,?,?)";
+ $sql = "INSERT INTO equipment_history (equipmentid,type,description,createdby) VALUES (?,?,?,?)";
$stmt = $pdo->prepare($sql);
$stmt->execute([$rowID_servicetool,$historytype,$testdetails,$user]);
//Update status to InUse
diff --git a/api/v1/post/application.php b/api/v1/post/application.php
index 83aefc5..79c121d 100644
--- a/api/v1/post/application.php
+++ b/api/v1/post/application.php
@@ -125,7 +125,7 @@ switch ($action) {
$firmware_account_send = 1;
//create history
// Prepare queries
- $sql = 'INSERT INTO history (equipmentid, type, description, created, createdby) VALUES (?,?,?,?,?)';
+ $sql = 'INSERT INTO equipment_history (equipmentid, type, description, created, createdby) VALUES (?,?,?,?,?)';
$stmt = $pdo->prepare($sql);
$stmt->execute([$rowID['rowID'],$type9,$description,$timestamp,$post_content['email']]);
@@ -232,7 +232,7 @@ switch ($action) {
// --------------------------------------------
$firmware_account_send = 1;
//create history
- $sql = 'INSERT INTO history (equipmentid, type, description, created, createdby) VALUES (?,?,?,?,?)';
+ $sql = 'INSERT INTO equipment_history (equipmentid, type, description, created, createdby) VALUES (?,?,?,?,?)';
$stmt = $pdo->prepare($sql);
$stmt->execute([$rowID['rowID'],$type9,$description,$timestamp,$post_content['email']]);
diff --git a/api/v1/post/history.php b/api/v1/post/history.php
index 5040d82..6ec61e1 100644
--- a/api/v1/post/history.php
+++ b/api/v1/post/history.php
@@ -73,7 +73,7 @@ if ($command == 'update' && !isset($post_content['delete']) && isAllowed('histor
$stmt->execute($execute_input);
}
elseif ($command == 'insert' && !isset($post_content['delete']) && isAllowed('history',$profile,$permission,'C') === 1){
- $sql = 'INSERT INTO history ('.$clause_insert.') VALUES ('.$input_insert.')';
+ $sql = 'INSERT INTO equipment_history ('.$clause_insert.') VALUES ('.$input_insert.')';
$stmt = $pdo->prepare($sql);
$stmt->execute($execute_input);
}
diff --git a/api/v2/post/history.php b/api/v2/post/history.php
index 8d31f46..80b8ce8 100644
--- a/api/v2/post/history.php
+++ b/api/v2/post/history.php
@@ -190,7 +190,7 @@ if (isset($post_content['sn']) && isset($post_content['payload'])){
}
else {
// Insert Equipment
- $sql = "INSERT INTO history (equipmentid,type,description,createdby ) VALUES (?,?,?,?)";
+ $sql = "INSERT INTO equipment_history (equipmentid,type,description,createdby ) VALUES (?,?,?,?)";
$stmt = $pdo->prepare($sql);
$stmt->execute([$rowID,$historytype,$testdetails,$user]);
$last_id = $pdo->lastInsertId();
@@ -308,7 +308,7 @@ if (isset($post_content['sn']) && isset($post_content['payload'])){
if($total_servicetool != 0){
// Insert historyitem
- $sql = "INSERT INTO history (equipmentid,type,description,createdby) VALUES (?,?,?,?)";
+ $sql = "INSERT INTO equipment_history (equipmentid,type,description,createdby) VALUES (?,?,?,?)";
$stmt = $pdo->prepare($sql);
$stmt->execute([$rowID_servicetool,$historytype,$testdetails,$user]);
//Update status to InUse
@@ -405,7 +405,7 @@ else {
$stmt->execute($execute_input);
}
elseif ($command == 'insert' && !isset($post_content['delete']) && isAllowed('history',$profile,$permission,'C') === 1){
- $sql = 'INSERT INTO history ('.$clause_insert.') VALUES ('.$input_insert.')';
+ $sql = 'INSERT INTO equipment_history ('.$clause_insert.') VALUES ('.$input_insert.')';
$stmt = $pdo->prepare($sql);
$stmt->execute($execute_input);
}
From 60acbe379e59dc0aff10b20cde700aad3b19d775 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9CVeLiTi=E2=80=9D?= <“info@veliti.nl”>
Date: Tue, 3 Dec 2024 11:03:23 +0100
Subject: [PATCH 3/3] CMXX - Improvement menu creation
---
assets/functions.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/assets/functions.php b/assets/functions.php
index c700483..2013bd8 100644
--- a/assets/functions.php
+++ b/assets/functions.php
@@ -170,7 +170,7 @@ function menu($selected,$selected_child){
foreach ($main_menu as $menu_item){
if (in_array($item = $menu_item, $profile,)){
//Main URL
- $menu .= ''.ucfirst(${$urls[$item]['name']}).'';
+ $menu .= ''.ucfirst((${$urls[$item]['name']}?? 'not specified')).'';
//DEFINE SUBMENU
$sub_menu = $item.'_sub' ?? '';
@@ -181,7 +181,7 @@ function menu($selected,$selected_child){
foreach($sub_menu as $key){
//CHECK IF USER IS ALLOWED
if (in_array($key,$profile)){
- $menu .= '◼'.ucfirst(${$urls[$key]['name']}).'';
+ $menu .= '◼'.ucfirst((${$urls[$key]['name']}?? 'not specified')).'';
}
}
$menu .= '';