Merge pull request #29974 from deepeshgarg007/abbr_check

fix: Make abbreviation limit to 10
This commit is contained in:
Deepesh Garg 2022-02-25 15:52:51 +05:30 committed by GitHub
commit 25edc700bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,11 +78,11 @@ erpnext.setup.slides_settings = [
slide.get_input("company_name").on("change", function () {
var parts = slide.get_input("company_name").val().split(" ");
var abbr = $.map(parts, function (p) { return p ? p.substr(0, 1) : null }).join("");
slide.get_field("company_abbr").set_value(abbr.slice(0, 5).toUpperCase());
slide.get_field("company_abbr").set_value(abbr.slice(0, 10).toUpperCase());
}).val(frappe.boot.sysdefaults.company_name || "").trigger("change");
slide.get_input("company_abbr").on("change", function () {
if (slide.get_input("company_abbr").val().length > 5) {
if (slide.get_input("company_abbr").val().length > 10) {
frappe.msgprint(__("Company Abbreviation cannot have more than 5 characters"));
slide.get_field("company_abbr").set_value("");
}
@ -96,7 +96,7 @@ erpnext.setup.slides_settings = [
if (!this.values.company_abbr) {
return false;
}
if (this.values.company_abbr.length > 5) {
if (this.values.company_abbr.length > 10) {
return false;
}
return true;