Token malfunction with Auto NodeTitle: [term] replacement fix patch

flevour - November 25, 2008 - 10:59
Project:Token
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:flevour
Status:needs review
Description

AutoNodeTitle (ANT) patterns containing [term] do not get evaluated upon node creation. I was able to track down the issue inside node_token_values()@token_node.inc.
I found 2 problems:
* while looping through $node->taxonomy terms, when $vid was not found through db_query, the code issued a "continue" instruction, thus skipping all different approaches to $vid identification.
* the approach for the pre-taxonomy submit case doesn't take in account a case in which $node->taxonomy is an array of numeric values. That makes $term (and $original_term) a simple numeric variable. This scenario happens when ANT calls token_replace().

The attached patch removes the 'continue' instruction and changes the if's for the pre-taxonomy submit case to handle $original_term as an array and as a numeric value.

AttachmentSize
parse_term_on_taxo_pre_submit.patch1.89 KB

#1

jhedstrom - July 20, 2009 - 17:21

This patch works perfectly to resolve #476644: Does not see term-raw first time. I had to reroll it through, since the query that gets moved into the conditional has changed in token since this patch was written ($object->vid instead of $object->nid).

AttachmentSize
token.338853.patch 1.76 KB

#2

greggles - July 21, 2009 - 16:07

Can you provide a simpletest for this?

#3

rus032 - September 25, 2009 - 17:26

patch don't work. :(
ps latest stable - ANT, Token

#4

Miteto - October 1, 2009 - 06:44

Actually it does work, patch applied without a hitch.
Latest stable - Token 6.x-1.12, Automatic Nodetitles 6.x-1.2.

#5

vasike - October 20, 2009 - 09:22

subscribe and the solution provided here it seems it works

#6

corona ronin - October 29, 2009 - 00:59

Was this committed to dev? If not, is it going to be, or do I need to reapply the patch each update?

Thanks...

#7

corona ronin - November 14, 2009 - 16:51

I get an error when applying the first patch.

Hunk #1 FAILED at 110.

Patch #1 does not work, but patches successfully. The first patch does not apply, generating the error above. Any suggestions?

#8

corona ronin - November 15, 2009 - 19:55

Also, I don't know what patch to use, the first or second. Currently, I am unable to get ANT working with [term] or [term-raw]. Did anyone successfully get this working? Have these fixes been committed? I can't even keep track of what patches are running and what versions I got. [term] seems to be a pretty widely used token, can I get some update on what is going on with all this?

The second patch (#1) doesen't necessarily succeed, it just doesen't fail. My terminal prompt says 'patching file token_node.inc' but never says hunk succeeded.

I've been going high and low trying to get this fixed, any help would be extremely appreciated

Thanks.

 
 

Drupal is a registered trademark of Dries Buytaert.