Added patch to update account id value in description_html of item, which maps the image url to the description

This commit is contained in:
Anand Doshi 2011-08-10 13:27:25 +05:30
parent b61abff9cd
commit aabf1748a2

View File

@ -1,7 +1,7 @@
# REMEMBER to update this
# ========================
last_patch = 336
last_patch = 337
#-------------------------------------------
@ -1356,4 +1356,21 @@ def execute(patch_no):
for dt in ['Account', 'Cost Center', 'Territory', 'Item Group', 'Customer Group']:
sql("update `tabDocField` set fieldtype = 'Link', options = %s where fieldname = 'old_parent' and parent = %s", (dt, dt))
elif patch_no == 336:
reload_doc('server_tools','page','billing')
reload_doc('server_tools','page','billing')
elif patch_no == 337:
item_list = webnotes.conn.sql("""SELECT name, description_html
FROM tabItem""")
if item_list:
for item, html in item_list:
if html and "getfile" in html and "acx" in html:
ac_id = webnotes.conn.sql("""SELECT value FROM `tabSingles` WHERE doctype='Control Panel' AND field='account_id'""")
sp_acx = html.split("acx=")
l_acx = len(sp_acx)
if l_acx > 1:
for i in range(l_acx-1):
sp_quot = sp_acx[i+1].split('"')
if len(sp_quot) > 1: sp_quot[0] = str(ac_id[0][0])
sp_acx[i+1] = '"'.join(sp_quot)
html = "acx=".join(sp_acx)
webnotes.conn.sql("""UPDATE tabItem SET description_html=%s WHERE name=%s""", (html, item))