OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 152 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 152 Rev 170
Line 373... Line 373...
373
 
373
 
374
        elt.addListColumn(new BaseSQLTableModelColumn("Affaire", String.class) {
374
        elt.addListColumn(new BaseSQLTableModelColumn("Affaire", String.class) {
375
 
375
 
376
            @Override
376
            @Override
377
            protected Object show_(SQLRowAccessor r) {
377
            protected Object show_(SQLRowAccessor r) {
-
 
378
                final SQLRowAccessor foreignAff = r.getForeign("ID_AFFAIRE");
-
 
379
                if (foreignAff != null && !foreignAff.isUndefined()) {
-
 
380
                    return foreignAff.getString("NUMERO");
-
 
381
                } else {
378
                Collection<? extends SQLRowAccessor> rows = r.getReferentRows(elt.getTable().getTable("AFFAIRE"));
382
                    Collection<? extends SQLRowAccessor> rows = r.getReferentRows(elt.getTable().getTable("AFFAIRE"));
379
                if (rows.size() == 1) {
383
                    if (rows.size() == 1) {
380
                    return rows.iterator().next().getString("NUMERO");
384
                        return rows.iterator().next().getString("NUMERO");
381
                } else {
385
                    } else {
382
                    return "";
386
                        return "";
383
                }
387
                    }
384
            }
388
                }
-
 
389
            }
385
 
390
 
386
            @Override
391
            @Override
387
            public Set<FieldPath> getPaths() {
392
            public Set<FieldPath> getPaths() {
388
                SQLTable table = elt.getTable();
393
                SQLTable table = elt.getTable();
-
 
394
                Path pDev = new Path(table).add(table.getField("ID_AFFAIRE"));
389
                Path p = new Path(table).add(table.getTable("AFFAIRE"), Direction.REFERENT);
395
                Path pAff = new Path(table).add(table.getTable("AFFAIRE"), Direction.REFERENT);
390
                return CollectionUtils.createSet(new FieldPath(p, "NUMERO"));
396
                return CollectionUtils.createSet(new FieldPath(pDev, "NUMERO"), new FieldPath(pAff, "NUMERO"));
391
            }
397
            }
392
        });
398
        });
393
        new CmdToBrSQLInjector();
399
        new CmdToBrSQLInjector();
394
        new QuoteToOrderSQLInjector();
400
        new QuoteToOrderSQLInjector();
395
        new QuoteToInvoiceSQLInjector();
401
        new QuoteToInvoiceSQLInjector();
Line 497... Line 503...
497
                        SQLRowValues rowValsDevis = row.asRowValues();
503
                        SQLRowValues rowValsDevis = row.asRowValues();
498
                        rowValsDevis.put("ID_AFFAIRE", box.getSelectedId());
504
                        rowValsDevis.put("ID_AFFAIRE", box.getSelectedId());
499
 
505
 
500
                        try {
506
                        try {
501
                            rowValsDevis.commit();
507
                            rowValsDevis.commit();
-
 
508
                            row.fetchValues();
-
 
509
                            if (createCommandeClient) {
-
 
510
                                Configuration.getInstance().getDirectory().getElement(DevisSQLElement.class).transfertCommandeClient(Arrays.asList(row.asRowValues()));
-
 
511
                            }
502
                        } catch (SQLException exn) {
512
                        } catch (SQLException exn) {
503
                            // TODO Bloc catch auto-généré
513
                            ExceptionHandler.handle("Erreur lors de la création de la commande client!", exn);
504
                            exn.printStackTrace();
-
 
505
                        }
514
                        }
506
                    }
515
                    }
507
                });
516
                });
508
                FrameUtil.show(f);
517
                FrameUtil.show(f);
509
                return f;
518
                return f;
Line 671... Line 680...
671
            public void actionPerformed(ActionEvent e) {
680
            public void actionPerformed(ActionEvent e) {
672
                ProjectImportExport importExport = new ProjectImportExport(ctxt.getElement("AFFAIRE").getTable().getDBRoot());
681
                ProjectImportExport importExport = new ProjectImportExport(ctxt.getElement("AFFAIRE").getTable().getDBRoot());
673
                importExport.importProjects();
682
                importExport.importProjects();
674
            }
683
            }
675
        }, MainFrame.HELP_MENU);
684
        }, MainFrame.HELP_MENU);
676
 
-
 
-
 
685
        if (false) {
677
        ctxt.addMenuItem(new AbstractAction("Fix ID_AFFAIRE") {
686
            ctxt.addMenuItem(new AbstractAction("Fix ID_AFFAIRE") {
678
            @Override
687
                @Override
679
            public void actionPerformed(ActionEvent e) {
688
                public void actionPerformed(ActionEvent e) {
680
                {
689
                    {
681
                    SQLTable tableCmd = ctxt.getElement("COMMANDE_CLIENT").getTable();
690
                        SQLTable tableCmd = ctxt.getElement("COMMANDE_CLIENT").getTable();
Line 725... Line 734...
725
                        e1.printStackTrace();
734
                            e1.printStackTrace();
726
                    }
735
                        }
727
                }
736
                    }
728
            }
737
                }
729
        }, MainFrame.CREATE_MENU);
738
            }, MainFrame.CREATE_MENU);
730
 
739
        }
731
        ctxt.addMenuItem(new AbstractAction("Recalcul Total achat facture prorata") {
740
        ctxt.addMenuItem(new AbstractAction("Recalcul Total achat facture prorata") {
732
            @Override
741
            @Override
733
            public void actionPerformed(ActionEvent e) {
742
            public void actionPerformed(ActionEvent e) {
734
 
743
 
735
                {
744
                {