support custom fields for timesheets, customers, projects and activities (#871)
This commit is contained in:
@@ -29,7 +29,7 @@ kimai:
|
||||
|
||||
# The time-tracking mode that should be used.
|
||||
# See https://www.kimai.org/documentation/timesheet.html#tracking-modes
|
||||
mode: default
|
||||
# mode: default
|
||||
|
||||
# The default time to pre-fill the "create timesheet" form (in some cases).
|
||||
# This setting is only respected by some timetracking modes and not in all situations.
|
||||
|
||||
@@ -2,17 +2,21 @@ nelmio_api_doc:
|
||||
models:
|
||||
use_jms: true
|
||||
names:
|
||||
- { alias: CustomerEditForm, type: App\Form\CustomerEditForm, groups: [Default, Entity, Customer] }
|
||||
- { alias: CustomerEditForm, type: App\Form\API\CustomerApiEditForm, groups: [Default, Entity, Customer] }
|
||||
- { alias: CustomerEntity, type: App\Entity\Customer, groups: [Default, Entity, Customer] }
|
||||
- { alias: CustomerMetaField, type: App\Entity\CustomerMeta, groups: [Default, Customer] }
|
||||
- { alias: CustomerCollection, type: App\Entity\Customer, groups: [Default, Collection, Customer] }
|
||||
- { alias: ProjectEditForm, type: App\Form\ProjectEditForm, groups: [Default, Entity, Project] }
|
||||
- { alias: ProjectEditForm, type: App\Form\API\ProjectApiEditForm, groups: [Default, Entity, Project] }
|
||||
- { alias: ProjectEntity, type: App\Entity\Project, groups: [Default, Entity, Project] }
|
||||
- { alias: ProjectMetaField, type: App\Entity\ProjectMeta, groups: [Default, Project] }
|
||||
- { alias: ProjectCollection, type: App\Entity\Project, groups: [Default, Collection, Project] }
|
||||
- { alias: ActivityEditForm, type: App\Form\ActivityEditForm, groups: [Default, Entity, Activity] }
|
||||
- { alias: ActivityEditForm, type: App\Form\API\ActivityApiEditForm, groups: [Default, Entity, Activity] }
|
||||
- { alias: ActivityEntity, type: App\Entity\Activity, groups: [Default, Entity, Activity] }
|
||||
- { alias: ActivityMetaField, type: App\Entity\ActivityMeta, groups: [Default, Activity] }
|
||||
- { alias: ActivityCollection, type: App\Entity\Activity, groups: [Default, Collection, Activity] }
|
||||
- { alias: TimesheetEditForm, type: App\Form\TimesheetEditForm, groups: [Default, Entity, Timesheet] }
|
||||
- { alias: TimesheetEditForm, type: App\Form\API\TimesheetApiEditForm, groups: [Default, Entity, Timesheet] }
|
||||
- { alias: TimesheetEntity, type: App\Entity\Timesheet, groups: [Default, Entity, Timesheet] }
|
||||
- { alias: TimesheetMeta, type: App\Entity\TimesheetMeta, groups: [Default, Timesheet] }
|
||||
- { alias: TimesheetCollection, type: App\Entity\Timesheet, groups: [Default, Collection, Timesheet] }
|
||||
- { alias: TimesheetSubCollection, type: App\Entity\Timesheet, groups: [Default, Subresource, Timesheet] }
|
||||
- { alias: UserEntity, type: App\Entity\User, groups: [Default, Entity, User] }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
App\Entity\Activity:
|
||||
exclusion_policy: All
|
||||
custom_accessor_order: [id, name, comment, visible, project, fixedRate, hourlyRate, color, budget, timeBudget]
|
||||
custom_accessor_order: [id, name, comment, visible, project, fixedRate, hourlyRate, color, budget, timeBudget, metaFields]
|
||||
properties:
|
||||
id:
|
||||
include: true
|
||||
@@ -32,9 +32,16 @@ App\Entity\Activity:
|
||||
groups: [Default]
|
||||
color:
|
||||
include: true
|
||||
metaFields:
|
||||
exclude: true
|
||||
virtual_properties:
|
||||
getProject:
|
||||
serialized_name: project
|
||||
exp: "object.getProject() === null ? null : object.getProject().getId()"
|
||||
type: integer
|
||||
groups: [Default]
|
||||
getMetaFields:
|
||||
serialized_name: metaFields
|
||||
exp: "object.getVisibleMetaFields()"
|
||||
type: array<App\Entity\ActivityMeta>
|
||||
groups: [Default]
|
||||
|
||||
15
config/serializer/App/Entity.ActivityMeta.yml
Normal file
15
config/serializer/App/Entity.ActivityMeta.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
App\Entity\ActivityMeta:
|
||||
exclusion_policy: All
|
||||
custom_accessor_order: [name, value]
|
||||
properties:
|
||||
name:
|
||||
include: false
|
||||
value:
|
||||
include: false
|
||||
virtual_properties:
|
||||
getName:
|
||||
serialized_name: name
|
||||
exp: "object.isVisible() ? object.getName() : null"
|
||||
getValue:
|
||||
serialized_name: value
|
||||
exp: "object.isVisible() ? object.getValue() : null"
|
||||
@@ -1,6 +1,6 @@
|
||||
App\Entity\Customer:
|
||||
exclusion_policy: All
|
||||
custom_accessor_order: [id, name, number, comment, visible, company, contact, address, country, currency, phone, fax, mobile, email, homepage, timezone, fixedRate, hourlyRate, color, budget, timeBudget]
|
||||
custom_accessor_order: [id, name, number, comment, visible, company, contact, address, country, currency, phone, fax, mobile, email, homepage, timezone, fixedRate, hourlyRate, color, budget, timeBudget, metaFields]
|
||||
properties:
|
||||
id:
|
||||
include: true
|
||||
@@ -61,3 +61,11 @@ App\Entity\Customer:
|
||||
groups: [Customer]
|
||||
color:
|
||||
include: true
|
||||
metaFields:
|
||||
exclude: true
|
||||
virtual_properties:
|
||||
getMetaFields:
|
||||
serialized_name: metaFields
|
||||
exp: "object.getVisibleMetaFields()"
|
||||
type: array<App\Entity\CustomerMeta>
|
||||
groups: [Default]
|
||||
|
||||
15
config/serializer/App/Entity.CustomerMeta.yml
Normal file
15
config/serializer/App/Entity.CustomerMeta.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
App\Entity\CustomerMeta:
|
||||
exclusion_policy: All
|
||||
custom_accessor_order: [name, value]
|
||||
properties:
|
||||
name:
|
||||
include: false
|
||||
value:
|
||||
include: false
|
||||
virtual_properties:
|
||||
getName:
|
||||
serialized_name: name
|
||||
exp: "object.isVisible() ? object.getName() : null"
|
||||
getValue:
|
||||
serialized_name: value
|
||||
exp: "object.isVisible() ? object.getValue() : null"
|
||||
@@ -1,6 +1,6 @@
|
||||
App\Entity\Project:
|
||||
exclusion_policy: All
|
||||
custom_accessor_order: [id, name, comment, visible, orderNumber, customer, fixedRate, hourlyRate, color, budget, timeBudget]
|
||||
custom_accessor_order: [id, name, comment, visible, orderNumber, customer, fixedRate, hourlyRate, color, budget, timeBudget, metaFields]
|
||||
properties:
|
||||
id:
|
||||
include: true
|
||||
@@ -30,9 +30,16 @@ App\Entity\Project:
|
||||
groups: [Subresource]
|
||||
color:
|
||||
include: true
|
||||
metaFields:
|
||||
exclude: true
|
||||
virtual_properties:
|
||||
getCustomer:
|
||||
serialized_name: customer
|
||||
exp: "object.getCustomer() === null ? null : object.getCustomer().getId()"
|
||||
type: integer
|
||||
groups: [Entity, Collection]
|
||||
getMetaFields:
|
||||
serialized_name: metaFields
|
||||
exp: "object.getVisibleMetaFields()"
|
||||
type: array<App\Entity\ProjectMeta>
|
||||
groups: [Default]
|
||||
|
||||
15
config/serializer/App/Entity.ProjectMeta.yml
Normal file
15
config/serializer/App/Entity.ProjectMeta.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
App\Entity\ProjectMeta:
|
||||
exclusion_policy: All
|
||||
custom_accessor_order: [name, value]
|
||||
properties:
|
||||
name:
|
||||
include: false
|
||||
value:
|
||||
include: false
|
||||
virtual_properties:
|
||||
getName:
|
||||
serialized_name: name
|
||||
exp: "object.isVisible() ? object.getName() : null"
|
||||
getValue:
|
||||
serialized_name: value
|
||||
exp: "object.isVisible() ? object.getValue() : null"
|
||||
@@ -1,6 +1,6 @@
|
||||
App\Entity\Timesheet:
|
||||
exclusion_policy: All
|
||||
custom_accessor_order: [id, begin, end, duration, rate, activity, project, user, description, fixedRate, hourlyRate, tags, exported]
|
||||
custom_accessor_order: [id, begin, end, duration, rate, activity, project, user, description, fixedRate, hourlyRate, tags, exported, metaFields]
|
||||
properties:
|
||||
id:
|
||||
include: true
|
||||
@@ -29,6 +29,8 @@ App\Entity\Timesheet:
|
||||
groups: [Subresource]
|
||||
user:
|
||||
exclude: true
|
||||
metaFields:
|
||||
exclude: true
|
||||
virtual_properties:
|
||||
getBegin:
|
||||
serialized_name: begin
|
||||
@@ -53,6 +55,11 @@ App\Entity\Timesheet:
|
||||
exp: "object.getUser().getId()"
|
||||
type: integer
|
||||
getTags:
|
||||
serialized_name: tags
|
||||
exp: "object.getTagsAsArray()"
|
||||
type: array<string>
|
||||
serialized_name: tags
|
||||
exp: "object.getTagsAsArray()"
|
||||
type: array<string>
|
||||
getMetaFields:
|
||||
serialized_name: metaFields
|
||||
exp: "object.getVisibleMetaFields()"
|
||||
type: array<App\Entity\TimesheetMeta>
|
||||
groups: [Default]
|
||||
|
||||
15
config/serializer/App/Entity.TimesheetMeta.yml
Normal file
15
config/serializer/App/Entity.TimesheetMeta.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
App\Entity\TimesheetMeta:
|
||||
exclusion_policy: All
|
||||
custom_accessor_order: [name, value]
|
||||
properties:
|
||||
name:
|
||||
include: false
|
||||
value:
|
||||
include: false
|
||||
virtual_properties:
|
||||
getName:
|
||||
serialized_name: name
|
||||
exp: "object.isVisible() ? object.getName() : null"
|
||||
getValue:
|
||||
serialized_name: value
|
||||
exp: "object.isVisible() ? object.getValue() : null"
|
||||
Reference in New Issue
Block a user