enju_circulation 0.0.62 → 0.0.63
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/checkins_controller.rb +3 -1
- data/app/controllers/reserves_controller.rb +17 -10
- data/app/models/checked_item.rb +1 -1
- data/app/models/checkin.rb +4 -2
- data/lib/enju_circulation/version.rb +1 -1
- data/spec/controllers/checkins_controller_spec.rb +2 -2
- data/spec/controllers/checkouts_controller_spec.rb +1 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/data/test/index/segments_1 +0 -0
- data/spec/dummy/solr/data/test/spellchecker/segments_1 +0 -0
- metadata +2 -2
@@ -100,9 +100,11 @@ class CheckinsController < ApplicationController
|
|
100
100
|
item = Item.where(:item_identifier => @checkin.item_identifier.to_s.strip).first
|
101
101
|
end
|
102
102
|
@checkin.item = item
|
103
|
+
@checkin.assign_attributes(params[:checkin])
|
104
|
+
@checkin.librarian = current_user
|
103
105
|
|
104
106
|
respond_to do |format|
|
105
|
-
if @checkin.
|
107
|
+
if @checkin.save
|
106
108
|
format.html { redirect_to @checkin, :notice => t('controller.successfully_updated', :model => t('activerecord.models.checkin')) }
|
107
109
|
format.json { head :no_content }
|
108
110
|
else
|
@@ -62,16 +62,16 @@ class ReservesController < ApplicationController
|
|
62
62
|
# GET /reserves/new.json
|
63
63
|
def new
|
64
64
|
@reserve = Reserve.new(params[:reserve])
|
65
|
-
|
65
|
+
|
66
|
+
if current_user.has_role?('Librarian')
|
66
67
|
@reserve.user = @user
|
67
68
|
else
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
if @reserve.user and @reserve.user != current_user
|
73
|
-
access_denied; return
|
69
|
+
if @user.present?
|
70
|
+
if @user != current_user
|
71
|
+
access_denied; return
|
72
|
+
end
|
74
73
|
end
|
74
|
+
@reserve.user_number = current_user.user_number
|
75
75
|
end
|
76
76
|
|
77
77
|
get_manifestation
|
@@ -98,9 +98,15 @@ class ReservesController < ApplicationController
|
|
98
98
|
@reserve = Reserve.new(params[:reserve])
|
99
99
|
@reserve.user = User.where(:user_number => @reserve.user_number).first if @reserve.user_number.to_s.strip.present?
|
100
100
|
|
101
|
-
|
101
|
+
if current_user.has_role?('Librarian')
|
102
|
+
unless @reserve.user
|
103
|
+
@reserve.user = @user
|
104
|
+
end
|
105
|
+
else
|
102
106
|
if @reserve.user != current_user
|
103
|
-
|
107
|
+
if @user != current_user
|
108
|
+
access_denied; return
|
109
|
+
end
|
104
110
|
end
|
105
111
|
end
|
106
112
|
|
@@ -121,6 +127,7 @@ class ReservesController < ApplicationController
|
|
121
127
|
# PUT /reserves/1
|
122
128
|
# PUT /reserves/1.json
|
123
129
|
def update
|
130
|
+
@reserve.assign_attributes(params[:reserve])
|
124
131
|
@reserve.user = User.where(:user_number => @reserve.user_number).first if @reserve.user_number.to_s.strip.present?
|
125
132
|
|
126
133
|
unless current_user.has_role?('Librarian')
|
@@ -134,7 +141,7 @@ class ReservesController < ApplicationController
|
|
134
141
|
end
|
135
142
|
|
136
143
|
respond_to do |format|
|
137
|
-
if @reserve.
|
144
|
+
if @reserve.save
|
138
145
|
if @reserve.state == 'canceled'
|
139
146
|
flash[:notice] = t('reserve.reservation_was_canceled')
|
140
147
|
@reserve.send_message
|
data/app/models/checked_item.rb
CHANGED
data/app/models/checkin.rb
CHANGED
@@ -20,7 +20,9 @@ class Checkin < ActiveRecord::Base
|
|
20
20
|
def item_checkin(current_user)
|
21
21
|
message = ''
|
22
22
|
Checkin.transaction do
|
23
|
-
checkouts = Checkout.not_returned.where(:item_id => item_id).select(
|
23
|
+
checkouts = Checkout.not_returned.where(:item_id => item_id).select(
|
24
|
+
[:id, :item_id, :user_id, :basket_id, :due_date, :lock_version]
|
25
|
+
)
|
24
26
|
item.checkin!
|
25
27
|
checkouts.each do |checkout|
|
26
28
|
# TODO: ILL時の処理
|
@@ -28,7 +30,7 @@ class Checkin < ActiveRecord::Base
|
|
28
30
|
unless checkout.user.try(:save_checkout_history)
|
29
31
|
checkout.user = nil
|
30
32
|
end
|
31
|
-
checkout.save
|
33
|
+
checkout.save!
|
32
34
|
unless checkout.item.shelf.library == current_user.library
|
33
35
|
message << I18n.t('checkin.other_library_item')
|
34
36
|
end
|
@@ -312,8 +312,8 @@ describe CheckinsController do
|
|
312
312
|
describe "PUT update" do
|
313
313
|
before(:each) do
|
314
314
|
@checkin = checkins(:checkin_00001)
|
315
|
-
@attrs = {:item_identifier => @checkin.item.item_identifier
|
316
|
-
@invalid_attrs = {:
|
315
|
+
@attrs = {:item_identifier => @checkin.item.item_identifier}
|
316
|
+
@invalid_attrs = {:item_identifier => 'invalid'}
|
317
317
|
end
|
318
318
|
|
319
319
|
describe "When logged in as Administrator" do
|
@@ -237,7 +237,7 @@ describe CheckoutsController do
|
|
237
237
|
before(:each) do
|
238
238
|
@checkout = checkouts(:checkout_00003)
|
239
239
|
@attrs = {:due_date => 1.day.from_now}
|
240
|
-
@invalid_attrs = {:
|
240
|
+
@invalid_attrs = {:item_identifier => 'invalid'}
|
241
241
|
end
|
242
242
|
|
243
243
|
describe "When logged in as Administrator" do
|
data/spec/dummy/db/test.sqlite3
CHANGED
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.0.
|
4
|
+
version: 0.0.63
|
5
5
|
prerelease:
|
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-06-
|
12
|
+
date: 2012-06-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|