When activating the option "Save term lineage " in hierarchical select configuration page, drupal returns the following error:

PDOException: SQLSTATE[22018]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Conversion failed when converting the varchar value 'label_1' to data type int.: SELECT t.[tid] AS [tid] FROM taxonomy_term_data t INNER JOIN taxonomy_term_hierarchy h ON h.tid = t.tid WHERE ( ([h].[parent] = :db_condition_placeholder_0) AND ([t].[vid] = :db_condition_placeholder_1) ) ORDER BY t.weight ASC, t.name ASC; Array ( [:db_condition_placeholder_0] => label_1 [:db_condition_placeholder_1] => 14 ) in taxonomy_get_children() (line 1087 of ..\modules\taxonomy\taxonomy.module).

As an addition to the above, by the time the module throws the following error, fails to save nodes, terms etc.

In order to fix the above issue, we go to hierarchical_select.module file and in line 986 we replace:

$hs_selection[] = $value; with $hs_selection[] = (int)$value;.

Clear the cache and everything works fine.

Comments

dnacreative created an issue. See original summary.

dnacreative’s picture

Issue summary: View changes
dnacreative’s picture

Issue summary: View changes
stefan.r’s picture

Status: Fixed » Needs work

I think we already had an issue for this... this fix would turn it into an int (like MySQL does) but does not fix the underlying bug

dnacreative’s picture

You are right, I found it out later. I am working on fixing the whole bug

Island Usurper’s picture

Gold’s picture

It is looking like #1648228 is the same issue. I suggest we postpone this until that one is sorted and retest this one.

Gold’s picture

Status: Postponed » Closed (cannot reproduce)

Triaging old issues.

I've not seen this issue in a while and the related issue in #7 is not closed as unable to replicate.

If this turns out to still be an issue please reopen with a patch and detailed steps to reproduce.