Ver código fonte

checked if duplicate lft, rgt exists in nested set model

version-14
Nabin Hait 14 anos atrás
pai
commit
182111306c
1 arquivos alterados com 5 adições e 1 exclusões
  1. +5
    -1
      cgi-bin/webnotes/utils/nestedset.py

+ 5
- 1
cgi-bin/webnotes/utils/nestedset.py Ver arquivo

@@ -65,7 +65,11 @@ def update_add_node(doctype, name, parent, parent_field):
webnotes.conn.sql("update `tab%s` set rgt = rgt+2 where rgt >= %s" %(doctype,right))
webnotes.conn.sql("update `tab%s` set lft = lft+2 where lft >= %s" %(doctype,right))
#$ update index of new node
# update index of new node
if webnotes.conn.sql("select * from `tab%s` where lft=%s or rgt=%s"% (doctype, right, right+1))
webnotes.msgprint("Nested set error. Please send mail to support")
raise Exception

webnotes.conn.sql("update `tab%s` set lft=%s, rgt=%s where name='%s'" % (doctype,right,right+1,name))
return right



Carregando…
Cancelar
Salvar