Suppression de client : utilisation du formulaire générique
This commit is contained in:
parent
2d4052e984
commit
530f0886b3
|
@ -79,7 +79,7 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{else}
|
{else}
|
||||||
<h4>Cet utilisateur n'a pas de document associé.</h4>
|
<p class="alert block">Ce client n'a pas de document associé.</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{include file="admin/_foot.tpl"}
|
{include file="admin/_foot.tpl"}
|
|
@ -1,30 +1,15 @@
|
||||||
{include file="admin/_head.tpl" title="Supprimer un client — %s"|args:$plugin.nom current="plugin_%s"|args:$plugin.id js=0}
|
{include file="admin/_head.tpl" title="Supprimer un client — %s"|args:$plugin.nom current="plugin_%s"|args:$plugin.id js=0}
|
||||||
{include file="%s/templates/_menu_client.tpl"|args:$plugin_root current="client_supprimer"}
|
{include file="%s/templates/_menu_client.tpl"|args:$plugin_root current="client_supprimer"}
|
||||||
|
|
||||||
|
|
||||||
{form_errors}
|
|
||||||
|
|
||||||
{if !$deletable}
|
{if !$deletable}
|
||||||
<form method="post" action="{$self_url}">
|
<p class="error block">Ce/cette client·e ne peut pas être supprimé·e car des documents lui y sont liés.</p>
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<legend>Supprimer ce client ?</legend>
|
|
||||||
<h3 class="warning">
|
|
||||||
Êtes-vous sûr de vouloir supprimer le membre « {$client.nom} » ?
|
|
||||||
</h3>
|
|
||||||
<p class="alert">
|
|
||||||
<strong>Attention</strong> : cette action est irréversible.
|
|
||||||
</p>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<p class="submit">
|
|
||||||
{csrf_field key="delete_client_"|cat:$client.id}
|
|
||||||
<input type="submit" name="delete" value="Supprimer →" />
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
{else}
|
{else}
|
||||||
<p>Ce/cette client·e ne peut pas être supprimé·e car des documents lui y sont liés.</p>
|
|
||||||
|
{include file="common/delete_form.tpl"
|
||||||
|
legend="Supprimer ce client ?"
|
||||||
|
warning="Êtes-vous sûr de vouloir supprimer le client « %s » ?"|args:$client.nom
|
||||||
|
alert="Attention, cette action est irréversible."}
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{include file="admin/_foot.tpl"}
|
{include file="admin/_foot.tpl"}
|
|
@ -17,24 +17,13 @@ if (!$client)
|
||||||
throw new UserException("Ce client n'existe pas.");
|
throw new UserException("Ce client n'existe pas.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f('delete'))
|
$csrf_key = 'delete_client_'.$c->id;
|
||||||
{
|
|
||||||
$form->check('delete_client_'.$c->id);
|
|
||||||
|
|
||||||
if (!$form->hasErrors())
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$client->delete($c->id);
|
|
||||||
Utils::redirect(PLUGIN_URL . 'clients.php');
|
|
||||||
}
|
|
||||||
catch (UserException $e)
|
|
||||||
{
|
|
||||||
$form->addError($e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$form->runIf('delete', function () use ($client, $c) {
|
||||||
|
$client->delete($c->id);
|
||||||
|
}, $csrf_key, PLUGIN_URL . 'clients.php');
|
||||||
|
|
||||||
$tpl->assign('deletable', $client->isDeletable($id));
|
$tpl->assign('deletable', $client->isDeletable($id));
|
||||||
$tpl->assign('client', $c);
|
$tpl->assign('client', $c);
|
||||||
|
$tpl->assign(compact('csrf_key'));
|
||||||
$tpl->display(PLUGIN_ROOT . '/templates/client_supprimer.tpl');
|
$tpl->display(PLUGIN_ROOT . '/templates/client_supprimer.tpl');
|
||||||
|
|
Loading…
Reference in New Issue