1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #4634 from turbo124/v5-develop

Fixes for tasks, and migrations
This commit is contained in:
David Bomba 2021-01-06 10:37:03 +11:00 committed by GitHub
commit 867ad4ef72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 12 deletions

View File

@ -18,7 +18,7 @@
* @OA\Property(property="task_status_id", type="string", example="", description="________"),
* @OA\Property(property="description", type="string", example="", description="________"),
* @OA\Property(property="duration", type="integer", example="", description="________"),
* @OA\Property(property="task_status_sort_order", type="integer", example="", description="________"),
* @OA\Property(property="task_status_order", type="integer", example="", description="________"),
* @OA\Property(property="custom_value1", type="string", example="", description="________"),
* @OA\Property(property="custom_value2", type="string", example="", description="________"),
* @OA\Property(property="custom_value3", type="string", example="", description="________"),

View File

@ -390,6 +390,7 @@ class Import implements ShouldQueue
foreach ($data as $resource) {
$modified = $resource;
unset($modified['id']);
unset($modified['password']); //cant import passwords.
$user = $user_repository->save($modified, $this->fetchUser($resource['email']), true, true);

View File

@ -34,11 +34,12 @@ class Task extends BaseModel
'is_running',
'time_log',
'status_id',
'status_sort_order',
'status_sort_order', //deprecated
'invoice_documents',
'rate',
'number',
'is_date_based',
'status_order',
];
protected $touches = [];

View File

@ -29,5 +29,5 @@ class TaskStatus extends BaseModel
*/
protected $dates = ['deleted_at'];
protected $fillable = ['name','color'];
protected $fillable = ['name','color','status_order'];
}

View File

@ -42,8 +42,9 @@ class TaskRepository extends BaseRepository
$task->description = trim($data['description']);
}
if (isset($data['status_sort_order'])) {
$task->status_sort_order = $data['status_sort_order'];
//todo i can't set it - i need to calculate it.
if (isset($data['status_order'])) {
$task->status_order = $data['status_order'];
}
if (isset($data['time_log'])) {

View File

@ -24,11 +24,12 @@ class TaskStatusTransformer extends EntityTransformer
'id' => (string) $this->encodePrimaryKey($task_status->id),
'name' => (string) $task_status->name,
'color' => (string) $task_status->color,
'sort_order' => (int) $task_status->sort_order,
'sort_order' => (int) $task_status->sort_order, //deprecated
'is_deleted' => (bool) $task_status->is_deleted,
'created_at' => (int) $task_status->created_at,
'updated_at' => (int) $task_status->updated_at,
'archived_at' => (int) $task_status->deleted_at,
'status_order' => $task_status->status_order,
];
}
}

View File

@ -65,8 +65,9 @@ class TaskTransformer extends EntityTransformer
'custom_value3' => $task->custom_value3 ?: '',
'custom_value4' => $task->custom_value4 ?: '',
'status_id' => $this->encodePrimaryKey($task->status_id) ?: '',
'status_sort_order' => (int) $task->status_sort_order,
'status_sort_order' => (int) $task->status_sort_order, //deprecated 5.0.34
'is_date_based' => (bool) $task->is_date_based,
'status_order' => $task->status_order
];
}
}

View File

@ -110,6 +110,11 @@ class ImproveDecimalResolution extends Migration
$table->integer('status_sort_order')->nullable()->default(null)->change();
});
Schema::table('task_statuses', function (Blueprint $table){
$table->string('color')->default('#fff');
$table->integer('status_sort_order')->nullable()->default(null)->change();
});
Schema::table('tax_rates', function (Blueprint $table) {
$table->decimal('rate', 20, 6)->change();
});
@ -119,11 +124,6 @@ class ImproveDecimalResolution extends Migration
$table->boolean('hide_empty_columns_on_pdf')->false();
});
Schema::table('task_statuses', function (Blueprint $table){
$table->string('color')->default('#fff');
$table->integer('status_sort_order')->nullable()->default(null)->change();
});
Schema::table('expense_categories', function (Blueprint $table){
$table->string('color')->default('#fff');
});
@ -136,6 +136,14 @@ class ImproveDecimalResolution extends Migration
Task::query()->update(['status_sort_order' => NULL]);
TaskStatus::query()->update(['status_sort_order' => NULL]);
Schema::table('tasks', function (Blueprint $table) {
$table->integer('status_order')->nullable();
});
Schema::table('task_statuses', function (Blueprint $table){
$table->integer('status_order')->nullable();
});
}
/**