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)
|
def check_for_availability(stime, etime, pid, interval=nil, recurring_end_date=nil)
|
||||||
property = Property.find(pid)
|
property = Property.find(pid)
|
||||||
return {"success" => false, "msg" => "Values are not ok."} if property.nil? || stime.blank? || etime.blank?
|
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
|
if !stime.blank?
|
||||||
etime = DateTime.parse(etime + Time.zone.to_s) rescue nil
|
stime = DateTime.parse(stime + Time.zone.to_s) rescue nil
|
||||||
recurring_end_date = DateTime.parse(recurring_end_date + 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 = {}
|
data = {}
|
||||||
return {"success" => false, "msg" => "Starting time cannot be greater than ending time."} if stime > etime
|
return {"success" => false, "msg" => "Starting time cannot be greater than ending time."} if stime > etime
|
||||||
if property.is_available_for_hire?(stime, etime)
|
if property.is_available_for_hire?(stime, etime)
|
||||||
|
|
|
@ -146,7 +146,7 @@ class Property
|
||||||
end
|
end
|
||||||
stime_tp = stime_tp + d_step
|
stime_tp = stime_tp + d_step
|
||||||
etime_tp = etime_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
|
end
|
||||||
break if available == false
|
break if available == false
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue