enju_biblio 0.1.0.pre42 → 0.1.0.pre43

Sign up to get free protection for your applications and to get access to all the features.
Files changed (319) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/creates_controller.rb +11 -11
  3. data/app/controllers/items_controller.rb +3 -3
  4. data/app/controllers/manifestations_controller.rb +14 -14
  5. data/app/controllers/owns_controller.rb +10 -10
  6. data/app/controllers/patron_import_files_controller.rb +34 -34
  7. data/app/controllers/patron_import_results_controller.rb +5 -5
  8. data/app/controllers/patron_relationship_types_controller.rb +3 -3
  9. data/app/controllers/patron_relationships_controller.rb +7 -7
  10. data/app/controllers/patron_types_controller.rb +3 -3
  11. data/app/controllers/patrons_controller.rb +61 -61
  12. data/app/controllers/picture_files_controller.rb +4 -4
  13. data/app/controllers/produces_controller.rb +11 -11
  14. data/app/controllers/realizes_controller.rb +11 -11
  15. data/app/helpers/{patrons_helper.rb → agents_helper.rb} +5 -5
  16. data/app/models/{patron.rb → agent.rb} +36 -36
  17. data/app/models/{patron_import_file.rb → agent_import_file.rb} +77 -77
  18. data/app/models/agent_import_result.rb +26 -0
  19. data/app/models/{patron_relationship.rb → agent_relationship.rb} +7 -7
  20. data/app/models/{patron_relationship_type.rb → agent_relationship_type.rb} +4 -4
  21. data/app/models/{patron_sweeper.rb → agent_sweeper.rb} +6 -6
  22. data/app/models/{patron_type.rb → agent_type.rb} +4 -4
  23. data/app/models/country.rb +1 -1
  24. data/app/models/create.rb +7 -7
  25. data/app/models/donate.rb +5 -5
  26. data/app/models/enju_biblio/ability.rb +24 -24
  27. data/app/models/item.rb +5 -5
  28. data/app/models/item_sweeper.rb +2 -2
  29. data/app/models/manifestation.rb +24 -20
  30. data/app/models/own.rb +7 -7
  31. data/app/models/page_sweeper.rb +4 -4
  32. data/app/models/picture_file.rb +1 -1
  33. data/app/models/produce.rb +7 -7
  34. data/app/models/realize.rb +7 -7
  35. data/app/models/resource_import_file.rb +19 -19
  36. data/app/views/{patron_import_files → agent_import_files}/edit.html.erb +6 -6
  37. data/app/views/agent_import_files/index.html.erb +40 -0
  38. data/app/views/{patron_import_files → agent_import_files}/new.html.erb +3 -3
  39. data/app/views/agent_import_files/show.html.erb +69 -0
  40. data/app/views/agent_import_results/index.csv.erb +3 -0
  41. data/app/views/agent_import_results/index.html.erb +52 -0
  42. data/app/views/agent_import_results/show.html.erb +38 -0
  43. data/app/views/{patron_relationship_types → agent_relationship_types}/_form.html.erb +1 -1
  44. data/app/views/{patron_relationship_types → agent_relationship_types}/edit.html.erb +3 -3
  45. data/app/views/agent_relationship_types/index.html.erb +43 -0
  46. data/app/views/{patron_relationship_types → agent_relationship_types}/new.html.erb +2 -2
  47. data/app/views/agent_relationship_types/show.html.erb +29 -0
  48. data/app/views/{patron_relationships → agent_relationships}/_form.html.erb +7 -7
  49. data/app/views/{patron_relationships → agent_relationships}/edit.html.erb +3 -3
  50. data/app/views/agent_relationships/index.html.erb +34 -0
  51. data/app/views/{patron_relationships → agent_relationships}/new.html.erb +2 -2
  52. data/app/views/agent_relationships/show.html.erb +24 -0
  53. data/app/views/{patron_types → agent_types}/_form.html.erb +1 -1
  54. data/app/views/{patron_types → agent_types}/edit.html.erb +3 -3
  55. data/app/views/agent_types/index.html.erb +43 -0
  56. data/app/views/{patron_types → agent_types}/new.html.erb +2 -2
  57. data/app/views/agent_types/show.html.erb +29 -0
  58. data/app/views/{patrons → agents}/_expression_list.html.erb +3 -3
  59. data/app/views/{patrons → agents}/_form.html.erb +9 -9
  60. data/app/views/{patrons → agents}/_form_family_name_first.html.erb +0 -0
  61. data/app/views/{patrons → agents}/_form_family_name_last.html.erb +0 -0
  62. data/app/views/{patrons → agents}/_history_list.html.erb +2 -2
  63. data/app/views/{patrons → agents}/_index.html.erb +9 -9
  64. data/app/views/{patrons → agents}/_index_expression.html.erb +15 -15
  65. data/app/views/{patrons → agents}/_index_manifestation.html.erb +16 -16
  66. data/app/views/agents/_index_patron.html.erb +71 -0
  67. data/app/views/agents/_index_patron_merge_list.html.erb +53 -0
  68. data/app/views/{patrons → agents}/_index_work.html.erb +17 -17
  69. data/app/views/{patrons → agents}/_manifestation_list.html.erb +3 -3
  70. data/app/views/agents/_patron.html.erb +13 -0
  71. data/app/views/agents/_patron_list.html.erb +18 -0
  72. data/app/views/{patrons → agents}/_work_list.html.erb +1 -1
  73. data/app/views/agents/edit.html.erb +16 -0
  74. data/app/views/agents/index.atom.builder +10 -0
  75. data/app/views/{patrons → agents}/index.html.erb +4 -4
  76. data/app/views/{patrons → agents}/index.mobile.erb +5 -5
  77. data/app/views/{patrons → agents}/index.rss.builder +11 -11
  78. data/app/views/{patrons → agents}/new.html.erb +2 -2
  79. data/app/views/agents/show.html.erb +152 -0
  80. data/app/views/{patrons → agents}/show.js.erb +0 -0
  81. data/app/views/agents/show.mobile.erb +69 -0
  82. data/app/views/creates/_form.html.erb +5 -5
  83. data/app/views/creates/_index.html.erb +2 -2
  84. data/app/views/creates/_index_patron.html.erb +6 -6
  85. data/app/views/creates/_index_work.html.erb +2 -2
  86. data/app/views/creates/index.html.erb +2 -2
  87. data/app/views/creates/new.html.erb +3 -3
  88. data/app/views/creates/show.html.erb +4 -4
  89. data/app/views/donates/edit.html.erb +2 -2
  90. data/app/views/donates/index.html.erb +2 -2
  91. data/app/views/donates/new.html.erb +2 -2
  92. data/app/views/donates/show.html.erb +2 -2
  93. data/app/views/items/index.html.erb +1 -1
  94. data/app/views/languages/index.html.erb +1 -1
  95. data/app/views/layouts/patrons.html.erb +2 -2
  96. data/app/views/manifestations/_index_form_contributor.html.erb +1 -1
  97. data/app/views/manifestations/_index_form_creator.html.erb +1 -1
  98. data/app/views/manifestations/_index_form_publisher.html.erb +1 -1
  99. data/app/views/manifestations/_manifestation_list.html.erb +6 -6
  100. data/app/views/manifestations/_show.mods.builder +4 -4
  101. data/app/views/manifestations/_show.rdf.builder +4 -4
  102. data/app/views/manifestations/_show_creators.html.erb +4 -4
  103. data/app/views/manifestations/_show_creators.mobile.erb +4 -4
  104. data/app/views/manifestations/_title.html.erb +3 -3
  105. data/app/views/manifestations/_title.mobile.erb +3 -3
  106. data/app/views/manifestations/edit.html.erb +2 -2
  107. data/app/views/manifestations/index.atom.builder +2 -2
  108. data/app/views/manifestations/index.html.erb +3 -3
  109. data/app/views/manifestations/index.opds.builder +2 -2
  110. data/app/views/manifestations/index.sru.builder +6 -6
  111. data/app/views/manifestations/new.html.erb +2 -2
  112. data/app/views/notifier/manifestation_info.en.text.erb +1 -1
  113. data/app/views/notifier/manifestation_info.ja.text.erb +1 -1
  114. data/app/views/owns/_form.html.erb +1 -1
  115. data/app/views/owns/index.html.erb +2 -2
  116. data/app/views/owns/show.html.erb +4 -4
  117. data/app/views/picture_files/_index.html.erb +1 -1
  118. data/app/views/picture_files/_index_patron.html.erb +2 -2
  119. data/app/views/picture_files/index.html.erb +2 -2
  120. data/app/views/picture_files/show.html.erb +2 -2
  121. data/app/views/produces/_form.html.erb +5 -5
  122. data/app/views/produces/_index.html.erb +2 -2
  123. data/app/views/produces/_index_manifestation.html.erb +3 -3
  124. data/app/views/produces/_index_patron.html.erb +3 -3
  125. data/app/views/produces/index.html.erb +2 -2
  126. data/app/views/produces/new.html.erb +3 -3
  127. data/app/views/produces/show.html.erb +4 -4
  128. data/app/views/realizes/_form.html.erb +5 -5
  129. data/app/views/realizes/_index.html.erb +2 -2
  130. data/app/views/realizes/_index_expression.html.erb +3 -3
  131. data/app/views/realizes/_index_patron.html.erb +3 -3
  132. data/app/views/realizes/index.html.erb +2 -2
  133. data/app/views/realizes/new.html.erb +3 -3
  134. data/app/views/realizes/show.html.erb +4 -4
  135. data/app/views/resource_import_results/show.html.erb +1 -1
  136. data/config/routes.rb +16 -16
  137. data/db/migrate/{001_create_patrons.rb → 001_create_agents.rb} +8 -8
  138. data/db/migrate/012_create_owns.rb +2 -2
  139. data/db/migrate/015_create_creates.rb +2 -2
  140. data/db/migrate/047_create_produces.rb +2 -2
  141. data/db/migrate/125_create_donates.rb +2 -2
  142. data/db/migrate/20080830154109_create_realizes.rb +2 -2
  143. data/db/migrate/{20080905191442_create_patron_types.rb → 20080905191442_create_agent_types.rb} +2 -2
  144. data/db/migrate/20081028083142_create_agent_import_files.rb +22 -0
  145. data/db/migrate/{20090812151902_create_patron_relationship_types.rb → 20090812151902_create_agent_relationship_types.rb} +2 -2
  146. data/db/migrate/20091012101112_add_dcndl_schema.rb +2 -2
  147. data/db/migrate/20100606073747_create_agent_relationships.rb +13 -0
  148. data/db/migrate/20100814091104_add_position_to_agent_relationship.rb +11 -0
  149. data/db/migrate/20100925074559_create_agent_import_results.rb +12 -0
  150. data/db/migrate/20110301121550_add_birth_date_and_death_date_to_agent.rb +11 -0
  151. data/db/migrate/20120413161403_add_fingerprint_to_agent_import_file.rb +5 -0
  152. data/db/migrate/20120413170720_add_error_message_to_agent_import_file.rb +5 -0
  153. data/db/migrate/20120511072422_add_agent_identifier_to_agent.rb +6 -0
  154. data/db/migrate/20120602141129_add_edit_mode_to_agent_import_file.rb +5 -0
  155. data/lib/enju_biblio/biblio_helper.rb +8 -8
  156. data/lib/enju_biblio/version.rb +1 -1
  157. data/lib/enju_biblio.rb +3 -3
  158. data/lib/generators/enju_biblio/setup/templates/db/fixtures/patron_relationship_types.yml +3 -3
  159. data/lib/generators/enju_biblio/setup/templates/db/fixtures/patron_types.yml +2 -2
  160. data/lib/generators/enju_biblio/setup/templates/db/fixtures/patrons.yml +4 -4
  161. data/spec/controllers/agent_import_files_controller_spec.rb +321 -0
  162. data/spec/controllers/{patron_import_results_controller_spec.rb → agent_import_results_controller_spec.rb} +17 -17
  163. data/spec/controllers/agent_relationship_types_controller_spec.rb +445 -0
  164. data/spec/controllers/agent_relationships_controller_spec.rb +446 -0
  165. data/spec/controllers/agent_types_controller_spec.rb +447 -0
  166. data/spec/controllers/agents_controller_spec.rb +644 -0
  167. data/spec/controllers/countries_controller_spec.rb +1 -1
  168. data/spec/controllers/items_controller_spec.rb +4 -4
  169. data/spec/controllers/manifestation_relationship_types_controller_spec.rb +1 -1
  170. data/spec/controllers/manifestations_controller_spec.rb +4 -4
  171. data/spec/controllers/owns_controller_spec.rb +2 -2
  172. data/spec/controllers/resource_import_files_controller_spec.rb +1 -1
  173. data/spec/dummy/app/helpers/application_helper.rb +5 -222
  174. data/spec/dummy/app/models/ability.rb +31 -31
  175. data/spec/dummy/app/models/{local_patron.rb → local_agent.rb} +1 -1
  176. data/spec/dummy/app/models/user.rb +3 -3
  177. data/spec/dummy/config/application.rb +0 -1
  178. data/spec/dummy/config/environments/test.rb +1 -0
  179. data/spec/dummy/db/development.sqlite3 +0 -0
  180. data/spec/dummy/db/migrate/035_create_reserves.rb +1 -1
  181. data/spec/dummy/db/migrate/20090519203307_create_participates.rb +2 -2
  182. data/spec/dummy/db/schema.rb +132 -132
  183. data/spec/dummy/db/test.sqlite3 +0 -0
  184. data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_delete_file.tsv +8 -0
  185. data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_import_file_sample1.tsv +5 -0
  186. data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_import_file_sample2.tsv +8 -0
  187. data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_import_file_sample3.tsv +5 -0
  188. data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_update_file.tsv +3 -0
  189. data/spec/dummy/solr/data/test/index/segments.gen +0 -0
  190. data/spec/dummy/solr/data/test/index/segments_q76 +0 -0
  191. data/spec/factories/{patron.rb → agent.rb} +3 -3
  192. data/spec/factories/create.rb +1 -1
  193. data/spec/factories/donate.rb +1 -1
  194. data/spec/factories/own.rb +1 -1
  195. data/spec/factories/patron_relationship.rb +3 -3
  196. data/spec/factories/patron_relationship_type.rb +2 -2
  197. data/spec/factories/patron_type.rb +2 -2
  198. data/spec/factories/produce.rb +1 -1
  199. data/spec/factories/realize.rb +1 -1
  200. data/spec/fixtures/{patron_import_files.yml → agent_import_files.yml} +18 -18
  201. data/spec/fixtures/{patron_import_results.yml → agent_import_results.yml} +7 -7
  202. data/spec/fixtures/{patron_relationship_types.yml → agent_relationship_types.yml} +4 -4
  203. data/spec/fixtures/{patron_relationships.yml → agent_relationships.yml} +4 -4
  204. data/spec/fixtures/{patron_types.yml → agent_types.yml} +4 -4
  205. data/spec/fixtures/{patrons.yml → agents.yml} +47 -47
  206. data/spec/fixtures/creates.yml +8 -8
  207. data/spec/fixtures/donates.yml +4 -4
  208. data/spec/fixtures/owns.yml +3 -3
  209. data/spec/fixtures/picture_files.yml +1 -1
  210. data/spec/fixtures/produces.yml +20 -20
  211. data/spec/fixtures/realizes.yml +11 -11
  212. data/spec/fixtures/reserves.yml +1 -1
  213. data/spec/models/agent_import_file_spec.rb +96 -0
  214. data/spec/models/{patron_import_result_spec.rb → agent_import_result_spec.rb} +4 -4
  215. data/spec/models/{patron_relationship_spec.rb → agent_relationship_spec.rb} +3 -3
  216. data/spec/models/{patron_relationship_type_spec.rb → agent_relationship_type_spec.rb} +2 -2
  217. data/spec/models/{patron_spec.rb → agent_spec.rb} +16 -16
  218. data/spec/models/{patron_type_spec.rb → agent_type_spec.rb} +2 -2
  219. data/spec/models/create_spec.rb +1 -1
  220. data/spec/models/donate_spec.rb +1 -1
  221. data/spec/models/manifestation_spec.rb +1 -1
  222. data/spec/models/own_spec.rb +1 -1
  223. data/spec/models/produce_spec.rb +1 -1
  224. data/spec/models/realize_spec.rb +1 -1
  225. data/spec/models/resource_import_file_spec.rb +8 -8
  226. data/spec/requests/agents_spec.rb +9 -0
  227. data/spec/routing/agent_relationship_types_routing_spec.rb +35 -0
  228. data/spec/routing/agent_relationships_routing_spec.rb +35 -0
  229. data/spec/routing/agents_routing_spec.rb +35 -0
  230. data/spec/views/creates/edit.html.erb_spec.rb +1 -1
  231. data/spec/views/creates/index.html.erb_spec.rb +2 -2
  232. data/spec/views/creates/new.html.erb_spec.rb +1 -1
  233. data/spec/views/creates/show.html.erb_spec.rb +1 -1
  234. data/spec/views/owns/edit.html.erb_spec.rb +1 -1
  235. data/spec/views/owns/index.html.erb_spec.rb +2 -2
  236. data/spec/views/owns/new.html.erb_spec.rb +1 -1
  237. data/spec/views/owns/show.html.erb_spec.rb +1 -1
  238. data/spec/views/produces/edit.html.erb_spec.rb +2 -2
  239. data/spec/views/produces/index.html.erb_spec.rb +2 -2
  240. data/spec/views/produces/new.html.erb_spec.rb +2 -2
  241. data/spec/views/produces/show.html.erb_spec.rb +1 -1
  242. data/spec/views/realizes/edit.html.erb_spec.rb +2 -2
  243. data/spec/views/realizes/index.html.erb_spec.rb +2 -2
  244. data/spec/views/realizes/new.html.erb_spec.rb +2 -2
  245. data/spec/views/realizes/show.html.erb_spec.rb +1 -1
  246. metadata +131 -187
  247. data/app/models/patron_import_result.rb +0 -26
  248. data/app/views/patron_import_files/index.html.erb +0 -40
  249. data/app/views/patron_import_files/show.html.erb +0 -69
  250. data/app/views/patron_import_results/index.csv.erb +0 -3
  251. data/app/views/patron_import_results/index.html.erb +0 -52
  252. data/app/views/patron_import_results/show.html.erb +0 -38
  253. data/app/views/patron_relationship_types/index.html.erb +0 -43
  254. data/app/views/patron_relationship_types/show.html.erb +0 -29
  255. data/app/views/patron_relationships/index.html.erb +0 -34
  256. data/app/views/patron_relationships/show.html.erb +0 -24
  257. data/app/views/patron_types/index.html.erb +0 -43
  258. data/app/views/patron_types/show.html.erb +0 -29
  259. data/app/views/patrons/_index_patron.html.erb +0 -71
  260. data/app/views/patrons/_index_patron_merge_list.html.erb +0 -53
  261. data/app/views/patrons/_patron.html.erb +0 -13
  262. data/app/views/patrons/_patron_list.html.erb +0 -18
  263. data/app/views/patrons/edit.html.erb +0 -16
  264. data/app/views/patrons/index.atom.builder +0 -10
  265. data/app/views/patrons/show.html.erb +0 -152
  266. data/app/views/patrons/show.mobile.erb +0 -69
  267. data/db/migrate/20081028083142_create_patron_import_files.rb +0 -22
  268. data/db/migrate/20100606073747_create_patron_relationships.rb +0 -13
  269. data/db/migrate/20100814091104_add_position_to_patron_relationship.rb +0 -11
  270. data/db/migrate/20100925074559_create_patron_import_results.rb +0 -12
  271. data/db/migrate/20110301121550_add_birth_date_and_death_date_to_patron.rb +0 -11
  272. data/db/migrate/20120413161403_add_fingerprint_to_patron_import_file.rb +0 -5
  273. data/db/migrate/20120413170720_add_error_message_to_patron_import_file.rb +0 -5
  274. data/db/migrate/20120511072422_add_patron_identifier_to_patron.rb +0 -6
  275. data/db/migrate/20120602141129_add_edit_mode_to_patron_import_file.rb +0 -5
  276. data/spec/controllers/patron_import_files_controller_spec.rb +0 -321
  277. data/spec/controllers/patron_relationship_types_controller_spec.rb +0 -445
  278. data/spec/controllers/patron_relationships_controller_spec.rb +0 -446
  279. data/spec/controllers/patron_types_controller_spec.rb +0 -447
  280. data/spec/controllers/patrons_controller_spec.rb +0 -644
  281. data/spec/dummy/app/mailers/notifier.rb +0 -40
  282. data/spec/dummy/lib/plugins/ext/event-calendar.rb +0 -38
  283. data/spec/dummy/lib/plugins/ext/sunspot/abstract_search.rb +0 -12
  284. data/spec/dummy/lib/plugins/ext/sunspot/dismax.rb +0 -41
  285. data/spec/dummy/lib/plugins/ext/sunspot/start_record.rb +0 -55
  286. data/spec/dummy/lib/plugins/ext/sunspot.rb +0 -3
  287. data/spec/dummy/lib/plugins/ext.rb +0 -1
  288. data/spec/dummy/lib/plugins.rb +0 -2
  289. data/spec/dummy/solr/data/test/index/_goc.fdt +0 -0
  290. data/spec/dummy/solr/data/test/index/_goc.fdx +0 -0
  291. data/spec/dummy/solr/data/test/index/_goc.fnm +0 -7
  292. data/spec/dummy/solr/data/test/index/_goc.frq +0 -0
  293. data/spec/dummy/solr/data/test/index/_goc.nrm +0 -1
  294. data/spec/dummy/solr/data/test/index/_goc.prx +0 -0
  295. data/spec/dummy/solr/data/test/index/_goc.tii +0 -0
  296. data/spec/dummy/solr/data/test/index/_goc.tis +0 -0
  297. data/spec/dummy/solr/data/test/index/_god.fdt +0 -0
  298. data/spec/dummy/solr/data/test/index/_god.fdx +0 -0
  299. data/spec/dummy/solr/data/test/index/_god.fnm +0 -7
  300. data/spec/dummy/solr/data/test/index/_god.frq +0 -0
  301. data/spec/dummy/solr/data/test/index/_god.nrm +0 -1
  302. data/spec/dummy/solr/data/test/index/_god.prx +0 -0
  303. data/spec/dummy/solr/data/test/index/_god.tii +0 -0
  304. data/spec/dummy/solr/data/test/index/_god.tis +0 -0
  305. data/spec/dummy/solr/data/test/index/_goe.fdt +0 -0
  306. data/spec/dummy/solr/data/test/index/_goe.fdx +0 -0
  307. data/spec/dummy/solr/data/test/index/_goe.fnm +0 -8
  308. data/spec/dummy/solr/data/test/index/_goe.frq +0 -0
  309. data/spec/dummy/solr/data/test/index/_goe.nrm +0 -1
  310. data/spec/dummy/solr/data/test/index/_goe.prx +0 -0
  311. data/spec/dummy/solr/data/test/index/_goe.tii +0 -0
  312. data/spec/dummy/solr/data/test/index/_goe.tis +0 -0
  313. data/spec/dummy/solr/data/test/index/segments_otc +0 -0
  314. data/spec/dummy/tmp/cache/4AD/470/country_all +0 -0
  315. data/spec/models/patron_import_file_spec.rb +0 -96
  316. data/spec/requests/patrons_spec.rb +0 -9
  317. data/spec/routing/patron_relationship_types_routing_spec.rb +0 -35
  318. data/spec/routing/patron_relationships_routing_spec.rb +0 -35
  319. data/spec/routing/patrons_routing_spec.rb +0 -35
@@ -1,22 +1,22 @@
1
1
  # -*- encoding: utf-8 -*-
2
- class PatronsController < ApplicationController
2
+ class AgentsController < ApplicationController
3
3
  load_and_authorize_resource :except => :index
4
4
  authorize_resource :only => :index
5
- before_filter :get_work, :get_expression, :get_manifestation, :get_item, :get_patron, :except => [:update, :destroy]
5
+ before_filter :get_work, :get_expression, :get_manifestation, :get_item, :get_agent, :except => [:update, :destroy]
6
6
  if defined?(EnjuResourceMerge)
7
- before_filter :get_patron_merge_list, :except => [:create, :update, :destroy]
7
+ before_filter :get_agent_merge_list, :except => [:create, :update, :destroy]
8
8
  end
9
9
  before_filter :prepare_options, :only => [:new, :edit]
10
10
  before_filter :store_location
11
11
  before_filter :get_version, :only => [:show]
12
12
  after_filter :solr_commit, :only => [:create, :update, :destroy]
13
- cache_sweeper :patron_sweeper, :only => [:create, :update, :destroy]
13
+ cache_sweeper :agent_sweeper, :only => [:create, :update, :destroy]
14
14
 
15
- # GET /patrons
16
- # GET /patrons.json
15
+ # GET /agents
16
+ # GET /agents.json
17
17
  def index
18
18
  #session[:params] = {} unless session[:params]
19
- #session[:params][:patron] = params
19
+ #session[:params][:agent] = params
20
20
  # 最近追加されたパトロン
21
21
  #@query = params[:query] ||= "[* TO *]"
22
22
  if params[:mode] == 'add'
@@ -35,12 +35,12 @@ class PatronsController < ApplicationController
35
35
  order = nil
36
36
  @count = {}
37
37
 
38
- search = Patron.search(:include => [:patron_type, :required_role])
39
- search.data_accessor_for(Patron).select = [
38
+ search = Agent.search(:include => [:agent_type, :required_role])
39
+ search.data_accessor_for(Agent).select = [
40
40
  :id,
41
41
  :full_name,
42
42
  :full_name_transcription,
43
- :patron_type_id,
43
+ :agent_type_id,
44
44
  :required_role_id,
45
45
  :created_at,
46
46
  :updated_at,
@@ -61,14 +61,14 @@ class PatronsController < ApplicationController
61
61
  work = @work
62
62
  expression = @expression
63
63
  manifestation = @manifestation
64
- patron = @patron
65
- patron_merge_list = @patron_merge_list
64
+ agent = @agent
65
+ agent_merge_list = @agent_merge_list
66
66
  search.build do
67
67
  with(:work_ids).equal_to work.id if work
68
68
  with(:expression_ids).equal_to expression.id if expression
69
69
  with(:manifestation_ids).equal_to manifestation.id if manifestation
70
- with(:original_patron_ids).equal_to patron.id if patron
71
- with(:patron_merge_list_ids).equal_to patron_merge_list.id if patron_merge_list
70
+ with(:original_agent_ids).equal_to agent.id if agent
71
+ with(:agent_merge_list_ids).equal_to agent_merge_list.id if agent_merge_list
72
72
  end
73
73
  end
74
74
 
@@ -79,138 +79,138 @@ class PatronsController < ApplicationController
79
79
 
80
80
  page = params[:page].to_i || 1
81
81
  page = 1 if page == 0
82
- search.query.paginate(page, Patron.default_per_page)
83
- @patrons = search.execute!.results
82
+ search.query.paginate(page, Agent.default_per_page)
83
+ @agents = search.execute!.results
84
84
 
85
85
  flash[:page_info] = {:page => page, :query => query}
86
86
 
87
87
  respond_to do |format|
88
88
  format.html # index.html.erb
89
- format.xml { render :xml => @patrons }
89
+ format.xml { render :xml => @agents }
90
90
  format.rss { render :layout => false }
91
91
  format.atom
92
- format.json { render :json => @patrons }
92
+ format.json { render :json => @agents }
93
93
  format.mobile
94
94
  end
95
95
  end
96
96
 
97
- # GET /patrons/1
98
- # GET /patrons/1.json
97
+ # GET /agents/1
98
+ # GET /agents/1.json
99
99
  def show
100
100
  case
101
101
  when @work
102
- @patron = @work.creators.find(params[:id])
102
+ @agent = @work.creators.find(params[:id])
103
103
  when @manifestation
104
- @patron = @manifestation.publishers.find(params[:id])
104
+ @agent = @manifestation.publishers.find(params[:id])
105
105
  when @item
106
- @patron = @item.patrons.find(params[:id])
106
+ @agent = @item.agents.find(params[:id])
107
107
  else
108
108
  if @version
109
- @patron = @patron.versions.find(@version).item if @version
109
+ @agent = @agent.versions.find(@version).item if @version
110
110
  end
111
111
  end
112
112
 
113
- patron = @patron
113
+ agent = @agent
114
114
  role = current_user.try(:role) || Role.default_role
115
115
  @works = Manifestation.search do
116
- with(:creator_ids).equal_to patron.id
116
+ with(:creator_ids).equal_to agent.id
117
117
  with(:required_role_id).less_than_or_equal_to role.id
118
118
  paginate :page => params[:work_list_page], :per_page => Manifestation.default_per_page
119
119
  end.results
120
120
  @expressions = Manifestation.search do
121
- with(:contributor_ids).equal_to patron.id
121
+ with(:contributor_ids).equal_to agent.id
122
122
  with(:required_role_id).less_than_or_equal_to role.id
123
123
  paginate :page => params[:expression_list_page], :per_page => Manifestation.default_per_page
124
124
  end.results
125
125
  @manifestations = Manifestation.search do
126
- with(:publisher_ids).equal_to patron.id
126
+ with(:publisher_ids).equal_to agent.id
127
127
  with(:required_role_id).less_than_or_equal_to role.id
128
128
  paginate :page => params[:manifestation_list_page], :per_page => Manifestation.default_per_page
129
129
  end.results
130
130
 
131
131
  respond_to do |format|
132
132
  format.html # show.html.erb
133
- format.json { render :json => @patron }
133
+ format.json { render :json => @agent }
134
134
  format.js
135
135
  format.mobile
136
136
  end
137
137
  end
138
138
 
139
- # GET /patrons/new
140
- # GET /patrons/new.json
139
+ # GET /agents/new
140
+ # GET /agents/new.json
141
141
  def new
142
- @patron = Patron.new
143
- @patron.required_role = Role.where(:name => 'Guest').first
144
- @patron.language = Language.where(:iso_639_1 => I18n.default_locale.to_s).first || Language.first
145
- @patron.country = current_user.library.country
142
+ @agent = Agent.new
143
+ @agent.required_role = Role.where(:name => 'Guest').first
144
+ @agent.language = Language.where(:iso_639_1 => I18n.default_locale.to_s).first || Language.first
145
+ @agent.country = current_user.library.country
146
146
  prepare_options
147
147
 
148
148
  respond_to do |format|
149
149
  format.html # new.html.erb
150
- format.json { render :json => @patron }
150
+ format.json { render :json => @agent }
151
151
  end
152
152
  end
153
153
 
154
- # GET /patrons/1/edit
154
+ # GET /agents/1/edit
155
155
  def edit
156
156
  prepare_options
157
157
  end
158
158
 
159
- # POST /patrons
160
- # POST /patrons.json
159
+ # POST /agents
160
+ # POST /agents.json
161
161
  def create
162
- @patron = Patron.new(params[:patron])
163
- #if @patron.user_username
164
- # @patron.user = User.find(@patron.user_username) rescue nil
162
+ @agent = Agent.new(params[:agent])
163
+ #if @agent.user_username
164
+ # @agent.user = User.find(@agent.user_username) rescue nil
165
165
  #end
166
166
  #unless current_user.has_role?('Librarian')
167
- # if @patron.user != current_user
167
+ # if @agent.user != current_user
168
168
  # access_denied; return
169
169
  # end
170
170
  #end
171
171
 
172
172
  respond_to do |format|
173
- if @patron.save
173
+ if @agent.save
174
174
  case
175
175
  when @work
176
- @patron.works << @work
176
+ @agent.works << @work
177
177
  when @manifestation
178
- @patron.manifestations << @manifestation
178
+ @agent.manifestations << @manifestation
179
179
  when @item
180
- @patron.items << @item
180
+ @agent.items << @item
181
181
  end
182
- format.html { redirect_to @patron, :notice => t('controller.successfully_created', :model => t('activerecord.models.patron')) }
183
- format.json { render :json => @patron, :status => :created, :location => @patron }
182
+ format.html { redirect_to @agent, :notice => t('controller.successfully_created', :model => t('activerecord.models.agent')) }
183
+ format.json { render :json => @agent, :status => :created, :location => @agent }
184
184
  else
185
185
  prepare_options
186
186
  format.html { render :action => "new" }
187
- format.json { render :json => @patron.errors, :status => :unprocessable_entity }
187
+ format.json { render :json => @agent.errors, :status => :unprocessable_entity }
188
188
  end
189
189
  end
190
190
  end
191
191
 
192
- # PUT /patrons/1
193
- # PUT /patrons/1.json
192
+ # PUT /agents/1
193
+ # PUT /agents/1.json
194
194
  def update
195
195
  respond_to do |format|
196
- if @patron.update_attributes(params[:patron])
197
- format.html { redirect_to @patron, :notice => t('controller.successfully_updated', :model => t('activerecord.models.patron')) }
196
+ if @agent.update_attributes(params[:agent])
197
+ format.html { redirect_to @agent, :notice => t('controller.successfully_updated', :model => t('activerecord.models.agent')) }
198
198
  format.json { head :no_content }
199
199
  else
200
200
  prepare_options
201
201
  format.html { render :action => "edit" }
202
- format.json { render :json => @patron.errors, :status => :unprocessable_entity }
202
+ format.json { render :json => @agent.errors, :status => :unprocessable_entity }
203
203
  end
204
204
  end
205
205
  end
206
206
 
207
- # DELETE /patrons/1
208
- # DELETE /patrons/1.json
207
+ # DELETE /agents/1
208
+ # DELETE /agents/1.json
209
209
  def destroy
210
- @patron.destroy
210
+ @agent.destroy
211
211
 
212
212
  respond_to do |format|
213
- format.html { redirect_to patrons_url, :notice => t('controller.successfully_deleted', :model => t('activerecord.models.patron')) }
213
+ format.html { redirect_to agents_url, :notice => t('controller.successfully_deleted', :model => t('activerecord.models.agent')) }
214
214
  format.json { head :no_content }
215
215
  end
216
216
  end
@@ -218,9 +218,9 @@ class PatronsController < ApplicationController
218
218
  private
219
219
  def prepare_options
220
220
  @countries = Country.all_cache
221
- @patron_types = PatronType.all
221
+ @agent_types = AgentType.all
222
222
  @roles = Role.all
223
223
  @languages = Language.all_cache
224
- @patron_type = PatronType.where(:name => 'Person').first
224
+ @agent_type = AgentType.where(:name => 'Person').first
225
225
  end
226
226
  end
@@ -59,7 +59,7 @@ class PictureFilesController < ApplicationController
59
59
  redirect_to picture_files_url
60
60
  return
61
61
  end
62
- #raise unless @event or @manifestation or @shelf or @patron
62
+ #raise unless @event or @manifestation or @shelf or @agent
63
63
  @picture_file = PictureFile.new
64
64
  @picture_file.picture_attachable = @attachable
65
65
 
@@ -140,9 +140,9 @@ class PictureFilesController < ApplicationController
140
140
  @attachable = @manifestation
141
141
  return
142
142
  end
143
- get_patron
144
- if @patron
145
- @attachable = @patron
143
+ get_agent
144
+ if @agent
145
+ @attachable = @agent
146
146
  return
147
147
  end
148
148
  get_event
@@ -1,6 +1,6 @@
1
1
  class ProducesController < ApplicationController
2
2
  load_and_authorize_resource
3
- before_filter :get_patron, :get_manifestation
3
+ before_filter :get_agent, :get_manifestation
4
4
  before_filter :prepare_options, :only => [:new, :edit]
5
5
  after_filter :solr_commit, :only => [:create, :update, :destroy]
6
6
  cache_sweeper :page_sweeper, :only => [:create, :update, :destroy]
@@ -9,8 +9,8 @@ class ProducesController < ApplicationController
9
9
  # GET /produces.json
10
10
  def index
11
11
  case
12
- when @patron
13
- @produces = @patron.produces.order('produces.position').page(params[:page])
12
+ when @agent
13
+ @produces = @agent.produces.order('produces.position').page(params[:page])
14
14
  when @manifestation
15
15
  @produces = @manifestation.produces.order('produces.position').page(params[:page])
16
16
  else
@@ -39,16 +39,16 @@ class ProducesController < ApplicationController
39
39
 
40
40
  # GET /produces/new
41
41
  def new
42
- if @patron and @manifestation.blank?
43
- redirect_to patron_manifestations_url(@patron)
42
+ if @agent and @manifestation.blank?
43
+ redirect_to agent_manifestations_url(@agent)
44
44
  return
45
- elsif @manifestation and @patron.blank?
46
- redirect_to manifestation_patrons_url(@manifestation)
45
+ elsif @manifestation and @agent.blank?
46
+ redirect_to manifestation_agents_url(@manifestation)
47
47
  return
48
48
  else
49
49
  @produce = Produce.new
50
50
  @produce.manifestation = @manifestation
51
- @produce.patron = @patron
51
+ @produce.agent = @agent
52
52
  end
53
53
  end
54
54
 
@@ -103,10 +103,10 @@ class ProducesController < ApplicationController
103
103
  format.html {
104
104
  flash[:notice] = t('controller.successfully_deleted', :model => t('activerecord.models.produce'))
105
105
  case
106
- when @patron
107
- redirect_to patron_manifestations_url(@patron)
106
+ when @agent
107
+ redirect_to agent_manifestations_url(@agent)
108
108
  when @manifestation
109
- redirect_to manifestation_patrons_url(@manifestation)
109
+ redirect_to manifestation_agents_url(@manifestation)
110
110
  else
111
111
  redirect_to produces_url
112
112
  end
@@ -1,6 +1,6 @@
1
1
  class RealizesController < ApplicationController
2
2
  load_and_authorize_resource
3
- before_filter :get_patron, :get_expression
3
+ before_filter :get_agent, :get_expression
4
4
  before_filter :prepare_options, :only => [:new, :edit]
5
5
  after_filter :solr_commit, :only => [:create, :update, :destroy]
6
6
  cache_sweeper :page_sweeper, :only => [:create, :update, :destroy]
@@ -9,8 +9,8 @@ class RealizesController < ApplicationController
9
9
  # GET /realizes.json
10
10
  def index
11
11
  case
12
- when @patron
13
- @realizes = @patron.realizes.order('realizes.position').page(params[:page])
12
+ when @agent
13
+ @realizes = @agent.realizes.order('realizes.position').page(params[:page])
14
14
  when @expression
15
15
  @realizes = @expression.realizes.order('realizes.position').page(params[:page])
16
16
  else
@@ -34,16 +34,16 @@ class RealizesController < ApplicationController
34
34
 
35
35
  # GET /realizes/new
36
36
  def new
37
- if @expression and @patron.blank?
38
- redirect_to expression_patrons_url(@expression)
37
+ if @expression and @agent.blank?
38
+ redirect_to expression_agents_url(@expression)
39
39
  return
40
- elsif @patron and @expression.blank?
41
- redirect_to patron_expressions_url(@patron)
40
+ elsif @agent and @expression.blank?
41
+ redirect_to agent_expressions_url(@agent)
42
42
  return
43
43
  else
44
44
  @realize = Realize.new
45
45
  @realize.expression = @expression
46
- @realize.patron = @patron
46
+ @realize.agent = @agent
47
47
  end
48
48
  end
49
49
 
@@ -100,9 +100,9 @@ class RealizesController < ApplicationController
100
100
  flash[:notice] = t('controller.successfully_deleted', :model => t('activerecord.models.realize'))
101
101
  case
102
102
  when @expression
103
- redirect_to expression_patrons_url(@expression)
104
- when @patron
105
- redirect_to patron_expressions_url(@patron)
103
+ redirect_to expression_agents_url(@expression)
104
+ when @agent
105
+ redirect_to agent_expressions_url(@agent)
106
106
  else
107
107
  redirect_to realizes_url
108
108
  end
@@ -1,13 +1,13 @@
1
- module PatronsHelper
1
+ module AgentsHelper
2
2
  include PictureFilesHelper
3
- def patron_custom_book_jacket(patron)
3
+ def agent_custom_book_jacket(agent)
4
4
  link = ''
5
- patron.picture_files.each_with_index do |picture_file, i|
5
+ agent.picture_files.each_with_index do |picture_file, i|
6
6
  if i == 0
7
- link += link_to(show_image(picture_file, :size => :thumb), picture_file_path(picture_file, :format => :download), :rel => "patron_#{patron.id}")
7
+ link += link_to(show_image(picture_file, :size => :thumb), picture_file_path(picture_file, :format => :download), :rel => "agent_#{agent.id}")
8
8
  else
9
9
  link += content_tag :span, :style => "display: none" do
10
- link_to(show_image(picture_file, :size => :thumb), picture_file_path(picture_file, :format => :download), :rel => "patron_#{patron.id}")
10
+ link_to(show_image(picture_file, :size => :thumb), picture_file_path(picture_file, :format => :download), :rel => "agent_#{agent.id}")
11
11
  end
12
12
  end
13
13
  end
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- class Patron < ActiveRecord::Base
2
+ class Agent < ActiveRecord::Base
3
3
  enju_export if defined?(EnjuExport)
4
4
  attr_accessible :last_name, :middle_name, :first_name,
5
5
  :last_name_transcription, :middle_name_transcription,
6
6
  :first_name_transcription, :corporate_name, :corporate_name_transcription,
7
7
  :full_name, :full_name_transcription, :full_name_alternative,
8
8
  :other_designation, :language_id,
9
- :country_id, :patron_type_id, :note, :required_role_id, :email, :url,
9
+ :country_id, :agent_type_id, :note, :required_role_id, :email, :url,
10
10
  :full_name_alternative_transcription, :title,
11
- :patron_identifier
11
+ :agent_identifier
12
12
 
13
13
  scope :readable_by, lambda{|user| {:conditions => ['required_role_id <= ?', user.try(:user_has_role).try(:role_id) || Role.where(:name => 'Guest').select(:id).first.id]}}
14
14
  has_many :creates, :dependent => :destroy
@@ -17,28 +17,28 @@ class Patron < ActiveRecord::Base
17
17
  has_many :expressions, :through => :realizes
18
18
  has_many :produces, :dependent => :destroy
19
19
  has_many :manifestations, :through => :produces
20
- has_many :children, :foreign_key => 'parent_id', :class_name => 'PatronRelationship', :dependent => :destroy
21
- has_many :parents, :foreign_key => 'child_id', :class_name => 'PatronRelationship', :dependent => :destroy
22
- has_many :derived_patrons, :through => :children, :source => :child
23
- has_many :original_patrons, :through => :parents, :source => :parent
20
+ has_many :children, :foreign_key => 'parent_id', :class_name => 'AgentRelationship', :dependent => :destroy
21
+ has_many :parents, :foreign_key => 'child_id', :class_name => 'AgentRelationship', :dependent => :destroy
22
+ has_many :derived_agents, :through => :children, :source => :child
23
+ has_many :original_agents, :through => :parents, :source => :parent
24
24
  has_many :picture_files, :as => :picture_attachable, :dependent => :destroy
25
25
  has_many :donates
26
26
  has_many :donated_items, :through => :donates, :source => :item
27
27
  has_many :owns, :dependent => :destroy
28
28
  has_many :items, :through => :owns
29
29
  if defined?(EnjuResourceMerge)
30
- has_many :patron_merges, :dependent => :destroy
31
- has_many :patron_merge_lists, :through => :patron_merges
30
+ has_many :agent_merges, :dependent => :destroy
31
+ has_many :agent_merge_lists, :through => :agent_merges
32
32
  end
33
33
  #belongs_to :user
34
- belongs_to :patron_type
34
+ belongs_to :agent_type
35
35
  belongs_to :required_role, :class_name => 'Role', :foreign_key => 'required_role_id', :validate => true
36
36
  belongs_to :language
37
37
  belongs_to :country
38
- has_one :patron_import_result
38
+ has_one :agent_import_result
39
39
 
40
- validates_presence_of :language, :patron_type, :country
41
- validates_associated :language, :patron_type, :country
40
+ validates_presence_of :language, :agent_type, :country
41
+ validates_associated :language, :agent_type, :country
42
42
  validates :full_name, :presence => true, :length => {:maximum => 255}
43
43
  #validates :user_id, :uniqueness => true, :allow_nil => true
44
44
  validates :birth_date, :format => {:with => /\A\d+(-\d{0,2}){0,2}\z/}, :allow_blank => true
@@ -63,10 +63,10 @@ class Patron < ActiveRecord::Base
63
63
  integer :work_ids, :multiple => true
64
64
  integer :expression_ids, :multiple => true
65
65
  integer :manifestation_ids, :multiple => true
66
- integer :patron_merge_list_ids, :multiple => true if defined?(EnjuResourceMerge)
67
- integer :original_patron_ids, :multiple => true
66
+ integer :agent_merge_list_ids, :multiple => true if defined?(EnjuResourceMerge)
67
+ integer :original_agent_ids, :multiple => true
68
68
  integer :required_role_id
69
- integer :patron_type_id
69
+ integer :agent_type_id
70
70
  end
71
71
 
72
72
  paginates_per 10
@@ -213,33 +213,33 @@ class Patron < ActiveRecord::Base
213
213
  owns.where(:item_id => item.id)
214
214
  end
215
215
 
216
- def self.import_patrons(patron_lists)
217
- patrons = []
218
- patron_lists.each do |patron_list|
219
- name_and_role = patron_list[:full_name].split('||')
220
- if patron_list[:patron_identifier].present?
221
- patron = Patron.where(:patron_identifier => patron_list[:patron_identifier]).first
216
+ def self.import_agents(agent_lists)
217
+ agents = []
218
+ agent_lists.each do |agent_list|
219
+ name_and_role = agent_list[:full_name].split('||')
220
+ if agent_list[:agent_identifier].present?
221
+ agent = Agent.where(:agent_identifier => agent_list[:agent_identifier]).first
222
222
  else
223
- patron = Patron.where(:full_name => name_and_role[0]).first
223
+ agent = Agent.where(:full_name => name_and_role[0]).first
224
224
  end
225
225
  role_type = name_and_role[1].to_s.strip
226
- unless patron
227
- patron = Patron.new(
226
+ unless agent
227
+ agent = Agent.new(
228
228
  :full_name => name_and_role[0],
229
- :full_name_transcription => patron_list[:full_name_transcription],
230
- :patron_identifier => patron_list[:patron_identifier],
229
+ :full_name_transcription => agent_list[:full_name_transcription],
230
+ :agent_identifier => agent_list[:agent_identifier],
231
231
  :language_id => 1
232
232
  )
233
- patron.required_role = Role.where(:name => 'Guest').first
234
- patron.save
233
+ agent.required_role = Role.where(:name => 'Guest').first
234
+ agent.save
235
235
  end
236
- patrons << patron
236
+ agents << agent
237
237
  end
238
- patrons
238
+ agents
239
239
  end
240
240
 
241
- def patrons
242
- self.original_patrons + self.derived_patrons
241
+ def agents
242
+ self.original_agents + self.derived_agents
243
243
  end
244
244
 
245
245
  def user
@@ -249,7 +249,7 @@ end
249
249
 
250
250
  # == Schema Information
251
251
  #
252
- # Table name: patrons
252
+ # Table name: agents
253
253
  #
254
254
  # id :integer not null, primary key
255
255
  # user_id :integer
@@ -287,7 +287,7 @@ end
287
287
  # date_of_death :datetime
288
288
  # language_id :integer default(1), not null
289
289
  # country_id :integer default(1), not null
290
- # patron_type_id :integer default(1), not null
290
+ # agent_type_id :integer default(1), not null
291
291
  # lock_version :integer default(0), not null
292
292
  # note :text
293
293
  # required_role_id :integer default(1), not null
@@ -298,6 +298,6 @@ end
298
298
  # full_name_alternative_transcription :text
299
299
  # birth_date :string(255)
300
300
  # death_date :string(255)
301
- # patron_identifier :string(255)
301
+ # agent_identifier :string(255)
302
302
  #
303
303