Integrate revision 14385 from trifonnt:

FR [3100564] - Improve JasperReport image handling
https://sourceforge.net/tracker/?func=detail&aid=3100564&group_id=176962&atid=883808
This commit is contained in:
Carlos Ruiz 2011-03-07 11:42:58 -05:00
parent 19dded6c92
commit d87472ce7a
1 changed files with 26 additions and 10 deletions

View File

@ -9,7 +9,7 @@
* You should have received a copy of the GNU General Public License along * * You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., * * with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us * * * For the text or an alternative of this public license, you may reach us *
*****************************************************************************/ *****************************************************************************/
package org.compiere.report; package org.compiere.report;
@ -408,10 +408,16 @@ public class ReportStarter implements ProcessCall, ClientProcess
} }
for( int i=0; i<subreports.length; i++) { for( int i=0; i<subreports.length; i++) {
JasperData subData = processReport( subreports[i]); // @Trifon - begin
if (subreports[i].getName().toLowerCase().endsWith(".jasper")
|| subreports[i].getName().toLowerCase().endsWith(".jrxml")
)
{
JasperData subData = processReport( subreports[i] );
if (subData.getJasperReport()!=null) { if (subData.getJasperReport()!=null) {
params.put( subData.getJasperName(), subData.getJasperFile().getAbsolutePath()); params.put( subData.getJasperName(), subData.getJasperFile().getAbsolutePath());
} }
} // @Trifon - end
} }
if (Record_ID > 0) if (Record_ID > 0)
@ -507,13 +513,16 @@ public class ReportStarter implements ProcessCall, ClientProcess
PrintRequestAttributeSet prats = new HashPrintRequestAttributeSet(); PrintRequestAttributeSet prats = new HashPrintRequestAttributeSet();
// add: copies, job-name, priority // add: copies, job-name, priority
if (printInfo.isDocumentCopy() || printInfo.getCopies() < 1) if (printInfo == null || printInfo.isDocumentCopy() || printInfo.getCopies() < 1) // @Trifon
prats.add (new Copies(1)); prats.add (new Copies(1));
else else
prats.add (new Copies(printInfo.getCopies())); prats.add (new Copies(printInfo.getCopies()));
Locale locale = Language.getLoginLanguage().getLocale(); Locale locale = Language.getLoginLanguage().getLocale();
prats.add(new JobName(printFormat.getName() + "_" + pi.getRecord_ID(), locale)); // @Trifon
prats.add(PrintUtil.getJobPriority(jasperPrint.getPages().size() , printInfo.getCopies(), true)); String printFormat_name = printFormat == null ? "" : printFormat.getName();
int numCopies = printInfo == null ? 0 : printInfo.getCopies();
prats.add(new JobName(printFormat_name + "_" + pi.getRecord_ID(), locale));
prats.add(PrintUtil.getJobPriority(jasperPrint.getPages().size(), numCopies, true));
// Create print service exporter // Create print service exporter
JRPrintServiceExporter exporter = new JRPrintServiceExporter();; JRPrintServiceExporter exporter = new JRPrintServiceExporter();;
@ -626,8 +635,15 @@ public class ReportStarter implements ProcessCall, ClientProcess
ArrayList<File> subreports = new ArrayList<File>(); ArrayList<File> subreports = new ArrayList<File>();
MAttachmentEntry[] entries = attachment.getEntries(); MAttachmentEntry[] entries = attachment.getEntries();
for(int i = 0; i < entries.length; i++) { for(int i = 0; i < entries.length; i++) {
if (!entries[i].getName().equals(name) && // @Trifon
(entries[i].getName().toLowerCase().endsWith(".jrxml") || entries[i].getName().toLowerCase().endsWith(".jasper"))) { if (!entries[i].getName().equals(name)
&& (entries[i].getName().toLowerCase().endsWith(".jrxml")
|| entries[i].getName().toLowerCase().endsWith(".jasper")
|| entries[i].getName().toLowerCase().endsWith(".jpg")
|| entries[i].getName().toLowerCase().endsWith(".png")
)
)
{
File reportFile = getAttachmentEntryFile(entries[i]); File reportFile = getAttachmentEntryFile(entries[i]);
if (reportFile != null) if (reportFile != null)
subreports.add(reportFile); subreports.add(reportFile);