mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-05 18:52:44 +01:00
Merge pull request #4650 from turbo124/v5-develop
Add $entity.datetime variable for invoice designs
This commit is contained in:
commit
bb8f628bb2
@ -113,6 +113,11 @@ class HtmlEngine
|
||||
$data['$invoice.due_date'] = &$data['$due_date'];
|
||||
$data['$invoice.number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.invoice_number')];
|
||||
$data['$invoice.po_number'] = ['value' => $this->entity->po_number ?: ' ', 'label' => ctrans('texts.po_number')];
|
||||
$data['$entity.datetime'] = ['value' => $this->formatDatetime($this->entity->created_at, $this->entity->client->date_format()), 'label' => ctrans('texts.date')];
|
||||
$data['$invoice.datetime'] = &$data['$entity.datetime'];
|
||||
$data['$quote.datetime'] = &$data['$entity.datetime'];
|
||||
$data['$credit.datetime'] = &$data['$entity.datetime'];
|
||||
|
||||
// $data['$line_taxes'] = ['value' => $this->makeLineTaxes() ?: ' ', 'label' => ctrans('texts.taxes')];
|
||||
// $data['$invoice.line_taxes'] = &$data['$line_taxes'];
|
||||
|
||||
|
@ -71,6 +71,17 @@ trait MakesDates
|
||||
return $date->format($format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a datedate.
|
||||
* @param Carbon|string $date Carbon object or date string
|
||||
* @param string $format The date display format
|
||||
* @return string The formatted date
|
||||
*/
|
||||
public function formatDatetime($date, string $format) :string
|
||||
{
|
||||
return Carbon::createFromTimestamp($date)->format($format . " g:i a");
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a date.
|
||||
* @param Carbon/String $date Carbon object or date string
|
||||
|
Loading…
Reference in New Issue
Block a user