Commit 61ebe74b authored by pierre.sciorella@accenture.com's avatar pierre.sciorella@accenture.com

Merge branch 'develop'

parents b898d900 7f998d76
......@@ -10,7 +10,7 @@
<groupId>fr.paris.lutece.plugins</groupId>
<artifactId>plugin-ticketing</artifactId>
<packaging>lutece-plugin</packaging>
<version>2.0.19</version>
<version>2.0.20-SNAPSHOT</version>
<name>Lutece ticketing plugin</name>
<repositories>
......@@ -30,6 +30,16 @@
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>fr.paris.lutece</groupId>
......@@ -116,7 +126,7 @@
<connection>scm:git:https://github.com/lutece-platform/lutece-collab-plugin-ticketing.git</connection>
<developerConnection>scm:git:https://github.com/lutece-platform/lutece-collab-plugin-ticketing.git</developerConnection>
<url>https://github.com/lutece-platform/lutece-collab-plugin-ticketing.git</url>
<tag>lutece-collab-plugin-ticketing-2.0.19</tag>
<tag>lutece-collab-plugin-ticketing-2.0.15</tag>
</scm>
</project>
......@@ -155,7 +155,11 @@ public final class ContactModeHome
for ( ReferenceItem item : referenceList )
{
String strLocalizedName = I18nService.getLocalizedString( MESSAGE_PREFIX + item.getName( ), locale );
String strLocalizedName = item.getName();
if (I18nService.getLocalizedString( MESSAGE_PREFIX + item.getName( ), locale )!=null &&
!I18nService.getLocalizedString( MESSAGE_PREFIX + item.getName( ), locale ).trim().isEmpty()) {
strLocalizedName = I18nService.getLocalizedString( MESSAGE_PREFIX + item.getName( ), locale );
}
if ( !StringUtils.isEmpty( strLocalizedName ) )
{
......
......@@ -621,6 +621,7 @@ modify_contactmode.labelMobilePhoneNumber=mobile phone number
message.confirmRemoveContactMode=Do you really want to delete this contact mode?
contactmodes.label.email=E-mail
contactmodes.label.courier=Mail
contactmodes.label.courrier=Mail
# JSR 303 constraint validator messages
validation.contactmode.code.notEmpty=The field Code must not be empty. Please enter a value.
validation.contactmode.code.size=The field 'Code' must not contain more than 50 characters.
......@@ -1180,4 +1181,5 @@ mass_action_result.labelPermissionDeniedTickets=You don't have the necessary rig
ticketing.removal.unit.listener.error.parent = This unit doesn't have any parent. You can't delete this unit.
# indexing
error.ticket.indexing.failed.backoffice = Error indexing ticket back office
\ No newline at end of file
error.ticket.indexing.failed.backoffice = Error indexing ticket back office
manage_viewing.pageTitle=
\ No newline at end of file
......@@ -638,6 +638,7 @@ modify_contactmode.labelMobilePhoneNumber=t\u00e9l\u00e9phone portable
message.confirmRemoveContactMode=\u00cates-vous s\u00fbr de vouloir supprimer ce mode de contact ?
contactmodes.label.email=Courriel
contactmodes.label.courier=Courrier
contactmodes.label.courrier=Courrier
# JSR 303 constraint validator messages
validation.contactmode.code.notEmpty=Le champ Code ne doit pas \u00eatre vide. Veuillez le remplir SVP.
validation.contactmode.code.size=Le champ 'Code' ne doit pas contenir plus de 50 caract\u00e8res.
......@@ -1252,8 +1253,7 @@ ticketing.removal.unit.listener.error.parent = C'est entit\u00e9 n'a pas de pare
error.ticket.indexing.failed.backoffice = Erreur d'indexation du ticket back office
task_assign_ticket_to_user.labelUser.help =
task_assign_ticket_to_unit.labelUnit.help =
contactmodes.label.courrier =
task_assign_ticket_to_unit.labelUnit.help =
demand.type.my.account.1.label = Demande d'information
demand.type.my.account.2.label = R\u00e9clamation
......
......@@ -275,6 +275,23 @@ public class TicketFormService implements Serializable
model.put( MARK_STR_LIST_CHILDREN, strConditionalQuestionStringBuffer.toString( ) );
}
// O2T : recuperation des attributs complementaires (num facil'familles)
int idEntry = entry.getIdEntry();
for ( Field field : entry.getFields( ) )
{
if ( field != null &&
field.getCode( ) != null &&
field.getCode( ).equals( entry.getCode() ) &&
request.getSession( ).getAttribute( "attribute"+idEntry ) != null )
{
if (request.getSession( ).getAttribute( "attribute"+idEntry ) instanceof String[]) {
field.setValue( ((String[])request.getSession( ).getAttribute( "attribute"+idEntry ))[0] );
}
}
}
model.put( MARK_ENTRY, entry );
model.put( MARK_LOCALE, locale );
......
package fr.paris.lutece.plugins.ticketing.util.sort;
import java.text.Normalizer;
import java.util.regex.Pattern;
public class StringUtils
{
private static Pattern MARKER = Pattern.compile( "\\p{M}" );
/**
* Removes accents & diacretics and converts ligatures into several chars
*
* @param x string to fold into ASCII
* @return string converted to ASCII equivalent, expanding common ligatures
*/
public static String foldToAscii( String x )
{
if ( x == null )
{
return null;
}
x = replaceSpecialCases( x );
// use java unicode normalizer to remove accents
x = Normalizer.normalize( x, Normalizer.Form.NFD );
return MARKER.matcher( x ).replaceAll( "" );
}
/**
* The Normalizer misses a few cases and 2 char ligatures which we deal with here
*/
private static String replaceSpecialCases( String x )
{
StringBuilder sb = new StringBuilder( );
for ( int i = 0; i < x.length( ); i++ )
{
char c = x.charAt( i );
switch ( c )
{
case 'ß':
sb.append( "ss" );
break;
case 'Æ':
sb.append( "AE" );
break;
case 'æ':
sb.append( "ae" );
break;
case 'Ð':
sb.append( "D" );
break;
case 'đ':
sb.append( "d" );
break;
case 'ð':
sb.append( "d" );
break;
case 'Ø':
sb.append( "O" );
break;
case 'ø':
sb.append( "o" );
break;
case 'Œ':
sb.append( "OE" );
break;
case 'œ':
sb.append( "oe" );
break;
case 'Ŧ':
sb.append( "T" );
break;
case 'ŧ':
sb.append( "t" );
break;
case 'Ł':
sb.append( "L" );
break;
case 'ł':
sb.append( "l" );
break;
default:
sb.append( c );
}
}
return sb.toString( );
}
}
package fr.paris.lutece.plugins.ticketing.util.sort;
import fr.paris.lutece.portal.service.util.AppLogService;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Comparator;
import java.util.Locale;
public class TicketAttributeComparator implements Comparator<Object>, Serializable
{
private static final long serialVersionUID = 8552197766086300259L;
private String _strSortedAttribute;
private boolean _bIsASC;
public TicketAttributeComparator(String strSortedAttribute, boolean bIsASC) {
this._strSortedAttribute = strSortedAttribute;
this._bIsASC = bIsASC;
}
public TicketAttributeComparator(String strSortedAttribute) {
this._strSortedAttribute = strSortedAttribute;
this._bIsASC = true;
}
public int compare(Object o1, Object o2) {
int nStatus = 0;
Method method1 = this.getMethod(o1);
Method method2 = this.getMethod(o2);
if (method1 != null && method2 != null && method1.getReturnType() == method2.getReturnType()) {
try {
Object oRet1 = method1.invoke(o1);
Object oRet2 = method2.invoke(o2);
String strReturnType = method1.getReturnType().getName();
Class<?> returnType = method1.getReturnType();
if (oRet1 == null) {
if ( oRet2 != null )
{
nStatus = -1;
} // sinon nStatus = 0
} else if (oRet2 == null) {
nStatus = 1;
} else if (strReturnType.equals("java.lang.String")) {
oRet1 = StringUtils.foldToAscii( ((String) oRet1).trim() );
oRet2 = StringUtils.foldToAscii( ((String) oRet2).trim() );
nStatus = ((String)oRet1).toLowerCase(Locale.ENGLISH).compareTo(((String)oRet2).toLowerCase(Locale.ENGLISH));
} else if (!returnType.isPrimitive() && !this.isComparable(returnType)) {
if (returnType.isEnum()) {
nStatus = oRet1.toString().compareTo(oRet2.toString());
}
} else {
nStatus = ((Comparable)oRet1).compareTo((Comparable)oRet2);
}
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException var10) {
AppLogService.error(var10);
}
}
if (!this._bIsASC) {
nStatus *= -1;
}
return nStatus;
}
private Method getMethod(Object obj) {
Method method = null;
String strFirstLetter = this._strSortedAttribute.substring(0, 1).toUpperCase();
String strMethodName = "get" + strFirstLetter + this._strSortedAttribute.substring(1, this._strSortedAttribute.length());
try {
method = obj.getClass().getMethod(strMethodName);
} catch (Exception var6) {
AppLogService.error(var6);
}
return method;
}
private boolean isComparable(Class<?> clazz) {
Class[] var2 = clazz.getInterfaces();
int var3 = var2.length;
for(int var4 = 0; var4 < var3; ++var4) {
Class<?> interfac = var2[var4];
if (interfac.equals(Comparable.class)) {
return true;
}
}
Class<?> superClass = clazz.getSuperclass();
if (superClass != null) {
return this.isComparable(superClass);
} else {
return false;
}
}
}
......@@ -114,7 +114,7 @@ import fr.paris.lutece.portal.web.util.LocalizedPaginator;
import fr.paris.lutece.util.html.Paginator;
import fr.paris.lutece.util.url.UrlItem;
/**
/*
* ManageTickets JSP Bean abstract class for JSP Bean
*/
......@@ -1007,6 +1007,14 @@ public class ManageTicketsJspBean extends WorkflowCapableJspBean
boolean bIsFormValid = populateAndValidateFormTicket( ticket, request );
// O2T : recuperation des attributs complementaires (dont num facil'familles)
for ( Map.Entry entry : request.getParameterMap().entrySet()) {
if (entry.getKey()!=null && entry.getKey().toString().startsWith( "attribute" )) {
request.getSession().setAttribute( String.valueOf( entry.getKey() ), entry.getValue() );
}
}
if ( !bIsFormValid )
{
_ticketFormService.saveTicketInSession( request.getSession( ), ticket );
......@@ -1015,6 +1023,8 @@ public class ManageTicketsJspBean extends WorkflowCapableJspBean
}
else
{
ticket.setContactMode( ContactModeHome.findByPrimaryKey( ticket.getIdContactMode( ) ).getCode( ) );
ticket.setUserTitle( UserTitleHome.findByPrimaryKey( ticket.getIdUserTitle( ) ).getLabel( ) );
ticket.setChannel( ChannelHome.findByPrimaryKey( ticket.getChannel( ).getId( ) ) );
......
......@@ -46,6 +46,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import fr.paris.lutece.plugins.ticketing.util.sort.TicketAttributeComparator;
import org.apache.commons.lang.StringUtils;
import fr.paris.lutece.plugins.ticketing.business.category.TicketCategory;
......@@ -71,7 +72,6 @@ import fr.paris.lutece.portal.web.constants.Parameters;
import fr.paris.lutece.portal.web.util.LocalizedPaginator;
import fr.paris.lutece.util.ReferenceList;
import fr.paris.lutece.util.html.Paginator;
import fr.paris.lutece.util.sort.AttributeComparator;
import fr.paris.lutece.util.url.UrlItem;
/**
......@@ -243,7 +243,7 @@ public class ModelResponseJspBean extends MVCAdminJspBean
if ( _strSortedAttributeName != null )
{
Collections.sort( listModelResponses, new AttributeComparator( _strSortedAttributeName, Boolean.parseBoolean( _strAscSort ) ) );
listModelResponses.sort( new TicketAttributeComparator( _strSortedAttributeName, Boolean.parseBoolean( _strAscSort ) ) );
url.addParameter( Parameters.SORTED_ATTRIBUTE_NAME, _strSortedAttributeName );
url.addParameter( Parameters.SORTED_ASC, _strAscSort );
}
......
......@@ -127,10 +127,17 @@ public class FormValidator
if ( !bIsValid )
{
Object [ ] args = {
I18nService.getLocalizedString( CONTACT_MODE_LABEL_I18N + contactMode.getCode( ), _request.getLocale( ) )
};
strError = I18nService.getLocalizedString( ERROR_CONTACT_MODE_NOT_FILLED, args, _request.getLocale( ) );
if (I18nService.getLocalizedString( CONTACT_MODE_LABEL_I18N + contactMode.getCode( ), _request.getLocale( ) ) != null &&
!I18nService.getLocalizedString( CONTACT_MODE_LABEL_I18N + contactMode.getCode( ), _request.getLocale( ) ).trim().isEmpty()) {
Object [ ] args = {
I18nService.getLocalizedString( CONTACT_MODE_LABEL_I18N + contactMode.getCode( ), _request.getLocale( ) )
};
strError = I18nService.getLocalizedString( ERROR_CONTACT_MODE_NOT_FILLED, args, _request.getLocale( ) );
} else {
Object [ ] args = {contactMode.getCode( )};
strError = I18nService.getLocalizedString( ERROR_CONTACT_MODE_NOT_FILLED, args, _request.getLocale( ) );
}
}
return strError;
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plug-in>
<name>ticketing</name>
<class>fr.paris.lutece.portal.service.plugin.PluginDefaultImplementation</class>
<version>2.0.19</version>
<version>2.0.20-SNAPSHOT</version>
<documentation/>
<installation/>
<changes/>
......
......@@ -25,7 +25,7 @@
</th>
<th width="15%">
${domain_list[0].name}
<@sort jsp_url="jsp/admin/plugins/ticketing/admin/ManageModelResponses.jsp" attribute="domain" />
<@sort jsp_url="jsp/admin/plugins/ticketing/admin/ManageModelResponses.jsp" attribute="domainLabel" />
</th>
<th width="25%">
<form id="filter_form" class="form-inline" method="post" name="manage_modelresponse" action="jsp/admin/plugins/ticketing/admin/ManageModelResponses.jsp">
......
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