[fix] calendar and dirty
This commit is contained in:
parent
41dfa18231
commit
d5f3479f58
3 changed files with 13 additions and 5 deletions
|
|
@ -14,8 +14,8 @@ class Event(Document):
|
|||
def validate(self):
|
||||
if self.starts_on and self.ends_on and self.starts_on > self.ends_on:
|
||||
frappe.msgprint(frappe._("Event end must be after start"), raise_exception=True)
|
||||
if self.starts_on and self.ends_on and int(date_diff(self.ends_on.split(" ")[0], self.starts_on.split(" ")[0])) > 0 \
|
||||
and self.repeat_on == "Every Day":
|
||||
if self.repeat_on == "Every Day" and self.starts_on and self.ends_on \
|
||||
and int(date_diff(self.ends_on.split(" ")[0], self.starts_on.split(" ")[0])) > 0:
|
||||
frappe.msgprint(frappe._("Every day events should finish on the same day."), raise_exception=True)
|
||||
|
||||
def get_permission_query_conditions(user):
|
||||
|
|
|
|||
|
|
@ -153,8 +153,15 @@ frappe.views.Calendar = Class.extend({
|
|||
if(me.field_map.end)
|
||||
event[me.field_map.end] = frappe.datetime.get_datetime_as_string(endDate);
|
||||
|
||||
if(me.field_map.allDay)
|
||||
event[me.field_map.allDay] = (startDate._ambigTime && endDate._ambigTime) ? 1 : 0;
|
||||
if(me.field_map.allDay) {
|
||||
var all_day = (startDate._ambigTime && endDate._ambigTime) ? 1 : 0;
|
||||
|
||||
event[me.field_map.allDay] = all_day;
|
||||
|
||||
if (all_day)
|
||||
event[me.field_map.end] = frappe.datetime.get_datetime_as_string(endDate.subtract(1, "s"));
|
||||
}
|
||||
|
||||
|
||||
frappe.set_route("Form", me.doctype, event.name);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -704,7 +704,8 @@ _f.get_value = function(dt, dn, fn) {
|
|||
|
||||
_f.Frm.prototype.dirty = function() {
|
||||
this.doc.__unsaved = 1;
|
||||
$(this.wrapper).trigger('dirty')
|
||||
$(this.wrapper).trigger('dirty');
|
||||
this.toolbar.set_primary_action(true);
|
||||
}
|
||||
|
||||
_f.Frm.prototype.get_docinfo = function() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue