fix erorr
This commit is contained in:
parent
a654081664
commit
afa62d1d67
|
@ -3,9 +3,21 @@ module Admin::PropertyHiresHelper
|
|||
def check_for_availability(stime, etime, pid, interval=nil, recurring_end_date=nil)
|
||||
property = Property.find(pid)
|
||||
return {"success" => false, "msg" => "Values are not ok."} if property.nil? || stime.blank? || etime.blank?
|
||||
stime = DateTime.parse(stime + Time.zone.to_s) rescue nil
|
||||
etime = DateTime.parse(etime + Time.zone.to_s) rescue nil
|
||||
recurring_end_date = DateTime.parse(recurring_end_date + Time.zone.to_s) rescue nil
|
||||
if !stime.blank?
|
||||
stime = DateTime.parse(stime + Time.zone.to_s) rescue nil
|
||||
else
|
||||
stime = nil
|
||||
end
|
||||
if !etime.blank?
|
||||
etime = DateTime.parse(etime + Time.zone.to_s) rescue nil
|
||||
else
|
||||
etime = nil
|
||||
end
|
||||
if !recurring_end_date.blank?
|
||||
recurring_end_date = DateTime.parse(recurring_end_date + Time.zone.to_s) rescue nil
|
||||
else
|
||||
recurring_end_date = nil
|
||||
end
|
||||
data = {}
|
||||
return {"success" => false, "msg" => "Starting time cannot be greater than ending time."} if stime > etime
|
||||
if property.is_available_for_hire?(stime, etime)
|
||||
|
|
|
@ -146,7 +146,7 @@ class Property
|
|||
end
|
||||
stime_tp = stime_tp + d_step
|
||||
etime_tp = etime_tp + d_step
|
||||
break if recurring_end_date.blank? || recurring_end_date < stime_tp
|
||||
break if recurring_end_date.blank? || d_step==0 || recurring_end_date < stime_tp
|
||||
end
|
||||
break if available == false
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue