OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 142 Rev 151
Line 18... Line 18...
18
import org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent;
18
import org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent;
19
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
19
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
20
import org.openconcerto.erp.core.common.ui.AbstractVenteArticleItemTable;
20
import org.openconcerto.erp.core.common.ui.AbstractVenteArticleItemTable;
21
import org.openconcerto.erp.core.common.ui.DeviseField;
21
import org.openconcerto.erp.core.common.ui.DeviseField;
22
import org.openconcerto.erp.core.common.ui.PanelFrame;
22
import org.openconcerto.erp.core.common.ui.PanelFrame;
-
 
23
import org.openconcerto.erp.core.edm.AttachmentAction;
23
import org.openconcerto.erp.core.finance.accounting.element.EcritureSQLElement;
24
import org.openconcerto.erp.core.finance.accounting.element.EcritureSQLElement;
24
import org.openconcerto.erp.core.sales.account.PartialInvoiceEditGroup;
25
import org.openconcerto.erp.core.sales.account.PartialInvoiceEditGroup;
25
import org.openconcerto.erp.core.sales.account.VenteFactureSituationSQLComponent;
26
import org.openconcerto.erp.core.sales.account.VenteFactureSituationSQLComponent;
26
import org.openconcerto.erp.core.sales.account.VenteFactureSoldeEditGroup;
27
import org.openconcerto.erp.core.sales.account.VenteFactureSoldeEditGroup;
27
import org.openconcerto.erp.core.sales.account.VenteFactureSoldeSQLComponent;
28
import org.openconcerto.erp.core.sales.account.VenteFactureSoldeSQLComponent;
Line 125... Line 126...
125
// informations nécessaires à son établissement ne sont pas connues au moment de son émission (par
126
// informations nécessaires à son établissement ne sont pas connues au moment de son émission (par
126
// exemple, quantité ou prix exact du produit).
127
// exemple, quantité ou prix exact du produit).
127
public class SaisieVenteFactureSQLElement extends ComptaSQLConfElement {
128
public class SaisieVenteFactureSQLElement extends ComptaSQLConfElement {
128
 
129
 
129
    public static final String TABLENAME = "SAISIE_VENTE_FACTURE";
130
    public static final String TABLENAME = "SAISIE_VENTE_FACTURE";
-
 
131
    static public final String MESSAGE_FIELD_NAME = "ID_SDD_MESSAGE";
-
 
132
    static public final String END2END_FIELD_NAME = "SDD_EndToEndId";
130
 
133
 
131
    public SaisieVenteFactureSQLElement() {
134
    public SaisieVenteFactureSQLElement() {
132
        super(TABLENAME, "une facture", "factures");
135
        super(TABLENAME, "une facture", "factures");
133
 
136
 
134
        GlobalMapper.getInstance().map(VenteFactureSituationSQLComponent.ID, new PartialInvoiceEditGroup());
137
        GlobalMapper.getInstance().map(VenteFactureSituationSQLComponent.ID, new PartialInvoiceEditGroup());
Line 157... Line 160...
157
                    TransfertBaseSQLComponent.openTransfertFrame(IListe.get(e).getSelectedRows(), "BON_DE_LIVRAISON");
160
                    TransfertBaseSQLComponent.openTransfertFrame(IListe.get(e).getSelectedRows(), "BON_DE_LIVRAISON");
158
                }
161
                }
159
            }, false, "sales.invoice.create.delivery");
162
            }, false, "sales.invoice.create.delivery");
160
            actionBL.setPredicate(IListeEvent.getSingleSelectionPredicate());
163
            actionBL.setPredicate(IListeEvent.getSingleSelectionPredicate());
161
            l.add(actionBL);
164
            l.add(actionBL);
-
 
165
        if (getTable().contains("ATTACHMENTS")) {
-
 
166
            PredicateRowAction actionAttachment = new PredicateRowAction(new AttachmentAction().getAction(), true);
-
 
167
            actionAttachment.setPredicate(IListeEvent.getSingleSelectionPredicate());
-
 
168
            getRowActions().add(actionAttachment);
-
 
169
        }
-
 
170
 
162
        PredicateRowAction actionAvoir = new PredicateRowAction(new AbstractAction() {
171
        PredicateRowAction actionAvoir = new PredicateRowAction(new AbstractAction() {
163
            public void actionPerformed(ActionEvent e) {
172
            public void actionPerformed(ActionEvent e) {
164
                TransfertBaseSQLComponent.openTransfertFrame(IListe.get(e).getSelectedRows(), "AVOIR_CLIENT");
173
                TransfertBaseSQLComponent.openTransfertFrame(IListe.get(e).getSelectedRows(), "AVOIR_CLIENT");
165
            }
174
            }
166
        }, false, "sales.invoice.create.credit");
175
        }, false, "sales.invoice.create.credit");
Line 186... Line 195...
186
                EditFrame editFrame = new EditFrame(eltFact, EditPanel.CREATION);
195
                EditFrame editFrame = new EditFrame(eltFact, EditPanel.CREATION);
187
 
196
 
188
                ((SaisieVenteFactureSQLComponent) editFrame.getSQLComponent()).loadFactureExistante(IListe.get(e).getSelectedId());
197
                ((SaisieVenteFactureSQLComponent) editFrame.getSQLComponent()).loadFactureExistante(IListe.get(e).getSelectedId());
189
                editFrame.setVisible(true);
198
                editFrame.setVisible(true);
190
            }
199
            }
191
        }, false, "sales.invoice.clone") {
200
        }, true, "sales.invoice.clone") {
192
            public boolean enabledFor(IListeEvent evt) {
201
            public boolean enabledFor(IListeEvent evt) {
193
                List<? extends SQLRowAccessor> l = evt.getSelectedRows();
202
                List<? extends SQLRowAccessor> l = evt.getSelectedRows();
194
                if (l != null && l.size() == 1) {
203
                if (l != null && l.size() == 1) {
195
                    SQLRowAccessor r = l.get(0);
204
                    SQLRowAccessor r = l.get(0);
196
                    return !r.getBoolean("PARTIAL") && !r.getBoolean("SOLDE");
205
                    return !r.getBoolean("PARTIAL") && !r.getBoolean("SOLDE");
Line 247... Line 256...
247
 
256
 
248
    }
257
    }
249
 
258
 
250
    @Override
259
    @Override
251
    protected void setupLinks(SQLElementLinksSetup links) {
260
    protected void setupLinks(SQLElementLinksSetup links) {
252
 
-
 
253
        super.setupLinks(links);
261
        super.setupLinks(links);
254
        if (getTable().contains("ID_ADRESSE")) {
262
        if (getTable().contains("ID_ADRESSE")) {
255
            links.get("ID_ADRESSE").setType(LinkType.ASSOCIATION);
263
            links.get("ID_ADRESSE").setType(LinkType.ASSOCIATION);
256
        }
264
        }
257
        if (getTable().contains("ID_ADRESSE_LIVRAISON")) {
265
        if (getTable().contains("ID_ADRESSE_LIVRAISON")) {
258
            links.get("ID_ADRESSE_LIVRAISON").setType(LinkType.ASSOCIATION);
266
            links.get("ID_ADRESSE_LIVRAISON").setType(LinkType.ASSOCIATION);
259
        }
267
        }
-
 
268
        links.get(MESSAGE_FIELD_NAME).setType(LinkType.ASSOCIATION, ReferenceAction.RESTRICT);
260
    }
269
    }
261
 
270
 
262
    @Override
271
    @Override
263
    public ListMap<String, String> getShowAs() {
272
    public ListMap<String, String> getShowAs() {
264
        ListMap<String, String> map = new ListMap<String, String>();
273
        ListMap<String, String> map = new ListMap<String, String>();