Fix bug.
This commit is contained in:
parent
429ef0f11c
commit
82cec4139c
|
@ -123,17 +123,23 @@ class PHire
|
||||||
datet = re.date
|
datet = re.date
|
||||||
interval = 1.send(re.recurring_interval) rescue 0
|
interval = 1.send(re.recurring_interval) rescue 0
|
||||||
if interval != 0
|
if interval != 0
|
||||||
|
org_start = re.start_time
|
||||||
@start_date = re.start_time
|
@start_date = re.start_time
|
||||||
recurring_end_date = re.recurring_end_date
|
recurring_end_date = re.recurring_end_date
|
||||||
new_end_date = [recurring_end_date,end_date].min
|
new_end_date = [recurring_end_date,end_date].min
|
||||||
@end_date = re.end_time
|
@end_date = re.end_time
|
||||||
if @start_date < start_date
|
if @start_date < start_date
|
||||||
add_interval = nil
|
add_interval = nil
|
||||||
|
period_str = nil
|
||||||
if re.recurring_interval == "week"
|
if re.recurring_interval == "week"
|
||||||
add_interval = ((start_date - @start_date).to_i / 7).send("week")
|
period_str = 'week'
|
||||||
|
add_interval = ((start_date - @start_date - 1.day).to_i / 7.day)
|
||||||
else
|
else
|
||||||
add_interval = ((start_date.year * 12 + start_date.month) - (@start_date.year * 12 + @start_date.month) - 1).send("month")
|
period_str = 'month'
|
||||||
|
add_interval = ((start_date.year * 12 + start_date.month) - (@start_date.year * 12 + @start_date.month) - 1)
|
||||||
end
|
end
|
||||||
|
add_interval = 0 if add_interval < 0
|
||||||
|
add_interval = add_interval.send(period_str)
|
||||||
@start_date += add_interval
|
@start_date += add_interval
|
||||||
@end_date += add_interval
|
@end_date += add_interval
|
||||||
end
|
end
|
||||||
|
@ -148,7 +154,7 @@ class PHire
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if @start_date >= start_date
|
if @start_date >= start_date && @start_date != org_start
|
||||||
@recurring << re.as_json({:startt=>@start_date,:endt=>@end_date,:datet=>datet})
|
@recurring << re.as_json({:startt=>@start_date,:endt=>@end_date,:datet=>datet})
|
||||||
end
|
end
|
||||||
@start_date += interval
|
@start_date += interval
|
||||||
|
|
|
@ -485,7 +485,7 @@ class Property
|
||||||
fields_name.each do |field_name|
|
fields_name.each do |field_name|
|
||||||
if has_p_hire_fields && field_name.include?("p_hire_fields")
|
if has_p_hire_fields && field_name.include?("p_hire_fields")
|
||||||
rf = p_hire_fields[field_name.sub("p_hire_fields.",'')]
|
rf = p_hire_fields[field_name.sub("p_hire_fields.",'')]
|
||||||
if rf.markup != 'hint_text' && rf.to_require
|
if rf && rf.markup != 'hint_text' && rf.to_require
|
||||||
v = booking_p["p_hire_field_values_attributes"][form_index.to_s]['value']
|
v = booking_p["p_hire_field_values_attributes"][form_index.to_s]['value']
|
||||||
if cross_lang_types.include?(rf.markup) || rf.get_data["cross_lang"] == "true"
|
if cross_lang_types.include?(rf.markup) || rf.get_data["cross_lang"] == "true"
|
||||||
if v.blank?
|
if v.blank?
|
||||||
|
|
Loading…
Reference in New Issue