Commit 555b53f2 authored by Sebastian Castro's avatar Sebastian Castro

Adds elements hard delete batch action

parent 62cb6983
......@@ -85,7 +85,7 @@ class ElementAdminList extends ElementAdminFilters
$actions = [];
$actions['validation'] = $this->createBatchConfig('Valider', 'validation');
$actions['refusal'] = $this->createBatchConfig('Refuser', 'refusal');
$actions['delete'] = $this->createBatchConfig('Supprimer', 'delete');
$actions['softDelete'] = $this->createBatchConfig('Supprimer (changement de status)', 'softDelete');
$actions['restore'] = $this->createBatchConfig('Restaurer', 'restore');
$actions['resolveReports'] = $this->createBatchConfig('Résoudre la modération', 'resolveReports');
......@@ -108,6 +108,7 @@ class ElementAdminList extends ElementAdminFilters
['type' => 'choice', 'choices' => $this->optionsChoices, 'id' => 'optionsToAdd', 'label' => 'Catégories à ajouter'],
]
);
$actions['delete'] = ['label' => 'Supprimer définitivement'];
return $actions;
}
......
......@@ -42,16 +42,24 @@ class ElementAdminController extends Controller
// ------------ BATCH ACTIONS ---------------
public function batchActionDelete(ProxyQueryInterface $selectedModelQuery)
public function batchActionSoftDelete(ProxyQueryInterface $selectedModelQuery)
{
return $this->batchStatus('batchDeleteFunction', $selectedModelQuery, 'delete');
return $this->batchStatus('batchSoftDeleteFunction', $selectedModelQuery, 'delete');
}
public function batchDeleteFunction($elementActionService, $selectedModel, $sendMail, $comment)
public function batchSoftDeleteFunction($elementActionService, $selectedModel, $sendMail, $comment)
{
$elementActionService->delete($selectedModel, $sendMail, $comment);
}
public function batchActionDelete(ProxyQueryInterface $selectedModelQuery)
{
$selectedModelQuery->remove()->getQuery()->execute();
return new RedirectResponse(
$this->admin->generateUrl('list', array('filter' => $this->admin->getFilterParameters()))
);
}
public function batchActionRestore(ProxyQueryInterface $selectedModelQuery)
{
return $this->batchStatus('batchRestoreFunction', $selectedModelQuery, 'restore');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment