OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 144 | Rev 174 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 144 Rev 156
Line 82... Line 82...
82
            // if
82
            // if
83
            // (this.row.getTable().getName().equalsIgnoreCase(this.elt.getAttributeValue("table")))
83
            // (this.row.getTable().getName().equalsIgnoreCase(this.elt.getAttributeValue("table")))
84
            // {
84
            // {
85
            String field = this.elt.getAttributeValue("name");
85
            String field = this.elt.getAttributeValue("name");
86
 
86
 
-
 
87
            if (field != null && field.trim().length() > 0 && !this.row.getTable().contains(field)) {
-
 
88
                throw new InvalidTemplateException("Le champ " + field + " n'existe pas dans la table " + this.row.getTable().getName());
-
 
89
            }
87
            final SQLField sqlField = (field == null || field.trim().length() == 0) ? null : this.row.getTable().getField(field);
90
            final SQLField sqlField = (field == null || field.trim().length() == 0) ? null : this.row.getTable().getField(field);
88
            boolean isForeignField = (sqlField == null) ? false : this.row.getTable().getForeignKeys().contains(sqlField);
91
            boolean isForeignField = (sqlField == null) ? false : this.row.getTable().getForeignKeys().contains(sqlField);
89
 
92
 
90
            // le champ est une clef etrangere, on recupere la valeur du sous composant
93
            // le champ est une clef etrangere, on recupere la valeur du sous composant
91
            if (isForeignField && this.elt.getChild("field") != null) {
94
            if (isForeignField && this.elt.getChild("field") != null) {
Line 135... Line 138...
135
                // sinon on recupere directement la valeur
138
                // sinon on recupere directement la valeur
136
 
139
 
137
                String typeComp = this.elt.getAttributeValue("type");
140
                String typeComp = this.elt.getAttributeValue("type");
138
                if (this.op != null && this.op.trim().length() > 0 && !(typeComp != null && typeComp.trim().length() > 0 && typeComp.toLowerCase().startsWith("deviselettre"))) {
141
                if (this.op != null && this.op.trim().length() > 0 && !(typeComp != null && typeComp.trim().length() > 0 && typeComp.toLowerCase().startsWith("deviselettre"))) {
139
                    String field2 = this.elt.getAttributeValue("name2");
142
                    String field2 = this.elt.getAttributeValue("name2");
-
 
143
                    if (!this.row.getTable().contains(field)) {
-
 
144
                        throw new InvalidTemplateException("Le champ " + field + " n'existe pas dans la table " + this.row.getTable().getName());
-
 
145
                    }
140
                    Number o = (Number) this.row.getObject(field);
146
                    Number o = (Number) this.row.getObject(field);
141
 
147
 
142
                    Number o2;
148
                    Number o2;
143
                    if (field2 != null && field2.trim().length() > 0) {
149
                    if (field2 != null && field2.trim().length() > 0) {
-
 
150
                        if (!this.row.getTable().contains(field2)) {
-
 
151
                            throw new InvalidTemplateException("Le champ " + field2 + " n'existe pas dans la table " + this.row.getTable().getName());
-
 
152
                        }
144
                        o2 = (Number) this.row.getObject(field2);
153
                        o2 = (Number) this.row.getObject(field2);
145
                    } else {
154
                    } else {
146
                        o2 = Double.parseDouble(this.elt.getAttributeValue("number"));
155
                        o2 = Double.parseDouble(this.elt.getAttributeValue("number"));
147
                    }
156
                    }
148
 
157
 
Line 221... Line 230...
221
                        if (this.elt.getAttributeValue("upperCase") != null) {
230
                        if (this.elt.getAttributeValue("upperCase") != null) {
222
                            o = o.toString().toUpperCase();
231
                            o = o.toString().toUpperCase();
223
                        }
232
                        }
224
                        stringValue = o.toString();
233
                        stringValue = o.toString();
225
                    } else {
234
                    } else {
-
 
235
                        if (!this.row.getTable().contains(field)) {
-
 
236
                            throw new InvalidTemplateException("Le champ " + field + " n'existe pas dans la table " + this.row.getTable().getName());
-
 
237
                        }
226
                        Object o2 = this.row.getObject(field);
238
                        Object o2 = this.row.getObject(field);
227
 
239
 
228
                        if (o2 != null && scale != null && scale.trim().length() > 0) {
240
                        if (o2 != null && scale != null && scale.trim().length() > 0) {
229
 
241
 
230
                            o2 = ((BigDecimal) o2).setScale(Integer.valueOf(scale), RoundingMode.HALF_UP);
242
                            o2 = ((BigDecimal) o2).setScale(Integer.valueOf(scale), RoundingMode.HALF_UP);