You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When performing a batch action with a confirmation page, there is an inconsistency what the user will get in the confirm vs what sonata will really do.
Steps to reproduce
Take any admin list with a couple of records, select one of them, then select "all records" checkbox by the batch actions and click any batch action with a confirmation page (batch delete will do). The confirmation page will show 'you are about to delete all elements. Proceed?'
This is not surprising, as the template admin-bundle/src/Resources/views/CRUD/batch_confirmation.html.twig states:
<div class="box-body">
{% if data.all_elements %}
{{ 'message_batch_all_confirmation'|trans({}, 'SonataAdminBundle') }}
{% else %}
{% trans with {'%count%': data.idx|length} from 'SonataAdminBundle' %}message_batch_confirmation{% endtrans %}
{% endif %}
</div>
so check if the 'all elements' checkbox is checked, if yes - message_batch_all_confirmation
but in the controller admin-bundle/src/Controller/CRUDController.php
so the controller adds the identifiers even if all elements is selected, and this implies that a sequence of AND and OR statements is added to the query.
Expected results
I would expect, that sonata will delete all elements, as the confirmation page stated that it will do so
Actual results
Sonata will delete only the one selected element
The question is - should Sonata prioritize all elements and the controller should be corrected, or should idx be prioritized and the confirmation page should be addjusted
I'm happy to help with the fix, but a decision needs to be made
The text was updated successfully, but these errors were encountered:
Take any admin list with a couple of records, select one of them, then select "all records" checkbox by the batch actions and click any batch action with a confirmation page (batch delete will do). The confirmation page will show 'you are about to delete all elements. Proceed?'
I consider it should delete all elements then, so controller should be corrected.
This commit fixes inconsistent behavior observed when both
'all_elements' and individual list rows are selected
simultaneously before executing a batch action. The resolved
behavior is detailed in sonata-project#8168.
Subject
When performing a batch action with a confirmation page, there is an inconsistency what the user will get in the confirm vs what sonata will really do.
Steps to reproduce
Take any admin list with a couple of records, select one of them, then select "all records" checkbox by the batch actions and click any batch action with a confirmation page (batch delete will do). The confirmation page will show 'you are about to delete all elements. Proceed?'
This is not surprising, as the template
admin-bundle/src/Resources/views/CRUD/batch_confirmation.html.twig
states:so check if the 'all elements' checkbox is checked, if yes - message_batch_all_confirmation
but in the controller
admin-bundle/src/Controller/CRUDController.php
we have
so the controller adds the identifiers even if all elements is selected, and this implies that a sequence of AND and OR statements is added to the query.
Expected results
I would expect, that sonata will delete all elements, as the confirmation page stated that it will do so
Actual results
Sonata will delete only the one selected element
The question is - should Sonata prioritize all elements and the controller should be corrected, or should idx be prioritized and the confirmation page should be addjusted
I'm happy to help with the fix, but a decision needs to be made
The text was updated successfully, but these errors were encountered: