Files
crm.clientright.ru/check_comment_file.php

54 lines
2.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
require_once('config.inc.php');
require_once('include/database/PearDatabase.php');
$adb = PearDatabase::getInstance();
$commentId = 393368;
$attachmentId = 393370;
echo "=== ПРОВЕРКА СВЯЗИ ФАЙЛА С КОММЕНТАРИЕМ ===\n";
echo "Comment ID: $commentId\n";
echo "Attachment ID: $attachmentId\n\n";
// Проверяем связь в vtiger_seattachmentsrel
$query = "SELECT * FROM vtiger_seattachmentsrel WHERE crmid = ? AND attachmentsid = ?";
$result = $adb->pquery($query, array($commentId, $attachmentId));
echo "Связь в vtiger_seattachmentsrel: " . $adb->num_rows($result) . " записей\n";
// Проверяем данные комментария
$query = "SELECT * FROM vtiger_modcomments WHERE modcommentsid = ?";
$result = $adb->pquery($query, array($commentId));
if ($adb->num_rows($result) > 0) {
$row = $adb->fetchByAssoc($result);
echo "Комментарий найден: " . $row['commentcontent'] . "\n";
echo "Related to: " . $row['related_to'] . "\n";
} else {
echo "Комментарий НЕ найден!\n";
}
// Проверяем данные файла
$query = "SELECT * FROM vtiger_attachments WHERE attachmentsid = ?";
$result = $adb->pquery($query, array($attachmentId));
if ($adb->num_rows($result) > 0) {
$row = $adb->fetchByAssoc($result);
echo "Файл найден: " . $row['name'] . "\n";
echo "Path: " . $row['path'] . "\n";
echo "Type: " . $row['type'] . "\n";
} else {
echo "Файл НЕ найден!\n";
}
// Проверяем vtiger_crmentity для файла
$query = "SELECT * FROM vtiger_crmentity WHERE crmid = ?";
$result = $adb->pquery($query, array($attachmentId));
if ($adb->num_rows($result) > 0) {
$row = $adb->fetchByAssoc($result);
echo "CRM Entity для файла: setype=" . $row['setype'] . ", deleted=" . $row['deleted'] . "\n";
} else {
echo "CRM Entity для файла НЕ найдена!\n";
}
echo "\n=== КОНЕЦ ПРОВЕРКИ ===\n";
?>