Page 1 of 1

Multiselect List custon field size

Posted: 05 Sep 2008, 17:36
by vzw614
We have a custom field that is defined as a multiselection list. In it we have a list of all of our developers seperated by the pipe character (|).

The text box for Possible Values on manage_custom_field_edit_page.php was hard coded at 255 length. I increased that to 1000. I also increased the size of the possible_values field in the database table to 1000.

When we submit a new issue the dropdown list for our custom field only displays the first 255 characters. Any idea where else I need to make changes so that the entire list is included in the dropdown list?

I did verify that the characters past 255 are being stored in the database now.

Also, why allow the Max. Length of a custom field to be changed if Mantis can only deal with 255 characters? At the least the largest Max. Length that should be allowed should be 255.

Thanks
Curtis

Re: Multiselect List custon field size

Posted: 05 Sep 2008, 19:54
by vzw614
After some futher investigation I'm pretty sure the problem is when the value is being retrieved from the database. I found this line of code in \core\adodb\drivers\adodb-mssql.inc.php

Code: Select all

// returns concatenated string
// MSSQL requires integers to be cast as strings
// automatically cast every datatype to VARCHAR(255)
    function Concat()
    {
            $s = "";
            $arr = func_get_args();

            // Split single record on commas, if possible
            if (sizeof($arr) == 1) {
                foreach ($arr as $arg) {
                    $args = explode(',', $arg);
                }
                $arr = $args;
            }

            array_walk($arr, create_function('&$v', '$v = "CAST(" . $v . " AS VARCHAR(255))";'));
            $s = implode('+',$arr);
            if (sizeof($arr) > 0) return "$s";
            
			return '';
I think the issue is in the line with array_walk where everything is cast as VARCHAR(255).

Any thoughts?