1.7 Alpha Attachment Print button problem

The screen shot below is busy because it shows a lot.  On the Patients|Medical Records|Documents screen I selected an attachment that was in fact a jpeg image, and then pressed the print button. As you can see, instead of showing the image, the system tried to interpret the jpeg as text.

As you might guess, this is data converted from an RxWorks system, and I suspect that I have blundered by converting the RxWorks attachment as an 'attachment' rather than an 'image'.

However, when you add an attachment, the system allows you to add any sort of file, including a jpeg.

If I add a jpeg as an image (rather than an attachment) then the Print button functions as expected - ie it uses the Patient Image template to display the image.

So is this my bug (ie the conversion code should have added the RxWorks attachment that was a jpeg as an Image rather than as an Attachment); or is this an OPV problem in that the code should have looked at the attachement and tried to figure out that it should use the Patient Image template.

I had a quick play with other types of attachements: .doc (word), .pdf, .txt all worked OK; .xls caused an NPE crash as follows:

 <error-report>
<version>1.7-SNAPSHOT</version>
<revision>5349</revision>
<message>An internal application error has occurred.</message>
<exception>
<type>java.lang.NullPointerException</type>
<stackTrace>
<trace>org.openvpms.report.openoffice.OpenOfficeDocument.getTextFieldMasters(OpenOfficeDocument.java:482)</trace>
<trace>org.openvpms.report.openoffice.OpenOfficeDocument.getUserTextFields(OpenOfficeDocument.java:385)</trace>
<trace>org.openvpms.report.openoffice.OpenOfficeDocument.initFields(OpenOfficeDocument.java:514)</trace>
<trace>org.openvpms.report.openoffice.OpenOfficeDocument.&lt;init&gt;(OpenOfficeDocument.java:169)</trace>
<trace>org.openvpms.report.openoffice.Converter.convert(Converter.java:124)</trace>
<trace>org.openvpms.web.component.im.doc.DocumentHelper.convert(DocumentHelper.java:44)</trace> 

Note that this is all Print button behaviour - if I click on the attachment itself, it get handled properly - ie dowload to browser and let the browser figure out what to do.

Regards, Tim G

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: 1.7 Alpha Attachment Print button problem

What is the mime type of the document?

For attachments, they should only get printed if they have a application/vnd.oasis.opendocument.text or application/msword mime type. Everything else should get downloaded.
 

Re: 1.7 Alpha Attachment Print button problem

Humm - I did a bit more experimenting - since the attachment used in the above report was one that was part of the RxWorks conversion (ie my kettle code generated the attacment record and then docloader loaded the jpeg file), I had a horrisble suspicion that I had screwed up.

So I did the following:

  1. find a standard jpg image on in MyPictures  (actually a photo of a cow)
  2. do New|Image to add it; then press the Print|Preview button - Cow appears
  3. do New|Attachement to add it; then press the Print|Preview button - text junk appears as per the original screen shot

Note that clicking on the icon itself works - it is using the Print button that causes the problem.

I will go and tweak the kettle code to add jpeg as images (which I probably should have done in the first place). However, this does not resolve the underlying problem.

If you have a scanned image of a customer consent form, it is quite logical to do New|Attachment to attach this, and I don't think that one should have to think 'its an image - should use New|Image'.

Regards, Tim G

Re: 1.7 Alpha Attachment Print button problem

OK - I can reproduce this via Print|Preview. The code is trying to convert the image to PDF when it should just download it unchanged.

Raised as https://openvpms.atlassian.net/browse/OVPMS-1341

-Tim

Syndicate content