From 0104ec2f3d0f172a99f50645332a0b3ce8011b9d Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 10 Jul 2018 14:29:47 +0530 Subject: [PATCH] conference fixes --- .../conference_participant.json | 548 ++++++++++-------- .../conference_participant.py | 3 + .../test_conference_participant.js | 23 + .../conference_registration.html | 20 - .../{email_alert => notification}/__init__.py | 0 .../conference_registration/__init__.py | 0 .../conference_registration.html | 24 + .../conference_registration.json | 0 .../conference_registration.py | 0 .../buy_tickets_inr/buy_tickets_inr.js | 20 +- .../buy_tickets_inr/buy_tickets_inr.json | 142 +++-- .../buy_tickets_paypal/buy_tickets_paypal.js | 22 +- .../buy_tickets_paypal.json | 148 +++-- foundation/migrate.py | 4 - 14 files changed, 506 insertions(+), 448 deletions(-) create mode 100644 foundation/erpnext_foundation/doctype/conference_participant/test_conference_participant.js delete mode 100644 foundation/erpnext_foundation/email_alert/conference_registration/conference_registration.html rename foundation/erpnext_foundation/{email_alert => notification}/__init__.py (100%) rename foundation/erpnext_foundation/{email_alert => notification}/conference_registration/__init__.py (100%) create mode 100644 foundation/erpnext_foundation/notification/conference_registration/conference_registration.html rename foundation/erpnext_foundation/{email_alert => notification}/conference_registration/conference_registration.json (100%) rename foundation/erpnext_foundation/{email_alert => notification}/conference_registration/conference_registration.py (100%) diff --git a/foundation/erpnext_foundation/doctype/conference_participant/conference_participant.json b/foundation/erpnext_foundation/doctype/conference_participant/conference_participant.json index 7dfbfcb8..0785991a 100644 --- a/foundation/erpnext_foundation/doctype/conference_participant/conference_participant.json +++ b/foundation/erpnext_foundation/doctype/conference_participant/conference_participant.json @@ -1,273 +1,321 @@ { - "allow_copy": 0, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 0, - "creation": "2017-07-06 16:20:28.662095", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 1, - "engine": "InnoDB", + "allow_copy": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "E-CON-2018-.###", + "beta": 0, + "creation": "2017-07-06 16:20:28.662095", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", "fields": [ { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "participant_name", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Participant Name", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "participant_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Participant Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "full_conference_tickets", - "fieldtype": "Int", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Full Conference Tickets", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "", + "fieldname": "conference", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Conference", + "length": 0, + "no_copy": 0, + "options": "\n2017\n2018", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "user_conference_tickets", - "fieldtype": "Int", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "User Conference Tickets", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "full_conference_tickets", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Full Conference Tickets", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "currency", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Currency", - "length": 0, - "no_copy": 0, - "options": "USD\nINR", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "user_conference_tickets", + "fieldtype": "Int", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "User Conference Tickets", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "amount", - "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Amount", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "currency", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Currency", + "length": 0, + "no_copy": 0, + "options": "USD\nINR", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "paid", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Paid", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amount", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Amount", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "thank_you_email_sent", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Thank You Email Sent", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "paid", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Paid", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "thank_you_email_sent", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Thank You Email Sent", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 0, - "max_attachments": 0, - "modified": "2017-07-07 11:36:26.163646", - "modified_by": "Administrator", - "module": "ERPNext Foundation", - "name": "Conference Participant", - "name_case": "", - "owner": "Administrator", + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2018-07-09 18:12:05.062456", + "modified_by": "Administrator", + "module": "ERPNext Foundation", + "name": "Conference Participant", + "name_case": "", + "owner": "Administrator", "permissions": [ { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 0, + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, "write": 1 } - ], - "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1, + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, "track_seen": 0 } \ No newline at end of file diff --git a/foundation/erpnext_foundation/doctype/conference_participant/conference_participant.py b/foundation/erpnext_foundation/doctype/conference_participant/conference_participant.py index b8cd5328..37a4bd51 100644 --- a/foundation/erpnext_foundation/doctype/conference_participant/conference_participant.py +++ b/foundation/erpnext_foundation/doctype/conference_participant/conference_participant.py @@ -7,6 +7,9 @@ import frappe from frappe.model.document import Document class ConferenceParticipant(Document): + def validate(self): + self.conference = '2018' + def on_payment_authorized(self, status_changed_to=None): self.paid = 1 self.save(ignore_permissions=True) diff --git a/foundation/erpnext_foundation/doctype/conference_participant/test_conference_participant.js b/foundation/erpnext_foundation/doctype/conference_participant/test_conference_participant.js new file mode 100644 index 00000000..690791ef --- /dev/null +++ b/foundation/erpnext_foundation/doctype/conference_participant/test_conference_participant.js @@ -0,0 +1,23 @@ +/* eslint-disable */ +// rename this file from _test_[name] to test_[name] to activate +// and remove above this line + +QUnit.test("test: Conference Participant", function (assert) { + let done = assert.async(); + + // number of asserts + assert.expect(1); + + frappe.run_serially([ + // insert a new Conference Participant + () => frappe.tests.make('Conference Participant', [ + // values to be set + {key: 'value'} + ]), + () => { + assert.equal(cur_frm.doc.key, 'value'); + }, + () => done() + ]); + +}); diff --git a/foundation/erpnext_foundation/email_alert/conference_registration/conference_registration.html b/foundation/erpnext_foundation/email_alert/conference_registration/conference_registration.html deleted file mode 100644 index 6ad737c1..00000000 --- a/foundation/erpnext_foundation/email_alert/conference_registration/conference_registration.html +++ /dev/null @@ -1,20 +0,0 @@ -

Dear {{ doc.participant_name }},

- -

Thank you for registering for the 2017 ERPNext Conference!

- -

Here are your ticket details:

- -{% if doc.full_conference_tickets %} -

-Full Conference Tickets: {{ doc.full_conference_tickets or 0 }} -

-{% endif %} -{% if doc.user_conference_tickets %} -

-User Conference Tickets: {{ doc.user_conference_tickets or 0 }} -

-{% endif %} - -

Total Amount: {{ doc.currency }} {{ doc.get_formatted('amount') }}

- -

If you need any help, please email us at foundation@erpnext.com

\ No newline at end of file diff --git a/foundation/erpnext_foundation/email_alert/__init__.py b/foundation/erpnext_foundation/notification/__init__.py similarity index 100% rename from foundation/erpnext_foundation/email_alert/__init__.py rename to foundation/erpnext_foundation/notification/__init__.py diff --git a/foundation/erpnext_foundation/email_alert/conference_registration/__init__.py b/foundation/erpnext_foundation/notification/conference_registration/__init__.py similarity index 100% rename from foundation/erpnext_foundation/email_alert/conference_registration/__init__.py rename to foundation/erpnext_foundation/notification/conference_registration/__init__.py diff --git a/foundation/erpnext_foundation/notification/conference_registration/conference_registration.html b/foundation/erpnext_foundation/notification/conference_registration/conference_registration.html new file mode 100644 index 00000000..0c6d2274 --- /dev/null +++ b/foundation/erpnext_foundation/notification/conference_registration/conference_registration.html @@ -0,0 +1,24 @@ +

Dear {{ doc.participant_name }},

+ +

Thank you for registering for the 2018 ERPNext Conference!

+ +

Here are your ticket details:

+ +

Ticket Number {{ doc.name}}

+ + + + + + + + + + + +
Ticket TypeQtyAmount
Conference Tickets + Lunch + Dinner{{ doc.full_conference_tickets or 0 }}
+ +
Total Amount: {{ doc.currency }} {{ doc.get_formatted('amount') }}
+ + +

If you need any help, please email us at foundation@erpnext.com

\ No newline at end of file diff --git a/foundation/erpnext_foundation/email_alert/conference_registration/conference_registration.json b/foundation/erpnext_foundation/notification/conference_registration/conference_registration.json similarity index 100% rename from foundation/erpnext_foundation/email_alert/conference_registration/conference_registration.json rename to foundation/erpnext_foundation/notification/conference_registration/conference_registration.json diff --git a/foundation/erpnext_foundation/email_alert/conference_registration/conference_registration.py b/foundation/erpnext_foundation/notification/conference_registration/conference_registration.py similarity index 100% rename from foundation/erpnext_foundation/email_alert/conference_registration/conference_registration.py rename to foundation/erpnext_foundation/notification/conference_registration/conference_registration.py diff --git a/foundation/erpnext_foundation/web_form/buy_tickets_inr/buy_tickets_inr.js b/foundation/erpnext_foundation/web_form/buy_tickets_inr/buy_tickets_inr.js index 8c8a7774..5c0d8fce 100644 --- a/foundation/erpnext_foundation/web_form/buy_tickets_inr/buy_tickets_inr.js +++ b/foundation/erpnext_foundation/web_form/buy_tickets_inr/buy_tickets_inr.js @@ -1,17 +1,17 @@ frappe.ready(function() { // bind events here - var calculate = function() { - var amount = parseInt($('input[name="full_conference_tickets"]').val() || 0) * 3000 - + parseInt($('input[name="user_conference_tickets"]').val() || 0) * 600; - $('input[name="amount"]').val(amount); + frappe._calculate = function() { + frappe.web_form.field_group.set_value('amount', + parseInt(frappe.web_form.field_group.get_value('full_conference_tickets') || 0) * 4000 + ) }; - $('input[name="full_conference_tickets"]').on('keyup', function() { - calculate(); - }); - $('input[name="user_conference_tickets"]').on('keyup', function() { - calculate(); - }); + setTimeout(() => { + $('input[data-fieldname="full_conference_tickets"]').on('keyup', function() { + frappe._calculate(); + }); + frappe._calculate(); + }, 1000); $('.btn-form-submit').hide(); }) \ No newline at end of file diff --git a/foundation/erpnext_foundation/web_form/buy_tickets_inr/buy_tickets_inr.json b/foundation/erpnext_foundation/web_form/buy_tickets_inr/buy_tickets_inr.json index 701c8821..2be48567 100644 --- a/foundation/erpnext_foundation/web_form/buy_tickets_inr/buy_tickets_inr.json +++ b/foundation/erpnext_foundation/web_form/buy_tickets_inr/buy_tickets_inr.json @@ -1,88 +1,78 @@ { - "accept_payment": 1, - "allow_comments": 0, - "allow_delete": 0, - "allow_edit": 0, - "allow_incomplete": 0, - "allow_multiple": 1, - "allow_print": 1, - "amount": 0.0, - "amount_based_on_field": 1, - "amount_field": "amount", - "creation": "2017-07-06 16:25:22.393979", - "currency": "INR", - "doc_type": "Conference Participant", - "docstatus": 0, - "doctype": "Web Form", - "idx": 0, - "introduction_text": "", - "is_standard": 1, - "login_required": 1, - "max_attachment_size": 0, - "modified": "2017-07-07 11:06:02.141890", - "modified_by": "Administrator", - "module": "ERPNext Foundation", - "name": "buy-tickets-inr", - "owner": "Administrator", - "payment_button_label": "Buy Now", - "payment_gateway": "Razorpay", - "published": 1, - "route": "buy-tickets-inr", - "show_sidebar": 1, - "sidebar_items": [], - "success_url": "/conf/2017", - "title": "Buy Tickets INR", + "accept_payment": 1, + "allow_comments": 0, + "allow_delete": 0, + "allow_edit": 0, + "allow_incomplete": 0, + "allow_multiple": 1, + "allow_print": 1, + "amount": 0.0, + "amount_based_on_field": 1, + "amount_field": "amount", + "creation": "2017-07-06 16:25:22.393979", + "currency": "INR", + "doc_type": "Conference Participant", + "docstatus": 0, + "doctype": "Web Form", + "idx": 0, + "introduction_text": "", + "is_standard": 1, + "login_required": 1, + "max_attachment_size": 0, + "modified": "2018-07-09 12:24:07.368873", + "modified_by": "Administrator", + "module": "ERPNext Foundation", + "name": "buy-tickets-inr", + "owner": "Administrator", + "payment_button_label": "Buy Now", + "payment_gateway": "Razorpay", + "published": 1, + "route": "buy-tickets-inr", + "show_sidebar": 0, + "sidebar_items": [], + "success_url": "/conf/2017", + "title": "Buy Tickets INR", "web_form_fields": [ { - "fieldname": "participant_name", - "fieldtype": "Data", - "hidden": 0, - "label": "Participant Name", - "max_length": 0, - "max_value": 0, - "read_only": 0, + "fieldname": "participant_name", + "fieldtype": "Data", + "hidden": 0, + "label": "Participant Name", + "max_length": 0, + "max_value": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "fieldname": "full_conference_tickets", - "fieldtype": "Int", - "hidden": 0, - "label": "Full Conference Tickets", - "max_length": 0, - "max_value": 0, - "read_only": 0, + "fieldname": "full_conference_tickets", + "fieldtype": "Int", + "hidden": 0, + "label": "Full Conference Tickets", + "max_length": 0, + "max_value": 0, + "read_only": 0, "reqd": 0 - }, + }, { - "fieldname": "user_conference_tickets", - "fieldtype": "Int", - "hidden": 0, - "label": "User Conference Tickets", - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 0 - }, - { - "default": "INR", - "fieldname": "currency", - "fieldtype": "Select", - "hidden": 0, - "label": "Currency", - "max_length": 0, - "max_value": 0, - "options": "INR", - "read_only": 1, + "default": "INR", + "fieldname": "currency", + "fieldtype": "Select", + "hidden": 0, + "label": "Currency", + "max_length": 0, + "max_value": 0, + "options": "INR", + "read_only": 1, "reqd": 1 - }, + }, { - "fieldname": "amount", - "fieldtype": "Data", - "hidden": 0, - "label": "Amount", - "max_length": 0, - "max_value": 0, - "read_only": 1, + "fieldname": "amount", + "fieldtype": "Data", + "hidden": 0, + "label": "Amount", + "max_length": 0, + "max_value": 0, + "read_only": 1, "reqd": 1 } ] diff --git a/foundation/erpnext_foundation/web_form/buy_tickets_paypal/buy_tickets_paypal.js b/foundation/erpnext_foundation/web_form/buy_tickets_paypal/buy_tickets_paypal.js index cace2bb3..509dce75 100644 --- a/foundation/erpnext_foundation/web_form/buy_tickets_paypal/buy_tickets_paypal.js +++ b/foundation/erpnext_foundation/web_form/buy_tickets_paypal/buy_tickets_paypal.js @@ -1,19 +1,17 @@ frappe.ready(function() { // bind events here - var calculate = function() { - var amount = - (parseInt($('input[name="full_conference_tickets"]').val() || 0) * 50) - + (parseInt($('input[name="user_conference_tickets"]').val() || 0) * 10); - $('input[name="amount"]').val(amount); - $('input[name="amount"]').closest('.form-group').toggleClass('has-error', amount == 0); + frappe._calculate = function() { + frappe.web_form.field_group.set_value('amount', + parseInt(frappe.web_form.field_group.get_value('full_conference_tickets') || 0) * 60 + ) }; - $('input[name="full_conference_tickets"]').on('keyup', function() { - calculate(); - }); - $('input[name="user_conference_tickets"]').on('keyup', function() { - calculate(); - }); + setTimeout(() => { + $('input[data-fieldname="full_conference_tickets"]').on('keyup', function() { + frappe._calculate(); + }); + frappe._calculate(); + }, 1000); $('.btn-form-submit').hide(); }) \ No newline at end of file diff --git a/foundation/erpnext_foundation/web_form/buy_tickets_paypal/buy_tickets_paypal.json b/foundation/erpnext_foundation/web_form/buy_tickets_paypal/buy_tickets_paypal.json index b6480ebc..713590c2 100644 --- a/foundation/erpnext_foundation/web_form/buy_tickets_paypal/buy_tickets_paypal.json +++ b/foundation/erpnext_foundation/web_form/buy_tickets_paypal/buy_tickets_paypal.json @@ -1,88 +1,84 @@ { - "accept_payment": 1, - "allow_comments": 0, - "allow_delete": 0, - "allow_edit": 0, - "allow_incomplete": 0, - "allow_multiple": 1, - "allow_print": 1, - "amount": 0.0, - "amount_based_on_field": 1, - "amount_field": "amount", - "creation": "2017-07-06 16:22:37.464680", - "currency": "USD", - "doc_type": "Conference Participant", - "docstatus": 0, - "doctype": "Web Form", - "idx": 0, - "introduction_text": "", - "is_standard": 1, - "login_required": 1, - "max_attachment_size": 0, - "modified": "2017-07-07 11:06:27.726016", - "modified_by": "Administrator", - "module": "ERPNext Foundation", - "name": "buy-tickets-paypal", - "owner": "Administrator", - "payment_button_label": "Buy Now", - "payment_gateway": "PayPal", - "published": 1, - "route": "buy-tickets-paypal", - "show_sidebar": 1, - "sidebar_items": [], - "success_url": "/conf/2017", - "title": "Buy Tickets Paypal", + "accept_payment": 1, + "allow_comments": 0, + "allow_delete": 0, + "allow_edit": 0, + "allow_incomplete": 0, + "allow_multiple": 1, + "allow_print": 1, + "amount": 0.0, + "amount_based_on_field": 1, + "amount_field": "amount", + "creation": "2017-07-06 16:22:37.464680", + "currency": "USD", + "doc_type": "Conference Participant", + "docstatus": 0, + "doctype": "Web Form", + "idx": 0, + "introduction_text": "", + "is_standard": 1, + "login_required": 1, + "max_attachment_size": 0, + "modified": "2018-07-09 12:51:08.338885", + "modified_by": "Administrator", + "module": "ERPNext Foundation", + "name": "buy-tickets-paypal", + "owner": "Administrator", + "payment_button_label": "Buy Now", + "payment_gateway": "PayPal", + "published": 1, + "route": "buy-tickets-paypal", + "show_sidebar": 0, + "sidebar_items": [ + { + "enabled": 1, + "route": "/buy-tickets-paypal", + "title": "My Tickets" + } + ], + "success_url": "/conf/2017", + "title": "Buy Tickets Paypal", "web_form_fields": [ { - "fieldname": "participant_name", - "fieldtype": "Data", - "hidden": 0, - "label": "Participant Name", - "max_length": 0, - "max_value": 0, - "read_only": 0, + "fieldname": "participant_name", + "fieldtype": "Data", + "hidden": 0, + "label": "Participant Name", + "max_length": 0, + "max_value": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "fieldname": "full_conference_tickets", - "fieldtype": "Int", - "hidden": 0, - "label": "Full Conference Tickets", - "max_length": 0, - "max_value": 0, - "read_only": 0, + "fieldname": "full_conference_tickets", + "fieldtype": "Int", + "hidden": 0, + "label": "Full Conference Tickets", + "max_length": 0, + "max_value": 0, + "read_only": 0, "reqd": 0 - }, + }, { - "fieldname": "user_conference_tickets", - "fieldtype": "Int", - "hidden": 0, - "label": "User Conference Tickets", - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 0 - }, - { - "default": "USD", - "fieldname": "currency", - "fieldtype": "Select", - "hidden": 0, - "label": "Currency", - "max_length": 0, - "max_value": 0, - "options": "USD\nINR", - "read_only": 1, + "default": "USD", + "fieldname": "currency", + "fieldtype": "Select", + "hidden": 0, + "label": "Currency", + "max_length": 0, + "max_value": 0, + "options": "USD\nINR", + "read_only": 1, "reqd": 1 - }, + }, { - "fieldname": "amount", - "fieldtype": "Data", - "hidden": 0, - "label": "Amount", - "max_length": 0, - "max_value": 0, - "read_only": 1, + "fieldname": "amount", + "fieldtype": "Data", + "hidden": 0, + "label": "Amount", + "max_length": 0, + "max_value": 0, + "read_only": 1, "reqd": 1 } ] diff --git a/foundation/migrate.py b/foundation/migrate.py index f7169146..e376e6c1 100644 --- a/foundation/migrate.py +++ b/foundation/migrate.py @@ -1,8 +1,4 @@ import frappe -from frappe.database import Database -from markdown2 import markdown -from frappe.utils import validate_email_add - def migrate(): pass