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
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])
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