mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 03:29:16 +00:00
First Name and Last Name in setup account dialog box
This commit is contained in:
@@ -585,6 +585,7 @@ HomeStatusBar = function() {
|
|||||||
this.wrapper.innerHTML = '';
|
this.wrapper.innerHTML = '';
|
||||||
this.profile_settings = $a($a(this.wrapper, 'p'), 'span', 'link_type', {fontWeight:'bold'});
|
this.profile_settings = $a($a(this.wrapper, 'p'), 'span', 'link_type', {fontWeight:'bold'});
|
||||||
this.profile_settings.innerHTML = user_fullname + ' (Profile Settings)';
|
this.profile_settings.innerHTML = user_fullname + ' (Profile Settings)';
|
||||||
|
this.profile_settings.id = "user_fullname";
|
||||||
this.profile_settings.onclick = function() { loadpage('profile-settings'); }
|
this.profile_settings.onclick = function() { loadpage('profile-settings'); }
|
||||||
|
|
||||||
this.span = $a($a(this.wrapper, 'p'), 'span', 'link_type', {fontWeight:'bold'});
|
this.span = $a($a(this.wrapper, 'p'), 'span', 'link_type', {fontWeight:'bold'});
|
||||||
@@ -614,7 +615,7 @@ pscript.home_make_status = function() {
|
|||||||
|
|
||||||
// complete registration
|
// complete registration
|
||||||
if(in_list(user_roles,'System Manager')) {
|
if(in_list(user_roles,'System Manager')) {
|
||||||
pscript.complete_registration(r.message.registration_complete);
|
pscript.complete_registration(r.message.registration_complete, r.message.profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup wizard
|
// setup wizard
|
||||||
@@ -627,15 +628,19 @@ pscript.home_make_status = function() {
|
|||||||
|
|
||||||
// complete my company registration
|
// complete my company registration
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
pscript.complete_registration = function(is_complete) {
|
pscript.complete_registration = function(is_complete, profile) {
|
||||||
if(is_complete == 'No'){
|
if(is_complete == 'No'){
|
||||||
var d = new Dialog(400, 200, "Please Complete Your Registration");
|
var d = new Dialog(400, 200, "Setup your Account");
|
||||||
if(user != 'Administrator'){
|
if(user != 'Administrator'){
|
||||||
d.no_cancel(); // Hide close image
|
d.no_cancel(); // Hide close image
|
||||||
$dh(page_body.wntoolbar.wrapper);
|
$dh(page_body.wntoolbar.wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
d.make_body([
|
d.make_body([
|
||||||
|
['HTML', 'Your Profile Details', '<h4>Your Profile Details</h4>'],
|
||||||
|
['Data', 'First Name'],
|
||||||
|
['Data', 'Last Name'],
|
||||||
|
['HTML', 'Company Details', '<h4>Create your first company</h4>'],
|
||||||
['Data','Company Name','Example: Your Company LLC'],
|
['Data','Company Name','Example: Your Company LLC'],
|
||||||
['Data','Company Abbreviation', 'Example: YC (all your acconts will have this as a suffix)'],
|
['Data','Company Abbreviation', 'Example: YC (all your acconts will have this as a suffix)'],
|
||||||
['Select','Fiscal Year Start Date'],
|
['Select','Fiscal Year Start Date'],
|
||||||
@@ -649,7 +654,16 @@ pscript.complete_registration = function(is_complete) {
|
|||||||
d.widgets['Company Name'].value = locals['Control Panel']['Control Panel'].company_name;
|
d.widgets['Company Name'].value = locals['Control Panel']['Control Panel'].company_name;
|
||||||
d.widgets['Company Name'].disabled = 1;
|
d.widgets['Company Name'].disabled = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(profile && profile.length>0) {
|
||||||
|
if(profile[0].first_name && profile[0].first_name!='None') {
|
||||||
|
d.widgets['First Name'].value = profile[0].first_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(profile[0].last_name && profile[0].last_name!='None') {
|
||||||
|
d.widgets['Last Name'].value = profile[0].last_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//d.widgets['Save'].disabled = true; // disable Save button
|
//d.widgets['Save'].disabled = true; // disable Save button
|
||||||
pscript.make_dialog_field(d);
|
pscript.make_dialog_field(d);
|
||||||
@@ -666,14 +680,20 @@ pscript.complete_registration = function(is_complete) {
|
|||||||
d.widgets['Company Name'].value,
|
d.widgets['Company Name'].value,
|
||||||
d.widgets['Company Abbreviation'].value,
|
d.widgets['Company Abbreviation'].value,
|
||||||
d.widgets['Fiscal Year Start Date'].value,
|
d.widgets['Fiscal Year Start Date'].value,
|
||||||
d.widgets['Default Currency'].value
|
d.widgets['Default Currency'].value,
|
||||||
|
d.widgets['First Name'].value,
|
||||||
|
d.widgets['Last Name'].value
|
||||||
];
|
];
|
||||||
|
|
||||||
$c_obj('Setup Control','setup_account',JSON.stringify(args),function(r, rt){
|
$c_obj('Setup Control','setup_account',JSON.stringify(args),function(r, rt){
|
||||||
sys_defaults = r.message;
|
sys_defaults = r.message.sys_defaults;
|
||||||
|
user_fullname = r.message.user_fullname;
|
||||||
d.hide();
|
d.hide();
|
||||||
$ds(page_body.wntoolbar.wrapper);
|
$ds(page_body.wntoolbar.wrapper);
|
||||||
|
$('#user_fullname').html(user_fullname + " (Profile Settings)");
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
d.widgets['Save'].done_working();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d.show();
|
d.show();
|
||||||
@@ -699,12 +719,12 @@ pscript.make_dialog_field = function(d)
|
|||||||
// ---------------
|
// ---------------
|
||||||
pscript.validate_fields = function(d)
|
pscript.validate_fields = function(d)
|
||||||
{
|
{
|
||||||
var lst = ['Company Abbreviation', 'Fiscal Year Start Date', 'Default Currency'];
|
var lst = ['First Name', 'Company Name', 'Company Abbreviation', 'Fiscal Year Start Date', 'Default Currency'];
|
||||||
var msg = 'Please enter the following fields';
|
var msg = 'Please enter the following fields\n';
|
||||||
var flag = 1;
|
var flag = 1;
|
||||||
for(var i=0; i<lst.length; i++)
|
for(var i=0; i<lst.length; i++)
|
||||||
{
|
{
|
||||||
if(!d.widgets[lst[i]].value){
|
if(!d.widgets[lst[i]].value || d.widgets[lst[i]].value=='None'){
|
||||||
flag = 0;
|
flag = 0;
|
||||||
msg = msg + NEWLINE + lst[i];
|
msg = msg + NEWLINE + lst[i];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,10 @@ def get_status_details(arg=None):
|
|||||||
'is_trial': webnotes.conn.get_global('is_trial'),
|
'is_trial': webnotes.conn.get_global('is_trial'),
|
||||||
'days_to_expiry': (webnotes.conn.get_global('days_to_expiry') or '0'),
|
'days_to_expiry': (webnotes.conn.get_global('days_to_expiry') or '0'),
|
||||||
'setup_status': get_setup_status(),
|
'setup_status': get_setup_status(),
|
||||||
'registration_complete': cint(get_defaults('registration_complete')) and 'Yes' or 'No'
|
'registration_complete': cint(get_defaults('registration_complete')) and 'Yes' or 'No',
|
||||||
|
'profile': webnotes.conn.sql("""\
|
||||||
|
SELECT first_name, last_name FROM `tabProfile`
|
||||||
|
WHERE name=%s AND docstatus<2""", webnotes.user.name, as_dict=1)
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
@@ -89,4 +92,4 @@ def get_setup_status():
|
|||||||
return ''
|
return ''
|
||||||
|
|
||||||
return {'ret': ret, 'percent': percent}
|
return {'ret': ret, 'percent': percent}
|
||||||
|
|
||||||
|
|||||||
@@ -47,9 +47,17 @@ class DocType:
|
|||||||
# Account Setup
|
# Account Setup
|
||||||
# ---------------
|
# ---------------
|
||||||
def setup_account(self, args):
|
def setup_account(self, args):
|
||||||
company_name, comp_abbr, fy_start, currency = eval(args)
|
import webnotes
|
||||||
|
company_name, comp_abbr, fy_start, currency, first_name, last_name = eval(args)
|
||||||
curr_fiscal_year,fy_start_date = self.get_fy_details(fy_start)
|
curr_fiscal_year,fy_start_date = self.get_fy_details(fy_start)
|
||||||
self.currency = currency
|
self.currency = currency
|
||||||
|
|
||||||
|
# Update Profile
|
||||||
|
if last_name=='None': last_name = None
|
||||||
|
webnotes.conn.sql("""\
|
||||||
|
UPDATE `tabProfile` SET first_name=%s, last_name=%s
|
||||||
|
WHERE name=%s AND docstatus<2""", (first_name, last_name, webnotes.user.name))
|
||||||
|
|
||||||
|
|
||||||
# Fiscal Year
|
# Fiscal Year
|
||||||
master_dict = {'Fiscal Year':{'year':curr_fiscal_year, 'year_start_date':fy_start_date}}
|
master_dict = {'Fiscal Year':{'year':curr_fiscal_year, 'year_start_date':fy_start_date}}
|
||||||
@@ -66,6 +74,7 @@ class DocType:
|
|||||||
'default_currency': currency,
|
'default_currency': currency,
|
||||||
'default_company':company_name,
|
'default_company':company_name,
|
||||||
'default_valuation_method':'FIFO',
|
'default_valuation_method':'FIFO',
|
||||||
|
'default_stock_uom':'Nos',
|
||||||
'date_format':'dd-mm-yyyy',
|
'date_format':'dd-mm-yyyy',
|
||||||
'default_currency_format':'Lacs',
|
'default_currency_format':'Lacs',
|
||||||
'so_required':'No',
|
'so_required':'No',
|
||||||
@@ -87,7 +96,8 @@ class DocType:
|
|||||||
msgprint("Great! Your company has now been created")
|
msgprint("Great! Your company has now been created")
|
||||||
|
|
||||||
import webnotes.utils
|
import webnotes.utils
|
||||||
return webnotes.utils.get_defaults()
|
user_fullname = (first_name or '') + (last_name and (" " + last_name) or '')
|
||||||
|
return {'sys_defaults': webnotes.utils.get_defaults(), 'user_fullname': user_fullname}
|
||||||
|
|
||||||
|
|
||||||
# Get Fiscal year Details
|
# Get Fiscal year Details
|
||||||
|
|||||||
Reference in New Issue
Block a user