[drupal-devel] [bug] possible bug in taxnomy_node_save

wiz drupal-devel at drupal.org
Sat Mar 26 14:34:43 UTC 2005


Issue status update for http://drupal.org/node/19494

 Project:      Drupal
 Version:      cvs
 Component:    taxonomy.module
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  wiz
 Updated by:   wiz
 Status:       patch

All right, but moshe weitzman told me not to do this right away:
"please set issues to patch once they have been tested.
"
I assume that you have thoroughly tested the patch before changing
status ;)


wiz



Previous comments:
------------------------------------------------------------------------

March 26, 2005 - 14:42 : wiz

Hi,
taxnomy_nodeapi calls taxonomy_node_save on insert and update.  This
function, in turn, saves the taxonomy of the node. Unfortunately it
first deletes all terms for the current node, and then inserts them
again /if they have been loaded before/. taxonomy_nodeapi doesn't
respond to 'load'. Therefore, unless you've done something like
$node->taxonomy = taxonomy_node_get_terms($node) the terms are lost.
See: http://drupaldocs.org/api/head/function/taxonomy_node_save
Solution: move the call to taxonomy_node_delete($nid) inside the if
(is_array($terms)). When the terms haven't been loaded they won't be
saved either.


------------------------------------------------------------------------

March 26, 2005 - 14:43 : wiz

Attachment: http://drupal.org/files/issues/taxonomy-save.patch (471 bytes)

Oops, forgot the patch


------------------------------------------------------------------------

March 26, 2005 - 14:58 : Junyor

Don't forget to change the status to patch when you upload a patch. :)





More information about the drupal-devel mailing list