Closed (fixed)
Project:
Unique field
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Dec 2009 at 19:05 UTC
Updated:
23 Dec 2010 at 15:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
arithmetric commentedThe single node scope is intended for comparing multiple fields of the same type from a single node against each other. Since there is only one author and language per node, it's not clear how or against what these would be compared.
I hope this clarifies the error message.
Comment #2
rwhiteheadCannot enable single node scope as rogerpfaff above.
I understand the error message as explained by detour but I do not have locale module enabled (so no language checkbox! - and default value=NULL in module for language) and I do not check "Author" field.
I have tried all combinations of unique fields selected not selected then saved node then tried to set "single node" scope and always get the message "The author and language fields are not supported within the scope of a single node."
Please give us a clue as to why we cannot set this principle feature?
Quite to happy to hack the unique_field.module validation as a quick fix? (I'm looking at this now!)
Comment #3
etomilin commentedI'm also getting "The author and language fields are not supported within the scope of a single node" with "Single node only" option. And no, I'm not selecting author or language as a unique fileds.
Comment #4
etomilin commentedIt seems the problem is in line 413 of unique_field.module:
if ($form_state['values']['unique_field_fields'][UNIQUE_FIELD_FIELDS_AUTHOR] == UNIQUE_FIELD_FIELDS_AUTHOR || $form_state['values']['unique_field_fields'][UNIQUE_FIELD_FIELDS_LANGUAGE] == UNIQUE_FIELD_FIELDS_LANGUAGE) {This check is always passed for some reason.
I'm not a PHP expert, but I think it fails because
$form_state['values']['unique_field_fields'][...]returnsint(0)if corresponding field is not checked, and UNIQUE_FIELD_FIELDS_AUTHOR/NAME are strings. I'm not sure how PHP handles such situations, but it seems like a cause of a problem.I changed this line to
if ($form_state['values']['unique_field_fields'][UNIQUE_FIELD_FIELDS_AUTHOR] <> '0' || $form_state['values']['unique_field_fields'][UNIQUE_FIELD_FIELDS_LANGUAGE] <> '0') {and it fixed the problem for me.
Comment #5
arithmetric commentedThis is fixed in the latest dev version (dated 2010-Nov-19 or later).
Comment #6
etomilin commentedI'm afraid this issue is still active.
Just updated to 1.3 and I'm still getting 'The author, language, and taxonomy fields are not supported within the scope of a single node.'
And I have only one nodereference field set as unique for this node type.
Comment #7
arithmetric commentedVersion 1.3 includes a change that should be equivalent to what you suggested in #4. Could you attach a screenshot of the settings you're using to get this error?
Comment #8
etomilin commentedSure. Sorry for a lot of Russian on it. Most of Unique field setting are untraslated, so I hope it won't be a problem.
The author field is named "Автор". There is no language field since Multilingual support is turned off.
field_oopt_doc_link is multi-valued nodereference field.
Comment #9
etomilin commentedChecked it briefly.
"if" expression on line 478 in form validation function evaluates as TRUE in my case:
if ($fval && ($fname === UNIQUE_FIELD_FIELDS_AUTHOR) || ($fname === UNIQUE_FIELD_FIELDS_LANGUAGE) || (strpos($fname, UNIQUE_FIELD_FIELDS_TAXONOMY) === 0)) {To be more precise, this part of expression makes it TRUE:
(strpos($fname, UNIQUE_FIELD_FIELDS_TAXONOMY) === 0)Not sure I get the idea of this particular expression or how it was intended to work.
Here is a dump of
$form_state['values']['unique_field_fields']for the form on my screenshot:Array ( [field_oopt_doc_link] => field_oopt_doc_link [title] => 0 [name] => 0 [field_gis_flag] => 0 [field_gis_comment] => 0 [field_gis_comment2] => 0 [field_status] => 0 [field_creation_date_planned] => 0 [field_reorganized_from] => 0 [field_reorganized_comment] => 0 [field_liquidation_date] => 0 [field_cat] => 0 [field_significance] => 0 [field_status_international] => 0 [field_doc_bio] => 0 [field_doc_vbo] => 0 [field_doc_kot] => 0 [field_doc_unesco] => 0 [field_doc_net] => 0 [field_oopt_network] => 0 [field_profile] => 0 [field_creation_date] => 0 [field__political_devision] => 0 [field_cadastr] => 0 [field_cadastr2] => 0 [field_clast] => 0 [field_oopt_area] => 0 [field_gp] => 0 [field_oopt_area_water] => 0 [field_oopt_area_non_withdrawn] => 0 [field_borders] => 0 [field_nature_features] => 0 [field_oopt_area_safe] => 0 [field_biology] => 0 [field_explanation] => 0 [field_zoning] => 0 [field_negative_influence] => 0 [field_protected] => 0 [field_oopt_included] => 0 [taxonomy:1] => 0 [taxonomy:2] => 0 [taxonomy:3] => 0 [taxonomy:4] => 0 [taxonomy:5] => 0 [taxonomy:10] => 0 [taxonomy:6] => 0 )Expression
strpos($fname, UNIQUE_FIELD_FIELDS_TAXONOMY) === 0obviously returns TRUE for elements like[taxonomy:1] => 0thus failing form validation.Comment #10
arithmetric commentedThanks for following up with me on this. I found a bug in the validation logic. I've committed a fix. Could you test if the new development release resolves this (dated 2010/12/05 or later)?
Comment #11
etomilin commentedNew dev version works perfectly. Thanks.
Comment #12
arithmetric commentedExcellent. Thanks for reviewing. I'll roll a new stable version soon.