Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add budget and timeBudget to class CustomerEditForm #1

Closed
wants to merge 1 commit into from

Conversation

MPW1412
Copy link
Contributor

@MPW1412 MPW1412 commented May 16, 2020

Hello,

budget and timeBudget are required fields in the Kimai Rest API to create a new customer.

Workaround: Export the CustomerEditForm.to_dict and append the fields.

Best,
Matthias

@kevinpapst
Copy link

kevinpapst commented May 16, 2020

I am certain that they are not required.

First of all: these fields are only visible to users with the budget_customer permission.
If you add them for users without that permission, the call will fail with validation error ("this form should not contain extra fields").

And if the users has this permission, then they are not required :
https://github.com/kevinpapst/kimai2/blob/master/src/Form/EntityFormTrait.php#L33

@MPW1412
Copy link
Contributor Author

MPW1412 commented May 17, 2020

Well, I got this when trying to create a customer via the API:

HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'X-Powered-By': 'PHP/7.4.5', 'Transfer-Encoding': 'chunked', 'Set-Cookie': 'PHPSESSID=nf3f4afk3o7o7kvg1f12qq4one; path=/; HttpOnly', 'Connection': 'keep-alive', 'Cache-Control': 'max-age=0, must-revalidate, private', 'Server': 'nginx', 'pragma': 'no-cache', 'Date': 'Sat, 16 May 2020 23:08:32 GMT', 'Expires': 'Sat, 16 May 2020 23:08:32 GMT'})
HTTP response body: {"code":400,"message":"Validation Failed","errors":{"children":{"name":{},"number":{},"comment":{},"company":{},"vatId":{},"contact":{},"address":{},"country":{},"currency":{},"phone":{},"fax":{},"mobile":{},"email":{},"homepage":{},"timezone":{},"color":{},"budget":{"errors":["This value should not be null."]},"timeBudget":{"errors":["This value should not be null."]},"visible":{}}}}

After adding those fields, it worked.

As those fields exist the CustomerEditForm should be extended by these values, optional or not.

@kevinpapst
Copy link

I just tested it: the form behaves wrong in the API, you should not be forced to set a value for these fields. The project and activity endpoint are affected as well.

Introduced by: kimai/kimai#1658

Can you please raise a bug report in the Kimai repo?

@MPW1412
Copy link
Contributor Author

MPW1412 commented May 17, 2020

Done: kimai/kimai#1713

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants