20160512000001_update_object_manager.rb 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. class UpdateObjectManager < ActiveRecord::Migration
  2. def up
  3. # return if it's a new setup
  4. return if !Setting.find_by(name: 'system_init_done')
  5. add_column :object_manager_attributes, :to_create, :boolean, null: false, default: false
  6. add_column :object_manager_attributes, :to_migrate, :boolean, null: false, default: false
  7. add_column :object_manager_attributes, :to_delete, :boolean, null: false, default: false
  8. ObjectManager::Attribute.reset_column_information
  9. ObjectManager::Attribute.add(
  10. force: true,
  11. object: 'Group',
  12. name: 'name',
  13. display: 'Name',
  14. data_type: 'input',
  15. data_option: {
  16. type: 'text',
  17. maxlength: 150,
  18. null: false,
  19. },
  20. editable: false,
  21. active: true,
  22. screens: {
  23. create: {
  24. '-all-' => {
  25. null: false,
  26. },
  27. },
  28. edit: {
  29. '-all-' => {
  30. null: false,
  31. },
  32. },
  33. view: {
  34. '-all-' => {
  35. shown: true,
  36. },
  37. },
  38. },
  39. to_create: false,
  40. to_migrate: false,
  41. to_delete: false,
  42. position: 200,
  43. created_by_id: 1,
  44. updated_by_id: 1,
  45. )
  46. ObjectManager::Attribute.add(
  47. force: true,
  48. object: 'Group',
  49. name: 'assignment_timeout',
  50. display: 'Assignment Timeout',
  51. data_type: 'integer',
  52. data_option: {
  53. maxlength: 150,
  54. null: true,
  55. note: 'Assignment timeout in minutes if assigned agent is not working on it. Ticket will be shown as unassigend.',
  56. min: 0,
  57. max: 999_999,
  58. },
  59. editable: false,
  60. active: true,
  61. screens: {
  62. create: {
  63. '-all-' => {
  64. null: true,
  65. },
  66. },
  67. edit: {
  68. '-all-' => {
  69. null: true,
  70. },
  71. },
  72. },
  73. to_create: false,
  74. to_migrate: false,
  75. to_delete: false,
  76. position: 300,
  77. created_by_id: 1,
  78. updated_by_id: 1,
  79. )
  80. ObjectManager::Attribute.add(
  81. force: true,
  82. object: 'Group',
  83. name: 'follow_up_possible',
  84. display: 'Follow up possible',
  85. data_type: 'select',
  86. data_option: {
  87. default: 'yes',
  88. options: {
  89. yes: 'yes',
  90. reject: 'reject follow up/do not reopen Ticket',
  91. new_ticket: 'do not reopen Ticket but create new Ticket'
  92. },
  93. null: false,
  94. note: 'Follow up for closed ticket possible or not.',
  95. translate: true
  96. },
  97. editable: false,
  98. active: true,
  99. screens: {
  100. create: {
  101. '-all-' => {
  102. null: true,
  103. },
  104. },
  105. edit: {
  106. '-all-' => {
  107. null: true,
  108. },
  109. },
  110. },
  111. to_create: false,
  112. to_migrate: false,
  113. to_delete: false,
  114. position: 400,
  115. created_by_id: 1,
  116. updated_by_id: 1,
  117. )
  118. ObjectManager::Attribute.add(
  119. force: true,
  120. object: 'Group',
  121. name: 'follow_up_assignment',
  122. display: 'Assign Follow Ups',
  123. data_type: 'select',
  124. data_option: {
  125. default: 'yes',
  126. options: {
  127. true: 'yes',
  128. false: 'no',
  129. },
  130. null: false,
  131. note: 'Assign follow up to latest agent again.',
  132. translate: true
  133. },
  134. editable: false,
  135. active: true,
  136. screens: {
  137. create: {
  138. '-all-' => {
  139. null: true,
  140. },
  141. },
  142. edit: {
  143. '-all-' => {
  144. null: true,
  145. },
  146. },
  147. },
  148. to_create: false,
  149. to_migrate: false,
  150. to_delete: false,
  151. position: 500,
  152. created_by_id: 1,
  153. updated_by_id: 1,
  154. )
  155. ObjectManager::Attribute.add(
  156. force: true,
  157. object: 'Group',
  158. name: 'email_address_id',
  159. display: 'Email',
  160. data_type: 'select',
  161. data_option: {
  162. default: '',
  163. multiple: false,
  164. null: true,
  165. relation: 'EmailAddress',
  166. nulloption: true,
  167. do_not_log: true,
  168. },
  169. editable: false,
  170. active: true,
  171. screens: {
  172. create: {
  173. '-all-' => {
  174. null: true,
  175. },
  176. },
  177. edit: {
  178. '-all-' => {
  179. null: true,
  180. },
  181. },
  182. },
  183. to_create: false,
  184. to_migrate: false,
  185. to_delete: false,
  186. position: 600,
  187. created_by_id: 1,
  188. updated_by_id: 1,
  189. )
  190. ObjectManager::Attribute.add(
  191. force: true,
  192. object: 'Group',
  193. name: 'signature_id',
  194. display: 'Signature',
  195. data_type: 'select',
  196. data_option: {
  197. default: '',
  198. multiple: false,
  199. null: true,
  200. relation: 'Signature',
  201. nulloption: true,
  202. do_not_log: true,
  203. },
  204. editable: false,
  205. active: true,
  206. screens: {
  207. create: {
  208. '-all-' => {
  209. null: true,
  210. },
  211. },
  212. edit: {
  213. '-all-' => {
  214. null: true,
  215. },
  216. },
  217. },
  218. to_create: false,
  219. to_migrate: false,
  220. to_delete: false,
  221. position: 600,
  222. created_by_id: 1,
  223. updated_by_id: 1,
  224. )
  225. ObjectManager::Attribute.add(
  226. force: true,
  227. object: 'Group',
  228. name: 'note',
  229. display: 'Note',
  230. data_type: 'richtext',
  231. data_option: {
  232. type: 'text',
  233. maxlength: 250,
  234. null: true,
  235. note: 'Notes are visible to agents only, never to customers.',
  236. },
  237. editable: false,
  238. active: true,
  239. screens: {
  240. create: {
  241. '-all-' => {
  242. null: true,
  243. },
  244. },
  245. edit: {
  246. '-all-' => {
  247. null: true,
  248. },
  249. },
  250. view: {
  251. '-all-' => {
  252. shown: true,
  253. },
  254. },
  255. },
  256. to_create: false,
  257. to_migrate: false,
  258. to_delete: false,
  259. position: 1500,
  260. created_by_id: 1,
  261. updated_by_id: 1,
  262. )
  263. ObjectManager::Attribute.add(
  264. force: true,
  265. object: 'Group',
  266. name: 'active',
  267. display: 'Active',
  268. data_type: 'active',
  269. data_option: {
  270. null: true,
  271. default: true,
  272. },
  273. editable: false,
  274. active: true,
  275. screens: {
  276. create: {
  277. '-all-' => {
  278. null: true,
  279. },
  280. },
  281. edit: {
  282. Admin: {
  283. null: false,
  284. },
  285. },
  286. view: {
  287. '-all-' => {
  288. shown: false,
  289. },
  290. },
  291. },
  292. to_create: false,
  293. to_migrate: false,
  294. to_delete: false,
  295. position: 1800,
  296. created_by_id: 1,
  297. updated_by_id: 1,
  298. )
  299. end
  300. end