mirror of
https://github.com/frappe/lms.git
synced 2026-05-02 13:39:31 +03:00
fix: timezone for direct evaluation courses
This commit is contained in:
@@ -271,13 +271,21 @@
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<Link
|
||||
v-if="course.paid_course || course.paid_certificate"
|
||||
doctype="Currency"
|
||||
v-model="course.currency"
|
||||
:filters="{ enabled: 1 }"
|
||||
:label="__('Currency')"
|
||||
/>
|
||||
<div class="space-y-5">
|
||||
<Link
|
||||
v-if="course.paid_course || course.paid_certificate"
|
||||
doctype="Currency"
|
||||
v-model="course.currency"
|
||||
:filters="{ enabled: 1 }"
|
||||
:label="__('Currency')"
|
||||
/>
|
||||
<FormControl
|
||||
v-if="course.paid_certificate"
|
||||
v-model="course.timezone"
|
||||
:label="__('Timezone')"
|
||||
:placeholder="__('e.g. IST, UTC, GMT...')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -388,6 +396,7 @@ const course = reactive({
|
||||
course_price: '',
|
||||
currency: '',
|
||||
evaluator: '',
|
||||
timezone: '',
|
||||
})
|
||||
|
||||
const meta = reactive({
|
||||
|
||||
@@ -133,7 +133,6 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fetch_from": "batch_name.timezone",
|
||||
"fieldname": "timezone",
|
||||
"fieldtype": "Data",
|
||||
"label": "Timezone",
|
||||
@@ -155,10 +154,11 @@
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2025-02-19 17:20:02.526294",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2025-10-13 14:30:57.897102",
|
||||
"modified_by": "sayali@frappe.io",
|
||||
"module": "LMS",
|
||||
"name": "LMS Certificate Request",
|
||||
"owner": "Administrator",
|
||||
@@ -211,6 +211,7 @@
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"states": [
|
||||
@@ -228,4 +229,4 @@
|
||||
}
|
||||
],
|
||||
"title_field": "member_name"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ class LMSCertificateRequest(Document):
|
||||
self.validate_slot()
|
||||
self.validate_if_existing_requests()
|
||||
self.validate_evaluation_end_date()
|
||||
self.validate_timezone()
|
||||
|
||||
def after_insert(self):
|
||||
self.send_notification()
|
||||
@@ -113,6 +114,20 @@ class LMSCertificateRequest(Document):
|
||||
)
|
||||
)
|
||||
|
||||
def validate_timezone(self):
|
||||
if self.timezone:
|
||||
return
|
||||
if self.batch_name:
|
||||
timezone = frappe.db.get_value("LMS Batch", self.batch_name, "timezone")
|
||||
if timezone:
|
||||
self.timezone = timezone
|
||||
return
|
||||
if self.course:
|
||||
timezone = frappe.db.get_value("LMS Course", self.course, "timezone")
|
||||
if timezone:
|
||||
self.timezone = timezone
|
||||
return
|
||||
|
||||
def send_notification(self):
|
||||
outgoing_email_account = frappe.get_cached_value(
|
||||
"Email Account", {"default_outgoing": 1, "enable_outgoing": 1}, "name"
|
||||
|
||||
@@ -43,11 +43,14 @@
|
||||
"paid_course",
|
||||
"enable_certification",
|
||||
"paid_certificate",
|
||||
"evaluator",
|
||||
"column_break_acoj",
|
||||
"section_break_vqbh",
|
||||
"course_price",
|
||||
"currency",
|
||||
"amount_usd",
|
||||
"column_break_sflq",
|
||||
"evaluator",
|
||||
"timezone",
|
||||
"tab_4_tab",
|
||||
"statistics_section",
|
||||
"enrollments",
|
||||
@@ -278,6 +281,20 @@
|
||||
"fieldtype": "Select",
|
||||
"label": "Color",
|
||||
"options": "Red\nBlue\nGreen\nAmber\nCyan\nOrange\nPink\nPurple\nTeal\nViolet\nYellow\nGray"
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_vqbh",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_sflq",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"depends_on": "paid_certificate",
|
||||
"fieldname": "timezone",
|
||||
"fieldtype": "Data",
|
||||
"label": "Timezone"
|
||||
}
|
||||
],
|
||||
"is_published_field": "published",
|
||||
@@ -296,7 +313,7 @@
|
||||
}
|
||||
],
|
||||
"make_attachments_public": 1,
|
||||
"modified": "2025-07-25 17:50:44.983391",
|
||||
"modified": "2025-10-13 15:08:11.734204",
|
||||
"modified_by": "sayali@frappe.io",
|
||||
"module": "LMS",
|
||||
"name": "LMS Course",
|
||||
|
||||
@@ -68,6 +68,9 @@ class LMSCourse(Document):
|
||||
if self.paid_certificate and not self.evaluator:
|
||||
frappe.throw(_("Evaluator is required for paid certificates."))
|
||||
|
||||
if self.paid_certificate and not self.timezone:
|
||||
frappe.throw(_("Timezone is required for paid certificates."))
|
||||
|
||||
def validate_amount_and_currency(self):
|
||||
if self.paid_course and (cint(self.course_price) < 0 or not self.currency):
|
||||
frappe.throw(_("Amount and currency are required for paid courses."))
|
||||
|
||||
Reference in New Issue
Block a user