From 4dbeae1eae9813394364ff390d13ba1fb38a409e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 7 Jun 2012 14:39:42 +0530 Subject: [PATCH] escape double quotes in communication content, allow 0 as value in data/int field --- erpnext/support/doctype/communication/communication.js | 6 +++--- erpnext/support/doctype/communication/listview.js | 6 +++--- erpnext/support/doctype/support_ticket/listview.js | 6 +++--- public/js/all-app.js | 4 ++-- public/js/fields.js | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/erpnext/support/doctype/communication/communication.js b/erpnext/support/doctype/communication/communication.js index 759dddd59b..36e5c907f0 100644 --- a/erpnext/support/doctype/communication/communication.js +++ b/erpnext/support/doctype/communication/communication.js @@ -38,9 +38,9 @@ cur_frm.cscript.render_communication_list = function(doc, dt, dn) { this._super(data); data.creation = wn.datetime.str_to_user(data.communication_date); - // replace double quote with blank string - data.content = cstr(data.subject).replace(/"/gi, '') - + " | " + cstr(data.content).replace(/"/gi, ''); + // escape double quote + data.content = cstr(data.subject).replace(/"/gi, '\"') + + " | " + cstr(data.content).replace(/"/gi, '\"'); if(data.content && data.content.length > 50) { data.content = '' + diff --git a/erpnext/support/doctype/communication/listview.js b/erpnext/support/doctype/communication/listview.js index 7a1e80c2da..a15cd8930f 100644 --- a/erpnext/support/doctype/communication/listview.js +++ b/erpnext/support/doctype/communication/listview.js @@ -15,9 +15,9 @@ wn.doclistviews['Communication'] = wn.views.ListView.extend({ this._super(data); data.creation = wn.datetime.only_date(data.creation); - // replace double quote with blank string - data.content = cstr(data.subject).replace(/"/gi, '') - + " | " + cstr(data.content).replace(/"/gi, ''); + // escape double quote + data.content = cstr(data.subject).replace(/"/gi, '\"') + + " | " + cstr(data.content).replace(/"/gi, '\"'); if(data.content && data.content.length > 50) { data.content = '' + diff --git a/erpnext/support/doctype/support_ticket/listview.js b/erpnext/support/doctype/support_ticket/listview.js index cc9828e4d0..eb0ba72551 100644 --- a/erpnext/support/doctype/support_ticket/listview.js +++ b/erpnext/support/doctype/support_ticket/listview.js @@ -33,9 +33,9 @@ wn.doclistviews['Support Ticket'] = wn.views.ListView.extend({ me.set_filter('status', $(this).text()); }); - // replace double quote with blank string - data.description = cstr(data.subject).replace(/"/gi, '') - + " | " + cstr(data.description).replace(/"/gi, ''); + // escape double quotes + data.description = cstr(data.subject).replace(/"/gi, '\"') + + " | " + cstr(data.description).replace(/"/gi, '\"'); // description if(data.description && data.description.length > 50) { diff --git a/public/js/all-app.js b/public/js/all-app.js index c953b97187..9605986391 100644 --- a/public/js/all-app.js +++ b/public/js/all-app.js @@ -700,7 +700,7 @@ if(this.txt){try{this.txt.focus();}catch(e){} this.txt.field_object=this;}} function DataField(){}DataField.prototype=new Field();DataField.prototype.make_input=function(){var me=this;this.input=$a_input(this.input_area,this.df.fieldtype=='Password'?'password':'text');this.get_value=function(){var v=this.input.value;if(this.validate) v=this.validate(v);return v;} -this.input.name=this.df.fieldname;$(this.input).change(function(){me.set_value(me.get_value&&me.get_value()||$(this.input).val());});this.set_value=function(val){if(!me.last_value)me.last_value='';if(me.validate){val=me.validate(val);me.input.value=val==undefined?'':val;} +this.input.name=this.df.fieldname;$(this.input).change(function(){me.set_value(me.get_value?me.get_value():$(this.input).val());});this.set_value=function(val){if(!me.last_value)me.last_value='';if(me.validate){val=me.validate(val);me.input.value=val==undefined?'':val;} me.set(val);if(me.format_input) me.format_input();if(in_list(['Currency','Float','Int'],me.df.fieldtype)){if(flt(me.last_value)==flt(val)){me.last_value=val;return;}} me.last_value=val;me.run_trigger();} @@ -1541,7 +1541,7 @@ if(this.txt){try{this.txt.focus();}catch(e){} this.txt.field_object=this;}} function DataField(){}DataField.prototype=new Field();DataField.prototype.make_input=function(){var me=this;this.input=$a_input(this.input_area,this.df.fieldtype=='Password'?'password':'text');this.get_value=function(){var v=this.input.value;if(this.validate) v=this.validate(v);return v;} -this.input.name=this.df.fieldname;$(this.input).change(function(){me.set_value(me.get_value&&me.get_value()||$(this.input).val());});this.set_value=function(val){if(!me.last_value)me.last_value='';if(me.validate){val=me.validate(val);me.input.value=val==undefined?'':val;} +this.input.name=this.df.fieldname;$(this.input).change(function(){me.set_value(me.get_value?me.get_value():$(this.input).val());});this.set_value=function(val){if(!me.last_value)me.last_value='';if(me.validate){val=me.validate(val);me.input.value=val==undefined?'':val;} me.set(val);if(me.format_input) me.format_input();if(in_list(['Currency','Float','Int'],me.df.fieldtype)){if(flt(me.last_value)==flt(val)){me.last_value=val;return;}} me.last_value=val;me.run_trigger();} diff --git a/public/js/fields.js b/public/js/fields.js index 69434a963b..dba9e5c249 100644 --- a/public/js/fields.js +++ b/public/js/fields.js @@ -64,7 +64,7 @@ if(this.txt){try{this.txt.focus();}catch(e){} this.txt.field_object=this;}} function DataField(){}DataField.prototype=new Field();DataField.prototype.make_input=function(){var me=this;this.input=$a_input(this.input_area,this.df.fieldtype=='Password'?'password':'text');this.get_value=function(){var v=this.input.value;if(this.validate) v=this.validate(v);return v;} -this.input.name=this.df.fieldname;$(this.input).change(function(){me.set_value(me.get_value&&me.get_value()||$(this.input).val());});this.set_value=function(val){if(!me.last_value)me.last_value='';if(me.validate){val=me.validate(val);me.input.value=val==undefined?'':val;} +this.input.name=this.df.fieldname;$(this.input).change(function(){me.set_value(me.get_value?me.get_value():$(this.input).val());});this.set_value=function(val){if(!me.last_value)me.last_value='';if(me.validate){val=me.validate(val);me.input.value=val==undefined?'':val;} me.set(val);if(me.format_input) me.format_input();if(in_list(['Currency','Float','Int'],me.df.fieldtype)){if(flt(me.last_value)==flt(val)){me.last_value=val;return;}} me.last_value=val;me.run_trigger();}