bug 605342
This commit is contained in:
@@ -5,6 +5,9 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2002-09-11 Lo<4C>c Chapeaux <lolo@phpheaven.net> and Marc
|
||||||
|
* tbl_change.php3: bug 605342, edit fills current time in datetime field
|
||||||
|
|
||||||
2002-09-11 Michal Cihar <nijel@users.sourceforge.net>
|
2002-09-11 Michal Cihar <nijel@users.sourceforge.net>
|
||||||
* lang/czech-*.inc.php3: Updates.
|
* lang/czech-*.inc.php3: Updates.
|
||||||
|
|
||||||
|
@@ -10,6 +10,7 @@ $js_to_run = 'tbl_change.js';
|
|||||||
require('./header.inc.php3');
|
require('./header.inc.php3');
|
||||||
require('./libraries/relation.lib.php3'); // foreign keys
|
require('./libraries/relation.lib.php3'); // foreign keys
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the query submitted and its result
|
* Displays the query submitted and its result
|
||||||
*/
|
*/
|
||||||
@@ -194,6 +195,10 @@ if ($cfg['ShowFunctionFields']) {
|
|||||||
$timestamp_seen = 0;
|
$timestamp_seen = 0;
|
||||||
$fields_cnt = mysql_num_rows($table_def);
|
$fields_cnt = mysql_num_rows($table_def);
|
||||||
|
|
||||||
|
// Set a flag here because the 'if' would not be valid in the loop
|
||||||
|
// if we set a value in some field
|
||||||
|
$insert_mode = (!isset($row) ? TRUE:FALSE);
|
||||||
|
|
||||||
for ($i = 0; $i < $fields_cnt; $i++) {
|
for ($i = 0; $i < $fields_cnt; $i++) {
|
||||||
// Display the submit button after every 15 lines --swix
|
// Display the submit button after every 15 lines --swix
|
||||||
// (wanted to use an <a href="#bottom"> and <a name> instead,
|
// (wanted to use an <a href="#bottom"> and <a name> instead,
|
||||||
@@ -212,9 +217,22 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
|
|
||||||
$row_table_def = PMA_mysql_fetch_array($table_def);
|
$row_table_def = PMA_mysql_fetch_array($table_def);
|
||||||
$field = $row_table_def['Field'];
|
$field = $row_table_def['Field'];
|
||||||
if ($row_table_def['Type'] == 'datetime' && empty($row[$field])) {
|
// loic1: current date should not be set as default if the field is NULL
|
||||||
|
// for the current row
|
||||||
|
if ($row_table_def['Type'] == 'datetime') {
|
||||||
|
// INSERT case
|
||||||
|
if ($insert_mode) {
|
||||||
$row[$field] = date('Y-m-d H:i:s', time());
|
$row[$field] = date('Y-m-d H:i:s', time());
|
||||||
}
|
}
|
||||||
|
// UPDATE case with an empty and not NULL value under PHP4
|
||||||
|
else if (empty($row[$field]) && function_exists('is_null')) {
|
||||||
|
$row[$field] = (is_null($row[$field]) ? $row[$field] : date('Y-m-d H:i:s', time()));
|
||||||
|
}
|
||||||
|
// UPDATE case with an empty value under PHP3
|
||||||
|
else if (empty($row[$field])) {
|
||||||
|
$row[$field] = date('Y-m-d H:i:s', time());
|
||||||
|
} // end if... else if... else if...
|
||||||
|
}
|
||||||
$len = (eregi('float|double', $row_table_def['Type']))
|
$len = (eregi('float|double', $row_table_def['Type']))
|
||||||
? 100
|
? 100
|
||||||
: @mysql_field_len($result, $i);
|
: @mysql_field_len($result, $i);
|
||||||
@@ -381,7 +399,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
// foreign_display can be FALSE if no display field defined:
|
// foreign_display can be FALSE if no display field defined:
|
||||||
$foreign_display = PMA_getDisplayField($foreign_db, $foreign_table);
|
$foreign_display = PMA_getDisplayField($foreign_db, $foreign_table);
|
||||||
$dispsql = 'SELECT ' . PMA_backquote($foreign_field)
|
$dispsql = 'SELECT ' . PMA_backquote($foreign_field)
|
||||||
. ($foreign_display==FALSE? '': ', ' . PMA_backquote($foreign_display))
|
. (($foreign_display == FALSE) ? '' : ', ' . PMA_backquote($foreign_display))
|
||||||
. ' FROM ' . PMA_backquote($foreign_db) . '.' . PMA_backquote($foreign_table);
|
. ' FROM ' . PMA_backquote($foreign_db) . '.' . PMA_backquote($foreign_table);
|
||||||
// lem9: put a LIMIT in case of big foreign table (looking for better
|
// lem9: put a LIMIT in case of big foreign table (looking for better
|
||||||
// solution, maybe a configurable limit, or a message?)
|
// solution, maybe a configurable limit, or a message?)
|
||||||
@@ -394,7 +412,7 @@ for ($i = 0; $i < $fields_cnt; $i++) {
|
|||||||
echo ' <select name="fields[' . urlencode($field) . ']">' . "\n";
|
echo ' <select name="fields[' . urlencode($field) . ']">' . "\n";
|
||||||
while ($relrow = @PMA_mysql_fetch_array($disp)) {
|
while ($relrow = @PMA_mysql_fetch_array($disp)) {
|
||||||
$key = $relrow[$foreign_field];
|
$key = $relrow[$foreign_field];
|
||||||
$value = ($foreign_display!=FALSE ? '-' . htmlspecialchars($relrow[$foreign_display]):'');
|
$value = (($foreign_display != FALSE) ? '-' . htmlspecialchars($relrow[$foreign_display]) : '');
|
||||||
echo ' <option value="' . urlencode($key) . '"';
|
echo ' <option value="' . urlencode($key) . '"';
|
||||||
if ($key == $data) {
|
if ($key == $data) {
|
||||||
echo ' selected="selected"';
|
echo ' selected="selected"';
|
||||||
|
Reference in New Issue
Block a user