"Fossies" - the Fresh Open Source Software Archive

Member "db/migrate/20161117000002_ticket_number_generator_issue_427.rb" (25 Mar 2021, 1643 Bytes) of package /linux/www/zammad-4.0.0.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ruby source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "20161117000002_ticket_number_generator_issue_427.rb": 3.4.1_vs_3.5.0.

    1 class TicketNumberGeneratorIssue427 < ActiveRecord::Migration[4.2]
    2   def up
    3     # return if it's a new setup
    4     return if !Setting.exists?(name: 'system_init_done')
    5 
    6     setting = Setting.find_by(name: 'ticket_number')
    7     setting.preferences = {
    8       settings_included: %w[ticket_number_increment ticket_number_date],
    9       controller:        'SettingsAreaTicketNumber',
   10       permission:        ['admin.ticket'],
   11     }
   12     setting.save!
   13     setting = Setting.find_by(name: 'ticket_number_increment')
   14     setting.preferences = {
   15       permission: ['admin.ticket'],
   16       hidden:     true,
   17     }
   18     setting.save!
   19     setting = Setting.find_by(name: 'ticket_number_date')
   20     setting.preferences = {
   21       permission: ['admin.ticket'],
   22       hidden:     true,
   23     }
   24 
   25     # just to make sure that value is saved correctly - https://github.com/zammad/zammad/issues/413
   26     if setting.state_current['value'] == true || setting.state_current['value'] == false
   27       setting.state_current['value'] = { 'checksum' => setting.state_current['value'] }
   28     end
   29     setting.save!
   30 
   31     setting = Setting.find_by(name: 'ticket_hook_position')
   32     setting.preferences = {
   33       controller: 'SettingsAreaTicketHookPosition',
   34       permission: ['admin.ticket'],
   35     }
   36     setting.options = {
   37       form: [
   38         {
   39           display:   '',
   40           null:      true,
   41           name:      'ticket_hook_position',
   42           tag:       'select',
   43           translate: true,
   44           options:   {
   45             'left'  => 'left',
   46             'right' => 'right',
   47             'none'  => 'none',
   48           },
   49         },
   50       ],
   51     }
   52     setting.save!
   53 
   54   end
   55 end