mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Minor fixes
This commit is contained in:
parent
0279cebbaf
commit
4065427da0
@ -104,6 +104,8 @@ class ActivityController extends BaseController
|
|||||||
$system = ctrans('texts.system');
|
$system = ctrans('texts.system');
|
||||||
|
|
||||||
$data = $activities->cursor()->map(function ($activity) use ($system) {
|
$data = $activities->cursor()->map(function ($activity) use ($system) {
|
||||||
|
|
||||||
|
return $activity->activity_string();
|
||||||
$arr =
|
$arr =
|
||||||
[
|
[
|
||||||
'client' => $activity->client ? $activity->client : '',
|
'client' => $activity->client ? $activity->client : '',
|
||||||
@ -134,7 +136,7 @@ class ActivityController extends BaseController
|
|||||||
$activity_meta['is_system'] = $activity->is_system;
|
$activity_meta['is_system'] = $activity->is_system;
|
||||||
// $activity_meta['currency_id'] = $activity->currency_id;
|
// $activity_meta['currency_id'] = $activity->currency_id;
|
||||||
|
|
||||||
return array_merge($arr, $activity_meta);
|
return array_merge($arr, $activity_array);
|
||||||
});
|
});
|
||||||
|
|
||||||
return response()->json(['data' => $data->toArray()], 200);
|
return response()->json(['data' => $data->toArray()], 200);
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Utils\Number;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -484,9 +485,10 @@ class Activity extends StaticModel
|
|||||||
':payment_amount',
|
':payment_amount',
|
||||||
':gateway',
|
':gateway',
|
||||||
':adjustment',
|
':adjustment',
|
||||||
|
':ip',
|
||||||
];
|
];
|
||||||
|
|
||||||
$found_variables = array_intersect(explode(" ",trans("texts.activity_{$this->activity_type_id}")));
|
$found_variables = array_intersect(explode(" ",trans("texts.activity_{$this->activity_type_id}")), $intersect);
|
||||||
|
|
||||||
$replacements = [];
|
$replacements = [];
|
||||||
|
|
||||||
@ -494,35 +496,48 @@ class Activity extends StaticModel
|
|||||||
$replacements[] = $this->matchVar($var);
|
$replacements[] = $this->matchVar($var);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctrans("texts.activity_{$this->activity_type_id}",$replacements);
|
foreach(['id', 'hashed_id','notes','created_at','activity_type_id'] as $var)
|
||||||
|
$replacements[] = $this->matchVar($var);
|
||||||
|
|
||||||
|
// return ctrans("texts.activity_{$this->activity_type_id}",$replacements);
|
||||||
|
|
||||||
|
return $replacements;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function matchVar(string $variable)
|
private function matchVar(string $variable)
|
||||||
{
|
{
|
||||||
return match($variable) {
|
return match($variable) {
|
||||||
':invoice' => $translation = [substr($variable, -1) => $this?->invoice?->number ?? ''],
|
'activity_type_id' => $translation = ['activity_type_id' => $this->activity_type_id],
|
||||||
':client' => $translation = [substr($variable, -1) => $this?->client?->present()->name() ?? ''],
|
'id' => $translation = ['id' => $this->id],
|
||||||
':contact' => $translation = [substr($variable, -1) => $this?->contact?->present()->name() ?? ''],
|
'hashed_id' => $translation = ['hashed_id' => $this->hashed_id],
|
||||||
':user' => $translation = [substr($variable, -1) => $this?->user?->present()->name() ??''],
|
'notes' => $translation = ['notes' => $this->notes ?? ''],
|
||||||
':vendor' => $translation = [substr($variable, -1) => $this?->vendor?->present()->name() ?? ''],
|
'created_at' => $translation = ['created_at' => $this->created_at ?? ''],
|
||||||
':quote' => $translation = [substr($variable, -1) => $this?->quote?->number ?? ''],
|
':invoice' => $translation = [substr($variable, 1) => [ 'label' => $this?->invoice?->number ?? '', 'hashed_id' => $this->invoice?->hashed_id ?? '']],
|
||||||
':credit' => $translation = [substr($variable, -1) => $this?->credit?->number ?? ''],
|
':client' => $translation = [substr($variable, 1) => [ 'label' => $this?->client?->present()->name() ?? '', 'hashed_id' => $this->client->hashed_id ?? '']],
|
||||||
':payment' => $translation = [substr($variable, -1) => $this?->payment?->number ?? ''],
|
':contact' => $translation = [substr($variable, 1) => [ 'label' => $this?->contact?->present()->name() ?? '', 'hashed_id' => $this->contact->client->hashed_id ?? '']],
|
||||||
':task' => $translation = [substr($variable, -1) => $this?->task?->number ?? ''],
|
':user' => $translation = [substr($variable, 1) => [ 'label' => $this?->user?->present()->name() ??'', 'hashed_id' => $this->user->hashed_id ?? '']],
|
||||||
':expense' => $translation = [substr($variable, -1) => $this?->expense?->number ?? ''],
|
':vendor' => $translation = [substr($variable, 1) => [ 'label' => $this?->vendor?->present()->name() ?? '', 'hashed_id' => $this->vendor->hashed_id ?? '']],
|
||||||
':purchase_order' => $translation = [substr($variable, -1) => $this?->purchase_order?->number ?? ''],
|
':quote' => $translation = [substr($variable, 1) => [ 'label' => $this?->quote?->number ?? '', 'hashed_id' => $this->quote->hashed_id ?? '']],
|
||||||
':subscription' => $translation = [substr($variable, -1) => $this?->subscription?->number ?? ''],
|
':credit' => $translation = [substr($variable, 1) => [ 'label' => $this?->credit?->number ?? '', 'hashed_id' => $this->credit->hashed_id ?? '']],
|
||||||
':recurring_invoice' => $translation = [substr($variable, -1) => $this?->purchase_order?->number ??''],
|
':payment' => $translation = [substr($variable, 1) => [ 'label' => $this?->payment?->number ?? '', 'hashed_id' => $this->payment->hashed_id ?? '']],
|
||||||
':recurring_expense' => $translation = [substr($variable, -1) => $this?->recurring_expense?->number ??''],
|
':task' => $translation = [substr($variable, 1) => [ 'label' => $this?->task?->number ?? '', 'hashed_id' => $this->task->hashed_id ?? '']],
|
||||||
':amount' => $translation = [substr($variable, -1) => ''],
|
':expense' => $translation = [substr($variable, 1) => [ 'label' => $this?->expense?->number ?? '', 'hashed_id' => $this->expense->hashed_id ?? '']],
|
||||||
':balance' => $translation = [substr($variable, -1) => ''],
|
':purchase_order' => $translation = [substr($variable, 1) => [ 'label' => $this?->purchase_order?->number ?? '', 'hashed_id' => $this->purchase_order->hashed_id ?? '']],
|
||||||
':number' => $translation = [substr($variable, -1) => ''],
|
':subscription' => $translation = [substr($variable, 1) => [ 'label' => $this?->subscription?->number ?? '', 'hashed_id' => $this->subscription->hashed_id ?? '' ]],
|
||||||
':payment_amount' => $translation = [substr($variable, -1) => ''],
|
':recurring_invoice' => $translation = [substr($variable, 1) =>[ 'label' => $this?->recurring_invoice?->number ??'', 'hashed_id' => $this->recurring_invoice->hashed_id ?? '']],
|
||||||
':adjustment' => $translation = [substr($variable, -1) => $this->payment->refunded ?? ''],
|
':recurring_expense' => $translation = [substr($variable, 1) => [ 'label' => $this?->recurring_expense?->number ??'', 'hashed_id' => $this->recurring_expense->hashed_id ?? '']],
|
||||||
default => $translation = [substr($variable, -1) => ''],
|
':payment_amount' => $translation = [substr($variable, 1) =>[ 'label' => Number::formatMoney($this?->payment?->amount, $this?->payment?->client) ?? '']],
|
||||||
|
':adjustment' => $translation = [substr($variable, 1) =>[ 'label' => Number::formatMoney($this?->payment?->refunded, $this?->payment?->client) ?? '']],
|
||||||
|
':ip' => $translation = [ 'ip' => $this->ip ?? ''],
|
||||||
|
default => $translation = [substr($variable, 1) => ''],
|
||||||
};
|
};
|
||||||
|
|
||||||
return $translation;
|
return $translation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function returnEntityValue(string $variable)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@ use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundExceptio
|
|||||||
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel newQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel newQuery()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel query()
|
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel query()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel find()
|
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel find()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel with()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel withTrashed()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel findOrFail()
|
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel findOrFail()
|
||||||
* @mixin \Eloquent
|
* @mixin \Eloquent
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user