Refactor software version queries to use 'rowID' instead of 'id' for consistency across the application
This commit is contained in:
@@ -64,10 +64,10 @@ if (isset($criterias['available'])) {
|
||||
|
||||
// Get all active versions
|
||||
$stmt = $pdo->prepare("
|
||||
SELECT sv.id, sv.version, sv.major_version, sv.minor_version, sv.patch_version,
|
||||
SELECT sv.rowID as id, sv.version, sv.major_version, sv.minor_version, sv.patch_version,
|
||||
sv.name, sv.description, sv.file_size, sv.release_date
|
||||
FROM software_versions sv
|
||||
WHERE sv.is_active = TRUE
|
||||
WHERE sv.status = 'published'
|
||||
ORDER BY sv.major_version DESC, sv.minor_version DESC, sv.patch_version DESC
|
||||
");
|
||||
$stmt->execute();
|
||||
|
||||
@@ -23,7 +23,7 @@ if (!$tokenData) {
|
||||
}
|
||||
|
||||
// Get file details
|
||||
$stmt = $pdo->prepare("SELECT * FROM software_versions WHERE id = ?");
|
||||
$stmt = $pdo->prepare("SELECT * FROM software_versions WHERE rowID = ?");
|
||||
$stmt->execute([$tokenData['version_id']]);
|
||||
$version = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ switch ($action) {
|
||||
}
|
||||
|
||||
// Get version details
|
||||
$stmt = $pdo->prepare("SELECT * FROM software_versions WHERE id = ?");
|
||||
$stmt = $pdo->prepare("SELECT * FROM software_versions WHERE rowID = ?");
|
||||
$stmt->execute([$versionId]);
|
||||
$version = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
@@ -176,7 +176,7 @@ switch ($action) {
|
||||
|
||||
//QUERY AND VERIFY ALLOWED
|
||||
if ($command == 'update' && isAllowed('software',$profile,$permission,'U') === 1){
|
||||
$sql = 'UPDATE software_versions SET '.$clause.' WHERE id = ?';
|
||||
$sql = 'UPDATE software_versions SET '.$clause.' WHERE rowID = ?';
|
||||
$execute_input[] = $id;
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->execute($execute_input);
|
||||
@@ -187,7 +187,7 @@ switch ($action) {
|
||||
$stmt->execute($execute_input);
|
||||
}
|
||||
elseif ($command == 'delete' && isAllowed('software',$profile,$permission,'D') === 1){
|
||||
$stmt = $pdo->prepare('DELETE FROM software_versions WHERE id = ?');
|
||||
$stmt = $pdo->prepare('DELETE FROM software_versions WHERE rowID = ?');
|
||||
$stmt->execute([$id]);
|
||||
|
||||
//Add deletion to changelog
|
||||
|
||||
Reference in New Issue
Block a user