if ($opt_debugLog == 'False') { $log->opt_debug = false; } else { $log->opt_debug = true; } } $opt_logLoc = $sql->getOption('Log_File_Location'); if ($opt_logLoc === false) { $log->add_log($sessionID, 'Warning', 'RetriveItem Warning: Log_File_Location Option missing or invalid.'); } else { $log->set_log_location($opt_logLoc); } $runLevel = $sql->verifySID($sessionID); //No special permission required. $IMSBase->verifyData($partNumber, "/^.+\$/", "Part Number"); $stmt = $sql->prepare("SELECT * FROM dbo.Inventory WHERE Name='{$partNumber}'"); $stmt->execute(); $result = $stmt->setFetchMode(PDO::FETCH_ASSOC); if (count($result) == 0) { $statusCode = '1'; $statusMessage = "RetrieveItem: Part Number,{$partNumber}, does not exist in database."; $log->add_log($sessionID, 'Warning', $statusMessage); } else { if (count($result) > 1) { $statusCode = '1'; $statusMessage = "RetrieveItem: Part Number,{$partNumber}, has multiple instances in database."; $log->add_log($sessionID, 'Warning', $statusMessage); } else { $dataArray = $stmt->fetch(PDO::FETCH_ASSOC); $statusCode = '0'; $statusMessage = "RetrieveItem: Part Number ,{$partNumber}, data has been retrieved.";
if ($opt_logLoc === false) { $log->add_log($sessionID, 'Warning', 'ModifyClassData Warning: Log_File_Location Option missing or invalid.'); } else { $log->set_log_location($opt_logLoc); } $runLevel = $sql->verifySID($sessionID, "1"); //1 = Requires edit privileges. $IMSBase->verifyData($recordID, "/^.+\$/", "Record ID"); $IMSBase->verifyData($field, "/^.+\$/", "Record Field"); $IMSBase->verifyData($value, "/^.+\$/", "Record Value"); $IMSBase->verifyData($sortColumn, "/^.*\$/", "Sort Column"); if ($sortColumn != "") { $IMSBase->verifyData($sortDirection, "/^(ASC|DESC)\$/", "Sort Direction"); } if ($field == 'Part') { $stmt = $sql->prepare("SELECT [Part] FROM dbo.Class_Data WHERE [id]='{$recordID}';"); $stmt->execute(); $oldPN_array = $stmt->fetchAll(PDO::FETCH_ASSOC); $oldPN = $oldPN_array[0]['Part']; //remove lab part flag from old part number $sql->command("UPDATE dbo.Inventory SET [Lab_Part_Flag]='0' WHERE [Name]='{$oldPN}';"); //add lab part flag from new part number $sql->command("UPDATE dbo.Inventory SET [Lab_Part_Flag]='1' WHERE [Name]='{$value}';"); } $sql->command("UPDATE dbo.Class_Data SET [{$field}]='{$value}' WHERE ID='{$recordID}';"); //retrieve new table. $sqlQuery = "SELECT * FROM dbo.Class_Data"; if ($sortColumn != "") { $sqlQuery = $sqlQuery . " ORDER BY {$sortColumn} {$sortDirection}"; } $sqlQuery = $sqlQuery . ";";
} $opt_logLoc = $sql->getOption('Log_File_Location'); if ($opt_logLoc === false) { $log->add_log($sessionID, 'Warning', 'ModifyEmailAddress Warning: Log_File_Location Option missing or invalid.'); } else { $log->set_log_location($opt_logLoc); } $runLevel = $sql->verifySID($sessionID, "1"); //1 = Requires edit privileges. $IMSBase->verifyData($recordID, "/^.+\$/", "Record ID"); $IMSBase->verifyData($field, "/^.+\$/", "Record Field"); $IMSBase->verifyData($value, "/^.+\$/", "Record Value"); $sql->command("UPDATE dbo.Emails SET [{$field}]='{$value}' WHERE ID='{$recordID}';"); //retrieve new table. $sqlQuery = "SELECT * FROM dbo.Emails;"; $stmt = $sql->prepare($sqlQuery); $stmt->execute(); $dataArray = $stmt->fetchAll(PDO::FETCH_ASSOC); $statusCode = '0'; $statusMessage = "Email record({$recordID}) - {$field} was updated with {$value}"; $log->add_log($sessionID, 'Information', $statusMessage); } catch (PDOException $e) { $statusCode = '1'; $statusMessage = 'ModifyEmailAddress SQLError: ' . $e->getMessage(); $log->add_log($sessionID, 'Error', $statusMessage); } catch (Exception $e) { $statusCode = $e->getCode(); $statusMessage = 'ModifyEmailAddress Error: ' . $e->getMessage(); if (!$log->add_log($sessionID, 'Error', $statusMessage, "N/A", true)) { $statusMessage = $statusMessage . " **Logging Failed**"; }