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.
- checksums.yaml +4 -4
- data/app/controllers/creates_controller.rb +11 -11
- data/app/controllers/items_controller.rb +3 -3
- data/app/controllers/manifestations_controller.rb +14 -14
- data/app/controllers/owns_controller.rb +10 -10
- data/app/controllers/patron_import_files_controller.rb +34 -34
- data/app/controllers/patron_import_results_controller.rb +5 -5
- data/app/controllers/patron_relationship_types_controller.rb +3 -3
- data/app/controllers/patron_relationships_controller.rb +7 -7
- data/app/controllers/patron_types_controller.rb +3 -3
- data/app/controllers/patrons_controller.rb +61 -61
- data/app/controllers/picture_files_controller.rb +4 -4
- data/app/controllers/produces_controller.rb +11 -11
- data/app/controllers/realizes_controller.rb +11 -11
- data/app/helpers/{patrons_helper.rb → agents_helper.rb} +5 -5
- data/app/models/{patron.rb → agent.rb} +36 -36
- data/app/models/{patron_import_file.rb → agent_import_file.rb} +77 -77
- data/app/models/agent_import_result.rb +26 -0
- data/app/models/{patron_relationship.rb → agent_relationship.rb} +7 -7
- data/app/models/{patron_relationship_type.rb → agent_relationship_type.rb} +4 -4
- data/app/models/{patron_sweeper.rb → agent_sweeper.rb} +6 -6
- data/app/models/{patron_type.rb → agent_type.rb} +4 -4
- data/app/models/country.rb +1 -1
- data/app/models/create.rb +7 -7
- data/app/models/donate.rb +5 -5
- data/app/models/enju_biblio/ability.rb +24 -24
- data/app/models/item.rb +5 -5
- data/app/models/item_sweeper.rb +2 -2
- data/app/models/manifestation.rb +24 -20
- data/app/models/own.rb +7 -7
- data/app/models/page_sweeper.rb +4 -4
- data/app/models/picture_file.rb +1 -1
- data/app/models/produce.rb +7 -7
- data/app/models/realize.rb +7 -7
- data/app/models/resource_import_file.rb +19 -19
- data/app/views/{patron_import_files → agent_import_files}/edit.html.erb +6 -6
- data/app/views/agent_import_files/index.html.erb +40 -0
- data/app/views/{patron_import_files → agent_import_files}/new.html.erb +3 -3
- data/app/views/agent_import_files/show.html.erb +69 -0
- data/app/views/agent_import_results/index.csv.erb +3 -0
- data/app/views/agent_import_results/index.html.erb +52 -0
- data/app/views/agent_import_results/show.html.erb +38 -0
- data/app/views/{patron_relationship_types → agent_relationship_types}/_form.html.erb +1 -1
- data/app/views/{patron_relationship_types → agent_relationship_types}/edit.html.erb +3 -3
- data/app/views/agent_relationship_types/index.html.erb +43 -0
- data/app/views/{patron_relationship_types → agent_relationship_types}/new.html.erb +2 -2
- data/app/views/agent_relationship_types/show.html.erb +29 -0
- data/app/views/{patron_relationships → agent_relationships}/_form.html.erb +7 -7
- data/app/views/{patron_relationships → agent_relationships}/edit.html.erb +3 -3
- data/app/views/agent_relationships/index.html.erb +34 -0
- data/app/views/{patron_relationships → agent_relationships}/new.html.erb +2 -2
- data/app/views/agent_relationships/show.html.erb +24 -0
- data/app/views/{patron_types → agent_types}/_form.html.erb +1 -1
- data/app/views/{patron_types → agent_types}/edit.html.erb +3 -3
- data/app/views/agent_types/index.html.erb +43 -0
- data/app/views/{patron_types → agent_types}/new.html.erb +2 -2
- data/app/views/agent_types/show.html.erb +29 -0
- data/app/views/{patrons → agents}/_expression_list.html.erb +3 -3
- data/app/views/{patrons → agents}/_form.html.erb +9 -9
- data/app/views/{patrons → agents}/_form_family_name_first.html.erb +0 -0
- data/app/views/{patrons → agents}/_form_family_name_last.html.erb +0 -0
- data/app/views/{patrons → agents}/_history_list.html.erb +2 -2
- data/app/views/{patrons → agents}/_index.html.erb +9 -9
- data/app/views/{patrons → agents}/_index_expression.html.erb +15 -15
- data/app/views/{patrons → agents}/_index_manifestation.html.erb +16 -16
- data/app/views/agents/_index_patron.html.erb +71 -0
- data/app/views/agents/_index_patron_merge_list.html.erb +53 -0
- data/app/views/{patrons → agents}/_index_work.html.erb +17 -17
- data/app/views/{patrons → agents}/_manifestation_list.html.erb +3 -3
- data/app/views/agents/_patron.html.erb +13 -0
- data/app/views/agents/_patron_list.html.erb +18 -0
- data/app/views/{patrons → agents}/_work_list.html.erb +1 -1
- data/app/views/agents/edit.html.erb +16 -0
- data/app/views/agents/index.atom.builder +10 -0
- data/app/views/{patrons → agents}/index.html.erb +4 -4
- data/app/views/{patrons → agents}/index.mobile.erb +5 -5
- data/app/views/{patrons → agents}/index.rss.builder +11 -11
- data/app/views/{patrons → agents}/new.html.erb +2 -2
- data/app/views/agents/show.html.erb +152 -0
- data/app/views/{patrons → agents}/show.js.erb +0 -0
- data/app/views/agents/show.mobile.erb +69 -0
- data/app/views/creates/_form.html.erb +5 -5
- data/app/views/creates/_index.html.erb +2 -2
- data/app/views/creates/_index_patron.html.erb +6 -6
- data/app/views/creates/_index_work.html.erb +2 -2
- data/app/views/creates/index.html.erb +2 -2
- data/app/views/creates/new.html.erb +3 -3
- data/app/views/creates/show.html.erb +4 -4
- data/app/views/donates/edit.html.erb +2 -2
- data/app/views/donates/index.html.erb +2 -2
- data/app/views/donates/new.html.erb +2 -2
- data/app/views/donates/show.html.erb +2 -2
- data/app/views/items/index.html.erb +1 -1
- data/app/views/languages/index.html.erb +1 -1
- data/app/views/layouts/patrons.html.erb +2 -2
- data/app/views/manifestations/_index_form_contributor.html.erb +1 -1
- data/app/views/manifestations/_index_form_creator.html.erb +1 -1
- data/app/views/manifestations/_index_form_publisher.html.erb +1 -1
- data/app/views/manifestations/_manifestation_list.html.erb +6 -6
- data/app/views/manifestations/_show.mods.builder +4 -4
- data/app/views/manifestations/_show.rdf.builder +4 -4
- data/app/views/manifestations/_show_creators.html.erb +4 -4
- data/app/views/manifestations/_show_creators.mobile.erb +4 -4
- data/app/views/manifestations/_title.html.erb +3 -3
- data/app/views/manifestations/_title.mobile.erb +3 -3
- data/app/views/manifestations/edit.html.erb +2 -2
- data/app/views/manifestations/index.atom.builder +2 -2
- data/app/views/manifestations/index.html.erb +3 -3
- data/app/views/manifestations/index.opds.builder +2 -2
- data/app/views/manifestations/index.sru.builder +6 -6
- data/app/views/manifestations/new.html.erb +2 -2
- data/app/views/notifier/manifestation_info.en.text.erb +1 -1
- data/app/views/notifier/manifestation_info.ja.text.erb +1 -1
- data/app/views/owns/_form.html.erb +1 -1
- data/app/views/owns/index.html.erb +2 -2
- data/app/views/owns/show.html.erb +4 -4
- data/app/views/picture_files/_index.html.erb +1 -1
- data/app/views/picture_files/_index_patron.html.erb +2 -2
- data/app/views/picture_files/index.html.erb +2 -2
- data/app/views/picture_files/show.html.erb +2 -2
- data/app/views/produces/_form.html.erb +5 -5
- data/app/views/produces/_index.html.erb +2 -2
- data/app/views/produces/_index_manifestation.html.erb +3 -3
- data/app/views/produces/_index_patron.html.erb +3 -3
- data/app/views/produces/index.html.erb +2 -2
- data/app/views/produces/new.html.erb +3 -3
- data/app/views/produces/show.html.erb +4 -4
- data/app/views/realizes/_form.html.erb +5 -5
- data/app/views/realizes/_index.html.erb +2 -2
- data/app/views/realizes/_index_expression.html.erb +3 -3
- data/app/views/realizes/_index_patron.html.erb +3 -3
- data/app/views/realizes/index.html.erb +2 -2
- data/app/views/realizes/new.html.erb +3 -3
- data/app/views/realizes/show.html.erb +4 -4
- data/app/views/resource_import_results/show.html.erb +1 -1
- data/config/routes.rb +16 -16
- data/db/migrate/{001_create_patrons.rb → 001_create_agents.rb} +8 -8
- data/db/migrate/012_create_owns.rb +2 -2
- data/db/migrate/015_create_creates.rb +2 -2
- data/db/migrate/047_create_produces.rb +2 -2
- data/db/migrate/125_create_donates.rb +2 -2
- data/db/migrate/20080830154109_create_realizes.rb +2 -2
- data/db/migrate/{20080905191442_create_patron_types.rb → 20080905191442_create_agent_types.rb} +2 -2
- data/db/migrate/20081028083142_create_agent_import_files.rb +22 -0
- data/db/migrate/{20090812151902_create_patron_relationship_types.rb → 20090812151902_create_agent_relationship_types.rb} +2 -2
- data/db/migrate/20091012101112_add_dcndl_schema.rb +2 -2
- data/db/migrate/20100606073747_create_agent_relationships.rb +13 -0
- data/db/migrate/20100814091104_add_position_to_agent_relationship.rb +11 -0
- data/db/migrate/20100925074559_create_agent_import_results.rb +12 -0
- data/db/migrate/20110301121550_add_birth_date_and_death_date_to_agent.rb +11 -0
- data/db/migrate/20120413161403_add_fingerprint_to_agent_import_file.rb +5 -0
- data/db/migrate/20120413170720_add_error_message_to_agent_import_file.rb +5 -0
- data/db/migrate/20120511072422_add_agent_identifier_to_agent.rb +6 -0
- data/db/migrate/20120602141129_add_edit_mode_to_agent_import_file.rb +5 -0
- data/lib/enju_biblio/biblio_helper.rb +8 -8
- data/lib/enju_biblio/version.rb +1 -1
- data/lib/enju_biblio.rb +3 -3
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/patron_relationship_types.yml +3 -3
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/patron_types.yml +2 -2
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/patrons.yml +4 -4
- data/spec/controllers/agent_import_files_controller_spec.rb +321 -0
- data/spec/controllers/{patron_import_results_controller_spec.rb → agent_import_results_controller_spec.rb} +17 -17
- data/spec/controllers/agent_relationship_types_controller_spec.rb +445 -0
- data/spec/controllers/agent_relationships_controller_spec.rb +446 -0
- data/spec/controllers/agent_types_controller_spec.rb +447 -0
- data/spec/controllers/agents_controller_spec.rb +644 -0
- data/spec/controllers/countries_controller_spec.rb +1 -1
- data/spec/controllers/items_controller_spec.rb +4 -4
- data/spec/controllers/manifestation_relationship_types_controller_spec.rb +1 -1
- data/spec/controllers/manifestations_controller_spec.rb +4 -4
- data/spec/controllers/owns_controller_spec.rb +2 -2
- data/spec/controllers/resource_import_files_controller_spec.rb +1 -1
- data/spec/dummy/app/helpers/application_helper.rb +5 -222
- data/spec/dummy/app/models/ability.rb +31 -31
- data/spec/dummy/app/models/{local_patron.rb → local_agent.rb} +1 -1
- data/spec/dummy/app/models/user.rb +3 -3
- data/spec/dummy/config/application.rb +0 -1
- data/spec/dummy/config/environments/test.rb +1 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/035_create_reserves.rb +1 -1
- data/spec/dummy/db/migrate/20090519203307_create_participates.rb +2 -2
- data/spec/dummy/db/schema.rb +132 -132
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_delete_file.tsv +8 -0
- data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_import_file_sample1.tsv +5 -0
- data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_import_file_sample2.tsv +8 -0
- data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_import_file_sample3.tsv +5 -0
- data/spec/dummy/private/system/agent_import_files/agent_imports/000/000/004/original/agent_update_file.tsv +3 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_q76 +0 -0
- data/spec/factories/{patron.rb → agent.rb} +3 -3
- data/spec/factories/create.rb +1 -1
- data/spec/factories/donate.rb +1 -1
- data/spec/factories/own.rb +1 -1
- data/spec/factories/patron_relationship.rb +3 -3
- data/spec/factories/patron_relationship_type.rb +2 -2
- data/spec/factories/patron_type.rb +2 -2
- data/spec/factories/produce.rb +1 -1
- data/spec/factories/realize.rb +1 -1
- data/spec/fixtures/{patron_import_files.yml → agent_import_files.yml} +18 -18
- data/spec/fixtures/{patron_import_results.yml → agent_import_results.yml} +7 -7
- data/spec/fixtures/{patron_relationship_types.yml → agent_relationship_types.yml} +4 -4
- data/spec/fixtures/{patron_relationships.yml → agent_relationships.yml} +4 -4
- data/spec/fixtures/{patron_types.yml → agent_types.yml} +4 -4
- data/spec/fixtures/{patrons.yml → agents.yml} +47 -47
- data/spec/fixtures/creates.yml +8 -8
- data/spec/fixtures/donates.yml +4 -4
- data/spec/fixtures/owns.yml +3 -3
- data/spec/fixtures/picture_files.yml +1 -1
- data/spec/fixtures/produces.yml +20 -20
- data/spec/fixtures/realizes.yml +11 -11
- data/spec/fixtures/reserves.yml +1 -1
- data/spec/models/agent_import_file_spec.rb +96 -0
- data/spec/models/{patron_import_result_spec.rb → agent_import_result_spec.rb} +4 -4
- data/spec/models/{patron_relationship_spec.rb → agent_relationship_spec.rb} +3 -3
- data/spec/models/{patron_relationship_type_spec.rb → agent_relationship_type_spec.rb} +2 -2
- data/spec/models/{patron_spec.rb → agent_spec.rb} +16 -16
- data/spec/models/{patron_type_spec.rb → agent_type_spec.rb} +2 -2
- data/spec/models/create_spec.rb +1 -1
- data/spec/models/donate_spec.rb +1 -1
- data/spec/models/manifestation_spec.rb +1 -1
- data/spec/models/own_spec.rb +1 -1
- data/spec/models/produce_spec.rb +1 -1
- data/spec/models/realize_spec.rb +1 -1
- data/spec/models/resource_import_file_spec.rb +8 -8
- data/spec/requests/agents_spec.rb +9 -0
- data/spec/routing/agent_relationship_types_routing_spec.rb +35 -0
- data/spec/routing/agent_relationships_routing_spec.rb +35 -0
- data/spec/routing/agents_routing_spec.rb +35 -0
- data/spec/views/creates/edit.html.erb_spec.rb +1 -1
- data/spec/views/creates/index.html.erb_spec.rb +2 -2
- data/spec/views/creates/new.html.erb_spec.rb +1 -1
- data/spec/views/creates/show.html.erb_spec.rb +1 -1
- data/spec/views/owns/edit.html.erb_spec.rb +1 -1
- data/spec/views/owns/index.html.erb_spec.rb +2 -2
- data/spec/views/owns/new.html.erb_spec.rb +1 -1
- data/spec/views/owns/show.html.erb_spec.rb +1 -1
- data/spec/views/produces/edit.html.erb_spec.rb +2 -2
- data/spec/views/produces/index.html.erb_spec.rb +2 -2
- data/spec/views/produces/new.html.erb_spec.rb +2 -2
- data/spec/views/produces/show.html.erb_spec.rb +1 -1
- data/spec/views/realizes/edit.html.erb_spec.rb +2 -2
- data/spec/views/realizes/index.html.erb_spec.rb +2 -2
- data/spec/views/realizes/new.html.erb_spec.rb +2 -2
- data/spec/views/realizes/show.html.erb_spec.rb +1 -1
- metadata +131 -187
- data/app/models/patron_import_result.rb +0 -26
- data/app/views/patron_import_files/index.html.erb +0 -40
- data/app/views/patron_import_files/show.html.erb +0 -69
- data/app/views/patron_import_results/index.csv.erb +0 -3
- data/app/views/patron_import_results/index.html.erb +0 -52
- data/app/views/patron_import_results/show.html.erb +0 -38
- data/app/views/patron_relationship_types/index.html.erb +0 -43
- data/app/views/patron_relationship_types/show.html.erb +0 -29
- data/app/views/patron_relationships/index.html.erb +0 -34
- data/app/views/patron_relationships/show.html.erb +0 -24
- data/app/views/patron_types/index.html.erb +0 -43
- data/app/views/patron_types/show.html.erb +0 -29
- data/app/views/patrons/_index_patron.html.erb +0 -71
- data/app/views/patrons/_index_patron_merge_list.html.erb +0 -53
- data/app/views/patrons/_patron.html.erb +0 -13
- data/app/views/patrons/_patron_list.html.erb +0 -18
- data/app/views/patrons/edit.html.erb +0 -16
- data/app/views/patrons/index.atom.builder +0 -10
- data/app/views/patrons/show.html.erb +0 -152
- data/app/views/patrons/show.mobile.erb +0 -69
- data/db/migrate/20081028083142_create_patron_import_files.rb +0 -22
- data/db/migrate/20100606073747_create_patron_relationships.rb +0 -13
- data/db/migrate/20100814091104_add_position_to_patron_relationship.rb +0 -11
- data/db/migrate/20100925074559_create_patron_import_results.rb +0 -12
- data/db/migrate/20110301121550_add_birth_date_and_death_date_to_patron.rb +0 -11
- data/db/migrate/20120413161403_add_fingerprint_to_patron_import_file.rb +0 -5
- data/db/migrate/20120413170720_add_error_message_to_patron_import_file.rb +0 -5
- data/db/migrate/20120511072422_add_patron_identifier_to_patron.rb +0 -6
- data/db/migrate/20120602141129_add_edit_mode_to_patron_import_file.rb +0 -5
- data/spec/controllers/patron_import_files_controller_spec.rb +0 -321
- data/spec/controllers/patron_relationship_types_controller_spec.rb +0 -445
- data/spec/controllers/patron_relationships_controller_spec.rb +0 -446
- data/spec/controllers/patron_types_controller_spec.rb +0 -447
- data/spec/controllers/patrons_controller_spec.rb +0 -644
- data/spec/dummy/app/mailers/notifier.rb +0 -40
- data/spec/dummy/lib/plugins/ext/event-calendar.rb +0 -38
- data/spec/dummy/lib/plugins/ext/sunspot/abstract_search.rb +0 -12
- data/spec/dummy/lib/plugins/ext/sunspot/dismax.rb +0 -41
- data/spec/dummy/lib/plugins/ext/sunspot/start_record.rb +0 -55
- data/spec/dummy/lib/plugins/ext/sunspot.rb +0 -3
- data/spec/dummy/lib/plugins/ext.rb +0 -1
- data/spec/dummy/lib/plugins.rb +0 -2
- data/spec/dummy/solr/data/test/index/_goc.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_goc.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_goc.fnm +0 -7
- data/spec/dummy/solr/data/test/index/_goc.frq +0 -0
- data/spec/dummy/solr/data/test/index/_goc.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_goc.prx +0 -0
- data/spec/dummy/solr/data/test/index/_goc.tii +0 -0
- data/spec/dummy/solr/data/test/index/_goc.tis +0 -0
- data/spec/dummy/solr/data/test/index/_god.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_god.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_god.fnm +0 -7
- data/spec/dummy/solr/data/test/index/_god.frq +0 -0
- data/spec/dummy/solr/data/test/index/_god.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_god.prx +0 -0
- data/spec/dummy/solr/data/test/index/_god.tii +0 -0
- data/spec/dummy/solr/data/test/index/_god.tis +0 -0
- data/spec/dummy/solr/data/test/index/_goe.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_goe.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_goe.fnm +0 -8
- data/spec/dummy/solr/data/test/index/_goe.frq +0 -0
- data/spec/dummy/solr/data/test/index/_goe.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_goe.prx +0 -0
- data/spec/dummy/solr/data/test/index/_goe.tii +0 -0
- data/spec/dummy/solr/data/test/index/_goe.tis +0 -0
- data/spec/dummy/solr/data/test/index/segments_otc +0 -0
- data/spec/dummy/tmp/cache/4AD/470/country_all +0 -0
- data/spec/models/patron_import_file_spec.rb +0 -96
- data/spec/requests/patrons_spec.rb +0 -9
- data/spec/routing/patron_relationship_types_routing_spec.rb +0 -35
- data/spec/routing/patron_relationships_routing_spec.rb +0 -35
- data/spec/routing/patrons_routing_spec.rb +0 -35
@@ -1,27 +1,27 @@
|
|
1
|
-
class
|
2
|
-
attr_accessible :
|
1
|
+
class AgentImportFile < ActiveRecord::Base
|
2
|
+
attr_accessible :agent_import, :edit_mode
|
3
3
|
include ImportFile
|
4
|
-
default_scope :order => '
|
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 :
|
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 :
|
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 :
|
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 :
|
22
|
+
validates_attachment_presence :agent_import
|
23
23
|
belongs_to :user, :validate => true
|
24
|
-
has_many :
|
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 |
|
40
|
-
|
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 |
|
44
|
-
|
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 = {:
|
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 =
|
75
|
+
import_result = AgentImportResult.create!(:agent_import_file_id => self.id, :body => row.fields.join("\t"))
|
76
76
|
|
77
|
-
|
78
|
-
|
77
|
+
agent = Agent.new
|
78
|
+
agent = set_agent_value(agent, row)
|
79
79
|
|
80
|
-
if
|
81
|
-
import_result.
|
82
|
-
num[:
|
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.
|
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
|
-
|
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
|
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(:
|
132
|
-
#
|
133
|
-
# user.
|
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
|
-
|
138
|
-
if
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
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
|
-
|
168
|
-
if
|
169
|
-
|
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('
|
182
|
+
tempfile = Tempfile.new('agent_import_file')
|
183
183
|
if Setting.uploaded_file.storage == :s3
|
184
|
-
uploaded_file_path =
|
184
|
+
uploaded_file_path = agent_import.expiring_url(10)
|
185
185
|
else
|
186
|
-
uploaded_file_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
|
-
|
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
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
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
|
-
|
222
|
-
|
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
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
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
|
-
|
238
|
-
|
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
|
-
#
|
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
|
-
|
245
|
+
agent.language = language if language
|
246
246
|
country = Country.where(:name => row['country'].to_s.strip).first
|
247
|
-
|
248
|
-
|
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:
|
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
|
-
#
|
291
|
-
#
|
292
|
-
#
|
293
|
-
#
|
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
|
-
#
|
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
|
2
|
-
attr_accessible :parent_id, :child_id, :
|
3
|
-
belongs_to :parent, :foreign_key => 'parent_id', :class_name => '
|
4
|
-
belongs_to :child, :foreign_key => 'child_id', :class_name => '
|
5
|
-
belongs_to :
|
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:
|
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
|
-
#
|
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
|
1
|
+
class AgentRelationshipType < ActiveRecord::Base
|
2
2
|
attr_accessible :name, :display_name, :note
|
3
3
|
include MasterModel
|
4
|
-
default_scope :order => '
|
5
|
-
has_many :
|
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:
|
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
|
1
|
+
class AgentSweeper < ActionController::Caching::Sweeper
|
2
2
|
include ExpireEditableFragment
|
3
|
-
observe
|
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.
|
20
|
-
expire_editable_fragment(
|
19
|
+
record.original_agents.each do |agent|
|
20
|
+
expire_editable_fragment(agent)
|
21
21
|
end
|
22
|
-
record.
|
23
|
-
expire_editable_fragment(
|
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
|
1
|
+
class AgentType < ActiveRecord::Base
|
2
2
|
attr_accessible :name, :display_name, :note
|
3
3
|
include MasterModel
|
4
|
-
default_scope :order => "
|
5
|
-
has_many :
|
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:
|
10
|
+
# Table name: agent_types
|
11
11
|
#
|
12
12
|
# id :integer not null, primary key
|
13
13
|
# name :string(255) not null
|
data/app/models/country.rb
CHANGED
@@ -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 :
|
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 :
|
3
|
-
belongs_to :
|
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 :
|
8
|
-
validates_presence_of :
|
9
|
-
validates_uniqueness_of :work_id, :scope => :
|
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
|
-
|
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
|
-
#
|
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 :
|
3
|
-
belongs_to :
|
2
|
+
attr_accessible :agent_id, :item_id
|
3
|
+
belongs_to :agent, :validate => true
|
4
4
|
belongs_to :item, :validate => true
|
5
|
-
validates_associated :
|
6
|
-
validates_presence_of :
|
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
|
-
#
|
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
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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
|
-
|
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
|
-
|
71
|
-
|
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],
|
84
|
-
can :show,
|
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],
|
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
|
-
|
99
|
-
|
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
|
-
|
118
|
-
|
119
|
-
|
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,
|
135
|
-
can :update,
|
134
|
+
can :index, Agent
|
135
|
+
can :update, Agent do |patron|
|
136
136
|
patron.user == user
|
137
137
|
end
|
138
|
-
can :show,
|
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
|
-
|
171
|
-
|
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,
|
182
|
-
can :show,
|
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
|
-
|
204
|
-
|
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 :
|
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 => :
|
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 :
|
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(
|
73
|
-
owns.where(:
|
72
|
+
def owned(agent)
|
73
|
+
owns.where(:agent_id => agent.id).first
|
74
74
|
end
|
75
75
|
|
76
76
|
def manifestation_url
|
data/app/models/item_sweeper.rb
CHANGED
@@ -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.
|
9
|
-
expire_editable_fragment(
|
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)
|