issue: populate ticket data before reply include v4.2
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 26 Nov 2019 16:24:05 +0000 (17:24 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 27 Nov 2019 12:27:51 +0000 (13:27 +0100)
Reorder in commit v4.1-34-gc83e7f0379 (2019-11-25) [issue: include replies
before issue retrieval] breaks admin features due to missing $Issue.
Update row data on update instead.

issue/index.php
widget/reply.php

index 1e7bba552f4c2b739f666b30a0efc482e170ceca..cefe00f363f8765f22faa649267ebfbab2efe751 100644 (file)
@@ -6,13 +6,13 @@ require_once 'database.inc.php';
 if ($id and ctype_digit($id)) {
        $Article->title = "Issue #$id";
        $Args = "/$id";  # minimal reference
-       $replies = placeholder_include('reply');  # handle before retrieval
-
        $Issue = $Db->query(
                'SELECT * FROM issues WHERE page = ? AND id = ?', [$Page, $id]
        )->fetch();
        if (!$Issue) throw new Exception('Issuenummer niet gevonden');
 
+       $replies = placeholder_include('reply');  # handle updates
+
        $Article->title .= ': '.htmlspecialchars($Issue->subject);
        print "<h2>{$Article->title}</h2>\n";
        print "<dl class=\"aside right sidebar\">\n";
index 94018c4e2492606caaa4845a58d78f23bf1b5b1e..fd01a947f81acb6748fb300b2bac7f00788216ef 100644 (file)
@@ -46,6 +46,7 @@ if ($_POST) {
                                                'value'      => $updated->$col,
                                        ]);
                                }
+                               $Issue = $updated;
                        }
                }
                $_POST['reply'] = NULL;