enju_biblio 0.1.0.pre55 → 0.1.0.pre56

Sign up to get free protection for your applications and to get access to all the features.
Files changed (614) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/agent_import_files_controller.rb +11 -11
  3. data/app/controllers/agent_import_results_controller.rb +1 -1
  4. data/app/controllers/agent_relationship_types_controller.rb +0 -1
  5. data/app/controllers/agent_relationships_controller.rb +2 -2
  6. data/app/controllers/agent_types_controller.rb +0 -1
  7. data/app/controllers/agents_controller.rb +22 -23
  8. data/app/controllers/carrier_types_controller.rb +11 -11
  9. data/app/controllers/content_types_controller.rb +0 -1
  10. data/app/controllers/countries_controller.rb +1 -1
  11. data/app/controllers/create_types_controller.rb +0 -1
  12. data/app/controllers/creates_controller.rb +13 -14
  13. data/app/controllers/donates_controller.rb +10 -10
  14. data/app/controllers/extents_controller.rb +1 -1
  15. data/app/controllers/form_of_works_controller.rb +1 -1
  16. data/app/controllers/frequencies_controller.rb +1 -1
  17. data/app/controllers/identifier_types_controller.rb +10 -10
  18. data/app/controllers/import_requests_controller.rb +12 -12
  19. data/app/controllers/items_controller.rb +25 -26
  20. data/app/controllers/languages_controller.rb +1 -1
  21. data/app/controllers/licenses_controller.rb +0 -1
  22. data/app/controllers/manifestation_relationship_types_controller.rb +0 -1
  23. data/app/controllers/manifestation_relationships_controller.rb +2 -2
  24. data/app/controllers/manifestations_controller.rb +64 -59
  25. data/app/controllers/medium_of_performances_controller.rb +0 -1
  26. data/app/controllers/owns_controller.rb +12 -13
  27. data/app/controllers/picture_files_controller.rb +13 -14
  28. data/app/controllers/produce_types_controller.rb +0 -1
  29. data/app/controllers/produces_controller.rb +15 -16
  30. data/app/controllers/realize_types_controller.rb +0 -1
  31. data/app/controllers/realizes_controller.rb +13 -14
  32. data/app/controllers/resource_export_files_controller.rb +11 -11
  33. data/app/controllers/resource_import_files_controller.rb +26 -11
  34. data/app/controllers/resource_import_results_controller.rb +2 -2
  35. data/app/controllers/series_statements_controller.rb +13 -14
  36. data/app/helpers/manifestations_helper.rb +1 -1
  37. data/app/models/agent.rb +44 -41
  38. data/app/models/agent_import_file.rb +12 -58
  39. data/app/models/agent_import_result.rb +3 -4
  40. data/app/models/agent_relationship.rb +3 -3
  41. data/app/models/agent_relationship_type.rb +1 -1
  42. data/app/models/agent_sweeper.rb +0 -1
  43. data/app/models/agent_type.rb +1 -1
  44. data/app/models/carrier_type.rb +4 -4
  45. data/app/models/content_type.rb +1 -1
  46. data/app/models/country.rb +1 -1
  47. data/app/models/create.rb +3 -3
  48. data/app/models/create_type.rb +1 -1
  49. data/app/models/donate.rb +2 -2
  50. data/app/models/enju_biblio/ability.rb +2 -13
  51. data/app/models/exemplify.rb +1 -1
  52. data/app/models/extent.rb +1 -1
  53. data/app/models/form_of_work.rb +1 -1
  54. data/app/models/frequency.rb +1 -1
  55. data/app/models/identifier.rb +3 -3
  56. data/app/models/identifier_type.rb +2 -2
  57. data/app/models/import_request.rb +2 -2
  58. data/app/models/item.rb +48 -48
  59. data/app/models/item_sweeper.rb +0 -1
  60. data/app/models/language.rb +1 -1
  61. data/app/models/license.rb +1 -1
  62. data/app/models/manifestation.rb +72 -66
  63. data/app/models/manifestation_relationship.rb +3 -3
  64. data/app/models/manifestation_relationship_type.rb +1 -1
  65. data/app/models/manifestation_sweeper.rb +0 -1
  66. data/app/models/medium_of_performance.rb +1 -1
  67. data/app/models/own.rb +4 -4
  68. data/app/models/page_sweeper.rb +0 -1
  69. data/app/models/picture_file.rb +6 -6
  70. data/app/models/produce.rb +3 -3
  71. data/app/models/produce_type.rb +1 -1
  72. data/app/models/realize.rb +3 -3
  73. data/app/models/realize_type.rb +1 -1
  74. data/app/models/resource_export_file.rb +4 -11
  75. data/app/models/resource_import_file.rb +148 -100
  76. data/app/models/resource_import_result.rb +1 -1
  77. data/app/models/series_statement.rb +7 -5
  78. data/app/views/agent_import_files/edit.html.erb +1 -1
  79. data/app/views/agent_import_files/index.html.erb +4 -4
  80. data/app/views/agent_import_files/new.html.erb +12 -12
  81. data/app/views/agent_import_files/show.html.erb +4 -4
  82. data/app/views/agent_import_results/index.html.erb +6 -8
  83. data/app/views/agent_import_results/{index.tsv.erb → index.txt.erb} +0 -0
  84. data/app/views/agent_import_results/show.html.erb +1 -6
  85. data/app/views/agent_relationship_types/edit.html.erb +1 -1
  86. data/app/views/agent_relationship_types/index.html.erb +20 -12
  87. data/app/views/agent_relationship_types/new.html.erb +1 -1
  88. data/app/views/agent_relationship_types/show.html.erb +1 -1
  89. data/app/views/agent_relationships/edit.html.erb +1 -1
  90. data/app/views/agent_relationships/index.html.erb +3 -3
  91. data/app/views/agent_relationships/new.html.erb +1 -1
  92. data/app/views/agent_relationships/show.html.erb +1 -1
  93. data/app/views/agent_types/edit.html.erb +1 -1
  94. data/app/views/agent_types/index.html.erb +19 -11
  95. data/app/views/agent_types/new.html.erb +1 -1
  96. data/app/views/agent_types/show.html.erb +1 -1
  97. data/app/views/agents/_agent.html.erb +1 -1
  98. data/app/views/agents/_expression_list.html.erb +2 -2
  99. data/app/views/agents/_form.html.erb +8 -8
  100. data/app/views/agents/_form_family_name_first.html.erb +4 -4
  101. data/app/views/agents/_form_family_name_last.html.erb +4 -4
  102. data/app/views/agents/_index.html.erb +4 -4
  103. data/app/views/agents/_index_agent.html.erb +7 -11
  104. data/app/views/agents/_index_expression.html.erb +5 -5
  105. data/app/views/agents/_index_manifestation.html.erb +11 -11
  106. data/app/views/agents/_index_work.html.erb +5 -5
  107. data/app/views/agents/_manifestation_list.html.erb +2 -2
  108. data/app/views/agents/_work_list.html.erb +2 -2
  109. data/app/views/agents/edit.html.erb +2 -2
  110. data/app/views/agents/index.atom.builder +2 -2
  111. data/app/views/agents/index.html.erb +1 -1
  112. data/app/views/agents/index.mobile.erb +3 -3
  113. data/app/views/agents/index.rss.builder +6 -6
  114. data/app/views/agents/new.html.erb +1 -1
  115. data/app/views/agents/show.html.erb +11 -22
  116. data/app/views/agents/show.mobile.erb +3 -9
  117. data/app/views/carrier_types/_form.html.erb +2 -2
  118. data/app/views/carrier_types/edit.html.erb +1 -1
  119. data/app/views/carrier_types/index.html.erb +15 -9
  120. data/app/views/carrier_types/new.html.erb +1 -1
  121. data/app/views/carrier_types/show.html.erb +17 -1
  122. data/app/views/content_types/_form.html.erb +5 -5
  123. data/app/views/content_types/edit.html.erb +1 -1
  124. data/app/views/content_types/index.html.erb +14 -8
  125. data/app/views/content_types/new.html.erb +1 -1
  126. data/app/views/content_types/show.html.erb +6 -1
  127. data/app/views/countries/_form.html.erb +5 -5
  128. data/app/views/countries/edit.html.erb +1 -1
  129. data/app/views/countries/index.html.erb +10 -8
  130. data/app/views/countries/new.html.erb +1 -1
  131. data/app/views/countries/show.html.erb +1 -1
  132. data/app/views/create_types/edit.html.erb +1 -1
  133. data/app/views/create_types/index.html.erb +20 -12
  134. data/app/views/create_types/new.html.erb +1 -1
  135. data/app/views/create_types/show.html.erb +1 -1
  136. data/app/views/creates/_index.html.erb +3 -3
  137. data/app/views/creates/_index_agent.html.erb +5 -6
  138. data/app/views/creates/_index_work.html.erb +4 -4
  139. data/app/views/creates/edit.html.erb +1 -1
  140. data/app/views/creates/new.html.erb +3 -3
  141. data/app/views/creates/show.html.erb +3 -3
  142. data/app/views/donates/edit.html.erb +1 -1
  143. data/app/views/donates/index.html.erb +4 -4
  144. data/app/views/donates/new.html.erb +1 -1
  145. data/app/views/donates/show.html.erb +1 -1
  146. data/app/views/extents/edit.html.erb +1 -1
  147. data/app/views/extents/index.html.erb +12 -8
  148. data/app/views/extents/new.html.erb +1 -1
  149. data/app/views/extents/show.html.erb +1 -1
  150. data/app/views/form_of_works/_form.html.erb +2 -2
  151. data/app/views/form_of_works/edit.html.erb +1 -1
  152. data/app/views/form_of_works/index.html.erb +15 -9
  153. data/app/views/form_of_works/new.html.erb +1 -1
  154. data/app/views/form_of_works/show.html.erb +1 -1
  155. data/app/views/frequencies/edit.html.erb +1 -1
  156. data/app/views/frequencies/index.html.erb +16 -8
  157. data/app/views/frequencies/new.html.erb +1 -1
  158. data/app/views/frequencies/show.html.erb +6 -1
  159. data/app/views/identifier_types/_form.html.erb +5 -5
  160. data/app/views/identifier_types/edit.html.erb +1 -1
  161. data/app/views/identifier_types/index.html.erb +3 -3
  162. data/app/views/identifier_types/new.html.erb +1 -1
  163. data/app/views/identifier_types/show.html.erb +6 -1
  164. data/app/views/import_requests/edit.html.erb +2 -2
  165. data/app/views/import_requests/index.html.erb +4 -4
  166. data/app/views/import_requests/new.html.erb +3 -3
  167. data/app/views/import_requests/show.html.erb +2 -2
  168. data/app/views/items/_form.html.erb +27 -16
  169. data/app/views/items/_shelf_picture.html.erb +1 -1
  170. data/app/views/items/_shelf_picture.mobile.erb +1 -1
  171. data/app/views/items/edit.html.erb +5 -5
  172. data/app/views/items/index.html.erb +10 -10
  173. data/app/views/items/index.mobile.erb +5 -5
  174. data/app/views/items/index.txt.erb +4 -0
  175. data/app/views/items/new.html.erb +4 -4
  176. data/app/views/items/show.html.erb +35 -21
  177. data/app/views/items/show.mobile.erb +3 -3
  178. data/app/views/languages/_form.html.erb +4 -4
  179. data/app/views/languages/edit.html.erb +1 -1
  180. data/app/views/languages/index.html.erb +2 -2
  181. data/app/views/languages/new.html.erb +1 -1
  182. data/app/views/languages/show.html.erb +1 -1
  183. data/app/views/layouts/agents.html.erb +2 -2
  184. data/app/views/layouts/manifestations.html.erb +2 -2
  185. data/app/views/licenses/_form.html.erb +2 -2
  186. data/app/views/licenses/edit.html.erb +1 -1
  187. data/app/views/licenses/index.html.erb +12 -7
  188. data/app/views/licenses/new.html.erb +1 -1
  189. data/app/views/licenses/show.html.erb +1 -1
  190. data/app/views/manifestation_relationship_types/edit.html.erb +1 -1
  191. data/app/views/manifestation_relationship_types/index.html.erb +20 -12
  192. data/app/views/manifestation_relationship_types/new.html.erb +1 -1
  193. data/app/views/manifestation_relationship_types/show.html.erb +1 -1
  194. data/app/views/manifestation_relationships/edit.html.erb +1 -1
  195. data/app/views/manifestation_relationships/index.html.erb +3 -3
  196. data/app/views/manifestation_relationships/new.html.erb +1 -1
  197. data/app/views/manifestation_relationships/show.html.erb +1 -1
  198. data/app/views/manifestations/_attachment_file.html.erb +1 -1
  199. data/app/views/manifestations/_edit_detail.html.erb +3 -3
  200. data/app/views/manifestations/_form.html.erb +47 -28
  201. data/app/views/manifestations/_holding.html.erb +1 -1
  202. data/app/views/manifestations/_index_form.html.erb +2 -2
  203. data/app/views/manifestations/_index_form_contributor.html.erb +2 -2
  204. data/app/views/manifestations/_index_form_creator.html.erb +2 -2
  205. data/app/views/manifestations/_index_form_item.html.erb +2 -2
  206. data/app/views/manifestations/_index_form_manifestation.html.erb +2 -2
  207. data/app/views/manifestations/_index_form_parent.html.erb +9 -3
  208. data/app/views/manifestations/_index_form_publisher.html.erb +2 -2
  209. data/app/views/manifestations/_index_form_series_statement.html.erb +3 -3
  210. data/app/views/manifestations/_manifestation.html.erb +7 -7
  211. data/app/views/manifestations/_manifestation_list.html.erb +2 -2
  212. data/app/views/manifestations/_paginate_id_link.html.erb +2 -2
  213. data/app/views/manifestations/_pickup.html.erb +4 -4
  214. data/app/views/manifestations/_search_engine.html.erb +1 -1
  215. data/app/views/manifestations/_show.mods.builder +2 -2
  216. data/app/views/manifestations/_show.rdf.builder +2 -2
  217. data/app/views/manifestations/_show_creators.html.erb +2 -2
  218. data/app/views/manifestations/_show_creators.mobile.erb +2 -2
  219. data/app/views/manifestations/_show_detail_librarian.html.erb +13 -9
  220. data/app/views/manifestations/_show_detail_user.html.erb +13 -9
  221. data/app/views/manifestations/_show_holding.html.erb +8 -6
  222. data/app/views/manifestations/_show_holding.mobile.erb +1 -1
  223. data/app/views/manifestations/_show_index.html.erb +7 -5
  224. data/app/views/manifestations/_show_index.mobile.erb +3 -3
  225. data/app/views/manifestations/_show_parent_form.html.erb +12 -0
  226. data/app/views/manifestations/_show_series_index.html.erb +6 -3
  227. data/app/views/manifestations/_submenu_parent.html.erb +1 -1
  228. data/app/views/manifestations/_tab_list.html.erb +3 -3
  229. data/app/views/manifestations/_tab_menu.html.erb +2 -2
  230. data/app/views/manifestations/_title.html.erb +9 -6
  231. data/app/views/manifestations/_title.mobile.erb +6 -6
  232. data/app/views/manifestations/edit.html.erb +3 -3
  233. data/app/views/manifestations/index.atom.builder +2 -2
  234. data/app/views/manifestations/index.html.erb +8 -7
  235. data/app/views/manifestations/index.mobile.erb +4 -4
  236. data/app/views/manifestations/index.mods.builder +1 -1
  237. data/app/views/manifestations/index.opds.builder +4 -4
  238. data/app/views/manifestations/index.rdf.builder +4 -4
  239. data/app/views/manifestations/index.rss.builder +6 -6
  240. data/app/views/manifestations/index.sru.builder +1 -1
  241. data/app/views/manifestations/{index.csv.erb → index.txt.erb} +0 -0
  242. data/app/views/manifestations/new.html.erb +1 -1
  243. data/app/views/manifestations/show.html.erb +14 -14
  244. data/app/views/manifestations/show.mobile.erb +3 -3
  245. data/app/views/manifestations/show.mods.builder +1 -1
  246. data/app/views/manifestations/show.rdf.builder +1 -1
  247. data/app/views/medium_of_performances/edit.html.erb +1 -1
  248. data/app/views/medium_of_performances/index.html.erb +16 -9
  249. data/app/views/medium_of_performances/new.html.erb +1 -1
  250. data/app/views/medium_of_performances/show.html.erb +1 -1
  251. data/app/views/notifier/manifestation_info.en.text.erb +2 -2
  252. data/app/views/notifier/manifestation_info.ja.text.erb +2 -2
  253. data/app/views/owns/edit.html.erb +1 -1
  254. data/app/views/owns/index.html.erb +4 -4
  255. data/app/views/owns/new.html.erb +1 -1
  256. data/app/views/owns/show.html.erb +3 -3
  257. data/app/views/picture_files/_index.html.erb +7 -7
  258. data/app/views/picture_files/_index_agent.html.erb +4 -4
  259. data/app/views/picture_files/_index_event.html.erb +4 -4
  260. data/app/views/picture_files/_index_manifestation.html.erb +4 -4
  261. data/app/views/picture_files/_index_shelf.html.erb +4 -4
  262. data/app/views/picture_files/_link.html.erb +1 -1
  263. data/app/views/picture_files/_link.mobile.erb +1 -1
  264. data/app/views/picture_files/edit.html.erb +1 -1
  265. data/app/views/picture_files/index.html.erb +1 -1
  266. data/app/views/picture_files/new.html.erb +2 -2
  267. data/app/views/picture_files/show.html.erb +7 -7
  268. data/app/views/picture_files/show.mobile.erb +2 -2
  269. data/app/views/produce_types/edit.html.erb +1 -1
  270. data/app/views/produce_types/index.html.erb +20 -12
  271. data/app/views/produce_types/new.html.erb +1 -1
  272. data/app/views/produce_types/show.html.erb +1 -1
  273. data/app/views/produces/_index.html.erb +3 -3
  274. data/app/views/produces/_index_agent.html.erb +3 -3
  275. data/app/views/produces/_index_manifestation.html.erb +5 -5
  276. data/app/views/produces/edit.html.erb +1 -1
  277. data/app/views/produces/index.html.erb +1 -1
  278. data/app/views/produces/new.html.erb +3 -3
  279. data/app/views/produces/show.html.erb +3 -3
  280. data/app/views/realize_types/edit.html.erb +1 -1
  281. data/app/views/realize_types/index.html.erb +20 -12
  282. data/app/views/realize_types/new.html.erb +1 -1
  283. data/app/views/realize_types/show.html.erb +1 -1
  284. data/app/views/realizes/_index.html.erb +3 -3
  285. data/app/views/realizes/_index_agent.html.erb +3 -3
  286. data/app/views/realizes/_index_expression.html.erb +5 -5
  287. data/app/views/realizes/edit.html.erb +1 -1
  288. data/app/views/realizes/new.html.erb +3 -3
  289. data/app/views/realizes/show.html.erb +3 -3
  290. data/app/views/resource_export_files/index.html.erb +3 -3
  291. data/app/views/resource_export_files/new.html.erb +2 -2
  292. data/app/views/resource_export_files/show.html.erb +1 -1
  293. data/app/views/resource_import_files/_observe_field.html.erb +7 -0
  294. data/app/views/resource_import_files/edit.html.erb +1 -1
  295. data/app/views/resource_import_files/index.html.erb +30 -25
  296. data/app/views/resource_import_files/new.html.erb +21 -13
  297. data/app/views/resource_import_files/show.html.erb +9 -4
  298. data/app/views/resource_import_results/index.html.erb +6 -6
  299. data/app/views/resource_import_results/{index.tsv.erb → index.txt.erb} +0 -0
  300. data/app/views/resource_import_results/show.html.erb +1 -1
  301. data/app/views/series_statements/_form.html.erb +2 -2
  302. data/app/views/series_statements/_index.html.erb +5 -5
  303. data/app/views/series_statements/_index_manifestation.html.erb +5 -5
  304. data/app/views/series_statements/_index_series_statement_merge_list.html.erb +5 -5
  305. data/app/views/series_statements/_merge.html.erb +2 -2
  306. data/app/views/series_statements/_refine_search_form.html.erb +2 -2
  307. data/app/views/series_statements/edit.html.erb +1 -1
  308. data/app/views/series_statements/new.html.erb +1 -1
  309. data/app/views/series_statements/show.html.erb +2 -2
  310. data/config/locales/translation_en.yml +13 -9
  311. data/config/locales/translation_ja.yml +16 -9
  312. data/config/routes.rb +5 -14
  313. data/db/migrate/001_create_agents.rb +0 -2
  314. data/db/migrate/006_create_items.rb +0 -2
  315. data/db/migrate/20100925074559_create_agent_import_results.rb +0 -1
  316. data/db/migrate/20140720140916_add_binding_item_identifier_to_item.rb +8 -0
  317. data/db/migrate/20140721151416_add_default_shelf_id_to_resource_import_file.rb +5 -0
  318. data/db/migrate/20140802082007_add_manifestation_id_to_item.rb +6 -0
  319. data/db/migrate/20140813182425_add_publication_place_to_manifestation.rb +5 -0
  320. data/lib/enju_biblio/biblio_helper.rb +4 -4
  321. data/lib/enju_biblio/engine.rb +0 -1
  322. data/lib/enju_biblio/version.rb +1 -1
  323. data/lib/generators/enju_biblio/setup/setup_generator.rb +2 -0
  324. data/lib/generators/enju_biblio/setup/templates/db/fixtures/agent_relationship_types.yml +3 -3
  325. data/lib/generators/enju_biblio/setup/templates/db/fixtures/agent_types.yml +2 -2
  326. data/lib/generators/enju_biblio/setup/templates/db/fixtures/carrier_types.yml +12 -10
  327. data/lib/generators/enju_biblio/setup/templates/db/fixtures/content_types.yml +70 -7
  328. data/lib/generators/enju_biblio/setup/templates/db/fixtures/manifestation_relationship_types.yml +2 -2
  329. data/lib/tasks/carrier_type.rb +26 -0
  330. data/lib/tasks/content_type.rb +19 -0
  331. data/lib/tasks/enju_biblio_tasks.rake +14 -0
  332. data/lib/tasks/item.rb +7 -0
  333. data/spec/cassette_library/ResourceImportFile/should_import_in_background.yml +433 -0
  334. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_has_only_isbn/should_be_imported.yml +363 -326
  335. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_shift_jis/should_be_imported.yml +166 -180
  336. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_be_imported.yml +166 -180
  337. data/spec/controllers/agent_import_files_controller_spec.rb +20 -60
  338. data/spec/controllers/agent_import_results_controller_spec.rb +6 -18
  339. data/spec/controllers/agent_relationship_types_controller_spec.rb +21 -21
  340. data/spec/controllers/agent_relationships_controller_spec.rb +21 -21
  341. data/spec/controllers/agent_types_controller_spec.rb +2 -1
  342. data/spec/controllers/carrier_types_controller_spec.rb +1 -1
  343. data/spec/controllers/content_types_controller_spec.rb +2 -1
  344. data/spec/controllers/countries_controller_spec.rb +22 -23
  345. data/spec/controllers/create_types_controller_spec.rb +2 -2
  346. data/spec/controllers/creates_controller_spec.rb +22 -22
  347. data/spec/controllers/donates_controller_spec.rb +21 -21
  348. data/spec/controllers/extents_controller_spec.rb +2 -1
  349. data/spec/controllers/form_of_works_controller_spec.rb +2 -2
  350. data/spec/controllers/frequencies_controller_spec.rb +2 -1
  351. data/spec/controllers/identifier_types_controller_spec.rb +1 -1
  352. data/spec/controllers/import_requests_controller_spec.rb +21 -21
  353. data/spec/controllers/items_controller_spec.rb +24 -24
  354. data/spec/controllers/languages_controller_spec.rb +12 -12
  355. data/spec/controllers/licenses_controller_spec.rb +2 -1
  356. data/spec/controllers/manifestation_relationship_types_controller_spec.rb +21 -21
  357. data/spec/controllers/manifestation_relationships_controller_spec.rb +21 -21
  358. data/spec/controllers/manifestations_controller_spec.rb +22 -22
  359. data/spec/controllers/medium_of_performances_controller_spec.rb +2 -1
  360. data/spec/controllers/owns_controller_spec.rb +22 -22
  361. data/spec/controllers/picture_files_controller_spec.rb +21 -21
  362. data/spec/controllers/produce_types_controller_spec.rb +2 -1
  363. data/spec/controllers/produces_controller_spec.rb +22 -22
  364. data/spec/controllers/realize_types_controller_spec.rb +2 -1
  365. data/spec/controllers/realizes_controller_spec.rb +23 -23
  366. data/spec/controllers/resource_export_files_controller_spec.rb +18 -18
  367. data/spec/controllers/resource_import_files_controller_spec.rb +18 -18
  368. data/spec/controllers/resource_import_results_controller_spec.rb +9 -9
  369. data/spec/dummy/app/models/user.rb +4 -79
  370. data/spec/dummy/config/environments/test.rb +3 -2
  371. data/spec/dummy/db/development.sqlite3 +0 -0
  372. data/spec/dummy/db/migrate/20111201155456_devise_create_users.rb +42 -0
  373. data/spec/dummy/db/migrate/20130221154434_add_additional_attributes_to_user.rb +26 -0
  374. data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +18 -0
  375. data/spec/dummy/db/migrate/20140110131010_create_user_import_results.rb +11 -0
  376. data/spec/dummy/db/migrate/20140122054321_create_profiles.rb +20 -0
  377. data/spec/dummy/db/migrate/20140518050147_create_reserve_transitions.rb +14 -0
  378. data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +14 -0
  379. data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +14 -0
  380. data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +14 -0
  381. data/spec/dummy/db/migrate/20140528045518_create_user_checkout_stat_transitions.rb +14 -0
  382. data/spec/dummy/db/migrate/20140528045539_create_user_reserve_stat_transitions.rb +14 -0
  383. data/spec/dummy/db/migrate/20140528045600_create_manifestation_checkout_stat_transitions.rb +14 -0
  384. data/spec/dummy/db/migrate/20140528045617_create_manifestation_reserve_stat_transitions.rb +14 -0
  385. data/spec/dummy/db/migrate/20140610123439_drop_email_unique_constraint_enju_leaf_rc10.rb +11 -0
  386. data/spec/dummy/db/migrate/20140628072217_add_user_encoding_to_user_import_file.rb +5 -0
  387. data/spec/dummy/db/migrate/20140709113413_create_user_export_files.rb +11 -0
  388. data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +14 -0
  389. data/spec/dummy/db/migrate/20140720170714_add_default_library_id_to_user_import_file.rb +5 -0
  390. data/spec/dummy/db/migrate/20140720170735_add_default_user_group_id_to_user_import_file.rb +5 -0
  391. data/spec/dummy/db/migrate/20140810061942_add_user_id_to_user_checkout_stat.rb +12 -0
  392. data/spec/dummy/db/migrate/20140810091231_add_checkout_icalendar_token_to_profile.rb +6 -0
  393. data/spec/dummy/db/migrate/20140810091417_add_save_checkout_history_to_profile.rb +5 -0
  394. data/spec/dummy/db/migrate/20140811031145_add_expired_at_to_profile.rb +5 -0
  395. data/spec/dummy/db/schema.rb +218 -24
  396. data/spec/dummy/db/test.sqlite3 +0 -0
  397. data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_import_file_sample1.tsv +5 -5
  398. data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_import_file_sample2.tsv +8 -8
  399. data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_import_file_sample3.tsv +5 -5
  400. data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/item_update_file.tsv +5 -4
  401. data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/resource_import_file_sample1.tsv +19 -19
  402. data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/resource_import_file_sample2.tsv +19 -19
  403. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140702-50651-14mi4s9.txt +147 -0
  404. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140702-50742-1fdbjo6.txt +147 -0
  405. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140704-12784-ozvvo.txt +147 -0
  406. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140705-18550-cc3qx2.txt +147 -0
  407. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140705-19313-rlc624.txt +147 -0
  408. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140705-20440-1o0htch.txt +147 -0
  409. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/{resource_export_file_20140705-26819-14hii8j.txt → resource_export_file_20140705-28145-o9qcd4.txt} +0 -0
  410. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/{resource_export_file_20140705-43608-i7uus1.txt → resource_export_file_20140722-98727-1jesse9.txt} +0 -0
  411. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140816-17115-1c1tv13.txt +147 -0
  412. data/spec/dummy/public/system/resource_export_files/resource_exports/000/000/004/original/resource_export_file_20140816-18348-14d01b3.txt +147 -0
  413. data/spec/dummy/solr/test/data/index/_20i.fdt +0 -0
  414. data/spec/dummy/solr/test/data/index/_20i.fdx +0 -0
  415. data/spec/dummy/solr/test/data/index/_20i.fnm +0 -0
  416. data/spec/dummy/solr/test/data/index/_20i.nvd +0 -0
  417. data/spec/dummy/solr/test/data/index/_20i.nvm +0 -0
  418. data/spec/dummy/solr/test/data/index/_20i.si +0 -0
  419. data/spec/dummy/solr/test/data/index/_20i_Lucene41_0.doc +0 -0
  420. data/spec/dummy/solr/test/data/index/_20i_Lucene41_0.pos +0 -0
  421. data/spec/dummy/solr/test/data/index/_20i_Lucene41_0.tim +0 -0
  422. data/spec/dummy/solr/test/data/index/_20i_Lucene41_0.tip +0 -0
  423. data/spec/dummy/solr/test/data/index/_20j.fdt +0 -0
  424. data/spec/dummy/solr/test/data/index/_20j.fdx +0 -0
  425. data/spec/dummy/solr/test/data/index/_20j.fnm +0 -0
  426. data/spec/dummy/solr/test/data/index/_20j.nvd +0 -0
  427. data/spec/dummy/solr/test/data/index/_20j.nvm +0 -0
  428. data/spec/dummy/solr/test/data/index/_20j.si +0 -0
  429. data/spec/dummy/solr/test/data/index/_20j_Lucene41_0.doc +0 -0
  430. data/spec/dummy/solr/test/data/index/_20j_Lucene41_0.pos +0 -0
  431. data/spec/dummy/solr/test/data/index/_20j_Lucene41_0.tim +0 -0
  432. data/spec/dummy/solr/test/data/index/_20j_Lucene41_0.tip +0 -0
  433. data/spec/dummy/solr/test/data/index/_20k.fdt +0 -0
  434. data/spec/dummy/solr/test/data/index/_20k.fdx +0 -0
  435. data/spec/dummy/solr/test/data/index/_20k.fnm +0 -0
  436. data/spec/dummy/solr/test/data/index/_20k.nvd +0 -0
  437. data/spec/dummy/solr/test/data/index/_20k.nvm +0 -0
  438. data/spec/dummy/solr/test/data/index/_20k.si +0 -0
  439. data/spec/dummy/solr/test/data/index/_20k_Lucene41_0.doc +0 -0
  440. data/spec/dummy/solr/test/data/index/_20k_Lucene41_0.pos +0 -0
  441. data/spec/dummy/solr/test/data/index/_20k_Lucene41_0.tim +0 -0
  442. data/spec/dummy/solr/test/data/index/_20k_Lucene41_0.tip +0 -0
  443. data/spec/dummy/solr/test/data/index/segments.gen +0 -0
  444. data/spec/dummy/solr/test/data/index/segments_2uc +0 -0
  445. data/spec/dummy/solr/test/data/tlog/{tlog.0000000000000000492 → tlog.0000000000000003680} +0 -0
  446. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000003681 +0 -0
  447. data/spec/dummy/solr/test/data/tlog/{tlog.0000000000000000494 → tlog.0000000000000003682} +0 -0
  448. data/spec/dummy/test/integration/resource_export_file_test.rb +7 -0
  449. data/spec/dummy/tmp/cache/4F7/F90/default_role +0 -0
  450. data/spec/dummy/tmp/cache/6E4/420/search_engine_all +0 -0
  451. data/spec/dummy/tmp/cache/assets/test/sprockets/01c388ec88c5fa6d00409d725549a506 +0 -0
  452. data/spec/dummy/tmp/cache/assets/test/sprockets/0440b81b0aae840cf287a686585a8cec +0 -0
  453. data/spec/dummy/tmp/cache/assets/test/sprockets/0483120d2ec851526d1beb322a87b34d +0 -0
  454. data/spec/dummy/tmp/cache/assets/test/sprockets/0c0062cfb97ef1437ab0020e724876c6 +0 -0
  455. data/spec/dummy/tmp/cache/assets/test/sprockets/0c8f59d97121b79a2e2a0d009d6da9c3 +0 -0
  456. data/spec/dummy/tmp/cache/assets/test/sprockets/0d8876cd5c35974067b09df39826ad64 +0 -0
  457. data/spec/dummy/tmp/cache/assets/test/sprockets/0dfa4223643dd4c4e2f977989012a78f +0 -0
  458. data/spec/dummy/tmp/cache/assets/test/sprockets/0e3e358e4fe4601ba5e435f6d0c86f12 +0 -0
  459. data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  460. data/spec/dummy/tmp/cache/assets/test/sprockets/1572dfd6f1e555f4be1aa60ddc3cb0c0 +0 -0
  461. data/spec/dummy/tmp/cache/assets/test/sprockets/15aaed1a5a5f4f98d5c8d19084d7980d +0 -0
  462. data/spec/dummy/tmp/cache/assets/test/sprockets/16262df7c7e382ef78b21f453750ea94 +0 -0
  463. data/spec/dummy/tmp/cache/assets/test/sprockets/173711a319dbf01f35a2ad8e1efe08b9 +0 -0
  464. data/spec/dummy/tmp/cache/assets/test/sprockets/19a44bc29c5173edea456f9416243854 +0 -0
  465. data/spec/dummy/tmp/cache/assets/test/sprockets/1c1fbab93e4552626da626e0dbe70c74 +0 -0
  466. data/spec/dummy/tmp/cache/assets/test/sprockets/1d0caee819e97b6e819aff48d160ba0e +0 -0
  467. data/spec/dummy/tmp/cache/assets/test/sprockets/1eeeee88b80ad204f61af2154ab097db +0 -0
  468. data/spec/dummy/tmp/cache/assets/test/sprockets/24051f5752691433a5a205b04a62fca1 +0 -0
  469. data/spec/dummy/tmp/cache/assets/test/sprockets/267e026cf7dcb8ed5ca66aa83dff1a87 +0 -0
  470. data/spec/dummy/tmp/cache/assets/test/sprockets/2b35ad8fee7e1228e205669278e2adda +0 -0
  471. data/spec/dummy/tmp/cache/assets/test/sprockets/2d65b40e585725207fd52ce4cf5134f4 +0 -0
  472. data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  473. data/spec/dummy/tmp/cache/assets/test/sprockets/305729f8ea45e96c3a7e75df920aa125 +0 -0
  474. data/spec/dummy/tmp/cache/assets/test/sprockets/3417713460df81bb2349531adec5f348 +0 -0
  475. data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  476. data/spec/dummy/tmp/cache/assets/test/sprockets/36fe3bdb5b7a6e84e23515bca1842154 +0 -0
  477. data/spec/dummy/tmp/cache/assets/test/sprockets/3ed0e4936463665c59155042a650dfa5 +0 -0
  478. data/spec/dummy/tmp/cache/assets/test/sprockets/3fc2b4de95dbb94dfe82ccfc97265cc4 +0 -0
  479. data/spec/dummy/tmp/cache/assets/test/sprockets/40e90f0c329b14292a9ff1a2fe907b39 +0 -0
  480. data/spec/dummy/tmp/cache/assets/test/sprockets/45adf514664dd4134fb290b1938c56d8 +0 -0
  481. data/spec/dummy/tmp/cache/assets/test/sprockets/45f3c74e1e31b58d9bda6908d5623290 +0 -0
  482. data/spec/dummy/tmp/cache/assets/test/sprockets/46ed442c54e0ad50ed9cbff91bca2c03 +0 -0
  483. data/spec/dummy/tmp/cache/assets/test/sprockets/479d8a0e6643a473b785734c1fb0655b +0 -0
  484. data/spec/dummy/tmp/cache/assets/test/sprockets/4aa18096a209e515f5f1df487622cdf4 +0 -0
  485. data/spec/dummy/tmp/cache/assets/test/sprockets/4db7c7b5ea13aacccd89ea32460e2de0 +0 -0
  486. data/spec/dummy/tmp/cache/assets/test/sprockets/4facb9d4adad5d1f55e19897f19ff502 +0 -0
  487. data/spec/dummy/tmp/cache/assets/test/sprockets/51df74c0fa7fbfa41670caa0f4268d54 +0 -0
  488. data/spec/dummy/tmp/cache/assets/test/sprockets/53ce49f7cb73ec18bfefea19be486fd5 +0 -0
  489. data/spec/dummy/tmp/cache/assets/test/sprockets/55de678ed3c84c51b3a4b4cf473da823 +0 -0
  490. data/spec/dummy/tmp/cache/assets/test/sprockets/5686725a34a5b152399098fe6811dfcc +0 -0
  491. data/spec/dummy/tmp/cache/assets/test/sprockets/5762cca052dd5d3eb8bb35e2ed9a59b8 +0 -0
  492. data/spec/dummy/tmp/cache/assets/test/sprockets/59d9f2ec47e055feaa8deb88dd230fd9 +0 -0
  493. data/spec/dummy/tmp/cache/assets/test/sprockets/5d30286c45c334a3e08806b2713ddbcd +0 -0
  494. data/spec/dummy/tmp/cache/assets/test/sprockets/5f084c5c398edfb6e223c67ec8fbf80d +0 -0
  495. data/spec/dummy/tmp/cache/assets/test/sprockets/60d030b3fef398bd6c75b5342c1e6951 +0 -0
  496. data/spec/dummy/tmp/cache/assets/test/sprockets/6273ac5ec2eeeb08808c520e45e7c353 +0 -0
  497. data/spec/dummy/tmp/cache/assets/test/sprockets/64513343a4d1500f6642a9797f2d6caf +0 -0
  498. data/spec/dummy/tmp/cache/assets/test/sprockets/64ee480e95febf6b404c1264755ea42e +0 -0
  499. data/spec/dummy/tmp/cache/assets/test/sprockets/6580b1bd3cb606ae0cc6a660e43ee91d +0 -0
  500. data/spec/dummy/tmp/cache/assets/test/sprockets/66e8ff0ee49363fdd0e1866807515228 +0 -0
  501. data/spec/dummy/tmp/cache/assets/test/sprockets/67ef1f14c3ad48997b6d2971949a9974 +0 -0
  502. data/spec/dummy/tmp/cache/assets/test/sprockets/6cf8b3b420dc28c045daec27150ade0a +0 -0
  503. data/spec/dummy/tmp/cache/assets/test/sprockets/7395823b7ae60934b3053f26fdb362d4 +0 -0
  504. data/spec/dummy/tmp/cache/assets/test/sprockets/74c056fa2e48770cba3499207a5027f5 +0 -0
  505. data/spec/dummy/tmp/cache/assets/test/sprockets/796cd029cd1ff06c3212795cdcc5a7c4 +0 -0
  506. data/spec/dummy/tmp/cache/assets/test/sprockets/7de140ed6f303b9d00d8d703cced3349 +0 -0
  507. data/spec/dummy/tmp/cache/assets/test/sprockets/7ef97a0c04f996570fa8d054e77614e4 +0 -0
  508. data/spec/dummy/tmp/cache/assets/test/sprockets/80348afae86df384b25e1e3bff21b13e +0 -0
  509. data/spec/dummy/tmp/cache/assets/test/sprockets/814bc1bed3effa0bb4588eb8b75ab92a +0 -0
  510. data/spec/dummy/tmp/cache/assets/test/sprockets/8488002e0e6035b7d00c3800c2c0e27e +0 -0
  511. data/spec/dummy/tmp/cache/assets/test/sprockets/84c8a64682205dba3f8edd60fc1ec8e5 +0 -0
  512. data/spec/dummy/tmp/cache/assets/test/sprockets/86dfe8a3e156aeb6ebcd456b2251fab7 +0 -0
  513. data/spec/dummy/tmp/cache/assets/test/sprockets/89c9228bae34e0ff18fd8fe7f6eb5847 +0 -0
  514. data/spec/dummy/tmp/cache/assets/test/sprockets/8e2bf5102d77a2cff3dda27a5617a79d +0 -0
  515. data/spec/dummy/tmp/cache/assets/test/sprockets/9411c91747cff7187d3b5eb3d5401758 +0 -0
  516. data/spec/dummy/tmp/cache/assets/test/sprockets/98d02556564ee10aef4c3397bb94d5b9 +0 -0
  517. data/spec/dummy/tmp/cache/assets/test/sprockets/994c519d4fdf48cadf8846c64a7c217d +0 -0
  518. data/spec/dummy/tmp/cache/assets/test/sprockets/9a11ac4cf3c8597981773b8ea1c36659 +0 -0
  519. data/spec/dummy/tmp/cache/assets/test/sprockets/a2474b74df12470fb37c668b85b562c6 +0 -0
  520. data/spec/dummy/tmp/cache/assets/test/sprockets/a2ee8688f63b884277632a234086f7df +0 -0
  521. data/spec/dummy/tmp/cache/assets/test/sprockets/a3cea75f1356ef55329e78f86b4c72b1 +0 -0
  522. data/spec/dummy/tmp/cache/assets/test/sprockets/a5ff35005a82346756c8a2d9b564aa8e +0 -0
  523. data/spec/dummy/tmp/cache/assets/test/sprockets/a72fe28675ab93fbb5f1fab49703e8b8 +0 -0
  524. data/spec/dummy/tmp/cache/assets/test/sprockets/aa2e1ada35daa496bb08e85fcb817536 +0 -0
  525. data/spec/dummy/tmp/cache/assets/test/sprockets/b0e11c6d89683eaa7256a44a164a2a12 +0 -0
  526. data/spec/dummy/tmp/cache/assets/test/sprockets/b530f21ccf5882027bf2aff5502dc79e +0 -0
  527. data/spec/dummy/tmp/cache/assets/test/sprockets/b62c2d32477b85c1a8e33a4b3ba86483 +0 -0
  528. data/spec/dummy/tmp/cache/assets/test/sprockets/b817a9a61cc21da35abec9d0dfb2a143 +0 -0
  529. data/spec/dummy/tmp/cache/assets/test/sprockets/b9ad765321d7527b38c851119d4d6f41 +0 -0
  530. data/spec/dummy/tmp/cache/assets/test/sprockets/bc086c9c936e5b91659a438d35126a90 +0 -0
  531. data/spec/dummy/tmp/cache/assets/test/sprockets/bf17ca8affe2a1febca7f2a4e37cd77b +0 -0
  532. data/spec/dummy/tmp/cache/assets/test/sprockets/c21a9a8a5166b51d4c2737ad4b99c16b +0 -0
  533. data/spec/dummy/tmp/cache/assets/test/sprockets/c36b7431da1ae91722b1c4091e4ba084 +0 -0
  534. data/spec/dummy/tmp/cache/assets/test/sprockets/c3e87e99d52cd8082c8548a7aa63b9da +0 -0
  535. data/spec/dummy/tmp/cache/assets/test/sprockets/c40786442706ae0cc6c793c6ee2500d3 +0 -0
  536. data/spec/dummy/tmp/cache/assets/test/sprockets/c42ec68313928d1544e733ae8383ef6d +0 -0
  537. data/spec/dummy/tmp/cache/assets/test/sprockets/c488c91e58a235d36a0ff8058e5a1004 +0 -0
  538. data/spec/dummy/tmp/cache/assets/test/sprockets/c4dbc19d89022a35885f5621f6b86eb3 +0 -0
  539. data/spec/dummy/tmp/cache/assets/test/sprockets/c6bbf5ca5c9b58807ba226fde0ccc60f +0 -0
  540. data/spec/dummy/tmp/cache/assets/test/sprockets/c7b0db461dfcfc1108bf9a6a87fb909d +0 -0
  541. data/spec/dummy/tmp/cache/assets/test/sprockets/c9d565eb8899b86408d9fd06fbf039be +0 -0
  542. data/spec/dummy/tmp/cache/assets/test/sprockets/cfeee09fa6b6ec2344a7b44bf0676028 +0 -0
  543. data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  544. data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  545. data/spec/dummy/tmp/cache/assets/test/sprockets/d8d8b7e606faf0fa1c22a6c2ebc2b58f +0 -0
  546. data/spec/dummy/tmp/cache/assets/test/sprockets/d8e283e15fd77782ae12f9b18e5be456 +0 -0
  547. data/spec/dummy/tmp/cache/assets/test/sprockets/d909adefad62117a3e85463b83954827 +0 -0
  548. data/spec/dummy/tmp/cache/assets/test/sprockets/e1fcfb0faa3c12467a1c35251e04c8b1 +0 -0
  549. data/spec/dummy/tmp/cache/assets/test/sprockets/e22f9546f5d75bd3549886e979dcb96e +0 -0
  550. data/spec/dummy/tmp/cache/assets/test/sprockets/e577e9ce00153ad2e59111f761d0fb15 +0 -0
  551. data/spec/dummy/tmp/cache/assets/test/sprockets/e58908ad0ccad6546faf9bcab669b0cd +0 -0
  552. data/spec/dummy/tmp/cache/assets/test/sprockets/e8f801eeda49cba4a03cfd9e2a4562ae +0 -0
  553. data/spec/dummy/tmp/cache/assets/test/sprockets/ea6fdf5f7aa83bf540d26f1ae12159a8 +0 -0
  554. data/spec/dummy/tmp/cache/assets/test/sprockets/eef93e7d091d8118419fb96adf80387b +0 -0
  555. data/spec/dummy/tmp/cache/assets/test/sprockets/efd104c04916854411c86a5440ba30e0 +0 -0
  556. data/spec/dummy/tmp/cache/assets/test/sprockets/f32a42f77e45018f7748de516be3c393 +0 -0
  557. data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  558. data/spec/dummy/tmp/cache/assets/test/sprockets/fb91323d4585f2e27d281cdb4193beb1 +0 -0
  559. data/spec/dummy/tmp/cache/assets/test/sprockets/fd080bad11122c7c3147a3fe1964c396 +0 -0
  560. data/spec/dummy/tmp/cache/assets/test/sprockets/fd88f9f1128cbff14dd2fa00800cfa10 +0 -0
  561. data/spec/dummy/tmp/cache/assets/test/sprockets/fe5bcfd29764185be3d476dee4108595 +0 -0
  562. data/spec/dummy/tmp/cache/assets/test/sprockets/ff64e9ded481959dfa8c78718e59e607 +0 -0
  563. data/spec/dummy/tmp/cache/stdout +3579 -87
  564. data/spec/dummy/tmp/pids/redis-test.pid +1 -1
  565. data/spec/factories/agent.rb +1 -1
  566. data/spec/factories/profile.rb +10 -0
  567. data/spec/factories/user.rb +21 -12
  568. data/spec/fixtures/agent_relationship_types.yml +3 -3
  569. data/spec/fixtures/agent_types.yml +3 -3
  570. data/spec/fixtures/agents.yml +0 -7
  571. data/spec/fixtures/carrier_types.yml +2 -2
  572. data/spec/fixtures/items.yml +46 -19
  573. data/spec/fixtures/manifestations.yml +1 -0
  574. data/spec/fixtures/message_requests.yml +3 -4
  575. data/spec/fixtures/message_templates.yml +51 -16
  576. data/spec/fixtures/profiles.yml +98 -0
  577. data/spec/fixtures/reserve_transitions.yml +88 -0
  578. data/spec/fixtures/resource_import_files.yml +1 -1
  579. data/spec/fixtures/user_groups.yml +3 -3
  580. data/spec/models/agent_import_file_spec.rb +0 -3
  581. data/spec/models/agent_spec.rb +0 -1
  582. data/spec/models/item_spec.rb +36 -26
  583. data/spec/models/manifestation_spec.rb +7 -0
  584. data/spec/models/resource_export_file_spec.rb +3 -0
  585. data/spec/models/resource_import_file_spec.rb +63 -34
  586. data/spec/spec_helper.rb +0 -1
  587. data/spec/support/resque.rb +3 -2
  588. data/spec/views/agent_types/index.html.erb_spec.rb +2 -2
  589. data/spec/views/create_types/index.html.erb_spec.rb +2 -2
  590. data/spec/views/produce_types/index.html.erb_spec.rb +2 -2
  591. data/spec/views/realize_types/index.html.erb_spec.rb +2 -2
  592. metadata +391 -67
  593. data/app/controllers/exemplifies_controller.rb +0 -103
  594. data/app/views/exemplifies/_form.html.erb +0 -27
  595. data/app/views/exemplifies/edit.html.erb +0 -13
  596. data/app/views/exemplifies/index.html.erb +0 -38
  597. data/app/views/exemplifies/new.html.erb +0 -12
  598. data/app/views/exemplifies/show.html.erb +0 -24
  599. data/app/views/items/index.csv.erb +0 -4
  600. data/app/views/manifestations/_question_list.html.erb +0 -13
  601. data/lib/generators/enju_biblio/setup/templates/db/fixtures/request_status_types.yml +0 -37
  602. data/lib/generators/enju_biblio/setup/templates/db/fixtures/request_types.yml +0 -29
  603. data/spec/controllers/exemplifies_controller_spec.rb +0 -446
  604. data/spec/dummy/db/migrate/20111201155456_create_users.rb +0 -16
  605. data/spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb +0 -44
  606. data/spec/dummy/solr/test/data/index/segments_dv +0 -0
  607. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000000493 +0 -0
  608. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000000495 +0 -0
  609. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000000496 +0 -0
  610. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000000497 +0 -0
  611. data/spec/views/exemplifies/edit.html.erb_spec.rb +0 -22
  612. data/spec/views/exemplifies/index.html.erb_spec.rb +0 -25
  613. data/spec/views/exemplifies/new.html.erb_spec.rb +0 -22
  614. data/spec/views/exemplifies/show.html.erb_spec.rb +0 -19
@@ -2,19 +2,20 @@
2
2
  class ResourceImportFile < ActiveRecord::Base
3
3
  include Statesman::Adapters::ActiveRecordModel
4
4
  include ImportFile
5
- attr_accessible :resource_import, :edit_mode, :user_encoding, :mode
5
+ attr_accessible :resource_import, :edit_mode, :user_encoding, :mode,
6
+ :default_shelf_id, :library_id
6
7
  default_scope {order('resource_import_files.id DESC')}
7
8
  scope :not_imported, -> {in_state(:pending)}
8
9
  scope :stucked, -> {in_state(:pending).where('created_at < ?', 1.hour.ago)}
9
10
 
10
11
  if Setting.uploaded_file.storage == :s3
11
- has_attached_file :resource_import, :storage => :s3, :s3_credentials => "#{Setting.amazon}",
12
+ has_attached_file :resource_import, storage: :s3, s3_credentials: "#{Setting.amazon}",
12
13
  :s3_permissions => :private
13
14
  else
14
15
  has_attached_file :resource_import,
15
- :path => ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
16
+ path: ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
16
17
  end
17
- validates_attachment_content_type :resource_import, :content_type => [
18
+ validates_attachment_content_type :resource_import, content_type: [
18
19
  'text/csv',
19
20
  'text/plain',
20
21
  'text/tab-separated-values',
@@ -22,12 +23,13 @@ class ResourceImportFile < ActiveRecord::Base
22
23
  'application/vnd.ms-excel'
23
24
  ]
24
25
  validates_attachment_presence :resource_import
25
- belongs_to :user, :validate => true
26
+ belongs_to :user, validate: true
27
+ belongs_to :default_shelf, class_name: 'Shelf'
26
28
  has_many :resource_import_results
27
29
  has_many :resource_import_file_transitions
28
30
 
29
31
  enju_import_file_model
30
- attr_accessor :mode
32
+ attr_accessor :mode, :library_id
31
33
 
32
34
  def state_machine
33
35
  ResourceImportFileStateMachine.new(self, transition_class: ResourceImportFileTransition)
@@ -54,7 +56,7 @@ class ResourceImportFile < ActiveRecord::Base
54
56
  def import
55
57
  transition_to!(:started)
56
58
  num = {:manifestation_imported => 0, :item_imported => 0, :manifestation_found => 0, :item_found => 0, :failed => 0}
57
- rows = open_import_file
59
+ rows = open_import_file(create_import_temp_file(resource_import))
58
60
  row_num = 1
59
61
 
60
62
  field = rows.first
@@ -65,10 +67,10 @@ class ResourceImportFile < ActiveRecord::Base
65
67
  rows.each do |row|
66
68
  row_num += 1
67
69
  next if row['dummy'].to_s.strip.present?
68
- import_result = ResourceImportResult.create!(:resource_import_file_id => self.id, :body => row.fields.join("\t"))
70
+ import_result = ResourceImportResult.create!(:resource_import_file_id => self.id, body: row.fields.join("\t"))
69
71
 
70
72
  item_identifier = row['item_identifier'].to_s.strip
71
- item = Item.where(:item_identifier => item_identifier).first
73
+ item = Item.where(item_identifier: item_identifier).first
72
74
  if item
73
75
  import_result.item = item
74
76
  import_result.manifestation = item.manifestation
@@ -84,21 +86,21 @@ class ResourceImportFile < ActiveRecord::Base
84
86
  unless manifestation
85
87
  if row['doi'].present?
86
88
  doi = URI.parse(row['doi']).path.gsub(/^\//, "")
87
- manifestation = Manifestation.where(:doi => doi).first
89
+ manifestation = Manifestation.where(doi: doi).first
88
90
  end
89
91
  end
90
92
 
91
93
  unless manifestation
92
94
  if row['jpno'].present?
93
95
  jpno = row['jpno'].to_s.strip
94
- manifestation = Identifier.where(:body => 'jpno', :identifier_type_id => IdentifierType.where(:name => 'jpno').first_or_create.id).first.try(:manifestation)
96
+ manifestation = Identifier.where(body: 'jpno', identifier_type_id: IdentifierType.where(name: 'jpno').first_or_create.id).first.try(:manifestation)
95
97
  end
96
98
  end
97
99
 
98
100
  unless manifestation
99
101
  if row['isbn'].present?
100
102
  isbn = StdNum::ISBN.normalize(row['isbn'])
101
- m = Identifier.where(:body => isbn, :identifier_type_id => IdentifierType.where(:name => 'isbn').first_or_create.id).first.try(:manifestation)
103
+ m = Identifier.where(body: isbn, identifier_type_id: IdentifierType.where(name: 'isbn').first_or_create.id).first.try(:manifestation)
102
104
  end
103
105
  if m
104
106
  if m.series_statements.exists?
@@ -135,7 +137,7 @@ class ResourceImportFile < ActiveRecord::Base
135
137
  else
136
138
  if manifestation.try(:fulltext_content?)
137
139
  item = Item.new
138
- item.circulation_status = CirculationStatus.where(:name => 'Available On Shelf').first
140
+ item.circulation_status = CirculationStatus.where(name: 'Available On Shelf').first
139
141
  item.shelf = Shelf.web
140
142
  begin
141
143
  item.acquired_at = Time.zone.parse(row['acquired_at'].to_s.strip)
@@ -148,7 +150,6 @@ class ResourceImportFile < ActiveRecord::Base
148
150
  num[:failed] += 1
149
151
  end
150
152
 
151
- ExpireFragmentCache.expire_fragment_cache(manifestation)
152
153
  import_result.save!
153
154
  num[:item_imported] +=1 if import_result.item
154
155
 
@@ -161,34 +162,36 @@ class ResourceImportFile < ActiveRecord::Base
161
162
  Sunspot.commit
162
163
  rows.close
163
164
  transition_to!(:completed)
165
+ send_message
164
166
  Rails.cache.write("manifestation_search_total", Manifestation.search.total)
165
- return num
167
+ num
166
168
  rescue => e
167
169
  self.error_message = "line #{row_num}: #{e.message}"
168
170
  transition_to!(:failed)
169
171
  raise e
170
172
  end
171
173
 
172
- def self.import_work(title, agents, options = {:edit_mode => 'create'})
174
+ def self.import_work(title, agents, options = {edit_mode: 'create'})
173
175
  work = Manifestation.new(title)
174
176
  work.save
175
177
  work.creators = agents.uniq unless agents.empty?
176
178
  work
177
179
  end
178
180
 
179
- def self.import_expression(work, agents, options = {:edit_mode => 'create'})
181
+ def self.import_expression(work, agents, options = {edit_mode: 'create'})
180
182
  expression = work
181
183
  expression.save
182
184
  expression.contributors = agents.uniq unless agents.empty?
183
185
  expression
184
186
  end
185
187
 
186
- def self.import_manifestation(expression, agents, options = {}, edit_options = {:edit_mode => 'create'})
188
+ def self.import_manifestation(expression, agents, options = {}, edit_options = {edit_mode: 'create'})
187
189
  manifestation = expression
188
190
  manifestation.during_import = true
189
191
  manifestation.reload
190
192
  manifestation.update_attributes!(options)
191
193
  manifestation.publishers = agents.uniq unless agents.empty?
194
+ manifestation.reload
192
195
  manifestation
193
196
  end
194
197
 
@@ -249,23 +252,23 @@ class ResourceImportFile < ActiveRecord::Base
249
252
 
250
253
  def modify
251
254
  transition_to!(:started)
252
- rows = open_import_file
255
+ rows = open_import_file(create_import_temp_file(resource_import))
253
256
  row_num = 1
254
257
 
255
258
  rows.each do |row|
256
259
  row_num += 1
257
260
  item_identifier = row['item_identifier'].to_s.strip
258
- item = Item.where(:item_identifier => item_identifier).first if item_identifier.present?
261
+ item = Item.where(item_identifier: item_identifier).first if item_identifier.present?
259
262
  if item
260
263
  if item.manifestation
261
- fetch(row, :edit_mode => 'update')
264
+ fetch(row, edit_mode: 'update')
262
265
  end
263
- shelf = Shelf.where(:name => row['shelf']).first
264
- circulation_status = CirculationStatus.where(:name => row['circulation_status']).first
265
- checkout_type = CheckoutType.where(:name => row['checkout_type']).first
266
- bookstore = Bookstore.where(:name => row['bookstore']).first
267
- required_role = Role.where(:name => row['required_role']).first
268
- use_restriction = UseRestriction.where(:name => row['use_restriction'].to_s.strip).first
266
+ shelf = Shelf.where(name: row['shelf'].to_s.strip).first
267
+ circulation_status = CirculationStatus.where(name: row['circulation_status']).first
268
+ checkout_type = CheckoutType.where(name: row['checkout_type']).first
269
+ bookstore = Bookstore.where(name: row['bookstore']).first
270
+ required_role = Role.where(name: row['required_role']).first
271
+ use_restriction = UseRestriction.where(name: row['use_restriction'].to_s.strip).first
269
272
 
270
273
  item.shelf = shelf if shelf
271
274
  item.circulation_status = circulation_status if circulation_status
@@ -273,21 +276,36 @@ class ResourceImportFile < ActiveRecord::Base
273
276
  item.bookstore = bookstore if bookstore
274
277
  item.required_role = required_role if required_role
275
278
  item.use_restriction = use_restriction if use_restriction
276
- item.include_supplements = row['include_supplements'] if row['include_supplements']
277
- item.call_number = row['call_number'] if row['call_number']
278
- item.item_price = row['item_price'] if row['item_price']
279
- item.acquired_at = row['acquired_at'] if row['acquired_at']
280
- item.note = row['note'] if row['note']
279
+
280
+ acquired_at = Time.zone.parse(row['acquired_at']) rescue nil
281
+ binded_at = Time.zone.parse(row['binded_at']) rescue nil
282
+ item.acquired_at = acquired_at if acquired_at
283
+ item.binded_at = binded_at if binded_at
284
+
285
+ item_columns = %w(
286
+ call_number item_price note
287
+ binding_item_identifier binding_call_number binded_at
288
+ )
289
+ item_columns.each do |column|
290
+ item.assign_attributes(:"#{column}" => row[column], as: :admin)
291
+ end
292
+
293
+ if row['include_supplements']
294
+ if %w(t true).include?(row['include_supplements'].downcase.strip)
295
+ item.include_supplements = true
296
+ else
297
+ item.include_supplements = false if item.include_supplements
298
+ end
299
+ end
281
300
  item.save!
282
- ExpireFragmentCache.expire_fragment_cache(item.manifestation)
283
301
  else
284
302
  manifestation_identifier = row['manifestation_identifier'].to_s.strip
285
303
  manifestation = Manifestation.where(:manifestation_identifier => manifestation_identifier).first if manifestation_identifier.present?
286
304
  unless manifestation
287
- manifestation = Manifestation.where(:id => row['manifestation_id']).first
305
+ manifestation = Manifestation.where(id: row['manifestation_id']).first
288
306
  end
289
307
  if manifestation
290
- fetch(row, :edit_mode => 'update')
308
+ fetch(row, edit_mode: 'update')
291
309
  end
292
310
  end
293
311
  end
@@ -300,13 +318,13 @@ class ResourceImportFile < ActiveRecord::Base
300
318
 
301
319
  def remove
302
320
  transition_to!(:started)
303
- rows = open_import_file
321
+ rows = open_import_file(create_import_temp_file(resource_import))
304
322
  row_num = 1
305
323
 
306
324
  rows.each do |row|
307
325
  row_num += 1
308
326
  item_identifier = row['item_identifier'].to_s.strip
309
- item = Item.where(:item_identifier => item_identifier).first
327
+ item = Item.where(item_identifier: item_identifier).first
310
328
  if item
311
329
  item.destroy if item.removable?
312
330
  end
@@ -320,20 +338,20 @@ class ResourceImportFile < ActiveRecord::Base
320
338
 
321
339
  def update_relationship
322
340
  transition_to!(:started)
323
- rows = open_import_file
341
+ rows = open_import_file(create_import_temp_file(resource_import))
324
342
  row_num = 2
325
343
 
326
344
  rows.each do |row|
327
345
  item_identifier = row['item_identifier'].to_s.strip
328
- item = Item.where(:item_identifier => item_identifier).first
346
+ item = Item.where(item_identifier: item_identifier).first
329
347
  unless item
330
- item = Item.where(:id => row['item_id'].to_s.strip).first
348
+ item = Item.where(id: row['item_id'].to_s.strip).first
331
349
  end
332
350
 
333
351
  manifestation_identifier = row['manifestation_identifier'].to_s.strip
334
352
  manifestation = Manifestation.where(:manifestation_identifier => manifestation_identifier).first
335
353
  unless manifestation
336
- manifestation = Manifestation.where(:id => row['manifestation_id'].to_s.strip).first
354
+ manifestation = Manifestation.where(id: row['manifestation_id'].to_s.strip).first
337
355
  end
338
356
 
339
357
  if item and manifestation
@@ -341,7 +359,7 @@ class ResourceImportFile < ActiveRecord::Base
341
359
  item.save!
342
360
  end
343
361
 
344
- import_result = ResourceImportResult.create!(:resource_import_file_id => self.id, :body => row.fields.join("\t"))
362
+ import_result = ResourceImportResult.create!(:resource_import_file_id => self.id, body: row.fields.join("\t"))
345
363
  import_result.item = item
346
364
  import_result.manifestation = manifestation
347
365
  import_result.save!
@@ -351,24 +369,36 @@ class ResourceImportFile < ActiveRecord::Base
351
369
  end
352
370
 
353
371
  private
354
- def open_import_file
355
- tempfile = Tempfile.new(self.class.name.underscore)
356
- if Setting.uploaded_file.storage == :s3
357
- uploaded_file_path = resource_import.expiring_url(10)
358
- else
359
- uploaded_file_path = resource_import.path
372
+ def open_import_file(tempfile)
373
+ file = CSV.open(tempfile, col_sep: "\t")
374
+ header_columns = %w(
375
+ original_title manifestation_identifier item_identifier shelf note
376
+ title_transcription title_alternative title_alternative_transcription
377
+ periodical manifestation_id publication_place
378
+ series_statement_identifier series_original_title series_creator_string
379
+ series_title_transcription creator creator_transcription publisher
380
+ publisher_transcription pub_date creator creator_transcription
381
+ contributor contributor_transcription description access_address
382
+ volume_number_string edition_string issue_number_string
383
+ edition serial_number isbn issn manifestation_price item_price
384
+ width height depth number_of_pages jpno lccn budget_type bookstore
385
+ language fulltext_content required_role doi
386
+ statement_of_responsibility acquired_at call_number circulation_status
387
+ binding_item_identifier binding_call_number binded_at
388
+ use_restriction include_supplements
389
+ dummy
390
+ )
391
+ if defined?(EnjuSubject)
392
+ header_columns += %w(subject classification)
360
393
  end
361
- open(uploaded_file_path){|f|
362
- f.each{|line|
363
- tempfile.puts(convert_encoding(line))
364
- }
365
- }
366
- tempfile.close
367
-
368
- file = CSV.open(tempfile.path, 'r:utf-8', :col_sep => "\t")
369
394
  header = file.first
370
- rows = CSV.open(tempfile.path, 'r:utf-8', :headers => header, :col_sep => "\t")
371
- ResourceImportResult.create!(:resource_import_file_id => self.id, :body => header.join("\t"))
395
+ ignored_columns = header - header_columns
396
+ unless ignored_columns.empty?
397
+ self.error_message = I18n.t('import.following_column_were_ignored', column: ignored_columns.join(', '))
398
+ save!
399
+ end
400
+ rows = CSV.open(tempfile, headers: header, col_sep: "\t")
401
+ ResourceImportResult.create!(:resource_import_file_id => self.id, body: header.join("\t"))
372
402
  tempfile.close(true)
373
403
  file.close
374
404
  rows
@@ -379,8 +409,8 @@ class ResourceImportFile < ActiveRecord::Base
379
409
  row['subject'].to_s.split('//').each do |s|
380
410
  # TODO: Subject typeの設定
381
411
  subject = Subject.new(:term => s.to_s.strip)
382
- subject.subject_type = SubjectType.where(:name => 'concept').first
383
- subject.subject_heading_type = SubjectHeadingType.where(:name => 'unknown').first
412
+ subject.subject_type = SubjectType.where(name: 'concept').first
413
+ subject.subject_heading_type = SubjectHeadingType.where(name: 'unknown').first
384
414
  subjects << subject
385
415
  end
386
416
  subjects
@@ -391,7 +421,7 @@ class ResourceImportFile < ActiveRecord::Base
391
421
  classification_number = YAML.load(row['classification'].to_s)
392
422
  return nil unless classification_number
393
423
  classification_number.map{|k, v|
394
- classification_type = ClassificationType.where(:name => k.downcase).first
424
+ classification_type = ClassificationType.where(name: k.downcase).first
395
425
  classification = Classification.new(:category => v.to_s)
396
426
  classification.classification_type = classification_type
397
427
  classification.save!
@@ -401,43 +431,54 @@ class ResourceImportFile < ActiveRecord::Base
401
431
  end
402
432
 
403
433
  def create_item(row, manifestation)
404
- shelf = Shelf.where(:name => row['shelf'].to_s.strip).first || Shelf.web
405
- bookstore = Bookstore.where(:name => row['bookstore'].to_s.strip).first
406
- budget_type = BudgetType.where(:name => row['budget_type'].to_s.strip).first
434
+ shelf = Shelf.where(name: row['shelf'].to_s.strip).first
435
+ unless shelf
436
+ shelf = default_shelf || Shelf.web
437
+ end
438
+ bookstore = Bookstore.where(name: row['bookstore'].to_s.strip).first
439
+ budget_type = BudgetType.where(name: row['budget_type'].to_s.strip).first
407
440
  acquired_at = Time.zone.parse(row['acquired_at']) rescue nil
441
+ binded_at = Time.zone.parse(row['binded_at']) rescue nil
408
442
  item = self.class.import_item(manifestation, {
409
- :manifestation_id => manifestation.id,
410
- :item_identifier => row['item_identifier'],
411
- :price => row['item_price'],
412
- :call_number => row['call_number'].to_s.strip,
413
- :acquired_at => acquired_at,
443
+ manifestation_id: manifestation.id,
444
+ item_identifier: row['item_identifier'],
445
+ price: row['item_price'],
446
+ call_number: row['call_number'].to_s.strip,
447
+ acquired_at: acquired_at,
448
+ binding_item_identifier: row['binding_item_identifier'],
449
+ binding_call_number: row['binding_call_number'],
450
+ binded_at: binded_at
414
451
  })
415
452
  if defined?(EnjuCirculation)
416
- circulation_status = CirculationStatus.where(:name => row['circulation_status'].to_s.strip).first || CirculationStatus.where(:name => 'In Process').first
453
+ circulation_status = CirculationStatus.where(name: row['circulation_status'].to_s.strip).first || CirculationStatus.where(name: 'In Process').first
417
454
  item.circulation_status = circulation_status
418
- use_restriction = UseRestriction.where(:name => row['use_restriction'].to_s.strip).first
455
+ use_restriction = UseRestriction.where(name: row['use_restriction'].to_s.strip).first
419
456
  unless use_restriction
420
- use_restriction = UseRestriction.where(:name => 'Not For Loan').first
457
+ use_restriction = UseRestriction.where(name: 'Not For Loan').first
421
458
  end
422
459
  item.use_restriction = use_restriction
423
460
  end
424
461
  item.bookstore = bookstore
425
462
  item.budget_type = budget_type
426
463
  item.shelf = shelf
464
+
465
+ if %w(t true).include?(row['include_supplements'].to_s.downcase.strip)
466
+ item.include_supplements = true
467
+ end
427
468
  item
428
469
  end
429
470
 
430
- def fetch(row, options = {:edit_mode => 'create'})
431
- shelf = Shelf.where(:name => row['shelf'].to_s.strip).first || Shelf.web
471
+ def fetch(row, options = {edit_mode: 'create'})
472
+ shelf = Shelf.where(name: row['shelf'].to_s.strip).first || Shelf.web
432
473
  case options[:edit_mode]
433
474
  when 'create'
434
475
  manifestation = nil
435
476
  when 'update'
436
- manifestation = Item.where(:item_identifier => row['item_identifier'].to_s.strip).first.try(:manifestation)
477
+ manifestation = Item.where(item_identifier: row['item_identifier'].to_s.strip).first.try(:manifestation)
437
478
  unless manifestation
438
479
  manifestation_identifier = row['manifestation_identifier'].to_s.strip
439
480
  manifestation = Manifestation.where(:manifestation_identifier => manifestation_identifier).first if manifestation_identifier
440
- manifestation = Manifestation.where(:id => row['manifestation_id']).first unless manifestation
481
+ manifestation = Manifestation.where(id: row['manifestation_id']).first unless manifestation
441
482
  end
442
483
  end
443
484
 
@@ -467,25 +508,13 @@ class ResourceImportFile < ActiveRecord::Base
467
508
  height = NKF.nkf('-eZ1', row['height'].to_s).gsub(/\D/, '').to_i
468
509
  depth = NKF.nkf('-eZ1', row['depth'].to_s).gsub(/\D/, '').to_i
469
510
  end_page = NKF.nkf('-eZ1', row['number_of_pages'].to_s).gsub(/\D/, '').to_i
470
- language = Language.where(:name => row['language'].to_s.strip.camelize).first
511
+ language = Language.where(name: row['language'].to_s.strip.camelize).first
471
512
  language = Language.where(:iso_639_2 => row['language'].to_s.strip.downcase).first unless language
472
513
  language = Language.where(:iso_639_1 => row['language'].to_s.strip.downcase).first unless language
473
514
 
474
- carrier_type = CarrierType.where(:name => row['carrier_type'].to_s.strip).first
515
+ carrier_type = CarrierType.where(name: row['carrier_type'].to_s.strip).first
475
516
 
476
- identifier = {}
477
- if row['isbn']
478
- identifier[:isbn] = Identifier.new(:body => row['isbn'])
479
- identifier[:isbn].identifier_type = IdentifierType.where(:name => 'isbn').first_or_create
480
- end
481
- if row['jpno']
482
- identifier[:jpno] = Identifier.new(:body => row['jpno'])
483
- identifier[:jpno].identifier_type = IdentifierType.where(:name => 'jpno').first_or_create
484
- end
485
- if row['issn']
486
- identifier[:issn] = Identifier.new(:body => row['issn'])
487
- identifier[:issn].identifier_type = IdentifierType.where(:name => 'issn').first_or_create
488
- end
517
+ identifier = set_identifier(row)
489
518
 
490
519
  if end_page >= 1
491
520
  start_page = 1
@@ -494,11 +523,11 @@ class ResourceImportFile < ActiveRecord::Base
494
523
  end_page = nil
495
524
  end
496
525
 
497
- if row['fulltext_content'].to_s.downcase.strip == "t"
526
+ if %w(t true).include?(row['fulltext_content'].to_s.downcase.strip)
498
527
  fulltext_content = true
499
528
  end
500
529
 
501
- if row['periodical'].to_s.downcase.strip == "t"
530
+ if %w(t true).include?(row['periodical'].to_s.downcase.strip)
502
531
  periodical = true
503
532
  end
504
533
 
@@ -559,25 +588,26 @@ class ResourceImportFile < ActiveRecord::Base
559
588
  :end_page => end_page,
560
589
  :access_address => row['access_address'],
561
590
  :manifestation_identifier => row['manifestation_identifier'],
562
- :fulltext_content => fulltext_content
591
+ :fulltext_content => fulltext_content,
592
+ :publication_place => row['publication_place']
563
593
  }.delete_if{|key, value| value.nil?}
564
594
  manifestation = self.class.import_manifestation(expression, publisher_agents, attributes,
565
595
  {
566
- :edit_mode => options[:edit_mode]
596
+ edit_mode: options[:edit_mode]
567
597
  })
568
598
  manifestation.volume_number = volume_number if volume_number
569
599
 
570
- required_role = Role.where(:name => row['required_role_name'].to_s.strip.camelize).first
600
+ required_role = Role.where(name: row['required_role_name'].to_s.strip.camelize).first
571
601
  if required_role and row['required_role_name'].present?
572
602
  manifestation.required_role = required_role
573
603
  else
574
- manifestation.required_role = Role.where(:name => 'Guest').first unless manifestation.required_role
604
+ manifestation.required_role = Role.where(name: 'Guest').first unless manifestation.required_role
575
605
  end
576
606
 
577
607
  if language and row['language'].present?
578
608
  manifestation.language = language
579
609
  else
580
- manifestation.language = Language.where(:name => 'unknown').first unless manifestation.language
610
+ manifestation.language = Language.where(name: 'unknown').first unless manifestation.language
581
611
  end
582
612
 
583
613
  manifestation.carrier_type = carrier_type if carrier_type
@@ -620,8 +650,8 @@ class ResourceImportFile < ActiveRecord::Base
620
650
 
621
651
  if options[:edit_mode] == 'create'
622
652
  manifestation.set_agent_role_type(creators_list)
623
- manifestation.set_agent_role_type(contributors_list, :scope => :contributor)
624
- manifestation.set_agent_role_type(publishers_list, :scope => :publisher)
653
+ manifestation.set_agent_role_type(contributors_list, scope: :contributor)
654
+ manifestation.set_agent_role_type(publishers_list, scope: :publisher)
625
655
  end
626
656
  end
627
657
  manifestation
@@ -630,6 +660,23 @@ class ResourceImportFile < ActiveRecord::Base
630
660
  def self.transition_class
631
661
  ResourceImportFileTransition
632
662
  end
663
+
664
+ def set_identifier(row)
665
+ identifier = {}
666
+ if row['isbn']
667
+ identifier[:isbn] = Identifier.new(body: row['isbn'])
668
+ identifier[:isbn].identifier_type = IdentifierType.where(name: 'isbn').first_or_create
669
+ end
670
+ if row['jpno']
671
+ identifier[:jpno] = Identifier.new(body: row['jpno'])
672
+ identifier[:jpno].identifier_type = IdentifierType.where(name: 'jpno').first_or_create
673
+ end
674
+ if row['issn']
675
+ identifier[:issn] = Identifier.new(body: row['issn'])
676
+ identifier[:issn].identifier_type = IdentifierType.where(name: 'issn').first_or_create
677
+ end
678
+ identifier
679
+ end
633
680
  end
634
681
 
635
682
  # == Schema Information
@@ -653,4 +700,5 @@ end
653
700
  # resource_import_fingerprint :string(255)
654
701
  # error_message :text
655
702
  # user_encoding :string(255)
703
+ # default_shelf_id :integer
656
704
  #
@@ -1,6 +1,6 @@
1
1
  class ResourceImportResult < ActiveRecord::Base
2
2
  attr_accessible :resource_import_file_id, :manifestation_id, :item_id, :body
3
- default_scope :order => 'resource_import_results.id'
3
+ default_scope order: 'resource_import_results.id'
4
4
  scope :file_id, proc{|file_id| where(:resource_import_file_id => file_id)}
5
5
  scope :failed, where(:manifestation_id => nil)
6
6
 
@@ -6,8 +6,8 @@ class SeriesStatement < ActiveRecord::Base
6
6
  :title_subseries_transcription, :creator_string, :volume_number_string
7
7
  attr_accessible :series_master
8
8
 
9
- belongs_to :manifestation
10
- belongs_to :root_manifestation, :foreign_key => :root_manifestation_id, :class_name => 'Manifestation'
9
+ belongs_to :manifestation, touch: true
10
+ belongs_to :root_manifestation, foreign_key: :root_manifestation_id, class_name: 'Manifestation', touch: true
11
11
  validates_presence_of :original_title
12
12
  before_save :create_root_series_statement
13
13
 
@@ -19,7 +19,7 @@ class SeriesStatement < ActiveRecord::Base
19
19
  text :numbering, :title_subseries, :numbering_subseries
20
20
  integer :manifestation_id
21
21
  integer :position
22
- integer :series_statement_merge_list_ids, :multiple => true if defined?(EnjuResourceMerge)
22
+ integer :series_statement_merge_list_ids, multiple: true if defined?(EnjuResourceMerge)
23
23
  end
24
24
 
25
25
  attr_accessor :selected
@@ -37,12 +37,14 @@ class SeriesStatement < ActiveRecord::Base
37
37
  def create_root_series_statement
38
38
  if series_master? and root_manifestation.nil?
39
39
  self.root_manifestation = manifestation
40
+ else
41
+ self.root_manifestation = nil
40
42
  end
41
43
  end
42
44
 
43
45
  if defined?(EnjuResourceMerge)
44
- has_many :series_statement_merges, :dependent => :destroy
45
- has_many :series_statement_merge_lists, :through => :series_statement_merges
46
+ has_many :series_statement_merges, dependent: :destroy
47
+ has_many :series_statement_merge_lists, through: :series_statement_merges
46
48
  end
47
49
  end
48
50
 
@@ -1,5 +1,5 @@
1
1
  <div id="content_detail" class="ui-corner-all ui-widget-content">
2
- <h1 class="title"><%= t('page.editing', :model => t('activerecord.models.agent_import_file')) -%></h1>
2
+ <h1 class="title"><%= t('page.editing', model: t('activerecord.models.agent_import_file')) -%></h1>
3
3
  <div id="content_list">
4
4
 
5
5
  <%= form_for(@agent_import_file) do |f| -%>
@@ -1,5 +1,5 @@
1
1
  <div id="content_detail" class="ui-corner-all ui-widget-content">
2
- <h1 class="title"><%= t('page.listing', :model => t('activerecord.models.agent_import_file')) -%></h1>
2
+ <h1 class="title"><%= t('page.listing', model: t('activerecord.models.agent_import_file')) -%></h1>
3
3
  <div id="content_list">
4
4
 
5
5
  <table class="table table-striped index">
@@ -18,12 +18,12 @@
18
18
  <td><%= link_to agent_import_file.id, agent_import_file -%></td>
19
19
  <td><%= link_to agent_import_file.agent_import_file_name, agent_import_file -%></td>
20
20
  <td><%= l(agent_import_file.executed_at) if agent_import_file.executed_at -%></td>
21
- <td><%= link_to agent_import_file.user.username, agent_import_file.user -%></td>
21
+ <td><%= link_to agent_import_file.user.username, agent_import_file.user.profile if agent_import_file.user.try(:profile) -%></td>
22
22
  <td><%= agent_import_file.edit_mode -%></td>
23
23
  <td><%= localized_state(agent_import_file.current_state) -%></td>
24
24
  <td>
25
25
  <%= link_to t('page.show'), agent_import_file -%>
26
- <%= link_to t('page.destroy'), agent_import_file, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%>
26
+ <%= link_to t('page.destroy'), agent_import_file, data: {confirm: t('page.are_you_sure')}, method: :delete -%>
27
27
  </td>
28
28
  </tr>
29
29
  <%- end -%>
@@ -35,6 +35,6 @@
35
35
 
36
36
  <div id="submenu" class="ui-corner-all ui-widget-content">
37
37
  <ul>
38
- <li><%= link_to t('page.new', :model => t('activerecord.models.agent_import_file')), new_agent_import_file_path -%></li>
38
+ <li><%= link_to t('page.new', model: t('activerecord.models.agent_import_file')), new_agent_import_file_path -%></li>
39
39
  </ul>
40
40
  </div>
@@ -1,8 +1,8 @@
1
1
  <div id="content_detail" class="ui-corner-all ui-widget-content">
2
- <h1 class="title"><%= t('page.new', :model => t('activerecord.models.agent_import_file')) -%></h1>
2
+ <h1 class="title"><%= t('page.new', model: t('activerecord.models.agent_import_file')) -%></h1>
3
3
  <div id="content_list">
4
4
 
5
- <%= form_for(@agent_import_file, :html => { :multipart => true }) do |f| -%>
5
+ <%= form_for(@agent_import_file, html: { multipart: true }) do |f| -%>
6
6
  <%= f.error_messages -%>
7
7
 
8
8
  <div class="field">
@@ -12,24 +12,24 @@
12
12
 
13
13
  <div class="field">
14
14
  <%= f.label :edit_mode -%><br />
15
- <%= f.radio_button :edit_mode, 'create', :checked => 'checked' %>
16
- <%= f.label :edit_mode, t('page.create'), :value => 'create' %>
15
+ <%= f.radio_button :edit_mode, 'create', checked: 'checked' %>
16
+ <%= f.label :edit_mode, t('page.create'), value: 'create' %>
17
17
  <%= f.radio_button :edit_mode, 'update' %>
18
- <%= f.label :edit_mode, t('page.update'), :value => 'update' %>
18
+ <%= f.label :edit_mode, t('page.update'), value: 'update' %>
19
19
  <%= f.radio_button :edit_mode, 'destroy' %>
20
- <%= f.label :edit_mode, t('page.destroy'), :value => 'destroy' %>
20
+ <%= f.label :edit_mode, t('page.destroy'), value: 'destroy' %>
21
21
  </div>
22
22
 
23
23
  <div class="field">
24
24
  <%= f.label :user_encoding -%><br />
25
- <%= f.radio_button :user_encoding, 'auto_detect', :checked => 'checked' %>
26
- <%= f.label :user_encoding, t('import.auto_detect'), :value => 'auto_detect' %>
25
+ <%= f.radio_button :user_encoding, 'auto_detect', checked: 'checked' %>
26
+ <%= f.label :user_encoding, t('import.auto_detect'), value: 'auto_detect' %>
27
27
  <%= f.radio_button :user_encoding, 'utf-8' %>
28
- <%= f.label :user_encoding, 'UTF-8', :value => 'utf-8' %>
28
+ <%= f.label :user_encoding, 'UTF-8', value: 'utf-8' %>
29
29
  <%= f.radio_button :user_encoding, 'shift_jis' %>
30
- <%= f.label :user_encoding, 'Shift_JIS', :value => 'shift_jis' %>
31
- <%= f.radio_button :user_encoding, 'euc-ho' %>
32
- <%= f.label :user_encoding, 'EUC-JP', :value => 'euc-jp' %>
30
+ <%= f.label :user_encoding, 'Shift_JIS', value: 'shift_jis' %>
31
+ <%= f.radio_button :user_encoding, 'euc-jp' %>
32
+ <%= f.label :user_encoding, 'EUC-JP', value: 'euc-jp' %>
33
33
  </div>
34
34
 
35
35
  <div class="actions">