mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-21 15:54:22 +01:00
Fix bug: Unable to create plans for all group
This commit is contained in:
parent
41d931aba0
commit
cecf8126e0
@ -6,6 +6,7 @@
|
|||||||
- Fix a bug: script mount-proof-of-identity-files unable to modify docker-compose.yml
|
- Fix a bug: script mount-proof-of-identity-files unable to modify docker-compose.yml
|
||||||
- Fix a bug: Event reservation calendar encoding in mail
|
- Fix a bug: Event reservation calendar encoding in mail
|
||||||
- Fix a bug: Missing of description of PlanCategory migration
|
- Fix a bug: Missing of description of PlanCategory migration
|
||||||
|
- Fix a bug: Unable to create plans for all group
|
||||||
|
|
||||||
## v5.4.0 2022 May 12
|
## v5.4.0 2022 May 12
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class API::PlansController < API::ApiController
|
|||||||
partner = params[:plan][:partner_id].empty? ? nil : User.find(params[:plan][:partner_id])
|
partner = params[:plan][:partner_id].empty? ? nil : User.find(params[:plan][:partner_id])
|
||||||
|
|
||||||
plan = PlansService.create(type, partner, plan_params)
|
plan = PlansService.create(type, partner, plan_params)
|
||||||
if plan.errors.keys.count.positive?
|
if plan.key?(:errors)
|
||||||
render json: plan.errors, status: :unprocessable_entity
|
render json: plan.errors, status: :unprocessable_entity
|
||||||
else
|
else
|
||||||
render json: plan, status: :created
|
render json: plan, status: :created
|
||||||
|
@ -181,16 +181,14 @@ Application.Controllers.controller('NewPlanController', ['$scope', '$uibModal',
|
|||||||
* @param content {Object}
|
* @param content {Object}
|
||||||
*/
|
*/
|
||||||
$scope.afterSubmit = function (content) {
|
$scope.afterSubmit = function (content) {
|
||||||
if ((content.id == null) && (content.plan_ids == null)) {
|
if (content.plan_ids === null || content.plan_ids === undefined) {
|
||||||
return growl.error(_t('app.admin.plans.new.unable_to_create_the_subscription_please_try_again'));
|
return growl.error(_t('app.admin.plans.new.unable_to_create_the_subscription_please_try_again'));
|
||||||
} else {
|
} else {
|
||||||
growl.success(_t('app.admin.plans.new.successfully_created_subscriptions_dont_forget_to_redefine_prices'));
|
growl.success(_t('app.admin.plans.new.successfully_created_subscriptions_dont_forget_to_redefine_prices'));
|
||||||
if (content.plan_ids != null) {
|
if (content.plan_ids.length > 1) {
|
||||||
return $state.go('app.admin.pricing');
|
return $state.go('app.admin.pricing');
|
||||||
} else {
|
} else {
|
||||||
if (content.id != null) {
|
return $state.go('app.admin.plans.edit', { id: content.plan_ids[0] });
|
||||||
return $state.go('app.admin.plans.edit', { id: content.id });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -14,8 +14,10 @@ class PlansService
|
|||||||
plan = type.constantize.new(params)
|
plan = type.constantize.new(params)
|
||||||
if plan.save
|
if plan.save
|
||||||
partner&.add_role :partner, plan
|
partner&.add_role :partner, plan
|
||||||
|
else
|
||||||
|
return { errors: plan.errors.full_messages }
|
||||||
end
|
end
|
||||||
plan
|
{ plan_ids: [plan.id] }
|
||||||
end
|
end
|
||||||
rescue PaymentGatewayError => e
|
rescue PaymentGatewayError => e
|
||||||
{ errors: e.message }
|
{ errors: e.message }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user