enju_circulation 0.1.0.pre41 → 0.1.0.pre42
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/carrier_type_has_checkout_types_controller.rb +10 -4
- data/app/controllers/checked_items_controller.rb +8 -1
- data/app/controllers/checkins_controller.rb +6 -1
- data/app/controllers/checkout_types_controller.rb +8 -3
- data/app/controllers/checkouts_controller.rb +11 -4
- data/app/controllers/circulation_statuses_controller.rb +7 -2
- data/app/controllers/demands_controller.rb +85 -0
- data/app/controllers/item_has_use_restrictions_controller.rb +9 -3
- data/app/controllers/lending_policies_controller.rb +8 -1
- data/app/controllers/manifestation_checkout_stats_controller.rb +11 -2
- data/app/controllers/manifestation_reserve_stats_controller.rb +9 -2
- data/app/controllers/reserves_controller.rb +37 -9
- data/app/controllers/use_restrictions_controller.rb +7 -2
- data/app/controllers/user_checkout_stats_controller.rb +9 -2
- data/app/controllers/user_group_has_checkout_types_controller.rb +12 -2
- data/app/controllers/user_reserve_stats_controller.rb +9 -2
- data/app/helpers/items_helper.rb +17 -0
- data/app/models/carrier_type_has_checkout_type.rb +0 -1
- data/app/models/checked_item.rb +1 -2
- data/app/models/checkin.rb +0 -1
- data/app/models/checkout.rb +0 -1
- data/app/models/checkout_stat_has_manifestation.rb +2 -2
- data/app/models/checkout_stat_has_user.rb +2 -2
- data/app/models/checkout_type.rb +0 -2
- data/app/models/circulation_status.rb +0 -1
- data/app/models/demand.rb +5 -0
- data/app/models/enju_circulation/ability.rb +2 -0
- data/app/models/item_has_use_restriction.rb +0 -1
- data/app/models/lending_policy.rb +0 -2
- data/app/models/manifestation_checkout_stat.rb +5 -2
- data/app/models/manifestation_checkout_stat_transition.rb +1 -1
- data/app/models/manifestation_reserve_stat.rb +5 -2
- data/app/models/manifestation_reserve_stat_transition.rb +1 -1
- data/app/models/reserve.rb +24 -27
- data/app/models/reserve_stat_has_manifestation.rb +0 -3
- data/app/models/reserve_stat_has_user.rb +3 -3
- data/app/models/reserve_state_machine.rb +7 -7
- data/app/models/reserve_transition.rb +1 -1
- data/app/models/use_restriction.rb +0 -2
- data/app/models/user_checkout_stat.rb +5 -2
- data/app/models/user_checkout_stat_transition.rb +1 -1
- data/app/models/user_group_has_checkout_type.rb +0 -5
- data/app/models/user_reserve_stat.rb +5 -2
- data/app/models/user_reserve_stat_transition.rb +1 -1
- data/app/views/checkouts/_index.html.erb +1 -1
- data/app/views/checkouts/_index_item.html.erb +1 -1
- data/app/views/checkouts/_index_overdue.html.erb +1 -1
- data/app/views/checkouts/_index_user.html.erb +1 -1
- data/app/views/checkouts/_list.html.erb +2 -4
- data/app/views/demands/_form.html.erb +29 -0
- data/app/views/demands/edit.html.erb +6 -0
- data/app/views/demands/index.html.erb +31 -0
- data/app/views/demands/new.html.erb +5 -0
- data/app/views/demands/show.html.erb +19 -0
- data/app/views/manifestation_checkout_stats/_group_by_carrier_type.html.erb +29 -28
- data/app/views/manifestation_checkout_stats/_group_by_checkout_type.html.erb +29 -28
- data/config/locales/translation_en.yml +1 -0
- data/config/locales/translation_ja.yml +1 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20150106001709_create_demands.rb +14 -0
- data/lib/enju_circulation/accept.rb +1 -0
- data/lib/enju_circulation/carrier_type.rb +15 -0
- data/lib/enju_circulation/item.rb +3 -2
- data/lib/enju_circulation/profile.rb +0 -3
- data/lib/enju_circulation/user.rb +7 -3
- data/lib/enju_circulation/user_group.rb +0 -1
- data/lib/enju_circulation/version.rb +1 -1
- data/lib/enju_circulation.rb +2 -0
- data/spec/controllers/checked_items_controller_spec.rb +18 -18
- data/spec/controllers/checkouts_controller_spec.rb +3 -3
- data/spec/dummy/app/models/user.rb +0 -1
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/config/environments/development.rb +2 -2
- data/spec/dummy/config/routes.rb +2 -0
- data/spec/dummy/db/migrate/{20111201155456_devise_create_users.rb → 002_devise_create_users.rb} +6 -2
- data/spec/dummy/db/migrate/041_create_roles.rb +13 -0
- data/spec/dummy/db/migrate/059_create_libraries.rb +1 -5
- data/spec/dummy/db/migrate/069_create_shelves.rb +1 -5
- data/spec/dummy/db/migrate/077_create_user_groups.rb +3 -7
- data/spec/dummy/db/migrate/080_create_library_groups.rb +2 -10
- data/spec/dummy/db/migrate/113_create_events.rb +2 -2
- data/spec/dummy/db/migrate/124_create_bookstores.rb +17 -0
- data/spec/dummy/db/migrate/130_create_request_status_types.rb +1 -5
- data/spec/dummy/db/migrate/131_create_request_types.rb +1 -5
- data/spec/dummy/db/migrate/20081006090811_create_subscriptions.rb +17 -0
- data/spec/dummy/db/migrate/20081006093246_create_subscribes.rb +14 -0
- data/spec/dummy/db/migrate/20081023092436_create_search_engines.rb +17 -0
- data/spec/dummy/db/migrate/20081028093607_create_event_import_files.rb +25 -0
- data/spec/dummy/db/migrate/20090519203307_create_participates.rb +17 -0
- data/spec/dummy/db/migrate/20100314190054_add_opening_hour_to_library.rb +9 -0
- data/spec/dummy/db/migrate/{20111201163718_create_user_has_roles.rb → 20100606065209_create_user_has_roles.rb} +2 -0
- data/spec/dummy/db/migrate/20100925074639_create_event_import_results.rb +15 -0
- data/spec/dummy/db/migrate/{20111201121844_create_roles.rb → 20120129014038_create_budget_types.rb} +2 -2
- data/spec/dummy/db/migrate/20120319173203_create_accepts.rb +14 -0
- data/spec/dummy/db/migrate/20120413051535_add_event_import_fingerprint_to_event_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413170734_add_error_message_to_event_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120415060342_rename_event_import_file_imported_at_to_executed_at.rb +9 -0
- data/spec/dummy/db/migrate/20120510140958_add_closed_to_shelf.rb +5 -0
- data/spec/dummy/db/migrate/20130412083556_add_latitude_and_longitude_to_library.rb +6 -0
- data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +18 -0
- data/spec/dummy/db/migrate/20140110131010_create_user_import_results.rb +11 -0
- data/spec/dummy/db/migrate/20140122054321_create_profiles.rb +1 -1
- data/spec/dummy/db/migrate/20140523171309_create_event_import_file_transitions.rb +18 -0
- data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +18 -0
- data/spec/dummy/db/migrate/20140628071719_add_user_encoding_to_event_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140628072217_add_user_encoding_to_user_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140709113413_create_user_export_files.rb +11 -0
- data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +18 -0
- data/spec/dummy/db/migrate/20140720170714_add_default_library_id_to_user_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140720170735_add_default_user_group_id_to_user_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140720192418_add_default_library_id_to_event_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140812152348_create_event_export_files.rb +11 -0
- data/spec/dummy/db/migrate/20140812153137_create_event_export_file_transitions.rb +18 -0
- data/spec/dummy/db/migrate/20140814070854_add_default_event_category_id_to_event_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20140821151023_create_colors.rb +14 -0
- data/spec/dummy/db/migrate/20141003181336_add_full_name_transcription_to_profile.rb +5 -0
- data/spec/dummy/db/migrate/20141003182825_add_date_of_birth_to_profile.rb +5 -0
- data/spec/dummy/db/schema.rb +246 -58
- data/spec/fixtures/checkouts.yml +1 -1
- data/spec/fixtures/demands.yml +11 -0
- data/spec/fixtures/events.yml +13 -39
- data/spec/fixtures/library_groups.yml +0 -2
- metadata +105 -43
- data/db/migrate/20111217234412_add_save_checkout_history_to_user.rb +0 -5
- data/db/migrate/20111218002349_add_checkout_icalendar_token_to_user.rb +0 -6
- data/spec/dummy/db/migrate/20090719201843_create_extents.rb +0 -12
- data/spec/dummy/db/migrate/20100222124420_add_allow_bookmark_external_url_to_library_group.rb +0 -9
- data/spec/dummy/db/migrate/20110115022329_add_position_to_library_group.rb +0 -9
- data/spec/dummy/db/migrate/20110425133109_add_issn_to_series_statement.rb +0 -9
- data/spec/dummy/db/migrate/20110618091240_add_periodical_to_series_statement.rb +0 -9
- data/spec/dummy/db/migrate/20110820131417_create_series_has_manifestations.rb +0 -13
- data/spec/dummy/db/migrate/20111020063828_remove_dsbl_from_library_group.rb +0 -11
- data/spec/dummy/db/migrate/20120224094141_create_delayed_jobs.rb +0 -22
- data/spec/dummy/script/delayed_job +0 -5
- data/spec/dummy/script/rails +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c9e08e2fc2236be4faa9882cfb283f247d845f1
|
4
|
+
data.tar.gz: f3d16e72a7f830f8b67e1524acb1d793c3ba1c47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91d1606fe101c3c2cc8b2f4d6bd0a2775f1867a293f84d19a6faa6990c2736bb3c7d7d143f793a16c3c47485ac2099f7b10b4512407604f090c1511652265563
|
7
|
+
data.tar.gz: c97fcb04551f6bafb00f15c0c58fc3cd8ae9d54135afcde4b7f8baedd0037cc4a947d2e91c8b7e2bfe6466678842fd780ebc82d7f7d16eee4c536f5991863ec8
|
@@ -43,7 +43,7 @@ class CarrierTypeHasCheckoutTypesController < ApplicationController
|
|
43
43
|
# POST /carrier_type_has_checkout_types
|
44
44
|
# POST /carrier_type_has_checkout_types.json
|
45
45
|
def create
|
46
|
-
@carrier_type_has_checkout_type = CarrierTypeHasCheckoutType.new(
|
46
|
+
@carrier_type_has_checkout_type = CarrierTypeHasCheckoutType.new(carrier_type_has_checkout_type_params)
|
47
47
|
|
48
48
|
respond_to do |format|
|
49
49
|
if @carrier_type_has_checkout_type.save
|
@@ -62,7 +62,7 @@ class CarrierTypeHasCheckoutTypesController < ApplicationController
|
|
62
62
|
# PUT /carrier_type_has_checkout_types/1.json
|
63
63
|
def update
|
64
64
|
respond_to do |format|
|
65
|
-
if @carrier_type_has_checkout_type.update_attributes(
|
65
|
+
if @carrier_type_has_checkout_type.update_attributes(carrier_type_has_checkout_type_params)
|
66
66
|
flash[:notice] = t('controller.successfully_updated', model: t('activerecord.models.carrier_type_has_checkout_type'))
|
67
67
|
format.html { redirect_to @carrier_type_has_checkout_type }
|
68
68
|
format.json { head :no_content }
|
@@ -86,8 +86,14 @@ class CarrierTypeHasCheckoutTypesController < ApplicationController
|
|
86
86
|
end
|
87
87
|
|
88
88
|
private
|
89
|
+
def carrier_type_has_checkout_type_params
|
90
|
+
params.require(:carrier_type_has_checkout_type).permit(
|
91
|
+
:carrier_type_id, :checkout_type_id, :note
|
92
|
+
)
|
93
|
+
end
|
94
|
+
|
89
95
|
def prepare_options
|
90
|
-
@checkout_types = CheckoutType.
|
91
|
-
@carrier_types = CarrierType.
|
96
|
+
@checkout_types = CheckoutType.order(:position)
|
97
|
+
@carrier_types = CarrierType.order(:position)
|
92
98
|
end
|
93
99
|
end
|
@@ -87,7 +87,7 @@ class CheckedItemsController < ApplicationController
|
|
87
87
|
end
|
88
88
|
|
89
89
|
respond_to do |format|
|
90
|
-
if @checked_item.update_attributes(
|
90
|
+
if @checked_item.update_attributes(checked_item_params)
|
91
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
|
@@ -107,4 +107,11 @@ class CheckedItemsController < ApplicationController
|
|
107
107
|
format.json { head :no_content }
|
108
108
|
end
|
109
109
|
end
|
110
|
+
|
111
|
+
private
|
112
|
+
def checked_item_params
|
113
|
+
params.fetch(:checked_item, {}).permit(
|
114
|
+
:item_identifier, :ignore_restriction, :due_date_string
|
115
|
+
)
|
116
|
+
end
|
110
117
|
end
|
@@ -90,7 +90,7 @@ class CheckinsController < ApplicationController
|
|
90
90
|
# PUT /checkins/1
|
91
91
|
# PUT /checkins/1.json
|
92
92
|
def update
|
93
|
-
@checkin.assign_attributes(
|
93
|
+
@checkin.assign_attributes(checkin_params)
|
94
94
|
@checkin.librarian = current_user
|
95
95
|
|
96
96
|
respond_to do |format|
|
@@ -115,4 +115,9 @@ class CheckinsController < ApplicationController
|
|
115
115
|
format.json { head :no_content }
|
116
116
|
end
|
117
117
|
end
|
118
|
+
|
119
|
+
private
|
120
|
+
def checkin_params
|
121
|
+
params.require(:checkin).permit(:item_identifier)
|
122
|
+
end
|
118
123
|
end
|
@@ -53,9 +53,9 @@ class CheckoutTypesController < ApplicationController
|
|
53
53
|
# POST /checkout_types.json
|
54
54
|
def create
|
55
55
|
if @user_group
|
56
|
-
@checkout_type = @user_group.checkout_types.new(
|
56
|
+
@checkout_type = @user_group.checkout_types.new(checkout_type_params)
|
57
57
|
else
|
58
|
-
@checkout_type = CheckoutType.new(
|
58
|
+
@checkout_type = CheckoutType.new(checkout_type_params)
|
59
59
|
end
|
60
60
|
|
61
61
|
respond_to do |format|
|
@@ -78,7 +78,7 @@ class CheckoutTypesController < ApplicationController
|
|
78
78
|
end
|
79
79
|
|
80
80
|
respond_to do |format|
|
81
|
-
if @checkout_type.update_attributes(
|
81
|
+
if @checkout_type.update_attributes(checkout_type_params)
|
82
82
|
format.html { redirect_to @checkout_type, notice: t('controller.successfully_updated', model: t('activerecord.models.checkout_type')) }
|
83
83
|
format.json { head :no_content }
|
84
84
|
else
|
@@ -101,4 +101,9 @@ class CheckoutTypesController < ApplicationController
|
|
101
101
|
format.json { head :no_content }
|
102
102
|
end
|
103
103
|
end
|
104
|
+
|
105
|
+
private
|
106
|
+
def checkout_type_params
|
107
|
+
params.require(:checkout_type).permit(:name, :display_name, :note)
|
108
|
+
end
|
104
109
|
end
|
@@ -35,7 +35,7 @@ class CheckoutsController < ApplicationController
|
|
35
35
|
if current_user.try(:has_role?, 'Librarian')
|
36
36
|
search.build do
|
37
37
|
with(:username).equal_to user.username
|
38
|
-
with(:checked_in_at).equal_to nil unless user.save_checkout_history
|
38
|
+
with(:checked_in_at).equal_to nil unless user.profile.save_checkout_history
|
39
39
|
end
|
40
40
|
else
|
41
41
|
if current_user == user
|
@@ -53,8 +53,10 @@ class CheckoutsController < ApplicationController
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
|
57
|
-
|
56
|
+
unless current_user.profile.save_checkout_history?
|
57
|
+
search.build do
|
58
|
+
with(:checked_in_at).equal_to nil
|
59
|
+
end
|
58
60
|
end
|
59
61
|
end
|
60
62
|
|
@@ -133,7 +135,7 @@ class CheckoutsController < ApplicationController
|
|
133
135
|
# PUT /checkouts/1
|
134
136
|
# PUT /checkouts/1.json
|
135
137
|
def update
|
136
|
-
@checkout.assign_attributes(
|
138
|
+
@checkout.assign_attributes(checkout_params)
|
137
139
|
@checkout.due_date = @checkout.due_date.end_of_day
|
138
140
|
@checkout.checkout_renewal_count += 1
|
139
141
|
|
@@ -177,4 +179,9 @@ class CheckoutsController < ApplicationController
|
|
177
179
|
format.json { head :no_content }
|
178
180
|
end
|
179
181
|
end
|
182
|
+
|
183
|
+
private
|
184
|
+
def checkout_params
|
185
|
+
params.fetch(:checkout, {}).permit(:due_date)
|
186
|
+
end
|
180
187
|
end
|
@@ -39,7 +39,7 @@ class CirculationStatusesController < ApplicationController
|
|
39
39
|
# POST /circulation_statuses
|
40
40
|
# POST /circulation_statuses.json
|
41
41
|
def create
|
42
|
-
@circulation_status = CirculationStatus.new(
|
42
|
+
@circulation_status = CirculationStatus.new(circulation_status_params)
|
43
43
|
|
44
44
|
respond_to do |format|
|
45
45
|
if @circulation_status.save
|
@@ -61,7 +61,7 @@ class CirculationStatusesController < ApplicationController
|
|
61
61
|
end
|
62
62
|
|
63
63
|
respond_to do |format|
|
64
|
-
if @circulation_status.update_attributes(
|
64
|
+
if @circulation_status.update_attributes(circulation_status_params)
|
65
65
|
format.html { redirect_to @circulation_status, notice: t('controller.successfully_updated', model: t('activerecord.models.circulation_status')) }
|
66
66
|
format.json { head :no_content }
|
67
67
|
else
|
@@ -81,4 +81,9 @@ class CirculationStatusesController < ApplicationController
|
|
81
81
|
format.json { head :no_content }
|
82
82
|
end
|
83
83
|
end
|
84
|
+
|
85
|
+
private
|
86
|
+
def circulation_status_params
|
87
|
+
params.require(:circulation_status).permit(:name, :display_name, :note)
|
88
|
+
end
|
84
89
|
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
class DemandsController < ApplicationController
|
2
|
+
load_and_authorize_resource
|
3
|
+
|
4
|
+
# GET /demands
|
5
|
+
# GET /demands.json
|
6
|
+
def index
|
7
|
+
@demands = Demand.order('id DESC').page(params[:page])
|
8
|
+
|
9
|
+
respond_to do |format|
|
10
|
+
format.html # index.html.erb
|
11
|
+
format.json { render json: @demands }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET /demands/1
|
16
|
+
# GET /demands/1.json
|
17
|
+
def show
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.json { render json: @demand }
|
21
|
+
format.txt
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# GET /demands/new
|
26
|
+
# GET /demands/new.json
|
27
|
+
def new
|
28
|
+
@demand = Demand.new
|
29
|
+
|
30
|
+
respond_to do |format|
|
31
|
+
format.html # new.html.erb
|
32
|
+
format.json { render json: @demand }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# GET /demands/1/edit
|
37
|
+
def edit
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /demands
|
41
|
+
# POST /demands.json
|
42
|
+
def create
|
43
|
+
@demand = Demand.new(demand_params)
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @demand.save
|
47
|
+
format.html { redirect_to @demand, notice: t('statistic.successfully_created', model: t('activerecord.models.demand')) }
|
48
|
+
format.json { render json: @demand, status: :created, location: @demand }
|
49
|
+
else
|
50
|
+
format.html { render action: "new" }
|
51
|
+
format.json { render json: @demand.errors, status: :unprocessable_entity }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# PUT /demands/1
|
57
|
+
# PUT /demands/1.json
|
58
|
+
def update
|
59
|
+
respond_to do |format|
|
60
|
+
if @demand.update_attributes(demand_params)
|
61
|
+
format.html { redirect_to @demand, notice: t('controller.successfully_updated', model: t('activerecord.models.demand')) }
|
62
|
+
format.json { head :no_content }
|
63
|
+
else
|
64
|
+
format.html { render action: "edit" }
|
65
|
+
format.json { render json: @demand.errors, status: :unprocessable_entity }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# DELETE /demands/1
|
71
|
+
# DELETE /demands/1.json
|
72
|
+
def destroy
|
73
|
+
@demand.destroy
|
74
|
+
|
75
|
+
respond_to do |format|
|
76
|
+
format.html { redirect_to demands_url }
|
77
|
+
format.json { head :no_content }
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
def demand_params
|
83
|
+
params.fetch(:demand, {}).permit()
|
84
|
+
end
|
85
|
+
end
|
@@ -45,8 +45,7 @@ class ItemHasUseRestrictionsController < ApplicationController
|
|
45
45
|
# POST /item_has_use_restrictions
|
46
46
|
# POST /item_has_use_restrictions.json
|
47
47
|
def create
|
48
|
-
@item_has_use_restriction = ItemHasUseRestriction.new(
|
49
|
-
@item_has_use_restriction.assign_attributes(params[:item_has_use_restriction])
|
48
|
+
@item_has_use_restriction = ItemHasUseRestriction.new(item_has_use_restriction_params)
|
50
49
|
|
51
50
|
respond_to do |format|
|
52
51
|
if @item_has_use_restriction.save
|
@@ -63,7 +62,7 @@ class ItemHasUseRestrictionsController < ApplicationController
|
|
63
62
|
# PUT /item_has_use_restrictions/1
|
64
63
|
# PUT /item_has_use_restrictions/1.json
|
65
64
|
def update
|
66
|
-
@item_has_use_restriction.assign_attributes(
|
65
|
+
@item_has_use_restriction.assign_attributes(item_has_use_restriction_params)
|
67
66
|
respond_to do |format|
|
68
67
|
if @item_has_use_restriction.save
|
69
68
|
format.html { redirect_to @item_has_use_restriction, notice: t('controller.successfully_updated', model: t('activerecord.models.item_has_use_restriction')) }
|
@@ -86,4 +85,11 @@ class ItemHasUseRestrictionsController < ApplicationController
|
|
86
85
|
format.json { head :no_content }
|
87
86
|
end
|
88
87
|
end
|
88
|
+
|
89
|
+
private
|
90
|
+
def item_has_use_restriction_params
|
91
|
+
params.require(:item_has_use_restriction).permit(
|
92
|
+
:item_id, :use_restriction_id, :use_restriction
|
93
|
+
)
|
94
|
+
end
|
89
95
|
end
|
@@ -55,7 +55,7 @@ class LendingPoliciesController < ApplicationController
|
|
55
55
|
# PUT /lending_policies/1.json
|
56
56
|
def update
|
57
57
|
respond_to do |format|
|
58
|
-
if @lending_policy.update_attributes(
|
58
|
+
if @lending_policy.update_attributes(lending_policy_params)
|
59
59
|
format.html { redirect_to @lending_policy, notice: t('controller.successfully_updated', model: t('activerecord.models.lending_policy')) }
|
60
60
|
format.json { head :no_content }
|
61
61
|
else
|
@@ -78,6 +78,13 @@ class LendingPoliciesController < ApplicationController
|
|
78
78
|
end
|
79
79
|
|
80
80
|
private
|
81
|
+
def lending_policy_params
|
82
|
+
params.require(:lending_policy).permit(
|
83
|
+
:item_id, :user_group_id, :loan_period, :fixed_due_date,
|
84
|
+
:renewal, :fine, :note, :position
|
85
|
+
)
|
86
|
+
end
|
87
|
+
|
81
88
|
def prepare_options
|
82
89
|
@user_groups = UserGroup.order(:position)
|
83
90
|
end
|
@@ -60,6 +60,8 @@ class ManifestationCheckoutStatsController < ApplicationController
|
|
60
60
|
# GET /manifestation_checkout_stats/new.json
|
61
61
|
def new
|
62
62
|
@manifestation_checkout_stat = ManifestationCheckoutStat.new
|
63
|
+
@manifestation_checkout_stat.start_date = Time.zone.now.beginning_of_day
|
64
|
+
@manifestation_checkout_stat.end_date = Time.zone.now.beginning_of_day
|
63
65
|
|
64
66
|
respond_to do |format|
|
65
67
|
format.html # new.html.erb
|
@@ -74,7 +76,7 @@ class ManifestationCheckoutStatsController < ApplicationController
|
|
74
76
|
# POST /manifestation_checkout_stats
|
75
77
|
# POST /manifestation_checkout_stats.json
|
76
78
|
def create
|
77
|
-
@manifestation_checkout_stat = ManifestationCheckoutStat.new(
|
79
|
+
@manifestation_checkout_stat = ManifestationCheckoutStat.new(manifestation_checkout_stat_params)
|
78
80
|
@manifestation_checkout_stat.user = current_user
|
79
81
|
|
80
82
|
respond_to do |format|
|
@@ -95,7 +97,7 @@ class ManifestationCheckoutStatsController < ApplicationController
|
|
95
97
|
# PUT /manifestation_checkout_stats/1.json
|
96
98
|
def update
|
97
99
|
respond_to do |format|
|
98
|
-
if @manifestation_checkout_stat.update_attributes(
|
100
|
+
if @manifestation_checkout_stat.update_attributes(manifestation_checkout_stat_params)
|
99
101
|
if @manifestation_checkout_stat.mode == 'import'
|
100
102
|
Resque.enqueue(ManifestationCheckoutStatQueue, @manifestation_checkout_stat.id)
|
101
103
|
end
|
@@ -118,4 +120,11 @@ class ManifestationCheckoutStatsController < ApplicationController
|
|
118
120
|
format.json { head :no_content }
|
119
121
|
end
|
120
122
|
end
|
123
|
+
|
124
|
+
private
|
125
|
+
def manifestation_checkout_stat_params
|
126
|
+
params.require(:manifestation_checkout_stat).permit(
|
127
|
+
:start_date, :end_date, :note, :mode
|
128
|
+
)
|
129
|
+
end
|
121
130
|
end
|
@@ -48,7 +48,7 @@ class ManifestationReserveStatsController < ApplicationController
|
|
48
48
|
# POST /manifestation_reserve_stats
|
49
49
|
# POST /manifestation_reserve_stats.json
|
50
50
|
def create
|
51
|
-
@manifestation_reserve_stat = ManifestationReserveStat.new(
|
51
|
+
@manifestation_reserve_stat = ManifestationReserveStat.new(manifestation_reserve_stat_params)
|
52
52
|
@manifestation_reserve_stat.user = current_user
|
53
53
|
|
54
54
|
respond_to do |format|
|
@@ -67,7 +67,7 @@ class ManifestationReserveStatsController < ApplicationController
|
|
67
67
|
# PUT /manifestation_reserve_stats/1.json
|
68
68
|
def update
|
69
69
|
respond_to do |format|
|
70
|
-
if @manifestation_reserve_stat.update_attributes(
|
70
|
+
if @manifestation_reserve_stat.update_attributes(manifestation_reserve_stat_params)
|
71
71
|
if @manifestation_reserve_stat.mode == 'import'
|
72
72
|
Resque.enqueue(ManifestationReserveStatQueue, @manifestation_reserve_stat.id)
|
73
73
|
end
|
@@ -90,4 +90,11 @@ class ManifestationReserveStatsController < ApplicationController
|
|
90
90
|
format.json { head :no_content }
|
91
91
|
end
|
92
92
|
end
|
93
|
+
|
94
|
+
private
|
95
|
+
def manifestation_reserve_stat_params
|
96
|
+
params.require(:manifestation_reserve_stat).permit(
|
97
|
+
:start_date, :end_date, :note, :mode
|
98
|
+
)
|
99
|
+
end
|
93
100
|
end
|
@@ -158,11 +158,7 @@ class ReservesController < ApplicationController
|
|
158
158
|
# POST /reserves
|
159
159
|
# POST /reserves.json
|
160
160
|
def create
|
161
|
-
|
162
|
-
@reserve = Reserve.new(params[:reserve], as: :admin)
|
163
|
-
else
|
164
|
-
@reserve = Reserve.new(params[:reserve])
|
165
|
-
end
|
161
|
+
@reserve = Reserve.new(reserve_params)
|
166
162
|
@reserve.set_user
|
167
163
|
|
168
164
|
if current_user.has_role?('Librarian')
|
@@ -194,14 +190,12 @@ class ReservesController < ApplicationController
|
|
194
190
|
# PUT /reserves/1
|
195
191
|
# PUT /reserves/1.json
|
196
192
|
def update
|
197
|
-
|
198
|
-
@reserve.assign_attributes(params[:reserve], as: :admin)
|
199
|
-
else
|
193
|
+
unless current_user.has_role?('Librarian')
|
200
194
|
if @reserve.user != current_user
|
201
195
|
access_denied; return
|
202
196
|
end
|
203
|
-
@reserve.assign_attributes(params[:reserve], as: :user_update)
|
204
197
|
end
|
198
|
+
@reserve.assign_attributes(reserve_update_params)
|
205
199
|
|
206
200
|
if @reserve.valid?
|
207
201
|
if params[:mode] == 'cancel'
|
@@ -256,6 +250,40 @@ class ReservesController < ApplicationController
|
|
256
250
|
end
|
257
251
|
|
258
252
|
private
|
253
|
+
def reserve_params
|
254
|
+
if current_user.try(:has_role?, 'Librarian')
|
255
|
+
params.fetch(:reserve, {}).permit(
|
256
|
+
:manifestation_id, :user_number, :expired_at,
|
257
|
+
:pickup_location_id, :expired_at,
|
258
|
+
:manifestation_id, :item_identifier, :user_number,
|
259
|
+
:request_status_type, :canceled_at, :checked_out_at,
|
260
|
+
:expiration_notice_to_patron, :expiration_notice_to_library, :item_id,
|
261
|
+
:retained_at, :postponed_at, :force_retaining
|
262
|
+
)
|
263
|
+
elsif current_user.try(:has_role?, 'User')
|
264
|
+
params.fetch(:reserve, {}).permit(
|
265
|
+
:user_number, :manifestation_id, :expired_at, :pickup_location_id
|
266
|
+
)
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
def reserve_update_params
|
271
|
+
if current_user.try(:has_role?, 'Librarian')
|
272
|
+
params.fetch(:reserve, {}).permit(
|
273
|
+
:manifestation_id, :user_number, :expired_at,
|
274
|
+
:pickup_location_id, :expired_at,
|
275
|
+
:manifestation_id, :item_identifier, :user_number,
|
276
|
+
:request_status_type, :canceled_at, :checked_out_at,
|
277
|
+
:expiration_notice_to_patron, :expiration_notice_to_library, :item_id,
|
278
|
+
:retained_at, :postponed_at, :force_retaining
|
279
|
+
)
|
280
|
+
elsif current_user.try(:has_role?, 'User')
|
281
|
+
params.fetch(:reserve, {}).permit(
|
282
|
+
:expired_at, :pickup_location_id
|
283
|
+
)
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
259
287
|
def prepare_options
|
260
288
|
@libraries = Library.real.order(:position)
|
261
289
|
end
|
@@ -39,7 +39,7 @@ class UseRestrictionsController < ApplicationController
|
|
39
39
|
# POST /use_restrictions
|
40
40
|
# POST /use_restrictions.json
|
41
41
|
def create
|
42
|
-
@use_restriction = UseRestriction.new(
|
42
|
+
@use_restriction = UseRestriction.new(use_restriction_params)
|
43
43
|
|
44
44
|
respond_to do |format|
|
45
45
|
if @use_restriction.save
|
@@ -61,7 +61,7 @@ class UseRestrictionsController < ApplicationController
|
|
61
61
|
end
|
62
62
|
|
63
63
|
respond_to do |format|
|
64
|
-
if @use_restriction.update_attributes(
|
64
|
+
if @use_restriction.update_attributes(use_restriction_params)
|
65
65
|
format.html { redirect_to @use_restriction, notice: t('controller.successfully_updated', model: t('activerecord.models.use_restriction')) }
|
66
66
|
format.json { head :no_content }
|
67
67
|
else
|
@@ -81,4 +81,9 @@ class UseRestrictionsController < ApplicationController
|
|
81
81
|
format.json { head :no_content }
|
82
82
|
end
|
83
83
|
end
|
84
|
+
|
85
|
+
private
|
86
|
+
def use_restriction_params
|
87
|
+
params.require(:use_restriction).permit(:name, :display_name, :note)
|
88
|
+
end
|
84
89
|
end
|
@@ -48,7 +48,7 @@ class UserCheckoutStatsController < ApplicationController
|
|
48
48
|
# POST /user_checkout_stats
|
49
49
|
# POST /user_checkout_stats.json
|
50
50
|
def create
|
51
|
-
@user_checkout_stat = UserCheckoutStat.new(
|
51
|
+
@user_checkout_stat = UserCheckoutStat.new(user_checkout_stat_params)
|
52
52
|
@user_checkout_stat.user = current_user
|
53
53
|
|
54
54
|
respond_to do |format|
|
@@ -67,7 +67,7 @@ class UserCheckoutStatsController < ApplicationController
|
|
67
67
|
# PUT /user_checkout_stats/1.json
|
68
68
|
def update
|
69
69
|
respond_to do |format|
|
70
|
-
if @user_checkout_stat.update_attributes(
|
70
|
+
if @user_checkout_stat.update_attributes(user_checkout_stat_params)
|
71
71
|
if @user_checkout_stat.mode == 'import'
|
72
72
|
Resque.enqueue(UserCheckoutStatQueue, @user_checkout_stat.id)
|
73
73
|
end
|
@@ -90,4 +90,11 @@ class UserCheckoutStatsController < ApplicationController
|
|
90
90
|
format.json { head :no_content }
|
91
91
|
end
|
92
92
|
end
|
93
|
+
|
94
|
+
private
|
95
|
+
def user_checkout_stat_params
|
96
|
+
params.require(:user_checkout_stat).permit(
|
97
|
+
:start_date, :end_date, :note, :mode
|
98
|
+
)
|
99
|
+
end
|
93
100
|
end
|
@@ -44,7 +44,7 @@ class UserGroupHasCheckoutTypesController < ApplicationController
|
|
44
44
|
# POST /user_group_has_checkout_types
|
45
45
|
# POST /user_group_has_checkout_types.json
|
46
46
|
def create
|
47
|
-
@user_group_has_checkout_type = UserGroupHasCheckoutType.new(
|
47
|
+
@user_group_has_checkout_type = UserGroupHasCheckoutType.new(user_group_has_checkout_type_params)
|
48
48
|
|
49
49
|
respond_to do |format|
|
50
50
|
if @user_group_has_checkout_type.save
|
@@ -62,7 +62,7 @@ class UserGroupHasCheckoutTypesController < ApplicationController
|
|
62
62
|
# PUT /user_group_has_checkout_types/1.json
|
63
63
|
def update
|
64
64
|
respond_to do |format|
|
65
|
-
if @user_group_has_checkout_type.update_attributes(
|
65
|
+
if @user_group_has_checkout_type.update_attributes(user_group_has_checkout_type_params)
|
66
66
|
format.html { redirect_to @user_group_has_checkout_type, notice: t('controller.successfully_updated', model: t('activerecord.models.user_group_has_checkout_type')) }
|
67
67
|
format.json { head :no_content }
|
68
68
|
else
|
@@ -85,6 +85,16 @@ class UserGroupHasCheckoutTypesController < ApplicationController
|
|
85
85
|
end
|
86
86
|
|
87
87
|
private
|
88
|
+
def user_group_has_checkout_type_params
|
89
|
+
params.require(:user_group_has_checkout_type).permit(
|
90
|
+
:user_group_id, :checkout_type_id,
|
91
|
+
:checkout_limit, :checkout_period, :checkout_renewal_limit,
|
92
|
+
:reservation_limit, :reservation_expired_period,
|
93
|
+
:set_due_date_before_closing_day, :fixed_due_date, :note, :position,
|
94
|
+
:user_group, :checkout_type
|
95
|
+
)
|
96
|
+
end
|
97
|
+
|
88
98
|
def prepare_options
|
89
99
|
@checkout_types = CheckoutType.all
|
90
100
|
@user_groups = UserGroup.all
|
@@ -48,7 +48,7 @@ class UserReserveStatsController < ApplicationController
|
|
48
48
|
# POST /user_reserve_stats
|
49
49
|
# POST /user_reserve_stats.json
|
50
50
|
def create
|
51
|
-
@user_reserve_stat = UserReserveStat.new(
|
51
|
+
@user_reserve_stat = UserReserveStat.new(user_reserve_stat_params)
|
52
52
|
@user_reserve_stat.user = current_user
|
53
53
|
|
54
54
|
respond_to do |format|
|
@@ -67,7 +67,7 @@ class UserReserveStatsController < ApplicationController
|
|
67
67
|
# PUT /user_reserve_stats/1.json
|
68
68
|
def update
|
69
69
|
respond_to do |format|
|
70
|
-
if @user_reserve_stat.update_attributes(
|
70
|
+
if @user_reserve_stat.update_attributes(user_reserve_stat_params)
|
71
71
|
if @user_reserve_stat.mode == 'import'
|
72
72
|
Resque.enqueue(UserReserveStatQueue, @user_reserve_stat.id)
|
73
73
|
end
|
@@ -90,4 +90,11 @@ class UserReserveStatsController < ApplicationController
|
|
90
90
|
format.json { head :no_content }
|
91
91
|
end
|
92
92
|
end
|
93
|
+
|
94
|
+
private
|
95
|
+
def user_reserve_stat_params
|
96
|
+
params.require(:user_reserve_stat).permit(
|
97
|
+
:start_date, :end_date, :note, :mode
|
98
|
+
)
|
99
|
+
end
|
93
100
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ItemsHelper
|
2
|
+
def circulation_status_facet(facet)
|
3
|
+
string = ''
|
4
|
+
circulation_status = CirculationStatus.where(name: facet.value).select([:name, :display_name]).first
|
5
|
+
if circulation_status
|
6
|
+
string << form_icon(circulation_status)
|
7
|
+
current = true if params[:circulation_status] == circulation_status.name
|
8
|
+
if current
|
9
|
+
content_tag :strong do
|
10
|
+
link_to("#{circulation_status.display_name.localize} (" + facet.count.to_s + ")", url_for(params.merge(circulation_status: circulation_status.name, page: nil, view: nil, only_path: true)))
|
11
|
+
end
|
12
|
+
else
|
13
|
+
link_to("#{circulation_status.display_name.localize} (" + facet.count.to_s + ")", url_for(params.merge(circulation_status: circulation_status.name, page: nil, view: nil, only_path: true)))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
class CarrierTypeHasCheckoutType < ActiveRecord::Base
|
2
|
-
attr_accessible :carrier_type_id, :checkout_type_id, :note
|
3
2
|
scope :available_for_carrier_type, lambda {|carrier_type| includes(:carrier_type).where('carrier_types.name = ?', carrier_type.name)}
|
4
3
|
scope :available_for_user_group, lambda {|user_group| includes(checkout_type: :user_groups).where('user_groups.name = ?', user_group.name)}
|
5
4
|
|
data/app/models/checked_item.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
class CheckedItem < ActiveRecord::Base
|
2
|
-
attr_accessible :item_identifier, :ignore_restriction, :due_date_string
|
3
2
|
belongs_to :item #, validate: true
|
4
3
|
belongs_to :basket #, validate: true
|
5
4
|
belongs_to :librarian, class_name: 'User' #, validate: true
|
@@ -15,7 +14,7 @@ class CheckedItem < ActiveRecord::Base
|
|
15
14
|
before_validation :set_due_date, on: :create
|
16
15
|
normalize_attributes :item_identifier
|
17
16
|
|
18
|
-
attr_protected :user_id
|
17
|
+
#attr_protected :user_id
|
19
18
|
attr_accessor :item_identifier, :ignore_restriction, :due_date_string
|
20
19
|
|
21
20
|
def available_for_checkout?
|
data/app/models/checkin.rb
CHANGED
data/app/models/checkout.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class CheckoutStatHasManifestation < ActiveRecord::Base
|
2
|
-
attr_accessible :manifestation_checkout_stat_id, :manifestation_id,
|
3
|
-
|
2
|
+
#attr_accessible :manifestation_checkout_stat_id, :manifestation_id,
|
3
|
+
# as: :admin
|
4
4
|
belongs_to :manifestation_checkout_stat
|
5
5
|
belongs_to :manifestation
|
6
6
|
|