diff --git a/app/database_transactions/database_transaction_edit.php b/app/database_transactions/database_transaction_edit.php index cc2c796ba7..40fcb6c2e2 100644 --- a/app/database_transactions/database_transaction_edit.php +++ b/app/database_transactions/database_transaction_edit.php @@ -42,7 +42,7 @@ $language = new text; $text = $language->get(); -//action add or update +//set the variables if (is_uuid($_REQUEST["id"])) { $database_transaction_uuid = $_REQUEST["id"]; $search = $_GET['search']; @@ -83,6 +83,23 @@ unset($sql, $parameters, $row); } +//undo the transaction + if ($_GET['action'] == 'undo' && ($transaction_type = 'delete' || $transaction_type = 'update')) { + //get the array + $array = json_decode($transaction_old, true); + + //save to the data + $database = new database; + $database->app_name = $app_name; + $database->app_uuid = $app_uuid; + $database->save($array); + $message = $database->message; + + //redirect the user + $_SESSION["message"] = $text['message-update']; + header("Location: database_transactions.php?".($search != '' ? "&search=".urlencode($search) : null).($page != '' ? "&page=".urlencode($page) : null)); + } + //get the type if not provided if (strlen($transaction_type) == 0) { if ($transaction_old == null || $transaction_old == "null") { @@ -101,7 +118,10 @@ echo " \n"; echo " ".$text['title-database_transaction']."

\n"; echo " \n"; - echo " "; + if ($transaction_type = 'delete' || $transaction_type = 'update') { + echo " "; + } + echo " "; echo " \n"; echo " \n"; echo "\n";