SugarCRM: On import field type int with validation range not working

Issue found on the SugarCRM Professional 6.1.2

Edit the file modules/Import/ImportFieldSanitize.php

Replace the function int with the below code

/**
 * Validate int fields
 *
 * @param  $value  string
 * @param  $vardef array
 * @return string sanitized and validated value on success, bool false on failure
 */
public function int(
    $value,
    $vardef
    )
{
    $value = str_replace($this->num_grp_sep,"",$value);
    if (!is_numeric($value) || strstr($value,".")) {
        return false;
    }
    if (isset($vardef['validation']) && $vardef['validation']['type']=='range') {
        $min    = $vardef['validation']['min'];
        $max    = $vardef['validation']['max'];
        if ($value$max) {
            return false;
        }
    }
    return $value;
}
Advertisements
SugarCRM: On import field type int with validation range not working

2 thoughts on “SugarCRM: On import field type int with validation range not working

  1. The following time I learn a blog, I hope that it doesnt disappoint me as a lot as this one. I mean, I do know it was my option to read, however I actually thought youd have one thing fascinating to say. All I hear is a bunch of whining about one thing that you possibly can fix when you werent too busy looking for attention.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s