diff --git a/marlo-data/src/main/java/org/cgiar/ccafs/marlo/config/APConstants.java b/marlo-data/src/main/java/org/cgiar/ccafs/marlo/config/APConstants.java
index 9f0b60f7be..0466512173 100644
--- a/marlo-data/src/main/java/org/cgiar/ccafs/marlo/config/APConstants.java
+++ b/marlo-data/src/main/java/org/cgiar/ccafs/marlo/config/APConstants.java
@@ -794,6 +794,7 @@ public final class APConstants {
public static final String IGNORE_NEWER_YEARS = "ignoreNewer";
public static final String DELIVERABLE_CRP_PROGRAM_OUTCOME_DEPRECATED = "DEPRECATED";
+ public static final String CRP_PROGRAM_OUTCOME_DEPRECATED = "DEPRECATED";
public static final int EXPECTED_OTHER_ALLIANCE_LEVER_ID = 9;
diff --git a/marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/dao/DeliverableInfoDAO.java b/marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/dao/DeliverableInfoDAO.java
index ededd96694..31aab0d658 100644
--- a/marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/dao/DeliverableInfoDAO.java
+++ b/marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/dao/DeliverableInfoDAO.java
@@ -62,6 +62,13 @@ public interface DeliverableInfoDAO {
public List getDeliverablesInfoByPhase(Phase phase);
+ /**
+ * This method gets a list of DeliverableInfo that are active by a given phase, project and status
+ *
+ * @return a list from DeliverableInfo null if no exist records
+ */
+ public List getDeliverablesInfoByPhaseProjectAndStatus(Phase phase, long projectId, long statusId);
+
/**
* This method gets a list of DeliverableInfo that are active by a given phase and project
*
diff --git a/marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/dao/mysql/DeliverableInfoMySQLDAO.java b/marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/dao/mysql/DeliverableInfoMySQLDAO.java
index ace6be6828..5194b3eab6 100644
--- a/marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/dao/mysql/DeliverableInfoMySQLDAO.java
+++ b/marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/dao/mysql/DeliverableInfoMySQLDAO.java
@@ -126,6 +126,36 @@ public List getDeliverablesInfoByPhase(Phase phase) {
return deliverableInfos;
}
+ @Override
+ public List getDeliverablesInfoByPhaseProjectAndStatus(Phase phase, long projectId, long statusId) {
+
+ StringBuilder query = new StringBuilder();
+ query.append("SELECT DISTINCT ");
+ query.append("di.id as id ");
+ query.append("FROM ");
+ query.append("deliverables_info AS di ");
+ query.append("INNER JOIN deliverables AS d ON d.id = di.deliverable_id ");
+ query.append("WHERE d.is_active = 1 AND ");
+ query.append("d.project_id IS NOT NULL AND ");
+ query.append("di.is_active = 1 AND ");
+ query.append("di.`id_phase` =" + phase.getId());
+ query.append(" AND d.project_id =" + projectId);
+ query.append(" AND di.status !=" + statusId);
+
+ List
"
+ + "Type: " + deliverableType + "" + "";
} catch (Exception e) {
return " (D" + this.getId() + ") - " + this.getDeliverableInfo().getTitle();
diff --git a/marlo-web/src/main/java/org/cgiar/ccafs/marlo/action/projects/DeliverableAction.java b/marlo-web/src/main/java/org/cgiar/ccafs/marlo/action/projects/DeliverableAction.java
index a1d32fa411..bcf1dd2319 100644
--- a/marlo-web/src/main/java/org/cgiar/ccafs/marlo/action/projects/DeliverableAction.java
+++ b/marlo-web/src/main/java/org/cgiar/ccafs/marlo/action/projects/DeliverableAction.java
@@ -3052,9 +3052,13 @@ public void saveDataSharing() {
private void saveDeliverableActivities(Deliverable deliverablePrew) {
if (deliverable.getActivities() != null) {
if (deliverablePrew.getDeliverableActivities() != null && !deliverablePrew.getDeliverableActivities().isEmpty()) {
- List activityPrew = deliverablePrew.getDeliverableActivities().stream()
- .filter(dp -> dp.isActive() && dp.getPhase() != null && dp.getPhase().equals(this.getActualPhase()))
- .collect(Collectors.toList());
+ /*
+ * List activityPrew = deliverablePrew.getDeliverableActivities().stream()
+ * .filter(dp -> dp.isActive() && dp.getPhase() != null && dp.getPhase().equals(this.getActualPhase()))
+ * .collect(Collectors.toList());
+ */
+ List activityPrew = deliverableActivityManager
+ .getDeliverableActivitiesByDeliverableIDAndPhase(deliverableID, this.getActualPhase().getId());
for (DeliverableActivity deliverableActivity : activityPrew) {
if (!deliverable.getActivities().contains(deliverableActivity)) {
@@ -3064,15 +3068,17 @@ private void saveDeliverableActivities(Deliverable deliverablePrew) {
}
for (DeliverableActivity deliverableActivity : deliverable.getActivities()) {
- if (deliverableActivity.getId() == null || deliverableActivity.getId() == -1) {
-
- deliverableActivity.setDeliverable(deliverableManager.getDeliverableById(deliverableID));
- deliverableActivity.setPhase(this.getActualPhase());
- deliverableActivityManager.saveDeliverableActivity(deliverableActivity);
- // This add projectFocus to generate correct auditlog.
- deliverablePrew.getDeliverableActivities().add(deliverableActivity);
+ if (deliverableActivity.getId() != null && deliverableActivity.getId() != -1) {
+ deliverableActivity = deliverableActivityManager.getDeliverableActivityById(deliverableActivity.getId());
}
+
+ deliverableActivity.setDeliverable(deliverableManager.getDeliverableById(deliverableID));
+ deliverableActivity.setPhase(this.getActualPhase());
+ deliverableActivityManager.saveDeliverableActivity(deliverableActivity);
+ // This add projectFocus to generate correct auditlog.
+ deliverablePrew.getDeliverableActivities().add(deliverableActivity);
}
+
}
}
diff --git a/marlo-web/src/main/java/org/cgiar/ccafs/marlo/action/projects/ProjectInnovationAction.java b/marlo-web/src/main/java/org/cgiar/ccafs/marlo/action/projects/ProjectInnovationAction.java
index da2b7283ee..980d41eb71 100644
--- a/marlo-web/src/main/java/org/cgiar/ccafs/marlo/action/projects/ProjectInnovationAction.java
+++ b/marlo-web/src/main/java/org/cgiar/ccafs/marlo/action/projects/ProjectInnovationAction.java
@@ -22,6 +22,7 @@
import org.cgiar.ccafs.marlo.data.manager.AuditLogManager;
import org.cgiar.ccafs.marlo.data.manager.CrpMilestoneManager;
import org.cgiar.ccafs.marlo.data.manager.CrpProgramOutcomeManager;
+import org.cgiar.ccafs.marlo.data.manager.DeliverableInfoManager;
import org.cgiar.ccafs.marlo.data.manager.DeliverableManager;
import org.cgiar.ccafs.marlo.data.manager.DeliverableTypeManager;
import org.cgiar.ccafs.marlo.data.manager.FeedbackQACommentManager;
@@ -170,6 +171,7 @@
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.stream.Collectors;
import javax.inject.Inject;
@@ -270,6 +272,7 @@ public static void setIsSaving(HashMap isSaving) {
private ProjectInnovationToolCategoryManager projectInnovationToolCategoryManager;
private ToolFunctionCategoryManager toolFunctionCategoryManager;
private DeliverableTypeManager deliverableTypeManager;
+ private DeliverableInfoManager deliverableInfoManager;
// Variables
private long projectID;
private long innovationID;
@@ -382,7 +385,8 @@ public ProjectInnovationAction(APConfig config, GlobalUnitManager globalUnitMana
ProjectInnovationActorManager projectInnovationActorManager,
ToolFunctionCategoryManager toolFunctionCategoryManager,
ProjectInnovationToolCategoryManager projectInnovationToolCategoryManager,
- DeliverableTypeManager deliverableTypeManager, InstitutionLocationManager institutionLocationManager) {
+ DeliverableTypeManager deliverableTypeManager, InstitutionLocationManager institutionLocationManager,
+ DeliverableInfoManager deliverableInfoManager) {
super(config);
this.projectInnovationManager = projectInnovationManager;
this.globalUnitManager = globalUnitManager;
@@ -453,6 +457,7 @@ public ProjectInnovationAction(APConfig config, GlobalUnitManager globalUnitMana
this.projectInnovationToolCategoryManager = projectInnovationToolCategoryManager;
this.deliverableTypeManager = deliverableTypeManager;
this.institutionLocationManager = institutionLocationManager;
+ this.deliverableInfoManager = deliverableInfoManager;
}
@@ -1523,6 +1528,9 @@ public void prepare() throws Exception {
// Default name (only the institution name)
String defaultName = contributingPartner.getName();
+ if (contributingPartner.getAcronym() != null && !contributingPartner.getAcronym().isEmpty()) {
+ defaultName = contributingPartner.getAcronym() + " - " + defaultName;
+ }
// Assign nameWithCountry if it is null or does not contain the country name
if (contributingPartner.getName() != null || !contributingPartner.getName().contains(tempName)) {
@@ -1557,25 +1565,29 @@ public void prepare() throws Exception {
}
}
+
+ // cgamboa 15/12/2024 function locElementManager.findAll() will be used once time
+ List listLocElementPrevious = locElementManager.findAll();
+
// Getting The list of countries
- countries = locElementManager.findAll().stream().filter(c -> c.getLocElementType().getId().intValue() == 2)
+ countries = listLocElementPrevious.stream().filter(c -> c.getLocElementType().getId().intValue() == 2)
.collect(Collectors.toList());
// Getting the list of institution
institutions = institutionManager.findAll().stream().collect(Collectors.toList());
// Regions for Geographic Scope Regional Selection
- regions = locElementManager.findAll().stream()
+ regions = listLocElementPrevious.stream()
.filter(c -> c.getLocElementType().getId().intValue() == 1 && c.isActive() && c.getIsoNumeric() != null)
.collect(Collectors.toList());
phaseResearchList = repIndPhaseResearchPartnershipManager.findAll();
stageInnovationList = repIndStageInnovationManager.findAll();
geographicScopeList = repIndGeographicScopeManager.findAll();
+
try {
if (geographicScopeList != null && !geographicScopeList.isEmpty()) {
- geographicScopeList = geographicScopeList.stream().sorted(Comparator.comparing(RepIndGeographicScope::getId))
- .collect(Collectors.toList());
+
RepIndGeographicScope geographicDelete;
// Remove multi-national
geographicDelete = repIndGeographicScopeManager.getRepIndGeographicScopeById(3);
@@ -1583,14 +1595,18 @@ public void prepare() throws Exception {
geographicScopeList.remove(geographicDelete);
}
// Remove sub-national
- geographicDelete = repIndGeographicScopeManager.getRepIndGeographicScopeById(6);
+ geographicDelete = repIndGeographicScopeManager.getRepIndGeographicScopeById(5);
if (geographicDelete != null) {
geographicScopeList.remove(geographicDelete);
}
+
+ geographicScopeList = geographicScopeList.stream().sorted(Comparator.comparing(RepIndGeographicScope::getId))
+ .collect(Collectors.toList());
}
} catch (Exception e) {
Log.error("error deleting elements from " + e);
}
+
innovationTypeList = repIndInnovationTypeManager.findAll();
innovationNatureList = repIndInnovationNatureManager.findAll();
focusLevelList = focusLevelManager.findAll();
@@ -1669,15 +1685,27 @@ public void prepare() throws Exception {
}
}
- if (phase != null && phase.getDeliverableInfos() != null && project != null
- && !phase.getDeliverableInfos().isEmpty()) {
- List infos = phase.getDeliverableInfos().stream()
- .filter(c -> c != null && c.getDeliverable() != null && c.getDeliverable().getProject() != null
- && c.getDeliverable().getProject().equals(project) && c.getDeliverable().isActive()
- && c.getDeliverable().getDeliverableInfo(this.getActualPhase()) != null
- && c.getDeliverable().getDeliverableInfo(this.getActualPhase()).getStatus() != null
- && c.getDeliverable().getDeliverableInfo(this.getActualPhase()).getStatus() != 5)
- .collect(Collectors.toList());
+ Set deliverableInfos = phase.getDeliverableInfos();
+ if (phase != null && deliverableInfos != null && project != null && !deliverableInfos.isEmpty()) {
+ /*
+ * List infos = phase.getDeliverableInfos().stream()
+ * .filter(c -> c != null && c.getDeliverable() != null && c.getDeliverable().getProject() != null
+ * && c.getDeliverable().getProject().equals(project) && c.getDeliverable().isActive()
+ * && c.getDeliverable().getDeliverableInfo(this.getActualPhase()) != null
+ * && c.getDeliverable().getDeliverableInfo(this.getActualPhase()).getStatus() != null
+ * && c.getDeliverable().getDeliverableInfo(this.getActualPhase()).getStatus() != 5)
+ * .collect(Collectors.toList());
+ */
+ // 16/12/2024 cgamboa the query was reduced
+ List infos = new ArrayList<>();
+ try {
+
+ infos = this.deliverableInfoManager.getDeliverablesInfoByPhaseProjectAndStatus(phase, project.getId(), 5L)
+ .stream().filter(c -> c != null).collect(Collectors.toList());
+ } catch (Exception e) {
+ logger.error(" unable to get deliverable info " + e.getMessage());
+ }
+
deliverableList = new ArrayList<>();
for (DeliverableInfo deliverableInfo : infos) {
Deliverable deliverable = deliverableInfo.getDeliverable();
@@ -1734,20 +1762,31 @@ public void prepare() throws Exception {
}
}
-
+ Set deliverableInfosShared = phase.getDeliverableInfos();
// Get deliverable list for shared innovations projects
if (projectSharedList != null && !projectSharedList.isEmpty()) {
for (Project projectInnovationShared : projectSharedList) {
- if (phase != null && phase.getDeliverableInfos() != null && projectInnovationShared != null
- && !phase.getDeliverableInfos().isEmpty()) {
- List infos = phase.getDeliverableInfos().stream()
- .filter(c -> c != null && c.getDeliverable() != null && c.getDeliverable().getProject() != null
- && c.getDeliverable().getProject().equals(projectInnovationShared) && c.getDeliverable().isActive()
- && c.getDeliverable().getDeliverableInfo(this.getActualPhase()) != null
- && c.getDeliverable().getDeliverableInfo(this.getActualPhase()).getStatus() != null
- && c.getDeliverable().getDeliverableInfo(this.getActualPhase()).getStatus() != 5)
- .collect(Collectors.toList());
-
+ if (phase != null && deliverableInfosShared != null && projectInnovationShared != null
+ && !deliverableInfosShared.isEmpty()) {
+ /*
+ * 16/12/2024 cgamboa the query was reduced
+ * List infos = phase.getDeliverableInfos().stream()
+ * .filter(c -> c != null && c.getDeliverable() != null && c.getDeliverable().getProject() != null
+ * && c.getDeliverable().getProject().equals(projectInnovationShared) && c.getDeliverable().isActive()
+ * && c.getDeliverable().getDeliverableInfo(this.getActualPhase()) != null
+ * && c.getDeliverable().getDeliverableInfo(this.getActualPhase()).getStatus() != null
+ * && c.getDeliverable().getDeliverableInfo(this.getActualPhase()).getStatus() != 5)
+ * .collect(Collectors.toList());
+ */
+ List infos = new ArrayList<>();
+ try {
+
+ infos = this.deliverableInfoManager
+ .getDeliverablesInfoByPhaseProjectAndStatus(phase, projectInnovationShared.getId(), 5L).stream()
+ .filter(c -> c != null).collect(Collectors.toList());
+ } catch (Exception e) {
+ logger.error(" unable to get deliverable info " + e.getMessage());
+ }
for (DeliverableInfo deliverableInfo : infos) {
Deliverable deliverable = deliverableInfo.getDeliverable();
deliverable.setDeliverableInfo(deliverableInfo);
@@ -1841,7 +1880,9 @@ public void prepare() throws Exception {
m -> m != null && m.isActive() && m.getYear() != 0 && m.getYear() <= this.getActualPhase().getYear())
.collect(Collectors.toList()));
- if (!this.crpOutcomes.contains(projectOutcome.getCrpProgramOutcome())) {
+ if (!this.crpOutcomes.contains(projectOutcome.getCrpProgramOutcome())
+ && projectOutcome.getCrpProgramOutcome().getDescription() != null && !projectOutcome.getCrpProgramOutcome()
+ .getDescription().contains(APConstants.CRP_PROGRAM_OUTCOME_DEPRECATED)) {
this.crpOutcomes.add(projectOutcome.getCrpProgramOutcome());
}
@@ -1918,13 +1959,6 @@ public void prepare() throws Exception {
&& f.getField().getId() != null && f.getField().getId().equals(field.getId()))
.collect(Collectors.toList());
- /*
- * comments = feedbackQACommentManager.findAll().stream()
- * .filter(f -> f != null && f.getPhase() != null && f.getPhase().getId() != null
- * && f.getPhase().getId().equals(this.getActualPhase().getId()) && f.getParentId() == innovation.getId()
- * && f.getField() != null && f.getField().getId() != null && f.getField().getId().equals(field.getId()))
- * .collect(Collectors.toList());
- */
field.setQaComments(comments);
}
}
@@ -3997,6 +4031,7 @@ public void validate() {
validator.validate(this, project, innovation, clearLead, true, true, this.getActualPhase().getYear(),
this.getActualPhase().getUpkeep());
}
+
}
public void validateTabs() {
diff --git a/marlo-web/src/main/java/org/cgiar/ccafs/marlo/config/APConstants.java b/marlo-web/src/main/java/org/cgiar/ccafs/marlo/config/APConstants.java
index ba19074ce1..ce0120c7c7 100644
--- a/marlo-web/src/main/java/org/cgiar/ccafs/marlo/config/APConstants.java
+++ b/marlo-web/src/main/java/org/cgiar/ccafs/marlo/config/APConstants.java
@@ -869,6 +869,7 @@ public final class APConstants {
public static final String IGNORE_NEWER_YEARS = "ignoreNewer";
public static final String DELIVERABLE_CRP_PROGRAM_OUTCOME_DEPRECATED = "DEPRECATED";
+ public static final String CRP_PROGRAM_OUTCOME_DEPRECATED = "DEPRECATED";
public static final int EXPECTED_OTHER_ALLIANCE_LEVER_ID = 9;
diff --git a/marlo-web/src/main/resources/custom/aicrra.properties b/marlo-web/src/main/resources/custom/aicrra.properties
index 7d5610a2e0..2d7a37c463 100644
--- a/marlo-web/src/main/resources/custom/aicrra.properties
+++ b/marlo-web/src/main/resources/custom/aicrra.properties
@@ -4358,7 +4358,7 @@ projectInnovations.stage=Stage of innovation
projectInnovations.contributingCenters=Contributing Centers/Managing partners
projectInnovations.geographicScope=Geographic Scope
projectInnovations.geographicImpact=Select the countries/regions that falls within the Innovation's scope
-projectInnovations.geographicScopeTopic=Select the is the main geographic focus of the output.
+projectInnovations.geographicScopeTopic=Select the is the main geographic focus of the output
projectInnovations.innovationType=Innovation type
projectInnovations.innovationType.helpText=Select one of the options from the available drop-down list and follow their description to better categorize the innovation that is being reported
projectInnovations.innovationNature=Innovation nature
@@ -4396,6 +4396,7 @@ projectInnovations.stageDescription=Description of Stage reached
projectInnovations.adaptativeResearch=Novel or adaptive research
projectInnovations.leadOrganization=Name of lead organization/entity to take innovation to this stage
projectInnovations.contributingOrganizations=Contributing external partners
+projectInnovations.contributingOrganizations.help=Please select the key external partners who have significantly contributed to the reported outcome or impact. Include the affiliation for individuals, if known.
projectInnovations.contributingCenters=Contributing Centers/Managing partners
projectInnovations.stageDescription.readText=Description of Stage reached
projectInnovations.stageDescription.help=Please provide a short description/explanation of the completed Stage
diff --git a/marlo-web/src/main/resources/global.properties b/marlo-web/src/main/resources/global.properties
index 70282cd16b..e0ea1146b6 100644
--- a/marlo-web/src/main/resources/global.properties
+++ b/marlo-web/src/main/resources/global.properties
@@ -4448,7 +4448,7 @@ projectInnovations.stage=Stage of innovation
projectInnovations.contributingCenters=Contributing Centers/Managing partners
projectInnovations.geographicScope=Geographic Scope
projectInnovations.geographicImpact=Select the countries/regions that falls within the Innovation's scope
-projectInnovations.geographicScopeTopic=Select the is the main geographic focus of the output.
+projectInnovations.geographicScopeTopic=Select the is the main geographic focus of the output
projectInnovations.innovationType=Innovation type
projectInnovations.innovationType.helpText=Select one of the options from the available drop-down list and follow their description to better categorize the innovation that is being reported
projectInnovations.innovationNature=Innovation nature
@@ -4486,6 +4486,7 @@ projectInnovations.stageDescription=Description of Stage reached
projectInnovations.adaptativeResearch=Novel or adaptive research
projectInnovations.leadOrganization=Name of lead organization/entity to take innovation to this stage
projectInnovations.contributingOrganizations=Contributing external partners
+projectInnovations.contributingOrganizations.help=Please select the key external partners who have significantly contributed to the reported outcome or impact. Include the affiliation for individuals, if known.
projectInnovations.contributingCenters=Contributing Centers/Managing partners
projectInnovations.stageDescription.readText=Description of Stage reached
projectInnovations.stageDescription.help=Please provide a short description/explanation of the completed Stage
diff --git a/marlo-web/src/main/webapp/WEB-INF/crp/views/projects/projectInnovation.ftl b/marlo-web/src/main/webapp/WEB-INF/crp/views/projects/projectInnovation.ftl
index ef12881553..90002a6134 100644
--- a/marlo-web/src/main/webapp/WEB-INF/crp/views/projects/projectInnovation.ftl
+++ b/marlo-web/src/main/webapp/WEB-INF/crp/views/projects/projectInnovation.ftl
@@ -177,15 +177,6 @@
-[#include "/WEB-INF/global/pages/footer.ftl"]
-
-[#function findElementID list id]
- [#list (list)![] as item]
- [#if (item.repIndGeographicScope.id == id)!false][#return true][/#if]
- [/#list]
- [#return false]
-[/#function]
-
[#-- Partner users TEMPLATE --]
[#list partners as partner]
@@ -193,9 +184,18 @@
[#assign usersList = (action.getUserList(partner.institution.id))![]]
[#list usersList as user]
- [@deliverableMacros.deliverableUserMacro element={} user=user index=user_index name="_TEMPLATE_innovation.partnerships[0].partnershipPersons" isUserChecked=false isResponsable=true /]
+ [@deliverableMacros.deliverableUserMacro element={} user=user index=user_index name="innovation.partnerships[0].partnershipPersons" isUserChecked=false isResponsable=true /]
[/#list]
[/#list]
-
\ No newline at end of file
+
+
+[#include "/WEB-INF/global/pages/footer.ftl"]
+
+[#function findElementID list id]
+ [#list (list)![] as item]
+ [#if (item.repIndGeographicScope.id == id)!false][#return true][/#if]
+ [/#list]
+ [#return false]
+[/#function]
\ No newline at end of file
diff --git a/marlo-web/src/main/webapp/WEB-INF/global/macros/forms.ftl b/marlo-web/src/main/webapp/WEB-INF/global/macros/forms.ftl
index 42d65ced62..b245efb84b 100644
--- a/marlo-web/src/main/webapp/WEB-INF/global/macros/forms.ftl
+++ b/marlo-web/src/main/webapp/WEB-INF/global/macros/forms.ftl
@@ -568,7 +568,7 @@
[#macro checkBoxFlat id name label="" help="" paramText="" helpIcon=true disabled=false editable=true value="" checked=true cssClass="" cssClassLabel="" columns=0 ]