active_scaffold_batch_vho 3.1.6 → 3.1.7
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a66999a2be3f590bc571e1b8c8c71ab1c556c427
|
4
|
+
data.tar.gz: fb6732ab36ee38d03396186c1c633cf927841f0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6428a4a72ae0d165e034c655aa74211ff4b07015d14c3879de3248416152e87c51bcd6b2f21b22839d1282fc1735ddf9a6c2f3daea8623e4efefdd99e5dffa1
|
7
|
+
data.tar.gz: 26ab92fbd91de06abddfb8920c71d2d69914d5d03a9cce620b1faf9ca3e537d7ee4c5c17be4bf7387b52d33f5b97f5184dca8939bf9dfc6aa4e262ee4202bacf
|
@@ -85,7 +85,7 @@ module ActiveScaffold::Actions
|
|
85
85
|
|
86
86
|
def before_do_batch_create
|
87
87
|
create_columns = active_scaffold_config.batch_create.columns
|
88
|
-
@batch_create_values =
|
88
|
+
@batch_create_values = batch_create_attribute_values_from_params(create_columns, params[:record])
|
89
89
|
end
|
90
90
|
|
91
91
|
# in case of an error we have to prepare @record object to have assigned all
|
@@ -95,7 +95,7 @@ module ActiveScaffold::Actions
|
|
95
95
|
do_new
|
96
96
|
batch_create_values.each do |attribute, value|
|
97
97
|
form_ui = colunm_form_ui(value[:column])
|
98
|
-
|
98
|
+
batch_create_set_record_attribute(value[:column], attribute, value[:value]) unless form_ui && override_batch_create_value?(form_ui)
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
@@ -130,7 +130,7 @@ module ActiveScaffold::Actions
|
|
130
130
|
unless @record.nil?
|
131
131
|
@record.send("#{batch_create_by_column.to_s}=", created_by)
|
132
132
|
batch_create_values.each do |attribute, value|
|
133
|
-
|
133
|
+
batch_create_set_record_attribute(value[:column], attribute, value[:value])
|
134
134
|
end
|
135
135
|
|
136
136
|
if authorized_for_job?(@record)
|
@@ -148,7 +148,7 @@ module ActiveScaffold::Actions
|
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
|
-
def
|
151
|
+
def batch_create_set_record_attribute(column, attribute, value)
|
152
152
|
form_ui = colunm_form_ui(column)
|
153
153
|
if form_ui && override_batch_create_value?(form_ui)
|
154
154
|
@record.send("#{attribute}=", send(override_batch_create_value(form_ui), column, @record, value))
|
@@ -167,7 +167,7 @@ module ActiveScaffold::Actions
|
|
167
167
|
end
|
168
168
|
|
169
169
|
|
170
|
-
def
|
170
|
+
def batch_create_attribute_values_from_params(columns, attributes)
|
171
171
|
values = {}
|
172
172
|
columns.each :for => new_model, :crud_type => :create, :flatten => true do |column|
|
173
173
|
if batch_create_by_column == column.name
|
@@ -93,7 +93,7 @@ module ActiveScaffold::Actions
|
|
93
93
|
|
94
94
|
def before_do_batch_update
|
95
95
|
update_columns = active_scaffold_config.batch_update.columns
|
96
|
-
@batch_update_values =
|
96
|
+
@batch_update_values = batch_update_attribute_values_from_params(update_columns, params[:record])
|
97
97
|
end
|
98
98
|
|
99
99
|
# in case of an error we have to prepare @record object to have assigned all
|
@@ -103,7 +103,7 @@ module ActiveScaffold::Actions
|
|
103
103
|
do_new
|
104
104
|
batch_update_values.each do |attribute, value|
|
105
105
|
form_ui = colunm_form_ui(value[:column])
|
106
|
-
|
106
|
+
batch_update_set_record_attribute(value[:column], attribute, value[:value]) unless form_ui && override_batch_update_value?(form_ui)
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
@@ -157,7 +157,7 @@ module ActiveScaffold::Actions
|
|
157
157
|
@record = record
|
158
158
|
|
159
159
|
batch_update_values.each do |attribute, value|
|
160
|
-
|
160
|
+
batch_update_set_record_attribute(value[:column], attribute, value[:value])
|
161
161
|
end
|
162
162
|
|
163
163
|
update_save({:no_record_param_update => true})
|
@@ -168,7 +168,7 @@ module ActiveScaffold::Actions
|
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
171
|
-
def
|
171
|
+
def batch_update_set_record_attribute(column, attribute, value)
|
172
172
|
form_ui = colunm_form_ui(column)
|
173
173
|
if form_ui && override_batch_update_value?(form_ui)
|
174
174
|
@record.send("#{attribute}=", send(override_batch_update_value(form_ui), column, @record, value))
|
@@ -202,7 +202,7 @@ module ActiveScaffold::Actions
|
|
202
202
|
return sql_set, update_value
|
203
203
|
end
|
204
204
|
|
205
|
-
def
|
205
|
+
def batch_update_attribute_values_from_params(columns, attributes)
|
206
206
|
values = {}
|
207
207
|
attributes = {} unless attributes.is_a?(Hash)
|
208
208
|
columns.each :for => new_model, :crud_type => :update, :flatten => true do |column|
|