Add new fields to items: id_code, image, location; implement QR code generation and printing; update translations and UI
This commit is contained in:
24
fix_db.php
Normal file
24
fix_db.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
require __DIR__ . '/config.php';
|
||||
|
||||
use App\Database;
|
||||
use App\Models\Category;
|
||||
|
||||
$db = Database::getInstance();
|
||||
|
||||
$categories = Category::getAll($db);
|
||||
|
||||
foreach ($categories as $cat) {
|
||||
$path = Category::getFullPath($db, $cat['id']);
|
||||
if (strpos($path, '[Circular]') !== false) {
|
||||
echo "Circular reference found for category {$cat['id']}: {$cat['name']}\n";
|
||||
// Reset parent_id to null
|
||||
$stmt = $db->prepare('UPDATE categories SET parent_id = NULL WHERE id = :id');
|
||||
$stmt->execute([':id' => $cat['id']]);
|
||||
echo "Fixed by setting parent_id to NULL\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "Done checking and fixing circular references.\n";
|
||||
Reference in New Issue
Block a user