Merge pull request #591 from anandpdoshi/hotfix

Fix to momentjs timezone database
This commit is contained in:
Anand Doshi 2014-06-06 23:53:51 +05:30
commit 376a488fc0
9 changed files with 7796 additions and 7672 deletions

View file

@ -44,14 +44,6 @@
"role": "Administrator",
"submit": 0,
"write": 1
},
{
"create": 1,
"delete": 1,
"permlevel": 0,
"read": 1,
"role": "System Manager",
"write": 1
}
]
}

View file

@ -8,13 +8,16 @@ from frappe.model.document import Document
class ModuleDef(Document):
def validate(self):
if not frappe.conf.get("developer_mode"):
return
modules = None
if not frappe.local.module_app.get(self.name):
if not frappe.local.module_app.get(frappe.scrub(self.name)):
with open(frappe.get_app_path(self.app_name, "modules.txt"), "r") as f:
content = f.read()
if not frappe.scrub(self.name) in content.splitlines():
if not self.name in content.splitlines():
modules = filter(None, content.splitlines())
modules.append(frappe.scrub(self.name))
modules.append(self.name)
if modules:
with open(frappe.get_app_path(self.app_name, "modules.txt"), "w") as f:

View file

@ -2,11 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, pytz
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.translate import get_lang_dict, set_default_language
from frappe.utils import cint
from frappe.utils.momentjs import get_all_timezones
class SystemSettings(Document):
def validate(self):
@ -39,7 +40,7 @@ def load():
languages.sort()
return {
"timezones": pytz.all_timezones,
"timezones": get_all_timezones(),
"languages": [""] + languages,
"defaults": defaults
}

File diff suppressed because it is too large Load diff

View file

@ -5,6 +5,7 @@
from __future__ import unicode_literals
import os, json, frappe
from frappe.utils.momentjs import get_all_timezones
def get_country_info(country=None):
data = get_all()
@ -21,10 +22,9 @@ def get_all():
@frappe.whitelist()
def get_country_timezone_info():
import pytz
return {
"country_info": get_all(),
"all_timezones": pytz.all_timezones
"all_timezones": get_all_timezones()
}
def update():

View file

@ -34,3 +34,4 @@ frappe.patches.v4_0.set_user_permissions
frappe.patches.v4_0.create_custom_field_for_owner_match
frappe.patches.v4_0.enable_scheduler_in_system_settings
execute:frappe.db.sql("update tabReport set apply_user_permissions=1") #2014-06-03
frappe.patches.v4_0.replace_deprecated_timezones

View file

@ -0,0 +1,18 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils.momentjs import data as momentjs_data
def execute():
ss = frappe.get_doc("System Settings", "System Settings")
if ss.time_zone in momentjs_data.get("links"):
ss.time_zone = momentjs_data["links"][ss.time_zone]
ss.save()
for user, time_zone in frappe.db.sql("select name, time_zone from `tabUser` where ifnull(time_zone, '')!=''"):
if time_zone in momentjs_data.get("links"):
user = frappe.get_doc("User", user)
user.time_zone = momentjs_data["links"][user.time_zone]
user.save()

View file

@ -2,7 +2,7 @@ function prettyDate(time){
if(moment) {
var user_timezone = frappe.boot.user.time_zone;
var system_timezone = sys_defaults.time_zone;
var zones = frappe.boot.timezone_info.zones;
var zones = (frappe.boot.timezone_info || {}).zones || {};
if (user_timezone && (user_timezone != system_timezone)
&& zones[user_timezone] && zones[system_timezone]) {
return moment.tz(time, sys_defaults.time_zone).tz(frappe.boot.user.time_zone).fromNow();

File diff suppressed because it is too large Load diff