CMXX - Update products_software to include versions
This commit is contained in:
@@ -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.')';
|
||||
|
||||
Reference in New Issue
Block a user