Bug fixes for data insert with interval fields in form generate

- if interval is emtpy set NULL
- do some clean up for pk return data from the form/db array io part
This commit is contained in:
Clemens Schwaighofer
2016-01-07 13:06:47 +09:00
parent 805330638a
commit 4458f366f9
2 changed files with 12 additions and 1 deletions

View File

@@ -34,6 +34,7 @@
'output_name' => 'Password change interval', 'output_name' => 'Password change interval',
'error_check' => 'intervalshort', // can be any date length format. n Y/M/D [not H/M/S], only one set, no combination 'error_check' => 'intervalshort', // can be any date length format. n Y/M/D [not H/M/S], only one set, no combination
'type' => 'text', 'type' => 'text',
'interval' => 1, // interval needs NULL write for empty
'size' => 5, // make it 5 chars long 'size' => 5, // make it 5 chars long
'length' => 5 'length' => 5
), ),

View File

@@ -429,6 +429,13 @@ $this->debug('write_check', "[$column][".$this->table_array[$column]["value"]."]
$_value = $this->table_array[$column]["value"]; $_value = $this->table_array[$column]["value"];
$q_data .= $_value; $q_data .= $_value;
} }
elseif ($this->table_array[$column]["interval"])
{
// for interval we check if no value, then we set null
if (!$this->table_array[$column]["value"])
$_value = 'NULL';
$q_data .= $_value;
}
else else
// normal string // normal string
{ {
@@ -500,7 +507,10 @@ $this->debug('write_check', "[$column][".$this->table_array[$column]["value"]."]
} }
// set primary key // set primary key
if ($insert) if ($insert)
$this->ok = $this->table_array[$this->pk_name]["value"] = $this->insert_id; {
$this->table_array[$this->pk_name]["value"] = $this->insert_id;
$this->ok = $this->insert_id;
}
// return the table if needed // return the table if needed
return $this->table_array; return $this->table_array;
} }