Comments

greggles’s picture

Same idea as the pathauto issue - thoughts?

exaboy’s picture

Status: Needs review » Reviewed & tested by the community

I have applied this patch and works when editing a node and when saving the new revision has the correct term used and path generated.

nonsie’s picture

Works great - cleaner solution than the original

greggles’s picture

Title: Incorrect retrival of node's taxonomy terms » Incorrect retrival of node's taxonomy terms with revisions
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

eltrufa’s picture

Version: 6.x-1.11 » 6.x-1.12
Status: Closed (fixed) » Needs review
FileSize
1 KB

This patch is related to revisioning
module integration. Please see #423132: Incorrect retrival of node's taxonomy terms with revisions.

Thanks.

Leandro

Dave Reid’s picture

Version: 6.x-1.12 » 6.x-1.x-dev
Status: Needs review » Needs work

Incorrect patch format.

bgilday’s picture

subscribing

Sera’s picture

Hi everyone,

this issue is still active for version 6.x-1.13.

I applied the patch in #1 and noticed, that if I choose only 1 term from my vocabulary, then the old term from the revision before is shown: e.g. my vocabulary consists of the terms "done", "open", "critical", and in r1 I choose "open" and in the current version its "done", then in the token the term is still "open" instead of "done".

Thus I added an if - clause. If I have only 1 term, then please take the tid that we already have in $original_term. This works for me. (Please note that I use php5.3)

If I have more than one terms, then my if clause is not choosen, but the module (incl. the patch) still doesnt work correctly. If there is more than one term selected within the node, the [term] is still one of the two terms... : e.g. choosing "open" and "done" (yes, that's illogical, nevertheless its an example) the [term] is "done". Thus for multiple terms the issue is still not fixed!

Nevertheless I hope that this addition still helps someone.

Best regards
Sera

            if (!isset($term->name) || !isset($term->tid)) {
              $vid = db_result(db_query_range("SELECT t.vid FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.nid = %d ORDER BY v.weight, t.weight, t.name", $object->nid, 0, 1));
              if (!$vid) {
                continue;
              }
              //edit by Su ; applying patch #1  from this issue
              //$term = db_fetch_object(db_query_range("SELECT t.tid, t.name FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.vid = %d ORDER BY t.weight", $vid, $object->vid, 0, 1));
              if (!isset($term->name)) {
                $term = db_fetch_object(db_query_range("SELECT t.tid, t.name FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.nid = %d ORDER BY r.vid DESC, weight", $vid, $object->nid, 0, 1));
              }
              else {
                $term = db_fetch_object(db_query_range("SELECT t.tid, t.name FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.nid = %d ORDER BY weight", $vid, $object->nid, 0, 1));
              }   
              //end edit by Su applying patch #1 from this issue
              $term->vid = $vid;
            }

            // Ok, if we still don't have a term name maybe this is a pre-taxonomy submit node
            // So if it's a number we can get data from it
            if (!isset($term->name) && is_array($original_term)) {
              $tid = array_shift($original_term);
              if (is_numeric($tid)) {
                $term = taxonomy_get_term($tid);
              }
            } 
            
            //edit by Su
            //if we have only one term, then the $original_term already contains the correct, current tid and we dont need to have the additional patch from above
            if (is_string($original_term)) {
                $tid = $original_term;
               if (is_numeric($tid)) {
                  $term = taxonomy_get_term($tid);
               }
            } 
            //end of edit by Su
marcoBauli’s picture

subscribing, looking forward to test patch #6 in the correct format