From f846b41c7e1570f3047e71fc74cbe1b2f9e13fc6 Mon Sep 17 00:00:00 2001 From: cedricnjanga Date: Mon, 4 Sep 2017 09:34:30 +0200 Subject: add some change for the Referential#new_from to only have a line collection regarding the functional scope of the current organozation --- app/controllers/application_controller.rb | 5 +++++ app/controllers/referentials_controller.rb | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d15aa336d..47b54039c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -33,6 +33,11 @@ class ApplicationController < ActionController::Base end helper_method :current_organisation + def current_functional_scope + JSON.parse(current_organisation.sso_attributes["functional_scope"]) if current_organisation + end + helper_method :current_functional_scope + def begin_of_association_chain current_organisation end diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb index afd376092..2094047b1 100644 --- a/app/controllers/referentials_controller.rb +++ b/app/controllers/referentials_controller.rb @@ -9,7 +9,8 @@ class ReferentialsController < BreadcrumbController def new if params[:from] source_referential = Referential.find(params[:from]) - @referential = Referential.new_from(source_referential) + @referential = Referential.new_from(source_referential, current_functional_scope) + @referential.workbench_id = current_organisation.workbenches.first.id end new! do @@ -56,6 +57,7 @@ class ReferentialsController < BreadcrumbController end def destroy + binding.pry workbench = referential.workbench_id referential.destroy! -- cgit v1.2.3