mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #2924 from aleksanderd/ninja-fixes-develop
Ninja fixes #2917
This commit is contained in:
commit
f8c7ae1a73
@ -22,6 +22,8 @@ use Nwidart\Modules\Facades\Module;
|
||||
|
||||
class Utils
|
||||
{
|
||||
protected static $cacheValues = [];
|
||||
|
||||
private static $weekdayNames = [
|
||||
'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday',
|
||||
];
|
||||
@ -555,6 +557,9 @@ class Utils
|
||||
|
||||
public static function getFromCache($id, $type)
|
||||
{
|
||||
if (!empty(static::$cacheValues[$type]) && !empty(static::$cacheValues[$type][$id])) {
|
||||
return static::$cacheValues[$type][$id];
|
||||
}
|
||||
$cache = Cache::get($type);
|
||||
|
||||
if (! $cache) {
|
||||
@ -567,7 +572,11 @@ class Utils
|
||||
return $item->id == $id;
|
||||
});
|
||||
|
||||
return $data->first();
|
||||
$res = $data->first();
|
||||
if (!empty($res)) {
|
||||
static::$cacheValues[$type][$id] = $res;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
public static function formatNumber($value, $currencyId = false, $precision = 0)
|
||||
|
@ -56,7 +56,7 @@ class InvoiceReport extends AbstractReport
|
||||
$clients = Client::scope()
|
||||
->orderBy('name')
|
||||
->withArchived()
|
||||
->with('contacts', 'user')
|
||||
->with('contacts', 'user', 'country', 'shipping_country')
|
||||
->with(['invoices' => function ($query) use ($statusIds) {
|
||||
$query->invoices()
|
||||
->withArchived()
|
||||
@ -122,7 +122,7 @@ class InvoiceReport extends AbstractReport
|
||||
$invoice->po_number,
|
||||
$invoice->private_notes,
|
||||
$client->vat_number,
|
||||
$invoice->user->getDisplayName(),
|
||||
$client->user->getDisplayName(),
|
||||
trim(str_replace('<br/>', ', ', $client->present()->address()), ', '),
|
||||
trim(str_replace('<br/>', ', ', $client->present()->address(ADDRESS_SHIPPING)), ', '),
|
||||
];
|
||||
|
@ -31,7 +31,9 @@ class TaxRateReport extends AbstractReport
|
||||
->withArchived()
|
||||
->with('contacts', 'user')
|
||||
->with(['invoices' => function ($query) {
|
||||
$query->with('invoice_items')
|
||||
$query
|
||||
->with('account', 'client')
|
||||
->with('invoice_items')
|
||||
->withArchived()
|
||||
->invoices()
|
||||
->where('is_public', '=', true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user