]> git.joonet.de Git - adminer.git/commitdiff
Respect original values in mass edit and clone
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Sat, 13 Jun 2009 17:00:48 +0000 (17:00 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Sat, 13 Jun 2009 17:00:48 +0000 (17:00 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@677 7c3ca157-0c34-0410-bff1-cbf682f78f5c

edit.inc.php
todo.txt

index cbaf474918e955d544aedec934fcd8d758f4cc36..43040bf9e40d88bbaa98f4aca832a13b6ec2d1c5 100644 (file)
@@ -47,8 +47,8 @@ if ($_POST["save"]) {
 } elseif ($where) {
        $select = array();
        foreach ($fields as $name => $field) {
-               if (isset($field["privileges"]["select"]) && (!$_POST["clone"] || !$field["auto_increment"])) {
-                       $select[] = ($field["type"] == "enum" || $field["type"] == "set" ? "1*" . idf_escape($name) . " AS " : "") . idf_escape($name);
+               if (isset($field["privileges"]["select"])) {
+                       $select[] = ($_POST["clone"] && $field["auto_increment"] ? "'' AS " : ($field["type"] == "enum" || $field["type"] == "set" ? "1*" . idf_escape($name) . " AS " : "")) . idf_escape($name);
                }
        }
        $row = array();
@@ -67,7 +67,7 @@ if ($fields) {
        echo "<table cellspacing='0'>\n";
        foreach ($fields as $name => $field) {
                echo "<tr><th>" . htmlspecialchars($name) . "</th>";
-               $value = (!isset($row) ? ($_POST["clone"] && $field["auto_increment"] ? "" : $field["default"])
+               $value = (!isset($row) ? ($_POST["clone"] && $field["auto_increment"] ? "" : ($where ? $field["default"] : null))
                        : (strlen($row[$name]) && ($field["type"] == "enum" || $field["type"] == "set") ? intval($row[$name]) : $row[$name])
                );
                input($name, $field, $value);
index 4805ef5d199bb14d2605b54ba797a59cbecb0288..0217d9d4729418b1a1b1e85cb57a1df1ec883be2 100644 (file)
--- a/todo.txt
+++ b/todo.txt
@@ -10,6 +10,7 @@ Function to fix database encoding - http://php.vrana.cz/prevod-kodovani-mysql.ph
 Utilize information_schema.USER_PRIVILEGES in Privileges
 Highlight SQL textarea - may use external CodePress
 Column and table names auto-completition in SQL textarea
+Mass editation of individual rows
 ? Save token also to cookie - for session expiration and login in other window
 ? Save uploaded files after error to session variable instead of hidden field
 ? Aliasing of built-in functions can save 7 KB, substitution of $_GET and friends can save 2 KB, remove of base64_decode() + using chars 127-255 in minification can save 1 KB, JS packer can save 1 KB