Project

General

Profile

Feature #13227 ยป new_user_format.diff

Go MAEDA, 2014-06-11 05:56

View differences:

app/models/user.rb (working copy)
52 52
        :order => %w(lastname firstname id),
53 53
        :setting_order => 5
54 54
      },
55
    :lastname_nosp_firstname => {
56
        :string => '#{lastname}#{firstname}',
57
        :order => %w(lastname firstname id),
58
        :setting_order => 6
59
      },
55 60
    :lastname => {
56 61
        :string => '#{lastname}',
57 62
        :order => %w(lastname id),
58
        :setting_order => 6
63
        :setting_order => 7
59 64
      },
60 65
    :username => {
61 66
        :string => '#{login}',
62 67
        :order => %w(login id),
63
        :setting_order => 7
68
        :setting_order => 8
64 69
      },
65 70
  }
66 71

  
......
683 688
    return if self.id.nil?
684 689

  
685 690
    substitute = User.anonymous
686
    Attachment.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id]) 
691
    Attachment.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id])
687 692
    Comment.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id])
688 693
    Issue.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id])
689 694
    Issue.where(['assigned_to_id = ?', id]).update_all('assigned_to_id = NULL')
690
    Journal.where(['user_id = ?', id]).update_all(['user_id = ?', substitute.id]) 
695
    Journal.where(['user_id = ?', id]).update_all(['user_id = ?', substitute.id])
691 696
    JournalDetail.
692 697
      where(["property = 'attr' AND prop_key = 'assigned_to_id' AND old_value = ?", id.to_s]).
693 698
      update_all(['old_value = ?', substitute.id.to_s])
694 699
    JournalDetail.
695 700
      where(["property = 'attr' AND prop_key = 'assigned_to_id' AND value = ?", id.to_s]).
696
      update_all(['value = ?', substitute.id.to_s]) 
701
      update_all(['value = ?', substitute.id.to_s])
697 702
    Message.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id])
698 703
    News.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id])
699 704
    # Remove private queries and keep public ones
    (1-1/1)