From ee223f370ef4bcb40d8b708e89e7333325b93df9 Mon Sep 17 00:00:00 2001 From: Damien Regad Date: Sat, 27 Feb 2016 15:24:03 +0100 Subject: [PATCH] Fix deletion of default category on MSSQL/Oracle (take 2) Use new config_is_defined() API to check whether the category to delete is defined as default_category_for_moves, instead of executing a SQL statement against the config table. This prevents a type mismatch error on some RDBMS: - Oracle (ORA-00932: inconsistent data types: expected -, found CLOB) - MSSQL (Operand type clash: text is incompatible with int.) - PostgreSQL (unconfirmed) Fixes #16384 --- manage_proj_cat_delete.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manage_proj_cat_delete.php b/manage_proj_cat_delete.php index 2139c9041d..98fcd6db94 100644 --- a/manage_proj_cat_delete.php +++ b/manage_proj_cat_delete.php @@ -67,9 +67,9 @@ # Protect the 'default category for moves' from deletion $t_default_category_id = config_get( 'default_category_for_moves', /* default */ null, ALL_USERS, ALL_PROJECTS ); -$t_query = 'SELECT count(config_id) FROM {config} WHERE config_id = ' . db_param() . ' AND value = ' . db_param(); -$t_default_cat_count = db_result( db_query( $t_query, array( 'default_category_for_moves', (string)$f_category_id ) ) ); -if( $t_default_cat_count > 0 || $f_category_id == $t_default_category_id ) { +if( $f_category_id == $t_default_category_id + || config_is_defined( 'default_category_for_moves', $f_category_id ) +) { trigger_error( ERROR_CATEGORY_CANNOT_DELETE_DEFAULT, ERROR ); }