CMXX - Update products_software to include versions

This commit is contained in:
“VeLiTi”
2024-11-22 11:05:17 +01:00
parent 21300d56f6
commit adf2ff2b24
9 changed files with 182 additions and 196 deletions

View File

@@ -86,14 +86,17 @@ if (isset($post_content['productrowid']) && $post_content['productrowid'] != '')
$clause_insert = substr($clause_insert, 2); //Clean clause - remove first comma
$input_insert = substr($input_insert, 1); //Clean clause - remove first comma
//SET HW VERSION
$hw_eq_version = (isset($criterias['hw_version']))? $criterias['hw_version']:'';
//QUERY AND VERIFY ALLOWED
if ($command == 'update' && isAllowed('products_software',$profile,$permission,'U') === 1){
//REMOVE LATEST FLAG FROM OTHER WHEN SEND
if ($criterias['latest'] == 1){
$sql = 'UPDATE products_software SET latest = 0 WHERE productrowid = ?';
$sql = 'UPDATE products_software SET latest = 0 WHERE productrowid = ? AND hw_version = ?';
$stmt = $pdo->prepare($sql);
$stmt->execute([$post_content['productrowid']]);
$stmt->execute([$post_content['productrowid'], $hw_eq_version ]);
}
$sql = 'UPDATE products_software SET '.$clause.' WHERE rowID = ? '.$whereclause.'';
@@ -104,9 +107,9 @@ if (isset($post_content['productrowid']) && $post_content['productrowid'] != '')
elseif ($command == 'insert' && isAllowed('products_software',$profile,$permission,'C') === 1){
//REMOVE LATEST FLAG FROM OTHER
$sql = 'UPDATE products_software SET latest = 0 WHERE productrowid = ?';
$sql = 'UPDATE products_software SET latest = 0 WHERE productrowid = ? AND hw_version = ?';
$stmt = $pdo->prepare($sql);
$stmt->execute([$post_content['productrowid']]);
$stmt->execute([$post_content['productrowid'], $hw_eq_version]);
//INSERT NEW ITEM
$sql = 'INSERT INTO products_software ('.$clause_insert.') VALUES ('.$input_insert.')';