OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 174 Rev 177
Line 552... Line 552...
552
            if (!compteSpec) {
552
            if (!compteSpec) {
553
                SQLRowAccessor cptCatComptable = null;
553
                SQLRowAccessor cptCatComptable = null;
554
                // TODO Optimiser les requetes
554
                // TODO Optimiser les requetes
555
                if (this.rowCatComptable != null && !this.rowCatComptable.isUndefined()) {
555
                if (this.rowCatComptable != null && !this.rowCatComptable.isUndefined()) {
556
                    String suffix = (this.achat ? "_ACHAT" : "_VENTE");
556
                    String suffix = (this.achat ? "_ACHAT" : "_VENTE");
-
 
557
                    if (!this.rowCatComptable.isForeignEmpty("ID_COMPTE_PCE" + suffix)) {
-
 
558
                        cptCatComptable = cacheForTableCompte.getRowFromId(this.rowCatComptable.getForeignID("ID_COMPTE_PCE" + suffix));
-
 
559
                    }
557
                    Collection<? extends SQLRowAccessor> rows = article.getReferentRows(this.compteTable.getTable("ARTICLE_CATEGORIE_COMPTABLE"));
560
                    Collection<? extends SQLRowAccessor> rows = article.getReferentRows(this.compteTable.getTable("ARTICLE_CATEGORIE_COMPTABLE"));
558
                    for (SQLRowAccessor sqlRowAccessor : rows) {
561
                    for (SQLRowAccessor sqlRowAccessor : rows) {
559
                        if (sqlRowAccessor.getForeignID("ID_CATEGORIE_COMPTABLE") == this.rowCatComptable.getID()) {
562
                        if (sqlRowAccessor.getForeignID("ID_CATEGORIE_COMPTABLE") == this.rowCatComptable.getID()) {
-
 
563
                            if (!sqlRowAccessor.isForeignEmpty("ID_COMPTE_PCE" + suffix)) {
560
                            cptCatComptable = cacheForTableCompte.getRowFromId(this.rowCatComptable.getForeignID("ID_COMPTE_PCE" + suffix));
564
                                cptCatComptable = cacheForTableCompte.getRowFromId(sqlRowAccessor.getForeignID("ID_COMPTE_PCE" + suffix));
-
 
565
                            }
561
                        }
566
                        }
562
                    }
567
                    }
563
                }
568
                }
564
 
-
 
565
                if (cptCatComptable == null) {
569
                if (cptCatComptable == null) {
566
                    String suffix = (this.achat ? "_ACHAT" : "");
570
                    String suffix = (this.achat ? "_ACHAT" : "");
567
                    SQLRowAccessor compteArticle = cacheForTableCompte.getRowFromId(article.getForeignID("ID_COMPTE_PCE" + suffix));
571
                    SQLRowAccessor compteArticle = cacheForTableCompte.getRowFromId(article.getForeignID("ID_COMPTE_PCE" + suffix));
568
                    if (compteArticle != null && !compteArticle.isUndefined()) {
572
                    if (compteArticle != null && !compteArticle.isUndefined()) {
569
                        cpt = compteArticle;
573
                        cpt = compteArticle;