enju_circulation 0.1.0.pre6 → 0.1.0.pre7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/enju_circulation/item.rb +17 -0
- data/lib/enju_circulation/version.rb +1 -1
- data/spec/controllers/lending_policies_controller_spec.rb +1 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/conf/schema.xml +2 -14
- data/spec/dummy/solr/data/test/index/{_1w.tis → _cr.tis} +0 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/{segments_3z → segments_qn} +0 -0
- data/spec/dummy/solr/data/test/spellchecker/segments_1 +0 -0
- metadata +20 -20
- /data/spec/dummy/solr/data/test/index/{_1w.fdt → _cr.fdt} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1w.fdx → _cr.fdx} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1w.fnm → _cr.fnm} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1w.frq → _cr.frq} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1w.nrm → _cr.nrm} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1w.prx → _cr.prx} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1w.tii → _cr.tii} +0 -0
@@ -48,6 +48,9 @@ module EnjuCirculation
|
|
48
48
|
end
|
49
49
|
attr_accessible :item_has_use_restriction_attributes
|
50
50
|
accepts_nested_attributes_for :item_has_use_restriction
|
51
|
+
|
52
|
+
after_create :create_lending_policy
|
53
|
+
before_update :delete_lending_policy
|
51
54
|
end
|
52
55
|
end
|
53
56
|
|
@@ -118,6 +121,20 @@ module EnjuCirculation
|
|
118
121
|
def not_for_loan?
|
119
122
|
!manifestation.items.for_checkout.include?(self)
|
120
123
|
end
|
124
|
+
|
125
|
+
def create_lending_policy
|
126
|
+
UserGroupHasCheckoutType.available_for_item(self).each do |rule|
|
127
|
+
LendingPolicy.create!(:item_id => id, :user_group_id => rule.user_group_id, :fixed_due_date => rule.fixed_due_date, :loan_period => rule.checkout_period, :renewal => rule.checkout_renewal_limit)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def delete_lending_policy
|
132
|
+
return nil unless changes[:circulation_status_id]
|
133
|
+
self.transaction do
|
134
|
+
lending_policies.delete_all
|
135
|
+
create_lending_policy
|
136
|
+
end
|
137
|
+
end
|
121
138
|
end
|
122
139
|
end
|
123
140
|
end
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -84,14 +84,11 @@
|
|
84
84
|
<fieldType name="tfloat" class="solr.TrieFloatField" omitNorms="true"/>
|
85
85
|
<!-- *** This fieldType is used by Sunspot! *** -->
|
86
86
|
<fieldType name="tdate" class="solr.TrieDateField" omitNorms="true"/>
|
87
|
-
|
88
|
-
<!-- A specialized field for geospatial search. If indexed, this fieldType must not be multivalued. -->
|
89
|
-
<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
|
90
87
|
</types>
|
91
88
|
<fields>
|
92
89
|
<!-- Valid attributes for fields:
|
93
90
|
name: mandatory - the name for the field
|
94
|
-
type: mandatory - the name of a previously defined type from the
|
91
|
+
type: mandatory - the name of a previously defined type from the
|
95
92
|
<types> section
|
96
93
|
indexed: true if this field should be indexed (searchable or sortable)
|
97
94
|
stored: true if this field should be retrievable
|
@@ -226,17 +223,8 @@
|
|
226
223
|
<dynamicField name="*_ets" stored="true" termVectors="true" type="tdouble" multiValued="false" indexed="true"/>
|
227
224
|
<!-- *** This dynamicField is used by Sunspot! *** -->
|
228
225
|
<dynamicField name="*_etms" stored="true" termVectors="true" type="tdouble" multiValued="true" indexed="true"/>
|
229
|
-
|
230
|
-
<!-- Type used to index the lat and lon components for the "location" FieldType -->
|
231
|
-
<dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false" multiValued="false"/>
|
232
|
-
<dynamicField name="*_p" type="location" indexed="true" stored="true" multiValued="false"/>
|
233
|
-
|
234
|
-
<dynamicField name="*_ll" stored="false" type="location" multiValued="false" indexed="true"/>
|
235
|
-
<dynamicField name="*_llm" stored="false" type="location" multiValued="true" indexed="true"/>
|
236
|
-
<dynamicField name="*_lls" stored="true" type="location" multiValued="false" indexed="true"/>
|
237
|
-
<dynamicField name="*_llms" stored="true" type="location" multiValued="true" indexed="true"/>
|
238
226
|
</fields>
|
239
|
-
<!-- Field to use to determine and enforce document uniqueness.
|
227
|
+
<!-- Field to use to determine and enforce document uniqueness.
|
240
228
|
Unless this field is marked with required="false", it will be a required field
|
241
229
|
-->
|
242
230
|
<uniqueKey>id</uniqueKey>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enju_circulation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.pre7
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -636,16 +636,16 @@ files:
|
|
636
636
|
- spec/dummy/solr/conf/spellings.txt
|
637
637
|
- spec/dummy/solr/conf/stopwords.txt
|
638
638
|
- spec/dummy/solr/conf/synonyms.txt
|
639
|
-
- spec/dummy/solr/data/test/index/
|
640
|
-
- spec/dummy/solr/data/test/index/
|
641
|
-
- spec/dummy/solr/data/test/index/
|
642
|
-
- spec/dummy/solr/data/test/index/
|
643
|
-
- spec/dummy/solr/data/test/index/
|
644
|
-
- spec/dummy/solr/data/test/index/
|
645
|
-
- spec/dummy/solr/data/test/index/
|
646
|
-
- spec/dummy/solr/data/test/index/
|
639
|
+
- spec/dummy/solr/data/test/index/_cr.fdt
|
640
|
+
- spec/dummy/solr/data/test/index/_cr.fdx
|
641
|
+
- spec/dummy/solr/data/test/index/_cr.fnm
|
642
|
+
- spec/dummy/solr/data/test/index/_cr.frq
|
643
|
+
- spec/dummy/solr/data/test/index/_cr.nrm
|
644
|
+
- spec/dummy/solr/data/test/index/_cr.prx
|
645
|
+
- spec/dummy/solr/data/test/index/_cr.tii
|
646
|
+
- spec/dummy/solr/data/test/index/_cr.tis
|
647
647
|
- spec/dummy/solr/data/test/index/segments.gen
|
648
|
-
- spec/dummy/solr/data/test/index/
|
648
|
+
- spec/dummy/solr/data/test/index/segments_qn
|
649
649
|
- spec/dummy/solr/data/test/spellchecker/segments.gen
|
650
650
|
- spec/dummy/solr/data/test/spellchecker/segments_1
|
651
651
|
- spec/factories/basket.rb
|
@@ -908,16 +908,16 @@ test_files:
|
|
908
908
|
- spec/dummy/solr/conf/spellings.txt
|
909
909
|
- spec/dummy/solr/conf/stopwords.txt
|
910
910
|
- spec/dummy/solr/conf/synonyms.txt
|
911
|
-
- spec/dummy/solr/data/test/index/
|
912
|
-
- spec/dummy/solr/data/test/index/
|
913
|
-
- spec/dummy/solr/data/test/index/
|
914
|
-
- spec/dummy/solr/data/test/index/
|
915
|
-
- spec/dummy/solr/data/test/index/
|
916
|
-
- spec/dummy/solr/data/test/index/
|
917
|
-
- spec/dummy/solr/data/test/index/
|
918
|
-
- spec/dummy/solr/data/test/index/
|
911
|
+
- spec/dummy/solr/data/test/index/_cr.fdt
|
912
|
+
- spec/dummy/solr/data/test/index/_cr.fdx
|
913
|
+
- spec/dummy/solr/data/test/index/_cr.fnm
|
914
|
+
- spec/dummy/solr/data/test/index/_cr.frq
|
915
|
+
- spec/dummy/solr/data/test/index/_cr.nrm
|
916
|
+
- spec/dummy/solr/data/test/index/_cr.prx
|
917
|
+
- spec/dummy/solr/data/test/index/_cr.tii
|
918
|
+
- spec/dummy/solr/data/test/index/_cr.tis
|
919
919
|
- spec/dummy/solr/data/test/index/segments.gen
|
920
|
-
- spec/dummy/solr/data/test/index/
|
920
|
+
- spec/dummy/solr/data/test/index/segments_qn
|
921
921
|
- spec/dummy/solr/data/test/spellchecker/segments.gen
|
922
922
|
- spec/dummy/solr/data/test/spellchecker/segments_1
|
923
923
|
- spec/factories/basket.rb
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|