enju_circulation 0.1.0.pre24 → 0.1.0.pre25
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.
- checksums.yaml +4 -4
- data/app/controllers/checkouts_controller.rb +2 -19
- data/app/models/checkin.rb +2 -1
- data/app/models/checkout.rb +14 -7
- data/app/views/carrier_types/_checkout_form.html.erb +9 -0
- data/app/views/user_groups/_checkout_form.html.erb +23 -0
- data/config/locales/translation_en.yml +1 -0
- data/config/locales/translation_ja.yml +2 -1
- data/lib/enju_circulation/user_group.rb +2 -0
- data/lib/enju_circulation/version.rb +1 -1
- data/spec/controllers/checkouts_controller_spec.rb +4 -4
- 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_391 → segments_3xz} +0 -0
- data/spec/models/checkout_spec.rb +5 -3
- metadata +22 -20
- /data/spec/dummy/solr/data/test/index/{_1mh.fdt → _1yy.fdt} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1mh.fdx → _1yy.fdx} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1mh.fnm → _1yy.fnm} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1mh.frq → _1yy.frq} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1mh.nrm → _1yy.nrm} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1mh.prx → _1yy.prx} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1mh.tii → _1yy.tii} +0 -0
- /data/spec/dummy/solr/data/test/index/{_1mh.tis → _1yy.tis} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e586c12f6f5f99c3790e5cb3256326c6d1fe88e6
|
4
|
+
data.tar.gz: ab9630c6e9ab4d9e73435cc0bcb84eb89e39b0c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e01a8153d2cb1eb1511f24fc3ad5cf3683b912414e28754ad8dd1bc9c4b44c5a18bdb381eac2d0eeb664d90d72b9db30acd4ba8c973051926864092f093126d
|
7
|
+
data.tar.gz: 8591508a0c7f9e479fdc258f411e83c9d8519fc0270a8030b87e85c66d7b36ec00f7913a6fdb5503931f1c05b73e7366cf649adaa2ba1194896c438c6affa81f
|
@@ -134,27 +134,9 @@ class CheckoutsController < ApplicationController
|
|
134
134
|
# PUT /checkouts/1
|
135
135
|
# PUT /checkouts/1.json
|
136
136
|
def update
|
137
|
-
if @checkout.reserved?
|
138
|
-
flash[:notice] = t('checkout.this_item_is_reserved')
|
139
|
-
redirect_to edit_checkout_url(@checkout)
|
140
|
-
return
|
141
|
-
end
|
142
|
-
if @checkout.over_checkout_renewal_limit?
|
143
|
-
flash[:notice] = t('checkout.excessed_renewal_limit')
|
144
|
-
redirect_to edit_checkout_url(@checkout)
|
145
|
-
return
|
146
|
-
end
|
147
|
-
if @checkout.overdue?
|
148
|
-
flash[:notice] = t('checkout.you_have_overdue_item')
|
149
|
-
unless current_user.has_role?('Librarian')
|
150
|
-
redirect_to edit_checkout_url(@checkout)
|
151
|
-
return
|
152
|
-
end
|
153
|
-
end
|
154
|
-
@checkout.reload
|
155
|
-
@checkout.checkout_renewal_count += 1
|
156
137
|
@checkout.assign_attributes(params[:checkout])
|
157
138
|
@checkout.due_date = @checkout.due_date.end_of_day
|
139
|
+
@checkout.checkout_renewal_count += 1
|
158
140
|
|
159
141
|
respond_to do |format|
|
160
142
|
if @checkout.save
|
@@ -171,6 +153,7 @@ class CheckoutsController < ApplicationController
|
|
171
153
|
# DELETE /checkouts/1.json
|
172
154
|
def destroy
|
173
155
|
user = @checkout.user
|
156
|
+
@checkout.operator = current_user
|
174
157
|
@checkout.user_id = nil
|
175
158
|
@checkout.save!
|
176
159
|
|
data/app/models/checkin.rb
CHANGED
@@ -35,12 +35,13 @@ class Checkin < ActiveRecord::Base
|
|
35
35
|
message = ''
|
36
36
|
Checkin.transaction do
|
37
37
|
checkouts = Checkout.not_returned.where(:item_id => item_id).select(
|
38
|
-
[:id, :item_id, :user_id, :basket_id, :due_date, :lock_version, :created_at]
|
38
|
+
[:id, :item_id, :user_id, :basket_id, :due_date, :lock_version, :created_at, :checkout_renewal_count]
|
39
39
|
)
|
40
40
|
item.checkin!
|
41
41
|
checkouts.each do |checkout|
|
42
42
|
# TODO: ILL時の処理
|
43
43
|
checkout.checkin = self
|
44
|
+
checkout.operator = current_user
|
44
45
|
unless checkout.user.try(:save_checkout_history)
|
45
46
|
checkout.user = nil
|
46
47
|
end
|
data/app/models/checkout.rb
CHANGED
@@ -21,6 +21,7 @@ class Checkout < ActiveRecord::Base
|
|
21
21
|
validates_presence_of :item_id, :basket_id, :due_date
|
22
22
|
validates_uniqueness_of :item_id, :scope => [:basket_id, :user_id]
|
23
23
|
validate :is_not_checked?, :on => :create
|
24
|
+
validate :renewable?, :on => :update
|
24
25
|
validates_date :due_date
|
25
26
|
|
26
27
|
searchable do
|
@@ -43,6 +44,8 @@ class Checkout < ActiveRecord::Base
|
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
47
|
+
attr_accessor :operator
|
48
|
+
|
46
49
|
paginates_per 10
|
47
50
|
|
48
51
|
def is_not_checked?
|
@@ -52,13 +55,16 @@ class Checkout < ActiveRecord::Base
|
|
52
55
|
end
|
53
56
|
end
|
54
57
|
|
55
|
-
def
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
58
|
+
def renewable?
|
59
|
+
if !operator and overdue?
|
60
|
+
errors[:base] << I18n.t('checkout.you_have_overdue_item')
|
61
|
+
end
|
62
|
+
if !operator and reserved?
|
63
|
+
errors[:base] << I18n.t('checkout.this_item_is_reserved')
|
64
|
+
end
|
65
|
+
if !operator and over_checkout_renewal_limit?
|
66
|
+
errors[:base] << I18n.t('checkout.excessed_renewal_limit')
|
60
67
|
end
|
61
|
-
true
|
62
68
|
end
|
63
69
|
|
64
70
|
def reserved?
|
@@ -67,7 +73,8 @@ class Checkout < ActiveRecord::Base
|
|
67
73
|
end
|
68
74
|
|
69
75
|
def over_checkout_renewal_limit?
|
70
|
-
return
|
76
|
+
return nil unless item.checkout_status(user)
|
77
|
+
return true if item.checkout_status(user).checkout_renewal_limit < checkout_renewal_count
|
71
78
|
end
|
72
79
|
|
73
80
|
def overdue?
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<div class="field">
|
2
|
+
<%= f.label t('activerecord.models.carrier_type_has_checkout_type') %><br />
|
3
|
+
<%= f.fields_for :carrier_type_has_checkout_types do |checkout_form| %>
|
4
|
+
<%= checkout_form.label :checkout_type_id -%>
|
5
|
+
<%= checkout_form.select(:checkout_type_id, @checkout_types.collect{|c| [c.display_name.localize, c.id]}) %>
|
6
|
+
<%= checkout_form.link_to_remove t('page.remove'), :confirm => t('page.are_you_sure') %>
|
7
|
+
<% end %>
|
8
|
+
<p><%= f.link_to_add t('page.add'), :carrier_type_has_checkout_types %></p>
|
9
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<div class="field">
|
2
|
+
<%= f.label t('activerecord.models.user_group_has_checkout_type') %><br />
|
3
|
+
<%= f.fields_for :user_group_has_checkout_types do |checkout_form| %>
|
4
|
+
<%= checkout_form.label :checkout_type_id -%>
|
5
|
+
<%= checkout_form.select(:checkout_type_id, @checkout_types.collect{|c| [c.display_name.localize, c.id]}) %>
|
6
|
+
<%= checkout_form.link_to_remove t('page.remove'), :confirm => t('page.are_you_sure') %>
|
7
|
+
<br />
|
8
|
+
<%= checkout_form.label :checkout_limit -%>
|
9
|
+
<%= checkout_form.text_field :checkout_limit, :class => 'resource_integer' %>
|
10
|
+
<%= checkout_form.label :checkout_period -%>
|
11
|
+
<%= checkout_form.text_field :checkout_period, :class => 'resource_integer' %>
|
12
|
+
<%= checkout_form.label :checkout_renewal_limit -%>
|
13
|
+
<%= checkout_form.text_field :checkout_renewal_limit, :class => 'resource_integer' %>
|
14
|
+
<br />
|
15
|
+
<%= checkout_form.label :reservation_limit -%>
|
16
|
+
<%= checkout_form.text_field :reservation_limit, :class => 'resource_integer' %>
|
17
|
+
<%= checkout_form.label :reservation_expired_period -%>
|
18
|
+
<%= checkout_form.text_field :reservation_expired_period, :class => 'resource_integer' %>
|
19
|
+
<%= checkout_form.label :set_due_date_before_closing_day -%>
|
20
|
+
<%= checkout_form.check_box :set_due_date_before_closing_day %>
|
21
|
+
<% end %>
|
22
|
+
<p><%= f.link_to_add t('page.add'), :user_group_has_checkout_types %></p>
|
23
|
+
</div>
|
@@ -20,7 +20,7 @@ ja:
|
|
20
20
|
reserve_stat_has_manifestation: 資料別予約統計
|
21
21
|
reserve_stat_has_user: 利用者別予約統計
|
22
22
|
user_group_has_checkout_type: 利用者グループと貸出区分の関係
|
23
|
-
carrier_type_has_checkout_type:
|
23
|
+
carrier_type_has_checkout_type: 資料の形態と貸出区分の関係
|
24
24
|
|
25
25
|
attributes:
|
26
26
|
basket:
|
@@ -78,6 +78,7 @@ ja:
|
|
78
78
|
carrier_type_has_checkout_type:
|
79
79
|
note: 注記
|
80
80
|
position: 位置
|
81
|
+
checkout_type_id: 貸出種別
|
81
82
|
manifestation_checkout_stat:
|
82
83
|
start_date: 開始日
|
83
84
|
end_date: 終了日
|
@@ -9,6 +9,8 @@ module EnjuCirculation
|
|
9
9
|
has_many :user_group_has_checkout_types, :dependent => :destroy
|
10
10
|
has_many :checkout_types, :through => :user_group_has_checkout_types, :order => :position
|
11
11
|
has_many :lending_policies
|
12
|
+
attr_accessible :user_group_has_checkout_types_attributes
|
13
|
+
accepts_nested_attributes_for :user_group_has_checkout_types, :allow_destroy => true, :reject_if => :all_blank
|
12
14
|
|
13
15
|
validates_numericality_of :number_of_day_to_notify_due_date,
|
14
16
|
:number_of_day_to_notify_overdue,
|
@@ -320,8 +320,8 @@ describe CheckoutsController do
|
|
320
320
|
|
321
321
|
it "should update checkout item that is reserved" do
|
322
322
|
put :update, :id => 8, :checkout => { }
|
323
|
-
|
324
|
-
response.should
|
323
|
+
assigns(:checkout).errors[:base].include?(I18n.t('checkout.this_item_is_reserved')).should be_true
|
324
|
+
response.should be_success
|
325
325
|
end
|
326
326
|
|
327
327
|
it "should update other user's checkout" do
|
@@ -371,8 +371,8 @@ describe CheckoutsController do
|
|
371
371
|
|
372
372
|
it "should not update checkout already renewed" do
|
373
373
|
put :update, :id => 9, :checkout => { }
|
374
|
-
|
375
|
-
response.should
|
374
|
+
assigns(:checkout).errors[:base].include?(I18n.t('checkout.excessed_renewal_limit')).should be_true
|
375
|
+
response.should be_success
|
376
376
|
end
|
377
377
|
|
378
378
|
it "should update my checkout" do
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
Binary file
|
Binary file
|
@@ -5,9 +5,11 @@ describe Checkout do
|
|
5
5
|
#pending "add some examples to (or delete) #{__FILE__}"
|
6
6
|
fixtures :all
|
7
7
|
|
8
|
-
it "should respond to
|
9
|
-
checkouts(:checkout_00001).
|
10
|
-
checkouts(:
|
8
|
+
it "should respond to renewable?" do
|
9
|
+
checkouts(:checkout_00001).save
|
10
|
+
checkouts(:checkout_00001).errors[:base].should eq []
|
11
|
+
checkouts(:checkout_00002).save
|
12
|
+
checkouts(:checkout_00002).errors[:base].should eq [I18n.t('checkout.this_item_is_reserved')]
|
11
13
|
end
|
12
14
|
|
13
15
|
it "should respond to reserved?" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.pre25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kosuke Tanabe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: enju_core
|
@@ -306,6 +306,7 @@ files:
|
|
306
306
|
- app/views/carrier_type_has_checkout_types/index.html.erb
|
307
307
|
- app/views/carrier_type_has_checkout_types/new.html.erb
|
308
308
|
- app/views/carrier_type_has_checkout_types/show.html.erb
|
309
|
+
- app/views/carrier_types/_checkout_form.html.erb
|
309
310
|
- app/views/checked_items/_checked_item.html.erb
|
310
311
|
- app/views/checked_items/_checkout.html.erb
|
311
312
|
- app/views/checked_items/_list.html.erb
|
@@ -416,6 +417,7 @@ files:
|
|
416
417
|
- app/views/user_group_has_checkout_types/index.html.erb
|
417
418
|
- app/views/user_group_has_checkout_types/new.html.erb
|
418
419
|
- app/views/user_group_has_checkout_types/show.html.erb
|
420
|
+
- app/views/user_groups/_checkout_form.html.erb
|
419
421
|
- app/views/user_reserve_stats/_form.html.erb
|
420
422
|
- app/views/user_reserve_stats/edit.html.erb
|
421
423
|
- app/views/user_reserve_stats/index.html.erb
|
@@ -635,16 +637,16 @@ files:
|
|
635
637
|
- spec/dummy/solr/conf/spellings.txt
|
636
638
|
- spec/dummy/solr/conf/stopwords.txt
|
637
639
|
- spec/dummy/solr/conf/synonyms.txt
|
638
|
-
- spec/dummy/solr/data/test/index/
|
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/
|
640
|
+
- spec/dummy/solr/data/test/index/_1yy.fdt
|
641
|
+
- spec/dummy/solr/data/test/index/_1yy.fdx
|
642
|
+
- spec/dummy/solr/data/test/index/_1yy.fnm
|
643
|
+
- spec/dummy/solr/data/test/index/_1yy.frq
|
644
|
+
- spec/dummy/solr/data/test/index/_1yy.nrm
|
645
|
+
- spec/dummy/solr/data/test/index/_1yy.prx
|
646
|
+
- spec/dummy/solr/data/test/index/_1yy.tii
|
647
|
+
- spec/dummy/solr/data/test/index/_1yy.tis
|
646
648
|
- spec/dummy/solr/data/test/index/segments.gen
|
647
|
-
- spec/dummy/solr/data/test/index/
|
649
|
+
- spec/dummy/solr/data/test/index/segments_3xz
|
648
650
|
- spec/dummy/solr/data/test/spellchecker/segments.gen
|
649
651
|
- spec/dummy/solr/data/test/spellchecker/segments_1
|
650
652
|
- spec/factories/basket.rb
|
@@ -910,16 +912,16 @@ test_files:
|
|
910
912
|
- spec/dummy/solr/conf/spellings.txt
|
911
913
|
- spec/dummy/solr/conf/stopwords.txt
|
912
914
|
- spec/dummy/solr/conf/synonyms.txt
|
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/
|
919
|
-
- spec/dummy/solr/data/test/index/
|
920
|
-
- spec/dummy/solr/data/test/index/
|
915
|
+
- spec/dummy/solr/data/test/index/_1yy.fdt
|
916
|
+
- spec/dummy/solr/data/test/index/_1yy.fdx
|
917
|
+
- spec/dummy/solr/data/test/index/_1yy.fnm
|
918
|
+
- spec/dummy/solr/data/test/index/_1yy.frq
|
919
|
+
- spec/dummy/solr/data/test/index/_1yy.nrm
|
920
|
+
- spec/dummy/solr/data/test/index/_1yy.prx
|
921
|
+
- spec/dummy/solr/data/test/index/_1yy.tii
|
922
|
+
- spec/dummy/solr/data/test/index/_1yy.tis
|
921
923
|
- spec/dummy/solr/data/test/index/segments.gen
|
922
|
-
- spec/dummy/solr/data/test/index/
|
924
|
+
- spec/dummy/solr/data/test/index/segments_3xz
|
923
925
|
- spec/dummy/solr/data/test/spellchecker/segments.gen
|
924
926
|
- spec/dummy/solr/data/test/spellchecker/segments_1
|
925
927
|
- 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
|
File without changes
|