Jump to content

Recommended Posts

Posted

Blesta has already implemented a table to store invoice meta.  It appears to be used primarily for temp storage of recurring information on 'draft' status invoices.  The Invoices model has three public methods to work with this meta data:

getMeta($invoice_id, $key = null)
setMeta($invoice_id, $key, $value)
unsetMeta($invoice_id, $key = null)

The methods have parameters already present to work with all meta for a given invoice, or with invoice meta having a certain key.  From first glance this looks like a great way for other plugins to add their own custom meta data to invoices. 

The current limitation with this is that when Blesta saves an invoice that is in draft status, but the invoice is no longer a recurring invoice, the Invoices->edit() method invokes the unsetMeta() method without specifying a key; the result of which is ALL of the invoice meta is deleted.  When an invoice is deleted, it makes perfect sense to delete ALL meta.  But in all other cases if the invoice remains, so should any meta that is not related to the recurring meta.

The feature request is to ask if Blesta would please modify their Invoices model (line #717 & Line #721 of version 5.12.2) such that rather than just

// Remove any existing meta data, no longer needed
$this->unsetMeta($invoice_id)

it would be

// Remove any recurring meta data, no longer needed
$this->unsetMeta($invoice_id, 'recur')

With this minor edit, ONLY the meta record pertaining to the 'recur' data would be deleted, allowing any other custom invoice meta provided by other plugins to remain.  The management of the remaining meta would come from the plugin(s) that created those meta records.  

 

 

 

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...