enju_biblio 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/manifestations_controller.rb +1 -1
- data/app/jobs/agent_import_file_job.rb +1 -1
- data/app/jobs/resource_export_file_job.rb +1 -1
- data/app/jobs/resource_import_file_job.rb +1 -1
- data/app/mailers/agent_import_mailer.rb +17 -0
- data/app/mailers/resource_export_mailer.rb +17 -0
- data/app/mailers/resource_import_mailer.rb +17 -0
- data/app/models/agent.rb +4 -4
- data/app/models/agent_import_file.rb +13 -1
- data/app/models/agent_import_file_transition.rb +1 -1
- data/app/models/agent_import_result.rb +1 -1
- data/app/models/agent_merge.rb +1 -1
- data/app/models/agent_merge_list.rb +1 -1
- data/app/models/agent_relationship.rb +1 -1
- data/app/models/agent_relationship_type.rb +1 -1
- data/app/models/agent_type.rb +1 -1
- data/app/models/carrier_type.rb +1 -1
- data/app/models/content_type.rb +1 -1
- data/app/models/country.rb +1 -1
- data/app/models/create.rb +1 -1
- data/app/models/create_type.rb +1 -1
- data/app/models/donate.rb +1 -1
- data/app/models/form_of_work.rb +1 -1
- data/app/models/frequency.rb +1 -1
- data/app/models/identifier.rb +1 -1
- data/app/models/identifier_type.rb +1 -1
- data/app/models/import_request.rb +1 -1
- data/app/models/import_request_transition.rb +1 -1
- data/app/models/item.rb +3 -3
- data/app/models/language.rb +2 -18
- data/app/models/license.rb +1 -1
- data/app/models/manifestation.rb +16 -4
- data/app/models/manifestation_relationship.rb +1 -1
- data/app/models/manifestation_relationship_type.rb +1 -1
- data/app/models/medium_of_performance.rb +1 -1
- data/app/models/own.rb +1 -1
- data/app/models/picture_file.rb +1 -1
- data/app/models/produce.rb +1 -1
- data/app/models/produce_type.rb +1 -1
- data/app/models/realize.rb +1 -1
- data/app/models/realize_type.rb +1 -1
- data/app/models/resource_export_file.rb +6 -4
- data/app/models/resource_export_file_transition.rb +1 -1
- data/app/models/resource_import_file.rb +30 -6
- data/app/models/resource_import_file_transition.rb +1 -1
- data/app/models/resource_import_result.rb +1 -1
- data/app/models/series_statement.rb +1 -1
- data/app/models/series_statement_merge.rb +1 -1
- data/app/models/series_statement_merge_list.rb +1 -1
- data/app/views/agent_import_mailer/completed.en.text.erb +9 -0
- data/app/views/agent_import_mailer/completed.ja.text.erb +9 -0
- data/app/views/agent_import_mailer/failed.en.text +9 -0
- data/app/views/agent_import_mailer/failed.ja.text.erb +9 -0
- data/app/views/items/show.html+phone.erb +0 -9
- data/app/views/items/show.html.erb +0 -12
- data/app/views/manifestations/_manifestation.json.jbuilder +53 -0
- data/app/views/manifestations/index.json.jbuilder +6 -0
- data/app/views/picture_files/edit.html.erb +2 -22
- data/app/views/resource_export_mailer/completed.en.text.erb +9 -0
- data/app/views/resource_export_mailer/completed.ja.text.erb +9 -0
- data/app/views/resource_export_mailer/failed.en.text.erb +9 -0
- data/app/views/resource_export_mailer/failed.ja.text.erb +9 -0
- data/app/views/resource_import_mailer/completed.en.text.erb +9 -0
- data/app/views/resource_import_mailer/completed.ja.text.erb +9 -0
- data/app/views/resource_import_mailer/failed.en.text.erb +9 -0
- data/app/views/resource_import_mailer/failed.ja.text.erb +9 -0
- data/config/locales/translation_en.yml +11 -0
- data/config/locales/translation_ja.yml +11 -0
- data/lib/enju_biblio/version.rb +1 -1
- data/spec/controllers/items_controller_spec.rb +0 -37
- data/spec/dummy/app/jobs/application_job.rb +7 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/user.rb +1 -7
- data/spec/dummy/config/application.rb +2 -1
- data/spec/dummy/db/migrate/029_create_subjects.rb +3 -6
- data/spec/dummy/db/migrate/032_create_checkins.rb +3 -6
- data/spec/dummy/db/migrate/033_create_checkouts.rb +6 -11
- data/spec/dummy/db/migrate/035_create_reserves.rb +4 -9
- data/spec/dummy/db/migrate/121_create_checked_items.rb +3 -4
- data/spec/dummy/db/migrate/129_create_item_has_use_restrictions.rb +2 -4
- data/spec/dummy/db/migrate/20081030023518_create_user_group_has_checkout_types.rb +2 -4
- data/spec/dummy/db/migrate/20081030023615_create_carrier_type_has_checkout_types.rb +2 -3
- data/spec/dummy/db/migrate/20081212075554_create_checkout_stat_has_manifestations.rb +2 -2
- data/spec/dummy/db/migrate/20081215094955_create_checkout_stat_has_users.rb +2 -4
- data/spec/dummy/db/migrate/20081216190517_create_reserve_stat_has_manifestations.rb +2 -2
- data/spec/dummy/db/migrate/20081220034117_create_reserve_stat_has_users.rb +2 -4
- data/spec/dummy/db/migrate/20090831220301_create_lending_policies.rb +3 -3
- data/spec/dummy/db/migrate/20100606065209_create_user_has_roles.rb +2 -4
- data/spec/dummy/db/migrate/20110627122938_add_number_of_day_to_notify_overdue_to_user_group.rb +2 -2
- data/spec/dummy/db/migrate/20111129044509_add_pickup_location_to_reserve.rb +6 -0
- data/spec/dummy/db/migrate/20120424103932_add_librarian_id_to_checked_item.rb +1 -1
- data/spec/dummy/db/migrate/20130221154434_add_additional_attributes_to_user.rb +1 -1
- data/spec/dummy/db/migrate/20140122054321_create_profiles.rb +4 -5
- data/spec/dummy/db/migrate/20140518050147_create_reserve_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20140528045518_create_user_checkout_stat_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20140528045539_create_user_reserve_stat_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20140528045600_create_manifestation_checkout_stat_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20140528045617_create_manifestation_reserve_stat_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20140810061942_add_user_id_to_user_checkout_stat.rb +4 -8
- data/spec/dummy/db/migrate/20141014065831_add_shelf_id_to_checkout.rb +1 -2
- data/spec/dummy/db/migrate/20141020120523_add_library_id_to_checkout.rb +5 -0
- data/spec/dummy/db/migrate/20150106001709_create_demands.rb +11 -0
- data/spec/dummy/db/migrate/20150421023923_create_identities.rb +14 -0
- data/spec/dummy/db/migrate/20150923173139_add_url_to_classification.rb +5 -0
- data/spec/dummy/db/migrate/20150925092505_add_label_to_classification.rb +5 -0
- data/spec/dummy/db/migrate/20151126005552_add_provider_to_identity.rb +5 -0
- data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +4 -11
- data/spec/dummy/db/migrate/20180107160726_add_constraints_to_most_recent_for_user_import_file_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20180107160740_add_constraints_to_most_recent_for_user_export_file_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20180107161035_add_constraints_to_most_recent_for_reserve_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107161951_add_constraints_to_most_recent_for_user_checkout_stat_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107162009_add_constraints_to_most_recent_for_user_reserve_stat_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107162029_add_constraints_to_most_recent_for_manifestation_checkout_stat_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107162048_add_constraints_to_most_recent_for_manifestation_reserve_stat_transitions.rb +13 -0
- data/spec/dummy/db/schema.rb +51 -12
- data/spec/factories/agent.rb +1 -1
- data/spec/factories/identifier.rb +1 -0
- data/spec/factories/item.rb +0 -1
- data/spec/fixtures/reserve_transitions.yml +23 -7
- data/spec/mailers/agent_import_spec.rb +5 -0
- data/spec/mailers/previews/agent_import_preview.rb +4 -0
- data/spec/mailers/previews/resource_export_preview.rb +4 -0
- data/spec/mailers/previews/resource_import_preview.rb +4 -0
- data/spec/mailers/resource_export_spec.rb +5 -0
- data/spec/mailers/resource_import_spec.rb +5 -0
- data/spec/models/agent_spec.rb +1 -1
- data/spec/models/item_spec.rb +0 -41
- data/spec/models/manifestation_spec.rb +0 -32
- data/spec/models/resource_export_file_spec.rb +2 -26
- data/spec/models/resource_import_file_spec.rb +2 -2
- data/spec/policies/manifestation_policy_spec.rb +2 -5
- data/spec/views/items/index.html.erb_spec.rb +3 -10
- data/spec/views/manifestations/show.html.erb_spec.rb +1 -5
- metadata +121 -26
- data/spec/factories/checkout.rb +0 -9
- data/spec/fixtures/checked_items.yml +0 -35
- data/spec/fixtures/checkins.yml +0 -48
- data/spec/fixtures/checkouts.yml +0 -162
- data/spec/fixtures/item_has_use_restrictions.yml +0 -61
- data/spec/fixtures/lending_policies.yml +0 -92
data/app/models/produce.rb
CHANGED
data/app/models/produce_type.rb
CHANGED
data/app/models/realize.rb
CHANGED
data/app/models/realize_type.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
class ResourceExportFile <
|
1
|
+
class ResourceExportFile < ApplicationRecord
|
2
2
|
include Statesman::Adapters::ActiveRecordQueries
|
3
3
|
include ExportFile
|
4
4
|
|
@@ -37,12 +37,14 @@ class ResourceExportFile < ActiveRecord::Base
|
|
37
37
|
end
|
38
38
|
tempfile.close
|
39
39
|
self.resource_export = File.new(tempfile.path, "r")
|
40
|
-
|
41
|
-
send_message
|
42
|
-
end
|
40
|
+
save!
|
43
41
|
transition_to!(:completed)
|
42
|
+
mailer = ResourceExportMailer.completed(self)
|
43
|
+
send_message(mailer)
|
44
44
|
rescue => e
|
45
45
|
transition_to!(:failed)
|
46
|
+
mailer = ResourceExportMailer.failed(self)
|
47
|
+
send_message(mailer)
|
46
48
|
raise e
|
47
49
|
end
|
48
50
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class ResourceImportFile <
|
1
|
+
class ResourceImportFile < ApplicationRecord
|
2
2
|
include Statesman::Adapters::ActiveRecordQueries
|
3
3
|
include ImportFile
|
4
4
|
default_scope { order('resource_import_files.id DESC') }
|
@@ -216,13 +216,16 @@ class ResourceImportFile < ActiveRecord::Base
|
|
216
216
|
Sunspot.commit
|
217
217
|
rows.close
|
218
218
|
transition_to!(:completed)
|
219
|
-
|
219
|
+
mailer = ResourceImportMailer.completed(self)
|
220
|
+
send_message(mailer)
|
220
221
|
Rails.cache.write("manifestation_search_total", Manifestation.search.total)
|
221
222
|
num
|
222
223
|
rescue => e
|
223
224
|
self.error_message = "line #{row_num}: #{e.message}"
|
224
225
|
save
|
225
226
|
transition_to!(:failed)
|
227
|
+
mailer = ResourceImportMailer.failed(self)
|
228
|
+
send_message(mailer)
|
226
229
|
raise e
|
227
230
|
end
|
228
231
|
|
@@ -314,12 +317,16 @@ class ResourceImportFile < ActiveRecord::Base
|
|
314
317
|
if item.manifestation
|
315
318
|
fetch(row, edit_mode: 'update')
|
316
319
|
end
|
320
|
+
|
321
|
+
if defined?(EnjuCirculation)
|
322
|
+
circulation_status = CirculationStatus.find_by(name: row['circulation_status'])
|
323
|
+
checkout_type = CheckoutType.find_by(name: row['checkout_type'])
|
324
|
+
use_restriction = UseRestriction.find_by(name: row['use_restriction'].to_s.strip)
|
325
|
+
end
|
326
|
+
|
317
327
|
shelf = Shelf.find_by(name: row['shelf'].to_s.strip)
|
318
|
-
circulation_status = CirculationStatus.find_by(name: row['circulation_status'])
|
319
|
-
checkout_type = CheckoutType.find_by(name: row['checkout_type'])
|
320
328
|
bookstore = Bookstore.find_by(name: row['bookstore'])
|
321
329
|
required_role = Role.find_by(name: row['required_role'])
|
322
|
-
use_restriction = UseRestriction.find_by(name: row['use_restriction'].to_s.strip)
|
323
330
|
|
324
331
|
item.shelf = shelf if shelf
|
325
332
|
item.circulation_status = circulation_status if circulation_status
|
@@ -371,10 +378,14 @@ class ResourceImportFile < ActiveRecord::Base
|
|
371
378
|
import_result.save!
|
372
379
|
end
|
373
380
|
transition_to!(:completed)
|
381
|
+
mailer = ResourceImportMailer.completed(self)
|
382
|
+
send_message(mailer)
|
374
383
|
rescue => e
|
375
384
|
self.error_message = "line #{row_num}: #{e.message}"
|
376
385
|
save
|
377
386
|
transition_to!(:failed)
|
387
|
+
mailer = ResourceImportMailer.failed(self)
|
388
|
+
send_message(mailer)
|
378
389
|
raise e
|
379
390
|
end
|
380
391
|
|
@@ -393,10 +404,14 @@ class ResourceImportFile < ActiveRecord::Base
|
|
393
404
|
end
|
394
405
|
end
|
395
406
|
transition_to!(:completed)
|
407
|
+
mailer = ResourceImportMailer.completed(self)
|
408
|
+
send_message(mailer)
|
396
409
|
rescue => e
|
397
410
|
self.error_message = "line #{row_num}: #{e.message}"
|
398
411
|
save
|
399
412
|
transition_to!(:failed)
|
413
|
+
mailer = ResourceImportMailer.failed(self)
|
414
|
+
send_message(mailer)
|
400
415
|
raise e
|
401
416
|
end
|
402
417
|
|
@@ -431,6 +446,15 @@ class ResourceImportFile < ActiveRecord::Base
|
|
431
446
|
row_num += 1
|
432
447
|
end
|
433
448
|
transition_to!(:completed)
|
449
|
+
mailer = ResourceImportMailer.completed(self)
|
450
|
+
send_message(mailer)
|
451
|
+
rescue => e
|
452
|
+
self.error_message = "line #{row_num}: #{e.message}"
|
453
|
+
save
|
454
|
+
transition_to!(:failed)
|
455
|
+
mailer = ResourceImportMailer.failed(self)
|
456
|
+
send_message(mailer)
|
457
|
+
raise e
|
434
458
|
end
|
435
459
|
|
436
460
|
private
|
@@ -754,7 +778,7 @@ class ResourceImportFile < ActiveRecord::Base
|
|
754
778
|
def set_identifier(row)
|
755
779
|
identifiers = []
|
756
780
|
%w(isbn issn doi jpno ncid).each do |id_type|
|
757
|
-
if row[
|
781
|
+
if row[id_type.to_s].present?
|
758
782
|
row[id_type].split(/\/\//).each do |identifier_s|
|
759
783
|
import_id = Identifier.new(body: identifier_s)
|
760
784
|
identifier_type = IdentifierType.find_by(name: id_type)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class ResourceImportResult <
|
1
|
+
class ResourceImportResult < ApplicationRecord
|
2
2
|
default_scope { order('resource_import_results.id') }
|
3
3
|
scope :file_id, proc{|file_id| where(resource_import_file_id: file_id)}
|
4
4
|
scope :failed, -> { where(manifestation_id: nil) }
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class SeriesStatement <
|
1
|
+
class SeriesStatement < ApplicationRecord
|
2
2
|
has_many :series_statement_merges, dependent: :destroy
|
3
3
|
has_many :series_statement_merge_lists, through: :series_statement_merges
|
4
4
|
belongs_to :manifestation, touch: true, optional: true
|
@@ -20,15 +20,6 @@
|
|
20
20
|
<%= @item.checkout_type.display_name.localize -%>
|
21
21
|
</p>
|
22
22
|
|
23
|
-
<p>
|
24
|
-
<strong><%= t('activerecord.models.lending_policy') -%>:</strong>
|
25
|
-
<ul>
|
26
|
-
<%- @item.lending_policies.each do |lending_policy| -%>
|
27
|
-
<li><%= lending_policy.user_group.display_name.localize -%></li>
|
28
|
-
<%- end -%>
|
29
|
-
</ul>
|
30
|
-
</p>
|
31
|
-
|
32
23
|
<p>
|
33
24
|
<strong><%= t('activerecord.models.circulation_status') -%>:</strong>
|
34
25
|
<%= @item.circulation_status.display_name.localize -%>
|
@@ -32,15 +32,6 @@
|
|
32
32
|
<%= link_to @item.checkout_type.display_name.localize, @item.checkout_type -%>
|
33
33
|
</p>
|
34
34
|
|
35
|
-
<p>
|
36
|
-
<strong><%= t('activerecord.models.lending_policy') -%>:</strong>
|
37
|
-
<ul>
|
38
|
-
<%- @item.lending_policies.each do |lending_policy| -%>
|
39
|
-
<li><%= link_to lending_policy.user_group.display_name.localize, lending_policy -%></li>
|
40
|
-
<%- end -%>
|
41
|
-
</ul>
|
42
|
-
</p>
|
43
|
-
|
44
35
|
<p>
|
45
36
|
<strong><%= t('activerecord.models.circulation_status') -%>:</strong>
|
46
37
|
<%= link_to @item.circulation_status.display_name.localize, @item.circulation_status -%>
|
@@ -152,9 +143,6 @@
|
|
152
143
|
<%- end -%>
|
153
144
|
<% end %>
|
154
145
|
<% if defined?(EnjuCirculation) %>
|
155
|
-
<% if policy(LendingPolicy).index? %>
|
156
|
-
<li><%= link_to t('page.listing', model: t('activerecord.models.lending_policy')), lending_policies_path(item_id: @item.id) -%></li>
|
157
|
-
<% end %>
|
158
146
|
<% if policy(Checkout).index? %>
|
159
147
|
<li><%= link_to t('page.checkout_history'), checkouts_path(item_id: @item.id) -%></li>
|
160
148
|
<% end %>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
json.id manifestation.id
|
2
|
+
json.original_title manifestation.original_title
|
3
|
+
json.title_alternative manifestation.title_alternative
|
4
|
+
json.title_transcription manifestation.title_transcription
|
5
|
+
json.title_alternative_transcription manifestation.title_alternative_transcription
|
6
|
+
json.pub_date manifestation.pub_date
|
7
|
+
json.statement_of_responsibility manifestation.statement_of_responsibility
|
8
|
+
json.creators do
|
9
|
+
json.array!(manifestation.creators) do |creator|
|
10
|
+
json.full_name creator.full_name
|
11
|
+
end
|
12
|
+
end
|
13
|
+
json.contributors do
|
14
|
+
json.array!(manifestation.contributors) do |contributor|
|
15
|
+
json.full_name contributor.full_name
|
16
|
+
end
|
17
|
+
end
|
18
|
+
json.publishers do
|
19
|
+
json.array!(manifestation.publishers) do |publisher|
|
20
|
+
json.full_name publisher.full_name
|
21
|
+
end
|
22
|
+
end
|
23
|
+
json.publication_place manifestation.publication_place
|
24
|
+
json.extent manifestation.extent
|
25
|
+
json.dimensions manifestation.dimensions
|
26
|
+
json.identifiers do
|
27
|
+
json.array!(manifestation.identifiers) do |identifier|
|
28
|
+
json.identifier_type identifier.identifier_type.name
|
29
|
+
json.body identifier.body
|
30
|
+
end
|
31
|
+
end
|
32
|
+
json.subjects do
|
33
|
+
json.array!(manifestation.subjects) do |subject|
|
34
|
+
json.subject_heading_type subject.subject_heading_type.name
|
35
|
+
json.term subject.term
|
36
|
+
end
|
37
|
+
end
|
38
|
+
json.classfifications do
|
39
|
+
json.array!(manifestation.classifications) do |classification|
|
40
|
+
json.classification_type classification.classification_type.name
|
41
|
+
json.term classification.category
|
42
|
+
end
|
43
|
+
end
|
44
|
+
json.access_address manifestation.access_address
|
45
|
+
json.items do
|
46
|
+
json.array!(manifestation.items.available.on_shelf) do |item|
|
47
|
+
json.item_identifier item.item_identifier
|
48
|
+
json.shelf item.shelf.display_name
|
49
|
+
json.circulation_status item.circulation_status.display_name if defined?(EnjuCirculationStatus)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
json.created_at manifestation.created_at
|
53
|
+
json.updated_at manifestation.updated_at
|
@@ -6,28 +6,8 @@
|
|
6
6
|
<%= f.error_messages -%>
|
7
7
|
|
8
8
|
<div class="field">
|
9
|
-
<%= f.label
|
10
|
-
<%= f.
|
11
|
-
</div>
|
12
|
-
|
13
|
-
<div class="field">
|
14
|
-
<%= f.label t('page.attachable') -%><br />
|
15
|
-
<%= f.text_field :picture_attachable_id -%>
|
16
|
-
</div>
|
17
|
-
|
18
|
-
<div class="field">
|
19
|
-
<%= f.label :picture_file_size -%><br />
|
20
|
-
<%= f.text_field :picture_file_size -%>
|
21
|
-
</div>
|
22
|
-
|
23
|
-
<div class="field">
|
24
|
-
<%= f.label :picture_content_type -%><br />
|
25
|
-
<%= f.text_field :picture_content_type -%>
|
26
|
-
</div>
|
27
|
-
|
28
|
-
<div class="field">
|
29
|
-
<%= f.label :picture_file_name -%><br />
|
30
|
-
<%= f.text_field :picture_file_name -%>
|
9
|
+
<%= f.label t('page.file') -%><br />
|
10
|
+
<%= f.file_field :picture -%>
|
31
11
|
</div>
|
32
12
|
|
33
13
|
<div class="actions">
|