|
|
@@ -590,33 +590,52 @@ public class ProceduresController {
|
|
|
|
|
|
if(it.getText() == null) {
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
-
|
|
|
Map<String, Object> opciones;
|
|
|
try {
|
|
|
opciones = mapper.readValue(it.getTasca().getOpcions(),
|
|
|
new TypeReference<Map<String, Object>>() {});
|
|
|
+
|
|
|
if(opciones != null) {
|
|
|
- List<?> copiarDesdeList = (List<?>) opciones.get("copiar_desde");
|
|
|
-
|
|
|
- if (!copiarDesdeList.isEmpty()) {
|
|
|
- Map<?, ?> datosCopiar = (Map<?, ?>) copiarDesdeList.get(0);
|
|
|
-
|
|
|
- if (datosCopiar.get("proces") != null && datosCopiar.get("curso") != null) {
|
|
|
- String proces = datosCopiar.get("proces").toString();
|
|
|
- Integer curso = Integer.parseInt(datosCopiar.get("curso").toString());
|
|
|
-
|
|
|
- PamMetadades pam = pms.findByNomProcesAndCursActivacio(proces, curso);
|
|
|
-
|
|
|
- String resultJson = addDefaultFieldsToJson(pam.getInstanciaTasca().getText(), false);
|
|
|
- itt.setText(resultJson);
|
|
|
+ Object idPamRevObj = opciones.get("id_pam_rev");
|
|
|
+
|
|
|
+ int idPamRev = 0;
|
|
|
+ if (idPamRevObj != null) {
|
|
|
+ idPamRev = Integer.parseInt(idPamRevObj.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ String resultJson = "";
|
|
|
+
|
|
|
+ if (idPamRev != 0) {
|
|
|
+ InstanciaTasca itPam = its.findByInstanciaTascap(it.getInstancia().getIdInstancia(), idPamRev);
|
|
|
+ if (itPam != null && itPam.getText() != null) {
|
|
|
+ resultJson = addDefaultFieldsToJson(itPam.getText(), true);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ List<?> copiarDesdeList = (List<?>) opciones.get("copiar_desde");
|
|
|
+
|
|
|
+ if (!copiarDesdeList.isEmpty()) {
|
|
|
+ Map<?, ?> datosCopiar = (Map<?, ?>) copiarDesdeList.get(0);
|
|
|
+
|
|
|
+ if (datosCopiar.get("proces") != null && datosCopiar.get("curso") != null) {
|
|
|
+ String proces = datosCopiar.get("proces").toString();
|
|
|
+ Integer curso = Integer.parseInt(datosCopiar.get("curso").toString());
|
|
|
+
|
|
|
+ PamMetadades pam = pms.findByNomProcesAndCursActivacio(proces, curso);
|
|
|
+ if (pam != null && pam.getInstanciaTasca() != null && pam.getInstanciaTasca().getText() != null) {
|
|
|
+ resultJson = addDefaultFieldsToJson(pam.getInstanciaTasca().getText(), false);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ itt.setText(resultJson);
|
|
|
}
|
|
|
} catch (JsonMappingException e) {
|
|
|
e.printStackTrace();
|
|
|
} catch (JsonProcessingException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
+
|
|
|
} else {
|
|
|
String resultJson = addDefaultFieldsToJson(it.getText(), true);
|
|
|
itt.setText(resultJson);
|
|
|
@@ -634,7 +653,7 @@ public class ProceduresController {
|
|
|
}
|
|
|
else {
|
|
|
itt.setUsuariFet("");
|
|
|
- }
|
|
|
+ }
|
|
|
itt.setAssignedToUser(its.isUserAuthorized(usuari, itt.getIdInstanciaTasca()));
|
|
|
itt.setOldEvidences(its.findOlderByProces(it.getInstancia().getCentre(), it.getInstancia().getTitulacio(), it.getInstancia().getProces().getNomProces(), i.getProces().getCursActivacio()));
|
|
|
itt.setVersions(its.findOlderVersions(it.getInstancia().getIdInstancia(), it.getTasca().getIdTasca(), it.getVersion()));
|