Commit 590963df authored by Guinness's avatar Guinness Committed by Okhin

Remove an address from the admin page.

Refers #26
parent 0bd91f82
...@@ -755,6 +755,26 @@ class Admin extends Controller ...@@ -755,6 +755,26 @@ class Admin extends Controller
$f3->set('block_content', 'backend/contrepartie.html'); $f3->set('block_content', 'backend/contrepartie.html');
} }
public function adresse($f3, $args) {
$id = '';
$user_id = '';
$db = $f3->get('DB');
if ($f3->get('VERB') == 'POST') {
$id = \Utils::asl($f3->get('POST.id'));
}
$result = $db->query("SELECT user_id FROM adresses WHERE id = $id");
$result = $result->fetch(\PDO::FETCH_ASSOC);
$user_id = \Utils::asl($result["user_id"]);
$db->query("UPDATE dons SET adresse_id = NULL
WHERE user_id = $user_id");
$db->query("UPDATE contreparties SET adresse_id = NULL
WHERE user_id = $user_id");
$db->query("DELETE FROM adresses
WHERE id = $id"
);
$f3->reroute("/admin/users/$user_id");
}
public function user($f3, $args) public function user($f3, $args)
{ {
$id = array_key_exists('id', $args) ? \Utils::asl($args['id']) : ''; $id = array_key_exists('id', $args) ? \Utils::asl($args['id']) : '';
......
...@@ -196,13 +196,15 @@ ...@@ -196,13 +196,15 @@
</check> </check>
</td> </td>
<td> <td>
<check if="{{ @row.pdf != '' }}"> <check if="{{ @row.pdf == '' }}">
<true><a href="{{ @PIPLOME_URL }}{{ @row.pdf }}.pdf">{{ @row.pdf }}</a>( {{@user.adresses[@row.adresse_id].nom }})</td> <true>
</true> <a href="/cron/piplome/{{ @row.id }}">PDF</a>
<false> </true>
&nbsp; <false>
</false> <a href="{{ PIPLOME_URL }}/{{ @row.pdf }}.pdf" target="_blank">PDF</a>
</check> </false>
</check>
</td>
<td class="inline">{{ @DONS_STATUTS[@row.status] }}</td> <td class="inline">{{ @DONS_STATUTS[@row.status] }}</td>
<td> <td>
<a href="{{ 'edit_support', 'id='.@row.id | alias }}">Editer</a> <a href="{{ 'edit_support', 'id='.@row.id | alias }}">Editer</a>
...@@ -214,12 +216,6 @@ ...@@ -214,12 +216,6 @@
<false> <false>
<a href="{{ 'invalidate_support', 'id='.@row.id | alias }}">Invalider</a> <a href="{{ 'invalidate_support', 'id='.@row.id | alias }}">Invalider</a>
- -
<check if="{{ @row.pdf == '' }}">
<a href="/cron/piplome/{{ @row.id }}">PDF</a>
<false>
<a href="{{ PIPLOME_URL }}/{{ @row.pdf }}.pdf" target="_blank">PDF</a>
</false>
</check>
</false> </false>
</check> </check>
</td> </td>
......
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