From f380737327994c4073de22086fda308e56d405b4 Mon Sep 17 00:00:00 2001 From: pratu16x7 Date: Mon, 6 Mar 2017 16:06:03 +0530 Subject: [PATCH] [minor] fix link field decription match --- frappe/public/js/frappe/form/control.js | 27 +++++++++---------------- 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/frappe/public/js/frappe/form/control.js b/frappe/public/js/frappe/form/control.js index f2d60d60dd..1141282f40 100644 --- a/frappe/public/js/frappe/form/control.js +++ b/frappe/public/js/frappe/form/control.js @@ -1303,33 +1303,24 @@ frappe.ui.form.ControlLink = frappe.ui.form.ControlData.extend({ maxItems: 99, autoFirst: true, list: [], - data: function (item, input) { - var label = item.value + "%%%" + (item.description || ""); - if(item.value.indexOf("__link_option") !== -1) { - label = item.label; - } return { - label: label, + label: item.label || item.value, value: item.value }; }, filter: function(item, input) { - var value = item.value.toLowerCase(); - if(value.indexOf('__link_option') !== -1 || - value.indexOf(input.toLowerCase()) !== -1) { - return true; - } + var d = this.get_item(item.value); + return Awesomplete.FILTER_CONTAINS(d.value, '__link_option') || + Awesomplete.FILTER_CONTAINS(d.value, input) || + Awesomplete.FILTER_CONTAINS(d.description, input); }, item: function (item, input) { - var parts = item.split("%%%"), - d = { value: parts[0], description: parts[1] }; - var _value = d.value; + d = this.get_item(item.value); + if(!d.label) { d.label = d.value; } - if(me.translate_values) { - _value = __(d.value) - } - var html = "" + _value + ""; + var _label = (me.translate_values) ? __(d.label) : d.label; + var html = "" + _label + ""; if(d.description && d.value!==d.description) { html += '
' + __(d.description) + ''; }