Fix article quantity bug and session timeout
All checks were successful
Docker Build & Push / build-and-push (push) Successful in 1m38s
All checks were successful
Docker Build & Push / build-and-push (push) Successful in 1m38s
- Fixed article quantity handling in packing lists (drag and drop). - Resolved 'headers already sent' bug in backpacks.php. - Increased PHP session timeout to 24 hours via .htaccess. - Synced .gitea/workflows/build-push.yaml template.
This commit is contained in:
3
src/.htaccess
Normal file
3
src/.htaccess
Normal file
@@ -0,0 +1,3 @@
|
||||
php_value session.gc_maxlifetime 86400
|
||||
php_value session.cookie_lifetime 86400
|
||||
php_value session.cache_expire 86400
|
||||
@@ -2,13 +2,18 @@
|
||||
// backpacks.php - Verwaltung der Rucksäcke
|
||||
$page_title = "Rucksäcke";
|
||||
require_once 'db_connect.php';
|
||||
require_once 'header.php';
|
||||
|
||||
if (session_status() == PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'header.php';
|
||||
|
||||
$user_id = $_SESSION['user_id'];
|
||||
$message = '';
|
||||
|
||||
|
||||
@@ -286,11 +286,23 @@ $conn->close();
|
||||
const filterCategory = document.getElementById('filter-category').value;
|
||||
const filterManufacturer = document.getElementById('filter-manufacturer').value;
|
||||
const availableListEl = document.getElementById('available-items-list');
|
||||
const packedArticleIds = packedItems.map(item => String(item.article_id));
|
||||
|
||||
const packedQuantities = {};
|
||||
packedItems.forEach(item => {
|
||||
const aid = String(item.article_id);
|
||||
packedQuantities[aid] = (packedQuantities[aid] || 0) + parseInt(item.quantity || 1, 10);
|
||||
});
|
||||
|
||||
let html = '';
|
||||
allArticles.forEach(article => {
|
||||
if (article.parent_article_id) return;
|
||||
if (article.consumable == 1 || !packedArticleIds.includes(String(article.id))) {
|
||||
|
||||
const aid = String(article.id);
|
||||
const packedQty = packedQuantities[aid] || 0;
|
||||
const ownedQty = parseInt(article.quantity_owned || 1, 10);
|
||||
const isConsumable = article.consumable == 1;
|
||||
|
||||
if (isConsumable || packedQty < ownedQty) {
|
||||
const matchesText = article.name.toLowerCase().includes(filterText) || (article.manufacturer_name && article.manufacturer_name.toLowerCase().includes(filterText)) || (article.product_designation && article.product_designation.toLowerCase().includes(filterText));
|
||||
const matchesCategory = !filterCategory || article.category_name === filterCategory;
|
||||
const matchesManufacturer = !filterManufacturer || article.manufacturer_name === filterManufacturer;
|
||||
|
||||
Reference in New Issue
Block a user