From 4b9a3ed8a0600e3fd7db4588db400311744db019 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 9 Apr 2013 10:27:06 +0530 Subject: [PATCH 01/13] [knowledge base] added all permissions --- utilities/page/questions/questions.txt | 27 ++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/utilities/page/questions/questions.txt b/utilities/page/questions/questions.txt index 64aaa514d3..804e2a6ce9 100644 --- a/utilities/page/questions/questions.txt +++ b/utilities/page/questions/questions.txt @@ -1,20 +1,31 @@ [ { - "owner": "Administrator", + "creation": "2012-06-14 18:44:56", "docstatus": 0, - "creation": "2011-05-04 11:09:49", + "modified": "2013-04-09 10:25:31", "modified_by": "Administrator", - "modified": "2011-03-29 13:53:57" + "owner": "Administrator" }, { - "name": "__common__", + "doctype": "Page", "module": "Utilities", - "standard": "Yes", + "name": "__common__", "page_name": "Questions", - "doctype": "Page" + "standard": "Yes" }, { - "name": "questions", - "doctype": "Page" + "doctype": "Page Role", + "name": "__common__", + "parent": "questions", + "parentfield": "roles", + "parenttype": "Page", + "role": "All" + }, + { + "doctype": "Page", + "name": "questions" + }, + { + "doctype": "Page Role" } ] \ No newline at end of file From 0c1611219ed7f325bb997caf1d0510d1507af0a6 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Apr 2013 13:54:13 +0530 Subject: [PATCH 02/13] [files] [cleanup/redesign] removed the old file_list structure and also added file listing in setup --- hr/doctype/employee/employee.py | 26 ++++++++++--------- patches/april_2013/p05_update_file_data.py | 4 ++- patches/april_2013/p06_update_file_size.py | 11 ++++++++ patches/patch_list.py | 2 ++ setup/page/setup/setup.js | 6 +++++ .../stock_reconciliation.txt | 7 +++-- 6 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 patches/april_2013/p06_update_file_size.py diff --git a/hr/doctype/employee/employee.py b/hr/doctype/employee/employee.py index 16ecb6d2ed..4100e2ee81 100644 --- a/hr/doctype/employee/employee.py +++ b/hr/doctype/employee/employee.py @@ -100,18 +100,20 @@ class DocType: if self.doc.gender: profile_wrapper.doc.gender = self.doc.gender - if self.doc.image and self.doc.file_list: - # add to file list and user_image - for file_args in self.doc.file_list.split("\n"): - fname, fid = file_args.split(",") - if self.doc.image == fname: - new_file_args = fname + "," + fid - file_list = cstr(profile_wrapper.doc.file_list).split("\n") - if new_file_args not in file_list: - file_list += [new_file_args] - profile_wrapper.doc.file_list = "\n".join(file_list) - profile_wrapper.doc.user_image = fname - break + if self.doc.image: + if not profile_wrapper.doc.user_image == self.doc.image: + profile_wrapper.doc.user_image = self.doc.image + try: + webnotes.doc({ + "doctype": "File Data", + "file_name": self.doc.image, + "attached_to_doctype": "Profile", + "attached_to_name": self.doc.user_id + }).insert() + except webnotes.DuplicateEntryError, e: + # already exists + pass + break profile_wrapper.save() diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index 1f288c1aac..a9a3cf9629 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -2,11 +2,13 @@ import webnotes, webnotes.utils, os from webnotes.modules.export_file import export_to_files def execute(): + webnotes.reload_doc("core", "doctype", "file_data") + webontes.reset_perms("File Data") + singles = webnotes.conn.sql_list("""select name from tabDocType where ifnull(issingle,0)=1""") for doctype in webnotes.conn.sql_list("""select parent from tabDocField where fieldname='file_list' and fieldtype='Text'"""): - print doctype if doctype in singles: doc = webnotes.doc(doctype, doctype) update_for_doc(doctype, doc) diff --git a/patches/april_2013/p06_update_file_size.py b/patches/april_2013/p06_update_file_size.py new file mode 100644 index 0000000000..e61c060d52 --- /dev/null +++ b/patches/april_2013/p06_update_file_size.py @@ -0,0 +1,11 @@ +import webnotes, os, webnotes.utils + +def execute(): + files_path = webnotes.utils.get_path("public", "files") + for f in webnotes.conn.sql("""select name, file_name from + `tabFile Data`""", as_dict=True): + filepath = os.path.join(files_path, f.file_name) + if os.path.exists(filepath): + webnotes.conn.set_value("File Data", f.name, "file_size", os.stat(filepath).st_size) + + \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index b827c5b482..d5b62e37fc 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -241,4 +241,6 @@ patch_list = [ "patches.april_2013.p04_reverse_modules_list", "execute:webnotes.delete_doc('Search Criteria', 'time_log_summary')", "patches.april_2013.p04_update_role_in_pages", + "patches.april_2013.p05_update_file_data", + "patches.april_2013.p06_update_file_size", ] \ No newline at end of file diff --git a/setup/page/setup/setup.js b/setup/page/setup/setup.js index 4ab7578850..b47f6f28d1 100644 --- a/setup/page/setup/setup.js +++ b/setup/page/setup/setup.js @@ -82,6 +82,12 @@ wn.module_page["Setup"] = [ label: wn._("Rename Tool"), "description":wn._("Rename multiple items in one go") }, + { + "route":"List/File Data", + doctype: "File Data", + label: wn._("File Manager"), + "description":wn._("List, delete uploaded files.") + }, ] }, { diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.txt b/stock/doctype/stock_reconciliation/stock_reconciliation.txt index 760620bb73..9b5b2a128a 100644 --- a/stock/doctype/stock_reconciliation/stock_reconciliation.txt +++ b/stock/doctype/stock_reconciliation/stock_reconciliation.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-03-26 06:51:17", + "creation": "2013-03-28 10:35:31", "docstatus": 0, - "modified": "2013-03-26 08:32:03", + "modified": "2013-04-10 13:44:19", "modified_by": "Administrator", "owner": "Administrator" }, @@ -52,6 +52,7 @@ "fieldname": "posting_date", "fieldtype": "Date", "in_filter": 0, + "in_list_view": 1, "label": "Posting Date", "oldfieldname": "reconciliation_date", "oldfieldtype": "Date", @@ -63,6 +64,7 @@ "fieldname": "posting_time", "fieldtype": "Time", "in_filter": 0, + "in_list_view": 1, "label": "Posting Time", "oldfieldname": "reconciliation_time", "oldfieldtype": "Time", @@ -148,6 +150,7 @@ "fieldname": "stock_value_difference", "fieldtype": "Currency", "hidden": 1, + "in_list_view": 1, "label": "Stock Value Difference", "print_hide": 1 }, From 44323693f4abd96e8ef4445ffcd1ea9d4825c512 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Apr 2013 13:54:44 +0530 Subject: [PATCH 03/13] [files] [cleanup/redesign] removed the old file_list structure and also added file listing in setup --- home/page/latest_updates/latest_updates.js | 1 + 1 file changed, 1 insertion(+) diff --git a/home/page/latest_updates/latest_updates.js b/home/page/latest_updates/latest_updates.js index c0bad9405b..6f8a05b81c 100644 --- a/home/page/latest_updates/latest_updates.js +++ b/home/page/latest_updates/latest_updates.js @@ -1,4 +1,5 @@ erpnext.updates = [ + ["10th April", ["Redesigned File Uploads and added File Manager in Setup"]], ["27th March", ["Rename multiple items together. Go to Setup > Rename Tool"]], ["26th March", ["Added project to Stock Ledger and Balance", "Added Default Cash Account in Company."]], From 04a1916bbdb6e96fc4e13502fa9ded43dc860b2a Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Apr 2013 13:57:08 +0530 Subject: [PATCH 04/13] [files] [cleanup/redesign] removed the old file_list structure and also added file listing in setup --- patches/april_2013/p05_update_file_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index a9a3cf9629..dc3b9a882c 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -36,7 +36,7 @@ def update_for_doc(doctype, doc): exists = True if not (filename.startswith("http://") or filename.startswith("https://")): - if not os.path.exists(os.path.join(webnotes.utils.get_base_path(), "public", "files", filename)): + if not os.path.exists(webnotes.utils.get_path("public", "files", filename): exists = False if exists: From 753ae05ba90d212bddd0e46446d856d906bb1b82 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Apr 2013 14:14:48 +0530 Subject: [PATCH 05/13] [files] [cleanup/redesign] removed the old file_list structure and also added file listing in setup --- patches/april_2013/p05_update_file_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index dc3b9a882c..a1d2f63b62 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -36,7 +36,7 @@ def update_for_doc(doctype, doc): exists = True if not (filename.startswith("http://") or filename.startswith("https://")): - if not os.path.exists(webnotes.utils.get_path("public", "files", filename): + if not os.path.exists(webnotes.utils.get_path("public", "files", filename)): exists = False if exists: From 9e93037119cd179efd452d3050ac8595798ad426 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Apr 2013 14:17:45 +0530 Subject: [PATCH 06/13] [files] [cleanup/redesign] removed the old file_list structure and also added file listing in setup --- patches/april_2013/p05_update_file_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index a1d2f63b62..8fd38ede88 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -3,7 +3,7 @@ from webnotes.modules.export_file import export_to_files def execute(): webnotes.reload_doc("core", "doctype", "file_data") - webontes.reset_perms("File Data") + webnotes.reset_perms("File Data") singles = webnotes.conn.sql_list("""select name from tabDocType where ifnull(issingle,0)=1""") From cc887a83208f7ca6f4a4b3640484ea56b8376179 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Apr 2013 14:20:56 +0530 Subject: [PATCH 07/13] [files] [cleanup/redesign] removed the old file_list structure and also added file listing in setup --- patches/april_2013/p05_update_file_data.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index 8fd38ede88..9fed8a495b 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -32,7 +32,11 @@ def update_for_doc(doctype, doc): if not filedata: continue - filename, fileid = filedata.split(",") + filedata = filedata.split(",") + if len(filedata)==2: + filename, fileid = filedata[0], filedata[1] + else: + continue exists = True if not (filename.startswith("http://") or filename.startswith("https://")): From 7c179bd00c35024ceed699009f6584726962617b Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Apr 2013 14:22:06 +0530 Subject: [PATCH 08/13] [files] [cleanup/redesign] removed the old file_list structure and also added file listing in setup --- patches/april_2013/p06_update_file_size.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/patches/april_2013/p06_update_file_size.py b/patches/april_2013/p06_update_file_size.py index e61c060d52..8709c7b642 100644 --- a/patches/april_2013/p06_update_file_size.py +++ b/patches/april_2013/p06_update_file_size.py @@ -4,8 +4,9 @@ def execute(): files_path = webnotes.utils.get_path("public", "files") for f in webnotes.conn.sql("""select name, file_name from `tabFile Data`""", as_dict=True): - filepath = os.path.join(files_path, f.file_name) - if os.path.exists(filepath): - webnotes.conn.set_value("File Data", f.name, "file_size", os.stat(filepath).st_size) + if f.file_name: + filepath = os.path.join(files_path, f.file_name) + if os.path.exists(filepath): + webnotes.conn.set_value("File Data", f.name, "file_size", os.stat(filepath).st_size) \ No newline at end of file From 1b35b1aa62522a80edd3f2db2294b27a22149e7a Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 10 Apr 2013 16:16:59 +0530 Subject: [PATCH 09/13] [file] [patch fix] --- patches/april_2013/p05_update_file_data.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index 9fed8a495b..a5540cc3cd 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -11,8 +11,9 @@ def execute(): fieldname='file_list' and fieldtype='Text'"""): if doctype in singles: doc = webnotes.doc(doctype, doctype) - update_for_doc(doctype, doc) - webnotes.conn.set_value(doctype, None, "file_list", None) + if doc.file_list: + update_for_doc(doctype, doc) + webnotes.conn.set_value(doctype, None, "file_list", None) else: try: for doc in webnotes.conn.sql("""select name, file_list from `tab%s` where From 5ed6676193b4d9781e84584cc82f0a48945e06c4 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 15 Apr 2013 10:49:17 +0530 Subject: [PATCH 10/13] [editor] [stylefix] --- website/doctype/website_settings/website_settings.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/doctype/website_settings/website_settings.txt b/website/doctype/website_settings/website_settings.txt index 442663aae4..4b66e098a4 100644 --- a/website/doctype/website_settings/website_settings.txt +++ b/website/doctype/website_settings/website_settings.txt @@ -2,7 +2,7 @@ { "creation": "2013-03-25 16:01:34", "docstatus": 0, - "modified": "2013-03-13 16:25:22", + "modified": "2013-04-12 10:30:18", "modified_by": "Administrator", "owner": "Administrator" }, @@ -50,7 +50,7 @@ "fieldtype": "Link", "label": "Home Page", "options": "Web Page", - "reqd": 1 + "reqd": 0 }, { "description": "The name of your company / website as you want to appear on browser title bar. All pages will have this as the prefix to the title.", From a1924eda90379c769453581c0944de96900e6677 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 17 Apr 2013 18:40:40 +0530 Subject: [PATCH 11/13] [employee] [fix] removed erroneous break statement --- hr/doctype/employee/employee.py | 1 - 1 file changed, 1 deletion(-) diff --git a/hr/doctype/employee/employee.py b/hr/doctype/employee/employee.py index bef3274c22..87fe9a45e9 100644 --- a/hr/doctype/employee/employee.py +++ b/hr/doctype/employee/employee.py @@ -114,7 +114,6 @@ class DocType: except webnotes.DuplicateEntryError, e: # already exists pass - break profile_wrapper.save() From cdc9e2cd6fe3a5639fc18ad7bcb8ae143c08426e Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 25 Apr 2013 11:06:17 +0530 Subject: [PATCH 12/13] [patch] [file data] reset permissions --- patches/patch_list.py | 1 + 1 file changed, 1 insertion(+) diff --git a/patches/patch_list.py b/patches/patch_list.py index abee4f0cbc..a6dd0a217b 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -246,4 +246,5 @@ patch_list = [ "execute:webnotes.delete_doc('DocType Mapper', 'Delivery Note-Packing Slip')", "execute:webnotes.reload_doc('Stock', 'DocType', 'Delivery Note Item')", "patches.april_2013.p06_default_cost_center", + "execute:webnotes.reset_perms('File Data')", ] \ No newline at end of file From 4cbeda1ec7ced13f5227948641467f2c66db148d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 29 Apr 2013 10:48:45 +0530 Subject: [PATCH 13/13] [patch] [fix] commented out export_to_files call in p05_update_file_data patch --- patches/april_2013/p05_update_file_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py index a5540cc3cd..986e5b9b53 100644 --- a/patches/april_2013/p05_update_file_data.py +++ b/patches/april_2013/p05_update_file_data.py @@ -26,7 +26,7 @@ def execute(): webnotes.conn.sql("""delete from tabDocField where fieldname='file_list' and parent=%s""", doctype) - export_to_files([["DocType", doctype]]) + # export_to_files([["DocType", doctype]]) def update_for_doc(doctype, doc): for filedata in doc.file_list.split("\n"):