OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 156 Rev 182
Line 1... Line 1...
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
9
 * language governing permissions and limitations under the License.
Line 64... Line 64...
64
import org.openconcerto.sql.users.rights.UserRightsManager;
64
import org.openconcerto.sql.users.rights.UserRightsManager;
65
import org.openconcerto.sql.view.EditFrame;
65
import org.openconcerto.sql.view.EditFrame;
66
import org.openconcerto.sql.view.EditPanel;
66
import org.openconcerto.sql.view.EditPanel;
67
import org.openconcerto.sql.view.EditPanel.EditMode;
67
import org.openconcerto.sql.view.EditPanel.EditMode;
68
import org.openconcerto.sql.view.EditPanelListener;
68
import org.openconcerto.sql.view.EditPanelListener;
-
 
69
import org.openconcerto.sql.view.IListeFilter;
69
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
70
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
70
import org.openconcerto.sql.view.list.IListe;
71
import org.openconcerto.sql.view.list.IListe;
71
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
72
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
72
import org.openconcerto.sql.view.list.RowAction;
73
import org.openconcerto.sql.view.list.RowAction;
73
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
74
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
74
import org.openconcerto.sql.view.list.SQLTableModelSource;
75
import org.openconcerto.sql.view.list.SQLTableModelSource;
-
 
76
import org.openconcerto.sql.view.list.action.ListEvent;
75
import org.openconcerto.ui.DefaultGridBagConstraints;
77
import org.openconcerto.ui.DefaultGridBagConstraints;
76
import org.openconcerto.ui.FrameUtil;
78
import org.openconcerto.ui.FrameUtil;
77
import org.openconcerto.ui.table.PercentTableCellRenderer;
79
import org.openconcerto.ui.table.PercentTableCellRenderer;
78
import org.openconcerto.utils.CollectionUtils;
80
import org.openconcerto.utils.CollectionUtils;
79
import org.openconcerto.utils.DecimalUtils;
81
import org.openconcerto.utils.DecimalUtils;
Line 199... Line 201...
199
 
201
 
200
                ((SaisieVenteFactureSQLComponent) editFrame.getSQLComponent()).loadFactureExistante(IListe.get(e).getSelectedId());
202
                ((SaisieVenteFactureSQLComponent) editFrame.getSQLComponent()).loadFactureExistante(IListe.get(e).getSelectedId());
201
                editFrame.setVisible(true);
203
                editFrame.setVisible(true);
202
            }
204
            }
203
        }, true, "sales.invoice.clone") {
205
        }, true, "sales.invoice.clone") {
204
            public boolean enabledFor(IListeEvent evt) {
206
            public boolean enabledFor(List<SQLRowValues> l) {
205
                List<? extends SQLRowAccessor> l = evt.getSelectedRows();
-
 
206
                if (l != null && l.size() == 1) {
207
                if (l.size() == 1) {
207
                    SQLRowAccessor r = l.get(0);
208
                    SQLRowAccessor r = l.get(0);
208
                    return !r.getBoolean("PARTIAL") && !r.getBoolean("SOLDE");
209
                    return !r.getBoolean("PARTIAL") && !r.getBoolean("SOLDE");
209
                }
210
                }
210
                return false;
211
                return false;
211
            }
212
            }
Line 237... Line 238...
237
            }
238
            }
238
        }, false, "sales.invoice.create.supplier.order");
239
        }, false, "sales.invoice.create.supplier.order");
239
        actionCommande.setPredicate(IListeEvent.getSingleSelectionPredicate());
240
        actionCommande.setPredicate(IListeEvent.getSingleSelectionPredicate());
240
        getRowActions().add(actionCommande);
241
        getRowActions().add(actionCommande);
241
 
242
 
242
        RowAction actionCancelAvoir = new PredicateRowAction(new AbstractAction() {
243
        PredicateRowAction actionCancelAvoir = new PredicateRowAction(new AbstractAction() {
243
            public void actionPerformed(ActionEvent e) {
244
            public void actionPerformed(ActionEvent e) {
244
                cancelAvoir(IListe.get(e).getSelectedRow());
245
                cancelAvoir(IListe.get(e).getSelectedRow());
245
            }
246
            }
246
        }, false, "sales.invoice.cancel.credit") {
247
        }, false, "sales.invoice.cancel.credit") {
247
            @Override
248
            @Override
248
            public boolean enabledFor(IListeEvent evt) {
249
            public boolean enabledFor(List<SQLRowValues> rows) {
249
                final SQLRowAccessor selectedRow = evt.getSelectedRow().asRow();
250
                if (rows.size() != 1) {
-
 
251
                    return false;
-
 
252
                }
250
                final List<SQLRowValues> rows = evt.getSelectedRows();
253
                final SQLRow selectedRow = rows.get(0).asRow();
251
                return rows != null && rows.size() == 1 && selectedRow != null && !selectedRow.isForeignEmpty("ID_AVOIR_CLIENT");
254
                return !selectedRow.isForeignEmpty("ID_AVOIR_CLIENT");
252
            }
255
            }
253
        };
256
        };
-
 
257
        actionCancelAvoir.setPredicate(IListeEvent.getSingleSelectionPredicate());
254
        getRowActions().add(actionCancelAvoir);
258
        getRowActions().add(actionCancelAvoir);
255
 
259
 
256
        MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(VenteFactureXmlSheet.class);
260
        MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(this, VenteFactureXmlSheet.class);
257
        getRowActions().addAll(mouseSheetXmlListeListener.getRowActions());
261
        getRowActions().addAll(mouseSheetXmlListeListener.getRowActions());
258
        // this.frame.getPanel().getListe().addRowActions(mouseListener.getRowActions());
262
        // this.frame.getPanel().getListe().addRowActions(mouseListener.getRowActions());
259
 
263
 
260
    }
264
    }
261
 
265