enju_biblio 0.1.0.pre10 → 0.1.0.pre11
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/accept.rb +4 -3
- data/app/models/carrier_type.rb +4 -4
- data/app/models/content_type.rb +4 -4
- data/app/models/country.rb +2 -2
- data/app/models/create.rb +5 -6
- data/app/models/create_type.rb +3 -3
- data/app/models/donate.rb +5 -5
- data/app/models/exemplify.rb +5 -15
- data/app/models/extent.rb +4 -4
- data/app/models/form_of_work.rb +4 -4
- data/app/models/frequency.rb +4 -4
- data/app/models/import_request.rb +3 -3
- data/app/models/item.rb +13 -11
- data/app/models/language.rb +2 -2
- data/app/models/license.rb +4 -4
- data/app/models/manifestation.rb +55 -30
- data/app/models/manifestation_relationship.rb +3 -3
- data/app/models/manifestation_relationship_type.rb +4 -4
- data/app/models/medium_of_performance.rb +4 -4
- data/app/models/own.rb +5 -5
- data/app/models/patron.rb +10 -10
- data/app/models/patron_import_file.rb +11 -5
- data/app/models/patron_import_result.rb +3 -3
- data/app/models/patron_relationship.rb +3 -3
- data/app/models/patron_relationship_type.rb +4 -4
- data/app/models/patron_type.rb +4 -4
- data/app/models/picture_file.rb +3 -3
- data/app/models/produce.rb +5 -6
- data/app/models/produce_type.rb +3 -3
- data/app/models/realize.rb +5 -6
- data/app/models/realize_type.rb +3 -3
- data/app/models/resource_import_file.rb +64 -14
- data/app/models/resource_import_result.rb +3 -3
- data/app/models/series_has_manifestation.rb +3 -3
- data/app/models/series_statement.rb +16 -8
- data/app/models/series_statement_relationship.rb +13 -0
- data/db/migrate/20120516020924_add_online_isbn_to_manifestation.rb +5 -0
- data/db/migrate/20121116031206_add_fulltext_content_to_manifestation.rb +5 -0
- data/db/migrate/20121116033446_add_doi_to_manifestation.rb +6 -0
- data/db/migrate/20121119153944_add_manifestation_id_to_item.rb +5 -0
- data/lib/enju_biblio/version.rb +1 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20090831220301_create_lending_policies.rb +1 -1
- data/spec/dummy/db/schema.rb +13 -11
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_b72 +0 -0
- data/spec/fixtures/carrier_types.yml +4 -4
- data/spec/fixtures/content_types.yml +4 -4
- data/spec/fixtures/countries.yml +2 -2
- data/spec/fixtures/create_types.yml +3 -3
- data/spec/fixtures/creates.yml +5 -6
- data/spec/fixtures/donates.yml +5 -5
- data/spec/fixtures/exemplifies.yml +5 -6
- data/spec/fixtures/extents.yml +4 -4
- data/spec/fixtures/form_of_works.yml +4 -4
- data/spec/fixtures/frequencies.yml +4 -4
- data/spec/fixtures/import_requests.yml +3 -3
- data/spec/fixtures/items.yml +12 -10
- data/spec/fixtures/languages.yml +3 -3
- data/spec/fixtures/licenses.yml +4 -4
- data/spec/fixtures/manifestation_relationship_types.yml +4 -4
- data/spec/fixtures/manifestation_relationships.yml +3 -3
- data/spec/fixtures/manifestations.yml +17 -21
- data/spec/fixtures/medium_of_performances.yml +4 -4
- data/spec/fixtures/owns.yml +5 -5
- data/spec/fixtures/patron_import_files.yml +3 -3
- data/spec/fixtures/patron_import_results.yml +3 -3
- data/spec/fixtures/patron_relationship_types.yml +4 -4
- data/spec/fixtures/patron_relationships.yml +3 -3
- data/spec/fixtures/patron_types.yml +4 -4
- data/spec/fixtures/patrons.yml +10 -14
- data/spec/fixtures/picture_files.yml +3 -3
- data/spec/fixtures/produce_types.yml +3 -3
- data/spec/fixtures/produces.yml +5 -6
- data/spec/fixtures/realize_types.yml +3 -3
- data/spec/fixtures/realizes.yml +5 -6
- data/spec/fixtures/resource_import_files.yml +3 -3
- data/spec/fixtures/resource_import_results.yml +3 -3
- data/spec/fixtures/series_has_manifestations.yml +3 -3
- data/spec/fixtures/series_statements.yml +4 -5
- data/spec/fixtures/user_group_has_checkout_types.yml +1 -1
- data/spec/models/accept_spec.rb +4 -3
- data/spec/models/carrier_type_spec.rb +4 -4
- data/spec/models/content_type_spec.rb +4 -4
- data/spec/models/country_spec.rb +2 -2
- data/spec/models/create_spec.rb +5 -6
- data/spec/models/create_type_spec.rb +3 -3
- data/spec/models/donate_spec.rb +5 -5
- data/spec/models/exemplify_spec.rb +5 -5
- data/spec/models/extent_spec.rb +4 -4
- data/spec/models/form_of_work_spec.rb +4 -4
- data/spec/models/frequency_spec.rb +4 -4
- data/spec/models/import_request_spec.rb +3 -3
- data/spec/models/item_spec.rb +20 -10
- data/spec/models/language_spec.rb +2 -2
- data/spec/models/license_spec.rb +4 -4
- data/spec/models/manifestation_relationship_spec.rb +3 -3
- data/spec/models/manifestation_relationship_type_spec.rb +4 -4
- data/spec/models/manifestation_spec.rb +17 -14
- data/spec/models/medium_of_performance_spec.rb +4 -4
- data/spec/models/own_spec.rb +5 -5
- data/spec/models/patron_import_file_spec.rb +3 -3
- data/spec/models/patron_import_result_spec.rb +3 -3
- data/spec/models/patron_relationship_spec.rb +3 -3
- data/spec/models/patron_relationship_type_spec.rb +4 -4
- data/spec/models/patron_spec.rb +10 -15
- data/spec/models/patron_type_spec.rb +4 -4
- data/spec/models/picture_file_spec.rb +3 -3
- data/spec/models/produce_spec.rb +5 -6
- data/spec/models/produce_type_spec.rb +3 -3
- data/spec/models/realize_spec.rb +5 -6
- data/spec/models/realize_type_spec.rb +3 -3
- data/spec/models/resource_import_file_spec.rb +3 -3
- data/spec/models/resource_import_result_spec.rb +3 -3
- data/spec/models/series_has_manifestation_spec.rb +3 -3
- data/spec/models/series_statement_relationship_spec.rb +13 -0
- data/spec/models/series_statement_spec.rb +4 -5
- metadata +10 -6
- data/spec/dummy/solr/data/test/index/segments_8fm +0 -0
@@ -12,7 +12,13 @@ class PatronImportFile < ActiveRecord::Base
|
|
12
12
|
has_attached_file :patron_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 :patron_import, :content_type => [
|
16
|
+
'text/csv',
|
17
|
+
'text/plain',
|
18
|
+
'text/tab-separated-values',
|
19
|
+
'application/octet-stream',
|
20
|
+
'application/vnd.ms-excel'
|
21
|
+
]
|
16
22
|
validates_attachment_presence :patron_import
|
17
23
|
belongs_to :user, :validate => true
|
18
24
|
has_many :patron_import_results
|
@@ -183,7 +189,7 @@ class PatronImportFile < ActiveRecord::Base
|
|
183
189
|
f.each{|line|
|
184
190
|
if defined?(CharlockHolmes::EncodingDetector)
|
185
191
|
begin
|
186
|
-
string = line.encode('UTF-8', CharlockHolmes::EncodingDetector.detect[:encoding])
|
192
|
+
string = line.encode('UTF-8', CharlockHolmes::EncodingDetector.detect(line)[:encoding])
|
187
193
|
rescue StandardError
|
188
194
|
string = NKF.nkf('-w -Lu', line)
|
189
195
|
end
|
@@ -273,7 +279,7 @@ end
|
|
273
279
|
#
|
274
280
|
# Table name: patron_import_files
|
275
281
|
#
|
276
|
-
# id :integer
|
282
|
+
# id :integer not null, primary key
|
277
283
|
# parent_id :integer
|
278
284
|
# content_type :string(255)
|
279
285
|
# size :integer
|
@@ -285,8 +291,8 @@ end
|
|
285
291
|
# patron_import_content_type :string(255)
|
286
292
|
# patron_import_file_size :integer
|
287
293
|
# patron_import_updated_at :datetime
|
288
|
-
# created_at :datetime
|
289
|
-
# updated_at :datetime
|
294
|
+
# created_at :datetime not null
|
295
|
+
# updated_at :datetime not null
|
290
296
|
# patron_import_fingerprint :string(255)
|
291
297
|
# error_message :text
|
292
298
|
# edit_mode :string(255)
|
@@ -15,12 +15,12 @@ end
|
|
15
15
|
#
|
16
16
|
# Table name: patron_import_results
|
17
17
|
#
|
18
|
-
# id :integer
|
18
|
+
# id :integer not null, primary key
|
19
19
|
# patron_import_file_id :integer
|
20
20
|
# patron_id :integer
|
21
21
|
# user_id :integer
|
22
22
|
# body :text
|
23
|
-
# created_at :datetime
|
24
|
-
# updated_at :datetime
|
23
|
+
# created_at :datetime not null
|
24
|
+
# updated_at :datetime not null
|
25
25
|
#
|
26
26
|
|
@@ -16,12 +16,12 @@ end
|
|
16
16
|
#
|
17
17
|
# Table name: patron_relationships
|
18
18
|
#
|
19
|
-
# id :integer
|
19
|
+
# id :integer not null, primary key
|
20
20
|
# parent_id :integer
|
21
21
|
# child_id :integer
|
22
22
|
# patron_relationship_type_id :integer
|
23
|
-
# created_at :datetime
|
24
|
-
# updated_at :datetime
|
23
|
+
# created_at :datetime not null
|
24
|
+
# updated_at :datetime not null
|
25
25
|
# position :integer
|
26
26
|
#
|
27
27
|
|
@@ -9,12 +9,12 @@ end
|
|
9
9
|
#
|
10
10
|
# Table name: patron_relationship_types
|
11
11
|
#
|
12
|
-
# id :integer
|
13
|
-
# name :string(255)
|
12
|
+
# id :integer not null, primary key
|
13
|
+
# name :string(255) not null
|
14
14
|
# display_name :text
|
15
15
|
# note :text
|
16
16
|
# position :integer
|
17
|
-
# created_at :datetime
|
18
|
-
# updated_at :datetime
|
17
|
+
# created_at :datetime not null
|
18
|
+
# updated_at :datetime not null
|
19
19
|
#
|
20
20
|
|
data/app/models/patron_type.rb
CHANGED
@@ -9,12 +9,12 @@ end
|
|
9
9
|
#
|
10
10
|
# Table name: patron_types
|
11
11
|
#
|
12
|
-
# id :integer
|
13
|
-
# name :string(255)
|
12
|
+
# id :integer not null, primary key
|
13
|
+
# name :string(255) not null
|
14
14
|
# display_name :text
|
15
15
|
# note :text
|
16
16
|
# position :integer
|
17
|
-
# created_at :datetime
|
18
|
-
# updated_at :datetime
|
17
|
+
# created_at :datetime not null
|
18
|
+
# updated_at :datetime not null
|
19
19
|
#
|
20
20
|
|
data/app/models/picture_file.rb
CHANGED
@@ -29,15 +29,15 @@ end
|
|
29
29
|
#
|
30
30
|
# Table name: picture_files
|
31
31
|
#
|
32
|
-
# id :integer
|
32
|
+
# id :integer not null, primary key
|
33
33
|
# picture_attachable_id :integer
|
34
34
|
# picture_attachable_type :string(255)
|
35
35
|
# content_type :string(255)
|
36
36
|
# title :text
|
37
37
|
# thumbnail :string(255)
|
38
38
|
# position :integer
|
39
|
-
# created_at :datetime
|
40
|
-
# updated_at :datetime
|
39
|
+
# created_at :datetime not null
|
40
|
+
# updated_at :datetime not null
|
41
41
|
# picture_file_name :string(255)
|
42
42
|
# picture_content_type :string(255)
|
43
43
|
# picture_file_size :integer
|
data/app/models/produce.rb
CHANGED
@@ -19,17 +19,16 @@ class Produce < ActiveRecord::Base
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
22
|
# == Schema Information
|
24
23
|
#
|
25
24
|
# Table name: produces
|
26
25
|
#
|
27
|
-
# id :integer
|
28
|
-
# patron_id :integer
|
29
|
-
# manifestation_id :integer
|
26
|
+
# id :integer not null, primary key
|
27
|
+
# patron_id :integer not null
|
28
|
+
# manifestation_id :integer not null
|
30
29
|
# position :integer
|
31
|
-
# created_at :datetime
|
32
|
-
# updated_at :datetime
|
30
|
+
# created_at :datetime not null
|
31
|
+
# updated_at :datetime not null
|
33
32
|
# produce_type_id :integer
|
34
33
|
#
|
35
34
|
|
data/app/models/produce_type.rb
CHANGED
@@ -8,12 +8,12 @@ end
|
|
8
8
|
#
|
9
9
|
# Table name: produce_types
|
10
10
|
#
|
11
|
-
# id :integer
|
11
|
+
# id :integer not null, primary key
|
12
12
|
# name :string(255)
|
13
13
|
# display_name :text
|
14
14
|
# note :text
|
15
15
|
# position :integer
|
16
|
-
# created_at :datetime
|
17
|
-
# updated_at :datetime
|
16
|
+
# created_at :datetime not null
|
17
|
+
# updated_at :datetime not null
|
18
18
|
#
|
19
19
|
|
data/app/models/realize.rb
CHANGED
@@ -18,17 +18,16 @@ class Realize < ActiveRecord::Base
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
21
|
# == Schema Information
|
23
22
|
#
|
24
23
|
# Table name: realizes
|
25
24
|
#
|
26
|
-
# id :integer
|
27
|
-
# patron_id :integer
|
28
|
-
# expression_id :integer
|
25
|
+
# id :integer not null, primary key
|
26
|
+
# patron_id :integer not null
|
27
|
+
# expression_id :integer not null
|
29
28
|
# position :integer
|
30
|
-
# created_at :datetime
|
31
|
-
# updated_at :datetime
|
29
|
+
# created_at :datetime not null
|
30
|
+
# updated_at :datetime not null
|
32
31
|
# realize_type_id :integer
|
33
32
|
#
|
34
33
|
|
data/app/models/realize_type.rb
CHANGED
@@ -8,12 +8,12 @@ end
|
|
8
8
|
#
|
9
9
|
# Table name: realize_types
|
10
10
|
#
|
11
|
-
# id :integer
|
11
|
+
# id :integer not null, primary key
|
12
12
|
# name :string(255)
|
13
13
|
# display_name :text
|
14
14
|
# note :text
|
15
15
|
# position :integer
|
16
|
-
# created_at :datetime
|
17
|
-
# updated_at :datetime
|
16
|
+
# created_at :datetime not null
|
17
|
+
# updated_at :datetime not null
|
18
18
|
#
|
19
19
|
|
@@ -13,7 +13,13 @@ class ResourceImportFile < ActiveRecord::Base
|
|
13
13
|
has_attached_file :resource_import,
|
14
14
|
:path => ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
|
15
15
|
end
|
16
|
-
validates_attachment_content_type :resource_import, :content_type => [
|
16
|
+
validates_attachment_content_type :resource_import, :content_type => [
|
17
|
+
'text/csv',
|
18
|
+
'text/plain',
|
19
|
+
'text/tab-separated-values',
|
20
|
+
'application/octet-stream',
|
21
|
+
'application/vnd.ms-excel'
|
22
|
+
]
|
17
23
|
validates_attachment_presence :resource_import
|
18
24
|
belongs_to :user, :validate => true
|
19
25
|
has_many :resource_import_results
|
@@ -63,7 +69,7 @@ class ResourceImportFile < ActiveRecord::Base
|
|
63
69
|
row_num = 2
|
64
70
|
|
65
71
|
field = rows.first
|
66
|
-
if [field['isbn'], field['original_title']].reject{|field| field.to_s.strip == ""}.empty?
|
72
|
+
if [field['print_isbn'], field['online_isbn'], field['isbn'], field['original_title']].reject{|field| field.to_s.strip == ""}.empty?
|
67
73
|
raise "You should specify isbn or original_tile in the first line"
|
68
74
|
end
|
69
75
|
|
@@ -90,13 +96,21 @@ class ResourceImportFile < ActiveRecord::Base
|
|
90
96
|
end
|
91
97
|
|
92
98
|
unless manifestation
|
93
|
-
if row['
|
99
|
+
if row['online_isbn'].present?
|
100
|
+
isbn = StdNum::ISBN.normalize(row['online_isbn'])
|
101
|
+
m = Manifestation.find_by_isbn(isbn)
|
102
|
+
end
|
103
|
+
if row['print_isbn'].present? and !m
|
104
|
+
isbn = StdNum::ISBN.normalize(row['print_isbn'])
|
105
|
+
m = Manifestation.find_by_isbn(isbn)
|
106
|
+
end
|
107
|
+
if row['isbn'].present? and !m
|
94
108
|
isbn = StdNum::ISBN.normalize(row['isbn'])
|
95
109
|
m = Manifestation.find_by_isbn(isbn)
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
110
|
+
end
|
111
|
+
if m
|
112
|
+
unless m.series_statement
|
113
|
+
manifestation = m
|
100
114
|
end
|
101
115
|
end
|
102
116
|
end
|
@@ -129,6 +143,18 @@ class ResourceImportFile < ActiveRecord::Base
|
|
129
143
|
import_result.item = create_item(row, manifestation)
|
130
144
|
manifestation.index
|
131
145
|
else
|
146
|
+
if manifestation.try(:fulltext_content?)
|
147
|
+
item = Item.new
|
148
|
+
item.circulation_status = CirculationStatus.where(:name => 'Available On Shelf').first
|
149
|
+
item.shelf = Shelf.web
|
150
|
+
begin
|
151
|
+
item.acquired_at = Time.zone.parse(row['acquired_at'].to_s.strip)
|
152
|
+
rescue ArgumentError
|
153
|
+
end
|
154
|
+
item.manifestation_id = manifestation.id
|
155
|
+
item.save!
|
156
|
+
manifestation.items << item
|
157
|
+
end
|
132
158
|
num[:failed] += 1
|
133
159
|
end
|
134
160
|
|
@@ -346,7 +372,7 @@ class ResourceImportFile < ActiveRecord::Base
|
|
346
372
|
f.each{|line|
|
347
373
|
if defined?(CharlockHolmes::EncodingDetector)
|
348
374
|
begin
|
349
|
-
string = line.encode('UTF-8', CharlockHolmes::EncodingDetector.detect[:encoding])
|
375
|
+
string = line.encode('UTF-8', CharlockHolmes::EncodingDetector.detect(line)[:encoding])
|
350
376
|
rescue StandardError
|
351
377
|
string = NKF.nkf('-w -Lu', line)
|
352
378
|
end
|
@@ -437,10 +463,23 @@ class ResourceImportFile < ActiveRecord::Base
|
|
437
463
|
return nil
|
438
464
|
end
|
439
465
|
|
440
|
-
lisbn = Lisbn.new(row['
|
466
|
+
lisbn = Lisbn.new(row['print_isbn'].to_s.strip)
|
441
467
|
if lisbn.isbn.valid?
|
442
468
|
isbn = lisbn.isbn
|
443
469
|
end
|
470
|
+
|
471
|
+
unless isbn
|
472
|
+
lisbn = Lisbn.new(row['isbn'].to_s.strip)
|
473
|
+
if lisbn.isbn.valid?
|
474
|
+
isbn = lisbn.isbn
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
online_lisbn = Lisbn.new(row['online_isbn'].to_s.strip)
|
479
|
+
if online_lisbn.isbn.valid?
|
480
|
+
online_isbn = lisbn.isbn
|
481
|
+
end
|
482
|
+
|
444
483
|
# TODO: 小数点以下の表現
|
445
484
|
width = NKF.nkf('-eZ1', row['width'].to_s).gsub(/\D/, '').to_i
|
446
485
|
height = NKF.nkf('-eZ1', row['height'].to_s).gsub(/\D/, '').to_i
|
@@ -449,6 +488,8 @@ class ResourceImportFile < ActiveRecord::Base
|
|
449
488
|
language = Language.where(:name => row['language'].to_s.strip.camelize).first
|
450
489
|
language = Language.where(:iso_639_2 => row['language'].to_s.strip.downcase).first unless language
|
451
490
|
language = Language.where(:iso_639_1 => row['language'].to_s.strip.downcase).first unless language
|
491
|
+
|
492
|
+
carrier_type = CarrierType.where(:name => row['carrier_type'].to_s.strip).first
|
452
493
|
|
453
494
|
if end_page >= 1
|
454
495
|
start_page = 1
|
@@ -457,6 +498,10 @@ class ResourceImportFile < ActiveRecord::Base
|
|
457
498
|
end_page = nil
|
458
499
|
end
|
459
500
|
|
501
|
+
if row['fulltext_content'].to_s.strip == "t"
|
502
|
+
fulltext_content = true
|
503
|
+
end
|
504
|
+
|
460
505
|
creators = row['creator'].to_s.split('//')
|
461
506
|
creator_transcriptions = row['creator_transcription'].to_s.split('//')
|
462
507
|
creators_list = creators.zip(creator_transcriptions).map{|f,t| {:full_name => f.to_s.strip, :full_name_transcription => t.to_s.strip}}
|
@@ -501,6 +546,7 @@ class ResourceImportFile < ActiveRecord::Base
|
|
501
546
|
:title_alternative => title[:title_alternative],
|
502
547
|
:title_alternative_transcription => title[:title_alternative_transcription],
|
503
548
|
:isbn => isbn,
|
549
|
+
:online_isbn => online_isbn,
|
504
550
|
:wrong_isbn => row['wrong_isbn'],
|
505
551
|
:issn => row['issn'],
|
506
552
|
:lccn => row['lccn'],
|
@@ -521,8 +567,10 @@ class ResourceImportFile < ActiveRecord::Base
|
|
521
567
|
:note => row['note'],
|
522
568
|
:start_page => start_page,
|
523
569
|
:end_page => end_page,
|
524
|
-
:access_address => row['
|
525
|
-
:
|
570
|
+
:access_address => row['access_address'],
|
571
|
+
:doi => row['doi'],
|
572
|
+
:manifestation_identifier => row['manifestation_identifier'],
|
573
|
+
:fulltext_content => fulltext_content
|
526
574
|
}.delete_if{|key, value| value.nil?}
|
527
575
|
manifestation = self.class.import_manifestation(expression, publisher_patrons, attributes,
|
528
576
|
{
|
@@ -543,6 +591,8 @@ class ResourceImportFile < ActiveRecord::Base
|
|
543
591
|
manifestation.language = Language.where(:name => 'unknown').first unless manifestation.language
|
544
592
|
end
|
545
593
|
|
594
|
+
manifestation.carrier_type = carrier_type if carrier_type
|
595
|
+
|
546
596
|
manifestation.series_statement = series_statement if series_statement
|
547
597
|
manifestation.save!
|
548
598
|
|
@@ -614,7 +664,7 @@ end
|
|
614
664
|
#
|
615
665
|
# Table name: resource_import_files
|
616
666
|
#
|
617
|
-
# id :integer
|
667
|
+
# id :integer not null, primary key
|
618
668
|
# parent_id :integer
|
619
669
|
# content_type :string(255)
|
620
670
|
# size :integer
|
@@ -626,8 +676,8 @@ end
|
|
626
676
|
# resource_import_content_type :string(255)
|
627
677
|
# resource_import_file_size :integer
|
628
678
|
# resource_import_updated_at :datetime
|
629
|
-
# created_at :datetime
|
630
|
-
# updated_at :datetime
|
679
|
+
# created_at :datetime not null
|
680
|
+
# updated_at :datetime not null
|
631
681
|
# edit_mode :string(255)
|
632
682
|
# resource_import_fingerprint :string(255)
|
633
683
|
# error_message :text
|
@@ -15,12 +15,12 @@ end
|
|
15
15
|
#
|
16
16
|
# Table name: resource_import_results
|
17
17
|
#
|
18
|
-
# id :integer
|
18
|
+
# id :integer not null, primary key
|
19
19
|
# resource_import_file_id :integer
|
20
20
|
# manifestation_id :integer
|
21
21
|
# item_id :integer
|
22
22
|
# body :text
|
23
|
-
# created_at :datetime
|
24
|
-
# updated_at :datetime
|
23
|
+
# created_at :datetime not null
|
24
|
+
# updated_at :datetime not null
|
25
25
|
#
|
26
26
|
|
@@ -25,11 +25,11 @@ end
|
|
25
25
|
#
|
26
26
|
# Table name: series_has_manifestations
|
27
27
|
#
|
28
|
-
# id :integer
|
28
|
+
# id :integer not null, primary key
|
29
29
|
# series_statement_id :integer
|
30
30
|
# manifestation_id :integer
|
31
31
|
# position :integer
|
32
|
-
# created_at :datetime
|
33
|
-
# updated_at :datetime
|
32
|
+
# created_at :datetime not null
|
33
|
+
# updated_at :datetime not null
|
34
34
|
#
|
35
35
|
|
@@ -3,6 +3,7 @@ class SeriesStatement < ActiveRecord::Base
|
|
3
3
|
:numbering_subseries, :title_transcription, :title_alternative,
|
4
4
|
:series_statement_identifier, :issn, :periodical, :note,
|
5
5
|
:title_subseries_transcription
|
6
|
+
attr_accessible :url, :frequency_id
|
6
7
|
|
7
8
|
has_many :series_has_manifestations, :dependent => :destroy
|
8
9
|
has_many :manifestations, :through => :series_has_manifestations
|
@@ -11,7 +12,7 @@ class SeriesStatement < ActiveRecord::Base
|
|
11
12
|
has_many :parent_relationships, :foreign_key => 'child_id', :class_name => 'SeriesStatementRelationship', :dependent => :destroy
|
12
13
|
has_many :children, :through => :child_relationships, :source => :child
|
13
14
|
has_many :parents, :through => :parent_relationships, :source => :parent
|
14
|
-
|
15
|
+
belongs_to :frequency
|
15
16
|
validates_presence_of :original_title
|
16
17
|
validate :check_issn
|
17
18
|
before_save :create_root_manifestation, :destroy_root_manifestation
|
@@ -42,7 +43,16 @@ class SeriesStatement < ActiveRecord::Base
|
|
42
43
|
paginates_per 10
|
43
44
|
|
44
45
|
def last_issue
|
45
|
-
manifestations.where('date_of_publication IS NOT NULL').order('date_of_publication DESC').first
|
46
|
+
issue = manifestations.where('date_of_publication IS NOT NULL').order('date_of_publication DESC').first
|
47
|
+
unless issue
|
48
|
+
issues = manifestations.order('manifestations.id DESC').limit(2)
|
49
|
+
if issues[0] == root_manifestation
|
50
|
+
issue = issues[1]
|
51
|
+
else
|
52
|
+
issue = issues[0]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
issue
|
46
56
|
end
|
47
57
|
|
48
58
|
def check_issn
|
@@ -99,25 +109,23 @@ class SeriesStatement < ActiveRecord::Base
|
|
99
109
|
end
|
100
110
|
end
|
101
111
|
|
102
|
-
|
103
|
-
|
104
112
|
# == Schema Information
|
105
113
|
#
|
106
114
|
# Table name: series_statements
|
107
115
|
#
|
108
|
-
# id :integer
|
116
|
+
# id :integer not null, primary key
|
109
117
|
# original_title :text
|
110
118
|
# numbering :text
|
111
119
|
# title_subseries :text
|
112
120
|
# numbering_subseries :text
|
113
121
|
# position :integer
|
114
|
-
# created_at :datetime
|
115
|
-
# updated_at :datetime
|
122
|
+
# created_at :datetime not null
|
123
|
+
# updated_at :datetime not null
|
116
124
|
# title_transcription :text
|
117
125
|
# title_alternative :text
|
118
126
|
# series_statement_identifier :string(255)
|
119
127
|
# issn :string(255)
|
120
|
-
# periodical :boolean
|
128
|
+
# periodical :boolean default(FALSE), not null
|
121
129
|
# root_manifestation_id :integer
|
122
130
|
# note :text
|
123
131
|
# title_subseries_transcription :text
|
@@ -15,3 +15,16 @@ class SeriesStatementRelationship < ActiveRecord::Base
|
|
15
15
|
Sunspot.commit
|
16
16
|
end
|
17
17
|
end
|
18
|
+
|
19
|
+
# == Schema Information
|
20
|
+
#
|
21
|
+
# Table name: series_statement_relationships
|
22
|
+
#
|
23
|
+
# id :integer not null, primary key
|
24
|
+
# parent_id :integer
|
25
|
+
# child_id :integer
|
26
|
+
# position :integer
|
27
|
+
# created_at :datetime not null
|
28
|
+
# updated_at :datetime not null
|
29
|
+
#
|
30
|
+
|
data/lib/enju_biblio/version.rb
CHANGED
Binary file
|
@@ -6,7 +6,7 @@ class CreateLendingPolicies < ActiveRecord::Migration
|
|
6
6
|
t.integer :loan_period, :default => 0, :null => false
|
7
7
|
t.datetime :fixed_due_date
|
8
8
|
t.integer :renewal, :default => 0, :null => false
|
9
|
-
t.
|
9
|
+
t.integer :fine, :default => 0, :null => false
|
10
10
|
t.text :note
|
11
11
|
t.integer :position
|
12
12
|
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20121119153944) do
|
15
15
|
|
16
16
|
create_table "accepts", :force => true do |t|
|
17
17
|
t.integer "basket_id"
|
@@ -440,6 +440,7 @@ ActiveRecord::Schema.define(:version => 20120728204337) do
|
|
440
440
|
t.datetime "acquired_at"
|
441
441
|
t.integer "bookstore_id"
|
442
442
|
t.integer "budget_type_id"
|
443
|
+
t.integer "manifestation_id"
|
443
444
|
end
|
444
445
|
|
445
446
|
add_index "items", ["bookstore_id"], :name => "index_items_on_bookstore_id"
|
@@ -466,16 +467,16 @@ ActiveRecord::Schema.define(:version => 20120728204337) do
|
|
466
467
|
add_index "languages", ["name"], :name => "index_languages_on_name", :unique => true
|
467
468
|
|
468
469
|
create_table "lending_policies", :force => true do |t|
|
469
|
-
t.integer "item_id",
|
470
|
-
t.integer "user_group_id",
|
471
|
-
t.integer "loan_period", :default => 0,
|
470
|
+
t.integer "item_id", :null => false
|
471
|
+
t.integer "user_group_id", :null => false
|
472
|
+
t.integer "loan_period", :default => 0, :null => false
|
472
473
|
t.datetime "fixed_due_date"
|
473
|
-
t.integer "renewal", :default => 0,
|
474
|
-
t.
|
474
|
+
t.integer "renewal", :default => 0, :null => false
|
475
|
+
t.integer "fine", :default => 0, :null => false
|
475
476
|
t.text "note"
|
476
477
|
t.integer "position"
|
477
|
-
t.datetime "created_at",
|
478
|
-
t.datetime "updated_at",
|
478
|
+
t.datetime "created_at", :null => false
|
479
|
+
t.datetime "updated_at", :null => false
|
479
480
|
end
|
480
481
|
|
481
482
|
add_index "lending_policies", ["item_id", "user_group_id"], :name => "index_lending_policies_on_item_id_and_user_group_id", :unique => true
|
@@ -645,18 +646,19 @@ ActiveRecord::Schema.define(:version => 20120728204337) do
|
|
645
646
|
t.integer "year_of_publication"
|
646
647
|
t.text "attachment_meta"
|
647
648
|
t.integer "month_of_publication"
|
649
|
+
t.string "online_isbn"
|
650
|
+
t.boolean "fulltext_content"
|
651
|
+
t.string "doi"
|
648
652
|
end
|
649
653
|
|
650
654
|
add_index "manifestations", ["access_address"], :name => "index_manifestations_on_access_address"
|
651
|
-
add_index "manifestations", ["
|
652
|
-
add_index "manifestations", ["frequency_id"], :name => "index_manifestations_on_frequency_id"
|
655
|
+
add_index "manifestations", ["doi"], :name => "index_manifestations_on_doi"
|
653
656
|
add_index "manifestations", ["isbn"], :name => "index_manifestations_on_isbn"
|
654
657
|
add_index "manifestations", ["issn"], :name => "index_manifestations_on_issn"
|
655
658
|
add_index "manifestations", ["lccn"], :name => "index_manifestations_on_lccn"
|
656
659
|
add_index "manifestations", ["manifestation_identifier"], :name => "index_manifestations_on_manifestation_identifier"
|
657
660
|
add_index "manifestations", ["nbn"], :name => "index_manifestations_on_nbn"
|
658
661
|
add_index "manifestations", ["oclc_number"], :name => "index_manifestations_on_oclc_number"
|
659
|
-
add_index "manifestations", ["required_role_id"], :name => "index_manifestations_on_required_role_id"
|
660
662
|
add_index "manifestations", ["updated_at"], :name => "index_manifestations_on_updated_at"
|
661
663
|
|
662
664
|
create_table "medium_of_performances", :force => true do |t|
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
Binary file
|
Binary file
|
@@ -40,12 +40,12 @@ carrier_type_00003:
|
|
40
40
|
#
|
41
41
|
# Table name: carrier_types
|
42
42
|
#
|
43
|
-
# id :integer
|
44
|
-
# name :string(255)
|
43
|
+
# id :integer not null, primary key
|
44
|
+
# name :string(255) not null
|
45
45
|
# display_name :text
|
46
46
|
# note :text
|
47
47
|
# position :integer
|
48
|
-
# created_at :datetime
|
49
|
-
# updated_at :datetime
|
48
|
+
# created_at :datetime not null
|
49
|
+
# updated_at :datetime not null
|
50
50
|
#
|
51
51
|
|
@@ -25,12 +25,12 @@ three:
|
|
25
25
|
#
|
26
26
|
# Table name: content_types
|
27
27
|
#
|
28
|
-
# id :integer
|
29
|
-
# name :string(255)
|
28
|
+
# id :integer not null, primary key
|
29
|
+
# name :string(255) not null
|
30
30
|
# display_name :text
|
31
31
|
# note :text
|
32
32
|
# position :integer
|
33
|
-
# created_at :datetime
|
34
|
-
# updated_at :datetime
|
33
|
+
# created_at :datetime not null
|
34
|
+
# updated_at :datetime not null
|
35
35
|
#
|
36
36
|
|