This commit is contained in:
邱博亞 2024-05-14 12:38:08 +08:00
parent bd8f88afa3
commit 4d02ff8729
3 changed files with 5 additions and 4 deletions

View File

@ -80,7 +80,7 @@ class Admin::PropertyHiresController < OrbitAdminController
def destroy def destroy
property = Property.find(params[:id]) rescue nil property = Property.find(params[:id]) rescue nil
email = MemberProfile.where(:id.in=>property.owners).collect{|v| v.email} email = MemberProfile.where(:id.in=>property.owners.to_a).collect{|v| v.email}
Admin::PropertyHiresHelper::HireMethod.send_mail('delete',email,property.id,nil,nil,current_user.id) Admin::PropertyHiresHelper::HireMethod.send_mail('delete',email,property.id,nil,nil,current_user.id)
property.destroy if !property.nil? property.destroy if !property.nil?
if params[:page] if params[:page]
@ -115,7 +115,7 @@ class Admin::PropertyHiresController < OrbitAdminController
property.p_hire_fields.each{|t| t.destroy if t["to_delete"] == true} property.p_hire_fields.each{|t| t.destroy if t["to_delete"] == true}
else else
property.update_attributes(@property_params) property.update_attributes(@property_params)
email = MemberProfile.where(:id.in=>property.owners).collect{|v| v.email} email = MemberProfile.where(:id.in=>property.owners.to_a).collect{|v| v.email}
Admin::PropertyHiresHelper::HireMethod.send_mail('edit',email,property.id,nil,nil,current_user.id) Admin::PropertyHiresHelper::HireMethod.send_mail('edit',email,property.id,nil,nil,current_user.id)
end end
redirect_to params[:referer_url] redirect_to params[:referer_url]
@ -287,7 +287,7 @@ class Admin::PropertyHiresController < OrbitAdminController
prop[:weekdays] = [] prop[:weekdays] = []
end end
if prop[:owners].nil? if prop[:owners].nil?
prop[:owners] = nil prop[:owners] = []
end end
prop.delete(:property_location) if prop[:property_location] == "other" prop.delete(:property_location) if prop[:property_location] == "other"
notes_selector = prop["notes_selector"] notes_selector = prop["notes_selector"]

View File

@ -378,8 +378,8 @@ class PropertyHiresController < ApplicationController
if property.can_hire_before_months != 0 if property.can_hire_before_months != 0
get_end_time = [time_now + (property.can_hire_before_months).send("month"),edt].min get_end_time = [time_now + (property.can_hire_before_months).send("month"),edt].min
end end
allevents += generate_all_reserve_buttons(get_start_time,get_end_time,all_day_settings,check_setting)
end end
allevents += generate_all_reserve_buttons(get_start_time,get_end_time,all_day_settings,check_setting)
end end
end end
end end

View File

@ -593,6 +593,7 @@ class Property
property property
end end
def fix_uploader(clone_relation, r, f) def fix_uploader(clone_relation, r, f)
return r.send(f).blank?
if !@clone_mode || (clone_relation[f].blank? && clone_relation.send(f).blank?) if !@clone_mode || (clone_relation[f].blank? && clone_relation.send(f).blank?)
clone_relation[f] = r[f] clone_relation[f] = r[f]
if @clone_mode if @clone_mode