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

Fix Client error when passing asset parameter to forms #814

Closed
wants to merge 0 commits into from

Conversation

mstenta
Copy link
Member

@mstenta mstenta commented Mar 27, 2024

Fixes #813

Copy link
Member

@paul121 paul121 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. This error does not happen if you use a query param like &asset=25 as when using the "Add observation log" action button from a single asset page.

But this error does happen when appending brackets to potentially indicate multiple asset IDs &asset[]=25. I hadn't heard of this deprecation, just wonder where else this may apply...

@mstenta
Copy link
Member Author

mstenta commented Mar 27, 2024

query param like &asset=25 as when using the "Add observation log" action button from a single asset page.

Oh good point @paul121.

I wonder if my fix breaks that case?

@mstenta
Copy link
Member Author

mstenta commented Mar 27, 2024

I wonder if my fix breaks that case?

Dang. Yes it does. Now I get "Client error" in that context.

mstenta added a commit to mstenta/farmOS that referenced this pull request Mar 27, 2024
@mstenta mstenta force-pushed the 3.x-fix-add-log-client-error branch from c52bd85 to b5a24a2 Compare March 27, 2024 15:32
@mstenta
Copy link
Member Author

mstenta commented Mar 27, 2024

OK, I reworked the logic so that it works with both single value asset parameters as well as arrays.

It's a bit annoying because $query->all('asset') errors when it isn't an array and $query->get('asset') errors when it is an array. But $query->all() gives me a keyed array of ALL parameters, which I can use to get asset in both cases. 🙄

@mstenta
Copy link
Member Author

mstenta commented Mar 27, 2024

mstenta added a commit to mstenta/farmOS that referenced this pull request Mar 27, 2024
@mstenta mstenta force-pushed the 3.x-fix-add-log-client-error branch from 6670d07 to 9447b42 Compare March 27, 2024 15:54
@mstenta mstenta changed the title Fix Client error using the "Add log" bulk action Fix Client error when passing asset parameter to forms Mar 27, 2024
@mstenta mstenta requested a review from paul121 March 27, 2024 15:54
@mstenta
Copy link
Member Author

mstenta commented Mar 27, 2024

Merged.

@mstenta mstenta deleted the 3.x-fix-add-log-client-error branch March 27, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Client error using the "Add log" bulk action
2 participants