This commit is contained in:
邱博亞 2024-10-02 09:38:50 +08:00
parent 420ce3b065
commit f2ad2647a5
2 changed files with 6 additions and 5 deletions

View File

@ -34,7 +34,7 @@ class PropertyHiresController < ApplicationController
def index_data(properties, url)
ma = ModuleApp.find_by_key("property_hire")
is_user_manager = (OrbitHelper.current_user.is_admin? || OrbitHelper.current_user.is_manager?(ma) || OrbitHelper.current_user.is_sub_manager?(ma))
is_user_manager = OrbitHelper.current_user && (OrbitHelper.current_user.is_admin? || OrbitHelper.current_user.is_manager?(ma) || OrbitHelper.current_user.is_sub_manager?(ma))
data = properties.collect do |property|
actions = []
url_to_show = "#{url}/#{property.to_param}?method=hire"
@ -334,7 +334,7 @@ class PropertyHiresController < ApplicationController
allow_no_logins_user = PropertyHireSetting.first.allow_no_logins_user
all_day_settings = property.all_day_settings.map{|d,settings| [d,settings.map{|s| [s.id.to_s,s.title]}]}.to_h
ma = ModuleApp.find_by_key("property_hire")
is_user_manager = (OrbitHelper.current_user.is_admin? || OrbitHelper.current_user.is_manager?(ma) || OrbitHelper.current_user.is_sub_manager?(ma))
is_user_manager = OrbitHelper.current_user && (OrbitHelper.current_user.is_admin? || OrbitHelper.current_user.is_manager?(ma) || OrbitHelper.current_user.is_sub_manager?(ma))
{
"hire" => hire,
"property" => property,

View File

@ -148,9 +148,10 @@ class Property
end
def can_reserve
start_time = self.p_hire_start_time || Time.now
end_time = self.p_hire_end_time || Time.now
return Time.now >= start_time && end_time >= Time.now
now = Time.now
start_time = self.p_hire_start_time || now
end_time = self.p_hire_end_time || now
return now >= start_time && end_time >= now
end
def p_hire_fields_enabled