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
Error with update project: new field added
Moderators: Developer, Contributor
Re: Error with update project: new field added
Did you add the field at the end of the table?
If not, make sure the new field is at the end and that you extend the different statements adding the field as last.
Now try again, if persists also provide the contents of the line in error.
If not, make sure the new field is at the end and that you extend the different statements adding the field as last.
Now try again, if persists also provide the contents of the line in error.
Re: Error with update project: new field added
Dear Cas,
Thank you for your reply. Yes, I did (add the field at the end of the table).
For your idea: "that you extend the different statements adding the field as last": you mean that I need to add the parameter at the end of the method signature?
If yes, I did it.
"The code line with issue project_api.php l469" : 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 ) );
Thank you again for your support.
Thank you for your reply. Yes, I did (add the field at the end of the table).
For your idea: "that you extend the different statements adding the field as last": you mean that I need to add the parameter at the end of the method signature?
If yes, I did it.
"The code line with issue project_api.php l469" : 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 ) );
Thank you again for your support.