knowledgecenter: remove forum/product tabs and fix new-post errors
- post_cardform.php: remove Diskussion tab (forum module doesn't exist) - post_cardform_contacts.php: guard get_contact_cards AJAX so it doesn't fire with post_id=0 on new posts (caused "Ungültige Beitrags-ID" error) - post_cardform_settings.php: remove Produkte section entirely — the product/product_translation tables don't exist in this installation, which caused a fatal crash when opening the settings tab Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -373,7 +373,6 @@ if ($resLinkedForm && mysqli_num_rows($resLinkedForm) > 0) {
|
||||
<a href="#tab-article" class="active"><?= $translation->get("wiki_post") ?></a>
|
||||
<a href="#tab-files"><?= $translation->get("files") ?> (<?php echo $fileCount; ?>)</a>
|
||||
<a href="#tab-contacts"><?= $translation->get("Ansprechpartner") ?> (<?php echo $contactCount; ?>)</a>
|
||||
<a href="#tab-discussion"><?= $translation->get("Forum") ?> (<?php echo $commentCount; ?>)</a>
|
||||
<a href="#tab-versions"><?= $translation->get("version_history") ?> (<?php echo $versionCount; ?>)</a>
|
||||
<?php if (get_permission_state('r-wiki', $GLOBALS['main_contact']['master_mandant_id'], $GLOBALS['main_contact']['id']) == 1) { ?>
|
||||
<a href="#tab-settings"><?= $translation->get("settings") ?></a>
|
||||
@@ -437,18 +436,6 @@ if ($resLinkedForm && mysqli_num_rows($resLinkedForm) > 0) {
|
||||
require_once 'post_cardform_contacts.php';
|
||||
?>
|
||||
</div>
|
||||
<div id="tab-discussion" class="tab-content forum">
|
||||
<?php
|
||||
$forumView = __DIR__ . '/../../forum/Views/topic_listform.php';
|
||||
if (!$isNew && $postId > 0 && file_exists($forumView)) {
|
||||
$knowledgecenter_post_id = $postId;
|
||||
require_once $forumView;
|
||||
} else {
|
||||
echo '<p style="color:#6b7280;font-style:italic;padding:16px;">Diskussionsfunktion noch nicht verfügbar.</p>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<!-- Tab Content: Versionsgeschichte -->
|
||||
<div id="tab-versions" class="tab-content">
|
||||
<?php
|
||||
|
||||
@@ -91,6 +91,7 @@ if ($postId != 0) {
|
||||
});
|
||||
});
|
||||
|
||||
<?php if ($postId > 0): ?>
|
||||
// Direktes Laden und Anzeigen der Visitenkarten per AJAX beim Laden der Seite
|
||||
$(document).ready(function () {
|
||||
$.post("/module/knowledgecenter_update/Ajax/Ajax.php", {
|
||||
@@ -108,4 +109,5 @@ if ($postId != 0) {
|
||||
$("#contactCards").html('<p>Ein Fehler ist aufgetreten.</p>');
|
||||
});
|
||||
});
|
||||
<?php endif; ?>
|
||||
</script>
|
||||
@@ -163,32 +163,6 @@ if ($postId != 0) {
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------- Produkte für Post --------------------
|
||||
$productsData = [];
|
||||
$query = "SELECT p.id, pt.title
|
||||
FROM product AS p
|
||||
JOIN product_translation AS pt
|
||||
ON p.id = pt.product_id
|
||||
WHERE pt.language_id = $languageId";
|
||||
$result = mysqli_query($GLOBALS['mysql_con'], $query);
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
$productsData[] = ['value' => $row['id'], 'name' => $row['title']];
|
||||
}
|
||||
$selectedProducts = [];
|
||||
if ($postId != 0) {
|
||||
$querySelected = "SELECT p.id, pt.title
|
||||
FROM product_knowledgecenter_post_link AS pl
|
||||
JOIN product AS p ON pl.product_id = p.id
|
||||
JOIN product_translation AS pt
|
||||
ON p.id = pt.product_id
|
||||
WHERE pl.post_id = $postId
|
||||
AND pt.language_id = $languageId";
|
||||
$resultSelected = mysqli_query($GLOBALS['mysql_con'], $querySelected);
|
||||
while ($row = mysqli_fetch_assoc($resultSelected)) {
|
||||
$selectedProducts[] = ['value' => $row['id'], 'name' => $row['title']];
|
||||
}
|
||||
}
|
||||
|
||||
$postBackgroundColor = '#FFFFFF';
|
||||
if (!empty($post['background_color'])) {
|
||||
$postBackgroundColor = $post['background_color'];
|
||||
@@ -269,11 +243,6 @@ if (!empty($post['text_color'])) {
|
||||
<input type="text" id="postFachbereichTags" name="postFachbereiche" placeholder="Fachbereich hinzufügen…" />
|
||||
</div>
|
||||
|
||||
<h3><?=$translation->get("products")?></h3>
|
||||
<div class="settings_container">
|
||||
<input type="text" id="postProductTags" name="postProducts" placeholder="<?=$translation->get("products")?>…" />
|
||||
</div>
|
||||
|
||||
<h3>Formular auswählen</h3>
|
||||
<div class="settings_container">
|
||||
<select name="postFormSelect" id="postFormSelect">
|
||||
@@ -318,9 +287,6 @@ if (!empty($post['text_color'])) {
|
||||
var selectedPostRoles = <?php echo json_encode($selectedPostRoles); ?>;
|
||||
var selectedPostEinrichts = <?php echo json_encode($selectedPostEinrichts); ?>;
|
||||
var selectedPostFachbereiche = <?php echo json_encode($selectedPostFachbereiche); ?>;
|
||||
var productsData = <?php echo json_encode($productsData); ?>;
|
||||
var selectedProducts = <?php echo json_encode($selectedProducts); ?>;
|
||||
|
||||
var categoryEnableColorMap = {};
|
||||
categoriesData.forEach(function (cat) {
|
||||
categoryEnableColorMap[String(cat.value)] = parseInt(cat.enable_post_color_pickers || 0, 10) === 1;
|
||||
@@ -458,25 +424,6 @@ if (!empty($post['text_color'])) {
|
||||
tagifyPostFachbereiche.addTags(selectedPostFachbereiche);
|
||||
}
|
||||
|
||||
// Produkte für Post
|
||||
var tagifyPostProducts = new Tagify(document.getElementById('postProductTags'), {
|
||||
whitelist: productsData,
|
||||
tagTextProp: 'name',
|
||||
enforceWhitelist: true,
|
||||
dropdown: { enabled: 0, maxItems: Infinity, searchKeys: ["name"] },
|
||||
templates: {
|
||||
dropdownItem: function (tagData) {
|
||||
return `<div ${this.getAttributes(tagData)} class="tagify__dropdown__item">
|
||||
<span>${tagData.name}</span>
|
||||
</div>`;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (selectedProducts.length) {
|
||||
tagifyPostProducts.addTags(selectedProducts);
|
||||
}
|
||||
|
||||
|
||||
<?php if (get_permission_state('r-wiki', $GLOBALS['main_contact']['master_mandant_id'], $GLOBALS['main_contact']['id']) == 1) { ?>
|
||||
$("#saveAllBtn").on("click", function () {
|
||||
// Während des Speicherns blurren
|
||||
@@ -538,11 +485,6 @@ if (!empty($post['text_color'])) {
|
||||
fachbereiche: JSON.stringify(selectedFachbereiche)
|
||||
}, "json"),
|
||||
|
||||
$.post("/module/knowledgecenter_update/Ajax/Ajax.php", {
|
||||
action: "update_post_products",
|
||||
post_id: postId,
|
||||
products: JSON.stringify(tagifyPostProducts.value.map(tag => tag.value))
|
||||
}, "json"),
|
||||
$.post("/module/knowledgecenter_update/Ajax/Ajax.php", {
|
||||
action: "update_post_pdf_inline",
|
||||
post_id: postId,
|
||||
@@ -554,7 +496,7 @@ if (!empty($post['text_color'])) {
|
||||
background_color: postBackgroundColor,
|
||||
text_color: postTextColor
|
||||
}, "json")
|
||||
).done(function (categoriesResponse, mandantsResponse, formResponse, departmentsResponse, rolesResponse, einrichtsResponse, fachbereicheResponse, productsResponse, pdfInlineResponse, postColorsResponse) {
|
||||
).done(function (categoriesResponse, mandantsResponse, formResponse, departmentsResponse, rolesResponse, einrichtsResponse, fachbereicheResponse, pdfInlineResponse, postColorsResponse) {
|
||||
var catSuccess = categoriesResponse[0].success;
|
||||
var mandantsSuccess = mandantsResponse[0].success;
|
||||
var formSuccess = formResponse[0].success;
|
||||
@@ -562,11 +504,10 @@ if (!empty($post['text_color'])) {
|
||||
var rolesSuccess = rolesResponse[0].success;
|
||||
var einrichtsSuccess = einrichtsResponse[0].success;
|
||||
var fachbereicheSuccess = fachbereicheResponse[0].success;
|
||||
var productsSuccess = productsResponse[0].success;
|
||||
var pdfInlineSuccess = pdfInlineResponse[0].success;
|
||||
var postColorsSuccess = postColorsResponse[0].success;
|
||||
|
||||
if (catSuccess && mandantsSuccess && formSuccess && departmentsSuccess && rolesSuccess && einrichtsSuccess && fachbereicheSuccess && productsSuccess && pdfInlineSuccess && postColorsSuccess) {
|
||||
if (catSuccess && mandantsSuccess && formSuccess && departmentsSuccess && rolesSuccess && einrichtsSuccess && fachbereicheSuccess && pdfInlineSuccess && postColorsSuccess) {
|
||||
showMessage("Alle Daten erfolgreich gespeichert!", true);
|
||||
} else {
|
||||
var errorMsg = "Fehler beim Speichern:";
|
||||
@@ -577,7 +518,6 @@ if (!empty($post['text_color'])) {
|
||||
if (!rolesSuccess) errorMsg += " Rollen";
|
||||
if (!einrichtsSuccess) errorMsg += " Einrichtungen";
|
||||
if (!fachbereicheSuccess) errorMsg += " Fachbereiche";
|
||||
if (!productsSuccess) errorMsg += " Produkte";
|
||||
if (!pdfInlineSuccess) errorMsg += " PDF Inline Vorschau";
|
||||
if (!postColorsSuccess) errorMsg += " Farben";
|
||||
showMessage(errorMsg, false);
|
||||
|
||||
Reference in New Issue
Block a user