File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -199,6 +199,7 @@ def new_plan_currency
199199
200200 is_plan_id_found = false
201201 plan_id = params [ :plan_id ]
202+ product = nil
202203
203204 options = tenant_options_for_client
204205 options [ :api_key ] = @tenant . api_key
@@ -209,7 +210,10 @@ def new_plan_currency
209210 # seek if plan id exists
210211 catalog . products . each do |product |
211212 product . plans . each { |plan | is_plan_id_found |= plan . name == plan_id }
212- break if is_plan_id_found
213+ if is_plan_id_found
214+ product = product
215+ break
216+ end
213217 end
214218
215219 unless is_plan_id_found
@@ -219,6 +223,7 @@ def new_plan_currency
219223
220224 @simple_plan = Kaui ::SimplePlan . new
221225 @simple_plan . plan_id = params [ :plan_id ]
226+ @simple_plan . product_name = product . name if product
222227 end
223228
224229 def create_simple_plan
@@ -247,8 +252,8 @@ def create_simple_plan
247252 flash . now [ :error ] = "Error while creating plan: invalid product name (#{ @simple_plan . product_name } is a plan name already)"
248253 valid = false
249254 elsif @all_plans . include? ( @simple_plan . plan_id )
250- flash . now [ :error ] = "Error while creating plan: plan #{ @simple_plan . plan_id } already exists"
251- valid = false
255+ # flash.now[:error] = "Error while creating plan: plan #{@simple_plan.plan_id} already exists"
256+ # valid = false
252257 elsif @available_base_products . include? ( @simple_plan . product_name ) && @simple_plan . product_category != 'BASE'
253258 flash . now [ :error ] = "Error while creating plan: product #{ @simple_plan . product_name } is a BASE product"
254259 valid = false
You can’t perform that action at this time.
0 commit comments