Merge branch 'latest' of github.com:webnotes/erpnext into latest
diff --git a/erpnext/home/page/my_company/my_company.py b/erpnext/home/page/my_company/my_company.py
index fa77b6c..a63e8d9 100644
--- a/erpnext/home/page/my_company/my_company.py
+++ b/erpnext/home/page/my_company/my_company.py
@@ -102,7 +102,7 @@
 		'account_url': webnotes.conn.get_default('account_url')
 	})
 	if not args.get('last_name'): args['last_name'] = ''
-	sendmail_md(pr.email, subject="Welcome to ERPNext", msg=welcome_txt % args)
+	sendmail_md(pr.email, subject="Welcome to ERPNext", msg=welcome_txt % args, from_defs=1)
 
 #
 # post comment
diff --git a/erpnext/patches/jan_mar_2012/website/file_data_rename.py b/erpnext/patches/jan_mar_2012/website/file_data_rename.py
index aff25db..2cd5e68 100644
--- a/erpnext/patches/jan_mar_2012/website/file_data_rename.py
+++ b/erpnext/patches/jan_mar_2012/website/file_data_rename.py
@@ -12,7 +12,6 @@
 	change_file_data_in_tabseries()
 	replace_file_list_column_entries()
 
-
 def replace_name_in_file_data():
 	"""
 		Change / to - in tabFile Data name column entries
diff --git a/erpnext/patches/jan_mar_2012/website/getfile_rename.py b/erpnext/patches/jan_mar_2012/website/getfile_rename.py
new file mode 100644
index 0000000..8f7cede
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/website/getfile_rename.py
@@ -0,0 +1,44 @@
+import webnotes
+
+def execute():
+	"""rename from getfle"""
+	l = [
+		('Quotation Detail', 'description'),
+		('Sales Order Detail', 'description'),
+		('Delivery Note Detail', 'description'),
+		('RV Detail', 'description'),
+		('Item', 'description_html'),
+		('Letter Head', 'content')
+	]
+	
+	import re
+	
+	for table in l:
+		for item in webnotes.conn.sql("""select name, %s from `tab%s` 
+			where %s like '%s'""" % (table[1], table[0], table[1], '%cgi-bin/getfile.cgi%')):
+			txt = re.sub('\&acx=[^"\']*', '', item[1])\
+				.replace('cgi-bin/getfile.cgi?name=', 'files/')\
+				.replace('FileData/', 'FileData-')
+			
+			txt = get_file_id(txt)
+			
+			webnotes.conn.sql("""update `tab%s` set %s=%s where name=%s""" % \
+				(table[0], table[1], '%s', '%s'), (txt, item[0]), debug=1)
+	
+	# control panel, client name
+	txt = webnotes.conn.get_value('Control Panel',None,'client_name')
+	txt = get_file_id(txt)
+	webnotes.conn.set_value('Control Panel', None, 'client_name', txt.replace('index.cgi?cmd=get_file&fname=', 'files/'))
+		
+def get_file_id(txt):
+	"""old file links may be from fileid or filename"""
+	import re
+	match = re.search('files/([^"\']*)', txt)
+	fname = match.groups()[0]
+	if not fname.startswith('FileData'):
+		fid = webnotes.conn.sql("""select name from `tabFile Data` 
+			where file_name=%s""", fname)
+		if fid:
+			fid = fid[0][0].replace('/', '-')	
+			txt = txt.replace(fname, fid)
+	return txt
\ No newline at end of file
diff --git a/erpnext/setup/doctype/personalize/personalize.py b/erpnext/setup/doctype/personalize/personalize.py
index dc9ad66..552532d 100644
--- a/erpnext/setup/doctype/personalize/personalize.py
+++ b/erpnext/setup/doctype/personalize/personalize.py
@@ -29,4 +29,6 @@
 	#
 	def set_html_from_image(self):
 		file_name = self.doc.file_list.split(',')[0]
-		self.doc.header_html = '<div><img style="max-height: 120px; max-width: 600px" src="index.cgi?cmd=get_file&fname=' + file_name + '"/></div>'
+		self.doc.header_html = """<div>
+<img style="max-height: 120px; max-width: 600px" src="files/%s"/>
+</div>""" % file_name
diff --git a/erpnext/setup/doctype/setup_control/setup_control.py b/erpnext/setup/doctype/setup_control/setup_control.py
index 8bfebd0..28558f0 100644
--- a/erpnext/setup/doctype/setup_control/setup_control.py
+++ b/erpnext/setup/doctype/setup_control/setup_control.py
@@ -42,7 +42,7 @@
 		args = json.loads(args)
 
 		self.set_cp_defaults(args['company'], args['industry'], args['time_zone'], args['country'], args['account_name'])
-		self.create_profile(args['user'], args['first_name'], args['last_name'])	
+		self.create_profile(args['user'], args['first_name'], args['last_name'], args.get('pwd'))	
 	
 		# Domain related updates
 		try:
@@ -168,13 +168,14 @@
 			
 	# Create Profile
 	# --------------
-	def create_profile(self, user_email, user_fname, user_lname):
+	def create_profile(self, user_email, user_fname, user_lname, pwd=None):
 		pr = Document('Profile')
 		pr.first_name = user_fname
 		pr.last_name = user_lname
 		pr.name = pr.email = user_email
 		pr.enabled = 1
 		pr.save(1)
+		if pwd: webnotes.conn.sql("UPDATE `tabProfile` SET password=PASSWORD(%s) WHERE name=%s", (pwd, user_email))
 		self.add_roles(pr)
 	
 	def add_roles(self, pr):
diff --git a/erpnext/website/doctype/products_settings/products_settings.py b/erpnext/website/doctype/products_settings/products_settings.py
index 195f37f..118ba4f 100644
--- a/erpnext/website/doctype/products_settings/products_settings.py
+++ b/erpnext/website/doctype/products_settings/products_settings.py
@@ -12,4 +12,7 @@
 				tmp = json.dumps({"item_group": d.item_group, "label":d.label})
 				break
 				
-		webnotes.conn.set_default("default_product_category", tmp)
\ No newline at end of file
+		webnotes.conn.set_default("default_product_category", tmp)
+		
+		from webnotes.session_cache import clear_cache
+		clear_cache('Guest')
\ No newline at end of file
diff --git a/erpnext/website/page/products/products.html b/erpnext/website/page/products/products.html
index 6c4fa97..3e460d2 100644
--- a/erpnext/website/page/products/products.html
+++ b/erpnext/website/page/products/products.html
@@ -1,7 +1,7 @@
 <div class="layout_wrapper" id="content-products">
 	<h1 class="products-category"></h1>
 	<div class="web-main-section">
-		<div class="products-search">
+		<div class="products-search" style="margin-bottom: 15px;">
 			<input name="products-search" /><button class="btn" style="margin-left: 7px">Search</button>
 		</div>
 	</div>
diff --git a/erpnext/website/page/products/products.js b/erpnext/website/page/products/products.js
index b9fa167..28baaec 100644
--- a/erpnext/website/page/products/products.js
+++ b/erpnext/website/page/products/products.js
@@ -65,7 +65,7 @@
 			parent.innerHTML = repl('<div style="float:left; width: 115px;">\
 				<img src="files/%(thumbnail_image)s" style="width:100px;"></div>\
 				<div style="float:left; width: 400px">\
-					<b><a href="#!%(page_name)s">%(title)s</a></b>\
+					<p><b><a href="#!%(page_name)s">%(title)s</a></b></p>\
 					<p>%(short_description)s</p></div>\
 				<div style="clear: both; margin-bottom: 15px; border-bottom: 1px solid #AAA"></div>', data);
 		}
diff --git a/js/all-app.js b/js/all-app.js
index 178ca27..e0da79b 100644
--- a/js/all-app.js
+++ b/js/all-app.js
Binary files differ
diff --git a/js/all-web.js b/js/all-web.js
index 4aafba0..b992d0d 100644
--- a/js/all-web.js
+++ b/js/all-web.js
@@ -353,7 +353,7 @@
 return decodeURIComponent(results[1]);},get_dict:function(){var d={}
 var t=window.location.href.split('?')[1];if(!t)return d;if(t.indexOf('#')!=-1)t=t.split('#')[0];if(!t)return d;t=t.split('&');for(var i=0;i<t.length;i++){var a=t[i].split('=');d[decodeURIComponent(a[0])]=decodeURIComponent(a[1]);}
 return d;},get_base_url:function(){var url=window.location.href.split('#')[0].split('?')[0].split('index.html')[0];if(url.substr(url.length-1,1)=='/')url=url.substr(0,url.length-1)
-return url},get_file_url:function(file_id){var ac_id=wn.control_panel.account_id;return repl('cgi-bin/getfile.cgi?name=%(fn)s&acx=%(ac)s',{fn:file_id,ac:ac_id})}}
+return url},get_file_url:function(file_id){return repl('files/%(fn)s',{fn:file_id,ac:ac_id})}}
 get_url_arg=wn.urllib.get_arg;get_url_dict=wn.urllib.get_dict;var user_img={}
 var user_img_queue={};var user_img_loading=[];set_user_img=function(img,username,get_latest,img_id){function set_it(i){if(user_img[username]=='no_img_m')
 i.src='lib/images/ui/no_img_m.gif';else if(user_img[username]=='no_img_f')
diff --git a/version.num b/version.num
index 59b8937..3cf63f9 100644
--- a/version.num
+++ b/version.num
@@ -1 +1 @@
-424
\ No newline at end of file
+425
\ No newline at end of file