Commit ea223d5a authored by Guillaume Lépine's avatar Guillaume Lépine
Browse files

FORMS-509: Fix display of dates when loading a draft

parent d3cbf240
......@@ -33,6 +33,8 @@
*/
package fr.paris.lutece.plugins.forms.web.entrytype;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
......@@ -44,9 +46,11 @@ import fr.paris.lutece.plugins.forms.business.form.column.IFormColumn;
import fr.paris.lutece.plugins.forms.business.form.column.impl.FormColumnEntry;
import fr.paris.lutece.plugins.forms.util.FormsConstants;
import fr.paris.lutece.plugins.genericattributes.business.Entry;
import fr.paris.lutece.plugins.genericattributes.business.Response;
import fr.paris.lutece.plugins.genericattributes.service.entrytype.EntryTypeServiceManager;
import fr.paris.lutece.plugins.genericattributes.service.entrytype.IEntryTypeService;
import fr.paris.lutece.portal.service.template.AppTemplateService;
import fr.paris.lutece.util.date.DateUtil;
/**
* The display service for entry type date
......@@ -98,7 +102,16 @@ public class EntryTypeDateDisplayService implements IEntryDisplayService
{
String strEntryHtml = StringUtils.EMPTY;
IEntryTypeService service = EntryTypeServiceManager.getEntryTypeService( entry );
List<Response> listResponse = retrieveResponseListFromModel( model );
for ( Response response : listResponse )
{
String strValueEntry = response.getResponseValue( );
if ( StringUtils.isNotEmpty( strValueEntry ) )
{
Date tDateValue = new Date( Long.parseLong( strValueEntry ) );
response.setToStringValueResponse( DateUtil.getDateString( tDateValue, locale ) );
}
}
switch( displayType.getMode( ) )
{
case EDITION:
......
......@@ -3,11 +3,7 @@
<@columns sm=9>
<#if list_responses?has_content>
<#list list_responses as response>
<@p>
<#if response.toStringValueResponse??>
${response.toStringValueResponse?number?number_to_date?string("dd/MM/yyyy")!''}
</#if>
</@p>
<@p>${response.toStringValueResponse!''}</@p>
</#list>
</#if>
</@columns>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment