OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 151 Rev 156
Line 16... Line 16...
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
17
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
17
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
18
import org.openconcerto.erp.core.common.ui.DeviseField;
18
import org.openconcerto.erp.core.common.ui.DeviseField;
19
import org.openconcerto.erp.core.common.ui.PanelFrame;
19
import org.openconcerto.erp.core.common.ui.PanelFrame;
20
import org.openconcerto.erp.core.edm.AttachmentAction;
20
import org.openconcerto.erp.core.edm.AttachmentAction;
-
 
21
import org.openconcerto.erp.core.finance.accounting.ui.AssociationAnalytiquePanel;
21
import org.openconcerto.erp.core.finance.accounting.ui.ConsultationCompteFrame;
22
import org.openconcerto.erp.core.finance.accounting.ui.ConsultationCompteFrame;
22
import org.openconcerto.erp.core.finance.accounting.ui.LettrageRenderer;
23
import org.openconcerto.erp.core.finance.accounting.ui.LettrageRenderer;
23
import org.openconcerto.erp.core.finance.accounting.ui.ListEcritureRenderer;
24
import org.openconcerto.erp.core.finance.accounting.ui.ListEcritureRenderer;
24
import org.openconcerto.erp.core.finance.accounting.ui.ListeDesEcrituresPanel;
25
import org.openconcerto.erp.core.finance.accounting.ui.ListeDesEcrituresPanel;
25
import org.openconcerto.erp.core.finance.accounting.ui.PointageRenderer;
26
import org.openconcerto.erp.core.finance.accounting.ui.PointageRenderer;
Line 44... Line 45...
44
import org.openconcerto.sql.users.UserManager;
45
import org.openconcerto.sql.users.UserManager;
45
import org.openconcerto.sql.utils.SQLUtils;
46
import org.openconcerto.sql.utils.SQLUtils;
46
import org.openconcerto.sql.utils.SQLUtils.SQLFactory;
47
import org.openconcerto.sql.utils.SQLUtils.SQLFactory;
47
import org.openconcerto.sql.view.EditFrame;
48
import org.openconcerto.sql.view.EditFrame;
48
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
49
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
-
 
50
import org.openconcerto.sql.view.list.IListe;
49
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
51
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
50
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
52
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
51
import org.openconcerto.sql.view.list.SQLTableModelColumn;
53
import org.openconcerto.sql.view.list.SQLTableModelColumn;
52
import org.openconcerto.sql.view.list.SQLTableModelSource;
54
import org.openconcerto.sql.view.list.SQLTableModelSource;
53
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
55
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
Line 89... Line 91...
89
    public EcritureSQLElement() {
91
    public EcritureSQLElement() {
90
        super("ECRITURE", "une écriture", "écritures");
92
        super("ECRITURE", "une écriture", "écritures");
91
        PredicateRowAction actionAttachment = new PredicateRowAction(new AttachmentAction("ID_MOUVEMENT").getAction(), true);
93
        PredicateRowAction actionAttachment = new PredicateRowAction(new AttachmentAction("ID_MOUVEMENT").getAction(), true);
92
        actionAttachment.setPredicate(IListeEvent.getSingleSelectionPredicate());
94
        actionAttachment.setPredicate(IListeEvent.getSingleSelectionPredicate());
93
        getRowActions().add(actionAttachment);
95
        getRowActions().add(actionAttachment);
-
 
96
 
-
 
97
        PredicateRowAction consult = new PredicateRowAction(new AbstractAction("Consultation du compte") {
-
 
98
            public void actionPerformed(ActionEvent event) {
-
 
99
                SQLRowAccessor row = IListe.get(event).getSelectedRow();
-
 
100
                consultationCompte(ComptePCESQLElement.getRow(row.getString("COMPTE_NUMERO"), row.getString("COMPTE_NOM")));
-
 
101
            }
-
 
102
        }, false);
-
 
103
        consult.setPredicate(IListeEvent.getSingleSelectionPredicate());
-
 
104
        getRowActions().add(consult);
-
 
105
 
-
 
106
        PredicateRowAction contre = new PredicateRowAction(new AbstractAction("Contrepassation") {
-
 
107
            public void actionPerformed(ActionEvent event) {
-
 
108
                EcritureSQLElement.contrePassationPiece(IListe.get(event).getSelectedId());
-
 
109
            }
-
 
110
        }, false);
-
 
111
        contre.setPredicate(IListeEvent.getSingleSelectionPredicate());
-
 
112
        getRowActions().add(contre);
-
 
113
        // menuDroit.add(new AbstractAction("Valider le mouvement") {
-
 
114
        // public void actionPerformed(ActionEvent event) {
-
 
115
        // if (JOptionPane.showConfirmDialog(null, "Etes vous sûr de vouloir valider le
-
 
116
        // mouvement?") == JOptionPane.YES_OPTION) {
-
 
117
        // EcritureSQLElement.validationEcritures(frame.getPanel().getListe().getSelectedRow().getInt("ID_MOUVEMENT"));
-
 
118
        // }
-
 
119
        // }
-
 
120
        // });
-
 
121
 
-
 
122
        PredicateRowAction clone = new PredicateRowAction(new AbstractAction("Dupliquer") {
-
 
123
            public void actionPerformed(ActionEvent event) {
-
 
124
                EcritureSQLElement.dupliquer(IListe.get(event).fetchSelectedRow());
-
 
125
            }
-
 
126
        }, false);
-
 
127
        clone.setPredicate(IListeEvent.getSingleSelectionPredicate());
-
 
128
        getRowActions().add(clone);
-
 
129
 
-
 
130
        PredicateRowAction an = new PredicateRowAction(new AbstractAction("Gérer l'analytique") {
-
 
131
            public void actionPerformed(ActionEvent event) {
-
 
132
                PanelFrame frameAssoc = new PanelFrame(new AssociationAnalytiquePanel(IListe.get(event).getSelectedRow().asRow()), "Association analytique");
-
 
133
                frameAssoc.setVisible(true);
-
 
134
            }
-
 
135
        }, false);
-
 
136
        an.setPredicate(IListeEvent.getSingleSelectionPredicate());
-
 
137
        getRowActions().add(an);
-
 
138
 
-
 
139
        PredicateRowAction show = new PredicateRowAction(new AbstractAction("Voir la source") {
-
 
140
            public void actionPerformed(ActionEvent event) {
-
 
141
 
-
 
142
                SQLRow row = IListe.get(event).fetchSelectedRow();
-
 
143
 
-
 
144
                MouvementSQLElement.showSource(row.getInt("ID_MOUVEMENT"));
-
 
145
            }
-
 
146
        }, false);
-
 
147
        show.setPredicate(IListeEvent.getSingleSelectionPredicate());
-
 
148
        getRowActions().add(show);
94
    }
149
    }
95
 
150
 
96
    @Override
151
    @Override
97
    protected String getParentFFName() {
152
    protected String getParentFFName() {
98
        return "ID_MOUVEMENT";
153
        return "ID_MOUVEMENT";
Line 675... Line 730...
675
                    ExceptionHandler.handle("Une erreur est survenue lors de la suppression des écritures.", e);
730
                    ExceptionHandler.handle("Une erreur est survenue lors de la suppression des écritures.", e);
676
                }
731
                }
677
            }
732
            }
678
 
733
 
679
        } else {
734
        } else {
680
            ExceptionHandler.handle("Impossible de supprimer le mouvement n°" + rowMvt.getInt("NUMERO") + " car il est validé.");
735
            JOptionPane.showMessageDialog(null, "Impossible de supprimer le mouvement n°" + rowMvt.getInt("NUMERO") + " car il est validé.");
681
        }
736
        }
682
    }
737
    }
683
 
738
 
684
    @Override
739
    @Override
685
    protected void archive(TreesOfSQLRows trees, boolean cutLinks) throws SQLException {
740
    protected void archive(TreesOfSQLRows trees, boolean cutLinks) throws SQLException {
Line 758... Line 813...
758
        frameSaisieKm.setVisible(true);
813
        frameSaisieKm.setVisible(true);
759
    }
814
    }
760
 
815
 
761
    @Override
816
    @Override
762
    protected String createCode() {
817
    protected String createCode() {
763
        return createCodeFromPackage() + ".entry.item";
818
        return createCodeOfPackage() + ".entry.item";
764
    }
819
    }
765
 
820
 
766
    public static void dupliquer(SQLRow selectedRow) {
821
    public static void dupliquer(SQLRow selectedRow) {
767
 
822
 
768
        final SQLRow foreignMvt = selectedRow.getForeign("ID_MOUVEMENT");
823
        final SQLRow foreignMvt = selectedRow.getForeign("ID_MOUVEMENT");