diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index b43e70df..d1450ef6 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -3127,6 +3127,7 @@ end notice = SystemUpdateNotice.last if notice.present? && notice.end_time > Time.now notice.update_attributes(:end_time => params[:end_time], :start_time => params[:start_time], :subject => params[:subject], :notes => params[:notes]) + UserSystemNotice.where(:notice_type => notice.notice_type).destroy_all else notice_type = UserSystemNotice.find_by_sql("select max(notice_type) as max_notice_type from user_system_notices").first.try(:max_notice_type).to_i + 1 SystemUpdateNotice.create(:end_time => params[:end_time], :start_time => params[:start_time], :subject => params[:subject], :notes => params[:notes], :notice_type => notice_type) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2e958f6f..e44a170b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2372,7 +2372,7 @@ class UsersController < ApplicationController if @user.certification == 3 @user.update_column('certification', 0) @noticed = true - notice = SystemUpdateNotice.first + notice = SystemUpdateNotice.last if notice.present? && notice.end_time > Time.now && notice.start_time >= Time.now - 21600 && User.current.user_system_notices.where(:notice_type => notice.notice_type).count == 0 @noticed_update = true end diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index f48b5615..ee3a571d 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -117,7 +117,7 @@ <% end %> - <% notice = SystemUpdateNotice.first %> + <% notice = SystemUpdateNotice.last %> <% if @noticed_update || ((User.current.certification == 1 || params[:controller] != "welcome") && notice.present? && notice.end_time > Time.now && notice.start_time >= (Time.now - 21600) && User.current.user_system_notices.where(:notice_type => notice.notice_type).count == 0) %> var htmlvalue = "<%= escape_javascript(render :partial => 'account/user_update_notice', :locals => {:notice => notice})%>"; pop_box_new(htmlvalue, 500, 380); diff --git a/app/views/managements/update_notice.html.erb b/app/views/managements/update_notice.html.erb index 0cabe548..c0e1f254 100644 --- a/app/views/managements/update_notice.html.erb +++ b/app/views/managements/update_notice.html.erb @@ -11,8 +11,10 @@