This commit is contained in:
BoHung Chiu 2022-08-04 16:00:20 +08:00
parent a6e9c31222
commit f8835c49d0
1 changed files with 9 additions and 4 deletions

View File

@ -217,8 +217,9 @@ class PropertyHiresController < ApplicationController
end end
end end
end end
phire_id = params[:phire_id] || params[:p_hire][:id]
if params[:url] == "admin" if params[:url] == "admin"
params[:phire_id] = booking_p[:id] phire_id = booking_p[:id]
end 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) 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 if data["success"] == true
@ -230,9 +231,13 @@ class PropertyHiresController < ApplicationController
end end
if data["success"] == true if data["success"] == true
hire = nil hire = nil
if params[:phire_id] if phire_id
hire = PHire.find(params[:phire_id]) hire = PHire.find(phire_id) rescue nil
hire.update_attributes(booking_p) if hire.nil?
hire = PHire.new(booking_p)
else
hire.update_attributes(booking_p)
end
else else
hire = PHire.new(booking_p) hire = PHire.new(booking_p)
end end