enju_circulation 0.1.0.pre40 → 0.1.0.pre41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +8 -1
  3. data/app/controllers/checked_items_controller.rb +1 -1
  4. data/app/controllers/checkout_types_controller.rb +0 -7
  5. data/app/controllers/checkouts_controller.rb +1 -1
  6. data/app/controllers/manifestation_checkout_stats_controller.rb +22 -8
  7. data/app/controllers/reserves_controller.rb +17 -5
  8. data/app/models/carrier_type_has_checkout_type.rb +2 -3
  9. data/app/models/checked_item.rb +2 -3
  10. data/app/models/checkin.rb +2 -3
  11. data/app/models/checkout.rb +6 -2
  12. data/app/models/checkout_stat_has_manifestation.rb +2 -3
  13. data/app/models/checkout_stat_has_user.rb +2 -3
  14. data/app/models/checkout_type.rb +2 -3
  15. data/app/models/circulation_status.rb +2 -3
  16. data/app/models/item_has_use_restriction.rb +2 -3
  17. data/app/models/lending_policy.rb +2 -3
  18. data/app/models/manifestation_checkout_stat.rb +3 -3
  19. data/app/models/manifestation_checkout_stat_state_machine.rb +1 -1
  20. data/app/models/manifestation_checkout_stat_transition.rb +2 -2
  21. data/app/models/manifestation_reserve_stat.rb +3 -3
  22. data/app/models/manifestation_reserve_stat_transition.rb +2 -2
  23. data/app/models/reserve.rb +14 -11
  24. data/app/models/reserve_stat_has_manifestation.rb +2 -3
  25. data/app/models/reserve_stat_has_user.rb +2 -3
  26. data/app/models/reserve_transition.rb +2 -2
  27. data/app/models/use_restriction.rb +2 -3
  28. data/app/models/user_checkout_stat.rb +2 -2
  29. data/app/models/user_checkout_stat_transition.rb +2 -2
  30. data/app/models/user_group_has_checkout_type.rb +6 -7
  31. data/app/models/user_reserve_stat.rb +2 -2
  32. data/app/models/user_reserve_stat_transition.rb +2 -2
  33. data/app/views/checkouts/_list.html.erb +5 -0
  34. data/app/views/checkouts/index.rss.builder +3 -3
  35. data/app/views/manifestation_checkout_stats/_group_by_carrier_type.html.erb +53 -0
  36. data/app/views/manifestation_checkout_stats/_group_by_checkout_type.html.erb +54 -0
  37. data/app/views/manifestation_checkout_stats/show.html.erb +6 -38
  38. data/app/views/reserves/_new.html.erb +6 -1
  39. data/app/views/reserves/_new_user.html.erb +6 -1
  40. data/app/views/reserves/edit.html.erb +5 -0
  41. data/app/views/reserves/index.html.erb +2 -0
  42. data/app/views/reserves/index.rss.builder +2 -2
  43. data/app/views/reserves/show.html.erb +5 -0
  44. data/config/locales/translation_en.yml +2 -0
  45. data/config/locales/translation_ja.yml +2 -0
  46. data/db/migrate/20111129044509_add_pickup_location_to_reserve.rb +6 -0
  47. data/db/migrate/20140518050147_create_reserve_transitions.rb +5 -1
  48. data/db/migrate/20140528045518_create_user_checkout_stat_transitions.rb +5 -1
  49. data/db/migrate/20140528045539_create_user_reserve_stat_transitions.rb +5 -1
  50. data/db/migrate/20140528045600_create_manifestation_checkout_stat_transitions.rb +5 -1
  51. data/db/migrate/20140528045617_create_manifestation_reserve_stat_transitions.rb +5 -1
  52. data/db/migrate/20141014065831_add_shelf_id_to_checkout.rb +6 -0
  53. data/db/migrate/20141020120523_add_library_id_to_checkout.rb +6 -0
  54. data/lib/enju_circulation/accept.rb +22 -0
  55. data/lib/enju_circulation/basket.rb +37 -0
  56. data/lib/enju_circulation/item.rb +14 -8
  57. data/lib/enju_circulation/profile.rb +1 -1
  58. data/lib/enju_circulation/version.rb +1 -1
  59. data/lib/enju_circulation.rb +4 -0
  60. data/lib/tasks/checkout.rb +7 -0
  61. data/lib/tasks/enju_circulation_tasks.rake +10 -2
  62. data/spec/controllers/manifestation_checkout_stats_controller_spec.rb +2 -0
  63. data/spec/dummy/config/database.yml +23 -18
  64. data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +5 -1
  65. data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +5 -1
  66. data/spec/dummy/db/migrate/20140519170214_create_resource_import_file_transitions.rb +5 -1
  67. data/spec/dummy/db/migrate/20140519171220_create_import_request_transitions.rb +5 -1
  68. data/spec/dummy/db/migrate/20140524020735_create_agent_import_file_transitions.rb +5 -1
  69. data/spec/dummy/db/migrate/20140614141500_create_resource_export_file_transitions.rb +5 -1
  70. data/spec/dummy/db/schema.rb +561 -555
  71. data/spec/fixtures/carrier_type_has_checkout_types.yml +2 -3
  72. data/spec/fixtures/checked_items.yml +6 -7
  73. data/spec/fixtures/checkins.yml +2 -3
  74. data/spec/fixtures/checkout_stat_has_manifestations.yml +2 -3
  75. data/spec/fixtures/checkout_stat_has_users.yml +2 -3
  76. data/spec/fixtures/checkout_types.yml +2 -3
  77. data/spec/fixtures/checkouts.yml +17 -15
  78. data/spec/fixtures/circulation_statuses.yml +2 -3
  79. data/spec/fixtures/item_has_use_restrictions.yml +2 -3
  80. data/spec/fixtures/lending_policies.yml +2 -3
  81. data/spec/fixtures/manifestation_checkout_stats.yml +2 -2
  82. data/spec/fixtures/manifestation_reserve_stats.yml +2 -2
  83. data/spec/fixtures/manifestations.yml +114 -114
  84. data/spec/fixtures/reserve_stat_has_manifestations.yml +2 -3
  85. data/spec/fixtures/reserve_stat_has_users.yml +2 -3
  86. data/spec/fixtures/reserve_transitions.yml +2 -2
  87. data/spec/fixtures/reserves.yml +20 -19
  88. data/spec/fixtures/use_restrictions.yml +2 -3
  89. data/spec/fixtures/user_checkout_stats.yml +2 -2
  90. data/spec/fixtures/user_group_has_checkout_types.yml +2 -3
  91. data/spec/fixtures/user_reserve_stats.yml +2 -2
  92. data/spec/fixtures/users.yml +1 -1
  93. data/spec/models/basket_spec.rb +15 -2
  94. data/spec/models/carrier_type_has_checkout_type_spec.rb +2 -3
  95. data/spec/models/checked_item_spec.rb +2 -3
  96. data/spec/models/checkin_spec.rb +2 -3
  97. data/spec/models/checkout_spec.rb +4 -2
  98. data/spec/models/checkout_stat_has_manifestation_spec.rb +2 -3
  99. data/spec/models/checkout_stat_has_user_spec.rb +2 -3
  100. data/spec/models/checkout_type_spec.rb +2 -3
  101. data/spec/models/circulation_status_spec.rb +2 -3
  102. data/spec/models/lending_policy_spec.rb +2 -3
  103. data/spec/models/manifestation_checkout_stat_spec.rb +5 -4
  104. data/spec/models/manifestation_reserve_stat_spec.rb +2 -2
  105. data/spec/models/reserve_spec.rb +3 -2
  106. data/spec/models/reserve_stat_has_manifestation_spec.rb +2 -3
  107. data/spec/models/reserve_stat_has_user_spec.rb +2 -3
  108. data/spec/models/user_checkout_stat_spec.rb +2 -2
  109. data/spec/models/user_group_has_checkout_type_spec.rb +2 -3
  110. data/spec/models/user_reserve_stat_spec.rb +2 -2
  111. data/spec/spec_helper.rb +2 -0
  112. metadata +44 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e28fea41163e953a23b7795ba5e2544e0b8b9499
4
- data.tar.gz: 67f915f13223995b0cace199886abd1ba72753c2
3
+ metadata.gz: bc28894fa75205e043a65091c988180f9ec16291
4
+ data.tar.gz: c032ab36c6bb6973ad8c7d333cda148feb0db4c6
5
5
  SHA512:
6
- metadata.gz: 65389ba2246803d37c50b8bbdfae76a4bedfe1f4026af104f759e7184dd769fe92761aaba09b596b0c7e3091108c299b46c253cb7c6f584549e6db2900786589
7
- data.tar.gz: 5c741d5e09449953ea957f01be5cd2e548d63b18ba3bebb372877e772b2bb464cfd6538d4ba7a33cece9275fb606d9f00db56a73e07f8804966dbdd9b799a446
6
+ metadata.gz: 38f85ed8019ed31ddc51516bed7bf0fd9764445b3ba9d4a3231fa27cdaccb744d7f0723bc211be6002e394c56e7e103ccbef73ba7aa84a62bd20f9537cb34e72
7
+ data.tar.gz: d35cb074110a6727b25a03fb57d1f38f25132dea4844dd31b1371db40383612b4d6cacfaf2f17269b545cca4adf96fbfeb0071227c73415dc8c84516eee9957c
data/README.rdoc CHANGED
@@ -1,3 +1,10 @@
1
- = EnjuCirculation {<img src="https://secure.travis-ci.org/nabeta/enju_circulation.png?branch=master" alt="Build Status" />}[http://travis-ci.org/nabeta/enju_circulation]
1
+ = EnjuCirculation
2
+ {<img src="https://secure.travis-ci.org/next-l/enju_circulation.png?branch=1.1" alt="Build Status" />}[http://travis-ci.org/next-l/enju_circulation]
3
+ {<img src="https://coveralls.io/repos/next-l/enju_circulation/badge.png?branch=1.1" alt="Coverage Status" />}[https://coveralls.io/r/next-l/enju_circulation?branch=1.1]
4
+ {<img src="https://hakiri.io/github/next-l/enju_circulation/1.1.svg" alt="security" />}[https://hakiri.io/github/next-l/enju_circulation/1.1]
2
5
 
3
6
  This project rocks and uses MIT-LICENSE.
7
+
8
+ == 製作者・貢献者 (Authors and contributors)
9
+ * {TANABE, Kosuke}[https://github.com/nabeta] ({@nabeta}[https://twitter.com/nabeta])
10
+ * {Project Next-L}[http://www.next-l.jp] ({@ProjectNextL}[https://twitter.com/ProjectNextL])
@@ -88,7 +88,7 @@ class CheckedItemsController < ApplicationController
88
88
 
89
89
  respond_to do |format|
90
90
  if @checked_item.update_attributes(params[:checked_item])
91
- format.html { redirect_to @checked_item, notice: t('controller.successfully_updated', model: t('activerecord.models.checked_item')) }
91
+ format.html { redirect_to checked_item_url(@checked_item), notice: t('controller.successfully_updated', model: t('activerecord.models.checked_item')) }
92
92
  format.json { head :no_content }
93
93
  else
94
94
  format.html { render action: "edit" }
@@ -47,9 +47,6 @@ class CheckoutTypesController < ApplicationController
47
47
 
48
48
  # GET /checkout_types/1/edit
49
49
  def edit
50
- if @user_group
51
- @checkout_type = @user_group.checkout_types.find(params[:id])
52
- end
53
50
  end
54
51
 
55
52
  # POST /checkout_types
@@ -75,10 +72,6 @@ class CheckoutTypesController < ApplicationController
75
72
  # PUT /checkout_types/1
76
73
  # PUT /checkout_types/1.json
77
74
  def update
78
- if @user_group
79
- @checkout_type = @user_group.checkout_types.find(params[:id])
80
- end
81
-
82
75
  if params[:move]
83
76
  move_position(@checkout_type, params[:move])
84
77
  return
@@ -10,7 +10,7 @@ class CheckoutsController < ApplicationController
10
10
  # GET /checkouts.json
11
11
  def index
12
12
  if params[:icalendar_token].present?
13
- icalendar_user = Profile.where(:checkout_icalendar_token => params[:icalendar_token]).first.try(:user)
13
+ icalendar_user = Profile.where(checkout_icalendar_token: params[:icalendar_token]).first.try(:user)
14
14
  if icalendar_user.blank?
15
15
  raise ActiveRecord::RecordNotFound
16
16
  else
@@ -21,20 +21,32 @@ class ManifestationCheckoutStatsController < ApplicationController
21
21
  else
22
22
  per_page = CheckoutStatHasManifestation.default_per_page
23
23
  end
24
- @stats = Checkout.where(
24
+
25
+ @carrier_type_results = Checkout.where(
25
26
  Checkout.arel_table[:created_at].gteq @manifestation_checkout_stat.start_date
26
27
  ).where(
27
28
  Checkout.arel_table[:created_at].lt @manifestation_checkout_stat.end_date
28
- ).joins(item: [:manifestation]).group(:manifestation_id).merge(
29
+ ).joins(item: :manifestation).group(
30
+ 'checkouts.shelf_id', :carrier_type_id
31
+ ).merge(
29
32
  Manifestation.where(carrier_type_id: CarrierType.pluck(:id))
30
- ).order('count_id DESC').page(params[:page])
31
- @breakdown = Checkout.where(
33
+ ).count(:id)
34
+
35
+ @checkout_type_results = Checkout.where(
36
+ Checkout.arel_table[:created_at].gteq @manifestation_checkout_stat.start_date
37
+ ).where(
38
+ Checkout.arel_table[:created_at].lt @manifestation_checkout_stat.end_date
39
+ ).joins(item: :manifestation).group(
40
+ 'checkouts.shelf_id', :checkout_type_id
41
+ ).count(:id)
42
+
43
+ @stats = Checkout.where(
32
44
  Checkout.arel_table[:created_at].gteq @manifestation_checkout_stat.start_date
33
45
  ).where(
34
46
  Checkout.arel_table[:created_at].lt @manifestation_checkout_stat.end_date
35
- ).joins(item: [:shelf, :manifestation]).group(:carrier_type_id).merge(
47
+ ).joins(item: :manifestation).group(:manifestation_id).merge(
36
48
  Manifestation.where(carrier_type_id: CarrierType.pluck(:id))
37
- ).order('manifestations.carrier_type_id').count(:id)
49
+ ).order('count_id DESC').page(params[:page]).per(per_page)
38
50
 
39
51
  respond_to do |format|
40
52
  format.html # show.html.erb
@@ -67,8 +79,10 @@ class ManifestationCheckoutStatsController < ApplicationController
67
79
 
68
80
  respond_to do |format|
69
81
  if @manifestation_checkout_stat.save
70
- Resque.enqueue(ManifestationCheckoutStatQueue, @manifestation_checkout_stat.id)
71
- format.html { redirect_to @manifestation_checkout_stat, notice: t('statistic.successfully_created', model: t('activerecord.models.manifestation_checkout_stat')) }
82
+ @manifestation_checkout_stat.transition_to(:started)
83
+ @manifestation_checkout_stat.transition_to!(:completed)
84
+ #Resque.enqueue(ManifestationCheckoutStatQueue, @manifestation_checkout_stat.id)
85
+ format.html { redirect_to @manifestation_checkout_stat, notice: t('controller.successfully_created', model: t('activerecord.models.manifestation_checkout_stat')) }
72
86
  format.json { render json: @manifestation_checkout_stat, status: :created, location: @manifestation_checkout_stat }
73
87
  else
74
88
  format.html { render action: "new" }
@@ -3,6 +3,7 @@ class ReservesController < ApplicationController
3
3
  before_filter :store_location, only: [:index, :new]
4
4
  load_and_authorize_resource except: :index
5
5
  authorize_resource only: :index
6
+ before_filter :prepare_options, only: [:new, :edit]
6
7
  before_filter :get_user, only: [:index, :new]
7
8
  before_filter :store_page
8
9
  helper_method :get_manifestation
@@ -95,7 +96,7 @@ class ReservesController < ApplicationController
95
96
  order_by sort_column, order
96
97
  with(:state).equal_to state if state
97
98
  facet :state
98
- paginate :page => page.to_i, :per_page => per_page
99
+ paginate page: page.to_i, per_page: per_page
99
100
  end
100
101
 
101
102
  @reserves = search.execute.results
@@ -122,7 +123,7 @@ class ReservesController < ApplicationController
122
123
  # GET /reserves/new
123
124
  # GET /reserves/new.json
124
125
  def new
125
- @reserve = Reserve.new(params[:reserve])
126
+ @reserve = Reserve.new
126
127
 
127
128
  if current_user.has_role?('Librarian')
128
129
  @reserve.user = @user
@@ -157,7 +158,11 @@ class ReservesController < ApplicationController
157
158
  # POST /reserves
158
159
  # POST /reserves.json
159
160
  def create
160
- @reserve = Reserve.new(params[:reserve])
161
+ if current_user.has_role?('Librarian')
162
+ @reserve = Reserve.new(params[:reserve], as: :admin)
163
+ else
164
+ @reserve = Reserve.new(params[:reserve])
165
+ end
161
166
  @reserve.set_user
162
167
 
163
168
  if current_user.has_role?('Librarian')
@@ -179,6 +184,7 @@ class ReservesController < ApplicationController
179
184
  format.html { redirect_to @reserve, notice: t('controller.successfully_created', model: t('activerecord.models.reserve')) }
180
185
  format.json { render json: @reserve, status: :created, location: reserve_url(@reserve) }
181
186
  else
187
+ prepare_options
182
188
  format.html { render action: "new" }
183
189
  format.json { render json: @reserve.errors, status: :unprocessable_entity }
184
190
  end
@@ -202,11 +208,11 @@ class ReservesController < ApplicationController
202
208
  @reserve.transition_to!(:canceled)
203
209
  else
204
210
  if @reserve.retained?
205
- if @reserve.item_identifier and @reserve.force_retaining == '1'
211
+ if @reserve.item_identifier.present? and @reserve.force_retaining == '1'
206
212
  @reserve.transition_to!(:retained)
207
213
  end
208
214
  else
209
- @reserve.transition_to!(:retained) if @reserve.item_identifier
215
+ @reserve.transition_to!(:retained) if @reserve.item_identifier.present?
210
216
  end
211
217
  end
212
218
  end
@@ -221,6 +227,7 @@ class ReservesController < ApplicationController
221
227
  format.html { redirect_to @reserve }
222
228
  format.json { head :no_content }
223
229
  else
230
+ prepare_options
224
231
  format.html { render action: "edit" }
225
232
  format.json { render json: @reserve.errors, status: :unprocessable_entity }
226
233
  end
@@ -247,4 +254,9 @@ class ReservesController < ApplicationController
247
254
  format.json { head :no_content }
248
255
  end
249
256
  end
257
+
258
+ private
259
+ def prepare_options
260
+ @libraries = Library.real.order(:position)
261
+ end
250
262
  end
@@ -22,7 +22,6 @@ end
22
22
  # checkout_type_id :integer not null
23
23
  # note :text
24
24
  # position :integer
25
- # created_at :datetime not null
26
- # updated_at :datetime not null
25
+ # created_at :datetime
26
+ # updated_at :datetime
27
27
  #
28
-
@@ -132,8 +132,7 @@ end
132
132
  # item_id :integer not null
133
133
  # basket_id :integer not null
134
134
  # due_date :datetime not null
135
- # created_at :datetime not null
136
- # updated_at :datetime not null
135
+ # created_at :datetime
136
+ # updated_at :datetime
137
137
  # librarian_id :integer
138
138
  #
139
-
@@ -90,8 +90,7 @@ end
90
90
  # item_id :integer not null
91
91
  # librarian_id :integer
92
92
  # basket_id :integer
93
- # created_at :datetime not null
94
- # updated_at :datetime not null
93
+ # created_at :datetime
94
+ # updated_at :datetime
95
95
  # lock_version :integer default(0), not null
96
96
  #
97
-
@@ -13,6 +13,8 @@ class Checkout < ActiveRecord::Base
13
13
  belongs_to :checkin
14
14
  belongs_to :librarian, class_name: 'User'
15
15
  belongs_to :basket
16
+ belongs_to :shelf
17
+ belongs_to :library
16
18
 
17
19
  validates_associated :user, :item, :librarian, :checkin #, :basket
18
20
  # TODO: 貸出履歴を保存しない場合は、ユーザ名を削除する
@@ -169,6 +171,8 @@ end
169
171
  # due_date :datetime
170
172
  # checkout_renewal_count :integer default(0), not null
171
173
  # lock_version :integer default(0), not null
172
- # created_at :datetime not null
173
- # updated_at :datetime not null
174
+ # created_at :datetime
175
+ # updated_at :datetime
176
+ # shelf_id :integer
177
+ # library_id :integer
174
178
  #
@@ -18,7 +18,6 @@ end
18
18
  # manifestation_checkout_stat_id :integer not null
19
19
  # manifestation_id :integer not null
20
20
  # checkouts_count :integer
21
- # created_at :datetime not null
22
- # updated_at :datetime not null
21
+ # created_at :datetime
22
+ # updated_at :datetime
23
23
  #
24
-
@@ -18,7 +18,6 @@ end
18
18
  # user_checkout_stat_id :integer not null
19
19
  # user_id :integer not null
20
20
  # checkouts_count :integer default(0), not null
21
- # created_at :datetime not null
22
- # updated_at :datetime not null
21
+ # created_at :datetime
22
+ # updated_at :datetime
23
23
  #
24
-
@@ -25,7 +25,6 @@ end
25
25
  # display_name :text
26
26
  # note :text
27
27
  # position :integer
28
- # created_at :datetime not null
29
- # updated_at :datetime not null
28
+ # created_at :datetime
29
+ # updated_at :datetime
30
30
  #
31
-
@@ -22,7 +22,6 @@ end
22
22
  # display_name :text
23
23
  # note :text
24
24
  # position :integer
25
- # created_at :datetime not null
26
- # updated_at :datetime not null
25
+ # created_at :datetime
26
+ # updated_at :datetime
27
27
  #
28
-
@@ -18,7 +18,6 @@ end
18
18
  # id :integer not null, primary key
19
19
  # item_id :integer not null
20
20
  # use_restriction_id :integer not null
21
- # created_at :datetime not null
22
- # updated_at :datetime not null
21
+ # created_at :datetime
22
+ # updated_at :datetime
23
23
  #
24
-
@@ -27,7 +27,6 @@ end
27
27
  # fine :integer default(0), not null
28
28
  # note :text
29
29
  # position :integer
30
- # created_at :datetime not null
31
- # updated_at :datetime not null
30
+ # created_at :datetime
31
+ # updated_at :datetime
32
32
  #
33
-
@@ -24,7 +24,7 @@ class ManifestationCheckoutStat < ActiveRecord::Base
24
24
  self.started_at = Time.zone.now
25
25
  Manifestation.find_each do |manifestation|
26
26
  daily_count = Checkout.manifestations_count(start_date.beginning_of_day, end_date.tomorrow.beginning_of_day, manifestation)
27
- #manifestation.update_attributes({:daily_checkouts_count => daily_count, :total_count => manifestation.total_count + daily_count})
27
+ #manifestation.update_attributes({daily_checkouts_count: daily_count, total_count: manifestation.total_count + daily_count})
28
28
  if daily_count > 0
29
29
  self.manifestations << manifestation
30
30
  sql = ['UPDATE checkout_stat_has_manifestations SET checkouts_count = ? WHERE manifestation_checkout_stat_id = ? AND manifestation_id = ?', daily_count, id, manifestation.id]
@@ -52,8 +52,8 @@ end
52
52
  # start_date :datetime
53
53
  # end_date :datetime
54
54
  # note :text
55
- # created_at :datetime not null
56
- # updated_at :datetime not null
55
+ # created_at :datetime
56
+ # updated_at :datetime
57
57
  # started_at :datetime
58
58
  # completed_at :datetime
59
59
  # user_id :integer
@@ -9,7 +9,7 @@ class ManifestationCheckoutStatStateMachine
9
9
 
10
10
  after_transition(to: :started) do |manifestation_checkout_stat|
11
11
  manifestation_checkout_stat.update_column(:started_at, Time.zone.now)
12
- manifestation_checkout_stat.calculate_count!
12
+ #manifestation_checkout_stat.calculate_count!
13
13
  end
14
14
 
15
15
  after_transition(to: :completed) do |manifestation_checkout_stat|
@@ -15,6 +15,6 @@ end
15
15
  # metadata :text default("{}")
16
16
  # sort_key :integer
17
17
  # manifestation_checkout_stat_id :integer
18
- # created_at :datetime not null
19
- # updated_at :datetime not null
18
+ # created_at :datetime
19
+ # updated_at :datetime
20
20
  #
@@ -24,7 +24,7 @@ class ManifestationReserveStat < ActiveRecord::Base
24
24
  self.started_at = Time.zone.now
25
25
  Manifestation.find_each do |manifestation|
26
26
  daily_count = manifestation.reserves.created(start_date.beginning_of_day, end_date.tomorrow.beginning_of_day).size
27
- #manifestation.update_attributes({:daily_reserves_count => daily_count, :total_count => manifestation.total_count + daily_count})
27
+ #manifestation.update_attributes({daily_reserves_count: daily_count, total_count: manifestation.total_count + daily_count})
28
28
  if daily_count > 0
29
29
  self.manifestations << manifestation
30
30
  sql = ['UPDATE reserve_stat_has_manifestations SET reserves_count = ? WHERE manifestation_reserve_stat_id = ? AND manifestation_id = ?', daily_count, id, manifestation.id]
@@ -52,8 +52,8 @@ end
52
52
  # start_date :datetime
53
53
  # end_date :datetime
54
54
  # note :text
55
- # created_at :datetime not null
56
- # updated_at :datetime not null
55
+ # created_at :datetime
56
+ # updated_at :datetime
57
57
  # started_at :datetime
58
58
  # completed_at :datetime
59
59
  # user_id :integer
@@ -15,6 +15,6 @@ end
15
15
  # metadata :text default("{}")
16
16
  # sort_key :integer
17
17
  # manifestation_reserve_stat_id :integer
18
- # created_at :datetime not null
19
- # updated_at :datetime not null
18
+ # created_at :datetime
19
+ # updated_at :datetime
20
20
  #
@@ -1,12 +1,13 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  class Reserve < ActiveRecord::Base
3
3
  include Statesman::Adapters::ActiveRecordModel
4
- attr_accessible :manifestation_id, :user_number, :expired_at
5
- attr_accessible :expired_at, as: :user_update
4
+ attr_accessible :manifestation_id, :user_number, :expired_at,
5
+ :pickup_location_id
6
+ attr_accessible :expired_at, :pickup_location_id, as: :user_update
6
7
  attr_accessible :manifestation_id, :item_identifier, :user_number,
7
8
  :expired_at, :request_status_type, :canceled_at, :checked_out_at,
8
9
  :expiration_notice_to_patron, :expiration_notice_to_library, :item_id,
9
- :retained_at, :postponed_at, :force_retaining,
10
+ :retained_at, :postponed_at, :force_retaining, :pickup_location_id,
10
11
  as: :admin
11
12
  scope :hold, -> { where('item_id IS NOT NULL') }
12
13
  scope :not_hold, -> { where(item_id: nil) }
@@ -18,17 +19,18 @@ class Reserve < ActiveRecord::Base
18
19
  scope :will_expire_retained, lambda {|datetime| in_state(:retained).where('checked_out_at IS NULL AND canceled_at IS NULL AND expired_at <= ?', datetime).order('expired_at')}
19
20
  scope :will_expire_pending, lambda {|datetime| in_state(:pending).where('checked_out_at IS NULL AND canceled_at IS NULL AND expired_at <= ?', datetime).order('expired_at')}
20
21
  scope :created, lambda {|start_date, end_date| where('created_at >= ? AND created_at < ?', start_date, end_date)}
21
- scope :not_sent_expiration_notice_to_patron, -> {in_state(:expired).where(:expiration_notice_to_patron => false)}
22
- scope :not_sent_expiration_notice_to_library, -> {in_state(:expired).where(:expiration_notice_to_library => false)}
23
- scope :sent_expiration_notice_to_patron, -> {in_state(:expired).where(:expiration_notice_to_patron => true)}
24
- scope :sent_expiration_notice_to_library, -> {in_state(:expired).where(:expiration_notice_to_library => true)}
25
- scope :not_sent_cancel_notice_to_patron, -> {in_state(:canceled).where(:expiration_notice_to_patron => false)}
26
- scope :not_sent_cancel_notice_to_library, -> {in_state(:canceled).where(:expiration_notice_to_library => false)}
22
+ scope :not_sent_expiration_notice_to_patron, -> {in_state(:expired).where(expiration_notice_to_patron: false)}
23
+ scope :not_sent_expiration_notice_to_library, -> {in_state(:expired).where(expiration_notice_to_library: false)}
24
+ scope :sent_expiration_notice_to_patron, -> {in_state(:expired).where(expiration_notice_to_patron: true)}
25
+ scope :sent_expiration_notice_to_library, -> {in_state(:expired).where(expiration_notice_to_library: true)}
26
+ scope :not_sent_cancel_notice_to_patron, -> {in_state(:canceled).where(expiration_notice_to_patron: false)}
27
+ scope :not_sent_cancel_notice_to_library, -> {in_state(:canceled).where(expiration_notice_to_library: false)}
27
28
  belongs_to :user
28
29
  belongs_to :manifestation, touch: true
29
30
  belongs_to :librarian, class_name: 'User'
30
31
  belongs_to :item, touch: true
31
32
  belongs_to :request_status_type
33
+ belongs_to :pickup_location, :class_name => 'Library'
32
34
 
33
35
  validates_associated :user, :librarian, :request_status_type
34
36
  validates :manifestation, associated: true #, on: :create
@@ -401,13 +403,14 @@ end
401
403
  # item_id :integer
402
404
  # request_status_type_id :integer not null
403
405
  # checked_out_at :datetime
404
- # created_at :datetime not null
405
- # updated_at :datetime not null
406
+ # created_at :datetime
407
+ # updated_at :datetime
406
408
  # canceled_at :datetime
407
409
  # expired_at :datetime
408
410
  # deleted_at :datetime
409
411
  # expiration_notice_to_patron :boolean default(FALSE)
410
412
  # expiration_notice_to_library :boolean default(FALSE)
413
+ # pickup_location_id :integer
411
414
  # retained_at :datetime
412
415
  # postponed_at :datetime
413
416
  # lock_version :integer default(0), not null
@@ -19,7 +19,6 @@ end
19
19
  # manifestation_reserve_stat_id :integer not null
20
20
  # manifestation_id :integer not null
21
21
  # reserves_count :integer
22
- # created_at :datetime not null
23
- # updated_at :datetime not null
22
+ # created_at :datetime
23
+ # updated_at :datetime
24
24
  #
25
-
@@ -19,7 +19,6 @@ end
19
19
  # user_reserve_stat_id :integer not null
20
20
  # user_id :integer not null
21
21
  # reserves_count :integer
22
- # created_at :datetime not null
23
- # updated_at :datetime not null
22
+ # created_at :datetime
23
+ # updated_at :datetime
24
24
  #
25
-
@@ -15,6 +15,6 @@ end
15
15
  # metadata :text default("{}")
16
16
  # sort_key :integer
17
17
  # reserve_id :integer
18
- # created_at :datetime not null
19
- # updated_at :datetime not null
18
+ # created_at :datetime
19
+ # updated_at :datetime
20
20
  #
@@ -23,7 +23,6 @@ end
23
23
  # display_name :text
24
24
  # note :text
25
25
  # position :integer
26
- # created_at :datetime not null
27
- # updated_at :datetime not null
26
+ # created_at :datetime
27
+ # updated_at :datetime
28
28
  #
29
-
@@ -51,8 +51,8 @@ end
51
51
  # start_date :datetime
52
52
  # end_date :datetime
53
53
  # note :text
54
- # created_at :datetime not null
55
- # updated_at :datetime not null
54
+ # created_at :datetime
55
+ # updated_at :datetime
56
56
  # started_at :datetime
57
57
  # completed_at :datetime
58
58
  # user_id :integer
@@ -15,6 +15,6 @@ end
15
15
  # metadata :text default("{}")
16
16
  # sort_key :integer
17
17
  # user_checkout_stat_id :integer
18
- # created_at :datetime not null
19
- # updated_at :datetime not null
18
+ # created_at :datetime
19
+ # updated_at :datetime
20
20
  #
@@ -4,8 +4,8 @@ class UserGroupHasCheckoutType < ActiveRecord::Base
4
4
  :reservation_limit, :reservation_expired_period,
5
5
  :set_due_date_before_closing_day, :fixed_due_date, :note, :position,
6
6
  :user_group, :checkout_type
7
- scope :available_for_item, lambda{|item| where(:checkout_type_id => item.checkout_type.id)}
8
- scope :available_for_carrier_type, lambda{|carrier_type| includes(:checkout_type => :carrier_types).where('carrier_types.id' => carrier_type.id)}
7
+ scope :available_for_item, lambda{|item| where(checkout_type_id: item.checkout_type.id)}
8
+ scope :available_for_carrier_type, lambda{|carrier_type| includes(checkout_type: :carrier_types).where('carrier_types.id' => carrier_type.id)}
9
9
 
10
10
  belongs_to :user_group, validate: true
11
11
  belongs_to :checkout_type, validate: true
@@ -20,7 +20,7 @@ class UserGroupHasCheckoutType < ActiveRecord::Base
20
20
 
21
21
  def create_lending_policy
22
22
  self.checkout_type.items.find_each do |item|
23
- policy = LendingPolicy.where(item_id: item.id, :user_group_id => user_group_id).select(:id).first
23
+ policy = LendingPolicy.where(item_id: item.id, user_group_id: user_group_id).select(:id).first
24
24
  unless policy
25
25
  sql = ['INSERT INTO lending_policies (item_id, user_group_id, loan_period, renewal, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)', item.id, user_group_id, checkout_period, checkout_renewal_limit, Time.zone.now, Time.zone.now]
26
26
  ActiveRecord::Base.connection.execute(
@@ -44,7 +44,7 @@ class UserGroupHasCheckoutType < ActiveRecord::Base
44
44
  'SELECT count(checkouts.id) as current_checkout_count,
45
45
  profiles.user_group_id,
46
46
  items.checkout_type_id
47
- FROM checkouts, profiles LEFT OUTER JOIN items
47
+ FROM profiles, checkouts LEFT OUTER JOIN items
48
48
  ON (checkouts.item_id = items.id)
49
49
  LEFT OUTER JOIN users
50
50
  ON (users.id = checkouts.user_id)
@@ -81,8 +81,7 @@ end
81
81
  # fixed_due_date :datetime
82
82
  # note :text
83
83
  # position :integer
84
- # created_at :datetime not null
85
- # updated_at :datetime not null
84
+ # created_at :datetime
85
+ # updated_at :datetime
86
86
  # current_checkout_count :integer
87
87
  #
88
-
@@ -51,8 +51,8 @@ end
51
51
  # start_date :datetime
52
52
  # end_date :datetime
53
53
  # note :text
54
- # created_at :datetime not null
55
- # updated_at :datetime not null
54
+ # created_at :datetime
55
+ # updated_at :datetime
56
56
  # started_at :datetime
57
57
  # completed_at :datetime
58
58
  # user_id :integer
@@ -15,6 +15,6 @@ end
15
15
  # metadata :text default("{}")
16
16
  # sort_key :integer
17
17
  # user_reserve_stat_id :integer
18
- # created_at :datetime not null
19
- # updated_at :datetime not null
18
+ # created_at :datetime
19
+ # updated_at :datetime
20
20
  #
@@ -21,6 +21,11 @@
21
21
  <%= render 'manifestations/show_index', manifestation: checkout.item.manifestation -%>
22
22
  (<%= link_to checkout.item.item_identifier, checkout.item -%>)
23
23
  <% end %>
24
+ <% if checkout.shelf %>
25
+ <%= t('activerecord.models.shelf') %>:
26
+ <%= link_to checkout.shelf.display_name.localize, checkout.shelf %>
27
+ (<%= link_to checkout.shelf.library.display_name.localize, checkout.shelf.library %>)
28
+ <% end %>
24
29
  </td>
25
30
  <td>
26
31
  <%= l(checkout.due_date, format: :only_date) -%>
@@ -1,4 +1,4 @@
1
- xml.instruct! :xml, :version=>"1.0"
1
+ xml.instruct! :xml, version: "1.0"
2
2
  xml.rss('version' => "2.0",
3
3
  'xmlns:opensearch' => "http://a9.com/-/spec/opensearch/1.1/",
4
4
  'xmlns:atom' => "http://www.w3.org/2005/Atom"){
@@ -17,12 +17,12 @@ xml.rss('version' => "2.0",
17
17
  xml.description "Next-L Enju, an open source integrated library system developed by Project Next-L"
18
18
  xml.language @locale.to_s
19
19
  xml.ttl "60"
20
- #xml.tag! "atom:link", rel: 'search', :type => 'application/opensearchdescription+xml', href: "http://#{request.host_with_port}/page/opensearch"
20
+ #xml.tag! "atom:link", rel: 'search', type: 'application/opensearchdescription+xml', href: "http://#{request.host_with_port}/page/opensearch"
21
21
  unless params[:query].blank?
22
22
  xml.tag! "opensearch:totalResults", @count[:query_result]
23
23
  xml.tag! "opensearch:startIndex", @checkouts.offset + 1
24
24
  xml.tag! "opensearch:itemsPerPage", @checkouts.per_page
25
- #xml.tag! "opensearch:Query", :role => 'request', :searchTerms => params[:query], :startPage => (params[:page] || 1)
25
+ #xml.tag! "opensearch:Query", role: 'request', searchTerms: params[:query], startPage: (params[:page] || 1)
26
26
  end
27
27
  @checkouts.each do |checkout|
28
28
  xml.item do