20170123000002_fixed_translation.rb 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. class FixedTranslation < ActiveRecord::Migration[4.2]
  2. def up
  3. # return if it's a new setup
  4. return if !Setting.find_by(name: 'system_init_done')
  5. settings_update = [
  6. {
  7. 'name' => 'app_version',
  8. 'title' => nil,
  9. 'description' => 'Only used internally to propagate current web app version to clients.',
  10. },
  11. {
  12. 'name' => 'websocket_port',
  13. 'title' => 'Websocket port',
  14. 'description' => nil,
  15. },
  16. {
  17. 'name' => 'http_type',
  18. 'title' => 'HTTP type',
  19. 'description' => 'Define the http protocol of your instance.',
  20. },
  21. {
  22. 'name' => 'storage_provider',
  23. 'title' => nil,
  24. 'description' => '"Database" stores all attachments in the database (not recommended for storing large amounts of data). "Filesystem" stores the data in the filesystem. You can switch between the modules even on a system that is already in production without any loss of data.',
  25. },
  26. {
  27. 'name' => 'geo_ip_backend',
  28. 'title' => nil,
  29. 'description' => 'Defines the backend for geo IP lookups. Shows also location of an IP address if an IP address is shown.',
  30. },
  31. {
  32. 'name' => 'geo_calendar_backend',
  33. 'title' => nil,
  34. 'description' => 'Defines the backend for geo calendar lookups. Used for initial calendar succession.',
  35. },
  36. {
  37. 'name' => 'ui_client_storage',
  38. 'title' => nil,
  39. 'description' => 'Use client storage to cache data to enhance performance of application.',
  40. },
  41. {
  42. 'name' => 'auth_oauth2',
  43. 'title' => nil,
  44. 'description' => 'Enables user authentication via generic OAuth2. Register your app first.',
  45. },
  46. {
  47. 'name' => 'auth_oauth2_credentials',
  48. 'title' => nil,
  49. 'description' => 'Enables user authentication via generic OAuth2.',
  50. },
  51. {
  52. 'name' => 'password_min_size',
  53. 'title' => 'Minimum length',
  54. 'description' => 'Password needs to have at least a minimal number of characters.',
  55. },
  56. {
  57. 'name' => 'password_need_digit',
  58. 'title' => nil,
  59. 'description' => 'Password needs to contain at least one digit.',
  60. },
  61. {
  62. 'name' => 'password_max_login_failed',
  63. 'title' => 'Maximum failed logins',
  64. 'description' => 'Number of failed logins after account will be deactivated.',
  65. },
  66. {
  67. 'name' => 'ticket_hook',
  68. 'title' => nil,
  69. 'description' => 'The identifier for a ticket, e.g. Ticket#, Call#, MyTicket#. The default is Ticket#.',
  70. },
  71. {
  72. 'name' => 'ticket_hook_divider',
  73. 'title' => nil,
  74. 'description' => 'The divider between TicketHook and ticket number. E. g. \': \'.',
  75. },
  76. {
  77. 'name' => 'ticket_hook_position',
  78. 'title' => nil,
  79. 'description' => "The format of the subject.
  80. * **Right** means **Some Subject [Ticket#12345]**
  81. * **Left** means **[Ticket#12345] Some Subject**
  82. * **None** means **Some Subject** (without ticket number). In the last case you should enable *postmaster_follow_up_search_in* to recognize follow-ups based on email headers and/or body.",
  83. },
  84. {
  85. 'name' => 'customer_ticket_create_group_ids',
  86. 'title' => nil,
  87. 'description' => 'Defines groups for which a customer can create tickets via web interface. "-" means all groups are available.',
  88. },
  89. {
  90. 'name' => 'form_ticket_create',
  91. 'title' => nil,
  92. 'description' => 'Defines if tickets can be created via web form.',
  93. },
  94. {
  95. 'name' => 'ticket_subject_size',
  96. 'title' => nil,
  97. 'description' => 'Max. length of the subject in an email reply.',
  98. },
  99. {
  100. 'name' => 'ticket_subject_re',
  101. 'title' => nil,
  102. 'description' => 'The text at the beginning of the subject in an email reply, e.g. RE, AW, or AS.',
  103. },
  104. {
  105. 'name' => 'ticket_define_email_from',
  106. 'title' => nil,
  107. 'description' => 'Defines how the From field of emails (sent from answers and email tickets) should look like.',
  108. },
  109. {
  110. 'name' => 'ticket_define_email_from_separator',
  111. 'title' => nil,
  112. 'description' => 'Defines the separator between the agent\'s real name and the given group email address.',
  113. },
  114. {
  115. 'name' => 'postmaster_max_size',
  116. 'title' => 'Maximum Email Size',
  117. 'description' => 'Maximum size in MB of emails.',
  118. },
  119. {
  120. 'name' => 'postmaster_follow_up_search_in',
  121. 'title' => 'Additional follow-up detection',
  122. 'description' => 'By default the follow-up check is done via the subject of an email. With this setting you can add more fields for which the follow-up check will be executed.',
  123. },
  124. {
  125. 'name' => 'send_no_auto_response_reg_exp',
  126. 'title' => nil,
  127. 'description' => 'If this regex matches, no notification will be sent by the sender.',
  128. },
  129. {
  130. 'name' => 'api_token_access',
  131. 'title' => nil,
  132. 'description' => 'Enable REST API using tokens (not username/email address and password). Each user needs to create its own access tokens in user profile.',
  133. },
  134. {
  135. 'name' => 'monitoring_token',
  136. 'title' => nil,
  137. 'description' => 'Token for monitoring.',
  138. },
  139. {
  140. 'name' => 'chat',
  141. 'title' => nil,
  142. 'description' => 'Enable/disable online chat.',
  143. },
  144. {
  145. 'name' => 'chat_agent_idle_timeout',
  146. 'title' => nil,
  147. 'description' => 'Idle timeout in seconds until agent is set offline automatically.',
  148. },
  149. {
  150. 'name' => 'models_searchable',
  151. 'title' => 'Defines searchable models.',
  152. 'description' => 'Defines the searchable models.',
  153. },
  154. {
  155. 'name' => 'default_controller',
  156. 'title' => nil,
  157. 'description' => 'Defines the default screen.',
  158. },
  159. {
  160. 'name' => 'es_url',
  161. 'title' => nil,
  162. 'description' => 'Defines endpoint of Elasticsearch.',
  163. },
  164. {
  165. 'name' => 'es_user',
  166. 'title' => nil,
  167. 'description' => 'Defines HTTP basic auth user of Elasticsearch.',
  168. },
  169. {
  170. 'name' => 'es_password',
  171. 'title' => 'Elasticsearch Endpoint Password',
  172. 'description' => 'Defines HTTP basic auth password of Elasticsearch.',
  173. },
  174. {
  175. 'name' => 'es_index',
  176. 'title' => 'Elasticsearch Endpoint Index',
  177. 'description' => 'Defines Elasticsearch index name.',
  178. },
  179. {
  180. 'name' => 'es_attachment_ignore',
  181. 'title' => 'Elasticsearch Attachment Extensions',
  182. 'description' => 'Defines attachment extensions which will be ignored by Elasticsearch.',
  183. },
  184. {
  185. 'name' => 'es_attachment_max_size_in_mb',
  186. 'title' => 'Elasticsearch Attachment Size',
  187. 'description' => nil,
  188. },
  189. {
  190. 'name' => 'import_mode',
  191. 'title' => nil,
  192. 'description' => 'Puts Zammad into import mode (disables some triggers).',
  193. },
  194. {
  195. 'name' => 'import_backend',
  196. 'title' => nil,
  197. 'description' => 'Set backend which is being used for import.',
  198. },
  199. {
  200. 'name' => 'import_ignore_sla',
  201. 'title' => nil,
  202. 'description' => 'Ignore escalation/SLA information for import.',
  203. },
  204. {
  205. 'name' => 'import_otrs_endpoint',
  206. 'title' => nil,
  207. 'description' => 'Defines OTRS endpoint to import users, tickets, states and articles.',
  208. },
  209. {
  210. 'name' => 'import_otrs_endpoint_key',
  211. 'title' => nil,
  212. 'description' => 'Defines OTRS endpoint authentication key.',
  213. },
  214. {
  215. 'name' => 'import_otrs_user',
  216. 'title' => 'Import User for HTTP basic authentication',
  217. 'description' => 'Defines HTTP basic authentication user (only if OTRS is protected via HTTP basic auth).',
  218. },
  219. {
  220. 'name' => 'import_zendesk_endpoint_key',
  221. 'title' => nil,
  222. 'description' => 'Defines Zendesk endpoint authentication key.',
  223. },
  224. {
  225. 'name' => 'import_zendesk_endpoint_username',
  226. 'title' => nil,
  227. 'description' => 'Defines Zendesk endpoint authentication user.',
  228. },
  229. {
  230. 'name' => 'time_accounting_selector',
  231. 'title' => nil,
  232. 'description' => 'Enable time accounting for these tickets.',
  233. },
  234. {
  235. 'name' => 'tag_new',
  236. 'title' => nil,
  237. 'description' => 'Allow users to create new tags.',
  238. },
  239. {
  240. 'name' => 'defaults_calendar_subscriptions_tickets',
  241. 'title' => nil,
  242. 'description' => 'Defines the default calendar tickets subscription settings.',
  243. },
  244. {
  245. 'name' => 'translator_key',
  246. 'title' => 'Defines translator identifier.',
  247. 'description' => nil,
  248. },
  249. {
  250. 'name' => '0010_postmaster_filter_trusted',
  251. 'title' => 'Defines postmaster filter.',
  252. 'description' => 'Defines postmaster filter to remove X-Zammad headers from not trusted sources.',
  253. },
  254. {
  255. 'name' => '0012_postmaster_filter_sender_is_system_address',
  256. 'title' => 'Defines postmaster filter.',
  257. 'description' => 'Defines postmaster filter to check if email has been created by Zammad itself and will set the article sender.',
  258. },
  259. {
  260. 'name' => '0015_postmaster_filter_identify_sender',
  261. 'title' => 'Defines postmaster filter.',
  262. 'description' => 'Defines postmaster filter to identify sender user.',
  263. },
  264. {
  265. 'name' => '0020_postmaster_filter_auto_response_check',
  266. 'title' => 'Defines postmaster filter.',
  267. 'description' => 'Defines postmaster filter to identify auto responses to prevent auto replies from Zammad.',
  268. },
  269. {
  270. 'name' => '0030_postmaster_filter_out_of_office_check',
  271. 'title' => 'Defines postmaster filter.',
  272. 'description' => 'Defines postmaster filter to identify out-of-office emails for follow-up detection and keeping current ticket state.',
  273. },
  274. {
  275. 'name' => '0100_postmaster_filter_follow_up_check',
  276. 'title' => 'Defines postmaster filter.',
  277. 'description' => 'Defines postmaster filter to identify follow-ups (based on admin settings).',
  278. },
  279. {
  280. 'name' => '0900_postmaster_filter_bounce_check',
  281. 'title' => 'Defines postmaster filter.',
  282. 'description' => 'Defines postmaster filter to identify postmaster bounced - to handle it as follow-up of the original ticket.',
  283. },
  284. {
  285. 'name' => '1000_postmaster_filter_database_check',
  286. 'title' => 'Defines postmaster filter.',
  287. 'description' => 'Defines postmaster filter for filters managed via admin interface.',
  288. },
  289. {
  290. 'name' => '5000_postmaster_filter_icinga',
  291. 'title' => 'Defines postmaster filter.',
  292. 'description' => 'Defines postmaster filter to manage Icinga (http://www.icinga.org) emails.',
  293. },
  294. {
  295. 'name' => '5100_postmaster_filter_nagios',
  296. 'title' => 'Defines postmaster filter.',
  297. 'description' => 'Defines postmaster filter to manage Nagios (http://www.nagios.org) emails.',
  298. },
  299. {
  300. 'name' => 'icinga_integration',
  301. 'title' => nil,
  302. 'description' => 'Defines if Icinga (http://www.icinga.org) is enabled or not.',
  303. },
  304. {
  305. 'name' => 'icinga_sender',
  306. 'title' => nil,
  307. 'description' => 'Defines the sender email address of Icinga emails.',
  308. },
  309. {
  310. 'name' => 'icinga_auto_close',
  311. 'title' => nil,
  312. 'description' => 'Defines if tickets should be closed if service is recovered.',
  313. },
  314. {
  315. 'name' => 'icinga_auto_close_state_id',
  316. 'title' => nil,
  317. 'description' => 'Defines the state of auto closed tickets.',
  318. },
  319. {
  320. 'name' => 'nagios_integration',
  321. 'title' => nil,
  322. 'description' => 'Defines if Nagios (http://www.nagios.org) is enabled or not.',
  323. },
  324. {
  325. 'name' => 'nagios_sender',
  326. 'title' => nil,
  327. 'description' => 'Defines the sender email address of Nagios emails.',
  328. },
  329. {
  330. 'name' => 'nagios_auto_close',
  331. 'title' => nil,
  332. 'description' => 'Defines if tickets should be closed if service is recovered.',
  333. },
  334. {
  335. 'name' => 'nagios_auto_close_state_id',
  336. 'title' => nil,
  337. 'description' => 'Defines the state of auto closed tickets.',
  338. },
  339. {
  340. 'name' => '0100_trigger',
  341. 'title' => 'Defines sync transaction backend.',
  342. 'description' => 'Defines the transaction backend to execute triggers.',
  343. },
  344. {
  345. 'name' => '0100_notification',
  346. 'title' => 'Defines transaction backend.',
  347. 'description' => 'Defines the transaction backend to send agent notifications.',
  348. },
  349. {
  350. 'name' => '1000_signature_detection',
  351. 'title' => 'Defines transaction backend.',
  352. 'description' => 'Defines the transaction backend to detect customer signatures in emails.',
  353. },
  354. {
  355. 'name' => '6000_slack_webhook',
  356. 'title' => 'Defines transaction backend.',
  357. 'description' => 'Defines the transaction backend which posts messages to Slack (http://www.slack.com).',
  358. },
  359. {
  360. 'name' => 'slack_integration',
  361. 'title' => nil,
  362. 'description' => 'Defines if Slack (http://www.slack.org) is enabled or not.',
  363. },
  364. {
  365. 'name' => 'slack_config',
  366. 'title' => nil,
  367. 'description' => 'Defines the slack config.',
  368. },
  369. {
  370. 'name' => 'sipgate_integration',
  371. 'title' => nil,
  372. 'description' => 'Defines if sipgate.io (http://www.sipgate.io) is enabled or not.',
  373. },
  374. {
  375. 'name' => 'sipgate_config',
  376. 'title' => nil,
  377. 'description' => 'Defines the sipgate.io config.',
  378. },
  379. {
  380. 'name' => 'clearbit_integration',
  381. 'title' => nil,
  382. 'description' => 'Defines if Clearbit (http://www.clearbit.com) is enabled or not.',
  383. },
  384. {
  385. 'name' => 'clearbit_config',
  386. 'title' => nil,
  387. 'description' => 'Defines the Clearbit config.',
  388. },
  389. {
  390. 'name' => '9000_clearbit_enrichment',
  391. 'title' => 'Defines transaction backend.',
  392. 'description' => 'Defines the transaction backend which will enrich customer and organization information from Clearbit (http://www.clearbit.com).',
  393. },
  394. {
  395. 'name' => '9100_cti_caller_id_detection',
  396. 'title' => 'Defines transaction backend.',
  397. 'description' => 'Defines the transaction backend which detects caller IDs in objects and store them for CTI lookups.',
  398. },
  399. {
  400. 'name' => '9200_karma',
  401. 'title' => 'Defines transaction backend.',
  402. 'description' => 'Defines the transaction backend which creates the karma score.',
  403. },
  404. {
  405. 'name' => 'karma_levels',
  406. 'title' => 'Defines karma levels.',
  407. 'description' => 'Defines the karma levels.',
  408. },
  409. ]
  410. settings_update.each do |setting|
  411. fetched_setting = Setting.find_by(name: setting['name'] )
  412. next if !fetched_setting
  413. if setting['title']
  414. fetched_setting.title = setting['title']
  415. end
  416. if setting['description']
  417. fetched_setting.description = setting['description']
  418. end
  419. fetched_setting.save!
  420. end
  421. Translation.sync
  422. end
  423. end