Skip to content

Commit

Permalink
This commit moves the 'sequence' column from mantis_custom_field_tabl…
Browse files Browse the repository at this point in the history
…e to mantis_custom_field_project_table. You'll need to either drop your custom field tables and add new ones, or manually remove the sequence column from the former and add it to the latter before the code will work again.

There is now currently no interface to modify the sequence for a binding.  I figure we can do this when we rework the interface.


git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@1649 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Julian Fitzell committed Dec 6, 2002
1 parent 10aca0b commit 39c0501
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 22 deletions.
17 changes: 4 additions & 13 deletions core/custom_field_api.php
Expand Up @@ -5,7 +5,7 @@
# See the files README and LICENSE for details

# --------------------------------------------------------
# $Id: custom_field_api.php,v 1.6 2002-12-05 09:07:43 jfitzell Exp $
# $Id: custom_field_api.php,v 1.7 2002-12-06 18:01:56 jfitzell Exp $
# --------------------------------------------------------

###########################################################################
Expand All @@ -21,7 +21,7 @@
# - add an object to store field data like BugData and UserPrefs ?
# - add caching functions like user, bug, etc
# - make existing api functions use caching functions
# - add functions to return individual db fields of a field definition
# - add functions to return individual db columns for a field definition
#
# DB SCHEMA
# The following is the current proposed DB schema to go with this API
Expand All @@ -38,7 +38,6 @@
length_min int(3) NOT NULL default '0',
length_max int(3) NOT NULL default '0',
advanced int(1) NOT NULL default '0',
sequence int(2) NOT NULL default '0',
PRIMARY KEY (id),
KEY name (name)
) TYPE=MyISAM COMMENT='Field definitions';
Expand All @@ -53,6 +52,7 @@
CREATE TABLE mantis_custom_field_project_table (
field_id int(3) NOT NULL,
project_id int(7) unsigned NOT NULL,
sequence int(2) NOT NULL default '0',
PRIMARY KEY (field_id,project_id)
) TYPE=MyISAM COMMENT='Definitions of which fields are available in each project';
*/
Expand Down Expand Up @@ -253,7 +253,6 @@ function custom_field_update( $p_field_id, $p_def_array ) {
$c_length_min = db_prepare_int( $p_def_array['length_min'] );
$c_length_max = db_prepare_int( $p_def_array['length_max'] );
$c_advanced = db_prepare_bool( $p_def_array['advanced'] );
$c_sequence = db_prepare_int( $p_def_array['sequence'] );

$query = "UPDATE " .
config_get( 'mantis_custom_field_table' ).
Expand Down Expand Up @@ -340,14 +339,6 @@ function custom_field_update( $p_field_id, $p_def_array ) {
}
$query .= "advanced='$c_advanced'";
}
if( array_key_exists( 'sequence', $p_def_array ) ) {
if ( !$t_update_something ) {
$t_update_something = true;
} else {
$query .= ', ';
}
$query .= "sequence='$c_sequence'";
}

$query .= " WHERE id='$c_field_id'";

Expand Down Expand Up @@ -489,7 +480,7 @@ function custom_field_get_ids( $p_project_id = 0 ) {
$t_custom_field_project_table p, $t_custom_field_table f
WHERE p.project_id='$c_project_id'
AND p.field_id = f.id
ORDER BY f.sequence ASC";
ORDER BY p.sequence ASC";
}
$result = db_query( $query );

Expand Down
8 changes: 0 additions & 8 deletions manage_proj_custom_field_edit_page.php
Expand Up @@ -121,14 +121,6 @@
<input type="checkbox" name="f_advanced" value="1" <?php if($t_definition['advanced']) echo 'checked'; ?>>
</td>
</tr>
<tr <?php echo helper_alternate_class() ?>>
<td class="category">
<?php echo lang_get( 'custom_field_sequence' ) ?>
</td>
<td>
<input type="text" name="f_sequence" size="32" maxlength="64" value="<?php echo $t_definition['sequence'] ?>" />
</td>
</tr>
<tr>
<td>
&nbsp;
Expand Down
1 change: 0 additions & 1 deletion manage_proj_custom_field_update.php
Expand Up @@ -22,7 +22,6 @@
$t_values['length_min'] = gpc_get_int( 'f_length_min' );
$t_values['length_max'] = gpc_get_int( 'f_length_max' );
$t_values['advanced'] = gpc_get_bool( 'f_advanced' );
$t_values['sequence'] = gpc_get_int( 'f_sequence' );

custom_field_update( $f_field_id, $t_values );

Expand Down

0 comments on commit 39c0501

Please sign in to comment.