Index: main/plugin-odf-sync/resources/js/org/ametys/odf/sync/person/ImportPersonTool.i18n.js
===================================================================
--- main/plugin-odf-sync/resources/js/org/ametys/odf/sync/person/ImportPersonTool.i18n.js (revision 36748)
+++ main/plugin-odf-sync/resources/js/org/ametys/odf/sync/person/ImportPersonTool.i18n.js (working copy)
@@ -312,9 +312,9 @@
{
html += "- " + result.countAlreadyImported + "";
}
- if (result.countProgramsFailed > 0)
+ if (result.countFailed > 0)
{
- html += "- " + result.countProgramsFailed + "";
+ html += "- " + result.countFailed + "";
}
org.ametys.odf.sync.AbstractImportTool._lastReport = result.report;
Index: main/plugin-odf-sync/src/org/ametys/plugins/odfsync/person/ImportPersonAction.java
===================================================================
--- main/plugin-odf-sync/src/org/ametys/plugins/odfsync/person/ImportPersonAction.java (revision 36748)
+++ main/plugin-odf-sync/src/org/ametys/plugins/odfsync/person/ImportPersonAction.java (working copy)
@@ -102,7 +102,8 @@
}
else
{
- report.error("La personne " + parametersToString(params) + " n'a pas été trouvée dans la base des personnes");
+ countFailed++;
+ report.error("La personne " + parametersToString(params) + " n'a pas été trouvée ou a été trouvé plusieurs fois dans la base des personnes");
}
}
}
@@ -117,8 +118,8 @@
result.put("countImported", countImported);
result.put("countFailed", countFailed);
result.put("countAlreadyImported", countAlreadyImported);
-
- result.put("report", StringUtils.join(report.getMessages(), "\n"));
+
+ result.put("report", report.report2Html());
Request request = ObjectModelHelper.getRequest(objectModel);
request.setAttribute(JSonReader.MAP_TO_READ, result);
Index: main/plugin-odf-sync/src/org/ametys/plugins/odfsync/person/SynchronizePersonAction.java
===================================================================
--- main/plugin-odf-sync/src/org/ametys/plugins/odfsync/person/SynchronizePersonAction.java (revision 36748)
+++ main/plugin-odf-sync/src/org/ametys/plugins/odfsync/person/SynchronizePersonAction.java (working copy)
@@ -73,47 +73,39 @@
String contentId = (String) jsParameters.get("contentId");
String login = ((String) jsParameters.get("code")).toUpperCase();
- if (!login.matches("^([a-z,A-Z,0-9,-,_]+)$"))
- {
- result.put("invalidLogin", true);
- getLogger().error("The login " + login + " is not valid, person can not be synchronized.");
- }
- else
+ Person person = _resolver.resolveById(contentId);
+
+ boolean hasChanges = _syncManager.synchronizePerson(login, person, report, getLogger());
+
+ if (!report.hasError())
{
- Person person = _resolver.resolveById(contentId);
-
- boolean hasChanges = _syncManager.synchronizePerson(login, person, report, getLogger());
+ if (report.hasWarning())
+ {
+ result.put("warning", true);
+ }
+ result.put("contentId", contentId);
- if (!report.hasError())
+ if (hasChanges)
{
- if (report.hasWarning())
+ result.put("hasChanges", true);
+ try
{
- result.put("warning", true);
+ doWorkflowAction (person);
}
- result.put("contentId", contentId);
-
- if (hasChanges)
+ catch (WorkflowException e)
{
- result.put("hasChanges", true);
- try
- {
- doWorkflowAction (person);
- }
- catch (WorkflowException e)
- {
- result.put("workflowError", true);
- report.error("Le worklow du contenu synchronisé n'a pas été avancé", e);
- getLogger().error("Unable to do workflow action after synchronization", e);
- }
+ result.put("workflowError", true);
+ report.error("Le worklow du contenu synchronisé n'a pas été avancé", e);
+ getLogger().error("Unable to do workflow action after synchronization", e);
}
}
- else
- {
- result.put("error", true);
- }
}
-
- result.put("report", StringUtils.join(report.getMessages(), "\n"));
+ else
+ {
+ result.put("error", true);
+ }
+
+ result.put("report", report.report2Html());
Request request = ObjectModelHelper.getRequest(objectModel);
request.setAttribute(JSonReader.MAP_TO_READ, result);