diff --git a/app/controllers/admin/property_hires_controller.rb b/app/controllers/admin/property_hires_controller.rb index 83b42bc..6f0e8c8 100644 --- a/app/controllers/admin/property_hires_controller.rb +++ b/app/controllers/admin/property_hires_controller.rb @@ -43,7 +43,7 @@ class Admin::PropertyHiresController < OrbitAdminController property = Property.find(params[:id]) rescue nil email = Array(MemberProfile.find(property.owners)).collect{|v| v.email} rescue [] email = User.all.select{|v| v.is_admin? && v.user_name != 'rulingcom'}.collect{|v| v.member_profile.email} if email.length == 0 - Admin::PropertyHiresHelper::HireMethod.send_mail('delete',email,property.id) + Admin::PropertyHiresHelper::HireMethod.send_mail('delete',email,property.id,nil,nil,current_user.id) property.destroy if !property.nil? if params[:page] redirect_to admin_property_hires_path(:page => params[:page]) @@ -58,7 +58,7 @@ class Admin::PropertyHiresController < OrbitAdminController property.update_attributes(property_params) email = Array(MemberProfile.find(property.owners)).collect{|v| v.email} rescue [] email = User.all.select{|v| v.is_admin? && v.user_name != 'rulingcom'}.collect{|v| v.member_profile.email} if email.length == 0 - Admin::PropertyHiresHelper::HireMethod.send_mail('edit',email,property.id) + Admin::PropertyHiresHelper::HireMethod.send_mail('edit',email,property.id,nil,nil,current_user.id) if params[:page] redirect_to admin_property_hires_path(:page => params[:page]) else diff --git a/app/helpers/admin/property_hires_helper.rb b/app/helpers/admin/property_hires_helper.rb index 9d2302b..cb29814 100644 --- a/app/helpers/admin/property_hires_helper.rb +++ b/app/helpers/admin/property_hires_helper.rb @@ -63,7 +63,7 @@ module Admin::PropertyHiresHelper a = multiple_lang_tag(key_field,markup,"#{key_index}][#{field}",field_sets,custom_options,end_block,{},markup=='text_area') a.html_safe end - def self.send_mail(field_name,email,property_id,send_date=nil,hire_id=nil) + def self.send_mail(field_name,email,property_id,send_date=nil,hire_id=nil,user_id=nil) property = Property.where(id: property_id).first if !property.nil? email_set = property.hire_email_sets.select{|v| v.field_name == field_name} @@ -76,14 +76,14 @@ module Admin::PropertyHiresHelper template:"email/#{field_name}_email.html.erb", mail_sentdate: send_date || Time.current, mail_subject: I18n.t("property_hire.email_#{field_name}_success"), - template_data:{'property_id'=>property_id,'content'=>content,'locale'=>I18n.locale.to_s,'hire_id'=>hire_id}) + template_data:{'property_id'=>property_id,'content'=>content,'locale'=>I18n.locale.to_s,'hire_id'=>hire_id,'user_id'=>user_id}) elsif !(email_set[0].disabled) mail = Email.create(mail_to: Array(email), module_app_key:"property_hire", template:"email/#{field_name}_email.html.erb", mail_sentdate: send_date || Time.current, mail_subject: email_set[0].title[I18n.locale], - template_data:{'property_id'=>property_id,'email_set_content'=>email_set[0].content.to_yaml,'content'=>content,'locale'=>I18n.locale.to_s,'hire_id'=>hire_id}) + template_data:{'property_id'=>property_id,'email_set_content'=>email_set[0].content.to_yaml,'content'=>content,'locale'=>I18n.locale.to_s,'hire_id'=>hire_id,'user_id'=>user_id}) end begin mail.deliver diff --git a/app/views/email/delete_email.html.erb b/app/views/email/delete_email.html.erb index ba959ec..0ab848e 100644 --- a/app/views/email/delete_email.html.erb +++ b/app/views/email/delete_email.html.erb @@ -9,6 +9,7 @@ <% property = Property.where(id: @data['property_id']).first %> <% if !property.nil? %>