OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 132 Rev 156
Line 49... Line 49...
49
import java.beans.PropertyChangeListener;
49
import java.beans.PropertyChangeListener;
50
import java.sql.SQLException;
50
import java.sql.SQLException;
51
import java.util.ArrayList;
51
import java.util.ArrayList;
52
import java.util.Calendar;
52
import java.util.Calendar;
53
import java.util.Date;
53
import java.util.Date;
54
import java.util.HashSet;
-
 
55
import java.util.List;
54
import java.util.List;
56
import java.util.Set;
55
import java.util.Set;
57
 
56
 
58
import javax.swing.BorderFactory;
57
import javax.swing.BorderFactory;
59
import javax.swing.JCheckBox;
58
import javax.swing.JCheckBox;
Line 426... Line 425...
426
                ExceptionHandler.handle("Erreur lors de la création des écritures associées à la saisie au kilometre.", exn);
425
                ExceptionHandler.handle("Erreur lors de la création des écritures associées à la saisie au kilometre.", exn);
427
            }
426
            }
428
            return id;
427
            return id;
429
        }
428
        }
430
 
429
 
-
 
430
        @Override
-
 
431
        public Set<String> getPartialResetNames() {
-
 
432
            return null;
-
 
433
        }
-
 
434
 
431
        public void loadMouvement(int idMvt) {
435
        public void loadMouvement(int idMvt) {
432
            this.tableKm.loadMouvement(idMvt, false);
436
            this.tableKm.loadMouvement(idMvt, false);
433
        }
437
        }
434
 
438
 
435
        public void loadContrepassation(int idMvt) {
439
        public void loadContrepassation(int idMvt) {
Line 481... Line 485...
481
                        final SQLTable tableElt = getTable().getBase().getTable("SAISIE_KM_ELEMENT");
485
                        final SQLTable tableElt = getTable().getBase().getTable("SAISIE_KM_ELEMENT");
482
                        List<SQLRow> myListKmItem = rowSaisieKm.getReferentRows(tableElt);
486
                        List<SQLRow> myListKmItem = rowSaisieKm.getReferentRows(tableElt);
483
 
487
 
484
                        List<SQLRow> listEcr = rowSaisieKm.getForeignRow("ID_MOUVEMENT").getReferentRows(ecritureTable);
488
                        List<SQLRow> listEcr = rowSaisieKm.getForeignRow("ID_MOUVEMENT").getReferentRows(ecritureTable);
485
 
489
 
-
 
490
                        // Fix bug sur saisie journal qui ne mettait pas l'id mouvement sur la
-
 
491
                        // saisie
-
 
492
                        boolean fixMvt = false;
-
 
493
                        if (myListKmItem != null && rowSaisieKm.isForeignEmpty("ID_MOUVEMENT")) {
-
 
494
                            for (SQLRow rowKmElement : myListKmItem) {
-
 
495
                                if (!rowKmElement.isForeignEmpty("ID_ECRITURE")) {
-
 
496
                                    SQLRow rowEcr = rowKmElement.getForeign("ID_ECRITURE");
-
 
497
                                    if (!rowEcr.isForeignEmpty("ID_MOUVEMENT")) {
-
 
498
                                        rowSaisieKm.createEmptyUpdateRow().put("ID_MOUVEMENT", rowEcr.getForeignID("ID_MOUVEMENT")).commit();
-
 
499
                                        rowSaisieKm.fetchValues();
-
 
500
                                        listEcr = rowSaisieKm.getForeignRow("ID_MOUVEMENT").getReferentRows(ecritureTable);
-
 
501
                                        fixMvt = true;
-
 
502
                                        break;
-
 
503
                                    }
-
 
504
                                }
-
 
505
                            }
-
 
506
                        }
486
                        if (myListKmItem != null) {
507
                        if (myListKmItem != null) {
487
 
508
 
-
 
509
                            // Mise à jour du nom de la pièce
-
 
510
                            final SQLRow mvt = rowSaisieKm.getForeign("ID_MOUVEMENT");
-
 
511
                            final SQLRow piece = mvt.getForeign("ID_PIECE");
-
 
512
                            String labelSaisie = rowSaisieKm.getString("NOM");
-
 
513
                            piece.createEmptyUpdateRow().put("NOM", (labelSaisie.length() == 0 ? "Saisie au km " : labelSaisie)).commit();
-
 
514
 
-
 
515
                            // Mise à jour des écritures
488
                            for (SQLRow rowKmElement : myListKmItem) {
516
                            for (SQLRow rowKmElement : myListKmItem) {
489
 
517
 
490
                                int idCpt = ComptePCESQLElement.getId(rowKmElement.getString("NUMERO"), rowKmElement.getString("NOM"));
518
                                int idCpt = ComptePCESQLElement.getId(rowKmElement.getString("NUMERO"), rowKmElement.getString("NOM"));
491
 
519
 
492
                                if (rowKmElement.getID() > 1) {
520
                                if (rowKmElement.getID() > 1) {
Line 503... Line 531...
503
                                    vals.put("JOURNAL_CODE", rowJournal.getString("CODE"));
531
                                    vals.put("JOURNAL_CODE", rowJournal.getString("CODE"));
504
                                    vals.put("NOM", rowKmElement.getObject("NOM_ECRITURE"));
532
                                    vals.put("NOM", rowKmElement.getObject("NOM_ECRITURE"));
505
                                    if (tableElt.contains("NOM_PIECE")) {
533
                                    if (tableElt.contains("NOM_PIECE")) {
506
                                        vals.put("NOM_PIECE", rowKmElement.getObject("NOM_PIECE"));
534
                                        vals.put("NOM_PIECE", rowKmElement.getObject("NOM_PIECE"));
507
                                    }
535
                                    }
-
 
536
 
508
                                    if (rowKmElement.getInt("ID_ECRITURE") > 1) {
537
                                    if (rowKmElement.getInt("ID_ECRITURE") > 1) {
509
                                        SQLRow rowTmp = ecritureTable.getRow(rowKmElement.getInt("ID_ECRITURE"));
-
 
510
 
538
 
-
 
539
                                        SQLRow rowTmp = ecritureTable.getRow(rowKmElement.getInt("ID_ECRITURE"));
-
 
540
                                        if (fixMvt) {
-
 
541
                                            vals.put("ID_MOUVEMENT", rowSaisieKm.getObject("ID_MOUVEMENT"));
-
 
542
                                        }
511
                                        if (!rowTmp.getBoolean("VALIDE")) {
543
                                        if (!rowTmp.getBoolean("VALIDE")) {
512
                                            vals.update(rowKmElement.getInt("ID_ECRITURE"));
544
                                            vals.update(rowKmElement.getInt("ID_ECRITURE"));
513
                                        } else {
545
                                        } else {
514
                                            System.err.println("Impossible de modifier une ecriture valide");
546
                                            System.err.println("Impossible de modifier une ecriture valide");
515
                                        }
547
                                        }
Line 670... Line 702...
670
 
702
 
671
    }
703
    }
672
 
704
 
673
    @Override
705
    @Override
674
    protected String createCode() {
706
    protected String createCode() {
675
        return createCodeFromPackage() + ".userentry";
707
        return createCodeOfPackage() + ".userentry";
676
    }
708
    }
677
}
709
}