20170117000001_unable_to_enable_time_accounting_633.rb 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. class UnableToEnableTimeAccounting633 < 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. Setting.create_if_not_exists(
  6. title: 'Time Accounting',
  7. name: 'time_accounting',
  8. area: 'Web::Base',
  9. description: 'Enable time accounting.',
  10. options: {
  11. form: [
  12. {
  13. display: '',
  14. null: true,
  15. name: 'time_accounting',
  16. tag: 'boolean',
  17. options: {
  18. true => 'yes',
  19. false => 'no',
  20. },
  21. },
  22. ],
  23. },
  24. preferences: {
  25. authentication: true,
  26. permission: ['admin.time_accounting'],
  27. },
  28. state: false,
  29. frontend: true
  30. )
  31. Setting.create_if_not_exists(
  32. title: 'Time Accounting Selector',
  33. name: 'time_accounting_selector',
  34. area: 'Web::Base',
  35. description: 'Enable time accounting for this tickets.',
  36. options: {
  37. form: [
  38. {},
  39. ],
  40. },
  41. preferences: {
  42. authentication: true,
  43. permission: ['admin.time_accounting'],
  44. },
  45. state: {},
  46. frontend: true
  47. )
  48. end
  49. end