Fix bug.
This commit is contained in:
parent
a6e9c31222
commit
f8835c49d0
|
@ -217,8 +217,9 @@ class PropertyHiresController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
phire_id = params[:phire_id] || params[:p_hire][:id]
|
||||
if params[:url] == "admin"
|
||||
params[:phire_id] = booking_p[:id]
|
||||
phire_id = booking_p[:id]
|
||||
end
|
||||
data = check_for_availability(start_time,end_time,booking_p[:property_id], booking_p[:recurring_interval], booking_p[:recurring_end_date], time_setting_id)
|
||||
if data["success"] == true
|
||||
|
@ -230,9 +231,13 @@ class PropertyHiresController < ApplicationController
|
|||
end
|
||||
if data["success"] == true
|
||||
hire = nil
|
||||
if params[:phire_id]
|
||||
hire = PHire.find(params[:phire_id])
|
||||
hire.update_attributes(booking_p)
|
||||
if phire_id
|
||||
hire = PHire.find(phire_id) rescue nil
|
||||
if hire.nil?
|
||||
hire = PHire.new(booking_p)
|
||||
else
|
||||
hire.update_attributes(booking_p)
|
||||
end
|
||||
else
|
||||
hire = PHire.new(booking_p)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue