Jump to content
  • 0

Invoice Format With {Num} Padding


MartyIX

Question

Hello,

 

 

I can set Invoice Format on page /admin/settings/company/billing/customization/ (in my case it is: {year}Company{num}). I would like to pad invoice IDs with zeros. I guess that for this purpose there is inv_pad_size setting (http://docs.blesta.com/display/dev/Company+Settings). However, I was not able to make it work - id_code of invoice is 2013Company1 instead of 2013Company0001.

 

Is it a bug? Or what is the purpose of the inv_pad_size setting?

 

/app/models/invoices.php (This may be the place where inv_pad_size is not taken into account)

 

    /**     * Partially constructs the query required by Invoices::get() and others
     *
     * @param int $invoice_id The ID of the invoice to fetch
     * @return Record The partially constructed query Record object
     */
    private function getInvoice($invoice_id) {
        $fields = array("invoices.*",
            "REPLACE(invoices.id_format, ?, invoices.id_value)" => "id_code",
            "invoice_delivery.date_sent" => "delivery_date_sent"
        );
        
        // Fetch the invoices along with total due and total paid, calculate total remaining on the fly
        $this->Record->select($fields)->select(array("invoices.total-IFNULL(invoices.paid,0)"=>"due"), false)->
            appendValues(array($this->replacement_keys['invoices']['ID_VALUE_TAG']))->
            from("invoices")->
            on("invoice_delivery.date_sent", "!=", null)->leftJoin("invoice_delivery", "invoice_delivery.invoice_id", "=", "invoices.id", false)->
            where("invoices.id", "=", $invoice_id)->
            group("invoices.id");
        
        return $this->Record;    
    }

 

Thank you!

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...