This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository tutti. See http://git.codelutin.com/tutti.git commit 2ff68c5176176f36ab3ee3288649ce4949d9316d Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Aug 26 16:24:32 2014 +0200 fixes #5673: [EXPORT] vérifier que pour la génération du rapport pdf que c'est bien les codes campagne qui sont remontés --- .../export/pdf/CatchesPdfExportService.java | 32 ++++++++++++++++++++-- .../service/export/pdf/PdfExportBatchEntry.java | 10 +++---- .../src/main/resources/ftl/catchesReport_fr.ftl | 4 +-- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/export/pdf/CatchesPdfExportService.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/export/pdf/CatchesPdfExportService.java index aae0193..77f22b3 100644 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/export/pdf/CatchesPdfExportService.java +++ b/tutti-service/src/main/java/fr/ifremer/tutti/service/export/pdf/CatchesPdfExportService.java @@ -24,9 +24,9 @@ package fr.ifremer.tutti.service.export.pdf; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import org.nuiton.jaxx.application.ApplicationTechnicalException; import fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.persistence.entities.data.SpeciesAbleBatch; +import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol; import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.service.AbstractTuttiService; import fr.ifremer.tutti.service.PersistenceService; @@ -41,6 +41,7 @@ import freemarker.template.Template; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.application.ApplicationTechnicalException; import org.xhtmlrenderer.pdf.ITextRenderer; import java.io.File; @@ -171,9 +172,21 @@ public class CatchesPdfExportService extends AbstractTuttiService { // Species if (exportContext.withSpeciesBatches()) { + List<ExportBatchEntry> speciesBatchEntries = exportContext.getSpeciesBatchEntry(false); + + boolean protocolFilled = context.getDataContext().isProtocolFilled(); + + Map<Integer, SpeciesProtocol> speciesProtocolMap = null; + + if (protocolFilled) { + + speciesProtocolMap = persistenceService.toSpeciesProtocolMap(); + + } + for (ExportBatchEntry entry : speciesBatchEntries) { SpeciesAbleBatch batch = entry.getBatch(); @@ -182,7 +195,22 @@ public class CatchesPdfExportService extends AbstractTuttiService { Species speciesWithVerncularCode = persistenceService.getSpeciesByReferenceTaxonIdWithVernacularCode(species.getReferenceTaxonId()); - PdfExportBatchEntry pdfEntry = new PdfExportBatchEntry(species.getRefTaxCode(), + String code; + + if (protocolFilled) { + + // use surveyCode from protocol + SpeciesProtocol speciesProtocol = speciesProtocolMap.get(species.getReferenceTaxonId()); + + code = speciesProtocol.getSpeciesSurveyCode(); + + } else { + + // use refTaxCode + code = species.getRefTaxCode(); + + } + PdfExportBatchEntry pdfEntry = new PdfExportBatchEntry(code, species.getName(), speciesWithVerncularCode.getVernacularCode(), entry.getSortedWeight(), diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/export/pdf/PdfExportBatchEntry.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/export/pdf/PdfExportBatchEntry.java index bbf8b10..33c2249 100644 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/export/pdf/PdfExportBatchEntry.java +++ b/tutti-service/src/main/java/fr/ifremer/tutti/service/export/pdf/PdfExportBatchEntry.java @@ -37,20 +37,20 @@ public class PdfExportBatchEntry extends ExportBatchEntry { protected final String scientificName; - protected final String commonName; + protected final String vernacularCode; protected float percentage; public PdfExportBatchEntry(String code, String scientificName, - String commonName, + String vernacularCode, float sortedWeight, float totalWeight, float catchTotalWeight) { super(null); this.code = code; this.scientificName = scientificName; - this.commonName = commonName; + this.vernacularCode = vernacularCode; addSortedWeight(sortedWeight); addTotalWeight(totalWeight); @@ -65,8 +65,8 @@ public class PdfExportBatchEntry extends ExportBatchEntry { return scientificName; } - public String getCommonName() { - return commonName; + public String getVernacularCode() { + return vernacularCode; } public float getPercentage() { diff --git a/tutti-service/src/main/resources/ftl/catchesReport_fr.ftl b/tutti-service/src/main/resources/ftl/catchesReport_fr.ftl index 97988df..fa3828e 100644 --- a/tutti-service/src/main/resources/ftl/catchesReport_fr.ftl +++ b/tutti-service/src/main/resources/ftl/catchesReport_fr.ftl @@ -94,9 +94,9 @@ <#list operation.catches?sort_by("sortedWeight")?reverse as catch> <tr> - <td><#if catch.code??>${catch.code}</#if></td> + <td>${catch.code}</td> <td><em>${catch.scientificName}</em></td> - <td><#if catch.commonName??>${catch.commonName}</#if></td> + <td><#if catch.vernacularCode??>${catch.vernacularCode}</#if></td> <td class="number">${catch.sortedWeight?string("0.00")}</td> <td class="number">${catch.totalWeight?string("0.00")}</td> <td class="number">${catch.percentage?string("0.0")}</td> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.