@@ -74,6 +74,15 @@ | |||
"oldfieldtype": "Data", | |||
"permlevel": 0 | |||
}, | |||
{ | |||
"default": "1", | |||
"depends_on": "eval:doc.__islocal", | |||
"fieldname": "send_welcome_email", | |||
"fieldtype": "Check", | |||
"label": "Send Welcome Email", | |||
"permlevel": 0, | |||
"precision": "" | |||
}, | |||
{ | |||
"fieldname": "unsubscribed", | |||
"fieldtype": "Check", | |||
@@ -464,7 +473,7 @@ | |||
"issingle": 0, | |||
"istable": 0, | |||
"max_attachments": 5, | |||
"modified": "2015-03-24 17:56:43.743847", | |||
"modified": "2015-04-24 14:37:26.430454", | |||
"modified_by": "Administrator", | |||
"module": "Core", | |||
"name": "User", | |||
@@ -110,8 +110,8 @@ class User(Document): | |||
# new password given, no email required | |||
_update_password(self.name, new_password) | |||
if not self.flags.no_welcome_mail: | |||
self.send_welcome_mail() | |||
if not self.flags.no_welcome_mail and self.send_welcome_email: | |||
self.send_welcome_mail_to_user() | |||
msgprint(_("Welcome email sent")) | |||
return | |||
else: | |||
@@ -155,7 +155,7 @@ class User(Document): | |||
def password_update_mail(self, password): | |||
self.send_login_mail(_("Password Update"), "templates/emails/password_update.html", {"new_password": password}) | |||
def send_welcome_mail(self): | |||
def send_welcome_mail_to_user(self): | |||
from frappe.utils import random_string, get_url | |||
key = random_string(32) | |||
@@ -1,20 +1,30 @@ | |||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors | |||
// MIT License. See license.txt | |||
frappe.ui.form.on("Event", "refresh", function(frm) { | |||
if(frm.doc.ref_type && frm.doc.ref_name) { | |||
frm.add_custom_button(__(frm.doc.ref_name), function() { | |||
frappe.set_route("Form", frm.doc.ref_type, frm.doc.ref_name); | |||
}, frappe.boot.doctype_icons[frm.doc.ref_type]); | |||
frappe.ui.form.on("Event", { | |||
onload: function(frm) { | |||
frm.set_query("ref_type", function(txt) { | |||
return { | |||
"filters": { | |||
"issingle": 0, | |||
} | |||
}; | |||
}); | |||
}, | |||
refresh: function(frm) { | |||
if(frm.doc.ref_type && frm.doc.ref_name) { | |||
frm.add_custom_button(__(frm.doc.ref_name), function() { | |||
frappe.set_route("Form", frm.doc.ref_type, frm.doc.ref_name); | |||
}, frappe.boot.doctype_icons[frm.doc.ref_type]); | |||
} | |||
}, | |||
repeat_on: function(frm) { | |||
if(frm.doc.repeat_on==="Every Day") { | |||
$.each(["monday", "tuesday", "wednesday", "thursday", "friday", | |||
"saturday", "sunday"], function(i,v) { | |||
frm.set_value(v, 1); | |||
}); | |||
} | |||
} | |||
}); | |||
cur_frm.cscript.repeat_on = function(doc, cdt, cdn) { | |||
if(doc.repeat_on==="Every Day") { | |||
$.each(["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], function(i,v) { | |||
cur_frm.set_value(v, 1); | |||
}) | |||
} | |||
} | |||
@@ -1,26 +1,37 @@ | |||
// bind events | |||
frappe.ui.form.on("ToDo", "refresh", function(frm) { | |||
if(frm.doc.reference_type && frm.doc.reference_name) { | |||
frm.add_custom_button(__(frm.doc.reference_name), function() { | |||
frappe.set_route("Form", frm.doc.reference_type, frm.doc.reference_name); | |||
}, frappe.boot.doctype_icons[frm.doc.reference_type]); | |||
} | |||
frappe.ui.form.on("ToDo", { | |||
onload: function(frm) { | |||
frm.set_query("reference_type", function(txt) { | |||
return { | |||
"filters": { | |||
"issingle": 0, | |||
} | |||
}; | |||
}); | |||
}, | |||
refresh: function(frm) { | |||
if(frm.doc.reference_type && frm.doc.reference_name) { | |||
frm.add_custom_button(__(frm.doc.reference_name), function() { | |||
frappe.set_route("Form", frm.doc.reference_type, frm.doc.reference_name); | |||
}, frappe.boot.doctype_icons[frm.doc.reference_type]); | |||
} | |||
if (!frm.doc.__islocal) { | |||
if(frm.doc.status=="Open") { | |||
frm.add_custom_button(__("Close"), function() { | |||
frm.set_value("status", "Closed"); | |||
frm.save(null, function() { | |||
// back to list | |||
frappe.set_route("List", "ToDo"); | |||
}); | |||
}, "icon-ok", "btn-success"); | |||
} else { | |||
frm.add_custom_button(__("Re-open"), function() { | |||
frm.set_value("status", "Open"); | |||
frm.save(); | |||
}, null, "btn-default"); | |||
if (!frm.doc.__islocal) { | |||
if(frm.doc.status=="Open") { | |||
frm.add_custom_button(__("Close"), function() { | |||
frm.set_value("status", "Closed"); | |||
frm.save(null, function() { | |||
// back to list | |||
frappe.set_route("List", "ToDo"); | |||
}); | |||
}, "icon-ok", "btn-success"); | |||
} else { | |||
frm.add_custom_button(__("Re-open"), function() { | |||
frm.set_value("status", "Open"); | |||
frm.save(); | |||
}, null, "btn-default"); | |||
} | |||
} | |||
} | |||
}); |
@@ -67,11 +67,13 @@ def add(args=None): | |||
def remove(doctype, name, assign_to): | |||
"""remove from todo""" | |||
try: | |||
todo = frappe.get_doc("ToDo", {"reference_type":doctype, "reference_name":name, "owner":assign_to, "status":"Open"}) | |||
todo.status = "Closed" | |||
todo.save(ignore_permissions=True) | |||
todo = frappe.db.get_value("ToDo", {"reference_type":doctype, "reference_name":name, "owner":assign_to, "status":"Open"}) | |||
if todo: | |||
todo = frappe.get_doc("ToDo", todo) | |||
todo.status = "Closed" | |||
todo.save(ignore_permissions=True) | |||
notify_assignment(todo.assigned_by, todo.owner, todo.reference_type, todo.reference_name) | |||
notify_assignment(todo.assigned_by, todo.owner, todo.reference_type, todo.reference_name) | |||
except frappe.DoesNotExistError: | |||
pass | |||