Fixed tag archival.
This commit is contained in:
parent
074a89e6b1
commit
1e80ed1394
2 changed files with 5 additions and 4 deletions
|
@ -156,12 +156,12 @@ switch ($_GET['v'] ?? null) {
|
||||||
$availableTags = $db->prepare('
|
$availableTags = $db->prepare('
|
||||||
SELECT `tag_id`, `tag_name`
|
SELECT `tag_id`, `tag_name`
|
||||||
FROM `msz_changelog_tags`
|
FROM `msz_changelog_tags`
|
||||||
WHERE `tag_id` NOT IN (
|
WHERE `tag_archived` IS NULL
|
||||||
|
AND `tag_id` NOT IN (
|
||||||
SELECT `tag_id`
|
SELECT `tag_id`
|
||||||
FROM `msz_changelog_change_tags`
|
FROM `msz_changelog_change_tags`
|
||||||
WHERE `change_id` = :change_id
|
WHERE `change_id` = :change_id
|
||||||
)
|
)
|
||||||
AND `tag_archived` IS NULL
|
|
||||||
');
|
');
|
||||||
$availableTags->bindValue('change_id', $change['change_id']);
|
$availableTags->bindValue('change_id', $change['change_id']);
|
||||||
$availableTags = $availableTags->execute() ? $availableTags->fetchAll(PDO::FETCH_ASSOC) : [];
|
$availableTags = $availableTags->execute() ? $availableTags->fetchAll(PDO::FETCH_ASSOC) : [];
|
||||||
|
@ -236,7 +236,8 @@ switch ($_GET['v'] ?? null) {
|
||||||
|
|
||||||
$updateTag->bindValue('name', $_POST['tag']['name']);
|
$updateTag->bindValue('name', $_POST['tag']['name']);
|
||||||
$updateTag->bindValue('description', $_POST['tag']['description']);
|
$updateTag->bindValue('description', $_POST['tag']['description']);
|
||||||
$updateTag->bindValue('archived', empty($_POST['tag']['description']) ? null : date('Y-m-d H:i:s'));
|
// this is fine, after being archived there shouldn't be any other changes being made
|
||||||
|
$updateTag->bindValue('archived', empty($_POST['tag']['archived']) ? null : date('Y-m-d H:i:s'));
|
||||||
$updateTag->execute();
|
$updateTag->execute();
|
||||||
|
|
||||||
if ($tagId < 1) {
|
if ($tagId < 1) {
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<label class="form__label">
|
<label class="form__label">
|
||||||
<div class="form__label__text">Archived</div>
|
<div class="form__label__text">Archived</div>
|
||||||
<div class="form__label__input">
|
<div class="form__label__input">
|
||||||
<input class="input" type="checkbox" name="tag[archived]"{% if edit_role is defined and edit_role.tag_archived is not null %} checked{% endif %}>
|
<input class="input" type="checkbox" name="tag[archived]"{% if edit_tag is defined and edit_tag.tag_archived is not null %} checked{% endif %}>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue