mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 19:29:10 +00:00
timestamps, comments
This commit is contained in:
@@ -2,7 +2,6 @@ import webnotes
|
||||
|
||||
from webnotes.utils import load_json, cint, nowdate
|
||||
|
||||
|
||||
def change_password(arg):
|
||||
"""
|
||||
Change password
|
||||
@@ -21,15 +20,40 @@ def change_password(arg):
|
||||
webnotes.msgprint('Password Updated');
|
||||
|
||||
def get_user_details(arg=None):
|
||||
"Returns user first name, last name and bio"
|
||||
|
||||
"""
|
||||
Returns user first name, last name and bio
|
||||
"""
|
||||
return webnotes.conn.sql("select first_name, last_name, bio from tabProfile where name=%s", webnotes.user.name, as_dict=1)[0]
|
||||
|
||||
def set_user_details(arg=None):
|
||||
"updates user details given in argument"
|
||||
"""
|
||||
updates user details given in argument
|
||||
"""
|
||||
from webnotes.model.doc import Document
|
||||
|
||||
p = Document('Profile', webnotes.user.name)
|
||||
p.fields.update(load_json(arg))
|
||||
p.save()
|
||||
webnotes.msgprint('Updated')
|
||||
|
||||
def set_user_image(arg=None):
|
||||
"""
|
||||
Set uploaded image as user image
|
||||
"""
|
||||
from webnotes.utils.upload_handler import UploadHandler
|
||||
|
||||
uh = UploadHandler()
|
||||
if not uh.file_name:
|
||||
# do nothing - no file found
|
||||
return
|
||||
else:
|
||||
# save the file
|
||||
from webnotes.utils.file_manager import FileAttachments
|
||||
|
||||
fa = FileAttachments('Profile', webnotes.session['user'])
|
||||
fa.delete_all()
|
||||
fa.add(uh.file_name, uh.content)
|
||||
fa.save()
|
||||
|
||||
uh.set_callback('window.parent.upload_callback("%s", "%s")' \
|
||||
% (webnotes.form_dict['uploader_id'], fa.get_fid(0)))
|
||||
Reference in New Issue
Block a user