OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 147 Rev 181
Line 70... Line 70...
70
 
70
 
71
            @Override
71
            @Override
72
            public void propertyChange(PropertyChangeEvent evt) {
72
            public void propertyChange(PropertyChangeEvent evt) {
73
                final List<SQLRowValues> selectedRows = list.getSelectedRows();
73
                final List<SQLRowValues> selectedRows = list.getSelectedRows();
74
                final IListPanel listePanel = listHistoriquePanel.getListePanel(0);
74
                final IListPanel listePanel = listHistoriquePanel.getListePanel(0);
-
 
75
                // Activation/Desactivation des boutons Mofifier/Supprimer
75
                if (selectedRows != null && !selectedRows.isEmpty()) {
76
                if (selectedRows != null && !selectedRows.isEmpty()) {
76
                    final Set<Long> idsCalendarItemGroup = new HashSet<>();
77
                    final Set<Long> idsCalendarItemGroup = new HashSet<>();
77
                    for (SQLRowValues sqlRowValues : selectedRows) {
78
                    for (SQLRowValues sqlRowValues : selectedRows) {
78
                        idsCalendarItemGroup.add(Long.valueOf(sqlRowValues.getForeign("ID_CALENDAR_ITEM_GROUP").getID()));
79
                        idsCalendarItemGroup.add(Long.valueOf(sqlRowValues.getForeign("ID_CALENDAR_ITEM_GROUP").getID()));
79
                    }
80
                    }
Line 140... Line 141...
140
                        cal.set(Calendar.YEAR, selectedYear);
141
                        cal.set(Calendar.YEAR, selectedYear);
141
                        Date dStart = cal.getTime();
142
                        Date dStart = cal.getTime();
142
                        cal.set(Calendar.YEAR, selectedYear + 1);
143
                        cal.set(Calendar.YEAR, selectedYear + 1);
143
                        Date dEnd = cal.getTime();
144
                        Date dEnd = cal.getTime();
144
 
145
 
145
                        final SQLTable groupT = comboRequest.getPrimaryTable().getTable("CALENDAR_ITEM_GROUP");
146
                        final SQLTable itemGroupTable = comboRequest.getPrimaryTable().getTable("CALENDAR_ITEM_GROUP");
146
                        final SQLTable calItemT = comboRequest.getPrimaryTable().getTable("CALENDAR_ITEM");
147
                        final SQLTable itemTable = comboRequest.getPrimaryTable().getTable("CALENDAR_ITEM");
-
 
148
                        final SQLTable operationTable = comboRequest.getPrimaryTable().getTable("OPERATION");
147
                        final List<?> dateGroupIDs;
149
                        final List<?> dateGroupIDs;
148
                        {
150
                        {
149
                            final SQLSelect copy = new SQLSelect(input);
151
                            final SQLSelect copy = new SQLSelect(input);
150
                            copy.clearSelect();
152
                            copy.clearSelect();
151
                            copy.addSelect(copy.getAlias(groupT.getKey()));
153
                            copy.addSelect(copy.getAlias(itemGroupTable.getKey()));
152
                            copy.setWhere(copy.getAlias(comboRequest.getPrimaryTable().getTable("OPERATION").getField("ID_SITE")), "=", panel.getSelectedRow().getID());
154
                            copy.setWhere(copy.getAlias(operationTable.getField("ID_SITE")), "=", panel.getSelectedRow().getID());
153
                            final List<?> allGroupIDs = calItemT.getDBSystemRoot().getDataSource().executeCol(copy.asString());
155
                            final List<?> allGroupIDs = itemTable.getDBSystemRoot().getDataSource().executeCol(copy.asString());
154
 
-
 
155
                            final SQLSelect selIDGroup = new SQLSelect();
156
                            final SQLSelect selIDGroup = new SQLSelect();
156
                            selIDGroup.addSelect(calItemT.getField("ID_CALENDAR_ITEM_GROUP"));
157
                            selIDGroup.addSelect(itemTable.getField("ID_CALENDAR_ITEM_GROUP"));
157
                            final Where where = new Where(calItemT.getField("START"), dStart, true, dEnd, true);
158
                            final Where where = new Where(itemTable.getField("START"), dStart, true, dEnd, true);
158
                            selIDGroup.setWhere(where).andWhere(new Where(calItemT.getField("ID_CALENDAR_ITEM_GROUP"), allGroupIDs));
159
                            selIDGroup.setWhere(where).andWhere(new Where(itemTable.getField("ID_CALENDAR_ITEM_GROUP"), allGroupIDs));
159
                            dateGroupIDs = calItemT.getDBSystemRoot().getDataSource().executeCol(selIDGroup.asString());
160
                            dateGroupIDs = itemTable.getDBSystemRoot().getDataSource().executeCol(selIDGroup.asString());
160
                        }
161
                        }
161
 
162
 
162
                        input.setWhere(new Where(input.getAlias(groupT.getKey()), dateGroupIDs));
163
                        Where w = new Where(input.getAlias(itemGroupTable.getKey()), dateGroupIDs);
-
 
164
                        input.setWhere(w);
163
                    } catch (Throwable e) {
165
                    } catch (Throwable e) {
164
                        e.printStackTrace();
166
                        e.printStackTrace();
165
                    }
167
                    }
166
                    return input;
168
                    return input;
167
                }
169
                }