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 11... |
Line 11... |
11 |
* When distributing the software, include this License Header Notice in each file.
|
11 |
* When distributing the software, include this License Header Notice in each file.
|
12 |
*/
|
12 |
*/
|
13 |
|
13 |
|
14 |
package org.openconcerto.erp.core.customerrelationship.customer.element;
|
14 |
package org.openconcerto.erp.core.customerrelationship.customer.element;
|
15 |
|
15 |
|
- |
|
16 |
import org.openconcerto.erp.config.ComptaPropsConfiguration;
|
16 |
import org.openconcerto.erp.core.edm.AttachmentAction;
|
17 |
import org.openconcerto.erp.core.edm.AttachmentAction;
|
17 |
import org.openconcerto.erp.core.reports.history.ui.HistoriqueClientFrame;
|
18 |
import org.openconcerto.erp.core.reports.history.ui.HistoriqueClientFrame;
|
- |
|
19 |
import org.openconcerto.erp.core.sales.product.element.ListeTarifClient;
|
18 |
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel;
|
20 |
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel;
|
- |
|
21 |
import org.openconcerto.sql.Configuration;
|
19 |
import org.openconcerto.sql.element.GlobalMapper;
|
22 |
import org.openconcerto.sql.element.GlobalMapper;
|
20 |
import org.openconcerto.sql.element.GroupSQLComponent;
|
23 |
import org.openconcerto.sql.element.GroupSQLComponent;
|
21 |
import org.openconcerto.sql.element.SQLComponent;
|
24 |
import org.openconcerto.sql.element.SQLComponent;
|
22 |
import org.openconcerto.sql.model.SQLRowAccessor;
|
25 |
import org.openconcerto.sql.model.SQLRowAccessor;
|
- |
|
26 |
import org.openconcerto.sql.model.SQLRowValues;
|
23 |
import org.openconcerto.sql.preferences.SQLPreferences;
|
27 |
import org.openconcerto.sql.preferences.SQLPreferences;
|
- |
|
28 |
import org.openconcerto.sql.request.ListSQLRequest;
|
24 |
import org.openconcerto.sql.request.SQLFieldTranslator;
|
29 |
import org.openconcerto.sql.request.SQLFieldTranslator;
|
25 |
import org.openconcerto.sql.view.list.IListe;
|
30 |
import org.openconcerto.sql.view.list.IListe;
|
26 |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
|
31 |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
|
- |
|
32 |
import org.openconcerto.sql.view.list.RowAction;
|
27 |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
|
33 |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
|
28 |
import org.openconcerto.ui.light.LightUIElement;
|
34 |
import org.openconcerto.ui.light.LightUIElement;
|
29 |
import org.openconcerto.ui.light.LightUILine;
|
35 |
import org.openconcerto.ui.light.LightUILine;
|
30 |
import org.openconcerto.ui.light.LightUIPanel;
|
36 |
import org.openconcerto.ui.light.LightUIPanel;
|
31 |
import org.openconcerto.ui.light.SimpleTextLine;
|
37 |
import org.openconcerto.ui.light.SimpleTextLine;
|
32 |
|
38 |
|
33 |
import java.awt.event.ActionEvent;
|
39 |
import java.awt.event.ActionEvent;
|
- |
|
40 |
import java.util.HashSet;
|
34 |
import java.util.List;
|
41 |
import java.util.List;
|
- |
|
42 |
import java.util.Set;
|
35 |
|
43 |
|
36 |
import javax.swing.AbstractAction;
|
44 |
import javax.swing.AbstractAction;
|
37 |
|
45 |
|
38 |
public class CustomerSQLElement extends ClientNormalSQLElement {
|
46 |
public class CustomerSQLElement extends ClientNormalSQLElement {
|
39 |
|
47 |
|
Line 58... |
Line 66... |
58 |
}
|
66 |
}
|
59 |
}, true);
|
67 |
}, true);
|
60 |
actionHistory.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
68 |
actionHistory.setPredicate(IListeEvent.getSingleSelectionPredicate());
|
61 |
getRowActions().add(actionHistory);
|
69 |
getRowActions().add(actionHistory);
|
62 |
|
70 |
|
- |
|
71 |
RowAction actionTarif = new RowAction(new AbstractAction("Tarifs associés") {
|
- |
|
72 |
|
- |
|
73 |
@Override
|
- |
|
74 |
public void actionPerformed(ActionEvent e) {
|
- |
|
75 |
final ListeTarifClient listeHistoCodeClient = new ListeTarifClient(((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete());
|
- |
|
76 |
int idClient = IListe.get(e).getSelectedRowAccessor().getForeignID("ID_TARIF");
|
- |
|
77 |
listeHistoCodeClient.getHistoriquePanel().selectIDinJList(idClient);
|
- |
|
78 |
listeHistoCodeClient.getFrame().setVisible(true);
|
- |
|
79 |
}
|
- |
|
80 |
|
- |
|
81 |
}, true) {
|
- |
|
82 |
@Override
|
- |
|
83 |
public boolean enabledFor(List<SQLRowValues> selection) {
|
- |
|
84 |
if (selection != null && selection.size() == 1) {
|
- |
|
85 |
return !selection.get(0).isForeignEmpty("ID_TARIF");
|
- |
|
86 |
} else {
|
- |
|
87 |
return false;
|
- |
|
88 |
}
|
- |
|
89 |
}
|
- |
|
90 |
};
|
- |
|
91 |
getRowActions().add(actionTarif);
|
- |
|
92 |
|
- |
|
93 |
}
|
- |
|
94 |
|
- |
|
95 |
protected void _initListRequest(final ListSQLRequest req) {
|
- |
|
96 |
super._initListRequest(req);
|
- |
|
97 |
req.addToGraphToFetch("ID_TARIF");
|
63 |
}
|
98 |
}
|
64 |
|
99 |
|
65 |
@Override
|
100 |
@Override
|
66 |
public SQLComponent createComponent() {
|
101 |
public SQLComponent createComponent() {
|
67 |
final GroupSQLComponent c = new CustomerSQLComponent(this);
|
102 |
final GroupSQLComponent c = new CustomerSQLComponent(this);
|
68 |
c.startTabGroupAfter("customerrelationship.customer.identifier");
|
103 |
c.startTabGroupAfter("customerrelationship.customer.identifier");
|
69 |
return c;
|
104 |
return c;
|
70 |
}
|
105 |
}
|
71 |
|
106 |
|
72 |
@Override
|
107 |
@Override
|
- |
|
108 |
public Set<String> getReadOnlyFields() {
|
- |
|
109 |
Set<String> s = new HashSet<>();
|
- |
|
110 |
return s;
|
- |
|
111 |
}
|
- |
|
112 |
|
- |
|
113 |
@Override
|
73 |
protected List<String> getListFields() {
|
114 |
protected List<String> getListFields() {
|
74 |
final List<String> fields = super.getListFields();
|
115 |
final List<String> fields = super.getListFields();
|
- |
|
116 |
|
75 |
if (getTable().contains("GROUPE")) {
|
117 |
if (getTable().contains("GROUPE")) {
|
76 |
fields.add("GROUPE");
|
118 |
fields.add("GROUPE");
|
77 |
}
|
119 |
}
|
- |
|
120 |
fields.add("ENCOURS_MAX");
|
78 |
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
|
121 |
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
|
79 |
|
122 |
|
80 |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.CATEGORIE_COMPTABLE_SPEC, false)) {
|
123 |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.CATEGORIE_COMPTABLE_SPEC, false)) {
|
81 |
fields.add("ID_CATEGORIE_COMPTABLE");
|
124 |
fields.add("ID_CATEGORIE_COMPTABLE");
|
82 |
}
|
125 |
}
|