From 8d8dfc3e8df9eddc70d52b98eb7f3b1a5d1ae35f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 2 Aug 2011 13:16:12 +0530 Subject: [PATCH 1/8] fixed patches --- patches/patch.py | 131 ++++------------------------------------------- 1 file changed, 9 insertions(+), 122 deletions(-) diff --git a/patches/patch.py b/patches/patch.py index 5def7a9f8e..2fbffd8d5b 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -56,17 +56,8 @@ def execute(patch_no): pass elif patch_no == 40: -<<<<<<< HEAD -<<<<<<< HEAD - import_from_files(record_list=[['material_management','doctype','item']]) -======= - - import_from_files(record_list=[['stock','doctype','item']]) ->>>>>>> stable -======= - import_from_files(record_list=[['stock','doctype','item']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c + elif patch_no == 42: acc = sql("select name, lft, rgt from tabAccount where account_name in ('Incomes', 'Expenses')") for d in acc: @@ -134,17 +125,8 @@ def execute(patch_no): elif patch_no == 56: sql("delete from `tabModule Def Item` where parent = 'CRM' and doc_type = 'Reports' and doc_name = 'Delivery Note' and display_name = 'Territory, Item Group wise GP'") elif patch_no == 57: -<<<<<<< HEAD -<<<<<<< HEAD + import_from_files(record_list=[['selling','doctype','sales_order_detail']]) - import_from_files(record_list=[['crm','doctype','sales_order_detail']]) -======= - - import_from_files(record_list=[['selling','doctype','sales_order_detail']]) ->>>>>>> stable -======= - import_from_files(record_list=[['selling','doctype','sales_order_detail']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c elif patch_no == 58: # module def patches sql("update `tabModule Def` set module_page = NULL where name not in ('Event Updates', 'Setup', 'My Company')") @@ -178,17 +160,8 @@ def execute(patch_no): sql("delete from `tabTDS Category Account` where company not in (select name from tabCompany)") elif patch_no == 62: # Import Supplier Quotation -<<<<<<< HEAD -<<<<<<< HEAD - import_from_files(record_list=[['srm','doctype','supplier_quotation']]) -======= - - import_from_files(record_list=[['buying','doctype','supplier_quotation']]) ->>>>>>> stable -======= - import_from_files(record_list=[['buying','doctype','supplier_quotation']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c + # Adding Status Filter sql("update tabDocType set search_fields = concat('status,',search_fields) where name IN ('Delivery Note','Leave Transaction')") # Import Other Charges @@ -196,17 +169,8 @@ def execute(patch_no): import_from_files(record_list=[['setup','doctype','other_charges']]) elif patch_no == 63: sql("update `tabDocField` set permlevel = 1 where fieldname in ('return_date', 'return_details') and parent = 'Sales and Purchase Return Wizard'") -<<<<<<< HEAD -<<<<<<< HEAD - import_from_files(record_list = [['accounts', 'doctype', 'rv_detail'], ['material_management', 'doctype', 'sales_and_purchase_return_wizard'], ['material_management', 'doctype', 'stock_entry']]) -======= - - import_from_files(record_list = [['accounts', 'doctype', 'rv_detail'], ['stock', 'doctype', 'sales_and_purchase_return_wizard'], ['stock', 'doctype', 'stock_entry']]) ->>>>>>> stable -======= - import_from_files(record_list = [['accounts', 'doctype', 'rv_detail'], ['stock', 'doctype', 'sales_and_purchase_return_wizard'], ['stock', 'doctype', 'stock_entry']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c + elif patch_no == 64: sql("update tabDocField set `hidden` = 1, `print_hide` = 1, `report_hide` = 1 where options in ('RFQ','Supplier Quotation')") sql("update tabDocType set `read_only` = 1, in_create = 1 where name in ('RFQ','Supplier Quotation')") @@ -387,17 +351,7 @@ def execute(patch_no): p.add_permission('Salary Slip', 'Employee', 1, read = 1, match = 'owner') elif patch_no == 79: # Import Modules -<<<<<<< HEAD -<<<<<<< HEAD - - import_from_files(record_list=[['payroll','doctype','leave_application'],['payroll','doctype','leave_allocation'],['payroll','doctype','leave_control_panel'],['payroll','doctype','holiday_list'],['payroll','doctype','holiday_list_detail'],['payroll','Module Def','Payroll']]) -======= - - import_from_files(record_list=[['hr','doctype','leave_application'],['hr','doctype','leave_allocation'],['hr','doctype','leave_control_panel'],['hr','doctype','holiday_list'],['hr','doctype','holiday_list_detail'],['hr','Module Def','Payroll']]) ->>>>>>> stable -======= - import_from_files(record_list=[['hr','doctype','leave_application'],['hr','doctype','leave_allocation'],['hr','doctype','leave_control_panel'],['hr','doctype','holiday_list'],['hr','doctype','holiday_list_detail'],['hr','Module Def','Payroll']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c + import_from_files(record_list=[['hr','doctype','leave_application'],['hr','doctype','leave_allocation'],['hr','doctype','leave_control_panel'],['hr','doctype','holiday_list'],['hr','doctype','holiday_list_detail'],['hr','Module Def','HR']]) elif patch_no == 80: # Holiday List sql("update `tabHoliday List Detail` set description = holiday_name") @@ -450,17 +404,7 @@ def execute(patch_no): elif patch_no == 81: # Import Modules -<<<<<<< HEAD -<<<<<<< HEAD - - import_from_files(record_list=[['payroll','Module Def','Payroll']]) -======= - - import_from_files(record_list=[['hr','Module Def','Payroll']]) ->>>>>>> stable -======= - import_from_files(record_list=[['hr','Module Def','Payroll']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c + import_from_files(record_list=[['hr','Module Def','HR']]) elif patch_no == 82: sql("update tabDocType set search_fields = 'employee,leave_type,total_leaves_allocated,fiscal_year' where name = 'Leave Allocation'") sql("update tabDocType set search_fields = 'employee,leave_type,from_date,to_date,total_leave_days,fiscal_year' where name = 'Leave Application'") @@ -486,32 +430,13 @@ def execute(patch_no): sql("update tabDocPerm set `match` = '' where parent = 'Leave Application' and role = 'HR User'") elif patch_no == 86: # Import Modules -<<<<<<< HEAD -<<<<<<< HEAD - - import_from_files(record_list=[['payroll','doctype','leave_type']]) -======= - import_from_files(record_list=[['hr','doctype','leave_type']]) ->>>>>>> stable -======= - import_from_files(record_list=[['hr','doctype','leave_type']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c elif patch_no == 87: sql("update `tabLeave Type` set is_lwp = 1 where name = 'Leave Without Pay'") elif patch_no == 88: # Import Modules -<<<<<<< HEAD -<<<<<<< HEAD + import_from_files(record_list=[['hr','doctype','leave_allocation']]) - import_from_files(record_list=[['payroll','doctype','leave_allocation']]) -======= - - import_from_files(record_list=[['hr','doctype','leave_allocation']]) ->>>>>>> stable -======= - import_from_files(record_list=[['hr','doctype','leave_allocation']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c elif patch_no == 89: sql("delete from `tabModule Def Item` where doc_type = 'Setup Forms' and doc_name in ('Payroll Rule', 'IT Checklist', 'Employee Profile') and parent = 'Payroll'") sql("update `tabDocField` set `hidden` = 1, `print_hide` = 1, `report_hide` = 1 where parent = 'Leave Type' and fieldname = 'is_encash'") @@ -529,17 +454,7 @@ def execute(patch_no): sql("update `tabTable Mapper Detail` set validation_logic = 'qty > ifnull(billed_qty,0) and docstatus = 1' where parent = 'Sales Order-Receivable Voucher' and from_table = 'Sales Order Detail'") sql("update `tabField Mapper Detail` set from_field = 'customer' where to_field = 'customer' and parent = 'Sales Order-Receivable Voucher'") elif patch_no == 94: -<<<<<<< HEAD -<<<<<<< HEAD - - import_from_files(record_list=[['crm','doctype','sms_center']]) -======= - import_from_files(record_list=[['selling','doctype','sms_center']]) ->>>>>>> stable -======= - import_from_files(record_list=[['selling','doctype','sms_center']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c elif patch_no == 95: import_from_files(record_list=[['mapper','DocType Mapper','Sales Order-Receivable Voucher'], ['mapper','DocType Mapper','Delivery Note-Receivable Voucher']]) elif patch_no == 96: @@ -570,17 +485,8 @@ def execute(patch_no): elif patch_no == 103: sql("update tabDocField set fieldname = '' where fieldtype = 'HTML'") elif patch_no == 104: -<<<<<<< HEAD -<<<<<<< HEAD + import_from_files(record_list=[['hr','search_criteria','stdsrch_00001'],['hr','search_criteria','stdsrch_00002'],['hr','search_criteria','stdsrch_00003'],['hr','Module Def','HR'],['hr','doctype','leave_application'],['hr','doctype','leave_allocation']]) - import_from_files(record_list=[['payroll','search_criteria','stdsrch_00001'],['payroll','search_criteria','stdsrch_00002'],['payroll','search_criteria','stdsrch_00003'],['payroll','Module Def','Payroll'],['payroll','doctype','leave_application'],['payroll','doctype','leave_allocation']]) -======= - - import_from_files(record_list=[['hr','search_criteria','stdsrch_00001'],['hr','search_criteria','stdsrch_00002'],['hr','search_criteria','stdsrch_00003'],['hr','Module Def','Payroll'],['hr','doctype','leave_application'],['hr','doctype','leave_allocation']]) ->>>>>>> stable -======= - import_from_files(record_list=[['hr','search_criteria','stdsrch_00001'],['hr','search_criteria','stdsrch_00002'],['hr','search_criteria','stdsrch_00003'],['hr','Module Def','Payroll'],['hr','doctype','leave_application'],['hr','doctype','leave_allocation']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c elif patch_no == 105: # Employee Leave Balance sql("delete from `tabModule Def Item` where parent = 'Payroll' and doc_type = 'Reports' and display_name IN ('Employeewise Leave Transaction Details','Employeewise Balance Leave Report')") @@ -1040,17 +946,8 @@ def execute(patch_no): elif patch_no == 239: reload_doc('core', 'doctype', 'docfield') reload_doc('core', 'doctype', 'doctype') -<<<<<<< HEAD -<<<<<<< HEAD + from patches.old_patches.feed_patch import set_subjects_and_tagfields - from patches.feed_patch import set_subjects_and_tagfields -======= - - from patches.old_patches.feed_patch import set_subjects_and_tagfields ->>>>>>> stable -======= - from patches.old_patches.feed_patch import set_subjects_and_tagfields ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c set_subjects_and_tagfields() elif patch_no == 240: # again for sales order (status) @@ -1123,18 +1020,8 @@ def execute(patch_no): sql("update `tabSingles` set value = replace(value, 'http://46.4.50.84/v170-test/', '') where field in ('letter_head', 'client_name') and doctype = 'Control Panel'") sql("update `tabItem` set description_html = replace(description_html, 'http://46.4.50.84/v170-test/', '')") elif patch_no == 257: -<<<<<<< HEAD -<<<<<<< HEAD - from patches.customer_address import run_old_data_sync_patch - run_old_data_sync_patch() -======= - from patches.old_patches.customer_address import run_old_data_sync_patch - run_old_data_sync_patch() ->>>>>>> stable -======= from patches.old_patches.customer_address import run_old_data_sync_patch run_old_data_sync_patch() ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c elif patch_no == 258: sql("update tabDocField set `default`=NULL where fieldname = 'naming_series'") elif patch_no == 259: From 0f36819ae2eb8fa380af1a221c63e3e19c2f928a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 10 Aug 2011 14:04:52 +0530 Subject: [PATCH 2/8] merged patch from master branch --- patches/patch.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/patches/patch.py b/patches/patch.py index 2fbffd8d5b..cd68b13e21 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 332 +last_patch = 337 #------------------------------------------- @@ -1343,3 +1343,33 @@ def execute(patch_no): p.add_permission('Lease Agreement', 'Accounts Manager', 1, read = 1) elif patch_no == 332: sql("update `tabDocField` set permlevel=1, hidden = 1 where parent = 'Bulk Rename Tool' and fieldname = 'file_list'") + elif patch_no == 333: + sql("update `tabDocPerm` set `create` =1 where role = 'Accounts Manager' and parent = 'Lease Agreement'") + + p = get_obj('Patch Util') + p.add_permission('DocType Mapper', 'System Manager', 0, read = 1, write=1, create=1) + p.add_permission('Role', 'System Manager', 0, read = 1, write=1, create=1) + p.add_permission('Print Format', 'System Manager', 0, read = 1, write=1, create=1) + elif patch_no == 334: + reload_doc('knowledge_base', 'doctype', 'answer') + elif patch_no == 335: + for dt in ['Account', 'Cost Center', 'Territory', 'Item Group', 'Customer Group']: + sql("update `tabDocField` set fieldtype = 'Link', options = %s where fieldname = 'old_parent' and parent = %s", (dt, dt)) + elif patch_no == 336: + reload_doc('server_tools','page','billing') + elif patch_no == 337: + item_list = webnotes.conn.sql("""SELECT name, description_html + FROM tabItem""") + if item_list: + for item, html in item_list: + if html and "getfile" in html and "acx" in html: + ac_id = webnotes.conn.sql("""SELECT value FROM `tabSingles` WHERE doctype='Control Panel' AND field='account_id'""") + sp_acx = html.split("acx=") + l_acx = len(sp_acx) + if l_acx > 1: + for i in range(l_acx-1): + sp_quot = sp_acx[i+1].split('"') + if len(sp_quot) > 1: sp_quot[0] = str(ac_id[0][0]) + sp_acx[i+1] = '"'.join(sp_quot) + html = "acx=".join(sp_acx) + webnotes.conn.sql("""UPDATE tabItem SET description_html=%s WHERE name=%s""", (html, item)) From 673f66f56e95bdc166becd2616254acd39af1baa Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 10 Aug 2011 14:18:31 +0530 Subject: [PATCH 3/8] error fixed in patch utils --- utilities/doctype/patch_util/patch_util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utilities/doctype/patch_util/patch_util.py b/utilities/doctype/patch_util/patch_util.py index f26d110aa6..828c805097 100644 --- a/utilities/doctype/patch_util/patch_util.py +++ b/utilities/doctype/patch_util/patch_util.py @@ -85,7 +85,8 @@ class DocType: d.parent = doctype d.parenttype = 'DocType' d.parentfield = 'permissions' - + + d.permlevel = level d.role = role d.read = read d.write = write From dc2f388e586986db49a1a4cf7c4b6f3285d6e09f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 11 Aug 2011 09:36:30 +0530 Subject: [PATCH 4/8] fix to support ticket --- support/doctype/support_ticket/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/doctype/support_ticket/__init__.py b/support/doctype/support_ticket/__init__.py index 936233db7c..63ed8c142d 100644 --- a/support/doctype/support_ticket/__init__.py +++ b/support/doctype/support_ticket/__init__.py @@ -92,7 +92,7 @@ We will get back to you as soon as possible sendmail(\ recipients = [d.raised_by], \ sender = self.email_settings.support_email, \ - subject = '['+d.name+'] ' + d.subject, \ + subject = '['+d.name+'] ' + str(d.subject or ''), \ msg = response) def auto_close_tickets(self): From c0e97b289d0c4d5336d88718e57483b563cb38b0 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 11 Aug 2011 09:38:19 +0530 Subject: [PATCH 5/8] fix to support ticket --- support/doctype/support_ticket/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/doctype/support_ticket/__init__.py b/support/doctype/support_ticket/__init__.py index 63ed8c142d..9379280484 100644 --- a/support/doctype/support_ticket/__init__.py +++ b/support/doctype/support_ticket/__init__.py @@ -85,7 +85,7 @@ We will get back to you as soon as possible [This is an automatic response] - """ + signature) + """ + (signature or '')) from webnotes.utils.email_lib import sendmail From 98b36762461162949d880afbd28fa92c573ba6a9 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 11 Aug 2011 10:57:08 +0530 Subject: [PATCH 6/8] fix to kb --- knowledge_base/page/question_view/question_view.js | 2 +- knowledge_base/page/questions/questions.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/knowledge_base/page/question_view/question_view.js b/knowledge_base/page/question_view/question_view.js index 895c6f7bcf..ed11efce8b 100644 --- a/knowledge_base/page/question_view/question_view.js +++ b/knowledge_base/page/question_view/question_view.js @@ -174,4 +174,4 @@ KBAnswer = function(body, data) { } -$import(knowledge_base.kb_common); \ No newline at end of file +$import(knowledge_base/page/kb_common/kb_common.js); \ No newline at end of file diff --git a/knowledge_base/page/questions/questions.js b/knowledge_base/page/questions/questions.js index 993a38e642..f268d0bbf0 100644 --- a/knowledge_base/page/questions/questions.js +++ b/knowledge_base/page/questions/questions.js @@ -203,4 +203,4 @@ KBQuestion = function(parent, det, kb) { this.make() } -$import(knowledge_base.kb_common); \ No newline at end of file +$import(knowledge_base/page/kb_common/kb_common.js); \ No newline at end of file From af43b7457c18f5bafa18fc49dc407d9d68941fc0 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 11 Aug 2011 12:37:11 +0530 Subject: [PATCH 7/8] fix to kb --- knowledge_base/page/questions/questions.txt | 2 +- patches/patch.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/knowledge_base/page/questions/questions.txt b/knowledge_base/page/questions/questions.txt index d71225a7a0..b45c7dde59 100644 --- a/knowledge_base/page/questions/questions.txt +++ b/knowledge_base/page/questions/questions.txt @@ -15,7 +15,7 @@ 'doctype': 'Page', 'module': 'Knowledge Base', 'name': '__common__', - 'page_name': 'Questions', + 'page_name': 'questions', 'standard': 'Yes' }, diff --git a/patches/patch.py b/patches/patch.py index cd68b13e21..0eafef6aff 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 337 +last_patch = 338 #------------------------------------------- @@ -1373,3 +1373,7 @@ def execute(patch_no): sp_acx[i+1] = '"'.join(sp_quot) html = "acx=".join(sp_acx) webnotes.conn.sql("""UPDATE tabItem SET description_html=%s WHERE name=%s""", (html, item)) + elif patch_no == 338: + # update name of questions page + sql("update tabPage set name='questions' where name='Questions'") + sql("update tabPage set name='question-view' where name='Question View'") \ No newline at end of file From c3ef49317182dfc6a396b555d49c7cf2595da912 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 12 Aug 2011 14:51:33 +0530 Subject: [PATCH 8/8] added setup wizard 0.1 --- home/page/event_updates/event_updates.css | 47 +++++++++++- home/page/event_updates/event_updates.js | 60 ++++++++++++++- home/page/event_updates/event_updates.py | 44 ++++++++++- setup/doctype/personalize/personalize.py | 2 +- setup/page/import_data/import_data.html | 2 +- setup/page/import_data/import_data.js | 90 +++++++++++++---------- 6 files changed, 197 insertions(+), 48 deletions(-) diff --git a/home/page/event_updates/event_updates.css b/home/page/event_updates/event_updates.css index ed50351973..a88fed48b1 100644 --- a/home/page/event_updates/event_updates.css +++ b/home/page/event_updates/event_updates.css @@ -14,4 +14,49 @@ span.home-status-unread { font-size: 11px; color: #FFF; background-color: RED; -} \ No newline at end of file +} + +div.setup-wizard { + display: none; + margin: 13px 0px; + background-color: #FED; + padding: 13px; +} + +div.setup-wizard .header { + font-size: 12px; + font-weight: bold; + color: #322; + margin-bottom: 7px; +} + + +div.setup-wizard .percent-outer { + height: 17px; + background-color: #FFF; + border: 2px solid #322; +} + +div.setup-wizard .percent-inner { + height: 17px; + background-color: GREEN; +} + +div.setup-wizard .suggestion { + margin: 7px 0px; + color: #322; +} + +div.setup-wizard .prev-next { + height: 13px; +} + +div.setup-wizard .prev-next span { + display: none; + float: right; + margin-left: 13px; + color: #877; + font-size: 11px; +} + + diff --git a/home/page/event_updates/event_updates.js b/home/page/event_updates/event_updates.js index 7ecfbdcf3c..1574f537ef 100644 --- a/home/page/event_updates/event_updates.js +++ b/home/page/event_updates/event_updates.js @@ -24,8 +24,8 @@ pscript.home_make_body = function() { wrapper.head = $a(wrapper.body, 'div'); wrapper.banner_area = $a(wrapper.head, 'div'); - wrapper.toolbar_area = $a(wrapper.head, 'div'); + wrapper.setup_wizard_area = $a(wrapper.body, 'div', 'setup-wizard') wrapper.system_message_area = $a(wrapper.body, 'div', '', {marginBottom:'16px', padding:'8px', backgroundColor:'#FFD', border:'1px dashed #AA6', display:'none'}) @@ -612,7 +612,6 @@ pscript.home_make_status = function() { // get values $c_page('home', 'event_updates', 'get_status_details', user, function(r,rt) { - home_status_bar.render(r.message); // system_messages @@ -622,6 +621,11 @@ pscript.home_make_status = function() { // render online users pscript.online_users_obj.render(r.message.online_users); pscript.online_users = r.message.online_users; + + // setup wizard + if(r.message.setup_status) { + new SetupWizard(r.message.setup_status) + } } ); } @@ -633,7 +637,7 @@ pscript.show_system_message = function(wrapper, msg) { var txt = $a(wrapper.system_message_area, 'div', '', {lineHeight:'1.6em'}); txt.innerHTML = msg; - var span = $ln($a(wrapper.system_message_area, 'div'), 'Dismiss', + var span = $ln($a(wrapper.system_message_area, 'div', '', {textAlign:'right'}), 'Dismiss'.bold(), function(me) { me.set_working(); $c_obj('Home Control', 'dismiss_message', '', function(r,rt) { @@ -729,3 +733,53 @@ pscript.validate_fields = function(d) if(!flag) alert(msg); return flag; } + +SetupWizard = function(status) { + var me = this; + $.extend(this, { + make: function(status) { + me.status = status; + me.wrapper = page_body.pages['Event Updates'].setup_wizard_area; + $ds(me.wrapper); + me.make_percent(status.percent); + me.make_suggestion(status.ret); + }, + make_percent: function(percent) { + $a(me.wrapper, 'div', 'header', {}, 'Your setup is '+percent+'% complete'); + var o = $a(me.wrapper, 'div', 'percent-outer'); + $a(o, 'div', 'percent-inner', {width:percent + '%'}); + }, + make_suggestion: function(ret) { + me.suggest_area = $a(me.wrapper, 'div', 'suggestion'); + if(me.status.ret.length>1) { + me.prev_next = $a(me.wrapper, 'div', 'prev-next'); + + // next + me.next = $a(me.prev_next, 'span', 'link_type', null, 'Next Suggestion', + function() { me.show_suggestion(me.cur_sugg+1) }); + + // prev + me.prev = $a(me.prev_next, 'span', 'link_type', null, 'Previous Suggestion', + function() { me.show_suggestion(me.cur_sugg-1) }); + + } + if(me.status.ret.length) { + me.show_suggestion(0); + } else { + me.suggest_area.innerHTML = 'Congratulations: '.bold() + 'You are now on your track... Good luck'; + } + }, + show_suggestion: function(idx) { + me.cur_sugg = idx; + me.suggest_area.innerHTML = 'What you can do next: '.bold() + me.status.ret[idx]; + + // show hide prev, next + if(me.status.ret.length>1) { + $dh(me.prev); $dh(me.next); + if(idx>0) $ds(me.prev); + if(idxUpload your company banner') + else: + percent += 20 + + def check_type(doctype, ret, percent): + if not webnotes.conn.sql("select count(*) from tab%s" % doctype)[0][0]: + ret.append(''' + + Create a new %(dt)s + or + + Import from a spreadsheet''' % {'dt':doctype}) + else: + percent += 20 + return ret, percent + + ret, percent = check_type('Item', ret, percent) + ret, percent = check_type('Customer', ret, percent) + ret, percent = check_type('Supplier', ret, percent) + + if percent==100: + webnotes.conn.set_global('setup_done', '1') + return '' + + return {'ret': ret, 'percent': percent} + \ No newline at end of file diff --git a/setup/doctype/personalize/personalize.py b/setup/doctype/personalize/personalize.py index 6a15102f41..3264546337 100644 --- a/setup/doctype/personalize/personalize.py +++ b/setup/doctype/personalize/personalize.py @@ -28,4 +28,4 @@ class DocType: # def set_html_from_image(self): file_name = self.doc.file_list.split(',')[0] - self.doc.header_html = '
' + self.doc.header_html = '
' diff --git a/setup/page/import_data/import_data.html b/setup/page/import_data/import_data.html index a4b30f425f..5b30dd28cf 100644 --- a/setup/page/import_data/import_data.html +++ b/setup/page/import_data/import_data.html @@ -32,7 +32,7 @@ -
+

Data Import Guide

  1. Get the template of the DocType for which you want to import in CSV (Comma seperated values) format.
  2. diff --git a/setup/page/import_data/import_data.js b/setup/page/import_data/import_data.js index aa0bdbd532..f1601e79c7 100644 --- a/setup/page/import_data/import_data.js +++ b/setup/page/import_data/import_data.js @@ -1,45 +1,55 @@ pscript['onload_Import Data'] = function() { - - //alert(profile.can_get_report); + + //alert(profile.can_get_report); - callback = function(r,rt) { - var h = new PageHeader('di_header','Import Data','Tool to download template and upload data'); - var sel = $i('import_template'); - if(r.message){ - add_sel_options(sel, r.message); - sel.onchange=function(){ - $i('child_tab_lst').innerHTML =''; - if(sel.value != 'Select Master...'){ - $c_obj('Import Data Control','get_child_lst',sel.value, - function(r,rt){ - var me = this; - $y($i('child_tab_lst'),{backgroundColor:'#EEEEEE'}) - var desc = $a($i('child_tab_lst'), 'div', '', {padding:'8px'}); - - desc.innerHTML = "

    Please click on following link(s) to download template.

    "; + callback = function(r,rt) { + var h = new PageHeader('di_header','Import Data','Tool to download template and upload data'); + var sel = $i('import_template'); + if(r.message){ + add_sel_options(sel, r.message); + + // please collapse here when editing :) + sel.onchange=function(){ + $i('child_tab_lst').innerHTML =''; + if(sel.value != 'Select Master...'){ + $c_obj('Import Data Control','get_child_lst',sel.value, + function(r,rt){ + var me = this; + $y($i('child_tab_lst'),{backgroundColor:'#EEEEEE', margin: '17px 17px', padding: '13px'}) + var desc = $a($i('child_tab_lst'), 'div', '', {padding:'4px'}); + + desc.innerHTML = "Download template(s) for importing "+sel_val(sel)+""; - - var parent = $a($i('child_tab_lst'), 'div'); - var tab = make_table(parent,r.message.length,1,'100%',[],{padding:'8px',fontSize:'15px',borderCollapse: 'collapse'}); - - for(var i=0;i