This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git commit 3c733ba186c23640da35955728109d346b80080e Author: Yannick Martel <martel@©odelutin.com> Date: Tue Jan 26 17:59:20 2016 +0100 fixes #7931 Add project in related projects when a document is a clsoing documentfor the project --- .../fr/ifremer/coselmar/services/v1/DocumentsWebService.java | 11 ++++++++++- coselmar-ui/src/main/webapp/js/coselmar-controllers.js | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java index 943fbf1..a0e6642 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java @@ -124,6 +124,12 @@ public class DocumentsWebService extends CoselmarWebServiceSupport { QuestionBean questionBean = BeanEntityConverter.toLightBean(getPersistenceContext().getTopiaIdFactory(), relatedQuestion); documentBean.addRelatedQuestion(questionBean); } + // Manage related Question + List<Question> relatedQuestionsAsClosing = getQuestionDao().forClosingDocumentsContains(document).findAll(); + for (Question relatedQuestion : relatedQuestionsAsClosing) { + QuestionBean questionBean = BeanEntityConverter.toLightBean(getPersistenceContext().getTopiaIdFactory(), relatedQuestion); + documentBean.addRelatedQuestion(questionBean); + } // Manage restricted access if (document.getPrivacy() == Privacy.RESTRICTED) { @@ -226,7 +232,10 @@ public class DocumentsWebService extends CoselmarWebServiceSupport { // Manage related Question long relatedQuestions = getQuestionDao().forRelatedDocumentsContains(document).count(); - documentBean.setNbRelatedQuestions((int) relatedQuestions); + // Don't forget use as closing documents + long relatedQuestionsAsClosing = getQuestionDao().forClosingDocumentsContains(document).count(); + + documentBean.setNbRelatedQuestions((int) (relatedQuestions + relatedQuestionsAsClosing)); result.add(documentBean); } diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index dde3628..7156265 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -426,7 +426,9 @@ coselmarControllers.controller("DocumentViewCtrl", //to enter in edit mode from view $scope.edit = function() { - $location.search("edit"); + if ($scope.canEdit) { + $location.search("edit"); + } } $scope.existing = {'types' : [], 'keywords' : []}; -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.