OFBiz
  1. OFBiz
  2. OFBIZ-4480

Need to have an option to pass file name as OrderId for the generated confirmation or invoice PDF.

    Details

    • Type: Improvement Improvement
    • Status: Patch Available
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: SVN trunk
    • Fix Version/s: None
    • Component/s: order
    • Labels:
    • Environment:

      OS - Ubuntu

      Description

      Need to have set the order pdf file name to its order number when we open the pdf from backoffice orderdetail page (/ordermgr/control/order.pdf?orderId=XXXXX).

      Currently, the default name of the pdf is always "order.pdf", instead need to have an option to set the default pdf name to its order number?

        Activity

        Hide
        Adrian Crum added a comment -

        I agree that we need a better way to handle import/export. The screen renderers are convenient, but using them requires a lot of kludge code. A "file export" view handler would be ideal.

        Show
        Adrian Crum added a comment - I agree that we need a better way to handle import/export. The screen renderers are convenient, but using them requires a lot of kludge code. A "file export" view handler would be ideal.
        Hide
        Chris Howe added a comment -

        Using this works on pdf files because the output stream waits until the end. However when using the MacroScreenViewHandler (for text/csv for example), you end up putting the servletResponse in the committed state by using response.getWriter() or by writing to the output stream.

        response.getWriter is the default when using stock ofbiz. That gets called before any action takes place in evaluating the screen. There would need to be an override for that in determining "useOutputStreamNotWriter".

        Once that's determined, the Tree Renderer tries to render it's template. That needs to be fixed to match the Screen and Form Renderers.

        Then finally, there is an attempt to render the Screen Begin Macro.

        I'm not sure how to best overcome this for use within the OFBiz project going forward. But checking for contentType "text/csv" before each of those issues fixes my local setup. Perhaps using a different View Handler when such modifications are needed is best (though Tree Widget Rendering differently than the others probably would need to be taken care of).

        Show
        Chris Howe added a comment - Using this works on pdf files because the output stream waits until the end. However when using the MacroScreenViewHandler (for text/csv for example), you end up putting the servletResponse in the committed state by using response.getWriter() or by writing to the output stream. response.getWriter is the default when using stock ofbiz. That gets called before any action takes place in evaluating the screen. There would need to be an override for that in determining "useOutputStreamNotWriter". Once that's determined, the Tree Renderer tries to render it's template. That needs to be fixed to match the Screen and Form Renderers. Then finally, there is an attempt to render the Screen Begin Macro. I'm not sure how to best overcome this for use within the OFBiz project going forward. But checking for contentType "text/csv" before each of those issues fixes my local setup. Perhaps using a different View Handler when such modifications are needed is best (though Tree Widget Rendering differently than the others probably would need to be taken care of).
        Hide
        Nicolas Malin added a comment -

        I look the patch, quick and powerful improvement to solve this issue, but improve directly ViewHandler to support a generic attribute (as example responseFileName) would be more usable for other report.

        Nicolas

        Show
        Nicolas Malin added a comment - I look the patch, quick and powerful improvement to solve this issue, but improve directly ViewHandler to support a generic attribute (as example responseFileName) would be more usable for other report. Nicolas
        Hide
        Ganesh Bawne added a comment -

        Thank you Anne for your quick reply.

        I have created the patch which will use orderId and InvoiceId as default name when "File Download" Dialog Box appear.

        To fix the issue, I set the content-disposition header in response to override this default behavior.
        Right now done it in CompanyHeader.groovy as is used for print pdf files.

        You can test it on pdf and invoice link on backend's orderdetails page.

        Thanks,
        Ganesh

        Show
        Ganesh Bawne added a comment - Thank you Anne for your quick reply. I have created the patch which will use orderId and InvoiceId as default name when "File Download" Dialog Box appear. To fix the issue, I set the content-disposition header in response to override this default behavior. Right now done it in CompanyHeader.groovy as is used for print pdf files. You can test it on pdf and invoice link on backend's orderdetails page. Thanks, Ganesh
        Hide
        Jacques Le Roux added a comment -

        From Anne on user ML

        Only a partial answer, I'm afraid.

        You need to set the content-disposition header. Google gave this page
        http://support.microsoft.com/kb/260519 which shows the syntax.

        I haven't looked at how you might do this with OfBiz.

        Show
        Jacques Le Roux added a comment - From Anne on user ML Only a partial answer, I'm afraid. You need to set the content-disposition header. Google gave this page http://support.microsoft.com/kb/260519 which shows the syntax. I haven't looked at how you might do this with OfBiz.

          People

          • Assignee:
            Unassigned
            Reporter:
            Ganesh Bawne
          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development