diff --git a/frappe/__init__.py b/frappe/__init__.py
index 2062004296..6889e6316f 100644
--- a/frappe/__init__.py
+++ b/frappe/__init__.py
@@ -510,10 +510,11 @@ def make_property_setter(args):
def get_application_home_page(user='Guest'):
"""get home page for user"""
+ roles = get_roles(user)
hpl = db.sql("""select home_page
from `tabDefault Home Page`
where parent='Control Panel'
- and role in ('%s') order by idx asc limit 1""" % "', '".join(get_roles(user)))
+ and role in (%s) order by idx asc limit 1""" % ", ".join(['%s']*len(roles)), roles)
if hpl:
return hpl[0][0]
else:
diff --git a/frappe/boot.py b/frappe/boot.py
index bb2663cb1c..2470edd941 100644
--- a/frappe/boot.py
+++ b/frappe/boot.py
@@ -83,9 +83,9 @@ def load_conf_settings(bootinfo):
if key in conf: bootinfo[key] = conf.get(key)
def add_allowed_pages(bootinfo):
- bootinfo.page_info = dict(frappe.db.sql("""select distinct
- parent, modified from `tabPage Role`
- where role in ('%s')""" % "', '".join(frappe.get_roles())))
+ roles = frappe.get_roles()
+ bootinfo.page_info = dict(frappe.db.sql("""select distinct parent, modified from `tabPage Role`
+ where role in (%s)""" % ', '.join(['%s']*len(roles)), roles))
# pages where role is not set are also allowed
bootinfo.page_info.update(dict(frappe.db.sql("""select parent, modified
diff --git a/frappe/core/doctype/docfield/docfield.txt b/frappe/core/doctype/docfield/docfield.txt
index 12c02d8fff..2dd3a6e819 100644
--- a/frappe/core/doctype/docfield/docfield.txt
+++ b/frappe/core/doctype/docfield/docfield.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:27:33",
"docstatus": 0,
- "modified": "2014-01-02 10:50:02",
+ "modified": "2014-03-05 14:58:43",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -178,6 +178,13 @@
"print_width": "50px",
"width": "50px"
},
+ {
+ "doctype": "DocField",
+ "fieldname": "set_only_once",
+ "fieldtype": "Check",
+ "label": "Set Only Once",
+ "description": "Do not allow user to change after set the first time"
+ },
{
"doctype": "DocField",
"fieldname": "column_break_13",
diff --git a/frappe/core/doctype/doctype/doctype.py b/frappe/core/doctype/doctype/doctype.py
index f08c3c9c99..8bac02bc72 100644
--- a/frappe/core/doctype/doctype/doctype.py
+++ b/frappe/core/doctype/doctype/doctype.py
@@ -33,10 +33,9 @@ class DocType:
if frappe.flags.in_import:
return
parent_list = frappe.db.sql("""SELECT parent
- from tabDocField where fieldtype="Table" and options="%s" """ % self.doc.name)
+ from tabDocField where fieldtype="Table" and options=%s""", self.doc.name)
for p in parent_list:
- frappe.db.sql('''UPDATE tabDocType SET modified="%s"
- WHERE `name`="%s"''' % (now(), p[0]))
+ frappe.db.sql('UPDATE tabDocType SET modified=%s WHERE `name`=%s', (now(), p[0]))
def scrub_field_names(self):
restricted = ('name','parent','idx','owner','creation','modified','modified_by',
diff --git a/frappe/core/page/permission_manager/permission_manager.py b/frappe/core/page/permission_manager/permission_manager.py
index d2f54da872..8d0b491865 100644
--- a/frappe/core/page/permission_manager/permission_manager.py
+++ b/frappe/core/page/permission_manager/permission_manager.py
@@ -22,10 +22,10 @@ def get_roles_and_doctypes():
def get_permissions(doctype=None, role=None):
frappe.only_for("System Manager")
return frappe.db.sql("""select * from tabDocPerm
- where %s%s order by parent, permlevel, role""" % (\
- doctype and (" parent='%s'" % doctype) or "",
- role and ((doctype and " and " or "") + " role='%s'" % role) or "",
- ), as_dict=True)
+ where %s%s order by parent, permlevel, role""" %
+ (doctype and (" parent='%s'" % doctype.replace("'", "\'")) or "",
+ role and ((doctype and " and " or "") + " role='%s'" % role.replace("'", "\'")) or ""),
+ as_dict=True)
@frappe.whitelist()
def remove(doctype, name):
diff --git a/frappe/core/report/todo/todo.py b/frappe/core/report/todo/todo.py
index 3524224fc3..0c5012962b 100644
--- a/frappe/core/report/todo/todo.py
+++ b/frappe/core/report/todo/todo.py
@@ -18,18 +18,19 @@ def execute(filters=None):
todo.date and getdate(todo.date) or getdate("1900-01-01")), reverse=True)
columns = [_("ID")+":Link/ToDo:90", _("Priority")+"::60", _("Date")+ ":Date",
- _("Description")+"::150", _("Assigned To/Owner") + ":Link/User:120",
- _("Assigned By")+":Link/User:120", _("Reference")+"::200"]
+ _("Description")+"::150", _("Assigned To/Owner") + ":Data:120",
+ _("Assigned By")+":Data:120", _("Reference")+"::200"]
result = []
for todo in todo_list:
- if todo.reference_type:
- todo.reference = """%s: %s""" % \
- (todo.reference_type, todo.reference_name, todo.reference_type, todo.reference_name)
- else:
- todo.reference = None
- result.append([todo.name, todo.priority, todo.date, todo.description,
- todo.owner, todo.assigned_by, todo.reference])
+ if todo.owner==frappe.session.user or todo.assigned_by==frappe.session.user:
+ if todo.reference_type:
+ todo.reference = """%s: %s""" % (todo.reference_type,
+ todo.reference_name, todo.reference_type, todo.reference_name)
+ else:
+ todo.reference = None
+ result.append([todo.name, todo.priority, todo.date, todo.description,
+ todo.owner, todo.assigned_by, todo.reference])
return columns, result
diff --git a/frappe/country_info.json b/frappe/country_info.json
index 2ab8f1dd2d..318ecc2ec1 100644
--- a/frappe/country_info.json
+++ b/frappe/country_info.json
@@ -1,5 +1,6 @@
{
"Afghanistan": {
+ "code": "af",
"currency_fraction": "Pul",
"currency_fraction_units": 100,
"currency_symbol": "\u060b",
@@ -9,6 +10,7 @@
]
},
"Albania": {
+ "code": "al",
"currency": "ALL",
"currency_fraction": "Qindark\u00eb",
"currency_fraction_units": 100,
@@ -20,6 +22,7 @@
]
},
"Algeria": {
+ "code": "dz",
"currency": "DZD",
"currency_fraction": "Santeem",
"currency_fraction_units": 100,
@@ -31,9 +34,11 @@
]
},
"American Samoa": {
+ "code": "as",
"number_format": "#,###.##"
},
"Andorra": {
+ "code": "ad",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -44,6 +49,7 @@
]
},
"Angola": {
+ "code": "ao",
"currency_fraction": "C\u00eantimo",
"currency_fraction_units": 100,
"currency_symbol": "Kz",
@@ -53,6 +59,7 @@
]
},
"Anguilla": {
+ "code": "ai",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -62,6 +69,7 @@
]
},
"Antarctica": {
+ "code": "aq",
"number_format": "#,###.##",
"timezones": [
"Antarctica/Casey",
@@ -78,6 +86,7 @@
]
},
"Antigua and Barbuda": {
+ "code": "ag",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -87,6 +96,7 @@
]
},
"Argentina": {
+ "code": "ar",
"currency": "ARS",
"currency_fraction": "Centavo",
"currency_fraction_units": 100,
@@ -109,6 +119,7 @@
]
},
"Armenia": {
+ "code": "am",
"currency": "AMD",
"currency_fraction": "Luma",
"currency_fraction_units": 100,
@@ -120,6 +131,7 @@
]
},
"Aruba": {
+ "code": "aw",
"currency": "AWG",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -131,6 +143,7 @@
]
},
"Australia": {
+ "code": "au",
"currency": "AUD",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -153,6 +166,7 @@
]
},
"Austria": {
+ "code": "at",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -163,6 +177,7 @@
]
},
"Azerbaijan": {
+ "code": "az",
"currency_fraction": "Q\u0259pik",
"currency_fraction_units": 100,
"currency_symbol": "",
@@ -172,6 +187,7 @@
]
},
"Bahamas": {
+ "code": "bs",
"currency": "BSD",
"currency_name": "Bahamian Dollar",
"number_format": "#,###.##",
@@ -180,6 +196,7 @@
]
},
"Bahrain": {
+ "code": "bh",
"currency": "BHD",
"currency_fraction": "Fils",
"currency_fraction_units": 1000,
@@ -191,6 +208,7 @@
]
},
"Bangladesh": {
+ "code": "bd",
"currency": "BDT",
"currency_fraction": "Paisa",
"currency_fraction_units": 100,
@@ -202,6 +220,7 @@
]
},
"Barbados": {
+ "code": "bb",
"currency": "BBD",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -213,6 +232,7 @@
]
},
"Belarus": {
+ "code": "by",
"currency_fraction": "Kapyeyka",
"currency_fraction_units": 100,
"currency_symbol": "Br",
@@ -222,6 +242,7 @@
]
},
"Belgium": {
+ "code": "be",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -232,6 +253,7 @@
]
},
"Belize": {
+ "code": "bz",
"currency": "BZD",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -244,6 +266,7 @@
]
},
"Benin": {
+ "code": "bj",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
"currency_symbol": "Fr",
@@ -253,6 +276,7 @@
]
},
"Bermuda": {
+ "code": "bm",
"currency": "BMD",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -264,6 +288,7 @@
]
},
"Bhutan": {
+ "code": "bt",
"currency": "BTN",
"currency_fraction": "Chetrum",
"currency_fraction_units": 100,
@@ -275,14 +300,17 @@
]
},
"Bolivia, Plurinational State of": {
+ "code": "bo",
"currency": "BOB",
"currency_name": "Boliviano",
"number_format": "#,###.##"
},
"Bonaire, Sint Eustatius and Saba": {
+ "code": "bq",
"number_format": "#,###.##"
},
"Bosnia and Herzegovina": {
+ "code": "ba",
"currency_fraction": "Fening",
"currency_fraction_units": 100,
"currency_symbol": "KM or \u041a\u041c",
@@ -292,6 +320,7 @@
]
},
"Botswana": {
+ "code": "bw",
"currency": "BWP",
"currency_fraction": "Thebe",
"currency_fraction_units": 100,
@@ -303,14 +332,16 @@
]
},
"Bouvet Island": {
+ "code": "bv",
"number_format": "#,###.##"
},
"Brazil": {
- "currency": "BRL",
+ "code": "br",
+ "currency": "BRL",
"currency_fraction": "Centavo",
"currency_fraction_units": 100,
"currency_symbol": "R$",
- "date_format": "dd/mm/yyyy",
+ "date_format": "dd/mm/yyyy",
"number_format": "#.###,##",
"timezones": [
"America/Araguaina",
@@ -332,6 +363,7 @@
]
},
"British Indian Ocean Territory": {
+ "code": "io",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -341,6 +373,7 @@
]
},
"Brunei Darussalam": {
+ "code": "bn",
"currency": "BND",
"currency_name": "Brunei Dollar",
"number_format": "#,###.##",
@@ -349,6 +382,7 @@
]
},
"Bulgaria": {
+ "code": "bg",
"currency_fraction": "Stotinka",
"currency_fraction_units": 100,
"currency_symbol": "\u043b\u0432",
@@ -358,6 +392,7 @@
]
},
"Burkina Faso": {
+ "code": "bf",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
"currency_symbol": "Fr",
@@ -367,6 +402,7 @@
]
},
"Burundi": {
+ "code": "bi",
"currency": "BIF",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
@@ -378,6 +414,7 @@
]
},
"Cambodia": {
+ "code": "kh",
"currency": "KHR",
"currency_fraction": "Sen",
"currency_fraction_units": 100,
@@ -389,6 +426,7 @@
]
},
"Cameroon": {
+ "code": "cm",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
"currency_symbol": "Fr",
@@ -398,6 +436,7 @@
]
},
"Canada": {
+ "code": "ca",
"currency": "CAD",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -437,6 +476,7 @@
]
},
"Cape Verde": {
+ "code": "cv",
"currency": "CVE",
"currency_fraction": "Centavo",
"currency_fraction_units": 100,
@@ -448,6 +488,7 @@
]
},
"Cayman Islands": {
+ "code": "ky",
"currency": "KYD",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -459,6 +500,7 @@
]
},
"Central African Republic": {
+ "code": "cf",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
"currency_symbol": "Fr",
@@ -468,6 +510,7 @@
]
},
"Chad": {
+ "code": "td",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
"currency_symbol": "Fr",
@@ -477,6 +520,7 @@
]
},
"Chile": {
+ "code": "cl",
"currency": "CLP",
"currency_fraction": "Centavo",
"currency_fraction_units": 100,
@@ -489,6 +533,7 @@
]
},
"China": {
+ "code": "cn",
"currency": "CNY",
"currency_name": "Yuan Renminbi",
"date_format": "yyyy-mm-dd",
@@ -502,12 +547,14 @@
]
},
"Christmas Island": {
+ "code": "cx",
"number_format": "#,###.##",
"timezones": [
"Indian/Christmas"
]
},
"Cocos (Keeling) Islands": {
+ "code": "cc",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -517,6 +564,7 @@
]
},
"Colombia": {
+ "code": "co",
"currency": "COP",
"currency_fraction": "Centavo",
"currency_fraction_units": 100,
@@ -528,6 +576,7 @@
]
},
"Comoros": {
+ "code": "km",
"currency": "KMF",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
@@ -539,12 +588,14 @@
]
},
"Congo": {
+ "code": "cg",
"number_format": "#,###.##"
},
"Congo, The Democratic Republic of the": {
"number_format": "#,###.##"
},
"Cook Islands": {
+ "code": "ck",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -554,6 +605,7 @@
]
},
"Costa Rica": {
+ "code": "cr",
"currency": "CRC",
"currency_fraction": "C\u00e9ntimo",
"currency_fraction_units": 100,
@@ -565,6 +617,7 @@
]
},
"Croatia": {
+ "code": "hr",
"currency": "HRK",
"currency_fraction": "Lipa",
"currency_fraction_units": 100,
@@ -576,6 +629,7 @@
]
},
"Cuba": {
+ "code": "cu",
"currency": "CUP",
"currency_fraction": "Centavo",
"currency_fraction_units": 100,
@@ -587,12 +641,14 @@
]
},
"Cura\u00e7ao": {
+ "code": "cw",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "\u0192",
"number_format": "#,###.##"
},
"Cyprus": {
+ "code": "cy",
"currency": "CYP",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -604,6 +660,7 @@
]
},
"Czech Republic": {
+ "code": "cz",
"currency": "CZK",
"currency_fraction": "Hal\u00e9\u0159",
"currency_fraction_units": 100,
@@ -615,6 +672,7 @@
]
},
"Denmark": {
+ "code": "dk",
"currency": "DKK",
"currency_fraction": "\u00d8re",
"currency_fraction_units": 100,
@@ -626,6 +684,7 @@
]
},
"Djibouti": {
+ "code": "dj",
"currency": "DJF",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
@@ -637,6 +696,7 @@
]
},
"Dominica": {
+ "code": "dm",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -646,6 +706,7 @@
]
},
"Dominican Republic": {
+ "code": "do",
"currency": "DOP",
"currency_fraction": "Centavo",
"currency_fraction_units": 100,
@@ -657,6 +718,7 @@
]
},
"Ecuador": {
+ "code": "ec",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -667,6 +729,7 @@
]
},
"Egypt": {
+ "code": "eg",
"currency": "EGP",
"currency_fraction": "Piastre[F]",
"currency_fraction_units": 100,
@@ -678,6 +741,7 @@
]
},
"El Salvador": {
+ "code": "sv",
"currency": "SVC",
"currency_fraction": "Centavo",
"currency_fraction_units": 100,
@@ -689,6 +753,7 @@
]
},
"Equatorial Guinea": {
+ "code": "gq",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
"currency_symbol": "Fr",
@@ -698,6 +763,7 @@
]
},
"Eritrea": {
+ "code": "er",
"currency": "ERN",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -710,6 +776,7 @@
]
},
"Estonia": {
+ "code": "ee",
"currency": "EEK",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -721,6 +788,7 @@
]
},
"Ethiopia": {
+ "code": "et",
"currency_fraction": "Santim",
"currency_fraction_units": 100,
"currency_symbol": "Br",
@@ -730,11 +798,13 @@
]
},
"Falkland Islands (Malvinas)": {
+ "code": "fk",
"currency": "FKP",
"currency_name": "Falkland Islands Pound",
"number_format": "#,###.##"
},
"Faroe Islands": {
+ "code": "fo",
"currency_fraction": "\u00d8re",
"currency_fraction_units": 100,
"currency_symbol": "kr",
@@ -744,6 +814,7 @@
]
},
"Fiji": {
+ "code": "fj",
"currency": "FJD",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -755,6 +826,7 @@
]
},
"Finland": {
+ "code": "fi",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -765,6 +837,7 @@
]
},
"France": {
+ "code": "fr",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -775,12 +848,14 @@
]
},
"French Guiana": {
+ "code": "gf",
"number_format": "#,###.##",
"timezones": [
"America/Cayenne"
]
},
"French Polynesia": {
+ "code": "pf",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
"currency_symbol": "Fr",
@@ -792,9 +867,11 @@
]
},
"French Southern Territories": {
+ "code": "tf",
"number_format": "#,###.##"
},
"Gabon": {
+ "code": "ga",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
"currency_symbol": "Fr",
@@ -804,6 +881,7 @@
]
},
"Gambia": {
+ "code": "gm",
"currency": "GMD",
"currency_name": "Dalasi",
"number_format": "#,###.##",
@@ -812,6 +890,7 @@
]
},
"Georgia": {
+ "code": "ge",
"currency_fraction": "Tetri",
"currency_fraction_units": 100,
"currency_symbol": "\u10da",
@@ -821,6 +900,7 @@
]
},
"Germany": {
+ "code": "de",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -831,6 +911,7 @@
]
},
"Ghana": {
+ "code": "gh",
"currency_fraction": "Pesewa",
"currency_fraction_units": 100,
"currency_symbol": "\u20b5",
@@ -840,6 +921,7 @@
]
},
"Gibraltar": {
+ "code": "gi",
"currency": "GIP",
"currency_fraction": "Penny",
"currency_fraction_units": 100,
@@ -851,6 +933,7 @@
]
},
"Greece": {
+ "code": "gr",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -861,6 +944,7 @@
]
},
"Greenland": {
+ "code": "gl",
"number_format": "#,###.##",
"timezones": [
"America/Danmarkshavn",
@@ -870,6 +954,7 @@
]
},
"Grenada": {
+ "code": "gd",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -879,18 +964,21 @@
]
},
"Guadeloupe": {
+ "code": "gp",
"number_format": "#,###.##",
"timezones": [
"America/Guadeloupe"
]
},
"Guam": {
+ "code": "gu",
"number_format": "#,###.##",
"timezones": [
"Pacific/Guam"
]
},
"Guatemala": {
+ "code": "gt",
"currency": "GTQ",
"currency_fraction": "Centavo",
"currency_fraction_units": 100,
@@ -902,6 +990,7 @@
]
},
"Guernsey": {
+ "code": "gg",
"currency_fraction": "Penny",
"currency_fraction_units": 100,
"currency_symbol": "\u00a3",
@@ -911,6 +1000,7 @@
]
},
"Guinea": {
+ "code": "gn",
"currency": "GNF",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
@@ -922,6 +1012,7 @@
]
},
"Guinea-Bissau": {
+ "code": "gw",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
"currency_symbol": "Fr",
@@ -931,6 +1022,7 @@
]
},
"Guyana": {
+ "code": "gy",
"currency": "GYD",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -942,6 +1034,7 @@
]
},
"Haiti": {
+ "code": "ht",
"currency": "HTG",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
@@ -954,12 +1047,15 @@
]
},
"Heard Island and McDonald Islands": {
+ "code": "hm",
"number_format": "#,###.##"
},
"Holy See (Vatican City State)": {
+ "code": "va",
"number_format": "#,###.##"
},
"Honduras": {
+ "code": "hn",
"currency": "HNL",
"currency_fraction": "Centavo",
"currency_fraction_units": 100,
@@ -971,6 +1067,7 @@
]
},
"Hong Kong": {
+ "code": "hk",
"currency": "HKD",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -982,6 +1079,7 @@
]
},
"Hungary": {
+ "code": "hu",
"currency": "HUF",
"currency_fraction": "Fill\u00e9r",
"currency_fraction_units": 100,
@@ -994,6 +1092,7 @@
]
},
"Iceland": {
+ "code": "is",
"currency": "ISK",
"currency_fraction": "Eyrir",
"currency_fraction_units": 100,
@@ -1005,6 +1104,7 @@
]
},
"India": {
+ "code": "in",
"currency": "INR",
"currency_fraction": "Paisa",
"currency_fraction_units": 100,
@@ -1017,6 +1117,7 @@
]
},
"Indonesia": {
+ "code": "id",
"currency": "IDR",
"currency_fraction": "Sen",
"currency_fraction_units": 100,
@@ -1031,11 +1132,13 @@
]
},
"Iran, Islamic Republic of": {
+ "code": "ir",
"currency": "IRR",
"currency_name": "Iranian Rial",
"number_format": "#,###.##"
},
"Iraq": {
+ "code": "iq",
"currency": "IQD",
"currency_fraction": "Fils",
"currency_fraction_units": 1000,
@@ -1047,6 +1150,7 @@
]
},
"Ireland": {
+ "code": "ie",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1057,6 +1161,7 @@
]
},
"Isle of Man": {
+ "code": "im",
"currency_fraction": "Penny",
"currency_fraction_units": 100,
"currency_symbol": "\u00a3",
@@ -1066,6 +1171,7 @@
]
},
"Israel": {
+ "code": "il",
"currency": "ILS",
"currency_fraction": "Agora",
"currency_fraction_units": 100,
@@ -1077,6 +1183,7 @@
]
},
"Italy": {
+ "code": "it",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1093,6 +1200,7 @@
"number_format": "#,###.##"
},
"Jamaica": {
+ "code": "jm",
"currency": "JMD",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1104,6 +1212,7 @@
]
},
"Japan": {
+ "code": "jp",
"currency": "JPY",
"currency_fraction": "Sen[G]",
"currency_fraction_units": 100,
@@ -1115,6 +1224,7 @@
]
},
"Jersey": {
+ "code": "je",
"currency_fraction": "Penny",
"currency_fraction_units": 100,
"currency_symbol": "\u00a3",
@@ -1124,6 +1234,7 @@
]
},
"Jordan": {
+ "code": "jo",
"currency": "JOD",
"currency_fraction": "Piastre[H]",
"currency_fraction_units": 100,
@@ -1135,6 +1246,7 @@
]
},
"Kazakhstan": {
+ "code": "kz",
"currency": "KZT",
"currency_fraction": "T\u00ef\u0131n",
"currency_fraction_units": 100,
@@ -1150,6 +1262,7 @@
]
},
"Kenya": {
+ "code": "ke",
"currency": "KES",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1161,6 +1274,7 @@
]
},
"Kiribati": {
+ "code": "ki",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -1177,11 +1291,13 @@
"number_format": "#,###.##"
},
"Korea, Republic of": {
+ "code": "kr",
"currency": "KRW",
"currency_name": "Won",
"number_format": "#,###"
},
"Kuwait": {
+ "code": "kw",
"currency": "KWD",
"currency_fraction": "Fils",
"currency_fraction_units": 1000,
@@ -1193,6 +1309,7 @@
]
},
"Kyrgyzstan": {
+ "code": "kg",
"currency": "KGS",
"currency_fraction": "Tyiyn",
"currency_fraction_units": 100,
@@ -1209,6 +1326,7 @@
"number_format": "#,###.##"
},
"Latvia": {
+ "code": "lv",
"currency": "LVL",
"currency_fraction": "Sant\u012bms",
"currency_fraction_units": 100,
@@ -1220,6 +1338,7 @@
]
},
"Lebanon": {
+ "code": "lb",
"currency": "LBP",
"currency_fraction": "Piastre",
"currency_fraction_units": 100,
@@ -1231,6 +1350,7 @@
]
},
"Lesotho": {
+ "code": "ls",
"currency": "LSL",
"currency_fraction": "Sente",
"currency_fraction_units": 100,
@@ -1242,6 +1362,7 @@
]
},
"Liberia": {
+ "code": "lr",
"currency": "LRD",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1253,6 +1374,7 @@
]
},
"Libya": {
+ "code": "ly",
"currency": "LYD",
"currency_fraction": "Dirham",
"currency_fraction_units": 1000,
@@ -1264,6 +1386,7 @@
]
},
"Liechtenstein": {
+ "code": "li",
"currency_fraction": "Rappen",
"currency_fraction_units": 100,
"currency_symbol": "Fr",
@@ -1273,6 +1396,7 @@
]
},
"Lithuania": {
+ "code": "lt",
"currency": "LTL",
"currency_fraction": "Centas",
"currency_fraction_units": 100,
@@ -1285,6 +1409,7 @@
]
},
"Luxembourg": {
+ "code": "lu",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1295,6 +1420,7 @@
]
},
"Macao": {
+ "code": "mo",
"currency": "MOP",
"currency_name": "Pataca",
"number_format": "#,###.##"
@@ -1308,6 +1434,7 @@
"number_format": "#,###.##"
},
"Madagascar": {
+ "code": "mg",
"currency_fraction": "Iraimbilanja",
"currency_fraction_units": 5,
"currency_symbol": "Ar",
@@ -1317,6 +1444,7 @@
]
},
"Malawi": {
+ "code": "mw",
"currency": "MWK",
"currency_fraction": "Tambala",
"currency_fraction_units": 100,
@@ -1328,6 +1456,7 @@
]
},
"Malaysia": {
+ "code": "my",
"currency": "MYR",
"currency_fraction": "Sen",
"currency_fraction_units": 100,
@@ -1340,6 +1469,7 @@
]
},
"Maldives": {
+ "code": "mv",
"currency": "MVR",
"currency_fraction": "Laari",
"currency_fraction_units": 100,
@@ -1351,6 +1481,7 @@
]
},
"Mali": {
+ "code": "ml",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
"currency_symbol": "Fr",
@@ -1360,6 +1491,7 @@
]
},
"Malta": {
+ "code": "mt",
"currency": "MTL",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1371,6 +1503,7 @@
]
},
"Marshall Islands": {
+ "code": "mh",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -1381,12 +1514,14 @@
]
},
"Martinique": {
+ "code": "mq",
"number_format": "#,###.##",
"timezones": [
"America/Martinique"
]
},
"Mauritania": {
+ "code": "mr",
"currency": "MRO",
"currency_fraction": "Khoums",
"currency_fraction_units": 5,
@@ -1398,6 +1533,7 @@
]
},
"Mauritius": {
+ "code": "mu",
"currency": "MUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1409,12 +1545,14 @@
]
},
"Mayotte": {
+ "code": "yt",
"number_format": "#,###.##",
"timezones": [
"Indian/Mayotte"
]
},
"Mexico": {
+ "code": "mx",
"currency": "MXN",
"currency_fraction": "Centavo",
"currency_fraction_units": 100,
@@ -1437,14 +1575,17 @@
]
},
"Micronesia, Federated States of": {
+ "code": "fm",
"number_format": "#,###.##"
},
"Moldova, Republic of": {
+ "code": "md",
"currency": "MDL",
"currency_name": "Moldovan Leu",
"number_format": "#,###.##"
},
"Monaco": {
+ "code": "mc",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1455,6 +1596,7 @@
]
},
"Mongolia": {
+ "code": "mn",
"currency": "MNT",
"currency_fraction": "M\u00f6ng\u00f6",
"currency_fraction_units": 100,
@@ -1469,6 +1611,7 @@
]
},
"Montenegro": {
+ "code": "me",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1479,6 +1622,7 @@
]
},
"Montserrat": {
+ "code": "ms",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -1488,6 +1632,7 @@
]
},
"Morocco": {
+ "code": "ma",
"currency": "MAD",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
@@ -1499,6 +1644,7 @@
]
},
"Mozambique": {
+ "code": "mz",
"currency_fraction": "Centavo",
"currency_fraction_units": 100,
"currency_symbol": "MT",
@@ -1508,6 +1654,7 @@
]
},
"Myanmar": {
+ "code": "mm",
"currency": "MMK",
"currency_name": "Kyat",
"number_format": "#,###.##",
@@ -1516,6 +1663,7 @@
]
},
"Namibia": {
+ "code": "na",
"currency": "NAD",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1527,6 +1675,7 @@
]
},
"Nauru": {
+ "code": "nr",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -1536,6 +1685,7 @@
]
},
"Nepal": {
+ "code": "np",
"currency": "NPR",
"currency_fraction": "Paisa",
"currency_fraction_units": 100,
@@ -1548,6 +1698,7 @@
]
},
"Netherlands": {
+ "code": "nl",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1558,6 +1709,7 @@
]
},
"New Caledonia": {
+ "code": "nc",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
"currency_symbol": "Fr",
@@ -1567,6 +1719,7 @@
]
},
"New Zealand": {
+ "code": "nz",
"currency": "NZD",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1579,6 +1732,7 @@
]
},
"Nicaragua": {
+ "code": "ni",
"currency": "NIO",
"currency_fraction": "Centavo",
"currency_fraction_units": 100,
@@ -1590,6 +1744,7 @@
]
},
"Niger": {
+ "code": "ne",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
"currency_symbol": "Fr",
@@ -1599,6 +1754,7 @@
]
},
"Nigeria": {
+ "code": "ng",
"currency": "NGN",
"currency_fraction": "Kobo",
"currency_fraction_units": 100,
@@ -1610,6 +1766,7 @@
]
},
"Niue": {
+ "code": "nu",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -1619,18 +1776,21 @@
]
},
"Norfolk Island": {
+ "code": "nf",
"number_format": "#,###.##",
"timezones": [
"Pacific/Norfolk"
]
},
"Northern Mariana Islands": {
+ "code": "mp",
"number_format": "#,###.##",
"timezones": [
"Pacific/Saipan"
]
},
"Norway": {
+ "code": "no",
"currency": "NOK",
"currency_fraction": "\u00d8re",
"currency_fraction_units": 100,
@@ -1642,6 +1802,7 @@
]
},
"Oman": {
+ "code": "om",
"currency": "OMR",
"currency_fraction": "Baisa",
"currency_fraction_units": 1000,
@@ -1653,6 +1814,7 @@
]
},
"Pakistan": {
+ "code": "pk",
"currency": "PKR",
"currency_fraction": "Paisa",
"currency_fraction_units": 100,
@@ -1664,6 +1826,7 @@
]
},
"Palau": {
+ "code": "pw",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -1677,6 +1840,7 @@
"number_format": "#,###.##"
},
"Panama": {
+ "code": "pa",
"currency_fraction": "Cent\u00e9simo",
"currency_fraction_units": 100,
"currency_symbol": "B/.",
@@ -1686,6 +1850,7 @@
]
},
"Papua New Guinea": {
+ "code": "pg",
"currency": "PGK",
"currency_fraction": "Toea",
"currency_fraction_units": 100,
@@ -1697,6 +1862,7 @@
]
},
"Paraguay": {
+ "code": "py",
"currency": "PYG",
"currency_fraction": "C\u00e9ntimo",
"currency_fraction_units": 100,
@@ -1708,6 +1874,7 @@
]
},
"Peru": {
+ "code": "pe",
"currency": "PEN",
"currency_fraction": "C\u00e9ntimo",
"currency_fraction_units": 100,
@@ -1719,6 +1886,7 @@
]
},
"Philippines": {
+ "code": "ph",
"currency": "PHP",
"currency_fraction": "Centavo",
"currency_fraction_units": 100,
@@ -1731,12 +1899,14 @@
]
},
"Pitcairn": {
+ "code": "pn",
"number_format": "#,###.##",
"timezones": [
"Pacific/Pitcairn"
]
},
"Poland": {
+ "code": "pl",
"currency_fraction": "Grosz",
"currency_fraction_units": 100,
"currency_symbol": "z\u0142",
@@ -1746,6 +1916,7 @@
]
},
"Portugal": {
+ "code": "pt",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1758,12 +1929,14 @@
]
},
"Puerto Rico": {
+ "code": "pr",
"number_format": "#,###.##",
"timezones": [
"America/Puerto_Rico"
]
},
"Qatar": {
+ "code": "qa",
"currency": "QAR",
"currency_fraction": "Dirham",
"currency_fraction_units": 100,
@@ -1775,6 +1948,7 @@
]
},
"Romania": {
+ "code": "ro",
"currency_fraction": "Ban",
"currency_fraction_units": 100,
"currency_symbol": "L",
@@ -1784,11 +1958,13 @@
]
},
"Russian Federation": {
+ "code": "ru",
"currency": "RUB",
"currency_name": "Russian Ruble",
"number_format": "#.###,##"
},
"Rwanda": {
+ "code": "rw",
"currency": "RWF",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
@@ -1800,17 +1976,21 @@
]
},
"R\u00e9union": {
+ "code": "re",
"number_format": "#,###.##"
},
"Saint Barth\u00e9lemy": {
+ "code": "bl",
"number_format": "#,###.##"
},
"Saint Helena, Ascension and Tristan da Cunha": {
+ "code": "sh",
"currency": "SHP",
"currency_name": "Saint Helena Pound",
"number_format": "#,###.##"
},
"Saint Kitts and Nevis": {
+ "code": "kn",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -1820,6 +2000,7 @@
]
},
"Saint Lucia": {
+ "code": "lc",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -1829,12 +2010,15 @@
]
},
"Saint Martin (French part)": {
+ "code": "mf",
"number_format": "#,###.##"
},
"Saint Pierre and Miquelon": {
+ "code": "pm",
"number_format": "#,###.##"
},
"Saint Vincent and the Grenadines": {
+ "code": "vc",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -1844,6 +2028,7 @@
]
},
"Samoa": {
+ "code": "ws",
"currency": "WST",
"currency_fraction": "Sene",
"currency_fraction_units": 100,
@@ -1855,6 +2040,7 @@
]
},
"San Marino": {
+ "code": "sm",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1865,11 +2051,13 @@
]
},
"Sao Tome and Principe": {
+ "code": "st",
"currency": "STD",
"currency_name": "Dobra",
"number_format": "#,###.##"
},
"Saudi Arabia": {
+ "code": "sa",
"currency": "SAR",
"currency_fraction": "Halala",
"currency_fraction_units": 100,
@@ -1881,6 +2069,7 @@
]
},
"Senegal": {
+ "code": "sn",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
"currency_symbol": "Fr",
@@ -1890,6 +2079,7 @@
]
},
"Serbia": {
+ "code": "rs",
"currency_fraction": "Para",
"currency_fraction_units": 100,
"currency_symbol": "\u0434\u0438\u043d. or din.",
@@ -1899,6 +2089,7 @@
]
},
"Seychelles": {
+ "code": "sc",
"currency": "SCR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1910,6 +2101,7 @@
]
},
"Sierra Leone": {
+ "code": "sl",
"currency": "SLL",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1921,6 +2113,7 @@
]
},
"Singapore": {
+ "code": "sg",
"currency": "SGD",
"currency_fraction": "Sen",
"currency_fraction_units": 100,
@@ -1932,9 +2125,11 @@
]
},
"Sint Maarten (Dutch part)": {
+ "code": "sx",
"number_format": "#,###.##"
},
"Slovakia": {
+ "code": "sk",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1945,6 +2140,7 @@
]
},
"Slovenia": {
+ "code": "si",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1955,6 +2151,7 @@
]
},
"Solomon Islands": {
+ "code": "sb",
"currency": "SBD",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1966,6 +2163,7 @@
]
},
"Somalia": {
+ "code": "so",
"currency": "SOS",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1977,6 +2175,7 @@
]
},
"South Africa": {
+ "code": "za",
"currency": "ZAR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -1989,12 +2188,14 @@
]
},
"South Georgia and the South Sandwich Islands": {
+ "code": "gs",
"currency_fraction": "Penny",
"currency_fraction_units": 100,
"currency_symbol": "\u00a3",
"number_format": "#,###.##"
},
"South Sudan": {
+ "code": "ss",
"currency_fraction": "Piastre",
"currency_fraction_units": 100,
"currency_symbol": "\u00a3",
@@ -2004,6 +2205,7 @@
]
},
"Spain": {
+ "code": "es",
"currency": "EUR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -2016,6 +2218,7 @@
]
},
"Sri Lanka": {
+ "code": "lk",
"currency": "LKR",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -2027,6 +2230,7 @@
]
},
"Sudan": {
+ "code": "sd",
"currency_fraction": "Piastre",
"currency_fraction_units": 100,
"currency_symbol": "\u00a3",
@@ -2036,6 +2240,7 @@
]
},
"Suriname": {
+ "code": "sr",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -2045,9 +2250,11 @@
]
},
"Svalbard and Jan Mayen": {
+ "code": "sj",
"number_format": "#,###.##"
},
"Swaziland": {
+ "code": "sz",
"currency": "SZL",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -2059,6 +2266,7 @@
]
},
"Sweden": {
+ "code": "se",
"currency": "SEK",
"currency_fraction": "\u00d6re",
"currency_fraction_units": 100,
@@ -2070,6 +2278,7 @@
]
},
"Switzerland": {
+ "code": "ch",
"currency": "CHF",
"currency_fraction": "Rappen[K]",
"currency_fraction_units": 100,
@@ -2081,15 +2290,18 @@
]
},
"Syrian Arab Republic": {
+ "code": "sy",
"currency": "SYP",
"currency_name": "Syrian Pound",
"number_format": "#,###.##"
},
"Taiwan, Province of China": {
+ "code": "tw",
"date_format": "yyyy-mm-dd",
"number_format": "#,###.##"
},
"Tajikistan": {
+ "code": "tj",
"currency_fraction": "Diram",
"currency_fraction_units": 100,
"currency_symbol": "\u0405\u041c",
@@ -2099,11 +2311,13 @@
]
},
"Tanzania, United Republic of": {
+ "code": "tz",
"currency": "TZS",
"currency_name": "Tanzanian Shilling",
"number_format": "#,###.##"
},
"Thailand": {
+ "code": "th",
"currency": "THB",
"currency_fraction": "Satang",
"currency_fraction_units": 100,
@@ -2115,9 +2329,11 @@
]
},
"Timor-Leste": {
+ "code": "tl",
"number_format": "#,###.##"
},
"Togo": {
+ "code": "tg",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
"currency_symbol": "Fr",
@@ -2127,12 +2343,14 @@
]
},
"Tokelau": {
+ "code": "tk",
"number_format": "#,###.##",
"timezones": [
"Pacific/Fakaofo"
]
},
"Tonga": {
+ "code": "to",
"currency": "TOP",
"currency_fraction": "Seniti[L]",
"currency_fraction_units": 100,
@@ -2144,6 +2362,7 @@
]
},
"Trinidad and Tobago": {
+ "code": "tt",
"currency": "TTD",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -2155,6 +2374,7 @@
]
},
"Tunisia": {
+ "code": "tn",
"currency": "TND",
"currency_fraction": "Millime",
"currency_fraction_units": 1000,
@@ -2166,6 +2386,7 @@
]
},
"Turkey": {
+ "code": "tr",
"currency_fraction": "Kuru\u015f",
"currency_fraction_units": 100,
"currency_symbol": "",
@@ -2175,6 +2396,7 @@
]
},
"Turkmenistan": {
+ "code": "tm",
"currency": "TMM",
"currency_fraction": "Tennesi",
"currency_fraction_units": 100,
@@ -2186,12 +2408,14 @@
]
},
"Turks and Caicos Islands": {
+ "code": "tc",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
"number_format": "#,###.##"
},
"Tuvalu": {
+ "code": "tv",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
"currency_symbol": "$",
@@ -2201,6 +2425,7 @@
]
},
"Uganda": {
+ "code": "ug",
"currency": "UGX",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -2212,6 +2437,7 @@
]
},
"Ukraine": {
+ "code": "ua",
"currency_fraction": "Kopiyka",
"currency_fraction_units": 100,
"currency_symbol": "\u20b4",
@@ -2224,6 +2450,7 @@
]
},
"United Arab Emirates": {
+ "code": "ae",
"currency": "AED",
"currency_fraction": "Fils",
"currency_fraction_units": 100,
@@ -2235,6 +2462,7 @@
]
},
"United Kingdom": {
+ "code": "gb",
"currency": "GBP",
"currency_fraction": "Penny",
"currency_fraction_units": 100,
@@ -2246,6 +2474,7 @@
]
},
"United States": {
+ "code": "us",
"currency": "USD",
"currency_fraction": "Cent",
"currency_fraction_units": 100,
@@ -2287,9 +2516,11 @@
]
},
"United States Minor Outlying Islands": {
+ "code": "um",
"number_format": "#,###.##"
},
"Uruguay": {
+ "code": "uy",
"currency": "UYU",
"currency_fraction": "Cent\u00e9simo",
"currency_fraction_units": 100,
@@ -2301,6 +2532,7 @@
]
},
"Uzbekistan": {
+ "code": "uz",
"currency": "UZS",
"currency_fraction": "Tiyin",
"currency_fraction_units": 100,
@@ -2313,6 +2545,7 @@
]
},
"Vanuatu": {
+ "code": "vu",
"currency": "VUV",
"currency_fraction": "None",
"currency_fraction_units": 0,
@@ -2324,32 +2557,39 @@
]
},
"Venezuela, Bolivarian Republic of": {
+ "code": "ve",
"number_format": "#,###.##"
},
"Viet Nam": {
+ "code": "vn",
"currency": "VND",
"currency_name": "Dong",
"number_format": "#.###"
},
"Virgin Islands, British": {
+ "code": "vg",
"number_format": "#,###.##"
},
"Virgin Islands, U.S.": {
+ "code": "vi",
"number_format": "#,###.##"
},
"Wallis and Futuna": {
+ "code": "wf",
"currency_fraction": "Centime",
"currency_fraction_units": 100,
"currency_symbol": "Fr",
"number_format": "#,###.##"
},
"Western Sahara": {
+ "code": "eh",
"number_format": "#,###.##",
"timezones": [
"Africa/El_Aaiun"
]
},
"Yemen": {
+ "code": "ye",
"currency_fraction": "Fils",
"currency_fraction_units": 100,
"currency_symbol": "\ufdfc",
@@ -2359,6 +2599,7 @@
]
},
"Zambia": {
+ "code": "zm",
"currency": "ZMK",
"currency_fraction": "Ngwee",
"currency_fraction_units": 100,
@@ -2370,6 +2611,7 @@
]
},
"Zimbabwe": {
+ "code": "zw",
"currency": "ZWD",
"currency_fraction": "Thebe",
"currency_fraction_units": 100,
@@ -2381,6 +2623,7 @@
]
},
"\u00c5land Islands": {
+ "code": "ax",
"number_format": "#,###.##"
}
-}
+}
\ No newline at end of file
diff --git a/frappe/data/Framework.sql b/frappe/data/Framework.sql
index b4e2a53b9c..f6b04d5d26 100644
--- a/frappe/data/Framework.sql
+++ b/frappe/data/Framework.sql
@@ -26,6 +26,7 @@ CREATE TABLE `tabDocField` (
`options` text,
`search_index` int(1) DEFAULT NULL,
`hidden` int(1) DEFAULT NULL,
+ `set_only_once` int(1) DEFAULT NULL,
`print_hide` int(1) DEFAULT NULL,
`report_hide` int(1) DEFAULT NULL,
`reqd` int(1) DEFAULT NULL,
diff --git a/frappe/defaults.py b/frappe/defaults.py
index 121bfa5a98..36840da232 100644
--- a/frappe/defaults.py
+++ b/frappe/defaults.py
@@ -128,7 +128,8 @@ def clear_default(key=None, value=None, parent=None, name=None, parenttype=None)
if not conditions:
raise Exception, "[clear_default] No key specified."
- frappe.db.sql("""delete from tabDefaultValue where %s""" % " and ".join(conditions), values)
+ frappe.db.sql("""delete from tabDefaultValue where {0}""".format(" and ".join(conditions)),
+ tuple(values))
_clear_cache(parent)
def get_defaults_for(parent="Control Panel"):
diff --git a/frappe/exceptions.py b/frappe/exceptions.py
index ecd9957531..0bbc5a5825 100644
--- a/frappe/exceptions.py
+++ b/frappe/exceptions.py
@@ -33,3 +33,4 @@ class InvalidStatusError(ValidationError): pass
class MandatoryError(ValidationError): pass
class InvalidSignatureError(ValidationError): pass
class RateLimitExceededError(ValidationError): pass
+class CannotChangeConstantError(ValidationError): pass
diff --git a/frappe/model/__init__.py b/frappe/model/__init__.py
index 2c12cf3878..8cb982a164 100644
--- a/frappe/model/__init__.py
+++ b/frappe/model/__init__.py
@@ -70,9 +70,7 @@ def delete_fields(args_dict, delete=0):
# Delete the data / column only if delete is specified
if not delete: continue
- is_single = frappe.db.sql("select issingle from tabDocType where name = '%s'" % dt)
- is_single = is_single and frappe.utils.cint(is_single[0][0]) or 0
- if is_single:
+ if frappe.db.get_value("DocType", dt, "issingle"):
frappe.db.sql("""\
DELETE FROM `tabSingles`
WHERE doctype=%s AND field IN (%s)
diff --git a/frappe/model/bean.py b/frappe/model/bean.py
index d7f62f3d55..4b3df1d1fa 100644
--- a/frappe/model/bean.py
+++ b/frappe/model/bean.py
@@ -89,7 +89,7 @@ class Bean:
self.doclist = frappe.doclist(doclist)
self.doc = self.doclist[0]
- if self.doc.get_meta().issingle:
+ if self.doc.meta.issingle:
self.doc.cast_floats_and_ints()
if self.obj:
@@ -128,8 +128,8 @@ class Bean:
conflict = True
else:
tmp = frappe.db.sql("""select modified, docstatus from `tab%s`
- where name="%s" for update"""
- % (self.doc.doctype, self.doc.name), as_dict=True)
+ where name=%s for update"""
+ % (self.doc.doctype, '%s'), self.doc.name, as_dict=True)
if not tmp:
frappe.msgprint("""This record does not exist. Please refresh.""", raise_exception=1)
diff --git a/frappe/model/db_schema.py b/frappe/model/db_schema.py
index e1183f9270..cc7de99745 100644
--- a/frappe/model/db_schema.py
+++ b/frappe/model/db_schema.py
@@ -26,12 +26,12 @@ type_map = {
,'datetime': ('datetime', '')
,'time': ('time', '')
,'text': ('text', '')
- ,'data': ('varchar', '180')
- ,'link': ('varchar', '180')
- ,'password': ('varchar', '180')
- ,'select': ('varchar', '180')
- ,'read only': ('varchar', '180')
- ,'attach': ('varchar', '180')
+ ,'data': ('varchar', '255')
+ ,'link': ('varchar', '255')
+ ,'password': ('varchar', '255')
+ ,'select': ('varchar', '255')
+ ,'read only': ('varchar', '255')
+ ,'attach': ('varchar', '255')
}
default_columns = ['name', 'creation', 'modified', 'modified_by', 'owner', 'docstatus', 'parent',\
@@ -77,15 +77,15 @@ class DbTable:
# create table
frappe.db.sql("""create table `%s` (
- name varchar(120) not null primary key,
+ name varchar(255) not null primary key,
creation datetime,
modified datetime,
modified_by varchar(40),
- owner varchar(40),
+ owner varchar(60),
docstatus int(1) default '0',
- parent varchar(120),
- parentfield varchar(120),
- parenttype varchar(120),
+ parent varchar(255),
+ parentfield varchar(255),
+ parenttype varchar(255),
idx int(8),
%sindex parent(parent))
ENGINE=InnoDB
@@ -95,7 +95,7 @@ class DbTable:
"""
get columns from docfields and custom fields
"""
- fl = frappe.db.sql("SELECT * FROM tabDocField WHERE parent = '%s'" % self.doctype, as_dict = 1)
+ fl = frappe.db.sql("SELECT * FROM tabDocField WHERE parent = %s", self.doctype, as_dict = 1)
try:
custom_fl = frappe.db.sql("""\
@@ -185,13 +185,15 @@ class DbTable:
for col in self.add_index:
# if index key not exists
- if not frappe.db.sql("show index from `%s` where key_name = '%s'" % (self.name, col.fieldname)):
+ if not frappe.db.sql("show index from `%s` where key_name = %s" %
+ (self.name, '%s'), col.fieldname):
frappe.db.sql("alter table `%s` add index `%s`(`%s`)" % (self.name, col.fieldname, col.fieldname))
for col in self.drop_index:
if col.fieldname != 'name': # primary key
# if index key exists
- if frappe.db.sql("show index from `%s` where key_name = '%s'" % (self.name, col.fieldname)):
+ if frappe.db.sql("show index from `%s` where key_name = %s" %
+ (self.name, '%s'), col.fieldname):
frappe.db.sql("alter table `%s` drop index `%s`" % (self.name, col.fieldname))
for col in self.set_default:
diff --git a/frappe/model/delete_doc.py b/frappe/model/delete_doc.py
index db056a64ed..902837b33b 100644
--- a/frappe/model/delete_doc.py
+++ b/frappe/model/delete_doc.py
@@ -89,7 +89,7 @@ def check_if_doc_is_linked(dt, dn, method="Delete"):
item = frappe.db.get_value(link_dt, {link_field:dn},
["name", "parent", "parenttype", "docstatus"], as_dict=True)
- if item and item.parent != dn and (method=="Delete" or
+ if item and item.parent != dn and ((method=="Delete" and item.docstatus<2) or
(method=="Cancel" and item.docstatus==1)):
frappe.msgprint(method + " " + _("Error") + ":"+\
("%s (%s) " % (dn, dt)) + _("is linked in") + (" %s (%s)") %
diff --git a/frappe/model/doc.py b/frappe/model/doc.py
index 5fcb59c7f8..5e14fa376f 100755
--- a/frappe/model/doc.py
+++ b/frappe/model/doc.py
@@ -9,6 +9,7 @@ Contains the Document class representing an object / record
_toc = ["frappe.model.doc.Document"]
import frappe
+from frappe import _
import frappe.model.meta
from frappe.utils import *
@@ -131,7 +132,8 @@ class Document:
self._loadsingle()
else:
try:
- dataset = frappe.db.sql('select * from `tab%s` where name="%s"' % (self.doctype, self.name.replace('"', '\"')))
+ dataset = frappe.db.sql('select * from `tab%s` where name=%s' %
+ (self.doctype, "%s"), self.name)
except frappe.SQLError, e:
if e.args[0]==1146:
dataset = None
@@ -215,8 +217,6 @@ class Document:
def save(self, new=0, check_links=1, ignore_fields=0, make_autoname=1,
keep_timestamps=False):
- self.get_meta()
-
if new:
self.fields["__islocal"] = 1
@@ -228,7 +228,7 @@ class Document:
self.set_idx()
# if required, make new
- if not self._meta.issingle:
+ if not self.meta.issingle:
if self.is_new():
r = self._insert(make_autoname=make_autoname, keep_timestamps = keep_timestamps)
if r:
@@ -240,7 +240,7 @@ class Document:
# save the values
- self._update_values(self._meta.issingle,
+ self._update_values(self.meta.issingle,
check_links and self.make_link_list() or {}, ignore_fields=ignore_fields,
keep_timestamps=keep_timestamps)
self._clear_temp_fields()
@@ -249,7 +249,7 @@ class Document:
def _get_amended_name(self):
am_id = 1
am_prefix = self.amended_from
- if frappe.db.sql('select amended_from from `tab%s` where name = "%s"' % (self.doctype, self.amended_from))[0][0] or '':
+ if frappe.db.get_value(self.doctype, self.amended_from, "amended_from"):
am_id = cint(self.amended_from.split('-')[-1]) + 1
am_prefix = '-'.join(self.amended_from.split('-')[:-1]) # except the last hyphen
@@ -262,8 +262,7 @@ class Document:
self._new_name_set = True
- self.get_meta()
- autoname = self._meta.autoname
+ autoname = self.meta.autoname
self.localname = self.name
@@ -304,7 +303,7 @@ class Document:
self.name = self.fields['__newname']
# default name for table
- elif self._meta.istable:
+ elif self.meta.istable:
self.name = make_autoname('#########', self.doctype)
# unable to determine a name, use global series
@@ -341,7 +340,7 @@ class Document:
self.set_new_name()
# validate name
- self.name = validate_name(self.doctype, self.name, self._meta.name_case)
+ self.name = validate_name(self.doctype, self.name, self.meta.name_case)
# insert!
if not keep_timestamps:
@@ -362,7 +361,7 @@ class Document:
self.modified = now()
update_str, values = [], []
- frappe.db.sql("delete from tabSingles where doctype='%s'" % self.doctype)
+ frappe.db.sql("delete from tabSingles where doctype=%s", self.doctype)
for f in self.fields.keys():
if not (f in ('modified', 'doctype', 'name', 'perm', 'localname', 'creation'))\
and (not f.startswith('__')): # fields not saved
@@ -421,6 +420,7 @@ class Document:
return tmp and tmp[0][0] or ''# match case
def _update_values(self, issingle, link_list, ignore_fields=0, keep_timestamps=False):
+ self.validate_constants()
if issingle:
self._update_single(link_list)
else:
@@ -457,12 +457,10 @@ class Document:
if getattr(frappe.local, "valid_fields_map", None) is None:
frappe.local.valid_fields_map = {}
- self.get_meta()
-
valid_fields_map = frappe.local.valid_fields_map
if not valid_fields_map.get(self.doctype):
- if cint( self._meta.issingle):
+ if cint(self.meta.issingle):
doctypelist = frappe.model.doctype.get(self.doctype)
valid_fields_map[self.doctype] = doctypelist.get_fieldnames({
"fieldtype": ["not in", frappe.model.no_value_fields]})
@@ -472,12 +470,27 @@ class Document:
return valid_fields_map.get(self.doctype)
- def get_meta(self):
+ def validate_constants(self):
+ if frappe.flags.in_import:
+ return
+
+ meta = frappe.get_doctype(self.doctype)
+ constants = [d.fieldname for d in meta.get({"set_only_once": 1})]
+ if constants:
+ values = frappe.db.get_value(self.doctype, self.name, constants, as_dict=True)
+
+ for fieldname in constants:
+ if self.fields.get(fieldname) != values.get(fieldname):
+ frappe.throw("{0}: {1}".format(_("Value cannot be changed for"),
+ _(meta.get_field(fieldname).label)), frappe.CannotChangeConstantError)
+
+ @property
+ def meta(self):
if not self._meta:
- self._meta = frappe.db.get_value("DocType", self.doctype, ["autoname", "issingle",
- "istable", "name_case"], as_dict=True) or frappe._dict()
+ self._meta = frappe.db.get_value("DocType", self.doctype, "*", as_dict=True) \
+ or frappe._dict()
+
return self._meta
-
def update_parentinfo(self):
"""update parent type and parent field, if not explicitly specified"""
@@ -748,11 +761,6 @@ def validate_name(doctype, name, case=None, merge=False):
name = name.strip() # no leading and trailing blanks
- forbidden = ['%', "'", '"', '#', '*', '?', '`']
- for f in forbidden:
- if f in name:
- frappe.msgprint('%s not allowed in ID (name)' % f, raise_exception =1)
-
return name
def get_default_naming_series(doctype):
diff --git a/frappe/model/meta.py b/frappe/model/meta.py
index b74126353e..1668c49948 100644
--- a/frappe/model/meta.py
+++ b/frappe/model/meta.py
@@ -15,8 +15,8 @@ def is_single(doctype):
def get_parent_dt(dt):
parent_dt = frappe.db.sql("""select parent from tabDocField
- where fieldtype="Table" and options="%s" and (parent not like "old_parent:%%")
- limit 1""" % dt)
+ where fieldtype="Table" and options=%s and (parent not like "old_parent:%%")
+ limit 1""", dt)
return parent_dt and parent_dt[0][0] or ''
def set_fieldname(field_id, fieldname):
@@ -40,12 +40,12 @@ def get_link_fields(doctype):
]
def get_table_fields(doctype):
- child_tables = [[d[0], d[1]] for d in frappe.db.sql("select options, fieldname from tabDocField \
- where parent='%s' and fieldtype='Table'" % doctype, as_list=1)]
+ child_tables = [[d[0], d[1]] for d in frappe.db.sql("""select options, fieldname
+ from tabDocField where parent=%s and fieldtype='Table'""", doctype, as_list=1)]
try:
- custom_child_tables = [[d[0], d[1]] for d in frappe.db.sql("select options, fieldname from `tabCustom Field` \
- where dt='%s' and fieldtype='Table'" % doctype, as_list=1)]
+ custom_child_tables = [[d[0], d[1]] for d in frappe.db.sql("""select options, fieldname
+ from `tabCustom Field` where dt=%s and fieldtype='Table'""", doctype, as_list=1)]
except Exception, e:
if e.args[0]!=1146:
raise
diff --git a/frappe/patches.txt b/frappe/patches.txt
index 1455d35e14..655217e402 100644
--- a/frappe/patches.txt
+++ b/frappe/patches.txt
@@ -1,7 +1,7 @@
execute:import inlinestyler # new requirement
execute:frappe.reload_doc('core', 'doctype', 'doctype', force=True) #2014-01-24
-execute:frappe.reload_doc('core', 'doctype', 'docfield', force=True) #2013-13-26
+execute:frappe.reload_doc('core', 'doctype', 'docfield', force=True) #2014-03-01
execute:frappe.reload_doc('core', 'doctype', 'docperm') #2013-13-26
execute:frappe.reload_doc('core', 'doctype', 'page') #2013-13-26
execute:frappe.reload_doc('core', 'doctype', 'report') #2013-13-26
@@ -21,4 +21,4 @@ execute:import frappe.installer;frappe.installer.make_site_dirs() #2014-02-19
frappe.patches.4_0.private_backups
frappe.patches.4_0.set_module_in_report
frappe.patches.4_0.remove_old_parent
-frappe.patches.4_0.rename_profile_to_user
\ No newline at end of file
+frappe.patches.4_0.rename_profile_to_user
diff --git a/frappe/public/js/frappe/model/perm.js b/frappe/public/js/frappe/model/perm.js
index 47e28d7cbf..ea28d22459 100644
--- a/frappe/public/js/frappe/model/perm.js
+++ b/frappe/public/js/frappe/model/perm.js
@@ -190,6 +190,11 @@ $.extend(frappe.perm, {
}
if(explain) console.log("By Read Only:" + status);
+ if(status==="Write" && df.set_only_once && !doc.__islocal) {
+ status = "Read";
+ }
+ if(explain) console.log("By Set Only Once:" + status);
+
return status;
},
});
\ No newline at end of file
diff --git a/frappe/public/js/frappe/views/grid_report.js b/frappe/public/js/frappe/views/grid_report.js
index e1e135864e..e471d240d2 100644
--- a/frappe/public/js/frappe/views/grid_report.js
+++ b/frappe/public/js/frappe/views/grid_report.js
@@ -589,6 +589,7 @@ frappe.views.GridReport = Class.extend({
var date_diff = dateutil.get_diff(this.to_date, this.from_date);
me.column_map = {};
+ me.last_date = null;
var add_column = function(date) {
me.columns.push({
diff --git a/frappe/sessions.py b/frappe/sessions.py
index 0299fee32b..668926db14 100644
--- a/frappe/sessions.py
+++ b/frappe/sessions.py
@@ -133,8 +133,8 @@ class Session:
self.insert_session_record()
# update user
- frappe.db.sql("""UPDATE tabUser SET last_login = '%s', last_ip = '%s'
- where name='%s'""" % (frappe.utils.now(), frappe.get_request_header('REMOTE_ADDR'), self.data['user']))
+ frappe.db.sql("""UPDATE tabUser SET last_login = %s, last_ip = %s
+ where name=%s""", (frappe.utils.now(), frappe.get_request_header('REMOTE_ADDR'), self.data['user']))
frappe.db.commit()
def insert_session_record(self):
diff --git a/frappe/utils/nestedset.py b/frappe/utils/nestedset.py
index 58697b36ab..693f2da911 100644
--- a/frappe/utils/nestedset.py
+++ b/frappe/utils/nestedset.py
@@ -70,19 +70,23 @@ def update_add_node(doc, parent, parent_field):
% (doctype, "%s"), parent)[0]
validate_loop(doc.doctype, doc.name, left, right)
else: # root
- right = frappe.db.sql("select ifnull(max(rgt),0)+1 from `tab%s` where ifnull(`%s`,'') =''" % (doctype, parent_field))[0][0]
+ right = frappe.db.sql("select ifnull(max(rgt),0)+1 from `tab%s` \
+ where ifnull(`%s`,'') =''" % (doctype, parent_field))[0][0]
right = right or 1
# update all on the right
- frappe.db.sql("update `tab%s` set rgt = rgt+2, modified='%s' where rgt >= %s" %(doctype,n,right))
- frappe.db.sql("update `tab%s` set lft = lft+2, modified='%s' where lft >= %s" %(doctype,n,right))
+ frappe.db.sql("update `tab%s` set rgt = rgt+2, modified=%s where rgt >= %s" %
+ (doctype, '%s', '%s'), (n, right))
+ frappe.db.sql("update `tab%s` set lft = lft+2, modified=%s where lft >= %s" %
+ (doctype, '%s', '%s'), (n, right))
# update index of new node
if frappe.db.sql("select * from `tab%s` where lft=%s or rgt=%s"% (doctype, right, right+1)):
frappe.msgprint("Nested set error. Please send mail to support")
raise Exception
- frappe.db.sql("update `tab%s` set lft=%s, rgt=%s, modified='%s' where name='%s'" % (doctype,right,right+1,n,name))
+ frappe.db.sql("update `tab{0}` set lft=%s, rgt=%s, modified=%s where name=%s".format(doctype),
+ (right,right+1,n,name))
return right
@@ -164,13 +168,15 @@ def rebuild_node(doctype, parent, left, parent_field):
right = left+1
# get all children of this node
- result = frappe.db.sql("SELECT name FROM `tab%s` WHERE `%s`='%s'" % (doctype, parent_field, parent))
+ result = frappe.db.sql("SELECT name FROM `tab%s` WHERE `%s`=%s" %
+ (doctype, parent_field, '%s'), (parent))
for r in result:
right = rebuild_node(doctype, r[0], right, parent_field)
# we've got the left value, and now that we've processed
# the children of this node we also know the right value
- frappe.db.sql("UPDATE `tab%s` SET lft=%s, rgt=%s, modified='%s' WHERE name='%s'" % (doctype,left,right,n,parent))
+ frappe.db.sql("""UPDATE `tab{0}` SET lft=%s, rgt=%s, modified=%s
+ WHERE name=%s""".format(doctype), (left,right,n,parent))
#return the right value of this node + 1
return right+1
diff --git a/frappe/website/doctype/blog_post/test_blog_post.py b/frappe/website/doctype/blog_post/test_blog_post.py
index 58f878e7c6..ac42ccb289 100644
--- a/frappe/website/doctype/blog_post/test_blog_post.py
+++ b/frappe/website/doctype/blog_post/test_blog_post.py
@@ -161,3 +161,12 @@ class TestBlogPost(unittest.TestCase):
bean = frappe.bean("Blog Post", "_test-blog-post-1")
self.assertTrue(bean.has_read_perm())
+
+ def test_set_only_once(self):
+ blog_post = frappe.get_doctype("Blog Post")
+ blog_post.get_field("title").set_only_once = 1
+ bean = frappe.bean("Blog Post", "_test-blog-post-1")
+ bean.doc.title = "New"
+ self.assertRaises(frappe.CannotChangeConstantError, bean.save)
+ blog_post.get_field("title").set_only_once = 0
+
diff --git a/frappe/widgets/event.py b/frappe/widgets/event.py
index 2ec135cbcd..5239846ef4 100644
--- a/frappe/widgets/event.py
+++ b/frappe/widgets/event.py
@@ -11,19 +11,30 @@ def get_cal_events(m_st, m_end):
import frappe.model.doc
# load owned events
- res1 = frappe.db.sql("select name from `tabEvent` WHERE ifnull(event_date,'2000-01-01') between '%s' and '%s' and owner = '%s' and event_type != 'Public' and event_type != 'Cancel'" % (m_st, m_end, frappe.user.name))
+ res1 = frappe.db.sql("""select name from `tabEvent`
+ WHERE ifnull(event_date,'2000-01-01') between %s and %s and owner = %s
+ and event_type != 'Public' and event_type != 'Cancel'""",
+ (m_st, m_end, frappe.user.name))
# load individual events
- res2 = frappe.db.sql("select t1.name from `tabEvent` t1, `tabEvent User` t2 where ifnull(t1.event_date,'2000-01-01') between '%s' and '%s' and t2.person = '%s' and t1.name = t2.parent and t1.event_type != 'Cancel'" % (m_st, m_end, frappe.user.name))
+ res2 = frappe.db.sql("""select t1.name from `tabEvent` t1, `tabEvent User` t2
+ where ifnull(t1.event_date,'2000-01-01') between %s and %s and t2.person = %s
+ and t1.name = t2.parent and t1.event_type != 'Cancel'""",
+ (m_st, m_end, frappe.user.name))
# load role events
roles = frappe.user.get_roles()
- myroles = ['t2.role = "%s"' % r for r in roles]
+ myroles = ['t2.role = "%s"' % r.replace('"', '\"') for r in roles]
myroles = '(' + (' OR '.join(myroles)) + ')'
- res3 = frappe.db.sql("select t1.name from `tabEvent` t1, `tabEvent Role` t2 where ifnull(t1.event_date,'2000-01-01') between '%s' and '%s' and t1.name = t2.parent and t1.event_type != 'Cancel' and %s" % (m_st, m_end, myroles))
+ res3 = frappe.db.sql("""select t1.name from `tabEvent` t1, `tabEvent Role` t2
+ where ifnull(t1.event_date,'2000-01-01') between %s and %s
+ and t1.name = t2.parent and t1.event_type != 'Cancel' and %s""" %
+ ('%s', '%s', myroles), (m_st, m_end))
# load public events
- res4 = frappe.db.sql("select name from `tabEvent` where ifnull(event_date,'2000-01-01') between '%s' and '%s' and event_type='Public'" % (m_st, m_end))
+ res4 = frappe.db.sql("select name from `tabEvent` \
+ where ifnull(event_date,'2000-01-01') between %s and %s and event_type='Public'",
+ (m_st, m_end))
doclist, rl = [], []
for r in res1 + res2 + res3 + res4:
diff --git a/frappe/widgets/query_builder.py b/frappe/widgets/query_builder.py
index 44f2303f56..48da6a5908 100644
--- a/frappe/widgets/query_builder.py
+++ b/frappe/widgets/query_builder.py
@@ -20,7 +20,7 @@ def get_sql_tables(q):
def get_parent_dt(dt):
pdt = ''
- if frappe.db.sql('select name from `tabDocType` where istable=1 and name="%s"' % dt):
+ if frappe.db.sql('select name from `tabDocType` where istable=1 and name=%s', dt):
import frappe.model.meta
return frappe.model.meta.get_parent_dt(dt)
return pdt
@@ -44,7 +44,8 @@ def get_sql_meta(tl):
meta[dt]['parent'] = ('ID', 'Link', pdt, '200')
# get the field properties from DocField
- res = frappe.db.sql("select fieldname, label, fieldtype, options, width from tabDocField where parent='%s'" % dt)
+ res = frappe.db.sql("select fieldname, label, fieldtype, options, width \
+ from tabDocField where parent=%s", dt)
for r in res:
if r[0]:
meta[dt][r[0]] = (r[1], r[2], r[3], r[4]);