mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-19 13:09:17 +00:00
[website] [cleanup] selectable images will now be relative urls (files/..) or full urls (http:..)
This commit is contained in:
16
patches/march_2013/p11_update_attach_files.py
Normal file
16
patches/march_2013/p11_update_attach_files.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
for f in webnotes.conn.sql("""select parent, fieldname
|
||||
from tabDocField where options="attach_files:" """, as_dict=1):
|
||||
if webnotes.conn.get_value("DocType", f.parent, "issingle"):
|
||||
fname = webnotes.conn.get_value(f.parent, None, f.fieldname)
|
||||
if fname:
|
||||
if not (fname.startswith("http") or fname.startswith("files")):
|
||||
webnotes.conn.set_value(f.parent, None, f.fieldname, "files/" + fname)
|
||||
else:
|
||||
webnotes.conn.sql("""update `tab%(parent)s`
|
||||
set %(fieldname)s =
|
||||
if(substr(%(fieldname)s,0,4)='http' or substr(%(fieldname)s, 0, 5)='files',
|
||||
%(fieldname)s,
|
||||
concat('files/', %(fieldname)s))""" % f)
|
||||
@@ -224,4 +224,5 @@ patch_list = [
|
||||
"execute:webnotes.conn.set_value('Email Settings', None, 'send_print_in_body_and_attachment', 1)",
|
||||
"patches.march_2013.p09_unset_user_type_partner",
|
||||
"patches.march_2013.p10_set_fiscal_year_for_stock",
|
||||
"patches.march_2013.p11_update_attach_files",
|
||||
]
|
||||
Reference in New Issue
Block a user