seeds.rb 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889
  1. # encoding: utf-8
  2. # This file should contain all the record creation needed to seed the database with its default values.
  3. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
  4. #
  5. # Examples:
  6. #
  7. # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
  8. # Mayor.create(:name => 'Emanuel', :city => cities.first)
  9. Setting.create_if_not_exists(
  10. title: 'System Init Done',
  11. name: 'system_init_done',
  12. area: 'Core',
  13. description: 'Defines if application is in init mode.',
  14. options: {},
  15. state: false,
  16. preferences: { online_service_disable: true },
  17. frontend: true
  18. )
  19. Setting.create_if_not_exists(
  20. title: 'Developer System',
  21. name: 'developer_mode',
  22. area: 'Core::Develop',
  23. description: 'Defines if application is in developer mode (useful for developer, all users have the same password, password reset will work without email delivery).',
  24. options: {},
  25. state: false,
  26. preferences: { online_service_disable: true },
  27. frontend: true
  28. )
  29. Setting.create_if_not_exists(
  30. title: 'Online Service',
  31. name: 'system_online_service',
  32. area: 'Core',
  33. description: 'Defines if application is used as online service.',
  34. options: {},
  35. state: false,
  36. preferences: { online_service_disable: true },
  37. frontend: true
  38. )
  39. Setting.create_if_not_exists(
  40. title: 'Product Name',
  41. name: 'product_name',
  42. area: 'System::Branding',
  43. description: 'Defines the name of the application, shown in the web interface, tabs and title bar of the web browser.',
  44. options: {
  45. form: [
  46. {
  47. display: '',
  48. null: false,
  49. name: 'product_name',
  50. tag: 'input',
  51. },
  52. ],
  53. },
  54. preferences: { render: true, session_check: true, prio: 1 },
  55. state: 'Zammad Helpdesk',
  56. frontend: true
  57. )
  58. Setting.create_if_not_exists(
  59. title: 'Logo',
  60. name: 'product_logo',
  61. area: 'System::Branding',
  62. description: 'Defines the logo of the application, shown in the web interface.',
  63. options: {
  64. form: [
  65. {
  66. display: '',
  67. null: false,
  68. name: 'product_logo',
  69. tag: 'input',
  70. },
  71. ],
  72. },
  73. preferences: { prio: 3 },
  74. state: 'logo.svg',
  75. frontend: true
  76. )
  77. Setting.create_if_not_exists(
  78. title: 'Organization',
  79. name: 'organization',
  80. area: 'System::Branding',
  81. description: 'Will be shown in the app and is included in email footers.',
  82. options: {
  83. form: [
  84. {
  85. display: '',
  86. null: false,
  87. name: 'organization',
  88. tag: 'input',
  89. },
  90. ],
  91. },
  92. state: '',
  93. preferences: { prio: 2 },
  94. frontend: true
  95. )
  96. options = {}
  97. (10..99).each {|item|
  98. options[item] = item
  99. }
  100. system_id = rand(10..99)
  101. Setting.create_if_not_exists(
  102. title: 'SystemID',
  103. name: 'system_id',
  104. area: 'System::Base',
  105. description: 'Defines the system identifier. Every ticket number contains this ID. This ensures that only tickets which belong to your system will be processed as follow-ups (useful when communicating between two instances of Zammad).',
  106. options: {
  107. form: [
  108. {
  109. display: '',
  110. null: true,
  111. name: 'system_id',
  112. tag: 'select',
  113. options: options,
  114. },
  115. ],
  116. },
  117. state: system_id,
  118. preferences: { online_service_disable: true },
  119. frontend: true
  120. )
  121. Setting.create_if_not_exists(
  122. title: 'Fully Qualified Domain Name',
  123. name: 'fqdn',
  124. area: 'System::Base',
  125. description: 'Defines the fully qualified domain name of the system. This setting is used as a variable, #{setting.fqdn} which is found in all forms of messaging used by the application, to build links to the tickets within your system.',
  126. options: {
  127. form: [
  128. {
  129. display: '',
  130. null: false,
  131. name: 'fqdn',
  132. tag: 'input',
  133. },
  134. ],
  135. },
  136. state: 'zammad.example.com',
  137. preferences: { online_service_disable: true },
  138. frontend: true
  139. )
  140. Setting.create_if_not_exists(
  141. title: 'websocket port',
  142. name: 'websocket_port',
  143. area: 'System::WebSocket',
  144. description: 'Defines the port of the websocket server.',
  145. options: {
  146. form: [
  147. {
  148. display: '',
  149. null: false,
  150. name: 'websocket_port',
  151. tag: 'input',
  152. },
  153. ],
  154. },
  155. state: '6042',
  156. preferences: { online_service_disable: true },
  157. frontend: true
  158. )
  159. Setting.create_if_not_exists(
  160. title: 'http type',
  161. name: 'http_type',
  162. area: 'System::Base',
  163. description: 'Defines the type of protocol, used by the web server, to serve the application. If https protocol will be used instead of plain http, it must be specified in here. Since this has no affect on the web server\'s settings or behavior, it will not change the method of access to the application and, if it is wrong, it will not prevent you from logging into the application. This setting is used as a variable, #{setting.http_type} which is found in all forms of messaging used by the application, to build links to the tickets within your system.',
  164. options: {
  165. form: [
  166. {
  167. display: '',
  168. null: true,
  169. name: 'http_type',
  170. tag: 'select',
  171. options: {
  172. 'https' => 'https',
  173. 'http' => 'http',
  174. },
  175. },
  176. ],
  177. },
  178. state: 'http',
  179. preferences: { online_service_disable: true },
  180. frontend: true
  181. )
  182. Setting.create_if_not_exists(
  183. title: 'Storage Mechanism',
  184. name: 'storage',
  185. area: 'System::Storage',
  186. description: '"Database" stores all attachments in the database (not recommended for storing large amounts of data). "Filesystem" stores the data on the filesystem. You can switch between the modules even on a system that is already in production without any loss of data.',
  187. options: {
  188. form: [
  189. {
  190. display: '',
  191. null: true,
  192. name: 'storage',
  193. tag: 'select',
  194. options: {
  195. 'DB' => 'Database',
  196. 'FS' => 'Filesystem',
  197. },
  198. },
  199. ],
  200. },
  201. state: 'DB',
  202. preferences: { online_service_disable: true },
  203. frontend: false
  204. )
  205. Setting.create_if_not_exists(
  206. title: 'Image Service',
  207. name: 'image_backend',
  208. area: 'System::Services',
  209. description: 'Defines the backend for user and organization image lookups.',
  210. options: {
  211. form: [
  212. {
  213. display: '',
  214. null: true,
  215. name: 'image_backend',
  216. tag: 'select',
  217. options: {
  218. '' => '-',
  219. 'Service::Image::Zammad' => 'Zammad Image Service',
  220. },
  221. },
  222. ],
  223. },
  224. state: 'Service::Image::Zammad',
  225. preferences: { prio: 1 },
  226. frontend: false
  227. )
  228. Setting.create_if_not_exists(
  229. title: 'Geo IP Service',
  230. name: 'geo_ip_backend',
  231. area: 'System::Services',
  232. description: 'Defines the backend for geo IP lookups. Show also location of an IP address if an IP address is shown.',
  233. options: {
  234. form: [
  235. {
  236. display: '',
  237. null: true,
  238. name: 'geo_ip_backend',
  239. tag: 'select',
  240. options: {
  241. '' => '-',
  242. 'Service::GeoIp::Zammad' => 'Zammad GeoIP Service',
  243. },
  244. },
  245. ],
  246. },
  247. state: 'Service::GeoIp::Zammad',
  248. preferences: { prio: 2 },
  249. frontend: false
  250. )
  251. Setting.create_if_not_exists(
  252. title: 'Geo Location Service',
  253. name: 'geo_location_backend',
  254. area: 'System::Services',
  255. description: 'Defines the backend for geo location lookups to store geo locations for addresses.',
  256. options: {
  257. form: [
  258. {
  259. display: '',
  260. null: true,
  261. name: 'geo_location_backend',
  262. tag: 'select',
  263. options: {
  264. '' => '-',
  265. 'Service::GeoLocation::Gmaps' => 'Google Maps',
  266. },
  267. },
  268. ],
  269. },
  270. state: 'Service::GeoLocation::Gmaps',
  271. preferences: { prio: 3 },
  272. frontend: false
  273. )
  274. Setting.create_if_not_exists(
  275. title: 'Send client stats',
  276. name: 'ui_send_client_stats',
  277. area: 'System::UI',
  278. description: 'Send client stats/error message to central server to improve the usability.',
  279. options: {
  280. form: [
  281. {
  282. display: '',
  283. null: true,
  284. name: 'ui_send_client_stats',
  285. tag: 'boolean',
  286. options: {
  287. true => 'yes',
  288. false => 'no',
  289. },
  290. },
  291. ],
  292. },
  293. state: true,
  294. preferences: { prio: 1 },
  295. frontend: true
  296. )
  297. Setting.create_if_not_exists(
  298. title: 'Client storage',
  299. name: 'ui_client_storage',
  300. area: 'System::UI',
  301. description: 'Use client storage to cache data to perform speed of application.',
  302. options: {
  303. form: [
  304. {
  305. display: '',
  306. null: true,
  307. name: 'ui_client_storage',
  308. tag: 'boolean',
  309. options: {
  310. true => 'yes',
  311. false => 'no',
  312. },
  313. },
  314. ],
  315. },
  316. state: false,
  317. preferences: { prio: 2 },
  318. frontend: true
  319. )
  320. Setting.create_if_not_exists(
  321. title: 'New User Accounts',
  322. name: 'user_create_account',
  323. area: 'Security::Base',
  324. description: 'Enables users to create their own account via web interface.',
  325. options: {
  326. form: [
  327. {
  328. display: '',
  329. null: true,
  330. name: 'user_create_account',
  331. tag: 'boolean',
  332. options: {
  333. true => 'yes',
  334. false => 'no',
  335. },
  336. },
  337. ],
  338. },
  339. state: true,
  340. frontend: true
  341. )
  342. Setting.create_if_not_exists(
  343. title: 'Lost Password',
  344. name: 'user_lost_password',
  345. area: 'Security::Base',
  346. description: 'Activates lost password feature for users.',
  347. options: {
  348. form: [
  349. {
  350. display: '',
  351. null: true,
  352. name: 'user_lost_password',
  353. tag: 'boolean',
  354. options: {
  355. true => 'yes',
  356. false => 'no',
  357. },
  358. },
  359. ],
  360. },
  361. state: true,
  362. frontend: true
  363. )
  364. Setting.create_if_not_exists(
  365. title: 'Authentication via OTRS',
  366. name: 'auth_otrs',
  367. area: 'Security::Authentication',
  368. description: 'Enables user authentication via OTRS.',
  369. state: {
  370. adapter: 'Auth::Otrs',
  371. required_group_ro: 'stats',
  372. group_rw_role_map: {
  373. 'admin' => 'Admin',
  374. 'stats' => 'Report',
  375. },
  376. group_ro_role_map: {
  377. 'stats' => 'Report',
  378. },
  379. always_role: {
  380. 'Agent' => true,
  381. },
  382. },
  383. frontend: false
  384. )
  385. Setting.create_if_not_exists(
  386. title: 'Authentication via LDAP',
  387. name: 'auth_ldap',
  388. area: 'Security::Authentication',
  389. description: 'Enables user authentication via LDAP.',
  390. state: {
  391. adapter: 'Auth::Ldap',
  392. host: 'localhost',
  393. port: 389,
  394. bind_dn: 'cn=Manager,dc=example,dc=org',
  395. bind_pw: 'example',
  396. uid: 'mail',
  397. base: 'dc=example,dc=org',
  398. always_filter: '',
  399. always_roles: %w(Admin Agent),
  400. always_groups: ['Users'],
  401. sync_params: {
  402. firstname: 'sn',
  403. lastname: 'givenName',
  404. email: 'mail',
  405. login: 'mail',
  406. },
  407. },
  408. frontend: false
  409. )
  410. Setting.create_if_not_exists(
  411. title: 'Authentication via Twitter',
  412. name: 'auth_twitter',
  413. area: 'Security::ThirdPartyAuthentication',
  414. description: 'Enables user authentication via twitter. Register your app first at https://dev.twitter.com/apps',
  415. options: {
  416. form: [
  417. {
  418. display: '',
  419. null: true,
  420. name: 'auth_twitter',
  421. tag: 'boolean',
  422. options: {
  423. true => 'yes',
  424. false => 'no',
  425. },
  426. },
  427. ],
  428. },
  429. state: false,
  430. frontend: true
  431. )
  432. Setting.create_if_not_exists(
  433. title: 'Twitter App Credentials',
  434. name: 'auth_twitter_credentials',
  435. area: 'Security::ThirdPartyAuthentication',
  436. description: 'App credentials for Twitter.',
  437. options: {
  438. form: [
  439. {
  440. display: 'Twitter Key',
  441. null: true,
  442. name: 'key',
  443. tag: 'input',
  444. },
  445. {
  446. display: 'Twitter Secret',
  447. null: true,
  448. name: 'secret',
  449. tag: 'input',
  450. },
  451. ],
  452. },
  453. state: {},
  454. frontend: false
  455. )
  456. Setting.create_if_not_exists(
  457. title: 'Authentication via Facebook',
  458. name: 'auth_facebook',
  459. area: 'Security::ThirdPartyAuthentication',
  460. description: 'Enables user authentication via Facebook. Register your app first at https://developers.facebook.com/apps/',
  461. options: {
  462. form: [
  463. {
  464. display: '',
  465. null: true,
  466. name: 'auth_facebook',
  467. tag: 'boolean',
  468. options: {
  469. true => 'yes',
  470. false => 'no',
  471. },
  472. },
  473. ],
  474. },
  475. state: false,
  476. frontend: true
  477. )
  478. Setting.create_if_not_exists(
  479. title: 'Facebook App Credentials',
  480. name: 'auth_facebook_credentials',
  481. area: 'Security::ThirdPartyAuthentication',
  482. description: 'App credentials for Facebook.',
  483. options: {
  484. form: [
  485. {
  486. display: 'App ID',
  487. null: true,
  488. name: 'app_id',
  489. tag: 'input',
  490. },
  491. {
  492. display: 'App Secret',
  493. null: true,
  494. name: 'app_secret',
  495. tag: 'input',
  496. },
  497. ],
  498. },
  499. state: {},
  500. frontend: false
  501. )
  502. Setting.create_if_not_exists(
  503. title: 'Authentication via Google',
  504. name: 'auth_google_oauth2',
  505. area: 'Security::ThirdPartyAuthentication',
  506. description: 'Enables user authentication via Google.',
  507. options: {
  508. form: [
  509. {
  510. display: '',
  511. null: true,
  512. name: 'auth_google_oauth2',
  513. tag: 'boolean',
  514. options: {
  515. true => 'yes',
  516. false => 'no',
  517. },
  518. },
  519. ],
  520. },
  521. state: false,
  522. frontend: true
  523. )
  524. Setting.create_if_not_exists(
  525. title: 'Google App Credentials',
  526. name: 'auth_google_oauth2_credentials',
  527. area: 'Security::ThirdPartyAuthentication',
  528. description: 'Enables user authentication via Google.',
  529. options: {
  530. form: [
  531. {
  532. display: 'Client ID',
  533. null: true,
  534. name: 'client_id',
  535. tag: 'input',
  536. },
  537. {
  538. display: 'Client Secret',
  539. null: true,
  540. name: 'client_secret',
  541. tag: 'input',
  542. },
  543. ],
  544. },
  545. state: {},
  546. frontend: false
  547. )
  548. Setting.create_if_not_exists(
  549. title: 'Authentication via LinkedIn',
  550. name: 'auth_linkedin',
  551. area: 'Security::ThirdPartyAuthentication',
  552. description: 'Enables user authentication via LinkedIn.',
  553. options: {
  554. form: [
  555. {
  556. display: '',
  557. null: true,
  558. name: 'auth_linkedin',
  559. tag: 'boolean',
  560. options: {
  561. true => 'yes',
  562. false => 'no',
  563. },
  564. },
  565. ],
  566. },
  567. state: false,
  568. frontend: true
  569. )
  570. Setting.create_if_not_exists(
  571. title: 'LinkedIn App Credentials',
  572. name: 'auth_linkedin_credentials',
  573. area: 'Security::ThirdPartyAuthentication',
  574. description: 'Enables user authentication via LinkedIn.',
  575. options: {
  576. form: [
  577. {
  578. display: 'App ID',
  579. null: true,
  580. name: 'app_id',
  581. tag: 'input',
  582. },
  583. {
  584. display: 'App Secret',
  585. null: true,
  586. name: 'app_secret',
  587. tag: 'input',
  588. },
  589. ],
  590. },
  591. state: {},
  592. frontend: false
  593. )
  594. Setting.create_if_not_exists(
  595. title: 'Minimal size',
  596. name: 'password_min_size',
  597. area: 'Security::Password',
  598. description: 'Password need to have at least minimal size of characters.',
  599. options: {
  600. form: [
  601. {
  602. display: '',
  603. null: true,
  604. name: 'password_min_size',
  605. tag: 'select',
  606. options: {
  607. 4 => ' 4',
  608. 5 => ' 5',
  609. 6 => ' 6',
  610. 7 => ' 7',
  611. 8 => ' 8',
  612. 9 => ' 9',
  613. 10 => '10',
  614. 11 => '11',
  615. 12 => '12',
  616. 13 => '13',
  617. 14 => '14',
  618. 15 => '15',
  619. 16 => '16',
  620. 17 => '17',
  621. 18 => '18',
  622. 19 => '19',
  623. 20 => '20',
  624. },
  625. },
  626. ],
  627. },
  628. state: 6,
  629. frontend: true
  630. )
  631. Setting.create_if_not_exists(
  632. title: '2 lower and 2 upper characters',
  633. name: 'password_min_2_lower_2_upper_characters',
  634. area: 'Security::Password',
  635. description: 'Password need to contain 2 lower and 2 upper characters.',
  636. options: {
  637. form: [
  638. {
  639. display: '',
  640. null: true,
  641. name: 'password_min_2_lower_2_upper_characters',
  642. tag: 'select',
  643. options: {
  644. 1 => 'yes',
  645. 0 => 'no',
  646. },
  647. },
  648. ],
  649. },
  650. state: 0,
  651. frontend: true
  652. )
  653. Setting.create_if_not_exists(
  654. title: 'Digit required',
  655. name: 'password_need_digit',
  656. area: 'Security::Password',
  657. description: 'Password need to have at least one digit.',
  658. options: {
  659. form: [
  660. {
  661. display: 'Needed',
  662. null: true,
  663. name: 'password_need_digit',
  664. tag: 'select',
  665. options: {
  666. 1 => 'yes',
  667. 0 => 'no',
  668. },
  669. },
  670. ],
  671. },
  672. state: 1,
  673. frontend: true
  674. )
  675. Setting.create_if_not_exists(
  676. title: 'Maximal failed logins',
  677. name: 'password_max_login_failed',
  678. area: 'Security::Password',
  679. description: 'Maximal failed logins after account is inactive.',
  680. options: {
  681. form: [
  682. {
  683. display: '',
  684. null: true,
  685. name: 'password_max_login_failed',
  686. tag: 'select',
  687. options: {
  688. 4 => ' 4',
  689. 5 => ' 5',
  690. 6 => ' 6',
  691. 7 => ' 7',
  692. 8 => ' 8',
  693. 9 => ' 9',
  694. 10 => '10',
  695. 11 => '11',
  696. 13 => '13',
  697. 14 => '14',
  698. 15 => '15',
  699. 16 => '16',
  700. 17 => '17',
  701. 18 => '18',
  702. 19 => '19',
  703. 20 => '20',
  704. },
  705. },
  706. ],
  707. },
  708. state: 10,
  709. frontend: true
  710. )
  711. Setting.create_if_not_exists(
  712. title: 'Ticket Hook',
  713. name: 'ticket_hook',
  714. area: 'Ticket::Base',
  715. description: 'The identifier for a ticket, e.g. Ticket#, Call#, MyTicket#. The default is Ticket#.',
  716. options: {
  717. form: [
  718. {
  719. display: '',
  720. null: false,
  721. name: 'ticket_hook',
  722. tag: 'input',
  723. },
  724. ],
  725. },
  726. preferences: { render: true },
  727. state: 'Ticket#',
  728. frontend: true
  729. )
  730. Setting.create_if_not_exists(
  731. title: 'Ticket Hook Divider',
  732. name: 'ticket_hook_divider',
  733. area: 'Ticket::Base::Shadow',
  734. description: 'The divider between TicketHook and ticket number. E.g \': \'.',
  735. options: {
  736. form: [
  737. {
  738. display: '',
  739. null: true,
  740. name: 'ticket_hook_divider',
  741. tag: 'input',
  742. },
  743. ],
  744. },
  745. state: '',
  746. frontend: false
  747. )
  748. Setting.create_if_not_exists(
  749. title: 'Ticket Hook Position',
  750. name: 'ticket_hook_position',
  751. area: 'Ticket::Base',
  752. description: 'The format of the subject. "Left" means "[Ticket#12345] Some Subject", "Right" means "Some Subject [Ticket#12345]", "None" means "Some Subject" and no ticket number. In the last case you should enable "postmaster_follow_up_search_in" to recognize followups based on email headers and/or body.',
  753. options: {
  754. form: [
  755. {
  756. display: '',
  757. null: true,
  758. name: 'ticket_hook_position',
  759. tag: 'select',
  760. options: {
  761. 'left' => 'Left',
  762. 'right' => 'Right',
  763. 'none' => 'None',
  764. },
  765. },
  766. ],
  767. },
  768. state: 'right',
  769. frontend: false
  770. )
  771. Setting.create_if_not_exists(
  772. title: 'Ticket Subject Size',
  773. name: 'ticket_subject_size',
  774. area: 'Ticket::Base',
  775. description: 'Max size of the subjects in an email reply.',
  776. options: {
  777. form: [
  778. {
  779. display: '',
  780. null: false,
  781. name: 'ticket_subject_size',
  782. tag: 'input',
  783. },
  784. ],
  785. },
  786. state: '110',
  787. frontend: false
  788. )
  789. Setting.create_if_not_exists(
  790. title: 'Ticket Subject Reply',
  791. name: 'ticket_subject_re',
  792. area: 'Ticket::Base',
  793. description: 'The text at the beginning of the subject in an email reply, e.g. RE, AW, or AS.',
  794. options: {
  795. form: [
  796. {
  797. display: '',
  798. null: true,
  799. name: 'ticket_subject_re',
  800. tag: 'input',
  801. },
  802. ],
  803. },
  804. state: 'RE',
  805. frontend: false
  806. )
  807. #Setting.create(
  808. # :title => 'Ticket Subject Forward',
  809. # :name => 'ticket_subject_fw',
  810. # :area => 'Ticket::Base',
  811. # :description => 'The text at the beginning of the subject when an email is forwarded, e.g. FW, Fwd, or WG.',
  812. # :state => {
  813. # :value => 'FW',
  814. # },
  815. # :frontend => false
  816. #)
  817. Setting.create_if_not_exists(
  818. title: 'Ticket Number Format',
  819. name: 'ticket_number',
  820. area: 'Ticket::Number',
  821. description: 'Selects the ticket number generator module. "Increment" increments the ticket
  822. number, the SystemID and the counter are used with SystemID.Counter format (e.g. 1010138, 1010139).
  823. With "Date" the ticket numbers will be generated by the current date, the SystemID and the counter.
  824. The format looks like Year.Month.Day.SystemID.counter (e.g. 201206231010138, 201206231010139).
  825. With param "Checksum => true" the counter will be appended as checksum to the string. The format
  826. looks like SystemID.Counter.CheckSum (e. g. 10101384, 10101392) or Year.Month.Day.SystemID.Counter.CheckSum (e.g. 2012070110101520, 2012070110101535).',
  827. options: {
  828. form: [
  829. {
  830. display: '',
  831. null: true,
  832. name: 'ticket_number',
  833. tag: 'select',
  834. options: {
  835. 'Ticket::Number::Increment' => 'Increment (SystemID.Counter)',
  836. 'Ticket::Number::Date' => 'Date (Year.Month.Day.SystemID.Counter)',
  837. },
  838. },
  839. ],
  840. },
  841. state: 'Ticket::Number::Increment',
  842. frontend: false
  843. )
  844. Setting.create_if_not_exists(
  845. title: 'Ticket Number Increment',
  846. name: 'ticket_number_increment',
  847. area: 'Ticket::Number',
  848. description: '-',
  849. options: {
  850. form: [
  851. {
  852. display: 'Checksum',
  853. null: true,
  854. name: 'checksum',
  855. tag: 'boolean',
  856. options: {
  857. true => 'yes',
  858. false => 'no',
  859. },
  860. },
  861. {
  862. display: 'Min. size of number',
  863. null: true,
  864. name: 'min_size',
  865. tag: 'select',
  866. options: {
  867. 1 => ' 1',
  868. 2 => ' 2',
  869. 3 => ' 3',
  870. 4 => ' 4',
  871. 5 => ' 5',
  872. 6 => ' 6',
  873. 7 => ' 7',
  874. 8 => ' 8',
  875. 9 => ' 9',
  876. 10 => '10',
  877. 11 => '11',
  878. 12 => '12',
  879. 13 => '13',
  880. 14 => '14',
  881. 15 => '15',
  882. 16 => '16',
  883. 17 => '17',
  884. 18 => '18',
  885. 19 => '19',
  886. 20 => '20',
  887. },
  888. },
  889. ],
  890. },
  891. state: {
  892. checksum: false,
  893. min_size: 5,
  894. },
  895. frontend: false
  896. )
  897. Setting.create_if_not_exists(
  898. title: 'Ticket Number Increment Date',
  899. name: 'ticket_number_date',
  900. area: 'Ticket::Number',
  901. description: '-',
  902. options: {
  903. form: [
  904. {
  905. display: 'Checksum',
  906. null: true,
  907. name: 'checksum',
  908. tag: 'boolean',
  909. options: {
  910. true => 'yes',
  911. false => 'no',
  912. },
  913. },
  914. ],
  915. },
  916. state: {
  917. checksum: false,
  918. },
  919. frontend: false
  920. )
  921. Setting.create_if_not_exists(
  922. title: 'Enable Ticket creation',
  923. name: 'customer_ticket_create',
  924. area: 'CustomerWeb::Base',
  925. description: 'Defines if a customer can create tickets via the web interface.',
  926. options: {
  927. form: [
  928. {
  929. display: '',
  930. null: true,
  931. name: 'customer_ticket_create',
  932. tag: 'boolean',
  933. options: {
  934. true => 'yes',
  935. false => 'no',
  936. },
  937. },
  938. ],
  939. },
  940. state: true,
  941. frontend: true
  942. )
  943. Setting.create_if_not_exists(
  944. title: 'Group selection for Ticket creation',
  945. name: 'customer_ticket_create_group_ids',
  946. area: 'CustomerWeb::Base',
  947. description: 'Defines groups where customer can create tickets via web interface. "-" means all groups are available.',
  948. options: {
  949. form: [
  950. {
  951. display: '',
  952. null: true,
  953. name: 'group_ids',
  954. tag: 'select',
  955. multiple: true,
  956. nulloption: true,
  957. relation: 'Group',
  958. },
  959. ],
  960. },
  961. state: '',
  962. frontend: true
  963. )
  964. Setting.create_if_not_exists(
  965. title: 'Enable Ticket View/Update',
  966. name: 'customer_ticket_view',
  967. area: 'CustomerWeb::Base',
  968. description: 'Defines if a customer view and update his own tickets.',
  969. options: {
  970. form: [
  971. {
  972. display: '',
  973. null: true,
  974. name: 'customer_ticket_view',
  975. tag: 'boolean',
  976. options: {
  977. true => 'yes',
  978. false => 'no',
  979. },
  980. },
  981. ],
  982. },
  983. state: true,
  984. frontend: true
  985. )
  986. Setting.create_if_not_exists(
  987. title: 'Enable Ticket creation',
  988. name: 'form_ticket_create',
  989. area: 'Form::Base',
  990. description: 'Defines if ticket can get created via web form.',
  991. options: {
  992. form: [
  993. {
  994. display: '',
  995. null: true,
  996. name: 'form_ticket_create',
  997. tag: 'boolean',
  998. options: {
  999. true => 'yes',
  1000. false => 'no',
  1001. },
  1002. },
  1003. ],
  1004. },
  1005. state: false,
  1006. frontend: false,
  1007. )
  1008. Setting.create_if_not_exists(
  1009. title: 'Sender Format',
  1010. name: 'ticket_define_email_from',
  1011. area: 'Email::Base',
  1012. description: 'Defines how the From field from the emails (sent from answers and email tickets) should look like.',
  1013. options: {
  1014. form: [
  1015. {
  1016. display: '',
  1017. null: true,
  1018. name: 'ticket_define_email_from',
  1019. tag: 'select',
  1020. options: {
  1021. SystemAddressName: 'System Address Display Name',
  1022. AgentNameSystemAddressName: 'Agent Name + FromSeparator + System Address Display Name',
  1023. },
  1024. },
  1025. ],
  1026. },
  1027. state: 'AgentNameSystemAddressName',
  1028. frontend: false
  1029. )
  1030. Setting.create_if_not_exists(
  1031. title: 'Sender Format Seperator',
  1032. name: 'ticket_define_email_from_seperator',
  1033. area: 'Email::Base',
  1034. description: 'Defines the separator between the agents real name and the given group email address.',
  1035. options: {
  1036. form: [
  1037. {
  1038. display: '',
  1039. null: false,
  1040. name: 'ticket_define_email_from_seperator',
  1041. tag: 'input',
  1042. },
  1043. ],
  1044. },
  1045. state: 'via',
  1046. frontend: false
  1047. )
  1048. Setting.create_if_not_exists(
  1049. title: 'Max. Email Size',
  1050. name: 'postmaster_max_size',
  1051. area: 'Email::Base',
  1052. description: 'Maximal size in MB of emails.',
  1053. options: {
  1054. form: [
  1055. {
  1056. display: '',
  1057. null: true,
  1058. name: 'postmaster_max_size',
  1059. tag: 'select',
  1060. options: {
  1061. 1 => ' 1',
  1062. 2 => ' 2',
  1063. 3 => ' 3',
  1064. 4 => ' 4',
  1065. 5 => ' 5',
  1066. 6 => ' 6',
  1067. 7 => ' 7',
  1068. 8 => ' 8',
  1069. 9 => ' 9',
  1070. 10 => ' 10',
  1071. 15 => ' 15',
  1072. 20 => ' 20',
  1073. 25 => ' 25',
  1074. 30 => ' 30',
  1075. 35 => ' 35',
  1076. 40 => ' 40',
  1077. 45 => ' 45',
  1078. 50 => ' 50',
  1079. 60 => ' 60',
  1080. 70 => ' 70',
  1081. 80 => ' 80',
  1082. 90 => ' 90',
  1083. 100 => '100',
  1084. 125 => '125',
  1085. 150 => '150',
  1086. },
  1087. },
  1088. ],
  1089. },
  1090. state: 10,
  1091. preferences: { online_service_disable: true },
  1092. frontend: false
  1093. )
  1094. Setting.create_if_not_exists(
  1095. title: 'Additional follow up detection',
  1096. name: 'postmaster_follow_up_search_in',
  1097. area: 'Email::Base',
  1098. description: 'In default the follow up check is done via the subject of an email. With this setting you can add more fields where the follow up ckeck is executed. "References" - Executes follow up check on In-Reply-To or References headers for mails. "Body" - Executes follow up check in mail body. "Attachment" - Executes follow up check in mail attachments.',
  1099. options: {
  1100. form: [
  1101. {
  1102. display: '',
  1103. null: true,
  1104. name: 'postmaster_follow_up_search_in',
  1105. tag: 'checkbox',
  1106. options: {
  1107. 'references' => 'References',
  1108. 'body' => 'Body',
  1109. 'attachment' => 'Attachment',
  1110. },
  1111. },
  1112. ],
  1113. },
  1114. state: [],
  1115. frontend: false
  1116. )
  1117. Setting.create_if_not_exists(
  1118. title: 'Notification Sender',
  1119. name: 'notification_sender',
  1120. area: 'Email::Base',
  1121. description: 'Defines the sender of email notifications.',
  1122. options: {
  1123. form: [
  1124. {
  1125. display: '',
  1126. null: false,
  1127. name: 'notification_sender',
  1128. tag: 'input',
  1129. },
  1130. ],
  1131. },
  1132. state: 'Notification Master <noreply@#{config.fqdn}>',
  1133. preferences: { online_service_disable: true },
  1134. frontend: false
  1135. )
  1136. Setting.create_if_not_exists(
  1137. title: 'Block Notifications',
  1138. name: 'send_no_auto_response_reg_exp',
  1139. area: 'Email::Base',
  1140. description: 'If this regex matches, no notification will be send by the sender.',
  1141. options: {
  1142. form: [
  1143. {
  1144. display: '',
  1145. null: false,
  1146. name: 'send_no_auto_response_reg_exp',
  1147. tag: 'input',
  1148. },
  1149. ],
  1150. },
  1151. state: '(MAILER-DAEMON|postmaster|abuse)@.+?\..+?',
  1152. preferences: { online_service_disable: true },
  1153. frontend: false
  1154. )
  1155. Setting.create_if_not_exists(
  1156. title: 'Enable Chat',
  1157. name: 'chat',
  1158. area: 'Chat::Base',
  1159. description: 'Enable/Disable online chat.',
  1160. options: {
  1161. form: [
  1162. {
  1163. display: '',
  1164. null: true,
  1165. name: 'chat',
  1166. tag: 'boolean',
  1167. options: {
  1168. true => 'yes',
  1169. false => 'no',
  1170. },
  1171. },
  1172. ],
  1173. },
  1174. preferences: { render: true },
  1175. state: false,
  1176. frontend: true
  1177. )
  1178. Setting.create_if_not_exists(
  1179. title: 'Define searchable models.',
  1180. name: 'models_searchable',
  1181. area: 'Models::Base',
  1182. description: 'Define the models which can be searched for.',
  1183. options: {},
  1184. state: [],
  1185. frontend: false,
  1186. )
  1187. Setting.create_if_not_exists(
  1188. title: 'Default Screen',
  1189. name: 'default_controller',
  1190. area: 'Core',
  1191. description: 'Defines the default controller.',
  1192. options: {},
  1193. state: '#dashboard',
  1194. frontend: true
  1195. )
  1196. Setting.create_if_not_exists(
  1197. title: 'Elasticsearch Endpoint URL',
  1198. name: 'es_url',
  1199. area: 'SearchIndex::Elasticsearch',
  1200. description: 'Define endpoint of Elastic Search.',
  1201. state: '',
  1202. preferences: { online_service_disable: true },
  1203. frontend: false
  1204. )
  1205. Setting.create_if_not_exists(
  1206. title: 'Elasticsearch Endpoint User',
  1207. name: 'es_user',
  1208. area: 'SearchIndex::Elasticsearch',
  1209. description: 'Define http basic auth user of Elasticsearch.',
  1210. state: '',
  1211. preferences: { online_service_disable: true },
  1212. frontend: false
  1213. )
  1214. Setting.create_if_not_exists(
  1215. title: 'Elastic Search Endpoint Password',
  1216. name: 'es_password',
  1217. area: 'SearchIndex::Elasticsearch',
  1218. description: 'Define http basic auth password of Elasticsearch.',
  1219. state: '',
  1220. preferences: { online_service_disable: true },
  1221. frontend: false
  1222. )
  1223. Setting.create_if_not_exists(
  1224. title: 'Elastic Search Endpoint Index',
  1225. name: 'es_index',
  1226. area: 'SearchIndex::Elasticsearch',
  1227. description: 'Define Elasticsearch index name.',
  1228. state: 'zammad',
  1229. preferences: { online_service_disable: true },
  1230. frontend: false
  1231. )
  1232. Setting.create_if_not_exists(
  1233. title: 'Elastic Search Attachment Extentions',
  1234. name: 'es_attachment_ignore',
  1235. area: 'SearchIndex::Elasticsearch',
  1236. description: 'Define attachment extentions which are ignored for Elasticsearch.',
  1237. state: [ '.png', '.jpg', '.jpeg', '.mpeg', '.mpg', '.mov', '.bin', '.exe', '.box', '.mbox' ],
  1238. preferences: { online_service_disable: true },
  1239. frontend: false
  1240. )
  1241. Setting.create_if_not_exists(
  1242. title: 'Elastic Search Attachment Size',
  1243. name: 'es_attachment_max_size_in_mb',
  1244. area: 'SearchIndex::Elasticsearch',
  1245. description: 'Define max. attachment size for Elasticsearch.',
  1246. state: 50,
  1247. preferences: { online_service_disable: true },
  1248. frontend: false
  1249. )
  1250. Setting.create_if_not_exists(
  1251. title: 'Import Mode',
  1252. name: 'import_mode',
  1253. area: 'Import::Base',
  1254. description: 'Set system in import mode (disable some triggers).',
  1255. options: {
  1256. form: [
  1257. {
  1258. display: '',
  1259. null: true,
  1260. name: 'import_mode',
  1261. tag: 'boolean',
  1262. options: {
  1263. true => 'yes',
  1264. false => 'no',
  1265. },
  1266. },
  1267. ],
  1268. },
  1269. state: false,
  1270. frontend: true
  1271. )
  1272. Setting.create_if_not_exists(
  1273. title: 'Import Backend',
  1274. name: 'import_backend',
  1275. area: 'Import::Base::Internal',
  1276. description: 'Set backend which is used for import.',
  1277. options: {},
  1278. state: '',
  1279. frontend: true
  1280. )
  1281. Setting.create_if_not_exists(
  1282. title: 'Ignore Escalation/SLA Information',
  1283. name: 'import_ignore_sla',
  1284. area: 'Import::Base',
  1285. description: 'Ignore Escalation/SLA Information form import system.',
  1286. options: {
  1287. form: [
  1288. {
  1289. display: '',
  1290. null: true,
  1291. name: 'import_ignore_sla',
  1292. tag: 'boolean',
  1293. options: {
  1294. true => 'yes',
  1295. false => 'no',
  1296. },
  1297. },
  1298. ],
  1299. },
  1300. state: false,
  1301. frontend: true
  1302. )
  1303. Setting.create_if_not_exists(
  1304. title: 'Import Endpoint',
  1305. name: 'import_otrs_endpoint',
  1306. area: 'Import::OTRS',
  1307. description: 'Defines OTRS endpoint to import users, ticket, states and articles.',
  1308. options: {
  1309. form: [
  1310. {
  1311. display: '',
  1312. null: false,
  1313. name: 'import_otrs_endpoint',
  1314. tag: 'input',
  1315. },
  1316. ],
  1317. },
  1318. state: 'http://otrs_host/otrs',
  1319. frontend: false
  1320. )
  1321. Setting.create_if_not_exists(
  1322. title: 'Import Key',
  1323. name: 'import_otrs_endpoint_key',
  1324. area: 'Import::OTRS',
  1325. description: 'Defines OTRS endpoint auth key.',
  1326. options: {
  1327. form: [
  1328. {
  1329. display: '',
  1330. null: false,
  1331. name: 'import_otrs_endpoint_key',
  1332. tag: 'input',
  1333. },
  1334. ],
  1335. },
  1336. state: '',
  1337. frontend: false
  1338. )
  1339. Setting.create_if_not_exists(
  1340. title: 'Import User for http basic authentiation',
  1341. name: 'import_otrs_user',
  1342. area: 'Import::OTRS',
  1343. description: 'Defines http basic authentiation user (only if OTRS is protected via http basic auth).',
  1344. options: {
  1345. form: [
  1346. {
  1347. display: '',
  1348. null: true,
  1349. name: 'import_otrs_user',
  1350. tag: 'input',
  1351. },
  1352. ],
  1353. },
  1354. state: '',
  1355. frontend: false
  1356. )
  1357. Setting.create_if_not_exists(
  1358. title: 'Import Password for http basic authentiation',
  1359. name: 'import_otrs_password',
  1360. area: 'Import::OTRS',
  1361. description: 'Defines http basic authentiation password (only if OTRS is protected via http basic auth).',
  1362. options: {
  1363. form: [
  1364. {
  1365. display: '',
  1366. null: true,
  1367. name: 'import_otrs_password',
  1368. tag: 'input',
  1369. },
  1370. ],
  1371. },
  1372. state: '',
  1373. frontend: false
  1374. )
  1375. Setting.create_if_not_exists(
  1376. title: 'Default calendar Tickets subscriptions',
  1377. name: 'defaults_calendar_subscriptions_tickets',
  1378. area: 'Defaults::CalendarSubscriptions',
  1379. description: 'Defines the default calendar Tickets subscription settings.',
  1380. options: {},
  1381. state: {
  1382. escalation: {
  1383. own: true,
  1384. not_assigned: false,
  1385. },
  1386. new_open: {
  1387. own: true,
  1388. not_assigned: false,
  1389. },
  1390. pending: {
  1391. own: true,
  1392. not_assigned: false,
  1393. }
  1394. },
  1395. frontend: true
  1396. )
  1397. signature = Signature.create_if_not_exists(
  1398. id: 1,
  1399. name: 'default',
  1400. body: '
  1401. #{user.firstname} #{user.lastname}
  1402. --
  1403. Super Support - Waterford Business Park
  1404. 5201 Blue Lagoon Drive - 8th Floor & 9th Floor - Miami, 33126 USA
  1405. Email: hot@example.com - Web: http://www.example.com/
  1406. --',
  1407. updated_by_id: 1,
  1408. created_by_id: 1
  1409. )
  1410. Role.create_if_not_exists(
  1411. id: 1,
  1412. name: 'Admin',
  1413. note: 'To configure your system.',
  1414. updated_by_id: 1,
  1415. created_by_id: 1
  1416. )
  1417. Role.create_if_not_exists(
  1418. id: 2,
  1419. name: 'Agent',
  1420. note: 'To work on Tickets.',
  1421. updated_by_id: 1,
  1422. created_by_id: 1
  1423. )
  1424. Role.create_if_not_exists(
  1425. id: 3,
  1426. name: 'Customer',
  1427. note: 'People who create Tickets ask for help.',
  1428. updated_by_id: 1,
  1429. created_by_id: 1
  1430. )
  1431. Group.create_if_not_exists(
  1432. id: 1,
  1433. name: 'Users',
  1434. signature_id: signature.id,
  1435. note: 'Standard Group/Pool for Tickets.',
  1436. updated_by_id: 1,
  1437. created_by_id: 1
  1438. )
  1439. user = User.create_if_not_exists(
  1440. id: 1,
  1441. login: '-',
  1442. firstname: '-',
  1443. lastname: '',
  1444. email: '',
  1445. password: 'root',
  1446. active: false,
  1447. updated_by_id: 1,
  1448. created_by_id: 1
  1449. )
  1450. UserInfo.current_user_id = 1
  1451. roles = Role.where( name: 'Customer' )
  1452. organizations = Organization.all
  1453. groups = Group.all
  1454. org_community = Organization.create_if_not_exists(
  1455. id: 1,
  1456. name: 'Zammad Foundation',
  1457. )
  1458. user_community = User.create_or_update(
  1459. id: 2,
  1460. login: 'nicole.braun@zammad.org',
  1461. firstname: 'Nicole',
  1462. lastname: 'Braun',
  1463. email: 'nicole.braun@zammad.org',
  1464. password: '',
  1465. active: true,
  1466. roles: roles,
  1467. organization_id: org_community.id,
  1468. )
  1469. Link::Type.create_if_not_exists( id: 1, name: 'normal' )
  1470. Link::Object.create_if_not_exists( id: 1, name: 'Ticket' )
  1471. Link::Object.create_if_not_exists( id: 2, name: 'Announcement' )
  1472. Link::Object.create_if_not_exists( id: 3, name: 'Question/Answer' )
  1473. Link::Object.create_if_not_exists( id: 4, name: 'Idea' )
  1474. Link::Object.create_if_not_exists( id: 5, name: 'Bug' )
  1475. Ticket::StateType.create_if_not_exists( id: 1, name: 'new' )
  1476. Ticket::StateType.create_if_not_exists( id: 2, name: 'open' )
  1477. Ticket::StateType.create_if_not_exists( id: 3, name: 'pending reminder' )
  1478. Ticket::StateType.create_if_not_exists( id: 4, name: 'pending action' )
  1479. Ticket::StateType.create_if_not_exists( id: 5, name: 'closed' )
  1480. Ticket::StateType.create_if_not_exists( id: 6, name: 'merged' )
  1481. Ticket::StateType.create_if_not_exists( id: 7, name: 'removed' )
  1482. Ticket::State.create_if_not_exists( id: 1, name: 'new', state_type_id: Ticket::StateType.find_by(name: 'new').id, )
  1483. Ticket::State.create_if_not_exists( id: 2, name: 'open', state_type_id: Ticket::StateType.find_by(name: 'open').id )
  1484. Ticket::State.create_if_not_exists( id: 3, name: 'pending reminder', state_type_id: Ticket::StateType.find_by(name: 'pending reminder').id, ignore_escalation: true )
  1485. Ticket::State.create_if_not_exists( id: 4, name: 'closed', state_type_id: Ticket::StateType.find_by(name: 'closed').id, ignore_escalation: true )
  1486. Ticket::State.create_if_not_exists( id: 5, name: 'merged', state_type_id: Ticket::StateType.find_by(name: 'merged').id, ignore_escalation: true )
  1487. Ticket::State.create_if_not_exists( id: 6, name: 'removed', state_type_id: Ticket::StateType.find_by(name: 'removed').id, active: false, ignore_escalation: true )
  1488. Ticket::State.create_if_not_exists( id: 7, name: 'pending close', state_type_id: Ticket::StateType.find_by(name: 'pending action').id, next_state_id: 4, ignore_escalation: true )
  1489. Ticket::Priority.create_if_not_exists( id: 1, name: '1 low' )
  1490. Ticket::Priority.create_if_not_exists( id: 2, name: '2 normal' )
  1491. Ticket::Priority.create_if_not_exists( id: 3, name: '3 high' )
  1492. Ticket::Article::Type.create_if_not_exists( id: 1, name: 'email', communication: true )
  1493. Ticket::Article::Type.create_if_not_exists( id: 2, name: 'sms', communication: true )
  1494. Ticket::Article::Type.create_if_not_exists( id: 3, name: 'chat', communication: true )
  1495. Ticket::Article::Type.create_if_not_exists( id: 4, name: 'fax', communication: true )
  1496. Ticket::Article::Type.create_if_not_exists( id: 5, name: 'phone', communication: true )
  1497. Ticket::Article::Type.create_if_not_exists( id: 6, name: 'twitter status', communication: true )
  1498. Ticket::Article::Type.create_if_not_exists( id: 7, name: 'twitter direct-message', communication: true )
  1499. Ticket::Article::Type.create_if_not_exists( id: 8, name: 'facebook feed post', communication: true )
  1500. Ticket::Article::Type.create_if_not_exists( id: 9, name: 'facebook feed comment', communication: true )
  1501. Ticket::Article::Type.create_if_not_exists( id: 10, name: 'note', communication: false )
  1502. Ticket::Article::Type.create_if_not_exists( id: 11, name: 'web', communication: true )
  1503. Ticket::Article::Sender.create_if_not_exists( id: 1, name: 'Agent' )
  1504. Ticket::Article::Sender.create_if_not_exists( id: 2, name: 'Customer' )
  1505. Ticket::Article::Sender.create_if_not_exists( id: 3, name: 'System' )
  1506. UserInfo.current_user_id = user_community.id
  1507. ticket = Ticket.create(
  1508. group_id: Group.where( name: 'Users' ).first.id,
  1509. customer_id: User.where( login: 'nicole.braun@zammad.org' ).first.id,
  1510. owner_id: User.where( login: '-' ).first.id,
  1511. title: 'Welcome to Zammad!',
  1512. state_id: Ticket::State.where( name: 'new' ).first.id,
  1513. priority_id: Ticket::Priority.where( name: '2 normal' ).first.id,
  1514. )
  1515. Ticket::Article.create(
  1516. ticket_id: ticket.id,
  1517. type_id: Ticket::Article::Type.where(name: 'phone' ).first.id,
  1518. sender_id: Ticket::Article::Sender.where(name: 'Customer' ).first.id,
  1519. from: 'Zammad Feedback <feedback@zammad.org>',
  1520. body: 'Welcome!
  1521. Thank you for installing Zammad.
  1522. You will find updates and patches at http://zammad.org/. Online
  1523. documentation is available at http://guides.zammad.org/. You can also
  1524. use our forums at http://forums.zammad.org/
  1525. Regards,
  1526. The Zammad.org Project
  1527. ',
  1528. internal: false,
  1529. )
  1530. UserInfo.current_user_id = 1
  1531. overview_role = Role.where( name: 'Agent' ).first
  1532. Overview.create_if_not_exists(
  1533. name: 'My assigned Tickets',
  1534. link: 'my_assigned',
  1535. prio: 1000,
  1536. role_id: overview_role.id,
  1537. condition: {
  1538. 'tickets.state_id' => [ 1, 2, 3, 7 ],
  1539. 'tickets.owner_id' => 'current_user.id',
  1540. },
  1541. order: {
  1542. by: 'created_at',
  1543. direction: 'ASC',
  1544. },
  1545. view: {
  1546. d: %w(title customer group created_at),
  1547. s: %w(title customer group created_at),
  1548. m: %w(number title customer group created_at),
  1549. view_mode_default: 's',
  1550. },
  1551. )
  1552. Overview.create_if_not_exists(
  1553. name: 'My pending reached Tickets',
  1554. link: 'my_pending_reached',
  1555. prio: 1010,
  1556. role_id: overview_role.id,
  1557. condition: {
  1558. 'tickets.state_id' => [3],
  1559. 'tickets.owner_id' => 'current_user.id',
  1560. 'tickets.pending_time' => { 'direction' => 'before', 'count' => 1, 'area' => 'minute' },
  1561. },
  1562. order: {
  1563. by: 'created_at',
  1564. direction: 'ASC',
  1565. },
  1566. view: {
  1567. d: %w(title customer group created_at),
  1568. s: %w(title customer group created_at),
  1569. m: %w(number title customer group created_at),
  1570. view_mode_default: 's',
  1571. },
  1572. )
  1573. Overview.create_if_not_exists(
  1574. name: 'Unassigned & Open Tickets',
  1575. link: 'all_unassigned',
  1576. prio: 1020,
  1577. role_id: overview_role.id,
  1578. condition: {
  1579. 'tickets.state_id' => [1, 2, 3],
  1580. 'tickets.owner_id' => 1,
  1581. },
  1582. order: {
  1583. by: 'created_at',
  1584. direction: 'ASC',
  1585. },
  1586. view: {
  1587. d: %w(title customer group created_at),
  1588. s: %w(title customer group created_at),
  1589. m: %w(number title customer group created_at),
  1590. view_mode_default: 's',
  1591. },
  1592. )
  1593. Overview.create_if_not_exists(
  1594. name: 'All Open Tickets',
  1595. link: 'all_open',
  1596. prio: 1030,
  1597. role_id: overview_role.id,
  1598. condition: {
  1599. 'tickets.state_id' => [1, 2, 3],
  1600. },
  1601. order: {
  1602. by: 'created_at',
  1603. direction: 'ASC',
  1604. },
  1605. view: {
  1606. d: %w(title customer group state owner created_at),
  1607. s: %w(title customer group state owner created_at),
  1608. m: %w(number title customer group state owner created_at),
  1609. view_mode_default: 's',
  1610. },
  1611. )
  1612. Overview.create_if_not_exists(
  1613. name: 'All pending reached Tickets',
  1614. link: 'all_pending_reached',
  1615. prio: 1035,
  1616. role_id: overview_role.id,
  1617. condition: {
  1618. 'tickets.state_id' => [3],
  1619. 'tickets.pending_time' => { 'direction' => 'before', 'count' => 1, 'area' => 'minute' },
  1620. },
  1621. order: {
  1622. by: 'created_at',
  1623. direction: 'ASC',
  1624. },
  1625. view: {
  1626. d: %w(title customer group owner created_at),
  1627. s: %w(title customer group owner created_at),
  1628. m: %w(number title customer group owner created_at),
  1629. view_mode_default: 's',
  1630. },
  1631. )
  1632. Overview.create_if_not_exists(
  1633. name: 'Escalated Tickets',
  1634. link: 'all_escalated',
  1635. prio: 1040,
  1636. role_id: overview_role.id,
  1637. condition: {
  1638. 'tickets.escalation_time' => { 'direction' => 'before', 'count' => 5, 'area' => 'minute' },
  1639. },
  1640. order: {
  1641. by: 'escalation_time',
  1642. direction: 'ASC',
  1643. },
  1644. view: {
  1645. d: %w(title customer group owner escalation_time),
  1646. s: %w(title customer group owner escalation_time),
  1647. m: %w(number title customer group owner escalation_time),
  1648. view_mode_default: 's',
  1649. },
  1650. )
  1651. overview_role = Role.where( name: 'Customer' ).first
  1652. Overview.create_if_not_exists(
  1653. name: 'My Tickets',
  1654. link: 'my_tickets',
  1655. prio: 1000,
  1656. role_id: overview_role.id,
  1657. condition: {
  1658. 'tickets.state_id' => [ 1, 2, 3, 4, 6 ],
  1659. 'tickets.customer_id' => 'current_user.id',
  1660. },
  1661. order: {
  1662. by: 'created_at',
  1663. direction: 'DESC',
  1664. },
  1665. view: {
  1666. d: %w(title customer state created_at),
  1667. s: %w(number title state created_at),
  1668. m: %w(number title state created_at),
  1669. view_mode_default: 's',
  1670. },
  1671. )
  1672. Overview.create_if_not_exists(
  1673. name: 'My Organization Tickets',
  1674. link: 'my_organization_tickets',
  1675. prio: 1100,
  1676. role_id: overview_role.id,
  1677. organization_shared: true,
  1678. condition: {
  1679. 'tickets.state_id' => [ 1, 2, 3, 4, 6 ],
  1680. 'tickets.organization_id' => 'current_user.organization_id',
  1681. },
  1682. order: {
  1683. by: 'created_at',
  1684. direction: 'DESC',
  1685. },
  1686. view: {
  1687. d: %w(title customer state created_at),
  1688. s: %w(number title customer state created_at),
  1689. m: %w(number title customer state created_at),
  1690. view_mode_default: 's',
  1691. },
  1692. )
  1693. Channel.create_if_not_exists(
  1694. area: 'Email::Notification',
  1695. options: {
  1696. outbound: {
  1697. adapter: 'smtp',
  1698. options: {
  1699. host: 'host.example.com',
  1700. user: '',
  1701. password: '',
  1702. ssl: true,
  1703. },
  1704. },
  1705. },
  1706. group_id: 1,
  1707. preferences: { online_service_disable: true },
  1708. active: false,
  1709. )
  1710. Channel.create_if_not_exists(
  1711. area: 'Email::Notification',
  1712. options: {
  1713. outbound: {
  1714. adapter: 'sendmail',
  1715. },
  1716. },
  1717. preferences: { online_service_disable: true },
  1718. active: true,
  1719. )
  1720. network = Network.create_if_not_exists(
  1721. id: 1,
  1722. name: 'base',
  1723. )
  1724. Network::Category::Type.create_if_not_exists(
  1725. id: 1,
  1726. name: 'Announcement',
  1727. )
  1728. Network::Category::Type.create_if_not_exists(
  1729. id: 2,
  1730. name: 'Idea',
  1731. )
  1732. Network::Category::Type.create_if_not_exists(
  1733. id: 3,
  1734. name: 'Question',
  1735. )
  1736. Network::Category::Type.create_if_not_exists(
  1737. id: 4,
  1738. name: 'Bug Report',
  1739. )
  1740. Network::Privacy.create_if_not_exists(
  1741. id: 1,
  1742. name: 'logged in',
  1743. key: 'loggedIn',
  1744. )
  1745. Network::Privacy.create_if_not_exists(
  1746. id: 2,
  1747. name: 'logged in and moderator',
  1748. key: 'loggedInModerator',
  1749. )
  1750. Network::Category.create_if_not_exists(
  1751. id: 1,
  1752. name: 'Announcements',
  1753. network_id: network.id,
  1754. network_category_type_id: Network::Category::Type.where(name: 'Announcement').first.id,
  1755. network_privacy_id: Network::Privacy.where(name: 'logged in and moderator').first.id,
  1756. allow_comments: true,
  1757. )
  1758. Network::Category.create_if_not_exists(
  1759. id: 2,
  1760. name: 'Questions',
  1761. network_id: network.id,
  1762. allow_comments: true,
  1763. network_category_type_id: Network::Category::Type.where(name: 'Question').first.id,
  1764. network_privacy_id: Network::Privacy.where(name: 'logged in').first.id,
  1765. # :network_categories_moderator_user_ids => User.where(:login => '-').first.id,
  1766. )
  1767. Network::Category.create_if_not_exists(
  1768. id: 3,
  1769. name: 'Ideas',
  1770. network_id: network.id,
  1771. network_category_type_id: Network::Category::Type.where(name: 'Idea').first.id,
  1772. network_privacy_id: Network::Privacy.where(name: 'logged in').first.id,
  1773. allow_comments: true,
  1774. )
  1775. Network::Category.create_if_not_exists(
  1776. id: 4,
  1777. name: 'Bug Reports',
  1778. network_id: network.id,
  1779. network_category_type_id: Network::Category::Type.where(name: 'Bug Report').first.id,
  1780. network_privacy_id: Network::Privacy.where(name: 'logged in').first.id,
  1781. allow_comments: true,
  1782. )
  1783. item = Network::Item.create(
  1784. title: 'Example Announcement',
  1785. body: 'Some announcement....',
  1786. network_category_id: Network::Category.where(name: 'Announcements').first.id,
  1787. )
  1788. Network::Item::Comment.create(
  1789. network_item_id: item.id,
  1790. body: 'Some comment....',
  1791. )
  1792. item = Network::Item.create(
  1793. title: 'Example Question?',
  1794. body: 'Some questions....',
  1795. network_category_id: Network::Category.where(name: 'Questions').first.id,
  1796. )
  1797. Network::Item::Comment.create(
  1798. network_item_id: item.id,
  1799. body: 'Some comment....',
  1800. )
  1801. item = Network::Item.create(
  1802. title: 'Example Idea',
  1803. body: 'Some idea....',
  1804. network_category_id: Network::Category.where(name: 'Ideas').first.id,
  1805. )
  1806. Network::Item::Comment.create(
  1807. network_item_id: item.id,
  1808. body: 'Some comment....',
  1809. )
  1810. item = Network::Item.create(
  1811. title: 'Example Bug Report',
  1812. body: 'Some bug....',
  1813. network_category_id: Network::Category.where(name: 'Bug Reports').first.id,
  1814. )
  1815. Network::Item::Comment.create(
  1816. network_item_id: item.id,
  1817. body: 'Some comment....',
  1818. )
  1819. # install locales and translations
  1820. Locale.create_if_not_exists(
  1821. locale: 'en-us',
  1822. alias: 'en',
  1823. name: 'English (United States)',
  1824. )
  1825. Locale.load
  1826. Translation.load
  1827. # install all packages in auto_install
  1828. Package.auto_install()