enju_circulation 0.1.0.pre31 → 0.1.0.pre32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/enju_circulation/ability.rb +4 -1
- data/app/models/reserve.rb +2 -2
- data/app/models/use_restriction.rb +13 -3
- data/app/views/checkins/_checkin.html.erb +10 -8
- data/lib/enju_circulation/item.rb +1 -1
- data/lib/enju_circulation/version.rb +1 -1
- data/lib/generators/enju_circulation/setup/templates/config/schedule.rb +4 -4
- data/lib/tasks/enju_circulation_tasks.rake +21 -1
- data/spec/dummy/config/initializers/devise.rb +2 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/conf/schema.xml +19 -2
- data/spec/dummy/solr/conf/solrconfig.xml +588 -855
- data/spec/dummy/solr/default/data/index/_4b.fdt +0 -0
- data/spec/dummy/solr/default/data/index/_4b.fdx +0 -0
- data/spec/dummy/solr/default/data/index/_4b.fnm +0 -0
- data/spec/dummy/solr/default/data/index/_4b.nvd +0 -0
- data/spec/dummy/solr/default/data/index/_4b.nvm +0 -0
- data/spec/dummy/solr/default/data/index/_4b.si +0 -0
- data/spec/dummy/solr/default/data/index/_4b_Lucene41_0.doc +0 -0
- data/spec/dummy/solr/default/data/index/_4b_Lucene41_0.pos +0 -0
- data/spec/dummy/solr/default/data/index/_4b_Lucene41_0.tim +0 -0
- data/spec/dummy/solr/default/data/index/_4b_Lucene41_0.tip +0 -0
- data/spec/dummy/solr/default/data/index/segments.gen +0 -0
- data/spec/dummy/solr/default/data/index/segments_8p +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000303 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000304 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000305 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000306 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000307 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000308 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000309 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000310 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000311 +0 -0
- data/spec/dummy/solr/{data/test/spellchecker → development/data/index}/segments.gen +0 -0
- data/spec/dummy/solr/development/data/index/segments_1 +0 -0
- data/spec/dummy/solr/solr.xml +8 -0
- data/spec/dummy/solr/test/data/index/segments.gen +0 -0
- data/spec/dummy/solr/test/data/index/segments_1 +0 -0
- metadata +59 -33
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/solr/data/test/index/_3ed.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_3ed.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_3ed.fnm +0 -4
- data/spec/dummy/solr/data/test/index/_3ed.frq +0 -1
- data/spec/dummy/solr/data/test/index/_3ed.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_3ed.prx +0 -0
- data/spec/dummy/solr/data/test/index/_3ed.tii +0 -0
- data/spec/dummy/solr/data/test/index/_3ed.tis +0 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_6sj +0 -0
- data/spec/dummy/solr/data/test/spellchecker/segments_1 +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87e73feef512a6ef555f86982f59f541dbfd1efa
|
4
|
+
data.tar.gz: 0d66f70320f865bea09fb0f432327975fa8f4836
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98223a49ba2217082f9fb50dad9399474bbf6a1a0c6532a173cf7ac1d0703375c862077f58fd433a3bb068617abbe9aca5aaaa18d11e3e719fae8a10c0af0a20
|
7
|
+
data.tar.gz: 33e5f44becadde09fcd0bbffc840fcb9007abffa1bc7c0d4b0d1ae41e98cb8c5c93e1d25893b36b095d0473e78f35d5c407ae1d1986117f055583fa5dd8b699e
|
@@ -8,6 +8,9 @@ module EnjuCirculation
|
|
8
8
|
can [:destroy, :delete], Manifestation do |manifestation|
|
9
9
|
manifestation.items.empty? and !manifestation.series_master? and !manifestation.is_reserved?
|
10
10
|
end
|
11
|
+
can [:destroy, :delete], Item do |item|
|
12
|
+
true if item.removable?
|
13
|
+
end
|
11
14
|
can :manage, [
|
12
15
|
Basket,
|
13
16
|
CarrierTypeHasCheckoutType,
|
@@ -38,7 +41,7 @@ module EnjuCirculation
|
|
38
41
|
can [:destroy, :delete], LendingPolicy
|
39
42
|
when 'Librarian'
|
40
43
|
can [:destroy, :delete], Item do |item|
|
41
|
-
item.
|
44
|
+
true if item.removable?
|
42
45
|
end
|
43
46
|
can [:destroy, :delete], Manifestation do |manifestation|
|
44
47
|
manifestation.items.empty? and !manifestation.series_master? and !manifestation.is_reserved?
|
data/app/models/reserve.rb
CHANGED
@@ -318,7 +318,7 @@ class Reserve < ActiveRecord::Base
|
|
318
318
|
|
319
319
|
def checked_out_now?
|
320
320
|
if user and manifestation
|
321
|
-
true if !(user.checkouts.not_returned.pluck(:item_id) & manifestation.items.pluck(
|
321
|
+
true if !(user.checkouts.not_returned.pluck(:item_id) & manifestation.items.pluck('items.id')).empty?
|
322
322
|
end
|
323
323
|
end
|
324
324
|
|
@@ -337,7 +337,7 @@ class Reserve < ActiveRecord::Base
|
|
337
337
|
|
338
338
|
expired_period = manifestation.try(:reservation_expired_period, user)
|
339
339
|
if expired_period.nil?
|
340
|
-
errors[:base] << I18n.t('reserve.
|
340
|
+
errors[:base] << I18n.t('reserve.this_patron_cannot_reserve')
|
341
341
|
end
|
342
342
|
end
|
343
343
|
end
|
@@ -1,10 +1,20 @@
|
|
1
1
|
class UseRestriction < ActiveRecord::Base
|
2
2
|
attr_accessible :name, :display_name, :note
|
3
|
-
include MasterModel
|
4
|
-
|
5
|
-
|
3
|
+
#include MasterModel
|
4
|
+
acts_as_list
|
5
|
+
validates :name, :presence => true, :format => {:with => /\A[0-9A-Za-z][0-9A-Za-z_\-\s,]*[0-9a-z]\Z/}
|
6
|
+
validates :display_name, :presence => true
|
7
|
+
before_validation :set_display_name, :on => :create
|
8
|
+
normalize_attributes :name
|
9
|
+
|
10
|
+
default_scope {order('use_restrictions.position')}
|
11
|
+
scope :available, -> {where(:name => ['Not For Loan', 'Limited Circulation, Normal Loan Period'])}
|
6
12
|
has_many :item_has_use_restrictions
|
7
13
|
has_many :items, :through => :item_has_use_restrictions
|
14
|
+
|
15
|
+
def set_display_name
|
16
|
+
self.display_name = "#{I18n.locale}: #{name}" if display_name.blank?
|
17
|
+
end
|
8
18
|
end
|
9
19
|
|
10
20
|
# == Schema Information
|
@@ -9,17 +9,19 @@
|
|
9
9
|
<%- @checkins.each_with_index do |checkin, i| -%>
|
10
10
|
<tr class="line<%= cycle("0", "1") -%>">
|
11
11
|
<td>
|
12
|
-
<%= render 'manifestations/show_index', :manifestation => checkin.item.manifestation if checkin.item.manifestation -%>
|
12
|
+
<%= render 'manifestations/show_index', :manifestation => checkin.item.manifestation if checkin.item.try(:manifestation) -%>
|
13
13
|
</td>
|
14
14
|
<td>
|
15
|
-
|
16
|
-
|
17
|
-
(<%= link_to checkin.item.shelf.library.display_name.localize, checkin.item.shelf.library %>)
|
18
|
-
<% if defined?(EnjuInterLibraryLoan) %>
|
15
|
+
<% if checkin.item %>
|
16
|
+
<%= link_to checkin.item.item_identifier, checkin.item -%>
|
19
17
|
<br />
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
(<%= link_to checkin.item.shelf.library.display_name.localize, checkin.item.shelf.library %>)
|
19
|
+
<% if defined?(EnjuInterLibraryLoan) %>
|
20
|
+
<br />
|
21
|
+
<%- unless checkin.item.shelf.library == current_user.library -%>
|
22
|
+
<span style="color: red"><%= link_to t('activerecord.models.inter_library_loan'), item_inter_library_loans_path(checkin.item) -%></span>
|
23
|
+
<%- end -%>
|
24
|
+
<% end %>
|
23
25
|
<% end %>
|
24
26
|
</td>
|
25
27
|
<td>
|
@@ -34,7 +34,7 @@ module EnjuCirculation
|
|
34
34
|
scope :removed, includes(:circulation_status).where('circulation_statuses.name' => 'Removed')
|
35
35
|
has_many :checkouts
|
36
36
|
has_many :reserves
|
37
|
-
has_many :checked_items
|
37
|
+
has_many :checked_items
|
38
38
|
has_many :baskets, :through => :checked_items
|
39
39
|
belongs_to :circulation_status, :validate => true
|
40
40
|
belongs_to :checkout_type
|
@@ -1,17 +1,17 @@
|
|
1
1
|
|
2
2
|
every 5.minute do
|
3
|
-
rake "
|
3
|
+
rake "enju_message:send"
|
4
4
|
end
|
5
5
|
|
6
6
|
every 1.day, :at => '0:00 am' do
|
7
|
-
rake "
|
7
|
+
rake "enju_circulation:expire"
|
8
8
|
runner "User.lock_expired_users"
|
9
9
|
end
|
10
10
|
|
11
11
|
every 1.day, :at => '1:00 am' do
|
12
|
-
rake "
|
12
|
+
rake "enju_circulation:stat"
|
13
13
|
end
|
14
14
|
|
15
15
|
every 1.day, :at => '5:00 am' do
|
16
|
-
rake "
|
16
|
+
rake "enju_circulation:send_notification"
|
17
17
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'active_record/fixtures'
|
2
|
-
desc "create initial records for enju_circulation"
|
3
2
|
namespace :enju_circulation do
|
3
|
+
desc "create initial records for enju_circulation"
|
4
4
|
task :setup => :environment do
|
5
5
|
Dir.glob(Rails.root.to_s + '/db/fixtures/enju_circulation/*.yml').each do |file|
|
6
6
|
ActiveRecord::Fixtures.create_fixtures('db/fixtures/enju_circulation', File.basename(file, '.*'))
|
@@ -11,4 +11,24 @@ namespace :enju_circulation do
|
|
11
11
|
|
12
12
|
puts 'initial fixture files loaded.'
|
13
13
|
end
|
14
|
+
|
15
|
+
desc 'Calculate stats'
|
16
|
+
task :stat => :environment do
|
17
|
+
UserCheckoutStat.calculate_stat
|
18
|
+
UserReserveStat.calculate_stat
|
19
|
+
ManifestationCheckoutStat.calculate_stat
|
20
|
+
ManifestationReserveStat.calculate_stat
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'Expire circulations and reservations'
|
24
|
+
task :expire => :environment do
|
25
|
+
Reserve.expire
|
26
|
+
Basket.expire
|
27
|
+
end
|
28
|
+
|
29
|
+
desc 'Sending due date notifications'
|
30
|
+
task :send_notification => :environment do
|
31
|
+
Checkout.send_due_date_notification
|
32
|
+
Checkout.send_overdue_notification
|
33
|
+
end
|
14
34
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# Use this hook to configure devise mailer, warden hooks and so forth.
|
2
2
|
# Many of these configuration options can be set straight in your model.
|
3
3
|
Devise.setup do |config|
|
4
|
+
config.secret_key = '7e21095c77c61417503b0b32ffe9ae8728eb3c689bce8a45562cbc2c1903d9ab177f6e902f2c97a1cdfe07a6f6459f06bf3fdd975ccebd72fa722489909836fc'
|
5
|
+
|
4
6
|
# ==> Mailer Configuration
|
5
7
|
# Configure the e-mail address which will be shown in Devise::Mailer,
|
6
8
|
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -64,6 +64,7 @@
|
|
64
64
|
<tokenizer class="solr.StandardTokenizerFactory"/>
|
65
65
|
<filter class="solr.StandardFilterFactory"/>
|
66
66
|
<filter class="solr.LowerCaseFilterFactory"/>
|
67
|
+
<filter class="solr.PorterStemFilterFactory"/>
|
67
68
|
</analyzer>
|
68
69
|
</fieldType>
|
69
70
|
<!-- *** This fieldType is used by Sunspot! *** -->
|
@@ -84,11 +85,14 @@
|
|
84
85
|
<fieldType name="tfloat" class="solr.TrieFloatField" omitNorms="true"/>
|
85
86
|
<!-- *** This fieldType is used by Sunspot! *** -->
|
86
87
|
<fieldType name="tdate" class="solr.TrieDateField" omitNorms="true"/>
|
88
|
+
|
89
|
+
<!-- A specialized field for geospatial search. If indexed, this fieldType must not be multivalued. -->
|
90
|
+
<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
|
87
91
|
</types>
|
88
92
|
<fields>
|
89
93
|
<!-- Valid attributes for fields:
|
90
94
|
name: mandatory - the name for the field
|
91
|
-
type: mandatory - the name of a previously defined type from the
|
95
|
+
type: mandatory - the name of a previously defined type from the
|
92
96
|
<types> section
|
93
97
|
indexed: true if this field should be indexed (searchable or sortable)
|
94
98
|
stored: true if this field should be retrievable
|
@@ -223,8 +227,21 @@
|
|
223
227
|
<dynamicField name="*_ets" stored="true" termVectors="true" type="tdouble" multiValued="false" indexed="true"/>
|
224
228
|
<!-- *** This dynamicField is used by Sunspot! *** -->
|
225
229
|
<dynamicField name="*_etms" stored="true" termVectors="true" type="tdouble" multiValued="true" indexed="true"/>
|
230
|
+
|
231
|
+
<!-- Type used to index the lat and lon components for the "location" FieldType -->
|
232
|
+
<dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false" multiValued="false"/>
|
233
|
+
<dynamicField name="*_p" type="location" indexed="true" stored="true" multiValued="false"/>
|
234
|
+
|
235
|
+
<dynamicField name="*_ll" stored="false" type="location" multiValued="false" indexed="true"/>
|
236
|
+
<dynamicField name="*_llm" stored="false" type="location" multiValued="true" indexed="true"/>
|
237
|
+
<dynamicField name="*_lls" stored="true" type="location" multiValued="false" indexed="true"/>
|
238
|
+
<dynamicField name="*_llms" stored="true" type="location" multiValued="true" indexed="true"/>
|
239
|
+
|
240
|
+
<!-- required by Solr 4 -->
|
241
|
+
<field name="_version_" type="string" indexed="true" stored="true" multiValued="false" />
|
226
242
|
</fields>
|
227
|
-
|
243
|
+
|
244
|
+
<!-- Field to use to determine and enforce document uniqueness.
|
228
245
|
Unless this field is marked with required="false", it will be a required field
|
229
246
|
-->
|
230
247
|
<uniqueKey>id</uniqueKey>
|