"Fossies" - the Fresh Open Source Software Archive

Member "db/migrate/20170628000001_form_group_selection.rb" (25 Mar 2021, 2749 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 "20170628000001_form_group_selection.rb": 3.4.1_vs_3.5.0.

    1 class FormGroupSelection < ActiveRecord::Migration[4.2]
    2   def up
    3 
    4     # return if it's a new setup
    5     return if !Setting.exists?(name: 'system_init_done')
    6 
    7     group = Group.where(active: true).first
    8     if !group
    9       group = Group.first
   10     end
   11     group_id = 1
   12     if group
   13       group_id = group.id
   14     end
   15     Setting.create_if_not_exists(
   16       title:       'Group selection for Ticket creation',
   17       name:        'form_ticket_create_group_id',
   18       area:        'Form::Base',
   19       description: 'Defines if group of created tickets via web form.',
   20       options:     {
   21         form: [
   22           {
   23             display:  '',
   24             null:     true,
   25             name:     'form_ticket_create_group_id',
   26             tag:      'select',
   27             relation: 'Group',
   28           },
   29         ],
   30       },
   31       state:       group_id,
   32       preferences: {
   33         permission: ['admin.channel_formular'],
   34       },
   35       frontend:    false,
   36     )
   37 
   38     Setting.create_if_not_exists(
   39       title:       'Limit tickets by ip per hour',
   40       name:        'form_ticket_create_by_ip_per_hour',
   41       area:        'Form::Base',
   42       description: 'Defines limit of tickets by ip per hour via web form.',
   43       options:     {
   44         form: [
   45           {
   46             display: '',
   47             null:    true,
   48             name:    'form_ticket_create_by_ip_per_hour',
   49             tag:     'input',
   50           },
   51         ],
   52       },
   53       state:       20,
   54       preferences: {
   55         permission: ['admin.channel_formular'],
   56       },
   57       frontend:    false,
   58     )
   59     Setting.create_if_not_exists(
   60       title:       'Limit tickets by ip per day',
   61       name:        'form_ticket_create_by_ip_per_day',
   62       area:        'Form::Base',
   63       description: 'Defines limit of tickets by ip per day via web form.',
   64       options:     {
   65         form: [
   66           {
   67             display: '',
   68             null:    true,
   69             name:    'form_ticket_create_by_ip_per_day',
   70             tag:     'input',
   71           },
   72         ],
   73       },
   74       state:       240,
   75       preferences: {
   76         permission: ['admin.channel_formular'],
   77       },
   78       frontend:    false,
   79     )
   80     Setting.create_if_not_exists(
   81       title:       'Limit tickets per day',
   82       name:        'form_ticket_create_per_day',
   83       area:        'Form::Base',
   84       description: 'Defines limit of tickets per day via web form.',
   85       options:     {
   86         form: [
   87           {
   88             display: '',
   89             null:    true,
   90             name:    'form_ticket_create_per_day',
   91             tag:     'input',
   92           },
   93         ],
   94       },
   95       state:       5000,
   96       preferences: {
   97         permission: ['admin.channel_formular'],
   98       },
   99       frontend:    false,
  100     )
  101 
  102   end
  103 end