OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 150 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 150 Rev 181
Line 138... Line 138...
138
        synchronized (this) {
138
        synchronized (this) {
139
            if (this.usersAndWeeklyMinutes != null) {
139
            if (this.usersAndWeeklyMinutes != null) {
140
                return this.usersAndWeeklyMinutes;
140
                return this.usersAndWeeklyMinutes;
141
            }
141
            }
142
        }
142
        }
143
        final Map<User, Integer> uInfo = new LinkedHashMap<User, Integer>();
143
        final Map<User, Integer> uInfo = new LinkedHashMap<>();
144
        final SQLRowValues v = new SQLRowValues(this.salarieElem.getTable());
144
        final SQLRowValues v = new SQLRowValues(this.salarieElem.getTable());
145
        v.putNulls("NOM", "PRENOM");
145
        v.putNulls("NOM", "PRENOM");
146
        v.putRowValues("ID_INFOS_SALARIE_PAYE").putNulls("DUREE_HEBDO");
146
        v.putRowValues("ID_INFOS_SALARIE_PAYE").putNulls("DUREE_HEBDO");
147
        final List<SQLRowValues> rows = SQLRowValuesListFetcher.create(v).fetch();
147
        final List<SQLRowValues> rows = SQLRowValuesListFetcher.create(v).fetch();
148
        final List<User> users = new ArrayList<>(this.userMngr.getAllActiveUsers());
148
        final List<User> users = new ArrayList<>(this.userMngr.getAllActiveUsers());
Line 150... Line 150...
150
        Collections.sort(users, new UserComparator());
150
        Collections.sort(users, new UserComparator());
151
        final int size = users.size();
151
        final int size = users.size();
152
        for (int i = 0; i < size; i++) {
152
        for (int i = 0; i < size; i++) {
153
            final User u = users.get(i);
153
            final User u = users.get(i);
154
            final String name = u.getName().trim();
154
            final String name = u.getName().trim();
155
            final String firstName = u.getFirstName();
155
            final String firstName = u.getFirstName().trim();
156
            Integer minutes = null;
156
            Integer minutes = null;
157
            for (SQLRowValues row : rows) {
157
            for (SQLRowValues row : rows) {
-
 
158
                // Matching Utilisateur <-> Salarié
-
 
159
                // Nom et prénom identique
-
 
160
                final String sName = row.getString("NOM").trim();
-
 
161
                final String sFirstName = row.getString("PRENOM").trim();
158
                if (row.getString("NOM").trim().equalsIgnoreCase(name) && row.getString("PRENOM").trim().equalsIgnoreCase(firstName)) {
162
                if (sName.equalsIgnoreCase(name) && sFirstName.equalsIgnoreCase(firstName)) {
159
                    minutes = (int) row.getForeign("ID_INFOS_SALARIE_PAYE").getFloat("DUREE_HEBDO") * 60;
163
                    minutes = (int) row.getForeign("ID_INFOS_SALARIE_PAYE").getFloat("DUREE_HEBDO") * 60;
160
                    break;
164
                    break;
161
                }
165
                }
162
            }
166
            }
163
            uInfo.put(u, minutes);
167
            uInfo.put(u, minutes);
Line 167... Line 171...
167
        }
171
        }
168
        return uInfo;
172
        return uInfo;
169
    }
173
    }
170
 
174
 
171
    private void setDurations(final List<List<JCalendarItem>> viewItems) {
175
    private void setDurations(final List<List<JCalendarItem>> viewItems) {
172
        final Map<Integer, Long> all = OperationCalendarPanel.getDurations(viewItems, null);
176
        final Map<Integer, Long> all = OperationCalendarPanel.getDurations(viewItems, null, ModuleOperation.FREE_TIME_FLAG);
173
        final Map<Integer, Long> locked = OperationCalendarPanel.getDurations(viewItems, Flag.getFlag("locked"));
177
        final Map<Integer, Long> locked = OperationCalendarPanel.getDurations(viewItems, Flag.getFlag("locked"), ModuleOperation.FREE_TIME_FLAG);
174
        synchronized (this) {
178
        synchronized (this) {
175
            this.allDurations = Collections.unmodifiableMap(all);
179
            this.allDurations = Collections.unmodifiableMap(all);
176
            this.lockedDurations = Collections.unmodifiableMap(locked);
180
            this.lockedDurations = Collections.unmodifiableMap(locked);
177
        }
181
        }
178
    }
182
    }
Line 215... Line 219...
215
            final String suffix;
219
            final String suffix;
216
            if (weeklyMinutes == null) {
220
            if (weeklyMinutes == null) {
217
                // not a SALARIE
221
                // not a SALARIE
218
                suffix = "";
222
                suffix = "";
219
            } else {
223
            } else {
220
                // Durée planifiée
-
 
221
                final int d = getDuration(all, u.getId());
-
 
222
                // Durée verrouillée
224
                // Durée verrouillée
223
                final int d2 = getDuration(locked, u.getId());
225
                final int d2 = getDuration(locked, u.getId());
-
 
226
                // Durée planifiée
-
 
227
                final int d = getDuration(all, u.getId());
224
                suffix = " [" + formatDuration(d2) + " / " + formatDuration(d) + " / " + formatDuration(weeklyMinutes) + "]";
228
                suffix = " [" + formatDuration(d2) + " / " + formatDuration(d) + " / " + formatDuration(weeklyMinutes) + "]";
225
            }
229
            }
226
            res.add(createItem(u, (u.getFullName() + suffix).trim()));
230
            res.add(createItem(u, (u.getFullName() + suffix).trim()));
227
        }
231
        }
228
        return res;
232
        return res;