User Account Creation Error

5 posts by 2 authors in: Forums > CMS Builder
Last Post: June 5, 2009   (RSS)

Re: [sagentic] User Account Creation Error

By Dave - June 4, 2009

Kenny,

Is that with the latest version? (1.28)?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] User Account Creation Error

By Kenny - June 4, 2009

Yes - sorry about about not mentioning that!

Re: [sagentic] User Account Creation Error

By Dave - June 4, 2009

Ok, I've fixed that for the next version. Here's the fix:

- Open /lib/menus/default/save.php
- Search for: isIntColumn
- Replace this code block:

// save blank int column values as null
$columnType = @$mySqlColsAndTypes[$colName];
$isIntColumn = preg_match("/^(tinyint|smallint|mediumint|int|bigint)/i", $columnType);
if ($value == '' && $isIntColumn && $fieldType != 'checkbox') {
$colsToValuesString .= "`$colName` = NULL, ";
}


With this one (new code in red):

// save blank int column values as null
$columnType = @$mySqlColsAndTypes[$colName];
$fieldType = @$schema[$colName]['type'];
$isIntColumn = preg_match("/^(tinyint|smallint|mediumint|int|bigint)/i", $columnType);
if ($value == '' && $isIntColumn && $fieldType != 'checkbox') {
$colsToValuesString .= "`$colName` = NULL, ";
}


>why is it happening?

It's a bug (thanks for reporting it!), and since you asked... :) Here's the technical details:

We added support for custom mysql column types (INT, etc) in the field editor a while back. The problem with that is those field only support a number or null, there is no "blank". So people saving a record with no value for a integer field would modify it and see a zero the next time. So we added some code to save integers as null if they have no value. Except checkboxes are store as tinyint's (as 0 or 1) but don't support NULLs, so the above code adds an exception for checkboxes.

Hope that helps, let me know if that patch fixes the problem or if there are any other issues.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] User Account Creation Error

By Kenny - June 5, 2009

Sorry to get back to you so late - the patch fixed the problem.

Thanks!