Error with update project: new field added
Posted: 07 Oct 2020, 09:54
				
				Dear,
I have an error when I update project details: Fatal error: Cannot use empty array elements in arrays in C:\wamp64\www\mantisbt\core\project_api.php on line 469
Steps description:
1/ I added a new column in mantis_project_mantis (display_columns: a flag for display test by project smallint).
Than I modify "manage_proj_edit_page.php" by adding the code below:
<tr><td class="category">
<?php echo lang_get( 'Activity display columns') ?>
</td><td>
<input type="text" class="input-sm" name="display_columns" id="display_columns" size="2" value="<?php echo (int)$t_row['display_columns'] ?>" /></td></tr>
2/Than I modify "manage_proj_update.php" by adding the new column in the action
$f_project_id = gpc_get_int( 'project_id' );
$f_name = gpc_get_string( 'name' );
$f_description = gpc_get_string( 'description' );
$f_status = gpc_get_int( 'status' );
$f_view_state = gpc_get_int( 'view_state' );
$f_display_columns = gpc_get_int( 'display_columns' );
$f_file_path = gpc_get_string( 'file_path', '' );
$f_enabled = gpc_get_bool( 'enabled' );
$f_inherit_global = gpc_get_bool( 'inherit_global', 0 );
access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id );
project_update( $f_project_id, $f_name, $f_description, $f_status, $f_view_state,$f_display_columns, $f_file_path, $f_enabled, $f_inherit_global );
3/ Than I modify the core of the function project_update in project_api.php as descibed below:
function project_update( $p_project_id, $p_name, $p_description, $p_status, $p_view_state,$p_display_columns, $p_file_path, $p_enabled, $p_inherit_global ) {
...
$t_query = 'UPDATE {project}
SET name=' . db_param() . ',
status=' . db_param() . ',
enabled=' . db_param() . ',
view_state=' . db_param() . ',
file_path=' . db_param() . ',
description=' . db_param() . ',
inherit_global=' . db_param() . ',
display_columns=' . db_param() . '
WHERE id=' . db_param();
db_query( $t_query, array( $p_name, (int)$p_status, $c_enabled, (int)$p_view_state, $p_file_path, $p_description, $c_inherit_global, (int)$p_display_columns, $p_project_id ) );
Any help is very appreciated.
Thank you
			I have an error when I update project details: Fatal error: Cannot use empty array elements in arrays in C:\wamp64\www\mantisbt\core\project_api.php on line 469
Steps description:
1/ I added a new column in mantis_project_mantis (display_columns: a flag for display test by project smallint).
Than I modify "manage_proj_edit_page.php" by adding the code below:
<tr><td class="category">
<?php echo lang_get( 'Activity display columns') ?>
</td><td>
<input type="text" class="input-sm" name="display_columns" id="display_columns" size="2" value="<?php echo (int)$t_row['display_columns'] ?>" /></td></tr>
2/Than I modify "manage_proj_update.php" by adding the new column in the action
$f_project_id = gpc_get_int( 'project_id' );
$f_name = gpc_get_string( 'name' );
$f_description = gpc_get_string( 'description' );
$f_status = gpc_get_int( 'status' );
$f_view_state = gpc_get_int( 'view_state' );
$f_display_columns = gpc_get_int( 'display_columns' );
$f_file_path = gpc_get_string( 'file_path', '' );
$f_enabled = gpc_get_bool( 'enabled' );
$f_inherit_global = gpc_get_bool( 'inherit_global', 0 );
access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id );
project_update( $f_project_id, $f_name, $f_description, $f_status, $f_view_state,$f_display_columns, $f_file_path, $f_enabled, $f_inherit_global );
3/ Than I modify the core of the function project_update in project_api.php as descibed below:
function project_update( $p_project_id, $p_name, $p_description, $p_status, $p_view_state,$p_display_columns, $p_file_path, $p_enabled, $p_inherit_global ) {
...
$t_query = 'UPDATE {project}
SET name=' . db_param() . ',
status=' . db_param() . ',
enabled=' . db_param() . ',
view_state=' . db_param() . ',
file_path=' . db_param() . ',
description=' . db_param() . ',
inherit_global=' . db_param() . ',
display_columns=' . db_param() . '
WHERE id=' . db_param();
db_query( $t_query, array( $p_name, (int)$p_status, $c_enabled, (int)$p_view_state, $p_file_path, $p_description, $c_inherit_global, (int)$p_display_columns, $p_project_id ) );
Any help is very appreciated.
Thank you