Fixes for client country exports

This commit is contained in:
David Bomba 2023-07-26 19:00:47 +10:00
parent 2dbf6cc4ff
commit e3d5abe5b5
4 changed files with 10 additions and 53 deletions

View File

@ -163,11 +163,11 @@ class ClientExport extends BaseExport
} }
if (in_array('client.country_id', $this->input['report_keys'])) { if (in_array('client.country_id', $this->input['report_keys'])) {
$entity['country'] = $client->country ? ctrans("texts.country_{$client->country->name}") : ''; $entity['client.country_id'] = $client->country ? ctrans("texts.country_{$client->country->name}") : '';
} }
if (in_array('client.shipping_country_id', $this->input['report_keys'])) { if (in_array('client.shipping_country_id', $this->input['report_keys'])) {
$entity['shipping_country'] = $client->shipping_country ? ctrans("texts.country_{$client->shipping_country->name}") : ''; $entity['client.shipping_country_id'] = $client->shipping_country ? ctrans("texts.country_{$client->shipping_country->name}") : '';
} }
if (in_array('client.currency_id', $this->input['report_keys'])) { if (in_array('client.currency_id', $this->input['report_keys'])) {

View File

@ -43,7 +43,9 @@ class UpdateCalculatedFields
if (! config('ninja.db.multi_db_enabled')) { if (! config('ninja.db.multi_db_enabled')) {
Project::with('tasks')->where('updated_at', '>', now()->subHours(2)) Project::with('tasks')->whereHas('tasks', function ($query){
$query->where('updated_at', '>', now()->subHours(2));
})
->cursor() ->cursor()
->each(function ($project) { ->each(function ($project) {
@ -59,7 +61,9 @@ class UpdateCalculatedFields
MultiDB::setDB($db); MultiDB::setDB($db);
Project::with('tasks')->where('updated_at', '>', now()->subHours(2)) Project::with('tasks')->whereHas('tasks', function ($query){
$query->where('updated_at', '>', now()->subHours(2));
})
->cursor() ->cursor()
->each(function ($project) { ->each(function ($project) {
$project->current_hours = $this->calculateDuration($project); $project->current_hours = $this->calculateDuration($project);

View File

@ -32,11 +32,9 @@ use Laracasts\Presenter\PresentableTrait;
* @property string $color * @property string $color
* @property-read \App\Models\Client|null $client * @property-read \App\Models\Client|null $client
* @property-read \App\Models\Company $company * @property-read \App\Models\Company $company
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read int|null $documents_count * @property-read int|null $documents_count
* @property-read mixed $hashed_id * @property-read mixed $hashed_id
* @property-read Project|null $project * @property-read Project|null $project
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @property-read int|null $tasks_count * @property-read int|null $tasks_count
* @property-read \App\Models\User $user * @property-read \App\Models\User $user
* @property-read \App\Models\Vendor|null $vendor * @property-read \App\Models\Vendor|null $vendor
@ -49,55 +47,10 @@ use Laracasts\Presenter\PresentableTrait;
* @method static \Illuminate\Database\Eloquent\Builder|Project onlyTrashed() * @method static \Illuminate\Database\Eloquent\Builder|Project onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|Project query() * @method static \Illuminate\Database\Eloquent\Builder|Project query()
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel scope() * @method static \Illuminate\Database\Eloquent\Builder|BaseModel scope()
* @method static \Illuminate\Database\Eloquent\Builder|Project whereAssignedUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereBudgetedHours($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereClientId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereColor($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereCompanyId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereCustomValue1($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereCustomValue2($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereCustomValue3($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereCustomValue4($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereDueDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereIsDeleted($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereNumber($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project wherePrivateNotes($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project wherePublicNotes($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereTaskRate($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project withTrashed() * @method static \Illuminate\Database\Eloquent\Builder|Project withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|Project withoutTrashed() * @method static \Illuminate\Database\Eloquent\Builder|Project withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @property int|null $current_hours
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @method static \Illuminate\Database\Eloquent\Builder|Project whereCurrentHours($value)
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @mixin \Eloquent * @mixin \Eloquent
*/ */
class Project extends BaseModel class Project extends BaseModel

View File

@ -36,8 +36,8 @@ use Illuminate\Support\Carbon;
* @property string|null $custom_value4 * @property string|null $custom_value4
* @property int|null $duration * @property int|null $duration
* @property string|null $description * @property string|null $description
* @property int $is_deleted * @property bool $is_deleted
* @property int $is_running * @property bool $is_running
* @property string|null $time_log * @property string|null $time_log
* @property string|null $number * @property string|null $number
* @property string $rate * @property string $rate