search selector fix for link
diff --git a/css/all-app.css b/css/all-app.css
index 367404c..f706a03 100644
--- a/css/all-app.css
+++ b/css/all-app.css
@@ -1577,6 +1577,11 @@
 	background-color: #eef
 }
 
+div.paging-button {
+	text-align: center;
+	padding: 11px 0px;
+}
+
 div.show_filters {
 	display: none;
 }
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index c86c680..972a467 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -108,12 +108,19 @@
 			cur_frm.refresh();
 	}
 
-	if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback);
-	if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
+	if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 
+		'get_default_customer_address', '', callback);
+	if(doc.customer) unhide_field(['customer_address','contact_person','customer_name',
+		'address_display','contact_display','contact_mobile','contact_email','territory',
+		'customer_group']);
 }
 
 cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
-	if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
+	if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({
+		customer: doc.customer, 
+		address: doc.customer_address, 
+		contact: doc.contact_person
+	}),'', doc, dt, dn, 1);
 }
 
 cur_frm.fields_dict.customer_address.on_new = function(dn) {
diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js
index fe3ba28..deec159 100644
--- a/erpnext/selling/doctype/sales_common/sales_common.js
+++ b/erpnext/selling/doctype/sales_common/sales_common.js
@@ -212,13 +212,16 @@
 cur_frm.cscript.conversion_rate = cur_frm.cscript.currency;
 cur_frm.cscript.plc_conversion_rate = cur_frm.cscript.currency;
 
-cur_frm.cscript.company = function(doc, dt, dn) {
+cur_frm.cscript.company = function(doc, cdt, cdn) {
 	wn.call({
 		method: 'selling.doctype.sales_common.sales_common.get_comp_base_currency',
 		args: {company:doc.company},
 		callback: function(r, rt) {
-			var doc = locals[dt][dn];
-			set_multiple(doc.doctype, doc.name, {currency:r.message, price_list_currency:r.message});
+			var doc = locals[cdt][cdn];
+			set_multiple(doc.doctype, doc.name, {
+				currency:r.message, 
+				price_list_currency:r.message
+			});
 			cur_frm.cscript.currency(doc, cdt, cdn);
 		}
 	});
@@ -249,9 +252,20 @@
 // ******************** ITEM CODE ******************************** 
 cur_frm.fields_dict[cur_frm.cscript.fname].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
 	if (doc.order_type == 'Maintenance')
-		return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND tabItem.docstatus != 2 AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
+		return 'SELECT tabItem.name,tabItem.item_name,tabItem.description \
+			FROM tabItem WHERE tabItem.is_service_item="Yes" \
+			AND tabItem.docstatus != 2 \
+			AND (ifnull(`tabItem`.`end_of_life`,"") = "" \
+				OR `tabItem`.`end_of_life` > NOW() \
+				OR `tabItem`.`end_of_life`="0000-00-00") \
+			AND tabItem.%(key)s LIKE "%s" LIMIT 50';
 	else 
-		return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_sales_item="Yes" AND tabItem.docstatus != 2 AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
+		return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem \
+			WHERE tabItem.is_sales_item="Yes" AND tabItem.docstatus != 2 \
+			AND (ifnull(`tabItem`.`end_of_life`,"") = "" \
+				OR `tabItem`.`end_of_life` > NOW() \
+				OR `tabItem`.`end_of_life`="0000-00-00") \
+			AND tabItem.%(key)s LIKE "%s" LIMIT 50';
 }
 
 
@@ -267,8 +281,14 @@
 			var callback = function(r, rt){
 				cur_frm.cscript.recalc(doc, 1);
 			}
-			var args = {'item_code':d.item_code, 'income_account':d.income_account, 'cost_center': d.cost_center, 'warehouse': d.warehouse};
-			get_server_fields('get_item_details',JSON.stringify(args), fname,doc,cdt,cdn,1,callback);
+			var args = {
+				'item_code':d.item_code, 
+				'income_account':d.income_account, 
+				'cost_center': d.cost_center, 
+				'warehouse': d.warehouse
+			};
+			get_server_fields('get_item_details',JSON.stringify(args), 
+				fname,doc,cdt,cdn,1,callback);
 		}
 	}
 	if(cur_frm.cscript.custom_item_code){
@@ -358,8 +378,14 @@
 	var sales_team = cur_frm.cscript.sales_team_fname;
 	var other_fname	= cur_frm.cscript.other_fname;
 	
-	if(!flt(doc.conversion_rate)) { doc.conversion_rate = 1; refresh_field('conversion_rate'); }
-	if(!flt(doc.plc_conversion_rate)) { doc.plc_conversion_rate = 1; refresh_field('plc_conversion_rate'); }
+	if(!flt(doc.conversion_rate)) { 
+		doc.conversion_rate = 1; 
+		refresh_field('conversion_rate'); 
+	}
+	if(!flt(doc.plc_conversion_rate)) { 
+		doc.plc_conversion_rate = 1; 
+		refresh_field('plc_conversion_rate'); 
+	}
 
 	if(n > 0) cur_frm.cscript.update_fname_table(doc , tname , fname , n, other_fname); // updates all values in table (i.e. amount, export amount, net total etc.)
 	
@@ -378,7 +404,7 @@
 		}
 		cur_frm.cscript.calc_other_charges(doc , tname , fname , other_fname); // calculate other charges
 	}
-	cur_frm.cscript.calc_doc_values(doc, cdt, cdn, tname, fname, other_fname); // calculates total amounts
+	cur_frm.cscript.calc_doc_values(doc, null, null, tname, fname, other_fname); // calculates total amounts
 
 	// ******************* calculate allocated amount of sales person ************************
 	cl = getchildren('Sales Team', doc.name, sales_team);
diff --git a/js/all-app.js b/js/all-app.js
index 4d808ac..fcc73cc 100644
--- a/js/all-app.js
+++ b/js/all-app.js
@@ -1028,7 +1028,7 @@
 /*
  *	lib/js/legacy/webpage/search.js
  */
-search_fields={};function setlinkvalue(name){selector.input.set_input(name);selector.hide();}
+search_fields={};function setlinkvalue(name){selector.input.set_input_value(name);selector.hide();}
 function makeselector(){var d=new Dialog(540,440,'Search');d.make_body([['Data','Beginning With','Tip: You can use wildcard "%"'],['Select','Search By'],['Button','Search'],['HTML','Help'],['HTML','Result']]);var inp=d.widgets['Beginning With'];var field_sel=d.widgets['Search By'];var btn=d.widgets['Search'];d.sel_type='';d.values_len=0;d.set=function(input,type,label){d.sel_type=type;d.input=input;if(d.style!='Link'){d.rows['Result'].innerHTML='';d.values_len=0;}
 d.style='Link';d.set_query_description()
 if(!d.sel_type)d.sel_type='Value';d.set_title('Select a "'+d.sel_type+'" for field "'+label+'"');}
@@ -1042,8 +1042,7 @@
 try{inp.focus();}catch(e){}
 if(d.input)d.input.set_get_query();var get_sf_list=function(dt){var l=[];var lf=search_fields[dt];for(var i=0;i<lf.length;i++)l.push(lf[i][1]);return l;}
 $ds(d.rows['Search By']);if(search_fields[d.sel_type]){empty_select(field_sel);add_sel_options(field_sel,get_sf_list(d.sel_type),'ID');}else{empty_select(field_sel);add_sel_options(field_sel,['ID'],'ID');$c('webnotes.widgets.search.getsearchfields',{'doctype':d.sel_type},function(r,rt){search_fields[d.sel_type]=r.searchfields;empty_select(field_sel);add_sel_options(field_sel,get_sf_list(d.sel_type));field_sel.selectedIndex=0;});}}
-d.onhide=function(){if(d.input&&d.input.txt)
-d.input.txt.onchange()}
+d.onhide=function(){}
 btn.onclick=function(){if(this.disabled)return;this.args.is_ajax=true;this.set_working();d.set_doctype=d.sel_type;var q='';args={};if(d.input&&d.input.get_query){var doc={};args.is_simple=1;if(cur_frm)doc=locals[cur_frm.doctype][cur_frm.docname];var q=d.input.get_query(doc,d.input.doctype,d.input.docname);if(!q){return'';}}
 var get_sf_fieldname=function(v){var lf=search_fields[d.sel_type];if(!lf)
 return'name'
diff --git a/js/all-web.js b/js/all-web.js
index aab3e93..af66b0b 100644
--- a/js/all-web.js
+++ b/js/all-web.js
@@ -720,21 +720,21 @@
     \
     <div class="result">\
      <div class="result-list"></div>\
-     <div class="result-grid"></div>\
+     <div class="result-grid hide"></div>\
     </div>\
     \
-    <div class="paging-button hide">\
-     <button class="btn btn-small btn-more">More...</div>\
+    <div class="paging-button">\
+     <button class="btn btn-small btn-more hide">More...</div>\
     </div>\
    </div>\
   ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();this.make_filters();},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-refresh').click(function(){me.run();});this.$w.find('.btn-more').click(function(){me.run({append:true});});this.$w.find('.btn-list').click(function(){me.show_view($(this),me.$w.find('.result-list'),me.$w.find('.btn-grid'),me.$w.find('.result-grid'))});this.$w.find('.btn-grid').click(function(){me.show_view($(this),me.$w.find('.result-grid'),me.$w.find('.btn-list'),me.$w.find('.result-list'))});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
-if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype);})}else{this.$w.find('.btn-new').toggle(false).attr('hidden','true');}
-if(!me.show_filters){this.$w.find('.btn-filter').toggle(false).attr('hidden','true');}
-if(this.hide_refresh||this.no_refresh){this.$w.find('.btn-refresh').toggle(false).attr('hidden','true');}
+if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype);})}else{this.$w.find('.btn-new').toggle(false).attr('hidden','hidden');}
+if(!me.show_filters){this.$w.find('.btn-filter').toggle(false).attr('hidden','hidden');}
+if(this.hide_refresh||this.no_refresh){this.$w.find('.btn-refresh').toggle(false).attr('hidden','hidden');}
 if(this.show_grid){this.$w.find('.select-view').toggle(true);}
-if(this.$w.find('.list-toolbar [hidden!="true"]').length>1){this.$w.find('.list-toolbar').addClass('btn-group')}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
+if(this.$w.find('.list-toolbar a[hidden!="hidden"]').length>1){this.$w.find('.list-toolbar').addClass('btn-group')}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
 this.onrun=a0;if(a0&&a0.callback)
-this.onrun=a0.callback;if(!a1||(a0&&a0.append))
+this.onrun=a0.callback;if(!a1&&!(a0&&a0.append))
 this.start=0;me.$w.find('.img-load').toggle(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.$w.find('.img-load').toggle(false);me.render_results(r)},no_spinner:this.opts.no_loading,btn:this.run_btn});},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
 args.simple_query=this.query;}else{var args={limit_start:this.start,limit_page_length:this.page_length}}
 if(this.args)
@@ -834,7 +834,7 @@
 /*
  *	lib/js/legacy/webpage/search.js
  */
-search_fields={};function setlinkvalue(name){selector.input.set_input(name);selector.hide();}
+search_fields={};function setlinkvalue(name){selector.input.set_input_value(name);selector.hide();}
 function makeselector(){var d=new Dialog(540,440,'Search');d.make_body([['Data','Beginning With','Tip: You can use wildcard "%"'],['Select','Search By'],['Button','Search'],['HTML','Help'],['HTML','Result']]);var inp=d.widgets['Beginning With'];var field_sel=d.widgets['Search By'];var btn=d.widgets['Search'];d.sel_type='';d.values_len=0;d.set=function(input,type,label){d.sel_type=type;d.input=input;if(d.style!='Link'){d.rows['Result'].innerHTML='';d.values_len=0;}
 d.style='Link';d.set_query_description()
 if(!d.sel_type)d.sel_type='Value';d.set_title('Select a "'+d.sel_type+'" for field "'+label+'"');}
@@ -848,8 +848,7 @@
 try{inp.focus();}catch(e){}
 if(d.input)d.input.set_get_query();var get_sf_list=function(dt){var l=[];var lf=search_fields[dt];for(var i=0;i<lf.length;i++)l.push(lf[i][1]);return l;}
 $ds(d.rows['Search By']);if(search_fields[d.sel_type]){empty_select(field_sel);add_sel_options(field_sel,get_sf_list(d.sel_type),'ID');}else{empty_select(field_sel);add_sel_options(field_sel,['ID'],'ID');$c('webnotes.widgets.search.getsearchfields',{'doctype':d.sel_type},function(r,rt){search_fields[d.sel_type]=r.searchfields;empty_select(field_sel);add_sel_options(field_sel,get_sf_list(d.sel_type));field_sel.selectedIndex=0;});}}
-d.onhide=function(){if(d.input&&d.input.txt)
-d.input.txt.onchange()}
+d.onhide=function(){}
 btn.onclick=function(){if(this.disabled)return;this.args.is_ajax=true;this.set_working();d.set_doctype=d.sel_type;var q='';args={};if(d.input&&d.input.get_query){var doc={};args.is_simple=1;if(cur_frm)doc=locals[cur_frm.doctype][cur_frm.docname];var q=d.input.get_query(doc,d.input.doctype,d.input.docname);if(!q){return'';}}
 var get_sf_fieldname=function(v){var lf=search_fields[d.sel_type];if(!lf)
 return'name'
diff --git a/version.num b/version.num
index 2b15d82..1c8a8a8 100644
--- a/version.num
+++ b/version.num
@@ -1 +1 @@
-926
\ No newline at end of file
+932
\ No newline at end of file