OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 151 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 151 Rev 177
Line 12... Line 12...
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.sql.request;
14
 package org.openconcerto.sql.request;
15
 
15
 
16
import org.openconcerto.sql.FieldExpander;
16
import org.openconcerto.sql.FieldExpander;
17
import org.openconcerto.sql.TM;
-
 
18
import org.openconcerto.sql.model.FieldRef;
17
import org.openconcerto.sql.model.FieldRef;
19
import org.openconcerto.sql.model.IFieldPath;
18
import org.openconcerto.sql.model.IFieldPath;
20
import org.openconcerto.sql.model.OrderComparator;
19
import org.openconcerto.sql.model.OrderComparator;
21
import org.openconcerto.sql.model.SQLField;
20
import org.openconcerto.sql.model.SQLField;
22
import org.openconcerto.sql.model.SQLRowAccessor;
21
import org.openconcerto.sql.model.SQLRowAccessor;
Line 612... Line 611...
612
        final SQLType type = selF.getField().getType();
611
        final SQLType type = selF.getField().getType();
613
        final SQLSyntax syntax = SQLSyntax.get(selF.getField());
612
        final SQLSyntax syntax = SQLSyntax.get(selF.getField());
614
        if (type.getJavaType() == String.class) {
613
        if (type.getJavaType() == String.class) {
615
            return Collections.singletonList(selF.getFieldRef());
614
            return Collections.singletonList(selF.getFieldRef());
616
        } else if (type.getJavaType() == Boolean.class) {
615
        } else if (type.getJavaType() == Boolean.class) {
-
 
616
            final org.openconcerto.utils.i18n.TM utilsTM = org.openconcerto.utils.i18n.TM.getInstance(l);
-
 
617
            return Collections.singletonList(
617
            return Collections.singletonList("case when " + selF.getFieldRef() + " then " + syntax.quoteString(TM.tr("true_key")) + " else " + syntax.quoteString(TM.tr("false_key")) + " end");
618
                    "case when " + selF.getFieldRef() + " then " + syntax.quoteString(utilsTM.translate("true_key")) + " else " + syntax.quoteString(utilsTM.translate("false_key")) + " end");
618
        } else if (Timestamp.class.isAssignableFrom(type.getJavaType())) {
619
        } else if (Timestamp.class.isAssignableFrom(type.getJavaType())) {
619
            final String shortFmt = formatTime(selF, DateProp.SHORT_DATETIME_SKELETON, l, syntax);
620
            final String shortFmt = formatTime(selF, DateProp.SHORT_DATETIME_SKELETON, l, syntax);
620
            final String longFmt = formatTime(selF, DateProp.LONG_DATETIME_SKELETON, l, syntax);
621
            final String longFmt = formatTime(selF, DateProp.LONG_DATETIME_SKELETON, l, syntax);
621
            return Arrays.asList(shortFmt, longFmt);
622
            return Arrays.asList(shortFmt, longFmt);
622
        } else if (Time.class.isAssignableFrom(type.getJavaType())) {
623
        } else if (Time.class.isAssignableFrom(type.getJavaType())) {