OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 140 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 140 Rev 147
Line 27... Line 27...
27
import org.openconcerto.sql.model.SQLTable;
27
import org.openconcerto.sql.model.SQLTable;
28
import org.openconcerto.sql.model.Where;
28
import org.openconcerto.sql.model.Where;
29
import org.openconcerto.sql.model.graph.Path;
29
import org.openconcerto.sql.model.graph.Path;
30
import org.openconcerto.sql.users.User;
30
import org.openconcerto.sql.users.User;
31
import org.openconcerto.sql.users.UserManager;
31
import org.openconcerto.sql.users.UserManager;
-
 
32
import org.openconcerto.sql.users.rights.UserRights;
-
 
33
import org.openconcerto.sql.users.rights.UserRightsManager;
32
import org.openconcerto.sql.view.EditFrame;
34
import org.openconcerto.sql.view.EditFrame;
33
import org.openconcerto.sql.view.EditPanel.EditMode;
35
import org.openconcerto.sql.view.EditPanel.EditMode;
34
import org.openconcerto.sql.view.EditPanelListener;
36
import org.openconcerto.sql.view.EditPanelListener;
35
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
37
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
36
import org.openconcerto.sql.view.list.IListe;
38
import org.openconcerto.sql.view.list.IListe;
Line 97... Line 99...
97
    @Override
99
    @Override
98
    protected void _initTableSource(SQLTableModelSource source) {
100
    protected void _initTableSource(SQLTableModelSource source) {
99
 
101
 
100
        super._initTableSource(source);
102
        super._initTableSource(source);
101
 
103
 
102
        User user = UserManager.getInstance().getCurrentUser();
-
 
103
        if (!user.getRights().haveRight(LeadSQLElement.CODE_NOT_RESTRICT)) {
104
        if (!UserRightsManager.getCurrentUserRights().haveRight(LeadSQLElement.CODE_NOT_RESTRICT)) {
104
            SQLRow row = Configuration.getInstance().getRoot().findTable("USER_COMMON").getRow(UserManager.getInstance().getCurrentUser().getId());
105
            final SQLRow row = Configuration.getInstance().getRoot().findTable("USER_COMMON").getRow(UserManager.getInstance().getCurrentUser().getId());
105
            List<SQLRow> rows = row.getReferentRows(Configuration.getInstance().getRoot().findTable("COMMERCIAL").getField("ID_USER_COMMON"));
106
            final List<SQLRow> rows = row.getReferentRows(Configuration.getInstance().getRoot().findTable("COMMERCIAL").getField("ID_USER_COMMON"));
106
            final List<Integer> listComm = new ArrayList<Integer>();
107
            final List<Integer> listComm = new ArrayList<Integer>();
107
            for (SQLRow sqlRow : rows) {
108
            for (SQLRow sqlRow : rows) {
108
                listComm.add(sqlRow.getID());
109
                listComm.add(sqlRow.getID());
109
            }
110
            }
110
            if (listComm != null && listComm.size() > 0) {
111
            if (!listComm.isEmpty()) {
111
                source.getReq().setSelectTransf(new ITransformer<SQLSelect, SQLSelect>() {
112
                source.getReq().setSelectTransf(new ITransformer<SQLSelect, SQLSelect>() {
112
 
113
 
113
                    @Override
114
                    @Override
114
                    public SQLSelect transformChecked(SQLSelect input) {
115
                    public SQLSelect transformChecked(SQLSelect input) {
115
 
-
 
116
                        SQLField field = input.getTable(Module.TABLE_LEAD).getField("ID_COMMERCIAL");
116
                        final SQLField field = input.getTable(Module.TABLE_LEAD).getField("ID_COMMERCIAL");
117
                        Where w = new Where(field, listComm);
117
                        Where w = new Where(field, listComm);
118
                        w = w.or(new Where(field, "IS", (Object) null));
118
                        w = w.or(new Where(field, "IS", (Object) null));
119
                        w = w.or(new Where(field, "=", getTable().getTable("COMMERCIAL").getUndefinedID()));
119
                        w = w.or(new Where(field, "=", getTable().getTable("COMMERCIAL").getUndefinedID()));
120
                        input.setWhere(w);
120
                        input.setWhere(w);
121
                        return input;
121
                        return input;
Line 126... Line 126...
126
 
126
 
127
        BaseSQLTableModelColumn adresse = new BaseSQLTableModelColumn("Adresse", String.class) {
127
        BaseSQLTableModelColumn adresse = new BaseSQLTableModelColumn("Adresse", String.class) {
128
 
128
 
129
            @Override
129
            @Override
130
            protected Object show_(SQLRowAccessor r) {
130
            protected Object show_(SQLRowAccessor r) {
131
                SQLRowAccessor rAdr = r.getForeign("ID_ADRESSE");
131
                final SQLRowAccessor rAdr = r.getForeign("ID_ADRESSE");
132
                if (rAdr != null && !rAdr.isUndefined()) {
132
                if (rAdr != null && !rAdr.isUndefined()) {
133
 
-
 
134
                    return rAdr.getString("RUE");
133
                    return rAdr.getString("RUE");
135
                }
134
                }
136
                return "";
135
                return "";
137
            }
136
            }
138
 
137
 
Line 263... Line 262...
263
                            rowVals.put("ID_CLIENT", id);
262
                            rowVals.put("ID_CLIENT", id);
264
                            rowVals.put("STATUS", "Acquis");
263
                            rowVals.put("STATUS", "Acquis");
265
                            try {
264
                            try {
266
                                rowVals.commit();
265
                                rowVals.commit();
267
                            } catch (SQLException exn) {
266
                            } catch (SQLException exn) {
268
                                // TODO Bloc catch auto-généré
-
 
269
                                exn.printStackTrace();
267
                                exn.printStackTrace();
270
                            }
268
                            }
271
                        }
269
                        }
272
 
270
 
273
                        @Override
271
                        @Override