';
-}
diff --git a/erpnext/home/page/profile_settings/profile_settings.js b/erpnext/home/page/profile_settings/profile_settings.js
index 9dac7f6f1d..f1ee6ffc6d 100644
--- a/erpnext/home/page/profile_settings/profile_settings.js
+++ b/erpnext/home/page/profile_settings/profile_settings.js
@@ -26,13 +26,15 @@ MyProfile = function(wrapper) {
this.make = function() {
this.head = new PageHeader(this.wrapper, 'My Profile Settings');
- this.head.add_button('Change Password', this.change_password)
+ this.head.add_button('Change Password', this.change_password);
+ this.head.add_button('Change Background', this.change_background);
+
this.tab = make_table($a(this.wrapper, 'div', '', {marginTop:'19px'}),
1, 2, '90%', ['50%', '50%'], {padding:'11px'})
- this.img = $a($td(this.tab, 0, 0), 'img');
- set_user_img(this.img, user);
+ this.img = $a($td(this.tab, 0, 0), 'img', '', {width: '120px', maxHeight:'200px'});
+ this.img.src = wn.user_info(user).image;
- $btn($a($td(this.tab, 0, 0), 'div', '', {marginTop:'11px'}), 'Change Image', this.change_image)
+ $btn($a($td(this.tab, 0, 0), 'div', '', {marginTop:'11px'}), 'Change Image', this.change_image);
this.make_form();
this.load_details();
@@ -105,32 +107,46 @@ MyProfile = function(wrapper) {
//
this.change_image = function() {
- if(!me.change_dialog) {
-
- var d = new Dialog(400,200,'Set Your Profile Image');
- d.make_body([
- ['HTML','wrapper']
- ]);
-
- var w = d.widgets['wrapper'];
- me.uploader = new Uploader(w,
- {
- modulename:'home.page.profile_settings.profile_settings',
- method: 'set_user_image'
- },
- pscript.user_image_upload, 1)
- me.change_dialog = d;
- }
- me.change_dialog.show();
+ var d = new wn.widgets.Dialog({
+ title: 'Set your Profile'
+ })
+ me.uploader = new Uploader(d.body, {
+ modulename:'home.page.profile_settings.profile_settings',
+ method: 'set_user_image'
+ },
+ pscript.user_image_upload, 1)
+ d.show();
+ pscript.open_dialog = d;
+ }
+
+ this.change_background = function() {
+ var d = new wn.widgets.Dialog({
+ title: 'Set Background Image'
+ })
+ me.uploader = new Uploader(d.body, {
+ modulename:'home.page.profile_settings.profile_settings',
+ method: 'set_user_background'
+ },
+ pscript.background_change, 1)
+ d.show();
+ pscript.open_dialog = d;
}
this.make();
}
-pscript.user_image_upload = function(fid) {
+pscript.background_change = function(fid) {
msgprint('File Uploaded');
-
if(fid) {
- pscript.myprofile.change_dialog.hide();
- set_user_img(pscript.myprofile.img, user, null, fid);
+ erpnext.set_user_background(fid);
+ pscript.open_dialog.hide();
+ }
+}
+
+pscript.user_image_upload = function(fid) {
+ msgprint('File Uploaded');
+ if(fid) {
+ pscript.open_dialog.hide();
+ wn.boot.user_info[user].image = 'files/' + fid;
+ pscript.myprofile.img.src = 'files/' + fid;
}
}
diff --git a/erpnext/home/page/profile_settings/profile_settings.py b/erpnext/home/page/profile_settings/profile_settings.py
index f614c75ff4..fb633fdb19 100644
--- a/erpnext/home/page/profile_settings/profile_settings.py
+++ b/erpnext/home/page/profile_settings/profile_settings.py
@@ -63,6 +63,31 @@ def set_user_image(fid, fname):
"""
Set uploaded image as user image
"""
- from webnotes.utils.file_manager import add_file_list, remove_all
- remove_all('Profile', webnotes.session['user'])
- add_file_list('Profile', webnotes.session['user'], fname, fid)
+ from webnotes.utils.file_manager import add_file_list, remove_file
+ user = webnotes.session['user']
+
+ # remove old file
+ old_image = webnotes.conn.get_value('Profile', user, 'user_image')
+ if old_image:
+ remove_file('Profile', user, old_image)
+
+ # add new file
+ add_file_list('Profile', user, fname, fid)
+ webnotes.conn.set_value('Profile', user, 'user_image', fid)
+
+@webnotes.whitelist()
+def set_user_background(fid, fname):
+ """
+ Set uploaded image as user image
+ """
+ from webnotes.utils.file_manager import add_file_list, remove_file
+ user = webnotes.session['user']
+
+ # remove old file
+ old_image = webnotes.conn.get_value('Profile', user, 'background_image')
+ if old_image:
+ remove_file('Profile', user, old_image)
+
+ # add new file
+ add_file_list('Profile', user, fname, fid)
+ webnotes.conn.set_value('Profile', user, 'background_image', fid)
diff --git a/erpnext/patches/jan_mar_2012/add_roles_to_admin.py b/erpnext/patches/jan_mar_2012/add_roles_to_admin.py
new file mode 100644
index 0000000000..402675ae2c
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/add_roles_to_admin.py
@@ -0,0 +1,10 @@
+def execute():
+ """
+ Adds various roles to Administrator. This patch is for making master db
+ ready for on premise installation
+ """
+ import webnotes
+ from webnotes.model.code import get_obj
+ from webnotes.model.doc import Document
+ sc = get_obj('Setup Control', 'Setup Control')
+ sc.add_roles(Document('Profile', 'Administrator'))
diff --git a/erpnext/patches/jan_mar_2012/clear_session_cache.py b/erpnext/patches/jan_mar_2012/clear_session_cache.py
index 2071ae567c..5ba2104322 100644
--- a/erpnext/patches/jan_mar_2012/clear_session_cache.py
+++ b/erpnext/patches/jan_mar_2012/clear_session_cache.py
@@ -16,6 +16,4 @@
def execute():
import webnotes
- webnotes.conn.sql("""
- delete from __SessionCache
- """)
+ webnotes.clear_cache()
diff --git a/erpnext/patches/jan_mar_2012/dt_map_fix.py b/erpnext/patches/jan_mar_2012/dt_map_fix.py
new file mode 100644
index 0000000000..f669009786
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/dt_map_fix.py
@@ -0,0 +1,7 @@
+def execute():
+ import webnotes
+ from webnotes.modules.module_manager import reload_doc
+ webnotes.conn.sql("delete from `tabField Mapper Detail` where from_field = 'transaction_date' and parent in ('Sales Order-Delivery Note', 'Purchase Order-Purchase Receipt')")
+
+ reload_doc('stock', 'DocType Mapper', 'Sales Order-Delivery Note')
+ reload_doc('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt')
diff --git a/erpnext/patches/jan_mar_2012/label_cleanup.py b/erpnext/patches/jan_mar_2012/label_cleanup.py
index 885c83f94b..b40f36f855 100644
--- a/erpnext/patches/jan_mar_2012/label_cleanup.py
+++ b/erpnext/patches/jan_mar_2012/label_cleanup.py
@@ -3,14 +3,14 @@ def execute():
from webnotes.model import delete_doc
from webnotes.modules.module_manager import reload_doc
- dt = [
+ dt = {
'selling': ['quotation', 'sales_order', 'quotation_detail', 'sales_order_detail'],
'stock': ['delivery_note', 'delivery_note_detail', 'purchase_receipt', 'purchase_receipt_detail'],
'accounts': ['receivable_voucher', 'payable_voucher', 'rv_detail', 'pv_detail', 'rv_tax_detail', 'purchase_tax_detail'],
'buying': ['purchase_order', 'po_detail']
- ]
+ }
for m in dt:
- for d in m:
+ for d in dt[m]:
reload_doc(m, 'doctype', d)
@@ -21,7 +21,7 @@ def execute():
del_flds = {
'Sales Order Detail': "'delivery_date', 'confirmation_date'",
- 'Delivery Note': "'supplier', 'supplier_address', 'purchase_receipt_no', 'purchase_order_no', 'transaction_date'"
+ 'Delivery Note': "'supplier', 'supplier_address', 'purchase_receipt_no', 'purchase_order_no', 'transaction_date'",
'Receivable Voucher': "'voucher_date'",
'Payable Voucher': "'voucher_date'",
'Purchase Receipt': "'transaction_date'"
@@ -33,10 +33,15 @@ def execute():
}
for d in del_flds:
- webnotes.conn.sql("delete from `tabDocField` where fieldname in (%s) and parent = %s", (del_flds[d], d))
+ webnotes.conn.sql("delete from `tabDocField` where fieldname in (%s) and parent = '%s'"% (del_flds[d], d))
for d in del_labels:
- webnotes.conn.sql("delete from `tabDocField` where label in (%s) and parent = %s", (del_labels[d], d))
+ webnotes.conn.sql("delete from `tabDocField` where label in (%s) and parent = '%s'"% (del_labels[d], d))
delete_doc('DocType', 'Update Delivery Date Detail')
- delete_doc('DocType', 'Update Delivery Date'
+
+ # Reload print formats
+ reload_doc('accounts', 'Print Format', 'Sales Invoice Classic')
+ reload_doc('accounts', 'Print Format', 'Sales Invoice Modern')
+ reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan')
+
diff --git a/erpnext/patches/jan_mar_2012/navupdate.py b/erpnext/patches/jan_mar_2012/navupdate.py
index d29a2cf336..1cfa879ad3 100644
--- a/erpnext/patches/jan_mar_2012/navupdate.py
+++ b/erpnext/patches/jan_mar_2012/navupdate.py
@@ -32,6 +32,17 @@ def execute():
reload_doc('utilities', 'page', 'todo')
reload_doc('utilities', 'page', 'calendar')
reload_doc('utilities', 'page', 'messages')
+ reload_doc('setup', 'page', 'modules_setup')
+ reload_doc('utilities', 'page', 'users')
+ reload_doc('home', 'page', 'activity')
+ reload_doc('home', 'page', 'attributions')
+ reload_doc('core', 'doctype', 'profile')
+
+ # update user_image in profile
+ for p in webnotes.conn.sql("""select name, file_list from tabProfile
+ where ifnull(file_list,'')!=''"""):
+ fid = p[1].split('\n')[0].split(',')[1]
+ webnotes.conn.set_value('Profile', p[0], 'user_image', fid)
webnotes.conn.set_value('Control Panel', 'Control Panel', 'home_page',
'desktop')
diff --git a/erpnext/patches/jan_mar_2012/reload_table.py b/erpnext/patches/jan_mar_2012/reload_table.py
new file mode 100644
index 0000000000..14b8864ed0
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/reload_table.py
@@ -0,0 +1,9 @@
+def execute():
+ import webnotes
+ from webnotes.modules.module_manager import reload_doc
+ reload_doc('selling', 'doctype', 'quotation_detail')
+ reload_doc('stock', 'doctype', 'delivery_note_detail')
+ reload_doc('stock', 'doctype', 'purchase_receipt_detail')
+ reload_doc('buying', 'doctype', 'po_detail')
+ reload_doc('accounts', 'doctype', 'rv_detail')
+ reload_doc('accounts', 'doctype', 'pv_detail')
diff --git a/erpnext/patches/jan_mar_2012/website/file_data_rename.py b/erpnext/patches/jan_mar_2012/website/file_data_rename.py
index 481a530aeb..dc4110bbc5 100644
--- a/erpnext/patches/jan_mar_2012/website/file_data_rename.py
+++ b/erpnext/patches/jan_mar_2012/website/file_data_rename.py
@@ -69,3 +69,12 @@ def replace_file_list_column_entries():
if file_list and "/" in file_list:
webnotes.conn.sql("UPDATE `%s` SET file_list='%s' WHERE name='%s'" \
% (tab, file_list.replace('/', '-'), name))
+
+ singles = webnotes.conn.sql("""SELECT doctype, value FROM `tabSingles`
+ WHERE field='file_list'""")
+ for doctype, file_list in singles:
+ if file_list and "/" in file_list:
+ webnotes.conn.sql("""UPDATE `tabSingles` SET value='%s'
+ WHERE doctype='%s' AND field='file_list'"""
+ % (file_list.replace('/', '-'), doctype))
+
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
index dc9f1dd7e4..7750962963 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -121,4 +121,61 @@ patch_list = [
'patch_file': 'fix_packing_slip',
'description': 'Update Mapper Delivery Note-Packing Slip'
},
+ {
+ 'patch_module': 'patches.jan_mar_2012.apps',
+ 'patch_file': 'todo_item',
+ 'description': 'Reloads todo item'
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'convert_tables_to_utf8',
+ 'description': 'Convert tables to UTF-8'
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'pending_patches',
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'pos_setting_patch',
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'reload_doctype',
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'reload_po_pr_mapper',
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'delete_pur_of_service',
+ 'description': 'Deletes purpose of service'
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'navupdate',
+ 'description': 'New Navigation Pages'
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'label_cleanup',
+ 'description': 'Remove extra fields and new dynamic labels'
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'add_roles_to_admin',
+ 'description': 'Add Roles to Administrator'
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'dt_map_fix',
+ 'description': 'removed transaction date from dt_mapper'
+ },
+ {
+ 'patch_module': 'patches.jan_mar_2012',
+ 'patch_file': 'reload_table',
+ 'description': 'Relaod all item table: fld order changes'
+ },
+
]
diff --git a/erpnext/patches/print_formats/SalesInvoiceClassic.html b/erpnext/patches/print_formats/SalesInvoiceClassic.html
index 78cb8155ff..d40f80152b 100644
--- a/erpnext/patches/print_formats/SalesInvoiceClassic.html
+++ b/erpnext/patches/print_formats/SalesInvoiceClassic.html
@@ -200,7 +200,7 @@
Invoice Date
-
+
Due Date
diff --git a/erpnext/patches/print_formats/SalesInvoiceModern.html b/erpnext/patches/print_formats/SalesInvoiceModern.html
index cef84ac6a2..ac66423495 100644
--- a/erpnext/patches/print_formats/SalesInvoiceModern.html
+++ b/erpnext/patches/print_formats/SalesInvoiceModern.html
@@ -227,7 +227,7 @@
Invoice Date
-
+
Due Date
diff --git a/erpnext/patches/print_formats/SalesInvoiceSpartan.html b/erpnext/patches/print_formats/SalesInvoiceSpartan.html
index 7d13674f9a..81e1c380fe 100644
--- a/erpnext/patches/print_formats/SalesInvoiceSpartan.html
+++ b/erpnext/patches/print_formats/SalesInvoiceSpartan.html
@@ -222,7 +222,7 @@
Invoice Date
-
+
Due Date
diff --git a/erpnext/selling/doctype/customer/customer.txt b/erpnext/selling/doctype/customer/customer.txt
index 24271ee688..346b4d1029 100644
--- a/erpnext/selling/doctype/customer/customer.txt
+++ b/erpnext/selling/doctype/customer/customer.txt
@@ -5,47 +5,48 @@
{
'creation': '2010-08-08 17:08:56',
'docstatus': 0,
- 'modified': '2011-07-20 10:42:05',
- 'modified_by': 'Administrator',
- 'owner': 'Administrator'
+ 'modified': '2012-02-29 13:24:31',
+ 'modified_by': u'Administrator',
+ 'owner': u'Administrator'
},
# These values are common for all DocType
{
- '_last_update': '1309508837',
+ '_last_update': u'1330501485',
'allow_print': 0,
'allow_trash': 1,
- 'colour': 'White:FFF',
+ 'colour': u'White:FFF',
+ 'default_print_format': u'Standard',
'doctype': 'DocType',
- 'document_type': 'Master',
- 'module': 'Selling',
+ 'document_type': u'Master',
+ 'module': u'Selling',
'name': '__common__',
- 'search_fields': 'customer_name,customer_group,country,territory',
- 'section_style': 'Tabbed',
- 'server_code_error': ' ',
+ 'search_fields': u'customer_name,customer_group,country,territory',
+ 'section_style': u'Tabbed',
+ 'server_code_error': u' ',
'show_in_menu': 0,
- 'subject': "eval:'%(customer_name)s'=='%(name)s' ? ' ' : '%(customer_name)s'",
- 'tag_fields': 'customer_group,customer_type',
- 'version': 433
+ 'subject': u'eval:"%(customer_name)s"=="%(name)s" ? "" : "%(customer_name)s"',
+ 'tag_fields': u'customer_group,customer_type',
+ 'version': 434
},
# These values are common for all DocField
{
- 'doctype': 'DocField',
+ 'doctype': u'DocField',
'name': '__common__',
- 'parent': 'Customer',
- 'parentfield': 'fields',
- 'parenttype': 'DocType'
+ 'parent': u'Customer',
+ 'parentfield': u'fields',
+ 'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'amend': 0,
- 'doctype': 'DocPerm',
+ 'doctype': u'DocPerm',
'name': '__common__',
- 'parent': 'Customer',
- 'parentfield': 'permissions',
- 'parenttype': 'DocType',
+ 'parent': u'Customer',
+ 'parentfield': u'permissions',
+ 'parenttype': u'DocType',
'read': 1,
'submit': 0
},
@@ -53,17 +54,16 @@
# DocType, Customer
{
'doctype': 'DocType',
- 'name': 'Customer'
+ 'name': u'Customer'
},
# DocPerm
{
'cancel': 0,
'create': 0,
- 'doctype': 'DocPerm',
- 'idx': 1,
+ 'doctype': u'DocPerm',
'permlevel': 1,
- 'role': 'Sales Manager',
+ 'role': u'Sales Manager',
'write': 0
},
@@ -71,10 +71,9 @@
{
'cancel': 0,
'create': 0,
- 'doctype': 'DocPerm',
- 'idx': 2,
+ 'doctype': u'DocPerm',
'permlevel': 0,
- 'role': 'Sales Manager',
+ 'role': u'Sales Manager',
'write': 0
},
@@ -82,10 +81,9 @@
{
'cancel': 0,
'create': 0,
- 'doctype': 'DocPerm',
- 'idx': 3,
+ 'doctype': u'DocPerm',
'permlevel': 1,
- 'role': 'Sales User',
+ 'role': u'Sales User',
'write': 0
},
@@ -93,10 +91,9 @@
{
'cancel': 0,
'create': 0,
- 'doctype': 'DocPerm',
- 'idx': 4,
+ 'doctype': u'DocPerm',
'permlevel': 0,
- 'role': 'Sales User',
+ 'role': u'Sales User',
'write': 0
},
@@ -104,10 +101,9 @@
{
'cancel': 1,
'create': 1,
- 'doctype': 'DocPerm',
- 'idx': 5,
+ 'doctype': u'DocPerm',
'permlevel': 0,
- 'role': 'Sales Master Manager',
+ 'role': u'Sales Master Manager',
'write': 1
},
@@ -115,38 +111,35 @@
{
'cancel': 0,
'create': 0,
- 'doctype': 'DocPerm',
- 'idx': 6,
+ 'doctype': u'DocPerm',
'permlevel': 1,
- 'role': 'Sales Master Manager',
+ 'role': u'Sales Master Manager',
'write': 0
},
# DocField
{
- 'colour': 'White:FFF',
- 'description': 'Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts',
- 'doctype': 'DocField',
- 'fieldtype': 'Section Break',
- 'idx': 1,
- 'label': 'Basic Info',
- 'oldfieldtype': 'Section Break',
+ 'colour': u'White:FFF',
+ 'description': u'Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts',
+ 'doctype': u'DocField',
+ 'fieldtype': u'Section Break',
+ 'label': u'Basic Info',
+ 'oldfieldtype': u'Section Break',
'permlevel': 0,
'reqd': 0
},
# DocField
{
- 'doctype': 'DocField',
- 'fieldname': 'customer_name',
- 'fieldtype': 'Data',
+ 'doctype': u'DocField',
+ 'fieldname': u'customer_name',
+ 'fieldtype': u'Data',
'hidden': 0,
- 'idx': 2,
'in_filter': 1,
- 'label': 'Customer Name',
+ 'label': u'Customer Name',
'no_copy': 1,
- 'oldfieldname': 'customer_name',
- 'oldfieldtype': 'Data',
+ 'oldfieldname': u'customer_name',
+ 'oldfieldtype': u'Data',
'permlevel': 0,
'print_hide': 0,
'report_hide': 0,
@@ -156,330 +149,312 @@
# DocField
{
- 'doctype': 'DocField',
- 'fieldname': 'customer_type',
- 'fieldtype': 'Select',
- 'idx': 3,
- 'label': 'Customer Type',
- 'oldfieldname': 'customer_type',
- 'oldfieldtype': 'Select',
- 'options': '\nCompany\nIndividual',
+ 'doctype': u'DocField',
+ 'fieldname': u'customer_type',
+ 'fieldtype': u'Select',
+ 'label': u'Customer Type',
+ 'oldfieldname': u'customer_type',
+ 'oldfieldtype': u'Select',
+ 'options': u'\nCompany\nIndividual',
'permlevel': 0,
'reqd': 1
},
# DocField
{
- 'doctype': 'DocField',
- 'fieldname': 'naming_series',
- 'fieldtype': 'Select',
- 'idx': 4,
- 'label': 'Series',
+ 'doctype': u'DocField',
+ 'fieldname': u'naming_series',
+ 'fieldtype': u'Select',
+ 'label': u'Series',
'no_copy': 1,
- 'options': '\nCUST\nCUSTMUM\nCUSTOM',
+ 'options': u'\nCUST\nCUSTMUM',
'permlevel': 0,
'print_hide': 0
},
# DocField
{
- 'colour': 'White:FFF',
- 'description': 'Fetch lead which will be converted into customer.',
- 'doctype': 'DocField',
- 'fieldname': 'lead_name',
- 'fieldtype': 'Link',
+ 'colour': u'White:FFF',
+ 'description': u'Fetch lead which will be converted into customer.',
+ 'doctype': u'DocField',
+ 'fieldname': u'lead_name',
+ 'fieldtype': u'Link',
'hidden': 0,
- 'idx': 5,
'in_filter': 1,
- 'label': 'Lead Ref',
+ 'label': u'Lead Ref',
'no_copy': 1,
- 'oldfieldname': 'lead_name',
- 'oldfieldtype': 'Link',
- 'options': 'Lead',
+ 'oldfieldname': u'lead_name',
+ 'oldfieldtype': u'Link',
+ 'options': u'Lead',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1,
- 'trigger': 'Client'
+ 'trigger': u'Client'
},
# DocField
{
- 'doctype': 'DocField',
- 'fieldtype': 'Column Break',
- 'idx': 6,
+ 'doctype': u'DocField',
+ 'fieldtype': u'Column Break',
'permlevel': 0,
- 'width': '50%'
+ 'width': u'50%'
},
# DocField
{
- 'colour': 'White:FFF',
- 'description': 'To manage Customer Groups, click here ',
- 'doctype': 'DocField',
- 'fieldname': 'customer_group',
- 'fieldtype': 'Link',
+ 'colour': u'White:FFF',
+ 'description': u'To manage Customer Groups, click here ',
+ 'doctype': u'DocField',
+ 'fieldname': u'customer_group',
+ 'fieldtype': u'Link',
'hidden': 0,
- 'idx': 7,
'in_filter': 1,
- 'label': 'Customer Group',
- 'oldfieldname': 'customer_group',
- 'oldfieldtype': 'Link',
- 'options': 'Customer Group',
+ 'label': u'Customer Group',
+ 'oldfieldname': u'customer_group',
+ 'oldfieldtype': u'Link',
+ 'options': u'Customer Group',
'permlevel': 0,
'print_hide': 0,
'reqd': 1,
'search_index': 1,
- 'trigger': 'Client'
+ 'trigger': u'Client'
},
# DocField
{
- 'colour': 'White:FFF',
- 'description': 'To manage Territory, click here ',
- 'doctype': 'DocField',
- 'fieldname': 'territory',
- 'fieldtype': 'Link',
- 'idx': 8,
- 'label': 'Territory',
- 'oldfieldname': 'territory',
- 'oldfieldtype': 'Link',
- 'options': 'Territory',
+ 'colour': u'White:FFF',
+ 'description': u'To manage Territory, click here ',
+ 'doctype': u'DocField',
+ 'fieldname': u'territory',
+ 'fieldtype': u'Link',
+ 'label': u'Territory',
+ 'oldfieldname': u'territory',
+ 'oldfieldtype': u'Link',
+ 'options': u'Territory',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
- 'trigger': 'Client'
+ 'trigger': u'Client'
},
# DocField
{
- 'colour': 'White:FFF',
- 'doctype': 'DocField',
- 'fieldtype': 'Section Break',
- 'idx': 9,
- 'label': 'Address & Contacts',
+ 'colour': u'White:FFF',
+ 'doctype': u'DocField',
+ 'fieldtype': u'Section Break',
+ 'label': u'Address & Contacts',
'permlevel': 0
},
# DocField
{
- 'colour': 'White:FFF',
- 'depends_on': 'eval:doc.__islocal',
- 'doctype': 'DocField',
- 'fieldtype': 'HTML',
- 'idx': 10,
- 'label': 'Address Desc',
- 'options': 'Addresses will appear only when you save the customer ',
+ 'colour': u'White:FFF',
+ 'depends_on': u'eval:doc.__islocal',
+ 'doctype': u'DocField',
+ 'fieldtype': u'HTML',
+ 'label': u'Address Desc',
+ 'options': u'Addresses will appear only when you save the customer ',
'permlevel': 0
},
# DocField
{
- 'colour': 'White:FFF',
- 'doctype': 'DocField',
- 'fieldtype': 'HTML',
- 'idx': 11,
- 'label': 'Address HTML',
+ 'colour': u'White:FFF',
+ 'doctype': u'DocField',
+ 'fieldtype': u'HTML',
+ 'label': u'Address HTML',
'permlevel': 1
},
# DocField
{
- 'doctype': 'DocField',
- 'fieldtype': 'Column Break',
- 'idx': 12,
+ 'doctype': u'DocField',
+ 'fieldtype': u'Column Break',
'permlevel': 0,
- 'width': '50%'
+ 'width': u'50%'
},
# DocField
{
- 'colour': 'White:FFF',
- 'depends_on': 'eval:doc.__islocal',
- 'doctype': 'DocField',
- 'fieldtype': 'HTML',
- 'idx': 13,
- 'label': 'Contact Desc',
- 'options': 'Contact Details will appear only when you save the customer ',
+ 'colour': u'White:FFF',
+ 'depends_on': u'eval:doc.__islocal',
+ 'doctype': u'DocField',
+ 'fieldtype': u'HTML',
+ 'label': u'Contact Desc',
+ 'options': u'Contact Details will appear only when you save the customer ',
'permlevel': 0
},
# DocField
{
- 'colour': 'White:FFF',
- 'doctype': 'DocField',
- 'fieldtype': 'HTML',
- 'idx': 14,
- 'label': 'Contact HTML',
- 'oldfieldtype': 'HTML',
+ 'colour': u'White:FFF',
+ 'doctype': u'DocField',
+ 'fieldtype': u'HTML',
+ 'label': u'Contact HTML',
+ 'oldfieldtype': u'HTML',
'permlevel': 1
},
# DocField
{
- 'colour': 'White:FFF',
- 'doctype': 'DocField',
- 'fieldtype': 'Section Break',
- 'idx': 15,
- 'label': 'More Info',
- 'oldfieldtype': 'Section Break',
+ 'colour': u'White:FFF',
+ 'doctype': u'DocField',
+ 'fieldtype': u'Section Break',
+ 'label': u'More Info',
+ 'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
- 'colour': 'White:FFF',
- 'description': 'To create an Account Head under a different company, then set the company and click the button below.',
- 'doctype': 'DocField',
- 'fieldname': 'company',
- 'fieldtype': 'Link',
- 'idx': 16,
+ 'doctype': u'DocField',
+ 'fieldtype': u'Column Break',
+ 'permlevel': 0,
+ 'width': u'50%'
+ },
+
+ # DocField
+ {
+ 'colour': u'White:FFF',
+ 'description': u'To create an Account Head under a different company, select the company and save customer.',
+ 'doctype': u'DocField',
+ 'fieldname': u'company',
+ 'fieldtype': u'Link',
'in_filter': 1,
- 'label': 'Company',
- 'oldfieldname': 'company',
- 'oldfieldtype': 'Link',
- 'options': 'Company',
+ 'label': u'Company',
+ 'oldfieldname': u'company',
+ 'oldfieldtype': u'Link',
+ 'options': u'Company',
'permlevel': 0,
'reqd': 1,
- 'search_index': 0
+ 'search_index': 1
},
# DocField
{
- 'colour': 'White:FFF',
- 'description': "Your Customer's TAX registration numbers (if applicable) or any general information",
- 'doctype': 'DocField',
- 'fieldname': 'customer_details',
- 'fieldtype': 'Text',
- 'idx': 17,
- 'label': 'Customer Details',
- 'oldfieldname': 'customer_details',
- 'oldfieldtype': 'Code',
+ 'colour': u'White:FFF',
+ 'description': u"Your Customer's TAX registration numbers (if applicable) or any general information",
+ 'doctype': u'DocField',
+ 'fieldname': u'customer_details',
+ 'fieldtype': u'Text',
+ 'label': u'Customer Details',
+ 'oldfieldname': u'customer_details',
+ 'oldfieldtype': u'Code',
'permlevel': 0
},
# DocField
{
- 'doctype': 'DocField',
- 'fieldtype': 'Column Break',
- 'idx': 18,
+ 'doctype': u'DocField',
+ 'fieldtype': u'Column Break',
'permlevel': 0,
- 'width': '50%'
+ 'width': u'50%'
},
# DocField
{
- 'doctype': 'DocField',
- 'fieldname': 'credit_days',
- 'fieldtype': 'Int',
- 'idx': 19,
- 'label': 'Credit Days',
- 'oldfieldname': 'credit_days',
- 'oldfieldtype': 'Int',
+ 'doctype': u'DocField',
+ 'fieldname': u'credit_days',
+ 'fieldtype': u'Int',
+ 'label': u'Credit Days',
+ 'oldfieldname': u'credit_days',
+ 'oldfieldtype': u'Int',
'permlevel': 0
},
# DocField
{
- 'doctype': 'DocField',
- 'fieldname': 'credit_limit',
- 'fieldtype': 'Currency',
- 'idx': 20,
- 'label': 'Credit Limit',
- 'oldfieldname': 'credit_limit',
- 'oldfieldtype': 'Currency',
+ 'doctype': u'DocField',
+ 'fieldname': u'credit_limit',
+ 'fieldtype': u'Currency',
+ 'label': u'Credit Limit',
+ 'oldfieldname': u'credit_limit',
+ 'oldfieldtype': u'Currency',
'permlevel': 0
},
# DocField
{
- 'doctype': 'DocField',
- 'fieldname': 'website',
- 'fieldtype': 'Data',
- 'idx': 21,
- 'label': 'Website',
+ 'doctype': u'DocField',
+ 'fieldname': u'website',
+ 'fieldtype': u'Data',
+ 'label': u'Website',
'permlevel': 0
},
# DocField
{
- 'doctype': 'DocField',
- 'fieldtype': 'Section Break',
- 'idx': 22,
- 'label': 'Sales Team',
- 'oldfieldtype': 'Section Break',
+ 'doctype': u'DocField',
+ 'fieldtype': u'Section Break',
+ 'label': u'Sales Team',
+ 'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
- 'doctype': 'DocField',
- 'fieldname': 'default_sales_partner',
- 'fieldtype': 'Link',
- 'idx': 23,
- 'label': 'Default Sales Partner',
- 'oldfieldname': 'default_sales_partner',
- 'oldfieldtype': 'Link',
- 'options': 'Sales Partner',
+ 'doctype': u'DocField',
+ 'fieldname': u'default_sales_partner',
+ 'fieldtype': u'Link',
+ 'label': u'Default Sales Partner',
+ 'oldfieldname': u'default_sales_partner',
+ 'oldfieldtype': u'Link',
+ 'options': u'Sales Partner',
'permlevel': 0
},
# DocField
{
- 'doctype': 'DocField',
- 'fieldname': 'default_commission_rate',
- 'fieldtype': 'Currency',
- 'idx': 24,
- 'label': 'Default Commission Rate',
- 'oldfieldname': 'default_commission_rate',
- 'oldfieldtype': 'Currency',
+ 'doctype': u'DocField',
+ 'fieldname': u'default_commission_rate',
+ 'fieldtype': u'Currency',
+ 'label': u'Default Commission Rate',
+ 'oldfieldname': u'default_commission_rate',
+ 'oldfieldtype': u'Currency',
'permlevel': 0
},
# DocField
{
- 'doctype': 'DocField',
- 'fieldname': 'sales_team',
- 'fieldtype': 'Table',
- 'idx': 25,
- 'label': 'Sales Team Details',
- 'oldfieldname': 'sales_team',
- 'oldfieldtype': 'Table',
- 'options': 'Sales Team',
+ 'doctype': u'DocField',
+ 'fieldname': u'sales_team',
+ 'fieldtype': u'Table',
+ 'label': u'Sales Team Details',
+ 'oldfieldname': u'sales_team',
+ 'oldfieldtype': u'Table',
+ 'options': u'Sales Team',
'permlevel': 0
},
# DocField
{
- 'colour': 'White:FFF',
- 'depends_on': 'eval:!doc.__islocal',
- 'doctype': 'DocField',
- 'fieldtype': 'Section Break',
- 'idx': 26,
- 'label': 'Transaction History',
+ 'colour': u'White:FFF',
+ 'depends_on': u'eval:!doc.__islocal',
+ 'doctype': u'DocField',
+ 'fieldtype': u'Section Break',
+ 'label': u'Transaction History',
'permlevel': 0
},
# DocField
{
- 'colour': 'White:FFF',
- 'depends_on': 'eval:!doc.__islocal',
- 'doctype': 'DocField',
- 'fieldtype': 'HTML',
- 'idx': 27,
- 'label': 'History HTML',
+ 'colour': u'White:FFF',
+ 'depends_on': u'eval:!doc.__islocal',
+ 'doctype': u'DocField',
+ 'fieldtype': u'HTML',
+ 'label': u'History HTML',
'permlevel': 0
},
# DocField
{
- 'colour': 'White:FFF',
- 'doctype': 'DocField',
- 'fieldname': 'trash_reason',
- 'fieldtype': 'Small Text',
- 'idx': 28,
- 'label': 'Trash Reason',
- 'oldfieldname': 'trash_reason',
- 'oldfieldtype': 'Small Text',
+ 'colour': u'White:FFF',
+ 'doctype': u'DocField',
+ 'fieldname': u'trash_reason',
+ 'fieldtype': u'Small Text',
+ 'label': u'Trash Reason',
+ 'oldfieldname': u'trash_reason',
+ 'oldfieldtype': u'Small Text',
'permlevel': 1
}
]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index 2a130a59cb..7f40782d0c 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -50,8 +50,11 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
}
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
- // defined in sales_common.js
- cur_frm.cscript.update_item_details(doc, cdt, cdn);
+ var callback = function(doc, dt, dn) {
+ // defined in sales_common.js
+ cur_frm.cscript.update_item_details(doc, dt, dn);
+ }
+ cur_frm.cscript.hide_price_list_currency(doc, dt, dn, callback);
}
// hide - unhide fields based on lead or customer..
@@ -83,10 +86,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.clear_custom_buttons();
- var callback = function() {
- cur_frm.cscript.dynamic_label(doc, cdt, cdn);
- }
- cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn, callback);
+ if (!cur_frm.cscript.is_onload) cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn);
if(doc.docstatus == 1 && doc.status!='Order Lost') {
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index 531de21ed4..de4056d2d6 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -77,14 +77,16 @@ class DocType(TransactionBase):
# Get Item Details
# -----------------
def get_item_details(self, args=None):
- args = eval(args)
- if args['item_code']:
+ args = args and eval(args) or {}
+ if args.get('item_code'):
return get_obj('Sales Common').get_item_details(args, self)
else:
obj = get_obj('Sales Common')
for doc in self.doclist:
if doc.fields.get('item_code'):
- ret = obj.get_item_details(doc.item_code, self)
+ arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
+ 'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
+ ret = obj.get_item_details(arg, self)
for r in ret:
if not doc.fields.get(r):
doc.fields[r] = ret[r]
@@ -96,11 +98,6 @@ class DocType(TransactionBase):
get_obj('Sales Common').get_adj_percent(self)
- def get_comp_base_currency(self):
- return get_obj('Sales Common').get_comp_base_currency(self.doc.company)
-
- def get_price_list_currency(self):
- return get_obj('Sales Common').get_price_list_currency(self.doc.price_list_name, self.doc.company)
# OTHER CHARGES TRIGGER FUNCTIONS
diff --git a/erpnext/selling/doctype/quotation/quotation.txt b/erpnext/selling/doctype/quotation/quotation.txt
index 07642e8a23..32784a8dcb 100644
--- a/erpnext/selling/doctype/quotation/quotation.txt
+++ b/erpnext/selling/doctype/quotation/quotation.txt
@@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:17',
'docstatus': 0,
- 'modified': '2012-02-27 17:14:54',
+ 'modified': '2012-03-02 12:20:40',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -41,7 +41,7 @@
'show_in_menu': 0,
'subject': u'To %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s',
'tag_fields': u'status',
- 'version': 617
+ 'version': 618
},
# These values are common for all DocFormat
@@ -675,18 +675,6 @@
'width': u'100px'
},
- # DocField
- {
- 'colour': u'White:FFF',
- 'doctype': u'DocField',
- 'fieldtype': u'HTML',
- 'label': u'Note HTML',
- 'oldfieldtype': u'HTML',
- 'options': u'Note : * In Base Currency\n
',
- 'permlevel': 0,
- 'print_hide': 1
- },
-
# DocField
{
'colour': u'White:FFF',
diff --git a/erpnext/selling/doctype/quotation_detail/quotation_detail.txt b/erpnext/selling/doctype/quotation_detail/quotation_detail.txt
index 8c78f48e43..81bf64de9f 100644
--- a/erpnext/selling/doctype/quotation_detail/quotation_detail.txt
+++ b/erpnext/selling/doctype/quotation_detail/quotation_detail.txt
@@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:18',
'docstatus': 0,
- 'modified': '2012-02-24 13:21:21',
+ 'modified': '2012-03-05 10:48:27',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -23,7 +23,7 @@
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
- 'version': 30
+ 'version': 32
},
# These values are common for all DocField
@@ -94,18 +94,33 @@
{
'default': u'0.00',
'doctype': u'DocField',
- 'fieldname': u'ref_rate',
+ 'fieldname': u'qty',
'fieldtype': u'Currency',
- 'label': u'Price List Rate',
- 'oldfieldname': u'ref_rate',
+ 'in_filter': 0,
+ 'label': u'Quantity',
+ 'oldfieldname': u'qty',
'oldfieldtype': u'Currency',
'permlevel': 0,
- 'print_hide': 1,
- 'reqd': 0,
+ 'print_hide': 0,
+ 'reqd': 1,
+ 'search_index': 0,
'trigger': u'Client',
'width': u'100px'
},
+ # DocField
+ {
+ 'doctype': u'DocField',
+ 'fieldname': u'base_ref_rate',
+ 'fieldtype': u'Currency',
+ 'label': u'Price List Rate*',
+ 'oldfieldname': u'base_ref_rate',
+ 'oldfieldtype': u'Currency',
+ 'permlevel': 1,
+ 'print_hide': 1,
+ 'width': u'100px'
+ },
+
# DocField
{
'default': u'0.00',
@@ -116,7 +131,59 @@
'oldfieldname': u'adj_rate',
'oldfieldtype': u'Float',
'permlevel': 0,
- 'print_hide': 0,
+ 'print_hide': 1,
+ 'trigger': u'Client',
+ 'width': u'100px'
+ },
+
+ # DocField
+ {
+ 'default': u'0.00',
+ 'doctype': u'DocField',
+ 'fieldname': u'basic_rate',
+ 'fieldtype': u'Currency',
+ 'in_filter': 0,
+ 'label': u'Basic Rate*',
+ 'oldfieldname': u'basic_rate',
+ 'oldfieldtype': u'Currency',
+ 'permlevel': 0,
+ 'print_hide': 1,
+ 'reqd': 0,
+ 'search_index': 0,
+ 'trigger': u'Client',
+ 'width': u'100px'
+ },
+
+ # DocField
+ {
+ 'default': u'0.00',
+ 'doctype': u'DocField',
+ 'fieldname': u'amount',
+ 'fieldtype': u'Currency',
+ 'in_filter': 0,
+ 'label': u'Amount*',
+ 'oldfieldname': u'amount',
+ 'oldfieldtype': u'Currency',
+ 'permlevel': 1,
+ 'print_hide': 1,
+ 'reqd': 0,
+ 'search_index': 0,
+ 'trigger': u'Client',
+ 'width': u'100px'
+ },
+
+ # DocField
+ {
+ 'default': u'0.00',
+ 'doctype': u'DocField',
+ 'fieldname': u'ref_rate',
+ 'fieldtype': u'Currency',
+ 'label': u'Price List Rate',
+ 'oldfieldname': u'ref_rate',
+ 'oldfieldtype': u'Currency',
+ 'permlevel': 0,
+ 'print_hide': 1,
+ 'reqd': 0,
'trigger': u'Client',
'width': u'100px'
},
@@ -139,24 +206,6 @@
'width': u'100px'
},
- # DocField
- {
- 'default': u'0.00',
- 'doctype': u'DocField',
- 'fieldname': u'qty',
- 'fieldtype': u'Currency',
- 'in_filter': 0,
- 'label': u'Quantity',
- 'oldfieldname': u'qty',
- 'oldfieldtype': u'Currency',
- 'permlevel': 0,
- 'print_hide': 0,
- 'reqd': 1,
- 'search_index': 0,
- 'trigger': u'Client',
- 'width': u'100px'
- },
-
# DocField
{
'default': u'0.00',
@@ -174,37 +223,6 @@
'width': u'100px'
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'base_ref_rate',
- 'fieldtype': u'Currency',
- 'label': u'Price List Rate*',
- 'oldfieldname': u'base_ref_rate',
- 'oldfieldtype': u'Currency',
- 'permlevel': 1,
- 'print_hide': 1,
- 'width': u'100px'
- },
-
- # DocField
- {
- 'default': u'0.00',
- 'doctype': u'DocField',
- 'fieldname': u'basic_rate',
- 'fieldtype': u'Currency',
- 'in_filter': 0,
- 'label': u'Basic Rate*',
- 'oldfieldname': u'basic_rate',
- 'oldfieldtype': u'Currency',
- 'permlevel': 0,
- 'print_hide': 1,
- 'reqd': 0,
- 'search_index': 0,
- 'trigger': u'Client',
- 'width': u'100px'
- },
-
# DocField
{
'colour': u'White:FFF',
@@ -220,24 +238,6 @@
'width': u'100px'
},
- # DocField
- {
- 'default': u'0.00',
- 'doctype': u'DocField',
- 'fieldname': u'amount',
- 'fieldtype': u'Currency',
- 'in_filter': 0,
- 'label': u'Amount*',
- 'oldfieldname': u'amount',
- 'oldfieldtype': u'Currency',
- 'permlevel': 1,
- 'print_hide': 1,
- 'reqd': 0,
- 'search_index': 0,
- 'trigger': u'Client',
- 'width': u'100px'
- },
-
# DocField
{
'doctype': u'DocField',
diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js
index 5d88c3034b..97b20eb702 100644
--- a/erpnext/selling/doctype/sales_common/sales_common.js
+++ b/erpnext/selling/doctype/sales_common/sales_common.js
@@ -26,13 +26,15 @@ cur_frm.cscript.load_taxes = function(doc, cdt, cdn, callback) {
// run if this is not executed from dt_map...
doc = locals[doc.doctype][doc.name];
if(doc.customer || getchildren('RV Tax Detail', doc.name, 'other_charges', doc.doctype).length) {
- if(callback) callback(doc, cdt, cdn);
- return;
+ if(callback) {
+ callback(doc, cdt, cdn);
+ }
+ } else {
+ $c_obj([doc],'load_default_taxes','',function(r,rt){
+ refresh_field('other_charges');
+ if(callback) callback(doc, cdt, cdn);
+ });
}
- $c_obj([doc],'load_default_taxes','',function(r,rt){
- refresh_field('other_charges');
- if(callback) callback(doc, cdt, cdn);
- });
}
@@ -75,7 +77,6 @@ cur_frm.cscript.update_item_details = function(doc, dt, dn, callback) {
-
// ============== Customer and its primary contact Details ============================
cur_frm.cscript.customer = function(doc, cdt, cdn) {
if(doc.customer){
@@ -120,7 +121,9 @@ var set_dynamic_label_child = function(doc, cdt, cdn, base_curr) {
for (d in item_cols_export) $('[data-grid-fieldname="'+cur_frm.cscript.tname+'-'+d+'"]').html(item_cols_export[d]+' ('+doc.currency+')');
var hide = (doc.currency == sys_defaults['currency']) ? false : true;
- for (f in item_cols_base) cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp(f, hide);
+ for (f in item_cols_export) {
+ cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp(f, hide);
+ }
//tax table flds
tax_cols = {'tax_amount': 'Amount', 'total': 'Total'};
@@ -136,17 +139,11 @@ var set_dynamic_label_child = function(doc, cdt, cdn, base_curr) {
// Change label dynamically based on currency
//------------------------------------------------------------------
-cur_frm.cscript.dynamic_label = function(doc, cdt, cdn) {
- var callback = function(r, rt) {
- if (r.message) base_curr = r.message;
- else base_curr = sys_defaults['currency'];
+cur_frm.cscript.dynamic_label = function(doc, cdt, cdn, base_curr, callback) {
+ set_dynamic_label_par(doc, cdt, cdn, base_curr);
+ set_dynamic_label_child(doc, cdt, cdn, base_curr);
- set_dynamic_label_par(doc, cdt, cdn, base_curr);
- set_dynamic_label_child(doc, cdt, cdn, base_curr);
- }
-
- if (doc.company == sys_defaults['company']) callback('', '');
- else $c_obj(make_doclist(doc.doctype, doc.name), 'get_comp_base_currency', '', callback);
+ if (callback) callback(doc, cdt, cdn);
}
@@ -155,27 +152,30 @@ cur_frm.cscript.dynamic_label = function(doc, cdt, cdn) {
cur_frm.cscript.hide_price_list_currency = function(doc, cdt, cdn, callback1) {
if (doc.price_list_name && doc.currency) {
- var callback = function(r, rt) {
- pl_currency = r.message[0]?r.message[0]:[];
- if (pl_currency.length==1) {
- if (pl_currency[0] == doc.currency) set_multiple(cdt, cdn, {price_list_currency:doc.currency, plc_conversion_rate:doc.conversion_rate});
- else if (pl_currency[0] = r.message[1]) set_multiple(cdt, cdn, {price_list_currency:pl_currency[0], plc_conversion_rate:1})
- hide_field(['price_list_currency', 'plc_conversion_rate']);
- } else unhide_field(['price_list_currency', 'plc_conversion_rate']);
+ wn.call({
+ method: 'selling.doctype.sales_common.sales_common.get_price_list_currency',
+ args: {'price_list':doc.price_list_name, 'company': doc.company},
+ callback: function(r, rt) {
+ pl_currency = r.message[0]?r.message[0]:[];
+ if (pl_currency.length==1) {
+ if (pl_currency[0] == doc.currency) set_multiple(cdt, cdn, {price_list_currency:doc.currency, plc_conversion_rate:doc.conversion_rate});
+ else if (pl_currency[0] = r.message[1]) set_multiple(cdt, cdn, {price_list_currency:pl_currency[0], plc_conversion_rate:1})
+ hide_field(['price_list_currency', 'plc_conversion_rate']);
+ } else unhide_field(['price_list_currency', 'plc_conversion_rate']);
- if (r.message[1] == doc.currency) {
- set_multiple(cdt, cdn, {conversion_rate:1});
- hide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
- } else unhide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
+ if (r.message[1] == doc.currency) {
+ set_multiple(cdt, cdn, {conversion_rate:1});
+ hide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
+ } else unhide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
- if (r.message[1] == doc.price_list_currency) {
- set_multiple(cdt, cdn, {plc_conversion_rate:1});
- hide_field('plc_conversion_rate');
- } else unhide_field('plc_conversion_rate');
-
- callback1()
- }
- $c_obj(make_doclist(doc.doctype, doc.name), 'get_price_list_currency', '', callback);
+ if (r.message[1] == doc.price_list_currency) {
+ set_multiple(cdt, cdn, {plc_conversion_rate:1});
+ hide_field('plc_conversion_rate');
+ } else unhide_field('plc_conversion_rate');
+
+ cur_frm.cscript.dynamic_label(doc, cdt, cdn, r.message[1], callback1);
+ }
+ })
}
}
@@ -213,12 +213,15 @@ cur_frm.cscript.conversion_rate = cur_frm.cscript.currency;
cur_frm.cscript.plc_conversion_rate = cur_frm.cscript.currency;
cur_frm.cscript.company = function(doc, dt, dn) {
- var callback = function(r, rt) {
- var doc = locals[dt][dn];
- set_multiple(doc.doctype, doc.name, {currency:r.message,price_list_currency:r.message});
- cur_frm.cscript.currency(doc, cdt, cdn);
- }
- $c_obj(make_doclist(doc.doctype, doc.name), 'get_comp_base_currency', '', callback);
+ wn.call({
+ method: 'selling.doctype.sales_common.sales_common.get_comp_base_currency',
+ args: {company:doc.company},
+ callback: function(r, rt) {
+ var doc = locals[dt][dn];
+ set_multiple(doc.doctype, doc.name, {currency:r.message, price_list_currency:r.message});
+ cur_frm.cscript.currency(doc, cdt, cdn);
+ }
+ });
}
@@ -234,7 +237,6 @@ cur_frm.cscript.price_list_name = function(doc, cdt, cdn) {
refresh_field(fname);
var doc = locals[cdt][cdn];
cur_frm.cscript.recalc(doc,3); //this is to re-calculate BASIC RATE and AMOUNT on basis of changed REF RATE
- cur_frm.cscript.dynamic_label(doc, cdt, cdn);
}
);
}
@@ -557,11 +559,9 @@ cur_frm.cscript.consider_incl_rate = function(doc, other_fname) {
var tax_list = getchildren('RV Tax Detail', doc.name, other_fname, doc.doctype);
for(var i=0; i .
+# along with this program. If not, see .
# Please edit this list and import only required elements
import webnotes
@@ -34,30 +34,36 @@ convert_to_lists = webnotes.conn.convert_to_lists
class DocType:
- def __init__(self,d,dl):
- self.doc, self.doclist = d,dl
- self.nsm_parent_field = 'parent_item_group';
+ def __init__(self,d,dl):
+ self.doc, self.doclist = d,dl
+ self.nsm_parent_field = 'parent_item_group';
- # update Node Set Model
- def update_nsm_model(self):
- import webnotes
- import webnotes.utils.nestedset
- webnotes.utils.nestedset.update_nsm(self)
+ # update Node Set Model
+ def update_nsm_model(self):
+ import webnotes
+ import webnotes.utils.nestedset
+ webnotes.utils.nestedset.update_nsm(self)
- # ON UPDATE
- #--------------------------------------
- def on_update(self):
- # update nsm
- self.update_nsm_model()
+ # ON UPDATE
+ #--------------------------------------
+ def on_update(self):
+ # update nsm
+ self.update_nsm_model()
- def validate(self):
- if self.doc.lft and self.doc.rgt:
- res = sql("select name from `tabItem Group` where is_group = 'Yes' and docstatus!= 2 and (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(self.doc.rgt,self.doc.lft,self.doc.parent_item_group,self.doc.item_group_name))
- if not res:
- msgprint("Please enter proper parent item group.")
- raise Exception
-
- r = sql("select name from `tabItem Group` where name = '%s' and docstatus = 2"%(self.doc.item_group_name))
- if r:
- msgprint("'%s' record is trashed. To untrash please go to Setup & click on Trash."%(self.doc.item_group_name))
- raise Exception
\ No newline at end of file
+ def validate(self):
+ if self.doc.lft and self.doc.rgt:
+ res = sql("select name from `tabItem Group` where is_group = 'Yes' and docstatus!= 2 and (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(self.doc.rgt,self.doc.lft,self.doc.parent_item_group,self.doc.item_group_name))
+ if not res:
+ msgprint("Please enter proper parent item group.")
+ raise Exception
+
+ r = sql("select name from `tabItem Group` where name = '%s' and docstatus = 2"%(self.doc.item_group_name))
+ if r:
+ msgprint("'%s' record is trashed. To untrash please go to Setup & click on Trash."%(self.doc.item_group_name))
+ raise Exception
+
+ def on_trash(self):
+ ig = sql("select name from `tabItem` where ifnull(item_group, '') = %s", self.doc.name)
+ if ig:
+ msgprint("""Item Group: %s can not be trashed/deleted because it is used in item: %s.
+ To trash/delete this, remove/change item group in item master""" % (self.doc.name, ig[0][0] or ''), raise_exception=1)
diff --git a/erpnext/setup/doctype/setup_control/setup_control.py b/erpnext/setup/doctype/setup_control/setup_control.py
index beb3cc66f1..50b9bb03cb 100644
--- a/erpnext/setup/doctype/setup_control/setup_control.py
+++ b/erpnext/setup/doctype/setup_control/setup_control.py
@@ -14,24 +14,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-# Please edit this list and import only required elements
import webnotes
-from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
-from webnotes.model.doclist import getlist, copy_doclist
-from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
-from webnotes import session, form, is_testing, msgprint, errprint
+from webnotes.utils import cint, cstr, flt, getdate, now, nowdate
+from webnotes.model.doc import Document, addchild
+from webnotes.model.code import get_obj
+from webnotes import session, form, msgprint
-set = webnotes.conn.set
sql = webnotes.conn.sql
-get_value = webnotes.conn.get_value
-in_transaction = webnotes.conn.in_transaction
-convert_to_lists = webnotes.conn.convert_to_lists
-
-# -----------------------------------------------------------------------------------------
-
class DocType:
def __init__(self, d, dl):
@@ -58,8 +48,8 @@ class DocType:
args = json.loads(args)
self.set_cp_defaults(args['company'], args['industry'], args['time_zone'], args['country'], args['account_name'])
- self.create_profile(args['user'], args['first_name'], args['last_name'], args.get('pwd'))
-
+ self.create_profile(args['user'], args['first_name'], args['last_name'], args.get('pwd'))
+
# Domain related updates
try:
from server_tools.gateway_utils import add_domain_map
@@ -68,38 +58,48 @@ class DocType:
pass
# add record in domain_list of Website Settings
- webnotes.conn.set_value('Website Settings', 'Website Settings', 'subdomain', args['url_name'] + ".erpnext.com")
+ account_url = args['url_name'] + '.erpnext.com'
+ webnotes.conn.set_value('Website Settings', 'Website Settings',
+ 'subdomain', account_url)
# Account Setup
# ---------------
def setup_account(self, 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)
- self.currency = currency
+ import webnotes, json
+ args = json.loads(args)
+
+ curr_fiscal_year, fy_start_date, fy_abbr = self.get_fy_details(args.get('fy_start'))
+
+ args['name'] = webnotes.session.get('user')
# Update Profile
- if last_name=='None': last_name = None
+ if not args.get('last_name') or args.get('last_name')=='None': args['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))
+ UPDATE `tabProfile` SET first_name=%(first_name)s,
+ last_name=%(last_name)s
+ WHERE name=%(name)s AND docstatus<2""", args)
# 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,
+ 'abbreviation': fy_abbr,
+ 'company': args.get('company_name'),
+ 'is_fiscal_year_closed': 'No'}}
self.create_records(master_dict)
# Company
- master_dict = {'Company':{'company_name':company_name,
- 'abbr':comp_abbr,
- 'default_currency':currency
- }}
+ master_dict = {'Company':{'company_name':args.get('company_name'),
+ 'abbr':args.get('company_abbr'),
+ 'default_currency':args.get('currency')
+ }}
self.create_records(master_dict)
def_args = {'current_fiscal_year':curr_fiscal_year,
- 'default_currency': currency,
- 'default_company':company_name,
+ 'default_currency': args.get('currency'),
+ 'default_company':args.get('company_name'),
'default_valuation_method':'FIFO',
'default_stock_uom':'Nos',
'date_format':'dd-mm-yyyy',
@@ -111,21 +111,51 @@ class DocType:
'emp_created_by':'Naming Series',
'cust_master_name':'Customer Name',
'supp_master_name':'Supplier Name',
- 'default_currency_format': (currency=='INR') and 'Lacs' or 'Millions'
+ 'default_currency_format': \
+ (args.get('currency')=='INR') and 'Lacs' or 'Millions'
}
# Set
self.set_defaults(def_args)
- # Set Registration Complete
- set_default('registration_complete','1')
+ self.create_feed_and_todo()
- msgprint("Great! Your company has now been created")
+ webnotes.clear_cache()
+ msgprint("Company setup is complete")
import webnotes.utils
- user_fullname = (first_name or '') + (last_name and (" " + last_name) or '')
+ user_fullname = (args.get('first_name') or '') + (args.get('last_name')
+ and (" " + args.get('last_name')) or '')
return {'sys_defaults': webnotes.utils.get_defaults(), 'user_fullname': user_fullname}
+ def create_feed_and_todo(self):
+ """update activty feed and create todo for creation of item, customer, vendor"""
+ import home
+ home.make_feed('Comment', 'ToDo Item', '', webnotes.session['user'],
+ '"' + 'Setup Complete. Please check your \
+ To Do List ' + '" ', '#6B24B3')
+
+ d = Document('ToDo Item')
+ d.description = 'Create your first Customer'
+ d.priority = 'High'
+ d.date = nowdate()
+ d.reference_type = 'Customer'
+ d.save(1)
+
+ d = Document('ToDo Item')
+ d.description = 'Create your first Item'
+ d.priority = 'High'
+ d.date = nowdate()
+ d.reference_type = 'Item'
+ d.save(1)
+
+ d = Document('ToDo Item')
+ d.description = 'Create your first Supplier'
+ d.priority = 'High'
+ d.date = nowdate()
+ d.reference_type = 'Supplier'
+ d.save(1)
+
# Get Fiscal year Details
# ------------------------
@@ -138,9 +168,11 @@ class DocType:
#eddt = sql("select DATE_FORMAT(DATE_SUB(DATE_ADD('%s', INTERVAL 1 YEAR), INTERVAL 1 DAY),'%%d-%%m-%%Y')" % (stdt.split('-')[2]+ '-' + stdt.split('-')[1] + '-' + stdt.split('-')[0]))
if(fy_start == '1st Jan'):
fy = cstr(getdate(nowdate()).year)
+ abbr = cstr(fy)[-2:]
else:
fy = cstr(curr_year) + '-' + cstr(curr_year+1)
- return fy,stdt
+ abbr = cstr(curr_year)[-2:] + '-' + cstr(curr_year+1)[-2:]
+ return fy, stdt, abbr
# Create Company and Fiscal Year
@@ -207,14 +239,6 @@ class DocType:
d = addchild(pr,'userroles', 'UserRole', 1)
d.role = r
d.save(1)
-
-
- # Sync DB
- # -------
- def sync_db(arg=''):
- import webnotes.model.db_schema
- sql("delete from `tabDocType Update Register`")
- webnotes.model.db_schema.sync_all()
def is_setup_okay(self, args):
@@ -224,21 +248,14 @@ class DocType:
from server_tools.gateway_utils import get_total_users
- args = eval(args)
- #webnotes.logger.error("args in set_account_details of setup_control: " + str(args))
-
+ args = eval(args)
cp_defaults = webnotes.conn.get_value('Control Panel', None, 'account_id')
-
user_profile = webnotes.conn.get_value('Profile', args['user'], 'name')
from webnotes.utils import cint
total_users = get_total_users()
-
- #webnotes.logger.error("setup_control.is_setup_okay: " + cp_defaults + " " + user_profile + " " + str(total_users))
-
- #webnotes.logger.error("setup_control.is_setup_okay: Passed Values:" + args['account_name'] + " " + args['user'] + " " + str(args['total_users']))
-
+
if (cp_defaults==args['account_name']) and user_profile and \
(total_users==cint(args['total_users'])):
return 'True'
diff --git a/erpnext/setup/doctype/territory/territory.py b/erpnext/setup/doctype/territory/territory.py
index 461b447aa7..8017ad5757 100644
--- a/erpnext/setup/doctype/territory/territory.py
+++ b/erpnext/setup/doctype/territory/territory.py
@@ -74,4 +74,11 @@ class DocType:
for d in getlist(self.doclist, 'target_details'):
if not flt(d.target_qty) and not flt(d.target_amount):
msgprint("Either target qty or target amount is mandatory.")
- raise Exception
\ No newline at end of file
+ raise Exception
+
+
+ def on_trash(self):
+ terr = sql("select name from `tabCustomer` where ifnull(territory, '') = %s", self.doc.name)
+ if terr:
+ msgprint("""Territory: %s can not be trashed/deleted because it is used in territory: %s.
+ To trash/delete this, remove/change territory in customer master""" % (self.doc.name, terr[0][0] or ''), raise_exception=1)
diff --git a/erpnext/setup/page/modules_setup/__init__.py b/erpnext/setup/page/modules_setup/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/erpnext/setup/page/modules_setup/modules_setup.css b/erpnext/setup/page/modules_setup/modules_setup.css
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/erpnext/setup/page/modules_setup/modules_setup.html b/erpnext/setup/page/modules_setup/modules_setup.html
new file mode 100644
index 0000000000..ea136ffcae
--- /dev/null
+++ b/erpnext/setup/page/modules_setup/modules_setup.html
@@ -0,0 +1,14 @@
+
+
×
+
Modules Setup
+
+
+ Select checkbox to show / hide module. Drag around to move order.
+
+
+
+
+ Update
+
+
\ No newline at end of file
diff --git a/erpnext/setup/page/modules_setup/modules_setup.js b/erpnext/setup/page/modules_setup/modules_setup.js
new file mode 100644
index 0000000000..af7522f4ae
--- /dev/null
+++ b/erpnext/setup/page/modules_setup/modules_setup.js
@@ -0,0 +1,50 @@
+wn.require('lib/js/lib/jquery-ui-sortable.min.js');
+
+$.extend(wn.pages.modules_setup, {
+ modules: ['Activity', 'Accounts', 'Selling', 'Buying', 'Stock', 'Production', 'Projects',
+ 'Support', 'HR', 'Website', 'To Do', 'Messages', 'Calendar', 'Knowledge Base'],
+ onload: function(wrapper) {
+ wn.pages.modules_setup.refresh(wn.boot.modules_list);
+ },
+ refresh: function(ml) {
+ $('#modules-list').empty();
+
+ // checked modules
+ for(i in ml) {
+ $('#modules-list').append(repl('\
+ \
+ %(m)s
', {m:ml[i]}));
+ }
+ $('#modules-list [data-module]').attr('checked', true);
+
+ // unchecked modules
+ var all = wn.pages.modules_setup.modules;
+ for(i in all) {
+ if(!$('#modules-list [data-module="'+all[i]+'"]').length) {
+ $('#modules-list').append(repl('\
+ \
+ %(m)s
', {m:all[i]}));
+ }
+ }
+
+ $('#modules-list').sortable();
+
+ },
+ update: function() {
+ var ml = [];
+ $('#modules-list [data-module]').each(function() {
+ if($(this).attr('checked'))
+ ml.push($(this).attr('data-module'));
+ });
+
+ wn.call({
+ method: 'setup.page.modules_setup.modules_setup.update',
+ args: {
+ ml: JSON.stringify(ml)
+ },
+ callback: function(r) {
+ },
+ btn: $('#modules-update').get(0)
+ });
+ }
+});
\ No newline at end of file
diff --git a/erpnext/setup/page/modules_setup/modules_setup.py b/erpnext/setup/page/modules_setup/modules_setup.py
new file mode 100644
index 0000000000..ee36dfaeaa
--- /dev/null
+++ b/erpnext/setup/page/modules_setup/modules_setup.py
@@ -0,0 +1,8 @@
+import webnotes
+
+@webnotes.whitelist()
+def update(arg=None):
+ """update modules"""
+ webnotes.conn.set_global('modules_list', webnotes.form_dict['ml'])
+ webnotes.msgprint('Updated')
+ webnotes.clear_cache()
\ No newline at end of file
diff --git a/erpnext/setup/page/modules_setup/modules_setup.txt b/erpnext/setup/page/modules_setup/modules_setup.txt
new file mode 100644
index 0000000000..70c6a90cc2
--- /dev/null
+++ b/erpnext/setup/page/modules_setup/modules_setup.txt
@@ -0,0 +1,28 @@
+# Page, modules_setup
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-02-28 17:48:39',
+ 'docstatus': 0,
+ 'modified': '2012-02-28 17:48:39',
+ 'modified_by': u'Administrator',
+ 'owner': u'Administrator'
+ },
+
+ # These values are common for all Page
+ {
+ 'doctype': 'Page',
+ 'module': u'Setup',
+ 'name': '__common__',
+ 'page_name': u'modules_setup',
+ 'standard': u'Yes',
+ 'title': u'Modules Setup'
+ },
+
+ # Page, modules_setup
+ {
+ 'doctype': 'Page',
+ 'name': u'modules_setup'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/setup/page/setup/setup.html b/erpnext/setup/page/setup/setup.html
index 7963cb9d9a..50ef112bbb 100644
--- a/erpnext/setup/page/setup/setup.html
+++ b/erpnext/setup/page/setup/setup.html
@@ -20,7 +20,7 @@
Data
diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py
index 5f0cc2334c..7db56bdb53 100644
--- a/erpnext/startup/event_handlers.py
+++ b/erpnext/startup/event_handlers.py
@@ -48,7 +48,7 @@ def on_login_post_session(login_manager):
sid!=%s""", \
(webnotes.session['user'], webnotes.session['sid']), as_list=1)
- if webnotes.session['user'] not in ('Guest') and webnotes.conn.cur_db_name!='accounts':
+ if webnotes.session['user'] not in ('Guest', 'demo@webnotestech.com') and webnotes.conn.cur_db_name!='accounts':
# create feed
from webnotes.utils import nowtime
home.make_feed('Login', 'Profile', login_manager.user, login_manager.user,
@@ -87,6 +87,14 @@ def boot_session(bootinfo):
import webnotes.model.doctype
bootinfo['docs'] += webnotes.model.doctype.get('Event')
+
+ bootinfo['modules_list'] = webnotes.conn.get_global('modules_list')
+
+ # if no company, show a dialog box to create a new company
+ bootinfo['setup_complete'] = webnotes.conn.sql("""select name from
+ tabCompany limit 1""") and 'Yes' or 'No'
+
+ bootinfo['user_background'] = webnotes.conn.get_value("Profile", webnotes.session['user'], 'background_image') or ''
def get_letter_heads():
"""load letter heads with startup"""
diff --git a/erpnext/startup/js/complete_setup.js b/erpnext/startup/js/complete_setup.js
new file mode 100644
index 0000000000..ac89affa5c
--- /dev/null
+++ b/erpnext/startup/js/complete_setup.js
@@ -0,0 +1,93 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see
.
+
+// complete my company registration
+// --------------------------------
+
+erpnext.complete_setup = function() {
+ var currency_list = ['', 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AZN',
+ 'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BRL', 'BSD', 'BTN', 'BYR',
+ 'BZD', 'CAD', 'CDF', 'CFA', 'CFP', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CUC', 'CZK', 'DJF',
+ 'DKK', 'DOP', 'DZD', 'EEK', 'EGP', 'ERN', 'ETB', 'EUR', 'EURO', 'FJD', 'FKP', 'FMG', 'GBP',
+ 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GQE', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF',
+ 'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF',
+ 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LTL', 'LVL', 'LYD',
+ 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR',
+ 'MZM', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NRs', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP',
+ 'PKR', 'PLN', 'PYG', 'QAR', 'RMB', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SCR', 'SDG', 'SDR',
+ 'SEK', 'SGD', 'SHP', 'SOS', 'SRD', 'STD', 'SYP', 'SZL', 'THB', 'TJS', 'TMT', 'TND', 'TRY',
+ 'TTD', 'TWD', 'TZS', 'UAE', 'UAH', 'UGX', 'USD', 'USh', 'UYU', 'UZS', 'VEB', 'VND', 'VUV',
+ 'WST', 'XAF', 'XCD', 'XDR', 'XOF', 'XPF', 'YEN', 'YER', 'YTL', 'ZAR', 'ZMK', 'ZWR'];
+
+ var d = new wn.widgets.Dialog({
+ title: "Setup",
+ fields: [
+ {fieldname:'first_name', label:'Your First Name', fieldtype:'Data', reqd: 1},
+ {fieldname:'last_name', label:'Your Last Name', fieldtype:'Data'},
+ {fieldname:'company_name', label:'Company Name', fieldtype:'Data', reqd:1,
+ description: 'e.g. "My Company LLC"'},
+ {fieldname:'company_abbr', label:'Company Abbreviation', fieldtype:'Data',
+ description:'e.g. "MC"',reqd:1},
+ {fieldname:'fy_start', label:'Financial Year Start Date', fieldtype:'Select',
+ description:'Your financial year begins on"', reqd:1,
+ options: ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct'].join('\n')},
+ {fieldname:'currency', label: 'Default Currency', reqd:1,
+ options: currency_list.join('\n'), fieldtype: 'Select'},
+ {fieldname:'update', label:'Setup',fieldtype:'Button'}
+ ]
+ })
+
+ // prepare
+ if(user != 'Administrator'){
+ d.no_cancel(); // Hide close image
+ $('header').toggle(false); // hide toolbar
+ }
+
+ // company name already set
+ if(wn.control_panel.company_name) {
+ var inp = d.fields_dict.company_name.input;
+ inp.value = wn.control_panel.company_name;
+ inp.disabled = true;
+ }
+
+ // set first name, last name
+ if(user_fullname) {
+ u = user_fullname.split(' ');
+ if(u[0]) {
+ d.fields_dict.first_name.input.value = u[0];
+ }
+ if(u[1]) {
+ d.fields_dict.last_name.input.value = u[1];
+ }
+ }
+
+ // setup
+ d.fields_dict.update.input.onclick = function() {
+ var data = d.get_values();
+ if(!data) return;
+ $(this).set_working();
+ $c_obj('Setup Control','setup_account',data,function(r, rt){
+ sys_defaults = r.message;
+ user_fullname = r.message.user_fullname;
+ wn.boot.user_info[user].fullname = user_fullname;
+ d.hide();
+ $('header').toggle(true);
+ page_body.wntoolbar.set_user_name();
+ });
+ }
+
+ d.show();
+}
diff --git a/erpnext/startup/feature_setup.js b/erpnext/startup/js/feature_setup.js
similarity index 95%
rename from erpnext/startup/feature_setup.js
rename to erpnext/startup/js/feature_setup.js
index 8644c1dd84..c5518ab751 100644
--- a/erpnext/startup/feature_setup.js
+++ b/erpnext/startup/js/feature_setup.js
@@ -122,13 +122,13 @@ pscript.feature_dict = {
'Sales Order': {'sales_order_details':['page_break']}
},
'fs_exports': {
- 'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','export_amount','export_rate']},
+ 'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['ref_rate','export_amount','export_rate']},
'POS Setting': {'fields':['conversion_rate','currency']},
- 'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','export_amount','export_rate']},
- 'Receivable Voucher': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','export_amount','export_rate']},
+ 'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['ref_rate','export_amount','export_rate']},
+ 'Receivable Voucher': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['ref_rate','export_amount','export_rate']},
'Item': {'ref_rate_details':['ref_currency']},
'Sales BOM': {'fields':['currency']},
- 'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','export_amount','export_rate']}
+ 'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['ref_rate','export_amount','export_rate']}
},
'fs_imports': {
'Payable Voucher': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['import_amount','import_rate']},
@@ -149,7 +149,6 @@ pscript.feature_dict = {
'Sales Order': {'fields':['sales_team','Packing List']}
},
'fs_more_info': {
- 'Customer': {'fields':['More Info']},
'Delivery Note': {'fields':['More Info']},
'Enquiry': {'fields':['More Info']},
'Indent': {'fields':['More Info']},
@@ -160,8 +159,6 @@ pscript.feature_dict = {
'Quotation': {'fields':['More Info']},
'Receivable Voucher': {'fields':['More Info']},
'Sales Order': {'fields':['More Info']},
- 'Serial No': {'fields':['More Info']},
- 'Supplier': {'fields':['More Info']}
},
'fs_quality': {
'Item': {'fields':['Item Inspection Criteria','inspection_required']},
diff --git a/erpnext/startup/modules.js b/erpnext/startup/js/modules.js
similarity index 89%
rename from erpnext/startup/modules.js
rename to erpnext/startup/js/modules.js
index dbd11b0b39..d43b0210b3 100644
--- a/erpnext/startup/modules.js
+++ b/erpnext/startup/js/modules.js
@@ -32,7 +32,7 @@ erpnext.module_page.hide_links = function(wrapper) {
$(wrapper).find('[href*="List/"]').each(function() {
var href = $(this).attr('href');
var dt = href.split('/')[1];
- if(wn.boot.profile.can_read.indexOf(get_label_doctype(dt))==-1) {
+ if(wn.boot.profile.all_read.indexOf(get_label_doctype(dt))==-1) {
var txt = $(this).text();
$(this).parent().css('color', '#999').html(txt);
}
@@ -41,7 +41,7 @@ erpnext.module_page.hide_links = function(wrapper) {
// reports
$(wrapper).find('[data-doctype]').each(function() {
var dt = $(this).attr('data-doctype');
- if(wn.boot.profile.can_read.indexOf(dt)==-1) {
+ if(wn.boot.profile.all_read.indexOf(dt)==-1) {
var txt = $(this).text();
$(this).parent().css('color', '#999').html(txt);
}
@@ -51,7 +51,7 @@ erpnext.module_page.hide_links = function(wrapper) {
$(wrapper).find('[href*="Form/"]').each(function() {
var href = $(this).attr('href');
var dt = href.split('/')[1];
- if(wn.boot.profile.can_read.indexOf(get_label_doctype(dt))==-1) {
+ if(wn.boot.profile.all_read.indexOf(get_label_doctype(dt))==-1) {
var txt = $(this).text();
$(this).parent().css('color', '#999').html(txt);
}
@@ -73,7 +73,10 @@ erpnext.module_page.make_list = function(module, wrapper) {
args: {
module: module
},
- no_refresh: true
+ no_refresh: true,
+ callback: function(r) {
+ erpnext.module_page.hide_links(wrapper)
+ }
});
wrapper.list.run();
}
\ No newline at end of file
diff --git a/erpnext/startup/toolbar.js b/erpnext/startup/js/toolbar.js
similarity index 72%
rename from erpnext/startup/toolbar.js
rename to erpnext/startup/js/toolbar.js
index 7eda49361c..7bf9c6a04e 100644
--- a/erpnext/startup/toolbar.js
+++ b/erpnext/startup/js/toolbar.js
@@ -73,20 +73,43 @@ erpnext.toolbar.add_modules = function() {
$('
\
Modules \
- ').prependTo('.navbar .nav:first');
- $('.navbar .nav:first')
+
+ // if no modules list then show all
+ if(wn.boot.modules_list)
+ wn.boot.modules_list = JSON.parse(wn.boot.modules_list);
+ else
+ wn.boot.modules_list = keys(erpnext.modules).sort();
+
+ // add to dropdown
+ for(var i in wn.boot.modules_list) {
+ var m = wn.boot.modules_list[i]
+
+ if(m!='Setup' && wn.boot.profile.allow_modules.indexOf(m)!=-1) {
+ args = {
+ module: m,
+ module_page: erpnext.modules[m],
+ module_label: m=='HR' ? 'Human Resources' : m
+ }
+
+ $('.navbar .modules').append(repl('
%(module_label)s ', args));
+ }
+ }
+
+ // dasboard for accounts system manager
+ if(user_roles.indexOf("Accounts Manager")!=-1) {
+ $('.navbar .modules').append('
Dashboard ');
+ }
+
+ // setup for system manager
+ if(user_roles.indexOf("System Manager")!=-1) {
+ $('.navbar .modules').append('
\
+
Setup ');
+ }
+
}
diff --git a/erpnext/startup/startup.css b/erpnext/startup/startup.css
index ae0ef606f1..225e444466 100644
--- a/erpnext/startup/startup.css
+++ b/erpnext/startup/startup.css
@@ -13,10 +13,11 @@ span, div, td, input, textarea, button, select {
}
body {
+ background: url(../images/stripedbg.png) repeat;
}
.erpnext-footer {
- margin: 3px auto;
+ margin: 11px auto;
text-align: center;
}
diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js
index 83b1685f55..0a2ac23e1d 100644
--- a/erpnext/startup/startup.js
+++ b/erpnext/startup/startup.js
@@ -19,6 +19,25 @@ var is_system_manager = 0;
wn.provide('erpnext.startup');
+erpnext.modules = {
+ 'Selling': 'selling-home',
+ 'Accounts': 'accounts-home',
+ 'Stock': 'stock-home',
+ 'Buying': 'buying-home',
+ 'Support': 'support-home',
+ 'Projects': 'projects-home',
+ 'Production': 'production-home',
+ 'Website': 'website-home',
+ 'HR': 'hr-home',
+ 'Setup': 'Setup',
+ 'Activity': 'activity',
+ 'To Do': 'todo',
+ 'Calendar': 'calendar',
+ 'Messages': 'messages',
+ 'Knowledge Base': 'questions',
+ 'Dashboard': 'dashboard'
+}
+
erpnext.startup.set_globals = function() {
pscript.is_erpnext_saas = cint(wn.control_panel.sync_with_gateway)
if(inList(user_roles,'System Manager')) is_system_manager = 1;
@@ -27,27 +46,42 @@ erpnext.startup.set_globals = function() {
erpnext.startup.start = function() {
$('#startup_div').html('Starting up...').toggle(true);
+
erpnext.startup.set_globals();
if(wn.boot.custom_css) {
set_style(wn.boot.custom_css);
}
+ if(wn.boot.user_background) {
+ erpnext.set_user_background(wn.boot.user_background);
+ }
if(user == 'Guest'){
if(wn.boot.website_settings.title_prefix) {
wn.title_prefix = wn.boot.website_settings.title_prefix;
}
} else {
+ // always allow apps
+ wn.boot.profile.allow_modules = wn.boot.profile.allow_modules.concat(
+ ['To Do', 'Knowledge Base', 'Calendar', 'Activity', 'Messages'])
+
// setup toolbar
erpnext.toolbar.setup();
-
+
// set interval for updates
erpnext.startup.set_periodic_updates();
// border to the body
// ------------------
$('footer').html('');
+
ERPNext | Attributions and License ');
+
+ // complete registration
+ if(in_list(user_roles,'System Manager') && (wn.boot.setup_complete=='No')) {
+ wn.require("erpnext/startup/js/complete_setup.js");
+ erpnext.complete_setup();
+ }
+
}
$('#startup_div').toggle(false);
@@ -69,53 +103,36 @@ show_chart_browser = function(nm, chart_type){
}
-// Module Page
-// ====================================================================
-
-ModulePage = function(parent, module_name, module_label, help_page, callback) {
- this.parent = parent;
-
- // add to current page
- page_body.cur_page.module_page = this;
-
- this.wrapper = $a(parent,'div');
- this.module_name = module_name;
- this.transactions = [];
- this.page_head = new PageHeader(this.wrapper, module_label);
-
- if(help_page) {
- var btn = this.page_head.add_button('Help', function() { loadpage(this.help_page) }, 1, 'ui-icon-help')
- btn.help_page = help_page;
- }
-
- if(callback) this.callback = function(){ callback(); }
-}
-
// ========== Update Messages ============
-var update_messages = function() {
+var update_messages = function(reset) {
// Updates Team Messages
if(inList(['Guest'], user)) { return; }
-
- $c_page('home', 'event_updates', 'get_unread_messages', null,
- function(r,rt) {
- if(!r.exc) {
- // This function is defined in toolbar.js
- page_body.wntoolbar.set_new_comments(r.message);
- var circle = $('#msg_count')
- if(circle) {
- if(r.message.length) {
- circle.find('span:first').text(r.message.length);
- circle.toggle(true);
- } else {
- circle.toggle(false);
+
+ if(!reset) {
+ $c_page('home', 'event_updates', 'get_unread_messages', null,
+ function(r,rt) {
+ if(!r.exc) {
+ // This function is defined in toolbar.js
+ page_body.wntoolbar.set_new_comments(r.message);
+ var circle = $('#msg_count')
+ if(circle) {
+ if(r.message.length) {
+ circle.find('span:first').text(r.message.length);
+ circle.toggle(true);
+ } else {
+ circle.toggle(false);
+ }
}
+ } else {
+ clearInterval(wn.updates.id);
}
- } else {
- clearInterval(wn.updates.id);
}
- }
- );
+ );
+ } else {
+ page_body.wntoolbar.set_new_comments(0);
+ $('#msg_count').toggle(false);
+ }
}
erpnext.startup.set_periodic_updates = function() {
@@ -129,7 +146,9 @@ erpnext.startup.set_periodic_updates = function() {
wn.updates.id = setInterval(update_messages, 60000);
}
-// =======================================
+erpnext.set_user_background = function(src) {
+ set_style(repl('body { background: url("files/%(src)s") repeat;}', {src:src}))
+}
// start
$(document).bind('startup', function() {
diff --git a/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt b/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt
index 3c50836af5..e3f0dc9adf 100644
--- a/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt
+++ b/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt
@@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:35',
'docstatus': 0,
- 'modified': '2012-02-07 13:28:20',
+ 'modified': '2012-03-01 17:58:16',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
diff --git a/erpnext/stock/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt b/erpnext/stock/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt
index 561019b4d7..fcadcd4245 100644
--- a/erpnext/stock/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt
+++ b/erpnext/stock/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt
@@ -5,273 +5,263 @@
{
'creation': '2010-08-08 17:09:35',
'docstatus': 0,
- 'modified': '2011-09-14 12:36:25',
- 'modified_by': 'Administrator',
- 'owner': 'Administrator'
+ 'modified': '2012-03-01 17:58:16',
+ 'modified_by': u'Administrator',
+ 'owner': u'Administrator'
},
# These values are common for all Table Mapper Detail
{
- 'doctype': 'Table Mapper Detail',
+ 'doctype': u'Table Mapper Detail',
'name': '__common__',
- 'parent': 'Sales Order-Delivery Note',
- 'parentfield': 'table_mapper_details',
- 'parenttype': 'DocType Mapper'
+ 'parent': u'Sales Order-Delivery Note',
+ 'parentfield': u'table_mapper_details',
+ 'parenttype': u'DocType Mapper'
},
# These values are common for all Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
+ 'doctype': u'Field Mapper Detail',
'name': '__common__',
- 'parent': 'Sales Order-Delivery Note',
- 'parentfield': 'field_mapper_details',
- 'parenttype': 'DocType Mapper'
+ 'parent': u'Sales Order-Delivery Note',
+ 'parentfield': u'field_mapper_details',
+ 'parenttype': u'DocType Mapper'
},
# These values are common for all DocType Mapper
{
'doctype': u'DocType Mapper',
- 'from_doctype': 'Sales Order',
- 'module': 'Stock',
+ 'from_doctype': u'Sales Order',
+ 'module': u'Stock',
'name': '__common__',
'ref_doc_submitted': 1,
- 'to_doctype': 'Delivery Note'
+ 'to_doctype': u'Delivery Note'
},
# DocType Mapper, Sales Order-Delivery Note
{
'doctype': u'DocType Mapper',
- 'name': 'Sales Order-Delivery Note'
+ 'name': u'Sales Order-Delivery Note'
},
# Field Mapper Detail
{
- 'checking_operator': '>=',
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'transaction_date',
- 'map': 'No',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'name',
+ 'map': u'Yes',
'match_id': 0,
- 'to_field': 'transaction_date'
+ 'to_field': u'sales_order_no'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'name',
- 'map': 'Yes',
+ 'checking_operator': u'=',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'company',
+ 'map': u'Yes',
'match_id': 0,
- 'to_field': 'sales_order_no'
+ 'to_field': u'company'
},
# Field Mapper Detail
{
- 'checking_operator': '=',
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'company',
- 'map': 'Yes',
+ 'checking_operator': u'=',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'currency',
+ 'map': u'Yes',
'match_id': 0,
- 'to_field': 'company'
+ 'to_field': u'currency'
},
# Field Mapper Detail
{
- 'checking_operator': '=',
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'currency',
- 'map': 'Yes',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'shipping_address_name',
+ 'map': u'Yes',
'match_id': 0,
- 'to_field': 'currency'
+ 'to_field': u'customer_address'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'shipping_address_name',
- 'map': 'Yes',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'shipping_address',
+ 'map': u'Yes',
'match_id': 0,
- 'to_field': 'customer_address'
+ 'to_field': u'address_display'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'shipping_address',
- 'map': 'Yes',
- 'match_id': 0,
- 'to_field': 'address_display'
- },
-
- # Field Mapper Detail
- {
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'parent',
- 'map': 'Yes',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'parent',
+ 'map': u'Yes',
'match_id': 1,
- 'to_field': 'prevdoc_docname'
+ 'to_field': u'prevdoc_docname'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'parenttype',
- 'map': 'Yes',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'parenttype',
+ 'map': u'Yes',
'match_id': 1,
- 'to_field': 'prevdoc_doctype'
+ 'to_field': u'prevdoc_doctype'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'name',
- 'map': 'Yes',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'name',
+ 'map': u'Yes',
'match_id': 1,
- 'to_field': 'prevdoc_detail_docname'
+ 'to_field': u'prevdoc_detail_docname'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.export_rate)',
- 'map': 'Yes',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.export_rate)',
+ 'map': u'Yes',
'match_id': 1,
- 'to_field': 'export_amount'
+ 'to_field': u'export_amount'
},
# Field Mapper Detail
{
- 'checking_operator': '=',
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'basic_rate',
- 'map': 'Yes',
+ 'checking_operator': u'=',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'basic_rate',
+ 'map': u'Yes',
'match_id': 1,
- 'to_field': 'basic_rate'
+ 'to_field': u'basic_rate'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'eval: flt(obj.qty) - flt(obj.delivered_qty)',
- 'map': 'Yes',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'eval: flt(obj.qty) - flt(obj.delivered_qty)',
+ 'map': u'Yes',
'match_id': 1,
- 'to_field': 'qty'
+ 'to_field': u'qty'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.basic_rate)',
- 'map': 'Yes',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.basic_rate)',
+ 'map': u'Yes',
'match_id': 1,
- 'to_field': 'amount'
+ 'to_field': u'amount'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'reserved_warehouse',
- 'map': 'Yes',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'reserved_warehouse',
+ 'map': u'Yes',
'match_id': 1,
- 'to_field': 'warehouse'
+ 'to_field': u'warehouse'
},
# Field Mapper Detail
{
- 'checking_operator': '=',
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'project_name',
- 'map': 'Yes',
+ 'checking_operator': u'=',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'project_name',
+ 'map': u'Yes',
'match_id': 0,
- 'to_field': 'project_name'
+ 'to_field': u'project_name'
},
# Field Mapper Detail
{
- 'checking_operator': '=',
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'customer',
- 'map': 'Yes',
+ 'checking_operator': u'=',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'customer',
+ 'map': u'Yes',
'match_id': 0,
- 'to_field': 'customer'
+ 'to_field': u'customer'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'naming_series',
- 'map': 'No',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'naming_series',
+ 'map': u'No',
'match_id': 0,
- 'to_field': 'naming_series'
+ 'to_field': u'naming_series'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'status',
- 'map': 'No',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'status',
+ 'map': u'No',
'match_id': 0,
- 'to_field': 'status'
+ 'to_field': u'status'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'incentives',
- 'map': 'No',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'incentives',
+ 'map': u'No',
'match_id': 3,
- 'to_field': 'incentives'
+ 'to_field': u'incentives'
},
# Field Mapper Detail
{
- 'doctype': 'Field Mapper Detail',
- 'from_field': 'allocated_amount',
- 'map': 'Yes',
+ 'doctype': u'Field Mapper Detail',
+ 'from_field': u'allocated_amount',
+ 'map': u'Yes',
'match_id': 0,
- 'to_field': 'customer_mobile_no'
+ 'to_field': u'customer_mobile_no'
},
# Table Mapper Detail
{
- 'doctype': 'Table Mapper Detail',
- 'from_field': 'sales_team',
- 'from_table': 'Sales Team',
+ 'doctype': u'Table Mapper Detail',
+ 'from_field': u'sales_team',
+ 'from_table': u'Sales Team',
'match_id': 3,
- 'to_field': 'sales_team',
- 'to_table': 'Sales Team',
- 'validation_logic': 'name is not null'
+ 'to_field': u'sales_team',
+ 'to_table': u'Sales Team',
+ 'validation_logic': u'name is not null'
},
# Table Mapper Detail
{
- 'doctype': 'Table Mapper Detail',
- 'from_field': 'other_charges',
- 'from_table': 'RV Tax Detail',
+ 'doctype': u'Table Mapper Detail',
+ 'from_field': u'other_charges',
+ 'from_table': u'RV Tax Detail',
'match_id': 2,
- 'to_field': 'other_charges',
- 'to_table': 'RV Tax Detail',
- 'validation_logic': 'name is not null'
+ 'to_field': u'other_charges',
+ 'to_table': u'RV Tax Detail',
+ 'validation_logic': u'name is not null'
},
# Table Mapper Detail
{
- 'doctype': 'Table Mapper Detail',
- 'from_field': 'sales_order_details',
- 'from_table': 'Sales Order Detail',
+ 'doctype': u'Table Mapper Detail',
+ 'from_field': u'sales_order_details',
+ 'from_table': u'Sales Order Detail',
'match_id': 1,
- 'reference_doctype_key': 'prevdoc_doctype',
- 'reference_key': 'prevdoc_detail_docname',
- 'to_field': 'delivery_note_details',
- 'to_table': 'Delivery Note Detail',
- 'validation_logic': 'qty > ifnull(delivered_qty,0) and docstatus = 1'
+ 'reference_doctype_key': u'prevdoc_doctype',
+ 'reference_key': u'prevdoc_detail_docname',
+ 'to_field': u'delivery_note_details',
+ 'to_table': u'Delivery Note Detail',
+ 'validation_logic': u'qty > ifnull(delivered_qty,0) and docstatus = 1'
},
# Table Mapper Detail
{
- 'doctype': 'Table Mapper Detail',
- 'from_table': 'Sales Order',
+ 'doctype': u'Table Mapper Detail',
+ 'from_table': u'Sales Order',
'match_id': 0,
- 'reference_key': 'prevdoc_docname',
- 'to_table': 'Delivery Note',
- 'validation_logic': 'docstatus = 1'
+ 'reference_key': u'prevdoc_docname',
+ 'to_table': u'Delivery Note',
+ 'validation_logic': u'docstatus = 1'
}
]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index 3a8931e1e7..1f5170be96 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -30,7 +30,7 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
if(!doc.transaction_date) set_multiple(dt,dn,{transaction_date:get_today()});
if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
- if(doc.__islocal && doc.customer) cur_frm.cscript.pull_item_details_onload(doc,dt,dn);
+ if(doc.__islocal && doc.customer) cur_frm.cscript.customer(doc,dt,dn,onload=true);
if(!doc.price_list_currency) {
set_multiple(dt, dn, {price_list_currency: doc.currency, plc_conversion_rate:1});
}
@@ -43,17 +43,19 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
// defined in sales_common.js
- if(doc.__islocal) cur_frm.cscript.update_item_details(doc, dt, dn);
+ var callback = function(doc, dt, dn) {
+ if(doc.__islocal) cur_frm.cscript.update_item_details(doc, dt, dn);
+ }
+
+ cur_frm.cscript.hide_price_list_currency(doc, dt, dn, callback);
}
// REFRESH
// ================================================================================================
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.clear_custom_buttons();
- var callback = function() {
- cur_frm.cscript.dynamic_label(doc, cdt, cdn);
- }
- cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn, callback);
+
+ if (!cur_frm.cscript.is_onload) cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn);
if(doc.per_billed < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Sales Invoice']);
@@ -123,16 +125,6 @@ cur_frm.cscript['Get Items'] = function(doc,dt,dn) {
}
-//RV-DN : Pull Item details - UOM, Item Group as it was not in Sales Invoice
-//---------------------------------------------------------------------
-cur_frm.cscript.pull_item_details_onload = function(doc,dt,dn){
- var callback = function(r,rt){
- refresh_field('delivery_note_details');
- cur_frm.cscript.customer(doc,dt,dn,onload=true);
- }
- $c_obj(make_doclist(dt,dn),'set_item_details','',callback);
-}
-
//================ create new contact ============================================================================
cur_frm.cscript.new_contact = function(){
tn = createLocal('Contact');
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index a94531b555..3d8a1011fc 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -74,16 +74,6 @@ class DocType(TransactionBase):
return cstr(self.doc.sales_order_no)
-
-
- #-------------------set item details -uom and item group----------------
- def set_item_details(self):
- for d in getlist(self.doclist,'delivery_note_details'):
- res = sql("select stock_uom, item_group from `tabItem` where name ='%s'"%d.item_code)
- if not d.stock_uom: d.stock_uom = res and cstr(res[0][0]) or ''
- if not d.item_group: d.item_group = res and cstr(res[0][1]) or ''
- d.save()
-
# ::::: Validates that Sales Order is not pulled twice :::::::
def validate_prev_docname(self):
for d in getlist(self.doclist, 'delivery_note_details'):
@@ -117,14 +107,16 @@ class DocType(TransactionBase):
# ***************** Get Item Details ******************************
def get_item_details(self, args=None):
- args = eval(args)
- if args['item_code']:
+ args = args and eval(args) or {}
+ if args.get('item_code'):
return get_obj('Sales Common').get_item_details(args, self)
else:
obj = get_obj('Sales Common')
for doc in self.doclist:
if doc.fields.get('item_code'):
- ret = obj.get_item_details(doc.item_code, self)
+ arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
+ 'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
+ ret = obj.get_item_details(arg, self)
for r in ret:
if not doc.fields.get(r):
doc.fields[r] = ret[r]
@@ -135,13 +127,6 @@ class DocType(TransactionBase):
get_obj('Sales Common').get_adj_percent(self)
- def get_comp_base_currency(self):
- return get_obj('Sales Common').get_comp_base_currency(self.doc.company)
-
- def get_price_list_currency(self):
- return get_obj('Sales Common').get_price_list_currency(self.doc.price_list_name, self.doc.company)
-
-
# ********** Get Actual Qty of item in warehouse selected *************
def get_actual_qty(self,args):
args = eval(args)
@@ -245,9 +230,9 @@ class DocType(TransactionBase):
if prevdoc_docname and prevdoc:
# ::::::::::: Validates Transaction Date of DN and previous doc (i.e. SO , PO, PR) *********
- trans_date = sql("select transaction_date from `tab%s` where name = '%s'" %(prevdoc,prevdoc_docname))[0][0]
- if trans_date and getdate(self.doc.transaction_date) < (trans_date):
- msgprint("Your Voucher Date cannot be before "+cstr(prevdoc)+" Date.")
+ trans_date = sql("select posting_date from `tab%s` where name = '%s'" %(prevdoc,prevdoc_docname))[0][0]
+ if trans_date and getdate(self.doc.posting_date) < (trans_date):
+ msgprint("Your Posting Date cannot be before "+cstr(prevdoc)+" Date.")
raise Exception
# ::::::::: Validates DN and previous doc details ::::::::::::::::::
get_name = sql("select name from `tab%s` where name = '%s'" % (prevdoc, prevdoc_docname))
@@ -356,16 +341,17 @@ class DocType(TransactionBase):
"""
Validate that if packed qty exists, it should be equal to qty
"""
- if not any([d.fields.get('packed_qty') for d in self.doclist]):
+ if not any([flt(d.fields.get('packed_qty')) for d in self.doclist if
+ d.doctype=='Delivery Note Detail']):
return
packing_error_list = []
for d in self.doclist:
if d.doctype != 'Delivery Note Detail': continue
- if d.fields.get('qty') != d.fields.get('packed_qty'):
+ if flt(d.fields.get('qty')) != flt(d.fields.get('packed_qty')):
packing_error_list.append([
d.fields.get('item_code', ''),
- d.fields.get('qty', ''),
- d.fields.get('packed_qty', '')
+ d.fields.get('qty', 0),
+ d.fields.get('packed_qty', 0)
])
if packing_error_list:
from webnotes.utils import cstr
@@ -457,7 +443,7 @@ class DocType(TransactionBase):
self.values.append({
'item_code' : d[1],
'warehouse' : wh,
- 'transaction_date' : self.doc.transaction_date,
+ 'transaction_date' : getdate(self.doc.modified).strftime('%Y-%m-%d'),
'posting_date' : self.doc.posting_date,
'posting_time' : self.doc.posting_time,
'voucher_type' : 'Delivery Note',
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.txt b/erpnext/stock/doctype/delivery_note/delivery_note.txt
index 6570b0c80d..314d0d9481 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.txt
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.txt
@@ -5,7 +5,7 @@
{
'creation': '2011-04-18 15:58:20',
'docstatus': 0,
- 'modified': '2012-02-27 17:35:31',
+ 'modified': '2012-03-02 12:15:44',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -21,7 +21,7 @@
# These values are common for all DocType
{
- '_last_update': u'1330343754',
+ '_last_update': u'1330593645',
'colour': u'White:FFF',
'default_print_format': u'Standard',
'doctype': 'DocType',
@@ -37,7 +37,7 @@
'show_in_menu': 0,
'subject': u'To %(customer_name)s on %(transaction_date)s | %(per_billed)s% billed',
'tag_fields': u'billing_status',
- 'version': 474
+ 'version': 475
},
# These values are common for all DocFormat
@@ -285,29 +285,37 @@
# DocField
{
'doctype': u'DocField',
- 'fieldtype': u'Column Break',
- 'oldfieldtype': u'Column Break',
- 'permlevel': 0
+ 'fieldname': u'territory',
+ 'fieldtype': u'Link',
+ 'hidden': 0,
+ 'in_filter': 1,
+ 'label': u'Territory',
+ 'options': u'Territory',
+ 'permlevel': 0,
+ 'print_hide': 1,
+ 'reqd': 1,
+ 'search_index': 1
},
# DocField
{
- 'colour': u'White:FFF',
- 'default': u'Today',
- 'description': u'The date at which current entry is made in system.',
'doctype': u'DocField',
- 'fieldname': u'transaction_date',
- 'fieldtype': u'Date',
+ 'fieldname': u'customer_group',
+ 'fieldtype': u'Link',
'in_filter': 1,
- 'label': u'Voucher Date',
- 'no_copy': 1,
- 'oldfieldname': u'transaction_date',
- 'oldfieldtype': u'Date',
+ 'label': u'Customer Group',
+ 'options': u'Customer Group',
'permlevel': 0,
'print_hide': 1,
- 'reqd': 1,
- 'search_index': 1,
- 'width': u'100px'
+ 'search_index': 1
+ },
+
+ # DocField
+ {
+ 'doctype': u'DocField',
+ 'fieldtype': u'Column Break',
+ 'oldfieldtype': u'Column Break',
+ 'permlevel': 0
},
# DocField
@@ -467,30 +475,41 @@
# DocField
{
+ 'colour': u'White:FFF',
+ 'description': u'Track this Delivery Note against any Project',
'doctype': u'DocField',
- 'fieldname': u'territory',
+ 'fieldname': u'project_name',
'fieldtype': u'Link',
- 'hidden': 0,
'in_filter': 1,
- 'label': u'Territory',
- 'options': u'Territory',
+ 'label': u'Project Name',
+ 'oldfieldname': u'project_name',
+ 'oldfieldtype': u'Link',
+ 'options': u'Project',
'permlevel': 0,
- 'print_hide': 1,
- 'reqd': 1,
- 'search_index': 1
+ 'search_index': 1,
+ 'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
- 'fieldname': u'customer_group',
- 'fieldtype': u'Link',
- 'in_filter': 1,
- 'label': u'Customer Group',
- 'options': u'Customer Group',
- 'permlevel': 0,
- 'print_hide': 1,
- 'search_index': 1
+ 'fieldname': u'challan_no',
+ 'fieldtype': u'Data',
+ 'label': u'Challan No',
+ 'oldfieldname': u'challan_no',
+ 'oldfieldtype': u'Data',
+ 'permlevel': 0
+ },
+
+ # DocField
+ {
+ 'doctype': u'DocField',
+ 'fieldname': u'challan_date',
+ 'fieldtype': u'Date',
+ 'label': u'Challan Date',
+ 'oldfieldname': u'challan_date',
+ 'oldfieldtype': u'Date',
+ 'permlevel': 0
},
# DocField
@@ -885,6 +904,7 @@
'oldfieldtype': u'Button',
'options': u'get_tc_details',
'permlevel': 0,
+ 'print_hide': 1,
'trigger': u'Server'
},
@@ -917,7 +937,8 @@
'doctype': u'DocField',
'fieldtype': u'Section Break',
'label': u'Transporter Info',
- 'permlevel': 0
+ 'permlevel': 0,
+ 'print_hide': 1
},
# DocField
@@ -925,6 +946,7 @@
'doctype': u'DocField',
'fieldtype': u'Column Break',
'permlevel': 0,
+ 'print_hide': 1,
'width': u'50%'
},
@@ -979,36 +1001,6 @@
'width': u'100px'
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldtype': u'Column Break',
- 'permlevel': 0,
- 'width': u'50%'
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'challan_no',
- 'fieldtype': u'Data',
- 'label': u'Challan No',
- 'oldfieldname': u'challan_no',
- 'oldfieldtype': u'Data',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'challan_date',
- 'fieldtype': u'Date',
- 'label': u'Challan Date',
- 'oldfieldname': u'challan_date',
- 'oldfieldtype': u'Date',
- 'permlevel': 0
- },
-
# DocField
{
'colour': u'White:FFF',
@@ -1017,7 +1009,8 @@
'fieldtype': u'Section Break',
'label': u'More Info',
'oldfieldtype': u'Section Break',
- 'permlevel': 0
+ 'permlevel': 0,
+ 'print_hide': 1
},
# DocField
@@ -1056,29 +1049,13 @@
'width': u'150px'
},
- # DocField
- {
- 'colour': u'White:FFF',
- 'description': u'Track this Delivery Note against any Project',
- 'doctype': u'DocField',
- 'fieldname': u'project_name',
- 'fieldtype': u'Link',
- 'in_filter': 1,
- 'label': u'Project Name',
- 'oldfieldname': u'project_name',
- 'oldfieldtype': u'Link',
- 'options': u'Project',
- 'permlevel': 0,
- 'search_index': 1,
- 'trigger': u'Client'
- },
-
# DocField
{
'doctype': u'DocField',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
+ 'print_hide': 1,
'width': u'50%'
},
@@ -1244,7 +1221,8 @@
'fieldtype': u'Section Break',
'label': u'Packing List',
'oldfieldtype': u'Section Break',
- 'permlevel': 0
+ 'permlevel': 0,
+ 'print_hide': 1
},
# DocField
@@ -1268,7 +1246,7 @@
'label': u'Sales Team',
'oldfieldtype': u'Section Break',
'permlevel': 0,
- 'print_hide': 0
+ 'print_hide': 1
},
# DocField
@@ -1276,6 +1254,7 @@
'doctype': u'DocField',
'fieldtype': u'Column Break',
'permlevel': 0,
+ 'print_hide': 1,
'width': u'50%'
},
@@ -1300,6 +1279,7 @@
'doctype': u'DocField',
'fieldtype': u'Column Break',
'permlevel': 0,
+ 'print_hide': 1,
'width': u'50%'
},
@@ -1338,7 +1318,8 @@
'doctype': u'DocField',
'fieldtype': u'Section Break',
'options': u'Simple',
- 'permlevel': 0
+ 'permlevel': 0,
+ 'print_hide': 1
},
# DocField
diff --git a/erpnext/stock/doctype/delivery_note_detail/delivery_note_detail.txt b/erpnext/stock/doctype/delivery_note_detail/delivery_note_detail.txt
index 78fea52a48..a5f82f4bf8 100644
--- a/erpnext/stock/doctype/delivery_note_detail/delivery_note_detail.txt
+++ b/erpnext/stock/doctype/delivery_note_detail/delivery_note_detail.txt
@@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:08:58',
'docstatus': 0,
- 'modified': '2012-02-24 11:33:58',
+ 'modified': '2012-03-05 10:49:39',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -23,7 +23,7 @@
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
- 'version': 53
+ 'version': 55
},
# These values are common for all DocField
@@ -117,18 +117,14 @@
# DocField
{
- 'default': u'0.00',
'doctype': u'DocField',
- 'fieldname': u'ref_rate',
+ 'fieldname': u'base_ref_rate',
'fieldtype': u'Currency',
- 'label': u'Price List Rate',
- 'no_copy': 0,
- 'oldfieldname': u'ref_rate',
+ 'label': u'Price List Rate*',
+ 'oldfieldname': u'base_ref_rate',
'oldfieldtype': u'Currency',
- 'permlevel': 0,
+ 'permlevel': 1,
'print_hide': 1,
- 'reqd': 0,
- 'trigger': u'Client',
'width': u'100px'
},
@@ -147,6 +143,53 @@
'width': u'100px'
},
+ # DocField
+ {
+ 'default': u'0.00',
+ 'doctype': u'DocField',
+ 'fieldname': u'basic_rate',
+ 'fieldtype': u'Currency',
+ 'label': u'Rate*',
+ 'oldfieldname': u'basic_rate',
+ 'oldfieldtype': u'Currency',
+ 'permlevel': 0,
+ 'print_hide': 1,
+ 'reqd': 0,
+ 'trigger': u'Client',
+ 'width': u'150px'
+ },
+
+ # DocField
+ {
+ 'doctype': u'DocField',
+ 'fieldname': u'amount',
+ 'fieldtype': u'Currency',
+ 'label': u'Amount*',
+ 'oldfieldname': u'amount',
+ 'oldfieldtype': u'Currency',
+ 'permlevel': 1,
+ 'print_hide': 1,
+ 'reqd': 0,
+ 'width': u'100px'
+ },
+
+ # DocField
+ {
+ 'default': u'0.00',
+ 'doctype': u'DocField',
+ 'fieldname': u'ref_rate',
+ 'fieldtype': u'Currency',
+ 'label': u'Price List Rate',
+ 'no_copy': 0,
+ 'oldfieldname': u'ref_rate',
+ 'oldfieldtype': u'Currency',
+ 'permlevel': 0,
+ 'print_hide': 1,
+ 'reqd': 0,
+ 'trigger': u'Client',
+ 'width': u'100px'
+ },
+
# DocField
{
'doctype': u'DocField',
@@ -176,49 +219,6 @@
'width': u'100px'
},
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'base_ref_rate',
- 'fieldtype': u'Currency',
- 'label': u'Price List Rate*',
- 'oldfieldname': u'base_ref_rate',
- 'oldfieldtype': u'Currency',
- 'permlevel': 1,
- 'print_hide': 1,
- 'width': u'100px'
- },
-
- # DocField
- {
- 'default': u'0.00',
- 'doctype': u'DocField',
- 'fieldname': u'basic_rate',
- 'fieldtype': u'Currency',
- 'label': u'Rate*',
- 'oldfieldname': u'basic_rate',
- 'oldfieldtype': u'Currency',
- 'permlevel': 0,
- 'print_hide': 1,
- 'reqd': 0,
- 'trigger': u'Client',
- 'width': u'150px'
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'amount',
- 'fieldtype': u'Currency',
- 'label': u'Amount*',
- 'oldfieldname': u'amount',
- 'oldfieldtype': u'Currency',
- 'permlevel': 1,
- 'print_hide': 1,
- 'reqd': 0,
- 'width': u'100px'
- },
-
# DocField
{
'doctype': u'DocField',
@@ -245,7 +245,7 @@
'oldfieldname': u'serial_no',
'oldfieldtype': u'Text',
'permlevel': 0,
- 'print_hide': 1,
+ 'print_hide': 0,
'trigger': u'Client'
},
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index 0f6d1a8a80..7ad9d91928 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -40,12 +40,15 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
var callback = function(doc, dt, dn) {
- if(doc.__islocal){
- cur_frm.cscript.get_default_schedule_date(doc);
+ var callback1 = function(doc, dt, dn) {
+ if(doc.__islocal){
+ cur_frm.cscript.get_default_schedule_date(doc);
+ }
}
+ // defined in purchase_common.js
+ cur_frm.cscript.update_item_details(doc, dt, dn, callback1);
}
- // defined in purchase_common.js
- cur_frm.cscript.update_item_details(doc, cdt, cdn, callback);
+ cur_frm.cscript.dynamic_label(doc, dt, dn, callback);
}
//========================== Refresh ===============================================================
@@ -55,7 +58,8 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
// ---------------------------------
cur_frm.clear_custom_buttons();
- cur_frm.cscript.dynamic_label(doc, cdt, cdn);
+ if (!cur_frm.cscript.is_onload) cur_frm.cscript.dynamic_label(doc, cdt, cdn);
+
if(doc.docstatus == 1){
var ch = getchildren('Purchase Receipt Detail',doc.name,'purchase_receipt_details');
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 530afcf09d..88cfbe3db5 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -57,7 +57,7 @@ class DocType(TransactionBase):
#-----------------Validation For Fiscal Year------------------------
def validate_fiscal_year(self):
- get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Transaction Date')
+ get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Transaction Date')
# Get Item Details
@@ -88,10 +88,6 @@ class DocType(TransactionBase):
def get_tc_details(self):
return get_obj('Purchase Common').get_tc_details(self)
- def get_comp_base_currency(self):
- return get_obj('Purchase Common').get_comp_base_currency(self.doc.company)
-
-
# get available qty at warehouse
def get_bin_details(self, arg = ''):
@@ -230,7 +226,7 @@ class DocType(TransactionBase):
ord_qty = -flt(curr_qty)
# update order qty in bin
- bin = get_obj('Warehouse', d.warehouse).update_bin(0, 0, (is_submit and 1 or -1) * flt(ord_qty), 0, 0, d.item_code, self.doc.transaction_date)
+ bin = get_obj('Warehouse', d.warehouse).update_bin(0, 0, (is_submit and 1 or -1) * flt(ord_qty), 0, 0, d.item_code, self.doc.posting_date)
# UPDATE actual qty to warehouse by pr_qty
self.make_sl_entry(d, d.warehouse, flt(pr_qty), d.valuation_rate, is_submit)
@@ -249,7 +245,7 @@ class DocType(TransactionBase):
self.values.append({
'item_code' : d.fields.has_key('item_code') and d.item_code or d.rm_item_code,
'warehouse' : wh,
- 'transaction_date' : self.doc.transaction_date,
+ 'transaction_date' : getdate(self.doc.modified).strftime('%Y-%m-%d'),
'posting_date' : self.doc.posting_date,
'posting_time' : self.doc.posting_time,
'voucher_type' : 'Purchase Receipt',
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt
index 2666f086c2..525bcfcef2 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt
@@ -5,14 +5,14 @@
{
'creation': '2010-08-08 17:09:15',
'docstatus': 0,
- 'modified': '2012-02-27 17:54:59',
+ 'modified': '2012-03-02 12:26:39',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
- '_last_update': u'1330345245',
+ '_last_update': u'1330593645',
'colour': u'White:FFF',
'default_print_format': u'Standard',
'doctype': 'DocType',
@@ -26,7 +26,7 @@
'server_code_error': u' ',
'show_in_menu': 0,
'subject': u'From %(supplier_name)s against %(purchase_order)s on %(transaction_date)s',
- 'version': 324
+ 'version': 325
},
# These values are common for all DocField
@@ -302,25 +302,6 @@
'width': u'50%'
},
- # DocField
- {
- 'colour': u'White:FFF',
- 'description': u'The date at which current entry is made in system.',
- 'doctype': u'DocField',
- 'fieldname': u'transaction_date',
- 'fieldtype': u'Date',
- 'in_filter': 1,
- 'label': u'Transaction Date',
- 'no_copy': 1,
- 'oldfieldname': u'transaction_date',
- 'oldfieldtype': u'Date',
- 'permlevel': 0,
- 'reqd': 1,
- 'search_index': 1,
- 'trigger': u'Client',
- 'width': u'100px'
- },
-
# DocField
{
'colour': u'White:FFF',
@@ -948,6 +929,7 @@
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
+ 'print_hide': 1,
'width': u'50%'
},
@@ -1120,7 +1102,8 @@
'fieldtype': u'Section Break',
'label': u'Raw Material Details',
'oldfieldtype': u'Section Break',
- 'permlevel': 1
+ 'permlevel': 1,
+ 'print_hide': 1
},
# DocField
@@ -1130,7 +1113,8 @@
'label': u'Get Current Stock',
'oldfieldtype': u'Button',
'options': u'get_current_stock',
- 'permlevel': 0
+ 'permlevel': 0,
+ 'print_hide': 1
},
# DocField
diff --git a/erpnext/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt b/erpnext/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt
index 7f636442ea..4ebd28c7c9 100755
--- a/erpnext/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt
+++ b/erpnext/stock/doctype/purchase_receipt_detail/purchase_receipt_detail.txt
@@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:16',
'docstatus': 0,
- 'modified': '2012-02-27 18:43:39',
+ 'modified': '2012-03-05 10:51:18',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@@ -22,7 +22,7 @@
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
- 'version': 74
+ 'version': 76
},
# These values are common for all DocField
@@ -95,6 +95,7 @@
'oldfieldname': u'received_qty',
'oldfieldtype': u'Currency',
'permlevel': 0,
+ 'print_hide': 1,
'reqd': 1,
'trigger': u'Client',
'width': u'100px'
@@ -125,6 +126,7 @@
'oldfieldname': u'rejected_qty',
'oldfieldtype': u'Currency',
'permlevel': 0,
+ 'print_hide': 1,
'search_index': 0,
'trigger': u'Client',
'width': u'100px'
@@ -133,10 +135,11 @@
# DocField
{
'doctype': u'DocField',
- 'fieldname': u'import_ref_rate',
+ 'fieldname': u'purchase_ref_rate',
'fieldtype': u'Currency',
- 'label': u'Ref Rate ',
- 'permlevel': 0
+ 'label': u'Ref Rate *',
+ 'permlevel': 0,
+ 'print_hide': 1
},
# DocField
@@ -145,43 +148,8 @@
'fieldname': u'discount_rate',
'fieldtype': u'Currency',
'label': u'Discount %',
- 'permlevel': 0
- },
-
- # DocField
- {
- 'colour': u'White:FFF',
- 'default': u'0.00',
- 'doctype': u'DocField',
- 'fieldname': u'import_rate',
- 'fieldtype': u'Currency',
- 'label': u'Rate',
- 'oldfieldname': u'import_rate',
- 'oldfieldtype': u'Currency',
'permlevel': 0,
- 'print_hide': 0,
- 'trigger': u'Client',
- 'width': u'100px'
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'import_amount',
- 'fieldtype': u'Currency',
- 'label': u'Amount',
- 'oldfieldname': u'import_amount',
- 'oldfieldtype': u'Currency',
- 'permlevel': 1
- },
-
- # DocField
- {
- 'doctype': u'DocField',
- 'fieldname': u'purchase_ref_rate',
- 'fieldtype': u'Currency',
- 'label': u'Ref Rate *',
- 'permlevel': 0
+ 'print_hide': 1
},
# DocField
@@ -217,6 +185,43 @@
'width': u'100px'
},
+ # DocField
+ {
+ 'doctype': u'DocField',
+ 'fieldname': u'import_ref_rate',
+ 'fieldtype': u'Currency',
+ 'label': u'Ref Rate ',
+ 'permlevel': 0,
+ 'print_hide': 1
+ },
+
+ # DocField
+ {
+ 'colour': u'White:FFF',
+ 'default': u'0.00',
+ 'doctype': u'DocField',
+ 'fieldname': u'import_rate',
+ 'fieldtype': u'Currency',
+ 'label': u'Rate',
+ 'oldfieldname': u'import_rate',
+ 'oldfieldtype': u'Currency',
+ 'permlevel': 0,
+ 'print_hide': 0,
+ 'trigger': u'Client',
+ 'width': u'100px'
+ },
+
+ # DocField
+ {
+ 'doctype': u'DocField',
+ 'fieldname': u'import_amount',
+ 'fieldtype': u'Currency',
+ 'label': u'Amount',
+ 'oldfieldname': u'import_amount',
+ 'oldfieldtype': u'Currency',
+ 'permlevel': 1
+ },
+
# DocField
{
'doctype': u'DocField',
@@ -228,7 +233,7 @@
'oldfieldtype': u'Link',
'options': u'Warehouse',
'permlevel': 0,
- 'print_hide': 0,
+ 'print_hide': 1,
'width': u'100px'
},
@@ -243,6 +248,7 @@
'oldfieldtype': u'Link',
'options': u'UOM',
'permlevel': 0,
+ 'print_hide': 1,
'reqd': 1,
'trigger': u'Client',
'width': u'100px'
@@ -441,7 +447,7 @@
'oldfieldtype': u'Link',
'options': u'Purchase Order',
'permlevel': 1,
- 'print_hide': 0,
+ 'print_hide': 1,
'reqd': 0,
'search_index': 1,
'width': u'150px'
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 0eb78dfdce..1e558c9441 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -51,7 +51,7 @@ var cfn_set_fields = function(doc, cdt, cdn) {
hide_field(lst);
unhide_field(['supplier','supplier_name','supplier_address','purchase_receipt_no']);
}
- if(doc.purpose == 'Sales Return'){
+ else if(doc.purpose == 'Sales Return'){
doc.supplier=doc.supplier_name = doc.supplier_address=doc.purchase_receipt_no='';
hide_field(lst);
unhide_field(['customer','customer_name','customer_address','delivery_note_no', 'sales_invoice_no']);
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 6d080a8c56..530c5e615e 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -453,8 +453,8 @@ class DocType:
if self.doc.purpose == 'Purchase Return':
#delete_doc("Serial No", serial_no)
serial_doc = Document("Serial No", serial_no)
- serial_doc.status = 'Purchase Returned'
- serial_doc.docstatus = 2
+ serial_doc.status = is_submit and 'Purchase Returned' or 'In Store'
+ serial_doc.docstatus = is_submit and 2 or 0
serial_doc.save()
diff --git a/erpnext/stock/page/stock_home/stock_home.html b/erpnext/stock/page/stock_home/stock_home.html
index 9ba21a43dd..bab93dcfbd 100644
--- a/erpnext/stock/page/stock_home/stock_home.html
+++ b/erpnext/stock/page/stock_home/stock_home.html
@@ -4,7 +4,7 @@
Stock
-
+
Transfer stock from one warehouse to another
Delivery (shipment) to customers
diff --git a/erpnext/support/doctype/customer_issue/customer_issue.py b/erpnext/support/doctype/customer_issue/customer_issue.py
index b00a6a03c8..af839cf09f 100644
--- a/erpnext/support/doctype/customer_issue/customer_issue.py
+++ b/erpnext/support/doctype/customer_issue/customer_issue.py
@@ -15,6 +15,7 @@
# along with this program. If not, see
.
# Please edit this list and import only required elements
+
import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
diff --git a/erpnext/support/doctype/support_ticket/__init__.py b/erpnext/support/doctype/support_ticket/__init__.py
index c9d1958af8..ca27a61f9f 100644
--- a/erpnext/support/doctype/support_ticket/__init__.py
+++ b/erpnext/support/doctype/support_ticket/__init__.py
@@ -29,6 +29,7 @@ class SupportMailbox(POP3Mailbox):
# extract email settings
self.email_settings = Document('Email Settings','Email Settings')
+ if not self.email_settings.fields.get('sync_support_mails'): return
s = Document('Support Email Settings')
s.use_ssl = self.email_settings.support_use_ssl
diff --git a/erpnext/support/doctype/support_ticket/support_ticket.js b/erpnext/support/doctype/support_ticket/support_ticket.js
index 02c9a5d082..86264a6433 100644
--- a/erpnext/support/doctype/support_ticket/support_ticket.js
+++ b/erpnext/support/doctype/support_ticket/support_ticket.js
@@ -178,7 +178,8 @@ EmailMessage = function(parent, args, list, idx) {
// email text
this.message = $a(w, 'div', '',
// style
- {lineHeight:'1.7em', display:'none', padding: '7px'},
+ {lineHeight:'1.7em', display:'none', padding: '7px', width: '575px',
+ wordWrap: 'break-word', textWrap: 'normal', overflowX: 'auto'},
// newlines for text email
(this.content_type=='text/plain' ? this.mail
diff --git a/erpnext/utilities/__init__.py b/erpnext/utilities/__init__.py
index 28eaccecdc..d57f0def05 100644
--- a/erpnext/utilities/__init__.py
+++ b/erpnext/utilities/__init__.py
@@ -23,6 +23,7 @@ def get_report_list(arg=None):
distinct criteria_name, doc_type, parent_doc_type
from `tabSearch Criteria`
where module='%(module)s'
- and docstatus in (0, NULL)
+ and docstatus in (0, NULL)
+ and ifnull(disabled, 0) = 0
order by criteria_name
limit %(limit_start)s, %(limit_page_length)s""" % webnotes.form_dict, as_dict=True)
\ No newline at end of file
diff --git a/erpnext/utilities/page/messages/messages.js b/erpnext/utilities/page/messages/messages.js
index 39f7974870..6937796168 100644
--- a/erpnext/utilities/page/messages/messages.js
+++ b/erpnext/utilities/page/messages/messages.js
@@ -1,8 +1,25 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see
.
+
wn.provide('erpnext.messages');
wn.pages.messages.onload = function(wrapper) {
erpnext.messages.show_active_users();
erpnext.messages.make_list();
+ update_messages('reset'); //Resets notification icons
// post message
$('#message-post').click(function() {
@@ -49,7 +66,7 @@ erpnext.messages = {
$(wn.pages.messages).find('.well').toggle(contact==user ? false : true);
$(wn.pages.messages).find('h1:first').html('Messages: '
- + (user==contact ? 'From everyone' : wn.boot.user_fullnames[contact]))
+ + (user==contact ? 'From everyone' : wn.user_info(contact).fullname));
erpnext.messages.contact = contact;
erpnext.messages.list.opts.args.contact = contact;
@@ -82,7 +99,7 @@ erpnext.messages = {
},
render_row: function(wrapper, data) {
data.creation = dateutil.comment_when(data.creation);
- data.comment_by_fullname = wn.boot.user_fullnames[data.owner];
+ data.comment_by_fullname = wn.user_info(data.owner).fullname;
data.reply_html = '';
if(data.owner==user) {
@@ -127,7 +144,7 @@ erpnext.messages = {
var $body = $(wn.pages.messages).find('.section-body');
for(var i in r.message) {
var p = r.message[i];
- p.fullname = wn.boot.user_fullnames[p.name];
+ p.fullname = wn.user_info(p.name).fullname;
p.name = p.name.replace('@', '__at__');
$body.append(repl('
', p))
diff --git a/erpnext/utilities/page/messages/messages.py b/erpnext/utilities/page/messages/messages.py
index d7c60267ed..b28299164c 100644
--- a/erpnext/utilities/page/messages/messages.py
+++ b/erpnext/utilities/page/messages/messages.py
@@ -1,3 +1,19 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
.
+
import webnotes
@webnotes.whitelist()
@@ -32,7 +48,8 @@ def get_list(arg=None):
@webnotes.whitelist()
def get_active_users(arg=None):
return webnotes.conn.sql("""select name from tabProfile
- where enabled=1 and
+ where ifnull(enabled,0)=1 and
+ docstatus < 2 and
name not in ('Administrator', 'Guest')
order by first_name""", as_dict=1)
diff --git a/erpnext/utilities/page/todo/todo.js b/erpnext/utilities/page/todo/todo.js
index 77e4625fae..dfaa7cdecf 100644
--- a/erpnext/utilities/page/todo/todo.js
+++ b/erpnext/utilities/page/todo/todo.js
@@ -1,3 +1,19 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see
.
+
wn.provide('erpnext.todo');
erpnext.todo.refresh = function() {
@@ -30,14 +46,22 @@ erpnext.todo.ToDoItem = Class.extend({
}
todo.labelclass = label_map[todo.priority];
todo.userdate = dateutil.str_to_user(todo.date);
+ if(todo.reference_name && todo.reference_type) {
+ todo.link = repl('
\
+ %(reference_name)s ', todo);
+ } else if(todo.reference_type) {
+ todo.link = repl('
\
+ %(reference_type)s ', todo);
+ } else {
+ todo.link = '';
+ }
$('#todo-list').append(repl('
', todo));
$todo = $('div.todoitem:last');
@@ -46,7 +70,7 @@ erpnext.todo.ToDoItem = Class.extend({
$todo.find('.description').css('text-decoration', 'line-through');
}
- if(!todo.reference_name)
+ if(!todo.reference_type)
$todo.find('.ref_link').toggle(false);
$todo.find('.description')
@@ -129,4 +153,4 @@ erpnext.todo.save = function(btn) {
wn.pages.todo.onload = function() {
// load todos
erpnext.todo.refresh();
-}
\ No newline at end of file
+}
diff --git a/erpnext/utilities/page/todo/todo.py b/erpnext/utilities/page/todo/todo.py
index c10809e8bf..05d55fe4a8 100644
--- a/erpnext/utilities/page/todo/todo.py
+++ b/erpnext/utilities/page/todo/todo.py
@@ -1,3 +1,19 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
.
+
import webnotes
from webnotes.model.doc import Document
diff --git a/erpnext/utilities/page/users/__init__.py b/erpnext/utilities/page/users/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/erpnext/utilities/page/users/users.css b/erpnext/utilities/page/users/users.css
new file mode 100644
index 0000000000..1a85d153c0
--- /dev/null
+++ b/erpnext/utilities/page/users/users.css
@@ -0,0 +1,35 @@
+.user-card {
+ border-radius: 5px;
+ width: 200px;
+ margin: 11px;
+ padding: 11px;
+ background-color: #FFEDBD;
+ box-shadow: 3px 3px 5px #888;
+ float: left;
+ overflow: hidden;
+}
+
+.user-card.disabled {
+ background-color: #eee;
+}
+
+.user-card img {
+ height: 60px;
+}
+
+.user-role {
+ padding: 5px;
+ width: 45%;
+ float: left;
+}
+
+table.user-perm {
+ border-collapse: collapse;
+}
+
+table.user-perm td, table.user-perm th {
+ padding: 5px;
+ text-align: center;
+ border-bottom: 1px solid #aaa;
+ min-width: 30px;
+}
\ No newline at end of file
diff --git a/erpnext/utilities/page/users/users.html b/erpnext/utilities/page/users/users.html
new file mode 100644
index 0000000000..fe2f000413
--- /dev/null
+++ b/erpnext/utilities/page/users/users.html
@@ -0,0 +1,13 @@
+
+
×
+
Users
+
+
Add, disable, delete users and change their roles, passwords and security settings
+
+ Add User
+
+
+
+
+
\ No newline at end of file
diff --git a/erpnext/utilities/page/users/users.js b/erpnext/utilities/page/users/users.js
new file mode 100644
index 0000000000..130e5385d1
--- /dev/null
+++ b/erpnext/utilities/page/users/users.js
@@ -0,0 +1,378 @@
+// ERPNext - web based ERP (http://erpnext.com)
+// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see
.
+
+$.extend(wn.pages.users, {
+ onload: function(wrapper) {
+ wn.pages.users.profiles = {};
+ wn.pages.users.refresh();
+ wn.pages.users.setup();
+ wn.pages.users.role_editor = new erpnext.RoleEditor();
+ },
+ setup: function() {
+ // set roles
+ $('.users-area').on('click', '.btn.user-roles', function() {
+ var uid = $(this).parent().parent().attr('data-name');
+ wn.pages.users.role_editor.show(uid);
+ });
+
+ // settings
+ $('.users-area').on('click', '.btn.user-settings', function() {
+ var uid = $(this).parent().parent().attr('data-name');
+ wn.pages.users.show_settings(uid);
+ });
+
+ // delete
+ $('.users-area').on('click', 'a.close', function() {
+ $card = $(this).parent();
+ var uid = $card.attr('data-name');
+ $card.css('opacity', 0.6);
+ wn.call({
+ method: 'utilities.page.users.users.delete',
+ args: {'uid': uid},
+ callback: function(r,rt) {
+ if(!r.exc)
+ $card.fadeOut()
+ }
+ });
+ })
+
+ },
+ refresh: function() {
+ // make the list
+ wn.call({
+ method:'utilities.page.users.users.get',
+ callback: function(r, rt) {
+ $('.users-area').empty();
+ for(var i in r.message) {
+ var p = r.message[i];
+ wn.pages.users.profiles[p.name] = p;
+ wn.pages.users.render(p);
+ }
+ }
+ });
+ },
+ render: function(data) {
+ if(data.file_list) {
+ data.imgsrc = 'files/' + data.file_list.split('\n')[0].split(',')[1];
+ } else {
+ data.imgsrc = 'lib/images/ui/no_img_' + (data.gender=='Female' ? 'f' : 'm') + '.gif';
+ }
+ data.fullname = wn.user_info(data.name).fullname;
+ data.delete_html = '';
+ if(!data.enabled)
+ data.delete_html = '
× ';
+
+ $('.users-area').append(repl('
\
+ %(delete_html)s\
+
\
+
\
+ %(fullname)s \
+ %(name)s \
+ Roles \
+ Settings \
+
\
+
', data));
+
+ if(!data.enabled) {
+ $('.users-area .user-card:last')
+ .addClass('disabled')
+ .find('.user-fullname').html('Disabled');
+ }
+ },
+ show_settings: function(uid) {
+ var me = wn.pages.users;
+ if(!me.settings_dialog)
+ me.make_settings_dialog();
+
+ var p = me.profiles[uid];
+ me.uid = uid;
+
+ me.settings_dialog.set_values({
+ restrict_ip: p.restrict_ip || '',
+ login_before: p.login_before || '',
+ login_after: p.login_after || '',
+ enabled: p.enabled || 0,
+ new_password: ''
+ });
+
+ me.settings_dialog.show();
+
+ },
+ make_settings_dialog: function() {
+ var me = wn.pages.users;
+ me.settings_dialog = new wn.widgets.Dialog({
+ title: 'Set User Security',
+ width: 500,
+ fields: [
+ {
+ label:'Enabled',
+ description: 'Uncheck to disable',
+ fieldtype: 'Check', fieldname: 'enabled'
+ },
+ {
+ label:'IP Address',
+ description: 'Restrict user login by IP address, partial ips (111.111.111), \
+ multiple addresses (separated by commas) allowed',
+ fieldname:'restrict_ip', fieldtype:'Data'
+ },
+ {
+ label:'Login After',
+ description: 'User can only login after this hour (0-24)',
+ fieldtype: 'Int', fieldname: 'login_after'
+ },
+ {
+ label:'Login Before',
+ description: 'User can only login before this hour (0-24)',
+ fieldtype: 'Int', fieldname: 'login_before'
+ },
+ {
+ label:'New Password',
+ description: 'Update the current user password',
+ fieldtype: 'Data', fieldname: 'new_password'
+ },
+ {
+ label:'Update', fieldtype:'Button', fieldname:'update'
+ }
+ ]
+ });
+
+ this.settings_dialog.fields_dict.update.input.onclick = function() {
+ var btn = this;
+ var args = me.settings_dialog.get_values();
+ args.user = me.uid;
+
+ if (args.new_password) {
+ me.get_password(btn, args);
+ } else {
+ me.update_security(btn, args);
+ }
+ };
+
+ },
+ update_security: function(btn, args) {
+ var me = wn.pages.users;
+ $(btn).set_working();
+ $c_page('utilities', 'users', 'update_security', JSON.stringify(args), function(r,rt) {
+ $(btn).done_working();
+ if(r.exc) {
+ msgprint(r.exc);
+ return;
+ }
+ me.settings_dialog.hide();
+ $.extend(me.profiles[me.uid], me.settings_dialog.get_values());
+ me.refresh();
+ });
+ },
+ get_password: function(btn, args) {
+ var me = wn.pages.users;
+ var pass_d = new wn.widgets.Dialog({
+ title: 'Your Password',
+ width: 300,
+ fields: [
+ {
+ label: 'Please Enter
Your Password ',
+ description: "Your password is required to update the user's password",
+ fieldtype: 'Password', fieldname: 'sys_admin_pwd', reqd: 1
+ },
+ {
+ label: 'Continue', fieldtype: 'Button', fieldname: 'continue'
+ }
+ ]
+ });
+
+ pass_d.fields_dict.continue.input.onclick = function() {
+ btn.pwd_dialog.hide();
+ args.sys_admin_pwd = btn.pwd_dialog.get_values().sys_admin_pwd;
+ btn.set_working();
+ me.update_security(btn, args);
+ btn.done_working();
+ }
+
+ pass_d.show();
+ btn.pwd_dialog = pass_d;
+ btn.done_working();
+ },
+ add_user: function() {
+ var me = wn.pages.users;
+ var d = new wn.widgets.Dialog({
+ title: 'Add User',
+ width: 400,
+ fields: [{
+ fieldtype: 'Data', fieldname: 'user', reqd: 1,
+ label: 'Email Id of the user to add'
+ }, {
+ fieldtype: 'Data', fieldname: 'first_name', reqd: 1, label: 'First Name'
+ }, {
+ fieldtype: 'Data', fieldname: 'last_name', label: 'Last Name'
+ }, {
+ fieldtype: 'Data', fieldname: 'password', reqd: 1, label: 'Password'
+ }, {
+ fieldtype: 'Button', label: 'Add', fieldname: 'add'
+ }]
+ });
+
+ d.make();
+ d.fields_dict.add.input.onclick = function() {
+ v = d.get_values();
+ if(v) {
+ d.fields_dict.add.input.set_working();
+ $c_page('utilities', 'users', 'add_user', v, function(r,rt) {
+ if(r.exc) { msgprint(r.exc); return; }
+ else {
+ wn.boot.user_info[v.user] = {fullname:v.first_name + ' ' + v.last_name};
+ d.hide();
+ me.refresh();
+ }
+ })
+ }
+ }
+ d.show();
+ }
+});
+
+erpnext.RoleEditor = Class.extend({
+ init: function() {
+ this.dialog = new wn.widgets.Dialog({
+ title: 'Set Roles'
+ });
+ var me = this;
+ $(this.dialog.body).html('
Loading...
')
+ wn.call({
+ method:'utilities.page.users.users.get_roles',
+ callback: function(r) {
+ me.roles = r.message;
+ me.show_roles();
+ }
+ });
+ },
+ show_roles: function() {
+ var me = this;
+ $(this.dialog.body).empty();
+ for(var i in this.roles) {
+ $(this.dialog.body).append(repl('
', {role: this.roles[i]}));
+ }
+ $(this.dialog.body).append('
\
+ Save
');
+ $(this.dialog.body).find('button.btn-primary').click(function() {
+ me.save();
+ });
+ $(this.dialog.body).find('.user-role a').click(function() {
+ me.show_permissions($(this).parent().attr('data-user-role'))
+ return false;
+ })
+ },
+ show: function(uid) {
+ var me = this;
+ this.uid = uid;
+ this.dialog.show();
+ // set user roles
+ wn.call({
+ method:'utilities.page.users.users.get_user_roles',
+ args: {uid:uid},
+ callback: function(r, rt) {
+ $(me.dialog.body).find('input[type="checkbox"]').attr('checked', false);
+ for(var i in r.message) {
+ $(me.dialog.body)
+ .find('[data-user-role="'+r.message[i]
+ +'"] input[type="checkbox"]').attr('checked',true);
+ }
+ }
+ })
+ },
+ save: function() {
+ var set_roles = [];
+ var unset_roles = [];
+ $(this.dialog.body).find('[data-user-role]').each(function() {
+ var $check = $(this).find('input[type="checkbox"]');
+ if($check.attr('checked')) {
+ set_roles.push($(this).attr('data-user-role'));
+ } else {
+ unset_roles.push($(this).attr('data-user-role'));
+ }
+ })
+ wn.call({
+ method:'utilities.page.users.users.update_roles',
+ args: {
+ set_roles: JSON.stringify(set_roles),
+ unset_roles: JSON.stringify(unset_roles),
+ uid: this.uid
+ },
+ btn: $(this.dialog.body).find('.btn-primary').get(0),
+ callback: function() {
+
+ }
+ })
+ },
+ show_permissions: function(role) {
+ // show permissions for a role
+ var me = this;
+ if(!this.perm_dialog)
+ this.make_perm_dialog()
+ $(this.perm_dialog.body).empty();
+ wn.call({
+ method:'utilities.page.users.users.get_perm_info',
+ args: {role: role},
+ callback: function(r) {
+ var $body = $(me.perm_dialog.body);
+ $body.append('
\
+ Document Type \
+ Level \
+ Read \
+ Write \
+ Submit \
+ Cancel \
+ Amend
');
+ for(var i in r.message) {
+ var perm = r.message[i];
+
+ // if permission -> icon
+ for(key in perm) {
+ if(key!='parent' && key!='permlevel') {
+ if(perm[key]) {
+ perm[key] = '
';
+ } else {
+ perm[key] = '';
+ }
+ }
+ }
+
+ $body.find('tbody').append(repl('
\
+ %(parent)s \
+ %(permlevel)s \
+ %(read)s \
+ %(write)s \
+ %(submit)s \
+ %(cancel)s \
+ %(amend)s \
+ ', perm))
+ }
+
+ me.perm_dialog.show();
+ }
+ });
+
+ },
+ make_perm_dialog: function() {
+ this.perm_dialog = new wn.widgets.Dialog({
+ title:'Role Permissions',
+ width: 500
+ });
+ }
+})
diff --git a/erpnext/utilities/page/users/users.py b/erpnext/utilities/page/users/users.py
new file mode 100644
index 0000000000..f2bb1a5f47
--- /dev/null
+++ b/erpnext/utilities/page/users/users.py
@@ -0,0 +1,193 @@
+# ERPNext - web based ERP (http://erpnext.com)
+# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
.
+
+import webnotes
+import json
+
+from webnotes.model.doc import Document
+from webnotes.utils import cint
+
+@webnotes.whitelist()
+def get(arg=None):
+ """return all users"""
+ return webnotes.conn.sql("""select name, file_list, enabled, gender,
+ restrict_ip, login_before, login_after from tabProfile
+ where docstatus<2 and name not in ('Administrator', 'Guest') order by
+ ifnull(enabled,0) desc, name""", as_dict=1)
+
+@webnotes.whitelist()
+def get_roles(arg=None):
+ """return all roles"""
+ return [r[0] for r in webnotes.conn.sql("""select name from tabRole
+ where name not in ('Administrator', 'Guest', 'All') order by name""")]
+
+@webnotes.whitelist()
+def get_user_roles(arg=None):
+ """get roles for a user"""
+ return [r[0] for r in webnotes.conn.sql("""select role from tabUserRole
+ where parent=%s""", webnotes.form_dict['uid'])]
+
+@webnotes.whitelist()
+def get_perm_info(arg=None):
+ """get permission info"""
+ return webnotes.conn.sql("""select parent, permlevel, `read`, `write`, submit,
+ cancel, amend from tabDocPerm where role=%s
+ and docstatus<2 order by parent, permlevel""",
+ webnotes.form_dict['role'], as_dict=1)
+
+@webnotes.whitelist()
+def update_roles(arg=None):
+ """update set and unset roles"""
+ # remove roles
+ unset = json.loads(webnotes.form_dict['unset_roles'])
+ webnotes.conn.sql("""delete from tabUserRole where parent='%s'
+ and role in ('%s')""" % (webnotes.form_dict['uid'], "','".join(unset)))
+
+ # check for 1 system manager
+ if not webnotes.conn.sql("""select parent from tabUserRole where role='System Manager'
+ and docstatus<2"""):
+ webnotes.msgprint("Sorry there must be atleast one 'System Manager'")
+ raise webnotes.ValidationError
+
+ # add roles
+ roles = get_user_roles()
+ toset = json.loads(webnotes.form_dict['set_roles'])
+ for role in toset:
+ if not role in roles:
+ d = Document('UserRole')
+ d.role = role
+ d.parent = webnotes.form_dict['uid']
+ d.save()
+
+ webnotes.msgprint('Roles Updated')
+
+@webnotes.whitelist()
+def update_security(args=''):
+ args = json.loads(args)
+ webnotes.conn.set_value('Profile', args['user'], 'restrict_ip', args.get('restrict_ip'))
+ webnotes.conn.set_value('Profile', args['user'], 'login_after', args.get('login_after'))
+ webnotes.conn.set_value('Profile', args['user'], 'login_before', args.get('login_before'))
+ webnotes.conn.set_value('Profile', args['user'], 'enabled', int(args.get('enabled',0)) or 0)
+
+ if args.get('new_password') and args.get('sys_admin_pwd'):
+ if cint(webnotes.conn.get_value('Control Panel',None,'sync_with_gateway')):
+ import server_tools.gateway_utils
+ res = server_tools.gateway_utils.change_password('', args['new_password'],
+ args['user'], args['sys_admin_pwd'])
+ if 'Traceback' not in res['message']:
+ webnotes.msgprint(res['message'])
+ webnotes.conn.sql("update tabProfile set password=password(%s) where name=%s",
+ (args['new_password'], args['user']))
+ else:
+ webnotes.msgprint('Settings Updated')
+
+
+
+#
+# user addition
+#
+
+@webnotes.whitelist()
+def add_user(args):
+ args = json.loads(args)
+ # erpnext-saas
+ if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
+ from server_tools.gateway_utils import add_user_gateway
+ add_user_gateway(args)
+
+ add_profile(args)
+
+@webnotes.whitelist()
+def add_profile(args):
+ from webnotes.utils import validate_email_add, now
+ email = args['user']
+
+ sql = webnotes.conn.sql
+
+ if not email:
+ email = webnotes.form_dict.get('user')
+ if not validate_email_add(email):
+ raise Exception
+ return 'Invalid Email Id'
+
+ if sql("select name from tabProfile where name = %s", email):
+ # exists, enable it
+ sql("update tabProfile set enabled = 1, docstatus=0 where name = %s", email)
+ webnotes.msgprint('Profile exists, enabled it with new password')
+ else:
+ # does not exist, create it!
+ pr = Document('Profile')
+ pr.name = email
+ pr.email = email
+ pr.first_name = args.get('first_name')
+ pr.last_name = args.get('last_name')
+ pr.enabled = 1
+ pr.user_type = 'System User'
+ pr.save(1)
+
+ if args.get('password'):
+ sql("""
+ UPDATE tabProfile
+ SET password = PASSWORD(%s), modified = %s
+ WHERE name = %s""", (args.get('password'), now, email))
+
+ send_welcome_mail(email, args)
+
+@webnotes.whitelist()
+def send_welcome_mail(email, args):
+ """send welcome mail to user with password and login url"""
+ pr = Document('Profile', email)
+ from webnotes.utils.email_lib import sendmail_md
+ args.update({
+ 'company': webnotes.conn.get_default('company'),
+ 'password': args.get('password'),
+ 'account_url': webnotes.conn.get_value('Website Settings',
+ 'Website Settings', 'subdomain') or ""
+ })
+ if not args.get('last_name'): args['last_name'] = ''
+ sendmail_md(pr.email, subject="Welcome to ERPNext", msg=welcome_txt % args, from_defs=1)
+
+#
+# delete user
+#
+@webnotes.whitelist()
+def delete(arg=None):
+ """delete user"""
+ webnotes.conn.sql("update tabProfile set enabled=0, docstatus=2 where name=%s",
+ webnotes.form_dict['uid'])
+ # erpnext-saas
+ if int(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
+ from server_tools.gateway_utils import remove_user_gateway
+ remove_user_gateway(webnotes.form_dict['uid'])
+
+ webnotes.login_manager.logout(user=webnotes.form_dict['uid'])
+
+welcome_txt = """
+## %(company)s
+
+Dear %(first_name)s %(last_name)s
+
+Welcome!
+
+A new account has been created for you, here are your details:
+
+login-id: %(user)s
+password: %(password)s
+
+To login to your new ERPNext account, please go to:
+
+%(account_url)s
+"""
diff --git a/erpnext/utilities/page/users/users.txt b/erpnext/utilities/page/users/users.txt
new file mode 100644
index 0000000000..165cc1695b
--- /dev/null
+++ b/erpnext/utilities/page/users/users.txt
@@ -0,0 +1,28 @@
+# Page, users
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2012-02-28 10:29:39',
+ 'docstatus': 0,
+ 'modified': '2012-02-28 10:29:39',
+ 'modified_by': u'Administrator',
+ 'owner': u'Administrator'
+ },
+
+ # These values are common for all Page
+ {
+ 'doctype': 'Page',
+ 'module': u'Utilities',
+ 'name': '__common__',
+ 'page_name': u'users',
+ 'standard': u'Yes',
+ 'title': u'Users'
+ },
+
+ # Page, users
+ {
+ 'doctype': 'Page',
+ 'name': u'users'
+ }
+]
\ No newline at end of file
diff --git a/erpnext/website/doctype/style_settings/custom_template.css b/erpnext/website/doctype/style_settings/custom_template.css
index e6eeeb34fa..8eb3d6396f 100644
--- a/erpnext/website/doctype/style_settings/custom_template.css
+++ b/erpnext/website/doctype/style_settings/custom_template.css
@@ -1,6 +1,6 @@
body {
{% if doc.background_image %}
- background: url("files/{{ doc.background_image }}") repeat !important;
+ background: url("files/{{ doc.background_image }}") repeat;
{% elif doc.background_color %}
background-color: #{{ doc.background_color }};
{% endif %}
diff --git a/erpnext/website/page/website_home/website_home.html b/erpnext/website/page/website_home/website_home.html
index 747ca5aa03..f7bb208bea 100644
--- a/erpnext/website/page/website_home/website_home.html
+++ b/erpnext/website/page/website_home/website_home.html
@@ -1,10 +1,10 @@
×
-
Support
+
Website
-
+
Static (content) web page
Product listed in catolog
diff --git a/images/stripedbg.png b/images/stripedbg.png
new file mode 100755
index 0000000000..64ece5707d
Binary files /dev/null and b/images/stripedbg.png differ
diff --git a/index.cgi b/index.cgi
index e7a1d57661..ed766eb11f 100755
--- a/index.cgi
+++ b/index.cgi
@@ -38,10 +38,25 @@ def init():
# init request
try:
webnotes.http_request = webnotes.auth.HTTPRequest()
+ return True
except webnotes.AuthenticationError, e:
- pass
+ return True
except webnotes.UnknownDomainError, e:
print "Location: " + (webnotes.defs.redirect_404)
+ except webnotes.SessionStopped, e:
+ if 'cmd' in webnotes.form_dict:
+ webnotes.handler.print_json()
+ else:
+ print "Content-Type: text/html"
+ print
+ print """
+
+
+ Updating.
+ We will be back in a few moments...
+
+
+ """
def respond():
import webnotes
@@ -55,5 +70,5 @@ def respond():
print webnotes.cms.index.get()
if __name__=="__main__":
- init()
- respond()
+ if init():
+ respond()
diff --git a/js/all-app.js b/js/all-app.js
index 952f24815a..aa2677859b 100644
--- a/js/all-app.js
+++ b/js/all-app.js
@@ -1,10 +1,4 @@
-/*
- * lib/js/lib/jquery.min.js
- *//*! jQuery v1.7.1 jquery.com | jquery.org/license */
-(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g
0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;ca ",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o=""+"",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};
-f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c ",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML=" ",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="
";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,""," "],thead:[1,""],tr:[2,""],td:[3,""],col:[2,""],area:[1,""," "],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function()
-{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>$2>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/