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,27 +1,27 @@
1
- class PatronImportFile < ActiveRecord::Base
2
- attr_accessible :patron_import, :edit_mode
1
+ class AgentImportFile < ActiveRecord::Base
2
+ attr_accessible :agent_import, :edit_mode
3
3
  include ImportFile
4
- default_scope :order => 'patron_import_files.id DESC'
4
+ default_scope :order => 'agent_import_files.id DESC'
5
5
  scope :not_imported, where(:state => 'pending')
6
6
  scope :stucked, where('created_at < ? AND state = ?', 1.hour.ago, 'pending')
7
7
 
8
8
  if Setting.uploaded_file.storage == :s3
9
- has_attached_file :patron_import, :storage => :s3, :s3_credentials => "#{Rails.root.to_s}/config/s3.yml",
9
+ has_attached_file :agent_import, :storage => :s3, :s3_credentials => "#{Rails.root.to_s}/config/s3.yml",
10
10
  :s3_permissions => :private
11
11
  else
12
- has_attached_file :patron_import,
12
+ has_attached_file :agent_import,
13
13
  :path => ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
14
14
  end
15
- validates_attachment_content_type :patron_import, :content_type => [
15
+ validates_attachment_content_type :agent_import, :content_type => [
16
16
  'text/csv',
17
17
  'text/plain',
18
18
  'text/tab-separated-values',
19
19
  'application/octet-stream',
20
20
  'application/vnd.ms-excel'
21
21
  ]
22
- validates_attachment_presence :patron_import
22
+ validates_attachment_presence :agent_import
23
23
  belongs_to :user, :validate => true
24
- has_many :patron_import_results
24
+ has_many :agent_import_results
25
25
 
26
26
  state_machine :initial => :pending do
27
27
  event :sm_start do
@@ -36,12 +36,12 @@ class PatronImportFile < ActiveRecord::Base
36
36
  transition :started => :failed
37
37
  end
38
38
 
39
- before_transition any => :started do |patron_import_file|
40
- patron_import_file.executed_at = Time.zone.now
39
+ before_transition any => :started do |agent_import_file|
40
+ agent_import_file.executed_at = Time.zone.now
41
41
  end
42
42
 
43
- before_transition any => :completed do |patron_import_file|
44
- patron_import_file.error_message = nil
43
+ before_transition any => :completed do |agent_import_file|
44
+ agent_import_file.error_message = nil
45
45
  end
46
46
  end
47
47
 
@@ -61,7 +61,7 @@ class PatronImportFile < ActiveRecord::Base
61
61
 
62
62
  def import
63
63
  self.reload
64
- num = {:patron_imported => 0, :user_imported => 0, :failed => 0}
64
+ num = {:agent_imported => 0, :user_imported => 0, :failed => 0}
65
65
  row_num = 2
66
66
  rows = open_import_file
67
67
  field = rows.first
@@ -72,14 +72,14 @@ class PatronImportFile < ActiveRecord::Base
72
72
 
73
73
  rows.each do |row|
74
74
  next if row['dummy'].to_s.strip.present?
75
- import_result = PatronImportResult.create!(:patron_import_file_id => self.id, :body => row.fields.join("\t"))
75
+ import_result = AgentImportResult.create!(:agent_import_file_id => self.id, :body => row.fields.join("\t"))
76
76
 
77
- patron = Patron.new
78
- patron = set_patron_value(patron, row)
77
+ agent = Agent.new
78
+ agent = set_agent_value(agent, row)
79
79
 
80
- if patron.save!
81
- import_result.patron = patron
82
- num[:patron_imported] += 1
80
+ if agent.save!
81
+ import_result.agent = agent
82
+ num[:agent_imported] += 1
83
83
  if row_num % 50 == 0
84
84
  Sunspot.commit
85
85
  GC.start
@@ -88,7 +88,7 @@ class PatronImportFile < ActiveRecord::Base
88
88
 
89
89
  #unless row['username'].to_s.strip.blank?
90
90
  # user = User.new
91
- # user.patron = patron
91
+ # user.agent = agent
92
92
  # set_user_value(user, row)
93
93
  # if user.password.blank?
94
94
  # user.set_auto_generated_password
@@ -113,11 +113,11 @@ class PatronImportFile < ActiveRecord::Base
113
113
  end
114
114
 
115
115
  def self.import
116
- PatronImportFile.not_imported.each do |file|
116
+ AgentImportFile.not_imported.each do |file|
117
117
  file.import_start
118
118
  end
119
119
  rescue
120
- Rails.logger.info "#{Time.zone.now} importing patrons failed!"
120
+ Rails.logger.info "#{Time.zone.now} importing agents failed!"
121
121
  end
122
122
 
123
123
  def modify
@@ -128,25 +128,25 @@ class PatronImportFile < ActiveRecord::Base
128
128
  rows.each do |row|
129
129
  next if row['dummy'].to_s.strip.present?
130
130
  #user = User.where(:user_number => row['user_number'].to_s.strip).first
131
- #if user.try(:patron)
132
- # set_patron_value(user.patron, row)
133
- # user.patron.save!
131
+ #if user.try(:agent)
132
+ # set_agent_value(user.agent, row)
133
+ # user.agent.save!
134
134
  # set_user_value(user, row)
135
135
  # user.save!
136
136
  #end
137
- patron = Patron.where(:id => row['id']).first
138
- if patron
139
- patron.full_name = row['full_name'] if row['full_name'].to_s.strip.present?
140
- patron.full_name_transcription = row['full_name_transcription'] if row['full_name_transcription'].to_s.strip.present?
141
- patron.first_name = row['first_name'] if row['first_name'].to_s.strip.present?
142
- patron.first_name_transcription = row['first_name_transcription'] if row['first_name_transcription'].to_s.strip.present?
143
- patron.middle_name = row['middle_name'] if row['middle_name'].to_s.strip.present?
144
- patron.middle_name_transcription = row['middle_name_transcription'] if row['middle_name_transcription'].to_s.strip.present?
145
- patron.last_name = row['last_name'] if row['last_name'].to_s.strip.present?
146
- patron.last_name_transcription = row['last_name_transcription'] if row['last_name_transcription'].to_s.strip.present?
147
- patron.address_1 = row['address_1'] if row['address_1'].to_s.strip.present?
148
- patron.address_2 = row['address_2'] if row['address_2'].to_s.strip.present?
149
- patron.save!
137
+ agent = Agent.where(:id => row['id']).first
138
+ if agent
139
+ agent.full_name = row['full_name'] if row['full_name'].to_s.strip.present?
140
+ agent.full_name_transcription = row['full_name_transcription'] if row['full_name_transcription'].to_s.strip.present?
141
+ agent.first_name = row['first_name'] if row['first_name'].to_s.strip.present?
142
+ agent.first_name_transcription = row['first_name_transcription'] if row['first_name_transcription'].to_s.strip.present?
143
+ agent.middle_name = row['middle_name'] if row['middle_name'].to_s.strip.present?
144
+ agent.middle_name_transcription = row['middle_name_transcription'] if row['middle_name_transcription'].to_s.strip.present?
145
+ agent.last_name = row['last_name'] if row['last_name'].to_s.strip.present?
146
+ agent.last_name_transcription = row['last_name_transcription'] if row['last_name_transcription'].to_s.strip.present?
147
+ agent.address_1 = row['address_1'] if row['address_1'].to_s.strip.present?
148
+ agent.address_2 = row['address_2'] if row['address_2'].to_s.strip.present?
149
+ agent.save!
150
150
  end
151
151
  row_num += 1
152
152
  end
@@ -164,9 +164,9 @@ class PatronImportFile < ActiveRecord::Base
164
164
 
165
165
  rows.each do |row|
166
166
  next if row['dummy'].to_s.strip.present?
167
- patron = Patron.where(:id => row['id'].to_s.strip).first
168
- if patron
169
- patron.destroy
167
+ agent = Agent.where(:id => row['id'].to_s.strip).first
168
+ if agent
169
+ agent.destroy
170
170
  end
171
171
  row_num += 1
172
172
  end
@@ -179,11 +179,11 @@ class PatronImportFile < ActiveRecord::Base
179
179
 
180
180
  private
181
181
  def open_import_file
182
- tempfile = Tempfile.new('patron_import_file')
182
+ tempfile = Tempfile.new('agent_import_file')
183
183
  if Setting.uploaded_file.storage == :s3
184
- uploaded_file_path = patron_import.expiring_url(10)
184
+ uploaded_file_path = agent_import.expiring_url(10)
185
185
  else
186
- uploaded_file_path = patron_import.path
186
+ uploaded_file_path = agent_import.path
187
187
  end
188
188
  open(uploaded_file_path){|f|
189
189
  f.each{|line|
@@ -204,48 +204,48 @@ class PatronImportFile < ActiveRecord::Base
204
204
  file = CSV.open(tempfile, :col_sep => "\t")
205
205
  header = file.first
206
206
  rows = CSV.open(tempfile, :headers => header, :col_sep => "\t")
207
- PatronImportResult.create!(:patron_import_file_id => self.id, :body => header.join("\t"))
207
+ AgentImportResult.create!(:agent_import_file_id => self.id, :body => header.join("\t"))
208
208
  tempfile.close(true)
209
209
  file.close
210
210
  rows
211
211
  end
212
212
 
213
- def set_patron_value(patron, row)
214
- patron.first_name = row['first_name'] if row['first_name']
215
- patron.middle_name = row['middle_name'] if row['middle_name']
216
- patron.last_name = row['last_name'] if row['last_name']
217
- patron.first_name_transcription = row['first_name_transcription'] if row['first_name_transcription']
218
- patron.middle_name_transcription = row['middle_name_transcription'] if row['middle_name_transcription']
219
- patron.last_name_transcription = row['last_name_transcription'] if row['last_name_transcription']
213
+ def set_agent_value(agent, row)
214
+ agent.first_name = row['first_name'] if row['first_name']
215
+ agent.middle_name = row['middle_name'] if row['middle_name']
216
+ agent.last_name = row['last_name'] if row['last_name']
217
+ agent.first_name_transcription = row['first_name_transcription'] if row['first_name_transcription']
218
+ agent.middle_name_transcription = row['middle_name_transcription'] if row['middle_name_transcription']
219
+ agent.last_name_transcription = row['last_name_transcription'] if row['last_name_transcription']
220
220
 
221
- patron.full_name = row['full_name'] if row['full_name']
222
- patron.full_name_transcription = row['full_name_transcription'] if row['full_name_transcription']
221
+ agent.full_name = row['full_name'] if row['full_name']
222
+ agent.full_name_transcription = row['full_name_transcription'] if row['full_name_transcription']
223
223
 
224
- patron.address_1 = row['address_1'] if row['address_1']
225
- patron.address_2 = row['address_2'] if row['address_2']
226
- patron.zip_code_1 = row['zip_code_1'] if row['zip_code_1']
227
- patron.zip_code_2 = row['zip_code_2'] if row['zip_code_2']
228
- patron.telephone_number_1 = row['telephone_number_1'] if row['telephone_number_1']
229
- patron.telephone_number_2 = row['telephone_number_2'] if row['telephone_number_2']
230
- patron.fax_number_1 = row['fax_number_1'] if row['fax_number_1']
231
- patron.fax_number_2 = row['fax_number_2'] if row['fax_number_2']
232
- patron.note = row['note'] if row['note']
233
- patron.birth_date = row['birth_date'] if row['birth_date']
234
- patron.death_date = row['death_date'] if row['death_date']
224
+ agent.address_1 = row['address_1'] if row['address_1']
225
+ agent.address_2 = row['address_2'] if row['address_2']
226
+ agent.zip_code_1 = row['zip_code_1'] if row['zip_code_1']
227
+ agent.zip_code_2 = row['zip_code_2'] if row['zip_code_2']
228
+ agent.telephone_number_1 = row['telephone_number_1'] if row['telephone_number_1']
229
+ agent.telephone_number_2 = row['telephone_number_2'] if row['telephone_number_2']
230
+ agent.fax_number_1 = row['fax_number_1'] if row['fax_number_1']
231
+ agent.fax_number_2 = row['fax_number_2'] if row['fax_number_2']
232
+ agent.note = row['note'] if row['note']
233
+ agent.birth_date = row['birth_date'] if row['birth_date']
234
+ agent.death_date = row['death_date'] if row['death_date']
235
235
 
236
236
  #if row['username'].to_s.strip.blank?
237
- patron.email = row['email'].to_s.strip
238
- patron.required_role = Role.where(:name => row['required_role_name'].to_s.strip.camelize).first || Role.find('Guest')
237
+ agent.email = row['email'].to_s.strip
238
+ agent.required_role = Role.where(:name => row['required_role_name'].to_s.strip.camelize).first || Role.find('Guest')
239
239
  #else
240
- # patron.required_role = Role.where(:name => row['required_role_name'].to_s.strip.camelize).first || Role.find('Librarian')
240
+ # agent.required_role = Role.where(:name => row['required_role_name'].to_s.strip.camelize).first || Role.find('Librarian')
241
241
  #end
242
242
  language = Language.where(:name => row['language'].to_s.strip.camelize).first
243
243
  language = Language.where(:iso_639_2 => row['language'].to_s.strip.downcase).first unless language
244
244
  language = Language.where(:iso_639_1 => row['language'].to_s.strip.downcase).first unless language
245
- patron.language = language if language
245
+ agent.language = language if language
246
246
  country = Country.where(:name => row['country'].to_s.strip).first
247
- patron.country = country if country
248
- patron
247
+ agent.country = country if country
248
+ agent
249
249
  end
250
250
 
251
251
  #def set_user_value(user, row)
@@ -277,7 +277,7 @@ end
277
277
 
278
278
  # == Schema Information
279
279
  #
280
- # Table name: patron_import_files
280
+ # Table name: agent_import_files
281
281
  #
282
282
  # id :integer not null, primary key
283
283
  # parent_id :integer
@@ -287,13 +287,13 @@ end
287
287
  # note :text
288
288
  # executed_at :datetime
289
289
  # state :string(255)
290
- # patron_import_file_name :string(255)
291
- # patron_import_content_type :string(255)
292
- # patron_import_file_size :integer
293
- # patron_import_updated_at :datetime
290
+ # agent_import_file_name :string(255)
291
+ # agent_import_content_type :string(255)
292
+ # agent_import_file_size :integer
293
+ # agent_import_updated_at :datetime
294
294
  # created_at :datetime not null
295
295
  # updated_at :datetime not null
296
- # patron_import_fingerprint :string(255)
296
+ # agent_import_fingerprint :string(255)
297
297
  # error_message :text
298
298
  # edit_mode :string(255)
299
299
  #
@@ -0,0 +1,26 @@
1
+ class AgentImportResult < ActiveRecord::Base
2
+ attr_accessible :agent_import_file_id, :agent_id, :user_id, :body
3
+ default_scope :order => 'agent_import_results.id'
4
+ scope :file_id, proc{|file_id| where(:agent_import_file_id => file_id)}
5
+ scope :failed, where(:agent_id => nil)
6
+
7
+ belongs_to :agent_import_file
8
+ belongs_to :agent
9
+ belongs_to :user
10
+
11
+ validates_presence_of :agent_import_file_id
12
+ end
13
+
14
+ # == Schema Information
15
+ #
16
+ # Table name: agent_import_results
17
+ #
18
+ # id :integer not null, primary key
19
+ # agent_import_file_id :integer
20
+ # agent_id :integer
21
+ # user_id :integer
22
+ # body :text
23
+ # created_at :datetime not null
24
+ # updated_at :datetime not null
25
+ #
26
+
@@ -1,8 +1,8 @@
1
- class PatronRelationship < ActiveRecord::Base
2
- attr_accessible :parent_id, :child_id, :patron_relationship_type_id
3
- belongs_to :parent, :foreign_key => 'parent_id', :class_name => 'Patron'
4
- belongs_to :child, :foreign_key => 'child_id', :class_name => 'Patron'
5
- belongs_to :patron_relationship_type
1
+ class AgentRelationship < ActiveRecord::Base
2
+ attr_accessible :parent_id, :child_id, :agent_relationship_type_id
3
+ belongs_to :parent, :foreign_key => 'parent_id', :class_name => 'Agent'
4
+ belongs_to :child, :foreign_key => 'child_id', :class_name => 'Agent'
5
+ belongs_to :agent_relationship_type
6
6
  validate :check_parent
7
7
  validates_presence_of :parent_id, :child_id
8
8
  acts_as_list :scope => :parent_id
@@ -14,12 +14,12 @@ end
14
14
 
15
15
  # == Schema Information
16
16
  #
17
- # Table name: patron_relationships
17
+ # Table name: agent_relationships
18
18
  #
19
19
  # id :integer not null, primary key
20
20
  # parent_id :integer
21
21
  # child_id :integer
22
- # patron_relationship_type_id :integer
22
+ # agent_relationship_type_id :integer
23
23
  # created_at :datetime not null
24
24
  # updated_at :datetime not null
25
25
  # position :integer
@@ -1,13 +1,13 @@
1
- class PatronRelationshipType < ActiveRecord::Base
1
+ class AgentRelationshipType < ActiveRecord::Base
2
2
  attr_accessible :name, :display_name, :note
3
3
  include MasterModel
4
- default_scope :order => 'patron_relationship_types.position'
5
- has_many :patron_relationships
4
+ default_scope :order => 'agent_relationship_types.position'
5
+ has_many :agent_relationships
6
6
  end
7
7
 
8
8
  # == Schema Information
9
9
  #
10
- # Table name: patron_relationship_types
10
+ # Table name: agent_relationship_types
11
11
  #
12
12
  # id :integer not null, primary key
13
13
  # name :string(255) not null
@@ -1,6 +1,6 @@
1
- class PatronSweeper < ActionController::Caching::Sweeper
1
+ class AgentSweeper < ActionController::Caching::Sweeper
2
2
  include ExpireEditableFragment
3
- observe Patron
3
+ observe Agent
4
4
 
5
5
  def after_save(record)
6
6
  expire_editable_fragment(record)
@@ -16,11 +16,11 @@ class PatronSweeper < ActionController::Caching::Sweeper
16
16
  record.donated_items.each do |item|
17
17
  expire_editable_fragment(item)
18
18
  end
19
- record.original_patrons.each do |patron|
20
- expire_editable_fragment(patron)
19
+ record.original_agents.each do |agent|
20
+ expire_editable_fragment(agent)
21
21
  end
22
- record.derived_patrons.each do |patron|
23
- expire_editable_fragment(patron)
22
+ record.derived_agents.each do |agent|
23
+ expire_editable_fragment(agent)
24
24
  end
25
25
  end
26
26
 
@@ -1,13 +1,13 @@
1
- class PatronType < ActiveRecord::Base
1
+ class AgentType < ActiveRecord::Base
2
2
  attr_accessible :name, :display_name, :note
3
3
  include MasterModel
4
- default_scope :order => "patron_types.position"
5
- has_many :patrons
4
+ default_scope :order => "agent_types.position"
5
+ has_many :agents
6
6
  end
7
7
 
8
8
  # == Schema Information
9
9
  #
10
- # Table name: patron_types
10
+ # Table name: agent_types
11
11
  #
12
12
  # id :integer not null, primary key
13
13
  # name :string(255) not null
@@ -2,7 +2,7 @@ class Country < ActiveRecord::Base
2
2
  attr_accessible :name, :display_name, :alpha_2, :alpha_3, :numeric_3, :note
3
3
  include MasterModel
4
4
  default_scope :order => "countries.position"
5
- has_many :patrons
5
+ has_many :agents
6
6
  #has_many :people
7
7
  #has_many :corporate_bodies
8
8
  #has_many :families
data/app/models/create.rb CHANGED
@@ -1,19 +1,19 @@
1
1
  class Create < ActiveRecord::Base
2
- attr_accessible :patron_id, :work_id, :create_type_id, :position
3
- belongs_to :patron
2
+ attr_accessible :agent_id, :work_id, :create_type_id, :position
3
+ belongs_to :agent
4
4
  belongs_to :work, :class_name => 'Manifestation', :foreign_key => 'work_id'
5
5
  belongs_to :create_type
6
6
 
7
- validates_associated :patron, :work
8
- validates_presence_of :patron_id, :work_id
9
- validates_uniqueness_of :work_id, :scope => :patron_id
7
+ validates_associated :agent, :work
8
+ validates_presence_of :agent_id, :work_id
9
+ validates_uniqueness_of :work_id, :scope => :agent_id
10
10
  after_save :reindex
11
11
  after_destroy :reindex
12
12
 
13
13
  acts_as_list :scope => :work
14
14
 
15
15
  def reindex
16
- patron.try(:index)
16
+ agent.try(:index)
17
17
  work.try(:index)
18
18
  end
19
19
  end
@@ -23,7 +23,7 @@ end
23
23
  # Table name: creates
24
24
  #
25
25
  # id :integer not null, primary key
26
- # patron_id :integer not null
26
+ # agent_id :integer not null
27
27
  # work_id :integer not null
28
28
  # position :integer
29
29
  # created_at :datetime not null
data/app/models/donate.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  class Donate < ActiveRecord::Base
2
- attr_accessible :patron_id, :item_id
3
- belongs_to :patron, :validate => true
2
+ attr_accessible :agent_id, :item_id
3
+ belongs_to :agent, :validate => true
4
4
  belongs_to :item, :validate => true
5
- validates_associated :patron, :item
6
- validates_presence_of :patron, :item
5
+ validates_associated :agent, :item
6
+ validates_presence_of :agent, :item
7
7
  end
8
8
 
9
9
  # == Schema Information
@@ -11,7 +11,7 @@ end
11
11
  # Table name: donates
12
12
  #
13
13
  # id :integer not null, primary key
14
- # patron_id :integer not null
14
+ # agent_id :integer not null
15
15
  # item_id :integer not null
16
16
  # created_at :datetime not null
17
17
  # updated_at :datetime not null
@@ -31,10 +31,10 @@ module EnjuBiblio
31
31
  ManifestationRelationship,
32
32
  ManifestationRelationshipType,
33
33
  Own,
34
- Patron,
35
- PatronImportFile,
36
- PatronRelationship,
37
- PatronRelationshipType,
34
+ Agent,
35
+ AgentImportFile,
36
+ AgentRelationship,
37
+ AgentRelationshipType,
38
38
  PictureFile,
39
39
  Produce,
40
40
  ProduceType,
@@ -52,7 +52,7 @@ module EnjuBiblio
52
52
  Language,
53
53
  License,
54
54
  MediumOfPerformance,
55
- PatronType,
55
+ AgentType,
56
56
  RequestStatusType,
57
57
  RequestType
58
58
  ] if LibraryGroup.site_config.network_access_allowed?(ip_address)
@@ -67,8 +67,8 @@ module EnjuBiblio
67
67
  Language,
68
68
  License,
69
69
  MediumOfPerformance,
70
- PatronImportResult,
71
- PatronType,
70
+ AgentImportResult,
71
+ AgentType,
72
72
  RequestStatusType,
73
73
  RequestType,
74
74
  ResourceImportResult
@@ -80,11 +80,11 @@ module EnjuBiblio
80
80
  can [:destroy, :delete], Manifestation do |manifestation|
81
81
  manifestation.items.empty? and !manifestation.series_master?
82
82
  end
83
- can [:index, :create], Patron
84
- can :show, Patron do |patron|
83
+ can [:index, :create], Agent
84
+ can :show, Agent do |patron|
85
85
  patron.required_role_id <= 3
86
86
  end
87
- can [:update, :destroy, :delete], Patron do |patron|
87
+ can [:update, :destroy, :delete], Agent do |patron|
88
88
  !patron.user.try(:has_role?, 'Librarian') and patron.required_role_id <= 3
89
89
  end
90
90
  can :manage, [
@@ -95,8 +95,8 @@ module EnjuBiblio
95
95
  ImportRequest,
96
96
  ManifestationRelationship,
97
97
  Own,
98
- PatronImportFile,
99
- PatronRelationship,
98
+ AgentImportFile,
99
+ AgentRelationship,
100
100
  PictureFile,
101
101
  Produce,
102
102
  Realize,
@@ -114,9 +114,9 @@ module EnjuBiblio
114
114
  Language,
115
115
  License,
116
116
  ManifestationRelationshipType,
117
- PatronImportResult,
118
- PatronRelationshipType,
119
- PatronType,
117
+ AgentImportResult,
118
+ AgentRelationshipType,
119
+ AgentType,
120
120
  RequestStatusType,
121
121
  RequestType,
122
122
  ResourceImportResult,
@@ -131,11 +131,11 @@ module EnjuBiblio
131
131
  can [:show, :edit], Manifestation do |manifestation|
132
132
  manifestation.required_role_id <= 2
133
133
  end
134
- can :index, Patron
135
- can :update, Patron do |patron|
134
+ can :index, Agent
135
+ can :update, Agent do |patron|
136
136
  patron.user == user
137
137
  end
138
- can :show, Patron do |patron|
138
+ can :show, Agent do |patron|
139
139
  #if patron.user == user
140
140
  # true
141
141
  #elsif patron.user != user
@@ -167,8 +167,8 @@ module EnjuBiblio
167
167
  ManifestationRelationshipType,
168
168
  MediumOfPerformance,
169
169
  Own,
170
- PatronRelationship,
171
- PatronRelationshipType,
170
+ AgentRelationship,
171
+ AgentRelationshipType,
172
172
  Produce,
173
173
  Realize,
174
174
  SeriesStatement
@@ -178,8 +178,8 @@ module EnjuBiblio
178
178
  can :show, Manifestation do |manifestation|
179
179
  manifestation.required_role_id == 1
180
180
  end
181
- can :index, Patron
182
- can :show, Patron do |patron|
181
+ can :index, Agent
182
+ can :show, Agent do |patron|
183
183
  patron.required_role_id == 1 #name == 'Guest'
184
184
  end
185
185
  can :read, [
@@ -200,8 +200,8 @@ module EnjuBiblio
200
200
  ManifestationRelationshipType,
201
201
  MediumOfPerformance,
202
202
  Own,
203
- PatronRelationship,
204
- PatronRelationshipType,
203
+ AgentRelationship,
204
+ AgentRelationshipType,
205
205
  PictureFile,
206
206
  Produce,
207
207
  Realize,
data/app/models/item.rb CHANGED
@@ -15,11 +15,11 @@ class Item < ActiveRecord::Base
15
15
  has_one :exemplify, :dependent => :destroy
16
16
  has_one :manifestation, :through => :exemplify
17
17
  has_many :owns
18
- has_many :patrons, :through => :owns
18
+ has_many :agents, :through => :owns
19
19
  delegate :display_name, :to => :shelf, :prefix => true
20
20
  belongs_to :bookstore, :validate => true
21
21
  has_many :donates
22
- has_many :donors, :through => :donates, :source => :patron
22
+ has_many :donors, :through => :donates, :source => :agent
23
23
  belongs_to :required_role, :class_name => 'Role', :foreign_key => 'required_role_id', :validate => true
24
24
  has_one :resource_import_result
25
25
  belongs_to :budget_type
@@ -43,7 +43,7 @@ class Item < ActiveRecord::Base
43
43
  manifestation.id if manifestation
44
44
  end
45
45
  integer :shelf_id
46
- integer :patron_ids, :multiple => true
46
+ integer :agent_ids, :multiple => true
47
47
  time :created_at
48
48
  time :updated_at
49
49
  time :acquired_at
@@ -69,8 +69,8 @@ class Item < ActiveRecord::Base
69
69
  manifestation.try(:publisher)
70
70
  end
71
71
 
72
- def owned(patron)
73
- owns.where(:patron_id => patron.id).first
72
+ def owned(agent)
73
+ owns.where(:agent_id => agent.id).first
74
74
  end
75
75
 
76
76
  def manifestation_url
@@ -5,8 +5,8 @@ class ItemSweeper < ActionController::Caching::Sweeper
5
5
  def after_save(record)
6
6
  expire_editable_fragment(record)
7
7
  expire_editable_fragment(record.manifestation)
8
- record.patrons.each do |patron|
9
- expire_editable_fragment(patron)
8
+ record.agents.each do |agent|
9
+ expire_editable_fragment(agent)
10
10
  end
11
11
  record.donors.each do |donor|
12
12
  expire_editable_fragment(donor)