Uploaded image for project: 'Blesta Core'
  1. Blesta Core
  2. CORE-923

Add option to cache copy of invoice when generated

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0
    • Fix Version/s: 5.1.0-b1
    • Component/s: None
    • Labels:
      None

      Description

      Currently invoice copies (PDFs, for example) are generated on the fly. This allows any changes made to the invoice to be reflected when the invoice is next viewed. However, some localities require that the invoice not change at all after being generated.

      To handle these instances, there should be a company setting to save a cached copy of the invoice to disk (Disabled by default). Once saved, all future requests to generate invoices will instead return the cached copy (if the company setting is enabled) if it exists. If a cached copy does not exist, it should be generated and cached to disk. Any future changes to the invoice would not affect the cached copy.

      In the rare event that a cached copy must be updated, there should be a "Recache" checkbox on the edit invoice page that allows the cached copy to be overwritten when saved. This option should only appear if the save cached copies company setting is enabled.

      We may need to also prevent an invoice from being updated once it's cached. Perhaps this would be a second setting? "Do not allow invoices to be modified after they are created.", but we would probably need a way to allow certain people to override this.

      As a sanity check, perhaps we should raise an error if an invoice is attempted to be edited without checking the "recache" option.

      This task should not apply to draft and proforma invoice types.

      UPDATE 12/11/20

      It has been suggested that we store the data only, rather than archiving a physical copy of the PDF which would be larger. We could store the invoices to disk in JSON format only – all of the data, and still generate the invoice PDF's on the fly, but rather than populating the invoice with data from the database, we populate from the invoice's JSON file if it exists. However, some indicate that it's not acceptable for the invoice template/design to change, others expect it to change. So there could be an option to store JSON only, or JSON + PDF.

        Issue Links

          Activity

            People

            • Assignee:
              abdy Abdy Franco
              Reporter:
              admin Paul Phillips
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                8/Jun/21

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 days, 41 minutes
                4d 41m

                  Agile