enju_biblio 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/items_controller.rb +5 -1
- data/app/controllers/manifestations_controller.rb +16 -13
- data/app/controllers/picture_files_controller.rb +2 -2
- data/app/helpers/manifestations_helper.rb +9 -5
- data/app/models/item.rb +11 -109
- data/app/models/manifestation.rb +53 -20
- data/app/models/page_sweeper.rb +1 -1
- data/app/models/patron.rb +2 -1
- data/app/models/patron_import_file.rb +2 -2
- data/app/models/picture_file.rb +4 -2
- data/app/models/resource_import_file.rb +8 -4
- data/app/models/series_statement.rb +1 -1
- data/app/views/carrier_types/index.html.erb +1 -1
- data/app/views/content_types/index.html.erb +1 -1
- data/app/views/countries/index.html.erb +1 -1
- data/app/views/create_types/index.html.erb +1 -1
- data/app/views/creates/_index.html.erb +1 -1
- data/app/views/creates/_index_patron.html.erb +1 -1
- data/app/views/creates/_index_work.html.erb +1 -1
- data/app/views/donates/index.html.erb +1 -1
- data/app/views/exemplifies/index.html.erb +1 -1
- data/app/views/extents/index.html.erb +1 -1
- data/app/views/form_of_works/index.html.erb +1 -1
- data/app/views/frequencies/index.html.erb +1 -1
- data/app/views/import_requests/index.html.erb +1 -1
- data/app/views/items/index.html.erb +1 -1
- data/app/views/items/index.mobile.erb +1 -1
- data/app/views/items/show.html.erb +1 -1
- data/app/views/languages/index.html.erb +1 -1
- data/app/views/licenses/index.html.erb +1 -1
- data/app/views/manifestation_relationship_types/index.html.erb +1 -1
- data/app/views/manifestation_relationships/index.html.erb +1 -1
- data/app/views/manifestations/_form.html.erb +4 -2
- data/app/views/manifestations/_index_form.html.erb +1 -1
- data/app/views/manifestations/_library_facet.html.erb +1 -6
- data/app/views/manifestations/_list.html.erb +1 -1
- data/app/views/manifestations/_paginate_id_link.html.erb +2 -0
- data/app/views/manifestations/_show_detail_librarian.html.erb +1 -1
- data/app/views/manifestations/_show_detail_user.html.erb +1 -1
- data/app/views/manifestations/_show_holding.html.erb +1 -1
- data/app/views/manifestations/_show_holding.mobile.erb +1 -1
- data/app/views/manifestations/_show_series_statement.html.erb +1 -1
- data/app/views/manifestations/index.csv.erb +1 -1
- data/app/views/manifestations/index.html.erb +1 -1
- data/app/views/manifestations/show.mobile.erb +1 -1
- data/app/views/medium_of_performances/index.html.erb +1 -1
- data/app/views/owns/index.html.erb +1 -1
- data/app/views/patron_import_files/index.html.erb +1 -1
- data/app/views/patron_import_results/index.html.erb +1 -1
- data/app/views/patron_relationship_types/index.html.erb +1 -1
- data/app/views/patron_relationships/index.html.erb +1 -1
- data/app/views/patron_types/index.html.erb +1 -1
- data/app/views/patrons/_index.html.erb +1 -3
- data/app/views/patrons/_index_expression.html.erb +1 -1
- data/app/views/patrons/_index_manifestation.html.erb +1 -1
- data/app/views/patrons/_index_patron.html.erb +1 -1
- data/app/views/patrons/_index_patron_merge_list.html.erb +1 -1
- data/app/views/patrons/_index_work.html.erb +1 -1
- data/app/views/patrons/_patron.html.erb +0 -4
- data/app/views/patrons/show.html.erb +3 -3
- data/app/views/patrons/show.mobile.erb +1 -1
- data/app/views/picture_files/_index.html.erb +1 -1
- data/app/views/picture_files/_index_event.html.erb +1 -1
- data/app/views/picture_files/_index_manifestation.html.erb +1 -1
- data/app/views/picture_files/_index_patron.html.erb +1 -1
- data/app/views/picture_files/_index_shelf.html.erb +1 -1
- data/app/views/produce_types/index.html.erb +1 -1
- data/app/views/produces/_index.html.erb +1 -1
- data/app/views/produces/_index_manifestation.html.erb +1 -1
- data/app/views/produces/_index_patron.html.erb +1 -1
- data/app/views/realize_types/index.html.erb +1 -1
- data/app/views/realizes/_index.html.erb +1 -1
- data/app/views/realizes/_index_expression.html.erb +1 -1
- data/app/views/realizes/_index_patron.html.erb +1 -1
- data/app/views/resource_import_files/index.html.erb +1 -1
- data/app/views/resource_import_results/index.html.erb +1 -1
- data/app/views/series_has_manifestations/index.html.erb +1 -1
- data/app/views/series_statements/_index.html.erb +1 -1
- data/app/views/series_statements/_index_manifestation.html.erb +1 -1
- data/app/views/series_statements/_index_series_statement_merge_list.html.erb +1 -1
- data/app/views/series_statements/_manifestation_list.html.erb +1 -1
- data/app/views/series_statements/_merge.html.erb +1 -1
- data/app/views/series_statements/show.html.erb +1 -1
- data/config/routes.rb +13 -13
- data/lib/enju_biblio/biblio_helper.rb +59 -0
- data/lib/enju_biblio/engine.rb +1 -0
- data/{spec/dummy/lib/enju_leaf → lib/enju_biblio}/openurl.rb +0 -0
- data/{spec/dummy/lib/enju_leaf → lib/enju_biblio}/porta_cql.rb +1 -1
- data/{spec/dummy/lib/enju_leaf → lib/enju_biblio}/sru.rb +1 -1
- data/lib/enju_biblio/version.rb +1 -1
- data/lib/enju_biblio.rb +4 -0
- data/spec/cassette_library/enju_ndl/manifestation.yml +10 -10
- data/spec/cassette_library/enju_ndl/ndl_search.yml +18 -18
- data/spec/dummy/app/mailers/notifier.rb +6 -2
- data/spec/dummy/config/initializers/resque_mailer.rb +1 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/enju_leaf.rb +0 -2
- data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/isbn_sample.txt +3 -0
- data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/item_delete_file.tsv +11 -0
- data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/item_update_file.tsv +4 -0
- data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/resource_import_file_sample1.tsv +19 -0
- data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/resource_import_file_sample2.tsv +19 -0
- data/spec/dummy/private/system/resource_import_files/resource_imports/000/000/004/original/update_series_statement.tsv +2 -0
- data/spec/dummy/public/system/picture_files/pictures/000/000/005/medium/spinner.gif +0 -0
- data/spec/dummy/public/system/picture_files/pictures/000/000/005/original/spinner.gif +0 -0
- data/spec/dummy/public/system/picture_files/pictures/000/000/005/thumb/spinner.gif +0 -0
- data/spec/dummy/solr/conf/schema.xml +7 -1
- data/spec/dummy/solr/data/test/index/{_39.fdt → _h.fdt} +0 -0
- data/spec/dummy/solr/data/test/index/_h.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_h.fnm +5 -0
- data/spec/dummy/solr/data/test/index/_h.frq +0 -0
- data/spec/dummy/solr/data/test/index/_h.nrm +1 -0
- data/spec/dummy/solr/data/test/index/_h.prx +0 -0
- data/spec/dummy/solr/data/test/index/{_39.tii → _h.tii} +0 -0
- data/spec/dummy/solr/data/test/index/_h.tis +0 -0
- data/spec/dummy/solr/data/test/index/_h_1.del +0 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_1e +0 -0
- data/spec/dummy/solr/data/test/spellchecker/segments_1 +0 -0
- data/spec/dummy/tmp/cache/4F7/F90/default_role +0 -0
- data/spec/dummy/tmp/cache/6E4/420/search_engine_all +0 -0
- data/spec/fixtures/manifestations.yml +6 -6
- data/spec/models/manifestation_spec.rb +8 -1
- data/spec/models/resource_import_file_spec.rb +1 -0
- metadata +58 -139
- data/app/views/manifestations/_form.html.erb.osakac +0 -153
- data/spec/dummy/solr/data/test/index/_2s.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_2s.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_2s.fnm +0 -10
- data/spec/dummy/solr/data/test/index/_2s.frq +0 -0
- data/spec/dummy/solr/data/test/index/_2s.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_2s.prx +0 -0
- data/spec/dummy/solr/data/test/index/_2s.tii +0 -0
- data/spec/dummy/solr/data/test/index/_2s.tis +0 -0
- data/spec/dummy/solr/data/test/index/_2t.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_2t.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_2t.fnm +0 -10
- data/spec/dummy/solr/data/test/index/_2t.frq +0 -0
- data/spec/dummy/solr/data/test/index/_2t.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_2t.prx +0 -0
- data/spec/dummy/solr/data/test/index/_2t.tii +0 -0
- data/spec/dummy/solr/data/test/index/_2t.tis +0 -0
- data/spec/dummy/solr/data/test/index/_2u.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_2u.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_2u.fnm +0 -10
- data/spec/dummy/solr/data/test/index/_2u.frq +0 -0
- data/spec/dummy/solr/data/test/index/_2u.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_2u.prx +0 -0
- data/spec/dummy/solr/data/test/index/_2u.tii +0 -0
- data/spec/dummy/solr/data/test/index/_2u.tis +0 -0
- data/spec/dummy/solr/data/test/index/_2z.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_2z.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_2z.fnm +0 -10
- data/spec/dummy/solr/data/test/index/_2z.frq +0 -0
- data/spec/dummy/solr/data/test/index/_2z.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_2z.prx +0 -0
- data/spec/dummy/solr/data/test/index/_2z.tii +0 -0
- data/spec/dummy/solr/data/test/index/_2z.tis +0 -0
- data/spec/dummy/solr/data/test/index/_39.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_39.fnm +0 -10
- data/spec/dummy/solr/data/test/index/_39.frq +0 -0
- data/spec/dummy/solr/data/test/index/_39.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_39.prx +0 -0
- data/spec/dummy/solr/data/test/index/_39.tis +0 -0
- data/spec/dummy/solr/data/test/index/_39_1.del +0 -0
- data/spec/dummy/solr/data/test/index/_k.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_k.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_k.fnm +0 -10
- data/spec/dummy/solr/data/test/index/_k.frq +0 -0
- data/spec/dummy/solr/data/test/index/_k.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_k.prx +0 -0
- data/spec/dummy/solr/data/test/index/_k.tii +0 -0
- data/spec/dummy/solr/data/test/index/_k.tis +0 -0
- data/spec/dummy/solr/data/test/index/_k_3.del +0 -0
- data/spec/dummy/solr/data/test/index/_x.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_x.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_x.fnm +0 -10
- data/spec/dummy/solr/data/test/index/_x.frq +0 -0
- data/spec/dummy/solr/data/test/index/_x.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_x.prx +0 -0
- data/spec/dummy/solr/data/test/index/_x.tii +0 -0
- data/spec/dummy/solr/data/test/index/_x.tis +0 -0
- data/spec/dummy/solr/data/test/index/_x_2.del +0 -0
- data/spec/dummy/solr/data/test/index/segments_39 +0 -0
@@ -158,6 +158,10 @@ class ItemsController < ApplicationController
|
|
158
158
|
# GET /items/1/edit
|
159
159
|
def edit
|
160
160
|
@item.library_id = @item.shelf.library_id
|
161
|
+
unless @item.use_restriction
|
162
|
+
@item.build_item_has_use_restriction
|
163
|
+
@item.item_has_use_restriction.use_restriction = UseRestriction.where(:name => 'Not For Loan').first
|
164
|
+
end
|
161
165
|
end
|
162
166
|
|
163
167
|
# POST /items
|
@@ -165,10 +169,10 @@ class ItemsController < ApplicationController
|
|
165
169
|
def create
|
166
170
|
@item = Item.new(params[:item])
|
167
171
|
manifestation = Manifestation.find(@item.manifestation_id)
|
168
|
-
@item.manifestation = manifestation
|
169
172
|
|
170
173
|
respond_to do |format|
|
171
174
|
if @item.save
|
175
|
+
@item.manifestation = manifestation
|
172
176
|
Item.transaction do
|
173
177
|
if defined?(EnjuCirculation)
|
174
178
|
if @item.reserved?
|
@@ -196,11 +196,14 @@ class ManifestationsController < ApplicationController
|
|
196
196
|
if flash[:search_query] == @search_query
|
197
197
|
flash.keep(:search_query)
|
198
198
|
else
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
199
|
+
if @series_statement
|
200
|
+
flash.keep(:search_query)
|
201
|
+
else
|
202
|
+
flash[:search_query] = @search_query
|
203
|
+
@manifestation_ids = search.build do
|
204
|
+
paginate :page => 1, :per_page => configatron.max_number_of_results
|
205
|
+
end.execute.raw_results.collect(&:primary_key).map{|id| id.to_i}
|
206
|
+
end
|
204
207
|
end
|
205
208
|
|
206
209
|
if defined?(EnjuBookmark)
|
@@ -210,8 +213,8 @@ class ManifestationsController < ApplicationController
|
|
210
213
|
paginate :page => 1, :per_page => configatron.max_number_of_results
|
211
214
|
end.execute.raw_results.collect(&:primary_key).map{|id| id.to_i}
|
212
215
|
end
|
213
|
-
#bookmark_ids = Bookmark.where(:manifestation_id => flash[:manifestation_ids]).limit(1000).
|
214
|
-
bookmark_ids = Bookmark.where(:manifestation_id => @manifestation_ids).limit(1000).
|
216
|
+
#bookmark_ids = Bookmark.where(:manifestation_id => flash[:manifestation_ids]).limit(1000).pluck(:id)
|
217
|
+
bookmark_ids = Bookmark.where(:manifestation_id => @manifestation_ids).limit(1000).pluck(:id)
|
215
218
|
@tags = Tag.bookmarked(bookmark_ids)
|
216
219
|
render :partial => 'manifestations/tag_cloud'
|
217
220
|
return
|
@@ -332,7 +335,7 @@ class ManifestationsController < ApplicationController
|
|
332
335
|
case params[:mode]
|
333
336
|
when 'send_email'
|
334
337
|
if user_signed_in?
|
335
|
-
Notifier.
|
338
|
+
Notifier.manifestation_info(current_user.id, @manifestation.id).deliver
|
336
339
|
flash[:notice] = t('page.sent_email')
|
337
340
|
redirect_to @manifestation
|
338
341
|
return
|
@@ -349,7 +352,7 @@ class ManifestationsController < ApplicationController
|
|
349
352
|
if @manifestation.periodical_master?
|
350
353
|
flash.keep(:notice) if flash[:notice]
|
351
354
|
flash[:manifestation_id] = @manifestation.id
|
352
|
-
redirect_to
|
355
|
+
redirect_to series_statement_manifestations_url(@manifestation.series_statement)
|
353
356
|
return
|
354
357
|
end
|
355
358
|
|
@@ -592,7 +595,7 @@ class ManifestationsController < ApplicationController
|
|
592
595
|
sort[:sort_by] = 'sort_title'
|
593
596
|
sort[:order] = 'asc'
|
594
597
|
when 'pub_date'
|
595
|
-
sort[:sort_by] = '
|
598
|
+
sort[:sort_by] = 'sort_date_of_publication'
|
596
599
|
sort[:order] = 'desc'
|
597
600
|
else
|
598
601
|
# デフォルトの並び方
|
@@ -656,11 +659,11 @@ class ManifestationsController < ApplicationController
|
|
656
659
|
when params[:patron_id]
|
657
660
|
patron[:patron] = Patron.find(params[:patron_id])
|
658
661
|
when params[:creator_id]
|
659
|
-
patron[:creator] = Patron.find(params[:creator_id])
|
662
|
+
patron[:creator] = @creator = Patron.find(params[:creator_id])
|
660
663
|
when params[:contributor_id]
|
661
|
-
patron[:contributor] = Patron.find(params[:contributor_id])
|
664
|
+
patron[:contributor] = @contributor = Patron.find(params[:contributor_id])
|
662
665
|
when params[:publisher_id]
|
663
|
-
patron[:publisher] = Patron.find(params[:publisher_id])
|
666
|
+
patron[:publisher] = @publisher = Patron.find(params[:publisher_id])
|
664
667
|
end
|
665
668
|
patron
|
666
669
|
end
|
@@ -32,7 +32,7 @@ class PictureFilesController < ApplicationController
|
|
32
32
|
|
33
33
|
if @picture_file.picture.path
|
34
34
|
if configatron.uploaded_file.storage == :s3
|
35
|
-
|
35
|
+
file = open(@picture_file.picture.expiring_url).read.force_encoding('UTF-8')
|
36
36
|
else
|
37
37
|
file = @picture_file.picture.path(size)
|
38
38
|
end
|
@@ -167,7 +167,7 @@ class PictureFilesController < ApplicationController
|
|
167
167
|
|
168
168
|
if @picture_file.picture.path
|
169
169
|
if configatron.uploaded_file.storage == :s3
|
170
|
-
send_data
|
170
|
+
send_data file, :filename => File.basename(@picture_file.picture_file_name), :type => @picture_file.picture_content_type, :disposition => disposition
|
171
171
|
else
|
172
172
|
if File.exist?(file) and File.file?(file)
|
173
173
|
send_file file, :filename => File.basename(@picture_file.picture_file_name), :type => @picture_file.picture_content_type, :disposition => disposition
|
@@ -76,15 +76,19 @@ module ManifestationsHelper
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
def library_facet(
|
79
|
+
def library_facet(current_libraries, facet)
|
80
|
+
library = Library.where(:name => facet.value).select([:name, :display_name]).first
|
81
|
+
return nil unless library
|
80
82
|
string = ''
|
81
83
|
current = true if current_libraries.include?(library.name)
|
82
|
-
|
83
|
-
|
84
|
+
content_tag :li do
|
85
|
+
if current
|
86
|
+
content_tag :strong do
|
87
|
+
link_to("#{library.display_name.localize} (" + facet.count.to_s + ")", url_for(params.merge(:page => nil, :library => (current_libraries << library.name).uniq.join(' '), :view => nil, :only_path => true)))
|
88
|
+
end
|
89
|
+
else
|
84
90
|
link_to("#{library.display_name.localize} (" + facet.count.to_s + ")", url_for(params.merge(:page => nil, :library => (current_libraries << library.name).uniq.join(' '), :view => nil, :only_path => true)))
|
85
91
|
end
|
86
|
-
else
|
87
|
-
link_to("#{library.display_name.localize} (" + facet.count.to_s + ")", url_for(params.merge(:page => nil, :library => (current_libraries << library.name).uniq.join(' '), :view => nil, :only_path => true)))
|
88
92
|
end
|
89
93
|
end
|
90
94
|
|
data/app/models/item.rb
CHANGED
@@ -20,6 +20,7 @@ class Item < ActiveRecord::Base
|
|
20
20
|
belongs_to :budget_type
|
21
21
|
has_one :accept
|
22
22
|
#accepts_nested_attributes_for :exemplify
|
23
|
+
#before_save :create_manifestation
|
23
24
|
|
24
25
|
validates_associated :bookstore
|
25
26
|
validates :manifestation_id, :presence => true, :on => :create
|
@@ -46,114 +47,9 @@ class Item < ActiveRecord::Base
|
|
46
47
|
time :updated_at
|
47
48
|
end
|
48
49
|
|
49
|
-
|
50
|
-
|
51
|
-
if defined?(EnjuCirculation)
|
52
|
-
FOR_CHECKOUT_CIRCULATION_STATUS = [
|
53
|
-
'Available On Shelf',
|
54
|
-
'On Loan',
|
55
|
-
'Waiting To Be Reshelved'
|
56
|
-
]
|
57
|
-
FOR_CHECKOUT_USE_RESTRICTION = [
|
58
|
-
'Available For Supply Without Return',
|
59
|
-
'Limited Circulation, Long Loan Period',
|
60
|
-
'Limited Circulation, Short Loan Period',
|
61
|
-
'No Reproduction',
|
62
|
-
'Overnight Only',
|
63
|
-
'Renewals Not Permitted',
|
64
|
-
'Supervision Required',
|
65
|
-
'Term Loan',
|
66
|
-
'User Signature Required',
|
67
|
-
'Limited Circulation, Normal Loan Period'
|
68
|
-
]
|
69
|
-
scope :for_checkout, includes(:circulation_status, :use_restriction).where(
|
70
|
-
'circulation_statuses.name' => FOR_CHECKOUT_CIRCULATION_STATUS,
|
71
|
-
'use_restrictions.name' => FOR_CHECKOUT_USE_RESTRICTION
|
72
|
-
).where('item_identifier IS NOT NULL')
|
73
|
-
scope :removed, includes(:circulation_status).where('circulation_statuses.name' => 'Removed')
|
74
|
-
has_many :checkouts
|
75
|
-
has_many :reserves
|
76
|
-
has_many :checked_items, :dependent => :destroy
|
77
|
-
has_many :baskets, :through => :checked_items
|
78
|
-
belongs_to :circulation_status, :validate => true
|
79
|
-
belongs_to :checkout_type
|
80
|
-
has_many :lending_policies, :dependent => :destroy
|
81
|
-
has_one :item_has_use_restriction, :dependent => :destroy
|
82
|
-
has_one :use_restriction, :through => :item_has_use_restriction
|
83
|
-
validates_associated :circulation_status, :checkout_type
|
84
|
-
validates_presence_of :circulation_status, :checkout_type
|
85
|
-
searchable do
|
86
|
-
integer :circulation_status_id
|
87
|
-
end
|
88
|
-
attr_accessible :item_has_use_restriction_attributes
|
89
|
-
accepts_nested_attributes_for :item_has_use_restriction
|
90
|
-
|
91
|
-
def set_circulation_status
|
92
|
-
self.circulation_status = CirculationStatus.where(:name => 'In Process').first if self.circulation_status.nil?
|
93
|
-
end
|
94
|
-
|
95
|
-
def checkout_status(user)
|
96
|
-
user.user_group.user_group_has_checkout_types.where(:checkout_type_id => self.checkout_type.id).first
|
97
|
-
end
|
98
|
-
|
99
|
-
def reserved?
|
100
|
-
return true if manifestation.next_reservation
|
101
|
-
false
|
102
|
-
end
|
103
|
-
|
104
|
-
def rent?
|
105
|
-
return true if self.checkouts.not_returned.select(:item_id).detect{|checkout| checkout.item_id == self.id}
|
106
|
-
false
|
107
|
-
end
|
50
|
+
enju_circulation_item_model if defined?(EnjuCirculation)
|
108
51
|
|
109
|
-
|
110
|
-
if manifestation.next_reservation
|
111
|
-
return true if manifestation.next_reservation.user == user
|
112
|
-
end
|
113
|
-
false
|
114
|
-
end
|
115
|
-
|
116
|
-
def available_for_checkout?
|
117
|
-
if circulation_status.name == 'On Loan'
|
118
|
-
false
|
119
|
-
else
|
120
|
-
manifestation.items.for_checkout.include?(self)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
def checkout!(user)
|
125
|
-
self.circulation_status = CirculationStatus.where(:name => 'On Loan').first
|
126
|
-
if self.reserved_by_user?(user)
|
127
|
-
manifestation.next_reservation.update_attributes(:checked_out_at => Time.zone.now)
|
128
|
-
manifestation.next_reservation.sm_complete!
|
129
|
-
end
|
130
|
-
save!
|
131
|
-
end
|
132
|
-
|
133
|
-
def checkin!
|
134
|
-
self.circulation_status = CirculationStatus.where(:name => 'Available On Shelf').first
|
135
|
-
save(:validate => false)
|
136
|
-
end
|
137
|
-
|
138
|
-
def retain(librarian)
|
139
|
-
Item.transaction do
|
140
|
-
reservation = manifestation.next_reservation
|
141
|
-
unless reservation.nil?
|
142
|
-
reservation.item = self
|
143
|
-
reservation.sm_retain!
|
144
|
-
reservation.send_message(librarian)
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
def lending_rule(user)
|
150
|
-
lending_policies.where(:user_group_id => user.user_group.id).first
|
151
|
-
end
|
152
|
-
|
153
|
-
def not_for_loan?
|
154
|
-
!manifestation.items.for_checkout.include?(self)
|
155
|
-
end
|
156
|
-
end
|
52
|
+
attr_accessor :library_id, :manifestation_id
|
157
53
|
|
158
54
|
if defined?(EnjuInventory)
|
159
55
|
has_many :inventories, :dependent => :destroy
|
@@ -163,8 +59,8 @@ class Item < ActiveRecord::Base
|
|
163
59
|
end
|
164
60
|
|
165
61
|
def self.inventory_items(inventory_file, mode = 'not_on_shelf')
|
166
|
-
item_ids = Item.
|
167
|
-
inventory_item_ids = inventory_file.items.
|
62
|
+
item_ids = Item.pluck(:id)
|
63
|
+
inventory_item_ids = inventory_file.items.pluck('items.id')
|
168
64
|
case mode
|
169
65
|
when 'not_on_shelf'
|
170
66
|
Item.where(:id => (item_ids - inventory_item_ids))
|
@@ -251,6 +147,12 @@ class Item < ActiveRecord::Base
|
|
251
147
|
end
|
252
148
|
end
|
253
149
|
end
|
150
|
+
|
151
|
+
def create_manifestation
|
152
|
+
if manifestation_id
|
153
|
+
self.manifestation = Manifestation.find(manifestation_id)
|
154
|
+
end
|
155
|
+
end
|
254
156
|
end
|
255
157
|
# == Schema Information
|
256
158
|
#
|
data/app/models/manifestation.rb
CHANGED
@@ -45,9 +45,9 @@ class Manifestation < ActiveRecord::Base
|
|
45
45
|
text :fulltext, :note, :creator, :contributor, :publisher, :description
|
46
46
|
text :item_identifier do
|
47
47
|
if periodical_master?
|
48
|
-
series_statement.manifestations.
|
48
|
+
series_statement.manifestations.map{|m| m.items.pluck(:item_identifier)}.flatten
|
49
49
|
else
|
50
|
-
items.
|
50
|
+
items.pluck(:item_identifier)
|
51
51
|
end
|
52
52
|
end
|
53
53
|
string :title, :multiple => true
|
@@ -67,8 +67,8 @@ class Manifestation < ActiveRecord::Base
|
|
67
67
|
[isbn, isbn10, wrong_isbn]
|
68
68
|
end
|
69
69
|
string :issn, :multiple => true do
|
70
|
-
if
|
71
|
-
series_statement.manifestations.
|
70
|
+
if series_statement
|
71
|
+
([series_statement.issn] + series_statement.manifestations.pluck(:issn)).uniq.compact
|
72
72
|
else
|
73
73
|
[issn, series_statement.try(:issn)].compact
|
74
74
|
end
|
@@ -90,7 +90,7 @@ class Manifestation < ActiveRecord::Base
|
|
90
90
|
end
|
91
91
|
string :item_identifier, :multiple => true do
|
92
92
|
if periodical_master?
|
93
|
-
series_statement.manifestations.collect{|m| m.items.
|
93
|
+
series_statement.manifestations.collect{|m| m.items.pluck(:item_identifier)}.flatten
|
94
94
|
else
|
95
95
|
items.collect(&:item_identifier)
|
96
96
|
end
|
@@ -101,6 +101,9 @@ class Manifestation < ActiveRecord::Base
|
|
101
101
|
time :created_at
|
102
102
|
time :updated_at
|
103
103
|
time :deleted_at
|
104
|
+
time :pub_date, :multiple => true do
|
105
|
+
pub_dates
|
106
|
+
end
|
104
107
|
time :date_of_publication
|
105
108
|
integer :creator_ids, :multiple => true
|
106
109
|
integer :contributor_ids, :multiple => true
|
@@ -146,19 +149,15 @@ class Manifestation < ActiveRecord::Base
|
|
146
149
|
if series_statement.try(:periodical) # 雑誌の場合
|
147
150
|
series_statement.titles
|
148
151
|
else # 雑誌以外(雑誌の記事も含む)
|
149
|
-
|
150
|
-
original_manifestations.each do |m|
|
151
|
-
titles << m.title
|
152
|
-
end
|
153
|
-
titles.flatten
|
152
|
+
original_manifestations.map{|m| m.title}.flatten
|
154
153
|
end
|
155
154
|
end
|
156
155
|
text :isbn do # 前方一致検索のためtext指定を追加
|
157
156
|
[isbn, isbn10, wrong_isbn]
|
158
157
|
end
|
159
158
|
text :issn do # 前方一致検索のためtext指定を追加
|
160
|
-
if
|
161
|
-
series_statement.issn
|
159
|
+
if series_statement
|
160
|
+
([series_statement.issn] + series_statement.manifestations.pluck(:issn)).uniq.compact
|
162
161
|
else
|
163
162
|
issn
|
164
163
|
end
|
@@ -183,9 +182,11 @@ class Manifestation < ActiveRecord::Base
|
|
183
182
|
|
184
183
|
has_paper_trail
|
185
184
|
if configatron.uploaded_file.storage == :s3
|
186
|
-
has_attached_file :attachment, :storage => :s3, :s3_credentials => "#{Rails.root.to_s}/config/s3.yml"
|
185
|
+
has_attached_file :attachment, :storage => :s3, :s3_credentials => "#{Rails.root.to_s}/config/s3.yml",
|
186
|
+
:s3_permissions => :private
|
187
187
|
else
|
188
|
-
has_attached_file :attachment
|
188
|
+
has_attached_file :attachment,
|
189
|
+
:path => ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
|
189
190
|
end
|
190
191
|
|
191
192
|
validates_presence_of :original_title, :carrier_type, :language
|
@@ -205,7 +206,7 @@ class Manifestation < ActiveRecord::Base
|
|
205
206
|
before_validation :set_wrong_isbn, :check_issn, :check_lccn, :if => :during_import
|
206
207
|
before_validation :convert_isbn, :if => :isbn_changed?
|
207
208
|
after_create :clear_cached_numdocs
|
208
|
-
before_save :set_date_of_publication
|
209
|
+
before_save :set_date_of_publication, :set_number
|
209
210
|
after_save :index_series_statement
|
210
211
|
after_destroy :index_series_statement
|
211
212
|
normalize_attributes :manifestation_identifier, :pub_date, :isbn, :issn, :nbn, :lccn, :original_title
|
@@ -396,10 +397,18 @@ class Manifestation < ActiveRecord::Base
|
|
396
397
|
end
|
397
398
|
|
398
399
|
def sort_title
|
399
|
-
if
|
400
|
-
|
400
|
+
if periodical_master?
|
401
|
+
if series_statement.title_transcription?
|
402
|
+
NKF.nkf('-w --katakana', series_statement.title_transcription)
|
403
|
+
else
|
404
|
+
series_statement.original_title
|
405
|
+
end
|
401
406
|
else
|
402
|
-
|
407
|
+
if title_transcription?
|
408
|
+
NKF.nkf('-w --katakana', title_transcription)
|
409
|
+
else
|
410
|
+
original_title
|
411
|
+
end
|
403
412
|
end
|
404
413
|
end
|
405
414
|
|
@@ -455,10 +464,10 @@ class Manifestation < ActiveRecord::Base
|
|
455
464
|
|
456
465
|
searchable do
|
457
466
|
text :subject do
|
458
|
-
|
467
|
+
subjects.map{|s| [:term, :term_transcription]}.compact
|
459
468
|
end
|
460
469
|
string :subject, :multiple => true do
|
461
|
-
|
470
|
+
subjects.map{|s| [:term, :term_transcription]}.compact
|
462
471
|
end
|
463
472
|
string :classification, :multiple => true do
|
464
473
|
classifications.collect(&:category)
|
@@ -547,6 +556,30 @@ class Manifestation < ActiveRecord::Base
|
|
547
556
|
end
|
548
557
|
end
|
549
558
|
|
559
|
+
def set_number
|
560
|
+
self.volume_number = volume_number_string.scan(/\d*/).map{|s| s.to_i if s =~ /\d/}.compact.first if volume_number_string and !volume_number?
|
561
|
+
self.issue_number = issue_number_string.scan(/\d*/).map{|s| s.to_i if s =~ /\d/}.compact.first if issue_number_string and !issue_number?
|
562
|
+
self.edition = edition_string.scan(/\d*/).map{|s| s.to_i if s =~ /\d/}.compact.first if edition_string and !edition?
|
563
|
+
end
|
564
|
+
|
565
|
+
def pub_dates
|
566
|
+
return [] unless pub_date
|
567
|
+
pub_date_array = pub_date.split(';')
|
568
|
+
pub_date_array.map{|pub_date_string|
|
569
|
+
date = nil
|
570
|
+
while date.nil? do
|
571
|
+
pub_date_string += '-01'
|
572
|
+
break if pub_date_string =~ /-01-01-01$/
|
573
|
+
begin
|
574
|
+
date = Time.zone.parse(pub_date_string)
|
575
|
+
rescue ArgumentError
|
576
|
+
rescue TZInfo::AmbiguousTime
|
577
|
+
end
|
578
|
+
end
|
579
|
+
date
|
580
|
+
}.compact
|
581
|
+
end
|
582
|
+
|
550
583
|
if defined?(EnjuScribd)
|
551
584
|
attr_accessible :post_to_scribd
|
552
585
|
end
|
data/app/models/page_sweeper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class PageSweeper < ActionController::Caching::Sweeper
|
2
2
|
include ExpireEditableFragment
|
3
|
-
observe Create, Realize, Produce, Own, Exemplify,
|
3
|
+
observe Create, Realize, Produce, Own, Exemplify,
|
4
4
|
SeriesStatement, SeriesHasManifestation, PictureFile
|
5
5
|
|
6
6
|
def after_save(record)
|
data/app/models/patron.rb
CHANGED
@@ -8,7 +8,8 @@ class Patron < ActiveRecord::Base
|
|
8
8
|
:telephone_number_1, :telephone_number_2, :fax_number_1, :fax_number_2,
|
9
9
|
:other_designation, :place, :street, :locality, :region, :language_id,
|
10
10
|
:country_id, :patron_type_id, :note, :required_role_id, :email, :url,
|
11
|
-
:full_name_alternative_transcription, :title, :birth_date, :death_date
|
11
|
+
:full_name_alternative_transcription, :title, :birth_date, :death_date,
|
12
|
+
:patron_identifier
|
12
13
|
|
13
14
|
scope :readable_by, lambda{|user| {:conditions => ['required_role_id <= ?', user.try(:user_has_role).try(:role_id) || Role.where(:name => 'Guest').select(:id).first.id]}}
|
14
15
|
has_many :creates, :dependent => :destroy
|
@@ -7,10 +7,10 @@ class PatronImportFile < ActiveRecord::Base
|
|
7
7
|
|
8
8
|
if configatron.uploaded_file.storage == :s3
|
9
9
|
has_attached_file :patron_import, :storage => :s3, :s3_credentials => "#{Rails.root.to_s}/config/s3.yml",
|
10
|
-
:path => "patron_import_files/:id/:filename",
|
11
10
|
:s3_permissions => :private
|
12
11
|
else
|
13
|
-
has_attached_file :patron_import,
|
12
|
+
has_attached_file :patron_import,
|
13
|
+
:path => ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
|
14
14
|
end
|
15
15
|
validates_attachment_content_type :patron_import, :content_type => ['text/csv', 'text/plain', 'text/tab-separated-values', 'application/octet-stream']
|
16
16
|
validates_attachment_presence :patron_import
|
data/app/models/picture_file.rb
CHANGED
@@ -6,9 +6,11 @@ class PictureFile < ActiveRecord::Base
|
|
6
6
|
|
7
7
|
if configatron.uploaded_file.storage == :s3
|
8
8
|
has_attached_file :picture, :storage => :s3, :styles => { :medium => "600x600>", :thumb => "100x100>" },
|
9
|
-
:s3_credentials => "#{Rails.root.to_s}/config/s3.yml",
|
9
|
+
:s3_credentials => "#{Rails.root.to_s}/config/s3.yml",
|
10
|
+
:s3_permissions => :private
|
10
11
|
else
|
11
|
-
has_attached_file :picture, :styles => { :medium => "600x600>", :thumb => "100x100>" }
|
12
|
+
has_attached_file :picture, :styles => { :medium => "600x600>", :thumb => "100x100>" } #,
|
13
|
+
# :path => ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
|
12
14
|
end
|
13
15
|
validates_attachment_presence :picture
|
14
16
|
validates_attachment_content_type :picture, :content_type => ["image/jpeg", "image/pjpeg", "image/png", "image/gif", "image/svg+xml"], :on => :create
|
@@ -8,12 +8,10 @@ class ResourceImportFile < ActiveRecord::Base
|
|
8
8
|
|
9
9
|
if configatron.uploaded_file.storage == :s3
|
10
10
|
has_attached_file :resource_import, :storage => :s3, :s3_credentials => "#{Rails.root.to_s}/config/s3.yml",
|
11
|
-
:path => "resource_import_files/:id/:filename",
|
12
11
|
:s3_permissions => :private
|
13
12
|
else
|
14
13
|
has_attached_file :resource_import,
|
15
|
-
:path => ":rails_root/private/system/:attachment/:
|
16
|
-
:url => "/system/:attachment/:id/:style/:filename"
|
14
|
+
:path => ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
|
17
15
|
end
|
18
16
|
validates_attachment_content_type :resource_import, :content_type => ['text/csv', 'text/plain', 'text/tab-separated-values', 'application/octet-stream']
|
19
17
|
validates_attachment_presence :resource_import
|
@@ -248,12 +246,14 @@ class ResourceImportFile < ActiveRecord::Base
|
|
248
246
|
checkout_type = CheckoutType.where(:name => row['checkout_type']).first
|
249
247
|
bookstore = Bookstore.where(:name => row['bookstore']).first
|
250
248
|
required_role = Role.where(:name => row['required_role']).first
|
249
|
+
use_restriction = UseRestriction.where(:name => row['use_restriction'].to_s.strip).first
|
251
250
|
|
252
251
|
item.shelf = shelf if shelf
|
253
252
|
item.circulation_status = circulation_status if circulation_status
|
254
253
|
item.checkout_type = checkout_type if checkout_type
|
255
254
|
item.bookstore = bookstore if bookstore
|
256
255
|
item.required_role = required_role if required_role
|
256
|
+
item.use_restriction = use_restriction if use_restriction
|
257
257
|
item.include_supplements = row['include_supplements'] if row['include_supplements']
|
258
258
|
item.call_number = row['call_number'] if row['call_number']
|
259
259
|
item.item_price = row['item_price'] if row['item_price']
|
@@ -383,8 +383,11 @@ class ResourceImportFile < ActiveRecord::Base
|
|
383
383
|
})
|
384
384
|
if defined?(EnjuCirculation)
|
385
385
|
circulation_status = CirculationStatus.where(:name => row['circulation_status'].to_s.strip).first || CirculationStatus.where(:name => 'In Process').first
|
386
|
-
use_restriction = UseRestriction.where(:name => row['use_restriction'].to_s.strip).first
|
387
386
|
item.circulation_status = circulation_status
|
387
|
+
use_restriction = UseRestriction.where(:name => row['use_restriction'].to_s.strip).first
|
388
|
+
unless use_restriction
|
389
|
+
use_restriction = UseRestriction.where(:name => 'Not For Loan').first
|
390
|
+
end
|
388
391
|
item.use_restriction = use_restriction
|
389
392
|
end
|
390
393
|
item.bookstore = bookstore
|
@@ -496,6 +499,7 @@ class ResourceImportFile < ActiveRecord::Base
|
|
496
499
|
:volume_number_string => row['volume_number_string'].to_s.split(' ').first.try(:tr, '0-9', '0-9'),
|
497
500
|
:issue_number_string => row['issue_number_string'],
|
498
501
|
:serial_number => row['serial_number'],
|
502
|
+
:edition => row['edition'],
|
499
503
|
:edition_string => row['edition_string'],
|
500
504
|
:width => width,
|
501
505
|
:depth => depth,
|
@@ -18,7 +18,7 @@ class SeriesStatement < ActiveRecord::Base
|
|
18
18
|
end
|
19
19
|
text :numbering, :title_subseries, :numbering_subseries
|
20
20
|
integer :manifestation_ids, :multiple => true do
|
21
|
-
series_has_manifestations.
|
21
|
+
series_has_manifestations.pluck(:manifestation_id)
|
22
22
|
end
|
23
23
|
integer :position
|
24
24
|
boolean :periodical
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.carrier_type')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
|
5
|
-
<table class="index">
|
5
|
+
<table class="table table-striped index">
|
6
6
|
<tr>
|
7
7
|
<th id="position"></th>
|
8
8
|
<th><%= t('activerecord.attributes.carrier_type.name') -%></th>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.content_type')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
|
5
|
-
<table class="index">
|
5
|
+
<table class="table table-striped index">
|
6
6
|
<tr>
|
7
7
|
<th id="position"></th>
|
8
8
|
<th><%= t('activerecord.attributes.content_type.name') -%></th>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.country')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
|
5
|
-
<table class="index">
|
5
|
+
<table class="table table-striped index">
|
6
6
|
<tr>
|
7
7
|
<th id="position"></th>
|
8
8
|
<th><%= t('activerecord.attributes.country.display_name') -%></th>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.create_type')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
|
5
|
-
<table class="index">
|
5
|
+
<table class="table table-striped index">
|
6
6
|
<tr>
|
7
7
|
<th id="position"></th>
|
8
8
|
<th><%= t('activerecord.attributes.create_type.name') -%></th>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.create')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
|
5
|
-
<table class="index">
|
5
|
+
<table class="table table-striped index">
|
6
6
|
<tr>
|
7
7
|
<th><%= t('activerecord.models.patron') -%></th>
|
8
8
|
<th><%= t('activerecord.models.work') -%></th>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.donate')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
|
5
|
-
<table class="index">
|
5
|
+
<table class="table table-striped index">
|
6
6
|
<tr>
|
7
7
|
<th><%= t('activerecord.models.patron') -%></th>
|
8
8
|
<th><%= t('activerecord.models.manifestation') -%></th>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.exemplify')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
|
5
|
-
<table class="index">
|
5
|
+
<table class="table table-striped index">
|
6
6
|
<tr>
|
7
7
|
<th><%= t('activerecord.models.manifestation') -%></th>
|
8
8
|
<th><%= t('activerecord.models.item') -%></th>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<h1 class="title"><%= t('page.listing', :model => t('activerecord.models.extent')) -%></h1>
|
3
3
|
<div id="content_list">
|
4
4
|
|
5
|
-
<table class="index">
|
5
|
+
<table class="table table-striped index">
|
6
6
|
<tr>
|
7
7
|
<th id="position"></th>
|
8
8
|
<th><%= t('activerecord.attributes.extent.name') -%></th>
|