Kina in the warehouse, Lumipunkte, new logo, versioned assets
Warehouse: Kina (the game currency) can be paid in and out, shown in its own box with the in-game coin icon (Icon_Currency_Coin_GoldNonbinding from the game client via aion2.app, since the wiki has none). It is a catalog item in the new "Währung" category, kept out of the item cards and totals, and allows up to a trillion per entry; warehouse_movements.quantity becomes BIGINT for that. A leftover "Kinah" entry is merged into "Kina". Beitragspunkte are renamed to Lumipunkte in every visible text, the coin is now lumipunkt.svg, and the schema sync also updates the descriptions of existing core permissions so the new name reaches the role editor. The sidebar, login page and mobile top bar show the new Lumina Ascendens logo, cropped and with its dark background made transparent. Scripts and the stylesheet are included with a ?v=<mtime> query (asset_url()), so browsers pick up new versions after an upload instead of running stale JavaScript - the cause of raid points not being saved. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
fe1561f4f7
commit
5f25e20900
27 changed files with 196 additions and 84 deletions
21
README.md
21
README.md
|
|
@ -26,11 +26,11 @@ und wird später ausgebaut. Fokus dieser Version ist der Mitglieder-/Admin-Berei
|
||||||
- Karte: interaktive Zoom-Karte aller Regionen (Verteron, Altgard, Elthen, Morheim, Poeta,
|
- Karte: interaktive Zoom-Karte aller Regionen (Verteron, Altgard, Elthen, Morheim, Poeta,
|
||||||
Ishalgen, Reshanta) mit Markern und Kategorie-Filtern, dazu Taktiken in Schritten, die
|
Ishalgen, Reshanta) mit Markern und Kategorie-Filtern, dazu Taktiken in Schritten, die
|
||||||
direkt auf die Karte gezeichnet werden
|
direkt auf die Karte gezeichnet werden
|
||||||
- Beitragspunkte: Punkte für Raids, Events und andere Aktivitäten an einzelne oder viele
|
- Lumipunkte: Punkte für Raids, Events und andere Aktivitäten an einzelne oder viele
|
||||||
Mitglieder vergeben, mit Rangliste und Verlauf
|
Mitglieder vergeben, mit Rangliste und Verlauf
|
||||||
- Lagerhaus: Bestand der Legion mit Einlagerungen (wer hat was wann überreicht) und Entnahmen
|
- Lagerhaus: Bestand der Legion mit Einlagerungen (wer hat was wann überreicht) und Entnahmen
|
||||||
(wann, optional an wen), Gegenstandsliste aus dem Aion-2-Wiki mit rund 2.300 Einträgen
|
(wann, optional an wen), Gegenstandsliste aus dem Aion-2-Wiki mit rund 2.300 Einträgen
|
||||||
- Anwesenheitsliste pro Raid (anwesend, abwesend, entschuldigt), automatische Beitragspunkte
|
- Anwesenheitsliste pro Raid (anwesend, abwesend, entschuldigt), automatische Lumipunkte
|
||||||
beim Archivieren und eine Discord-PN an die Raidleitung, sobald ein Raid beginnt
|
beim Archivieren und eine Discord-PN an die Raidleitung, sobald ein Raid beginnt
|
||||||
- Raids-Seite: zeigt anstehende Raid-Termine, Anforderungen, Gruppen und Anmeldungen,
|
- Raids-Seite: zeigt anstehende Raid-Termine, Anforderungen, Gruppen und Anmeldungen,
|
||||||
bezogen von einer externen API (`config.php: raids_api`), Filter Aktiv/Archiviert/Alle
|
bezogen von einer externen API (`config.php: raids_api`), Filter Aktiv/Archiviert/Alle
|
||||||
|
|
@ -403,7 +403,7 @@ anwesend, die Ersatzbank auf abwesend oder Abgemeldete auf entschuldigt. Wer dab
|
||||||
angemeldet zu sein, lässt sich als Mitglied nachtragen. **Speichern & als kontrolliert
|
angemeldet zu sein, lässt sich als Mitglied nachtragen. **Speichern & als kontrolliert
|
||||||
markieren** hält fest, wer die Liste wann geprüft hat. Die Raid-Karte zeigt danach „kontrolliert“,
|
markieren** hält fest, wer die Liste wann geprüft hat. Die Raid-Karte zeigt danach „kontrolliert“,
|
||||||
vorher nach Raidbeginn „noch nicht kontrolliert“. Wer kein Website-Konto mit Discord-Verknüpfung
|
vorher nach Raidbeginn „noch nicht kontrolliert“. Wer kein Website-Konto mit Discord-Verknüpfung
|
||||||
hat, steht mit in der Liste, kann aber keine Beitragspunkte bekommen.
|
hat, steht mit in der Liste, kann aber keine Lumipunkte bekommen.
|
||||||
|
|
||||||
Gespeichert wird in `raid_attendance` (je Raid und Discord-ID) und `raid_settings`. Die Raids
|
Gespeichert wird in `raid_attendance` (je Raid und Discord-ID) und `raid_settings`. Die Raids
|
||||||
selbst liegen weiter beim Bot, zugeordnet ist alles über die `raid_id` (= Discord-Nachrichten-ID).
|
selbst liegen weiter beim Bot, zugeordnet ist alles über die `raid_id` (= Discord-Nachrichten-ID).
|
||||||
|
|
@ -458,11 +458,11 @@ Einrichtung:
|
||||||
|
|
||||||
Fehlt einer der Werte, bleibt die Erinnerung aus, alles andere funktioniert trotzdem.
|
Fehlt einer der Werte, bleibt die Erinnerung aus, alles andere funktioniert trotzdem.
|
||||||
|
|
||||||
### Beitragspunkte
|
### Lumipunkte
|
||||||
|
|
||||||
Die Seite **Beitragspunkte** (`contributions.php`) vergibt Punkte an Mitglieder, für Raids,
|
Die Seite **Lumipunkte** (`contributions.php`) vergibt Punkte an Mitglieder, für Raids,
|
||||||
Events oder alles andere, was die Legion voranbringt. Ihr Symbol ist eine goldene Münze in
|
Events oder alles andere, was die Legion voranbringt. Ihr Symbol ist eine goldene Münze in
|
||||||
Herzform (`assets/images/beitragspunkt.svg`).
|
Herzform (`assets/images/lumipunkt.svg`).
|
||||||
|
|
||||||
- **Rangliste:** alle aktiven Mitglieder mit ihrem Punktestand als Karten, höchster zuerst.
|
- **Rangliste:** alle aktiven Mitglieder mit ihrem Punktestand als Karten, höchster zuerst.
|
||||||
Platz 1 bis 3 sind gold, silber und bronze umrandet, die eigene Karte hervorgehoben. Ein
|
Platz 1 bis 3 sind gold, silber und bronze umrandet, die eigene Karte hervorgehoben. Ein
|
||||||
|
|
@ -513,6 +513,15 @@ Die Seite **Lagerhaus** (`warehouse.php`) führt Buch über die Gegenstände der
|
||||||
lassen sich löschen. Eine Einlagerung, von der schon etwas entnommen wurde, erst nach der
|
lassen sich löschen. Eine Einlagerung, von der schon etwas entnommen wurde, erst nach der
|
||||||
passenden Entnahme.
|
passenden Entnahme.
|
||||||
|
|
||||||
|
**Kina** hat einen eigenen Kasten oben rechts: aktueller Bestand mit dem Kina-Symbol aus dem
|
||||||
|
Spiel und die Knöpfe **Einzahlen** und **Auszahlen**. Sie öffnen dieselben Dialoge, mit Kina
|
||||||
|
schon ausgewählt, samt von wem bzw. an wen. Kina ist in der Gegenstandsliste als „Kina“
|
||||||
|
(Kategorie Währung) geführt und erscheint nicht zwischen den Gegenständen. Pro Eintrag sind bis
|
||||||
|
zu einer Billion Kina möglich, bei Gegenständen bis zu einer Million. Das Symbol
|
||||||
|
(`assets/images/warehouse/icon_currency_kina.webp`) ist das handelbare Kina aus dem
|
||||||
|
Spielclient (`Icon_Currency_Coin_GoldNonbinding`), bezogen über aion2.app, weil das Wiki keins
|
||||||
|
führt.
|
||||||
|
|
||||||
Der Bestand wird nicht gespeichert, sondern immer aus den Bewegungen berechnet. Er kann
|
Der Bestand wird nicht gespeichert, sondern immer aus den Bewegungen berechnet. Er kann
|
||||||
deshalb nie vom Verlauf abweichen.
|
deshalb nie vom Verlauf abweichen.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ a:hover { color: var(--gold-hover); text-decoration: underline; }
|
||||||
|
|
||||||
.navbar-brand img {
|
.navbar-brand img {
|
||||||
display: block;
|
display: block;
|
||||||
height: 40px;
|
height: 46px;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,15 +92,16 @@ a:hover { color: var(--gold-hover); text-decoration: underline; }
|
||||||
|
|
||||||
.sidebar-brand a { display: block; }
|
.sidebar-brand a { display: block; }
|
||||||
|
|
||||||
/* Das Logo ist sehr breit (Seitenverhaeltnis 480:108). Mit fester Hoehe waere es breiter
|
/* Logo mit Emblem und Schriftzug (Seitenverhaeltnis etwa 5:2, Hintergrund transparent).
|
||||||
als die Sidebar und wuerde unten eine waagerechte Scrollleiste erzeugen - deshalb
|
Breite und Hoehe beide "auto" mit Obergrenzen - so bleibt das Seitenverhaeltnis erhalten,
|
||||||
skaliert es ueber die Breite und behaelt seine Hoehe nur als Obergrenze. */
|
egal welche Grenze greift, und es entsteht keine waagerechte Scrollleiste. */
|
||||||
.sidebar-brand img {
|
.sidebar-brand img {
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: auto;
|
||||||
max-width: 100%;
|
|
||||||
height: auto;
|
height: auto;
|
||||||
max-height: 56px;
|
max-width: 100%;
|
||||||
|
max-height: 80px;
|
||||||
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-brand a { color: var(--gold); }
|
.sidebar-brand a { color: var(--gold); }
|
||||||
|
|
@ -149,7 +150,7 @@ a:hover { color: var(--gold-hover); text-decoration: underline; }
|
||||||
|
|
||||||
.mobile-topbar-brand img {
|
.mobile-topbar-brand img {
|
||||||
display: block;
|
display: block;
|
||||||
height: 32px;
|
height: 36px;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2224,7 +2225,7 @@ a.page-link:hover { border-color: var(--gold); color: var(--gold); text-decorati
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- Beitragspunkte --- */
|
/* --- Lumipunkte --- */
|
||||||
|
|
||||||
.app-content.bg-contributions {
|
.app-content.bg-contributions {
|
||||||
background-image: linear-gradient(rgba(20, 20, 20, 0.7), rgba(20, 20, 20, 0.86)), url('/assets/images/Landscapes/web/landscape2-bg.jpg');
|
background-image: linear-gradient(rgba(20, 20, 20, 0.7), rgba(20, 20, 20, 0.86)), url('/assets/images/Landscapes/web/landscape2-bg.jpg');
|
||||||
|
|
@ -2523,7 +2524,7 @@ button.contribution-chip-remove:hover { background: none; color: var(--danger);
|
||||||
.contribution-own h3 { margin: 0 0 0.6rem; font-size: 1rem; }
|
.contribution-own h3 { margin: 0 0 0.6rem; font-size: 1rem; }
|
||||||
.contribution-limit-note { margin: 1rem 0 0; font-size: 0.85rem; }
|
.contribution-limit-note { margin: 1rem 0 0; font-size: 0.85rem; }
|
||||||
|
|
||||||
/* --- Raids: Anwesenheit und automatische Beitragspunkte --- */
|
/* --- Raids: Anwesenheit und automatische Lumipunkte --- */
|
||||||
|
|
||||||
.raid-points-fields {
|
.raid-points-fields {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|
@ -2635,3 +2636,20 @@ a.button-small:hover { text-decoration: none; }
|
||||||
|
|
||||||
.contribution-raid-mode[hidden] { display: none; }
|
.contribution-raid-mode[hidden] { display: none; }
|
||||||
.contribution-raid-mode .button-small.active { border-color: var(--gold); color: var(--gold); }
|
.contribution-raid-mode .button-small.active { border-color: var(--gold); color: var(--gold); }
|
||||||
|
|
||||||
|
/* Kina im Lagerhaus */
|
||||||
|
.warehouse-kina {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.75rem;
|
||||||
|
padding: 0.55rem 0.9rem;
|
||||||
|
border: 1px solid rgba(201, 162, 39, 0.5);
|
||||||
|
border-radius: 10px;
|
||||||
|
background: rgba(201, 162, 39, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.warehouse-kina > div:not(.warehouse-kina-actions) { display: flex; flex-direction: column; line-height: 1.2; }
|
||||||
|
.warehouse-kina .text-muted { font-size: 0.8rem; }
|
||||||
|
.warehouse-kina strong { font-size: 1.35rem; color: var(--gold); font-variant-numeric: tabular-nums; }
|
||||||
|
.warehouse-kina .warehouse-icon { background: none; }
|
||||||
|
.warehouse-kina-actions { display: flex; flex-direction: column; gap: 0.3rem; margin-left: 0.5rem; }
|
||||||
|
|
|
||||||
BIN
assets/images/logo-lumina-ascendens.webp
Normal file
BIN
assets/images/logo-lumina-ascendens.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
|
|
@ -1,5 +1,5 @@
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 64 64" role="img" aria-label="Beitragspunkt">
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 64 64" role="img" aria-label="Lumipunkt">
|
||||||
<title>Beitragspunkt</title>
|
<title>Lumipunkt</title>
|
||||||
<defs>
|
<defs>
|
||||||
<!-- Pralle Herzform: breite, runde Boegen, stumpfe Spitze -->
|
<!-- Pralle Herzform: breite, runde Boegen, stumpfe Spitze -->
|
||||||
<path id="bp-heart" d="M32 56.5C21 49.5 5.5 40 5.5 24.5 5.5 14.5 12.5 7.5 21.5 7.5c4.8 0 8.3 2.4 10.5 6.3 2.2-3.9 5.7-6.3 10.5-6.3 9 0 16 7 16 17 0 15.5-15.5 25-26.5 32z"/>
|
<path id="bp-heart" d="M32 56.5C21 49.5 5.5 40 5.5 24.5 5.5 14.5 12.5 7.5 21.5 7.5c4.8 0 8.3 2.4 10.5 6.3 2.2-3.9 5.7-6.3 10.5-6.3 9 0 16 7 16 17 0 15.5-15.5 25-26.5 32z"/>
|
||||||
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
BIN
assets/images/warehouse/icon_currency_kina.webp
Normal file
BIN
assets/images/warehouse/icon_currency_kina.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.5 KiB |
|
|
@ -102,14 +102,14 @@ $renderCard = static function (array $member) use ($currentUser, $canManage, $ca
|
||||||
<?php
|
<?php
|
||||||
};
|
};
|
||||||
|
|
||||||
$pageTitle = 'Beitragspunkte';
|
$pageTitle = 'Lumipunkte';
|
||||||
$containerWide = true;
|
$containerWide = true;
|
||||||
include __DIR__ . '/includes/header.php';
|
include __DIR__ . '/includes/header.php';
|
||||||
?>
|
?>
|
||||||
<div class="panel contribution-hero">
|
<div class="panel contribution-hero">
|
||||||
<img class="contribution-hero-coin" src="/assets/images/beitragspunkt.svg" alt="" width="72" height="72">
|
<img class="contribution-hero-coin" src="/assets/images/lumipunkt.svg" alt="" width="72" height="72">
|
||||||
<div class="contribution-hero-text">
|
<div class="contribution-hero-text">
|
||||||
<h1>Beitragspunkte</h1>
|
<h1>Lumipunkte</h1>
|
||||||
<p class="text-muted">Punkte für Raids, Events und alles, was die Legion voranbringt.</p>
|
<p class="text-muted">Punkte für Raids, Events und alles, was die Legion voranbringt.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="contribution-hero-balance" title="Dein Punktestand">
|
<div class="contribution-hero-balance" title="Dein Punktestand">
|
||||||
|
|
@ -180,7 +180,7 @@ include __DIR__ . '/includes/header.php';
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if (empty($awards)): ?>
|
<?php if (empty($awards)): ?>
|
||||||
<p class="text-muted">Noch keine Beitragspunkte vergeben.</p>
|
<p class="text-muted">Noch keine Lumipunkte vergeben.</p>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<div class="contribution-awards">
|
<div class="contribution-awards">
|
||||||
<?php foreach ($awards as $award): ?>
|
<?php foreach ($awards as $award): ?>
|
||||||
|
|
@ -266,5 +266,5 @@ include __DIR__ . '/includes/header.php';
|
||||||
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<script src="/assets/js/contributions.js"></script>
|
<script src="<?= e(asset_url('/assets/js/contributions.js')) ?>"></script>
|
||||||
<?php include __DIR__ . '/includes/footer.php'; ?>
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|
||||||
|
|
|
||||||
|
|
@ -79,8 +79,8 @@ switch ($action) {
|
||||||
$count = count($userIds);
|
$count = count($userIds);
|
||||||
$who = $count === 1 ? '1 Mitglied' : $count . ' Mitglieder';
|
$who = $count === 1 ? '1 Mitglied' : $count . ' Mitglieder';
|
||||||
set_flash('success', $points > 0
|
set_flash('success', $points > 0
|
||||||
? contribution_format($points) . ' Beitragspunkte an ' . $who . ' vergeben.'
|
? contribution_format($points) . ' Lumipunkte an ' . $who . ' vergeben.'
|
||||||
: contribution_format(-$points) . ' Beitragspunkte bei ' . $who . ' abgezogen.');
|
: contribution_format(-$points) . ' Lumipunkte bei ' . $who . ' abgezogen.');
|
||||||
redirect('/contributions.php');
|
redirect('/contributions.php');
|
||||||
|
|
||||||
// ---- Ganze Vergabe loeschen ----
|
// ---- Ganze Vergabe loeschen ----
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ $form = $old ?? [
|
||||||
];
|
];
|
||||||
$selected = array_map('intval', (array) ($form['users'] ?? []));
|
$selected = array_map('intval', (array) ($form['users'] ?? []));
|
||||||
|
|
||||||
$pageTitle = 'Beitragspunkte vergeben';
|
$pageTitle = 'Lumipunkte vergeben';
|
||||||
$containerWide = true;
|
$containerWide = true;
|
||||||
include __DIR__ . '/includes/header.php';
|
include __DIR__ . '/includes/header.php';
|
||||||
?>
|
?>
|
||||||
|
|
@ -104,7 +104,7 @@ include __DIR__ . '/includes/header.php';
|
||||||
<input type="hidden" name="action" value="create">
|
<input type="hidden" name="action" value="create">
|
||||||
|
|
||||||
<div class="contribution-head">
|
<div class="contribution-head">
|
||||||
<h1><?= contribution_coin(32) ?> Beitragspunkte vergeben</h1>
|
<h1><?= contribution_coin(32) ?> Lumipunkte vergeben</h1>
|
||||||
<a href="/contributions.php">Zurück zur Übersicht</a>
|
<a href="/contributions.php">Zurück zur Übersicht</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -190,5 +190,5 @@ include __DIR__ . '/includes/header.php';
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script id="contribution-raids" type="application/json"><?= json_encode($raids, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT) ?></script>
|
<script id="contribution-raids" type="application/json"><?= json_encode($raids, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT) ?></script>
|
||||||
<script src="/assets/js/contributions.js"></script>
|
<script src="<?= e(asset_url('/assets/js/contributions.js')) ?>"></script>
|
||||||
<?php include __DIR__ . '/includes/footer.php'; ?>
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|
||||||
|
|
|
||||||
|
|
@ -290,5 +290,5 @@ include __DIR__ . '/includes/header.php';
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<script src="/assets/js/events.js"></script>
|
<script src="<?= e(asset_url('/assets/js/events.js')) ?>"></script>
|
||||||
<?php include __DIR__ . '/includes/footer.php'; ?>
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Beitragspunkte: Punkte, die Mitglieder fuer Raids und andere Aktivitaeten bekommen.
|
* Lumipunkte: Punkte, die Mitglieder fuer Raids und andere Aktivitaeten bekommen.
|
||||||
*
|
*
|
||||||
* Eine Vergabe (contribution_awards) ist ein Anlass mit Grund und Datum, an dem ein oder
|
* Eine Vergabe (contribution_awards) ist ein Anlass mit Grund und Datum, an dem ein oder
|
||||||
* mehrere Mitglieder beteiligt sind (contribution_entries, je Mitglied die Punkte). Der
|
* mehrere Mitglieder beteiligt sind (contribution_entries, je Mitglied die Punkte). Der
|
||||||
|
|
@ -28,10 +28,10 @@ function contribution_category_label(string $key): string
|
||||||
return CONTRIBUTION_CATEGORIES[$key] ?? $key;
|
return CONTRIBUTION_CATEGORIES[$key] ?? $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Das Muenz-Symbol der Beitragspunkte. */
|
/** Das Muenz-Symbol der Lumipunkte. */
|
||||||
function contribution_coin(int $size = 20): string
|
function contribution_coin(int $size = 20): string
|
||||||
{
|
{
|
||||||
return '<img class="contribution-coin" src="/assets/images/beitragspunkt.svg" alt="Beitragspunkte" '
|
return '<img class="contribution-coin" src="/assets/images/lumipunkt.svg" alt="Lumipunkte" '
|
||||||
. 'width="' . $size . '" height="' . $size . '">';
|
. 'width="' . $size . '" height="' . $size . '">';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
"source": "https://aion2.wiki.fextralife.com/Equipment_Information (Kategorien der MediaWiki-API)",
|
"source": "https://aion2.wiki.fextralife.com/Equipment_Information (Kategorien der MediaWiki-API)",
|
||||||
"retrieved": "2026-09-21",
|
"retrieved": "2026-09-21",
|
||||||
"items": {
|
"items": {
|
||||||
|
"currency": [
|
||||||
|
"Kina"
|
||||||
|
],
|
||||||
"bow": [
|
"bow": [
|
||||||
"Abyssal Bow",
|
"Abyssal Bow",
|
||||||
"Anguish Bow",
|
"Anguish Bow",
|
||||||
|
|
@ -3617,6 +3620,7 @@
|
||||||
"Kernon Greaves": "icon_gm_0100_t02_pants.webp",
|
"Kernon Greaves": "icon_gm_0100_t02_pants.webp",
|
||||||
"Kernon Helm": "icon_gm_0100_t02_helmet.webp",
|
"Kernon Helm": "icon_gm_0100_t02_helmet.webp",
|
||||||
"Kernon Pauldrons": "icon_gm_0100_t02_shoulder.webp",
|
"Kernon Pauldrons": "icon_gm_0100_t02_shoulder.webp",
|
||||||
|
"Kina": "icon_currency_kina.webp",
|
||||||
"Korin Boots": "icon_gm_0092_t01_boots.webp",
|
"Korin Boots": "icon_gm_0092_t01_boots.webp",
|
||||||
"Korin Breastplate": "icon_gm_0092_t01_torso.webp",
|
"Korin Breastplate": "icon_gm_0092_t01_torso.webp",
|
||||||
"Korin Cloak": "icon_gm_0092_t01_cape.webp",
|
"Korin Cloak": "icon_gm_0092_t01_cape.webp",
|
||||||
|
|
@ -4654,5 +4658,6 @@
|
||||||
"Yggdrasil Bow": "icon_wp_bw_0052_t04.webp",
|
"Yggdrasil Bow": "icon_wp_bw_0052_t04.webp",
|
||||||
"Yggdrasil Staff": "icon_wp_st_0052_t04.webp"
|
"Yggdrasil Staff": "icon_wp_st_0052_t04.webp"
|
||||||
},
|
},
|
||||||
"icons_note": "Bilder unter assets/images/warehouse/, verkleinert auf 128x128 aus dem Wiki"
|
"icons_note": "Bilder unter assets/images/warehouse/, verkleinert auf 128x128 aus dem Wiki",
|
||||||
|
"currency_note": "Kina-Symbol aus dem Spielclient (Icon_Currency_Coin_GoldNonbinding), bezogen ueber aion2.app"
|
||||||
}
|
}
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/assets/js/nav.js"></script>
|
<script src="<?= e(asset_url('/assets/js/nav.js')) ?>"></script>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
</main>
|
</main>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
|
||||||
|
|
@ -285,3 +285,13 @@ function render_pagination(string $baseUrl, int $page, int $pageCount, string $a
|
||||||
</nav>
|
</nav>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL einer Datei unter assets/ mit Versionskennung (Aenderungsdatum). Nach einem Upload
|
||||||
|
* laedt der Browser so die neue Fassung, statt eine alte aus seinem Zwischenspeicher zu nehmen.
|
||||||
|
*/
|
||||||
|
function asset_url(string $path): string
|
||||||
|
{
|
||||||
|
$file = __DIR__ . '/..' . $path;
|
||||||
|
return $path . (is_file($file) ? '?v=' . filemtime($file) : '');
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ $otherFlashes = array_values(array_filter($allFlashes, fn (array $f): bool => ($
|
||||||
<link rel="icon" type="image/png" sizes="32x32" href="/assets/images/favicon-32.png">
|
<link rel="icon" type="image/png" sizes="32x32" href="/assets/images/favicon-32.png">
|
||||||
<link rel="icon" type="image/png" sizes="48x48" href="/assets/images/favicon-48.png">
|
<link rel="icon" type="image/png" sizes="48x48" href="/assets/images/favicon-48.png">
|
||||||
<link rel="apple-touch-icon" href="/assets/images/apple-touch-icon.png">
|
<link rel="apple-touch-icon" href="/assets/images/apple-touch-icon.png">
|
||||||
<link rel="stylesheet" href="/assets/css/style.css">
|
<link rel="stylesheet" href="<?= e(asset_url('/assets/css/style.css')) ?>">
|
||||||
</head>
|
</head>
|
||||||
<body<?= $shellUser ? '' : ' class="guest-bg"' ?>>
|
<body<?= $shellUser ? '' : ' class="guest-bg"' ?>>
|
||||||
<?php if (!empty($successFlashes)): ?>
|
<?php if (!empty($successFlashes)): ?>
|
||||||
|
|
@ -101,7 +101,7 @@ $otherFlashes = array_values(array_filter($allFlashes, fn (array $f): bool => ($
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/assets/js/success-popup.js"></script>
|
<script src="<?= e(asset_url('/assets/js/success-popup.js')) ?>"></script>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ($shellUser): ?>
|
<?php if ($shellUser): ?>
|
||||||
<div class="app-shell">
|
<div class="app-shell">
|
||||||
|
|
@ -109,11 +109,11 @@ $otherFlashes = array_values(array_filter($allFlashes, fn (array $f): bool => ($
|
||||||
<button type="button" class="sidebar-toggle" aria-label="Menü öffnen" aria-expanded="false">
|
<button type="button" class="sidebar-toggle" aria-label="Menü öffnen" aria-expanded="false">
|
||||||
<?= icon('menu') ?>
|
<?= icon('menu') ?>
|
||||||
</button>
|
</button>
|
||||||
<a href="/" class="mobile-topbar-brand"><img src="/assets/images/logo-mark.svg" alt="Lumina Ascendens"></a>
|
<a href="/" class="mobile-topbar-brand"><img src="<?= e(asset_url('/assets/images/logo-lumina-ascendens.webp')) ?>" alt="Lumina Ascendens" width="410" height="168"></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="sidebar-backdrop"></div>
|
<div class="sidebar-backdrop"></div>
|
||||||
<aside class="sidebar">
|
<aside class="sidebar">
|
||||||
<div class="sidebar-brand"><a href="/"><img src="/assets/images/logo-mark.svg" alt="Lumina Ascendens"></a></div>
|
<div class="sidebar-brand"><a href="/"><img src="<?= e(asset_url('/assets/images/logo-lumina-ascendens.webp')) ?>" alt="Lumina Ascendens" width="410" height="168"></a></div>
|
||||||
<nav class="sidebar-nav">
|
<nav class="sidebar-nav">
|
||||||
<a href="/dashboard.php" class="sidebar-link<?= $isDashboardActive ? ' active' : '' ?>" title="Dashboard">
|
<a href="/dashboard.php" class="sidebar-link<?= $isDashboardActive ? ' active' : '' ?>" title="Dashboard">
|
||||||
<?= icon('home') ?><span class="label">Dashboard</span>
|
<?= icon('home') ?><span class="label">Dashboard</span>
|
||||||
|
|
@ -122,8 +122,8 @@ $otherFlashes = array_values(array_filter($allFlashes, fn (array $f): bool => ($
|
||||||
<?= icon('profile') ?><span class="label">Mein Profil</span>
|
<?= icon('profile') ?><span class="label">Mein Profil</span>
|
||||||
</a>
|
</a>
|
||||||
<?php if ($canViewContributions): ?>
|
<?php if ($canViewContributions): ?>
|
||||||
<a href="/contributions.php" class="sidebar-link<?= $isContributionsActive ? ' active' : '' ?>" title="Beitragspunkte">
|
<a href="/contributions.php" class="sidebar-link<?= $isContributionsActive ? ' active' : '' ?>" title="Lumipunkte">
|
||||||
<?= icon('heart') ?><span class="label">Beitragspunkte</span>
|
<?= icon('heart') ?><span class="label">Lumipunkte</span>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ($canViewMembers): ?>
|
<?php if ($canViewMembers): ?>
|
||||||
|
|
@ -188,8 +188,8 @@ $otherFlashes = array_values(array_filter($allFlashes, fn (array $f): bool => ($
|
||||||
<div>
|
<div>
|
||||||
Angemeldet als<br><strong><?= e($currentUser['display_name'] !== '' ? $currentUser['display_name'] : $currentUser['username']) ?></strong>
|
Angemeldet als<br><strong><?= e($currentUser['display_name'] !== '' ? $currentUser['display_name'] : $currentUser['username']) ?></strong>
|
||||||
<?php if ($sidebarPoints !== null): ?>
|
<?php if ($sidebarPoints !== null): ?>
|
||||||
<a class="sidebar-points" href="/contributions.php" title="Deine Beitragspunkte">
|
<a class="sidebar-points" href="/contributions.php" title="Deine Lumipunkte">
|
||||||
<img src="/assets/images/beitragspunkt.svg" alt="" width="14" height="14"> <?= e(number_format($sidebarPoints, 0, ',', '.')) ?>
|
<img src="/assets/images/lumipunkt.svg" alt="" width="14" height="14"> <?= e(number_format($sidebarPoints, 0, ',', '.')) ?>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -206,7 +206,7 @@ $otherFlashes = array_values(array_filter($allFlashes, fn (array $f): bool => ($
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<header class="navbar">
|
<header class="navbar">
|
||||||
<div class="navbar-brand"><a href="/"><img src="/assets/images/logo-mark.svg" alt="Lumina Ascendens"></a></div>
|
<div class="navbar-brand"><a href="/"><img src="<?= e(asset_url('/assets/images/logo-lumina-ascendens.webp')) ?>" alt="Lumina Ascendens" width="410" height="168"></a></div>
|
||||||
<div class="navbar-user">
|
<div class="navbar-user">
|
||||||
<?php if ($currentUser): ?>
|
<?php if ($currentUser): ?>
|
||||||
<a href="/logout.php">Abmelden</a>
|
<a href="/logout.php">Abmelden</a>
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,9 @@ const CORE_PERMISSIONS = [
|
||||||
['key' => 'map.tactics', 'description' => 'Taktiken auf der Karte anlegen, zeichnen und bearbeiten'],
|
['key' => 'map.tactics', 'description' => 'Taktiken auf der Karte anlegen, zeichnen und bearbeiten'],
|
||||||
['key' => 'warehouse.view', 'description' => 'Lagerhaus: Bestand und Verlauf einsehen'],
|
['key' => 'warehouse.view', 'description' => 'Lagerhaus: Bestand und Verlauf einsehen'],
|
||||||
['key' => 'warehouse.manage', 'description' => 'Lagerhaus: Gegenstände einlagern, entnehmen und Einträge löschen'],
|
['key' => 'warehouse.manage', 'description' => 'Lagerhaus: Gegenstände einlagern, entnehmen und Einträge löschen'],
|
||||||
['key' => 'contributions.view', 'description' => 'Beitragspunkte: Punktestände und Verlauf einsehen'],
|
['key' => 'contributions.view', 'description' => 'Lumipunkte: Punktestände und Verlauf einsehen'],
|
||||||
['key' => 'contributions.view_all', 'description' => 'Beitragspunkte: vollständige Rangliste sehen (sonst nur die besten 25)'],
|
['key' => 'contributions.view_all', 'description' => 'Lumipunkte: vollständige Rangliste sehen (sonst nur die besten 25)'],
|
||||||
['key' => 'contributions.manage', 'description' => 'Beitragspunkte vergeben, abziehen und Vergaben löschen'],
|
['key' => 'contributions.manage', 'description' => 'Lumipunkte vergeben, abziehen und Vergaben löschen'],
|
||||||
['key' => 'members.view', 'description' => 'Mitgliederliste einsehen'],
|
['key' => 'members.view', 'description' => 'Mitgliederliste einsehen'],
|
||||||
['key' => 'reports.view', 'description' => 'Eingegangene Reports einsehen'],
|
['key' => 'reports.view', 'description' => 'Eingegangene Reports einsehen'],
|
||||||
['key' => 'reports.manage', 'description' => 'Reports löschen/archivieren und die Punkte-Gewichtung verwalten'],
|
['key' => 'reports.manage', 'description' => 'Reports löschen/archivieren und die Punkte-Gewichtung verwalten'],
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ require_once __DIR__ . '/raids_api.php';
|
||||||
require_once __DIR__ . '/contributions.php';
|
require_once __DIR__ . '/contributions.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Anwesenheit bei Raids und automatische Beitragspunkte beim Archivieren.
|
* Anwesenheit bei Raids und automatische Lumipunkte beim Archivieren.
|
||||||
*
|
*
|
||||||
* Die Raids selbst liegen beim Bot (Raid-API). Hier auf der Website liegen nur Zusaetze, die
|
* Die Raids selbst liegen beim Bot (Raid-API). Hier auf der Website liegen nur Zusaetze, die
|
||||||
* ueber die raid_id (= Discord-Nachrichten-ID) zugeordnet sind: die Punkte-Einstellungen
|
* ueber die raid_id (= Discord-Nachrichten-ID) zugeordnet sind: die Punkte-Einstellungen
|
||||||
|
|
@ -132,7 +132,7 @@ function raid_user_ids_by_discord(): array
|
||||||
return $map;
|
return $map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Wurden fuer diesen Raid schon Beitragspunkte vergeben (von Hand oder automatisch)? */
|
/** Wurden fuer diesen Raid schon Lumipunkte vergeben (von Hand oder automatisch)? */
|
||||||
function raid_has_awards(int $raidId): bool
|
function raid_has_awards(int $raidId): bool
|
||||||
{
|
{
|
||||||
$stmt = db()->prepare('SELECT 1 FROM contribution_awards WHERE raid_id = ? LIMIT 1');
|
$stmt = db()->prepare('SELECT 1 FROM contribution_awards WHERE raid_id = ? LIMIT 1');
|
||||||
|
|
@ -141,7 +141,7 @@ function raid_has_awards(int $raidId): bool
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Automatische Beitragspunkte fuer archivierte Raids.
|
* Automatische Lumipunkte fuer archivierte Raids.
|
||||||
*
|
*
|
||||||
* Laeuft bei jedem Aufruf der Raid- und Punkteseiten und direkt nach dem Archivieren - so
|
* Laeuft bei jedem Aufruf der Raid- und Punkteseiten und direkt nach dem Archivieren - so
|
||||||
* werden auch Raids erfasst, die im Discord ueber den Knopf archiviert wurden (die Website
|
* werden auch Raids erfasst, die im Discord ueber den Knopf archiviert wurden (die Website
|
||||||
|
|
@ -278,7 +278,7 @@ function raid_run_auto_points(int $raidId, array $raid, int $pointsPresent, int
|
||||||
|
|
||||||
return $finish(empty($parts)
|
return $finish(empty($parts)
|
||||||
? 'Keine automatischen Punkte für „' . $title . '“: niemand mit Website-Konto zu berücksichtigen.'
|
? 'Keine automatischen Punkte für „' . $title . '“: niemand mit Website-Konto zu berücksichtigen.'
|
||||||
: 'Automatische Beitragspunkte für „' . $title . '“ vergeben: ' . implode(', ', $parts) . '.');
|
: 'Automatische Lumipunkte für „' . $title . '“ vergeben: ' . implode(', ', $parts) . '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Ist fuer den Bot-Rueckkanal ein gemeinsamer Schluessel eingetragen? (config.php: bot_callback.key) */
|
/** Ist fuer den Bot-Rueckkanal ein gemeinsamer Schluessel eingetragen? (config.php: bot_callback.key) */
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ declare(strict_types=1);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Hochzaehlen, sobald unten eine Aenderung dazukommt - dann pruefen alle Sitzungen neu.
|
// Hochzaehlen, sobald unten eine Aenderung dazukommt - dann pruefen alle Sitzungen neu.
|
||||||
const SCHEMA_VERSION = 6;
|
const SCHEMA_VERSION = 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tabellen, die nachtraeglich dazugekommen sind: Tabelle => CREATE-Befehl (wie in sql/schema.sql).
|
* Tabellen, die nachtraeglich dazugekommen sind: Tabelle => CREATE-Befehl (wie in sql/schema.sql).
|
||||||
|
|
@ -41,7 +41,8 @@ CREATE TABLE IF NOT EXISTS warehouse_movements (
|
||||||
item_id INT UNSIGNED NOT NULL,
|
item_id INT UNSIGNED NOT NULL,
|
||||||
-- in = eingelagert, out = entnommen
|
-- in = eingelagert, out = entnommen
|
||||||
direction ENUM('in', 'out') NOT NULL,
|
direction ENUM('in', 'out') NOT NULL,
|
||||||
quantity INT UNSIGNED NOT NULL,
|
-- BIGINT wegen Kina (Betraege weit ueber 4 Milliarden moeglich)
|
||||||
|
quantity BIGINT UNSIGNED NOT NULL,
|
||||||
-- Wann uebergeben/entnommen (wie eingegeben, deutsche Zeit)
|
-- Wann uebergeben/entnommen (wie eingegeben, deutsche Zeit)
|
||||||
occurred_at DATETIME NOT NULL,
|
occurred_at DATETIME NOT NULL,
|
||||||
-- Von wem (in) bzw. an wen (out): ein Konto der Website oder ein frei eingetragener Name
|
-- Von wem (in) bzw. an wen (out): ein Konto der Website oder ein frei eingetragener Name
|
||||||
|
|
@ -90,7 +91,7 @@ SQL,
|
||||||
CREATE TABLE IF NOT EXISTS raid_settings (
|
CREATE TABLE IF NOT EXISTS raid_settings (
|
||||||
-- Discord-Nachrichten-ID des Raids (wie in der Raid-API), 19-stellig
|
-- Discord-Nachrichten-ID des Raids (wie in der Raid-API), 19-stellig
|
||||||
raid_id BIGINT UNSIGNED NOT NULL PRIMARY KEY,
|
raid_id BIGINT UNSIGNED NOT NULL PRIMARY KEY,
|
||||||
-- Automatische Beitragspunkte beim Archivieren: fuer Anwesende bzw. Abzug fuer Abwesende
|
-- Automatische Lumipunkte beim Archivieren: fuer Anwesende bzw. Abzug fuer Abwesende
|
||||||
points_present INT NOT NULL DEFAULT 0,
|
points_present INT NOT NULL DEFAULT 0,
|
||||||
points_absent INT NOT NULL DEFAULT 0,
|
points_absent INT NOT NULL DEFAULT 0,
|
||||||
-- Wann die Automatik gelaufen ist (oder uebersprungen wurde, weil schon Punkte vergeben waren)
|
-- Wann die Automatik gelaufen ist (oder uebersprungen wurde, weil schon Punkte vergeben waren)
|
||||||
|
|
@ -199,6 +200,7 @@ function ensure_schema(): void
|
||||||
// raid_id sind Discord-Nachrichten-IDs (19-stellig) - ein INT war dafuer zu klein.
|
// raid_id sind Discord-Nachrichten-IDs (19-stellig) - ein INT war dafuer zu klein.
|
||||||
$typeFixes = [
|
$typeFixes = [
|
||||||
['contribution_awards', 'raid_id', 'bigint', 'ALTER TABLE contribution_awards MODIFY raid_id BIGINT UNSIGNED NULL'],
|
['contribution_awards', 'raid_id', 'bigint', 'ALTER TABLE contribution_awards MODIFY raid_id BIGINT UNSIGNED NULL'],
|
||||||
|
['warehouse_movements', 'quantity', 'bigint', 'ALTER TABLE warehouse_movements MODIFY quantity BIGINT UNSIGNED NOT NULL'],
|
||||||
];
|
];
|
||||||
foreach ($typeFixes as [$table, $column, $expected, $sql]) {
|
foreach ($typeFixes as [$table, $column, $expected, $sql]) {
|
||||||
if (!in_array($table, $tables, true)) {
|
if (!in_array($table, $tables, true)) {
|
||||||
|
|
@ -234,18 +236,24 @@ function ensure_schema(): void
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Traegt neu hinzugekommene Kern-Berechtigungen (CORE_PERMISSIONS) in die Datenbank ein -
|
* Traegt neu hinzugekommene Kern-Berechtigungen (CORE_PERMISSIONS) in die Datenbank ein und
|
||||||
|
* aktualisiert die Beschreibungen der vorhandenen -
|
||||||
* bisher musste man sie nach einem Update von Hand anlegen. Neue Rechte bekommt die
|
* bisher musste man sie nach einem Update von Hand anlegen. Neue Rechte bekommt die
|
||||||
* Administrator-Gruppe gleich mit, weil sie laut Installation alle Rechte hat.
|
* Administrator-Gruppe gleich mit, weil sie laut Installation alle Rechte hat.
|
||||||
*/
|
*/
|
||||||
function schema_sync_core_permissions(): void
|
function schema_sync_core_permissions(): void
|
||||||
{
|
{
|
||||||
$pdo = db();
|
$pdo = db();
|
||||||
$existing = $pdo->query('SELECT `key` FROM permissions')->fetchAll(PDO::FETCH_COLUMN);
|
$existing = $pdo->query('SELECT `key`, description FROM permissions')->fetchAll(PDO::FETCH_KEY_PAIR);
|
||||||
$adminRoleId = (int) $pdo->query("SELECT id FROM roles WHERE name = 'Administrator'")->fetchColumn();
|
$adminRoleId = (int) $pdo->query("SELECT id FROM roles WHERE name = 'Administrator'")->fetchColumn();
|
||||||
|
|
||||||
foreach (CORE_PERMISSIONS as $permission) {
|
foreach (CORE_PERMISSIONS as $permission) {
|
||||||
if (in_array($permission['key'], $existing, true)) {
|
if (array_key_exists($permission['key'], $existing)) {
|
||||||
|
// Beschreibung nachziehen, falls sie im Code geaendert wurde (z.B. Umbenennungen).
|
||||||
|
if ($existing[$permission['key']] !== $permission['description']) {
|
||||||
|
$pdo->prepare('UPDATE permissions SET description = ? WHERE `key` = ?')
|
||||||
|
->execute([$permission['description'], $permission['key']]);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$pdo->prepare('INSERT INTO permissions (`key`, description) VALUES (?, ?)')
|
$pdo->prepare('INSERT INTO permissions (`key`, description) VALUES (?, ?)')
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ function setting_set(string $key, string $value): void
|
||||||
->execute([$key, $value]);
|
->execute([$key, $value]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Ist der Verlauf der Beitragspunkte fuer alle sichtbar oder nur fuer contributions.manage? */
|
/** Ist der Verlauf der Lumipunkte fuer alle sichtbar oder nur fuer contributions.manage? */
|
||||||
function contributions_history_public(): bool
|
function contributions_history_public(): bool
|
||||||
{
|
{
|
||||||
return setting_get('contributions_history_public') === '1';
|
return setting_get('contributions_history_public') === '1';
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ const WAREHOUSE_CATALOG_FILE = __DIR__ . '/data/warehouse_items.json';
|
||||||
* Wiki nicht).
|
* Wiki nicht).
|
||||||
*/
|
*/
|
||||||
const WAREHOUSE_CATEGORIES = [
|
const WAREHOUSE_CATEGORIES = [
|
||||||
|
'currency' => ['Währung', 'Währung'],
|
||||||
'sword' => ['Schwert', 'Waffen'],
|
'sword' => ['Schwert', 'Waffen'],
|
||||||
'greatsword' => ['Großschwert', 'Waffen'],
|
'greatsword' => ['Großschwert', 'Waffen'],
|
||||||
'dagger' => ['Dolch', 'Waffen'],
|
'dagger' => ['Dolch', 'Waffen'],
|
||||||
|
|
@ -52,6 +53,16 @@ const WAREHOUSE_CUSTOM_CATEGORIES = ['material', 'other', 'potion', 'food', 'dri
|
||||||
|
|
||||||
const WAREHOUSE_MAX_QUANTITY = 1000000;
|
const WAREHOUSE_MAX_QUANTITY = 1000000;
|
||||||
|
|
||||||
|
// Kina (Waehrung) geht schnell in die Millionen - dafuer gilt eine eigene Obergrenze.
|
||||||
|
const WAREHOUSE_KINA = 'Kina';
|
||||||
|
const WAREHOUSE_MAX_CURRENCY = 1000000000000;
|
||||||
|
|
||||||
|
/** Hoechstmenge pro Eintrag fuer eine Kategorie. */
|
||||||
|
function warehouse_max_quantity(string $category): int
|
||||||
|
{
|
||||||
|
return $category === 'currency' ? WAREHOUSE_MAX_CURRENCY : WAREHOUSE_MAX_QUANTITY;
|
||||||
|
}
|
||||||
|
|
||||||
function warehouse_category_label(string $key): string
|
function warehouse_category_label(string $key): string
|
||||||
{
|
{
|
||||||
return WAREHOUSE_CATEGORIES[$key][0] ?? $key;
|
return WAREHOUSE_CATEGORIES[$key][0] ?? $key;
|
||||||
|
|
@ -79,6 +90,19 @@ function warehouse_sync_catalog(): void
|
||||||
|
|
||||||
$pdo = db();
|
$pdo = db();
|
||||||
$pdo->beginTransaction();
|
$pdo->beginTransaction();
|
||||||
|
|
||||||
|
// Die Waehrung hiess kurz "Kinah" - vorhandene Buchungen wandern zu "Kina".
|
||||||
|
$old = $pdo->query("SELECT id FROM warehouse_items WHERE name = 'Kinah' AND category = 'currency'")->fetchColumn();
|
||||||
|
if ($old !== false) {
|
||||||
|
$new = $pdo->query("SELECT id FROM warehouse_items WHERE name = 'Kina' AND category = 'currency'")->fetchColumn();
|
||||||
|
if ($new === false) {
|
||||||
|
$pdo->prepare("UPDATE warehouse_items SET name = 'Kina' WHERE id = ?")->execute([(int) $old]);
|
||||||
|
} else {
|
||||||
|
$pdo->prepare('UPDATE warehouse_movements SET item_id = ? WHERE item_id = ?')->execute([(int) $new, (int) $old]);
|
||||||
|
$pdo->prepare('DELETE FROM warehouse_items WHERE id = ?')->execute([(int) $old]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$icons = is_array($data['icons'] ?? null) ? $data['icons'] : [];
|
$icons = is_array($data['icons'] ?? null) ? $data['icons'] : [];
|
||||||
$insert = $pdo->prepare(
|
$insert = $pdo->prepare(
|
||||||
"INSERT INTO warehouse_items (name, category, icon, source) VALUES (?, ?, ?, 'wiki')
|
"INSERT INTO warehouse_items (name, category, icon, source) VALUES (?, ?, ?, 'wiki')
|
||||||
|
|
@ -115,7 +139,7 @@ function warehouse_stock(): array
|
||||||
JOIN warehouse_movements m ON m.item_id = i.id
|
JOIN warehouse_movements m ON m.item_id = i.id
|
||||||
GROUP BY i.id
|
GROUP BY i.id
|
||||||
HAVING quantity > 0
|
HAVING quantity > 0
|
||||||
ORDER BY i.name"
|
ORDER BY i.category = 'currency' DESC, i.name"
|
||||||
)->fetchAll();
|
)->fetchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -322,7 +322,7 @@ include __DIR__ . '/includes/header.php';
|
||||||
<input type="hidden" name="class" id="premade-class-value">
|
<input type="hidden" name="class" id="premade-class-value">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script src="/assets/js/premades.js"></script>
|
<script src="<?= e(asset_url('/assets/js/premades.js')) ?>"></script>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ include __DIR__ . '/includes/header.php';
|
||||||
Beim Archivieren: +<?= (int) $settings['points_present'] ?> für Anwesende<?= $settings['points_absent'] > 0 ? ', −' . (int) $settings['points_absent'] . ' für Abwesende' : '' ?>.
|
Beim Archivieren: +<?= (int) $settings['points_present'] ?> für Anwesende<?= $settings['points_absent'] > 0 ? ', −' . (int) $settings['points_absent'] . ' für Abwesende' : '' ?>.
|
||||||
<?php if ($settings['auto_result']): ?><br><?= e((string) $settings['auto_result']) ?><?php endif; ?>
|
<?php if ($settings['auto_result']): ?><br><?= e((string) $settings['auto_result']) ?><?php endif; ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
Keine automatischen Beitragspunkte für diesen Raid eingestellt.
|
Keine automatischen Lumipunkte für diesen Raid eingestellt.
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -132,7 +132,7 @@ include __DIR__ . '/includes/header.php';
|
||||||
<strong><?= e($row['name']) ?></strong>
|
<strong><?= e($row['name']) ?></strong>
|
||||||
<span class="text-muted"><?= e($row['where']) ?><?= $row['class'] !== '' && $row['class'] !== 'Abgemeldet' ? ' · ' . e($row['class']) : '' ?></span>
|
<span class="text-muted"><?= e($row['where']) ?><?= $row['class'] !== '' && $row['class'] !== 'Abgemeldet' ? ' · ' . e($row['class']) : '' ?></span>
|
||||||
<?php if (!$hasAccount): ?>
|
<?php if (!$hasAccount): ?>
|
||||||
<span class="badge" title="Ohne Website-Konto mit Discord-Verknüpfung gibt es keine Beitragspunkte">kein Website-Konto</span>
|
<span class="badge" title="Ohne Website-Konto mit Discord-Verknüpfung gibt es keine Lumipunkte">kein Website-Konto</span>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="attendance-choice" role="radiogroup" aria-label="Anwesenheit von <?= e($row['name']) ?>">
|
<div class="attendance-choice" role="radiogroup" aria-label="Anwesenheit von <?= e($row['name']) ?>">
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ try {
|
||||||
'max_slots' => $maxSlots,
|
'max_slots' => $maxSlots,
|
||||||
]);
|
]);
|
||||||
$newRaidId = (int) ($result['raid_id'] ?? 0);
|
$newRaidId = (int) ($result['raid_id'] ?? 0);
|
||||||
// Beitragspunkte beim Archivieren kennt die Raid-API nicht - die merkt sich die Website.
|
// Lumipunkte beim Archivieren kennt die Raid-API nicht - die merkt sich die Website.
|
||||||
if ($newRaidId > 0 && ($pointsPresent > 0 || $pointsAbsent > 0)) {
|
if ($newRaidId > 0 && ($pointsPresent > 0 || $pointsAbsent > 0)) {
|
||||||
raid_settings_save_points($newRaidId, $pointsPresent, $pointsAbsent);
|
raid_settings_save_points($newRaidId, $pointsPresent, $pointsAbsent);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ try {
|
||||||
$apiError = $e->getMessage();
|
$apiError = $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Automatische Beitragspunkte fuer inzwischen archivierte Raids (auch im Discord archivierte).
|
// Automatische Lumipunkte fuer inzwischen archivierte Raids (auch im Discord archivierte).
|
||||||
foreach (raid_process_auto_points($apiError ? null : $raids) as $autoMessage) {
|
foreach (raid_process_auto_points($apiError ? null : $raids) as $autoMessage) {
|
||||||
if ($autoMessage !== '' && $canManageRaids) {
|
if ($autoMessage !== '' && $canManageRaids) {
|
||||||
set_flash('info', $autoMessage);
|
set_flash('info', $autoMessage);
|
||||||
|
|
@ -280,7 +280,7 @@ include __DIR__ . '/includes/header.php';
|
||||||
<span class="badge badge-pending">noch nicht kontrolliert</span>
|
<span class="badge badge-pending">noch nicht kontrolliert</span>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ($autoPresent > 0 || $autoAbsent > 0): ?>
|
<?php if ($autoPresent > 0 || $autoAbsent > 0): ?>
|
||||||
<span class="text-muted raid-auto-points" title="Automatische Beitragspunkte beim Archivieren">
|
<span class="text-muted raid-auto-points" title="Automatische Lumipunkte beim Archivieren">
|
||||||
<?= contribution_coin(15) ?> +<?= $autoPresent ?><?= $autoAbsent > 0 ? ' / −' . $autoAbsent : '' ?>
|
<?= contribution_coin(15) ?> +<?= $autoPresent ?><?= $autoAbsent > 0 ? ' / −' . $autoAbsent : '' ?>
|
||||||
<?= !empty($raidSetting['auto_processed_at']) ? '· ' . e((string) $raidSetting['auto_result']) : 'beim Archivieren' ?>
|
<?= !empty($raidSetting['auto_processed_at']) ? '· ' . e((string) $raidSetting['auto_result']) : 'beim Archivieren' ?>
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -457,5 +457,5 @@ include __DIR__ . '/includes/header.php';
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/assets/js/raids.js"></script>
|
<script src="<?= e(asset_url('/assets/js/raids.js')) ?>"></script>
|
||||||
<?php include __DIR__ . '/includes/footer.php'; ?>
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|
||||||
|
|
|
||||||
|
|
@ -382,6 +382,6 @@ include __DIR__ . '/includes/header.php';
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<script src="/assets/js/reports.js"></script>
|
<script src="<?= e(asset_url('/assets/js/reports.js')) ?>"></script>
|
||||||
|
|
||||||
<?php include __DIR__ . '/includes/footer.php'; ?>
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ CREATE TABLE IF NOT EXISTS user_roles (
|
||||||
CREATE TABLE IF NOT EXISTS raid_settings (
|
CREATE TABLE IF NOT EXISTS raid_settings (
|
||||||
-- Discord-Nachrichten-ID des Raids (wie in der Raid-API), 19-stellig
|
-- Discord-Nachrichten-ID des Raids (wie in der Raid-API), 19-stellig
|
||||||
raid_id BIGINT UNSIGNED NOT NULL PRIMARY KEY,
|
raid_id BIGINT UNSIGNED NOT NULL PRIMARY KEY,
|
||||||
-- Automatische Beitragspunkte beim Archivieren: fuer Anwesende bzw. Abzug fuer Abwesende
|
-- Automatische Lumipunkte beim Archivieren: fuer Anwesende bzw. Abzug fuer Abwesende
|
||||||
points_present INT NOT NULL DEFAULT 0,
|
points_present INT NOT NULL DEFAULT 0,
|
||||||
points_absent INT NOT NULL DEFAULT 0,
|
points_absent INT NOT NULL DEFAULT 0,
|
||||||
-- Wann die Automatik gelaufen ist (oder uebersprungen wurde, weil schon Punkte vergeben waren)
|
-- Wann die Automatik gelaufen ist (oder uebersprungen wurde, weil schon Punkte vergeben waren)
|
||||||
|
|
@ -107,7 +107,7 @@ CREATE TABLE IF NOT EXISTS raid_attendance (
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
-- --------------------------------------------------------------------------
|
-- --------------------------------------------------------------------------
|
||||||
-- Beitragspunkte
|
-- Lumipunkte
|
||||||
-- --------------------------------------------------------------------------
|
-- --------------------------------------------------------------------------
|
||||||
|
|
||||||
-- Eine Vergabe: Anlass (Raid, Event, ...) mit Grund und Datum.
|
-- Eine Vergabe: Anlass (Raid, Event, ...) mit Grund und Datum.
|
||||||
|
|
@ -166,7 +166,8 @@ CREATE TABLE IF NOT EXISTS warehouse_movements (
|
||||||
item_id INT UNSIGNED NOT NULL,
|
item_id INT UNSIGNED NOT NULL,
|
||||||
-- in = eingelagert, out = entnommen
|
-- in = eingelagert, out = entnommen
|
||||||
direction ENUM('in', 'out') NOT NULL,
|
direction ENUM('in', 'out') NOT NULL,
|
||||||
quantity INT UNSIGNED NOT NULL,
|
-- BIGINT wegen Kina (Betraege weit ueber 4 Milliarden moeglich)
|
||||||
|
quantity BIGINT UNSIGNED NOT NULL,
|
||||||
-- Wann uebergeben/entnommen (wie eingegeben, deutsche Zeit)
|
-- Wann uebergeben/entnommen (wie eingegeben, deutsche Zeit)
|
||||||
occurred_at DATETIME NOT NULL,
|
occurred_at DATETIME NOT NULL,
|
||||||
-- Von wem (in) bzw. an wen (out): ein Konto der Website oder ein frei eingetragener Name
|
-- Von wem (in) bzw. an wen (out): ein Konto der Website oder ein frei eingetragener Name
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,14 @@ $canManage = user_has_permission('warehouse.manage');
|
||||||
warehouse_sync_catalog();
|
warehouse_sync_catalog();
|
||||||
|
|
||||||
$stock = warehouse_stock();
|
$stock = warehouse_stock();
|
||||||
$stockTotal = array_sum(array_map(static fn (array $row): int => (int) $row['quantity'], $stock));
|
|
||||||
|
// Kina steht als eigener Kasten oben, nicht zwischen den Gegenstaenden.
|
||||||
|
$kinaStmt = db()->prepare("SELECT id, icon FROM warehouse_items WHERE name = ? AND category = 'currency'");
|
||||||
|
$kinaStmt->execute([WAREHOUSE_KINA]);
|
||||||
|
$kinaItem = $kinaStmt->fetch() ?: null;
|
||||||
|
$kinaBalance = $kinaItem ? warehouse_item_stock((int) $kinaItem['id']) : 0;
|
||||||
|
$itemStock = array_values(array_filter($stock, static fn (array $row): bool => $row['category'] !== 'currency'));
|
||||||
|
$stockTotal = array_sum(array_map(static fn (array $row): int => (int) $row['quantity'], $itemStock));
|
||||||
|
|
||||||
// Verlauf, optional nur fuer einen Gegenstand (Klick auf den Namen im Bestand).
|
// Verlauf, optional nur fuer einen Gegenstand (Klick auf den Namen im Bestand).
|
||||||
$filterItemId = isset($_GET['item']) ? (int) $_GET['item'] : null;
|
$filterItemId = isset($_GET['item']) ? (int) $_GET['item'] : null;
|
||||||
|
|
@ -40,7 +47,7 @@ unset($_SESSION['warehouse_form']);
|
||||||
$openForm = (string) ($old['form'] ?? '');
|
$openForm = (string) ($old['form'] ?? '');
|
||||||
|
|
||||||
$categoriesInStock = [];
|
$categoriesInStock = [];
|
||||||
foreach ($stock as $row) {
|
foreach ($itemStock as $row) {
|
||||||
$categoriesInStock[$row['category']] = warehouse_category_label((string) $row['category']);
|
$categoriesInStock[$row['category']] = warehouse_category_label((string) $row['category']);
|
||||||
}
|
}
|
||||||
asort($categoriesInStock);
|
asort($categoriesInStock);
|
||||||
|
|
@ -88,9 +95,24 @@ include __DIR__ . '/includes/header.php';
|
||||||
<div>
|
<div>
|
||||||
<h1>Lagerhaus</h1>
|
<h1>Lagerhaus</h1>
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<?= count($stock) ?> verschiedene Gegenstände, <?= number_format($stockTotal, 0, ',', '.') ?> Stück insgesamt.
|
<?= count($itemStock) ?> verschiedene Gegenstände, <?= number_format($stockTotal, 0, ',', '.') ?> Stück insgesamt.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<?php if ($kinaItem): ?>
|
||||||
|
<div class="warehouse-kina">
|
||||||
|
<?= warehouse_icon_html($kinaItem['icon'] ?? null, WAREHOUSE_KINA, 44) ?>
|
||||||
|
<div>
|
||||||
|
<span class="text-muted">Kina im Lager</span>
|
||||||
|
<strong><?= number_format($kinaBalance, 0, ',', '.') ?></strong>
|
||||||
|
</div>
|
||||||
|
<?php if ($canManage): ?>
|
||||||
|
<div class="warehouse-kina-actions">
|
||||||
|
<button type="button" class="button-secondary button-small" data-open-modal="warehouse-in-modal" data-item-name="<?= e(WAREHOUSE_KINA) ?>">+ Einzahlen</button>
|
||||||
|
<button type="button" class="button-secondary button-small" data-open-modal="warehouse-out-modal" data-item-id="<?= (int) $kinaItem['id'] ?>" <?= $kinaBalance > 0 ? '' : 'disabled' ?>>− Auszahlen</button>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
<?php if ($canManage): ?>
|
<?php if ($canManage): ?>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<button type="button" class="button-success" data-open-modal="warehouse-in-modal">+ Einlagern</button>
|
<button type="button" class="button-success" data-open-modal="warehouse-in-modal">+ Einlagern</button>
|
||||||
|
|
@ -109,11 +131,11 @@ include __DIR__ . '/includes/header.php';
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if (empty($stock)): ?>
|
<?php if (empty($itemStock)): ?>
|
||||||
<p class="text-muted">Das Lager ist leer.<?= $canManage ? ' Mit „Einlagern“ trägst du den ersten Gegenstand ein.' : '' ?></p>
|
<p class="text-muted">Keine Gegenstände im Lager.<?= $canManage ? ' Mit „Einlagern“ trägst du den ersten Gegenstand ein.' : '' ?></p>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<div class="warehouse-grid" id="warehouse-stock">
|
<div class="warehouse-grid" id="warehouse-stock">
|
||||||
<?php foreach ($stock as $row): ?>
|
<?php foreach ($itemStock as $row): ?>
|
||||||
<div class="warehouse-card" data-name="<?= e(mb_strtolower((string) $row['name'])) ?>" data-category="<?= e((string) $row['category']) ?>">
|
<div class="warehouse-card" data-name="<?= e(mb_strtolower((string) $row['name'])) ?>" data-category="<?= e((string) $row['category']) ?>">
|
||||||
<a class="warehouse-card-link" href="/warehouse.php?item=<?= (int) $row['id'] ?>#verlauf"
|
<a class="warehouse-card-link" href="/warehouse.php?item=<?= (int) $row['id'] ?>#verlauf"
|
||||||
title="<?= e((string) $row['name']) ?> - zuletzt bewegt <?= e(warehouse_format_time($row['last_movement'])) ?>. Klicken für den Verlauf.">
|
title="<?= e((string) $row['name']) ?> - zuletzt bewegt <?= e(warehouse_format_time($row['last_movement'])) ?>. Klicken für den Verlauf.">
|
||||||
|
|
@ -250,7 +272,7 @@ include __DIR__ . '/includes/header.php';
|
||||||
<div class="warehouse-row">
|
<div class="warehouse-row">
|
||||||
<div>
|
<div>
|
||||||
<label for="in-quantity">Anzahl</label>
|
<label for="in-quantity">Anzahl</label>
|
||||||
<input type="number" id="in-quantity" name="quantity" min="1" max="<?= WAREHOUSE_MAX_QUANTITY ?>" required
|
<input type="number" id="in-quantity" name="quantity" min="1" max="<?= WAREHOUSE_MAX_CURRENCY ?>" required
|
||||||
value="<?= e((string) ($oldIn['quantity'] ?? '1')) ?>">
|
value="<?= e((string) ($oldIn['quantity'] ?? '1')) ?>">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -318,5 +340,5 @@ include __DIR__ . '/includes/header.php';
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<script src="/assets/js/warehouse.js"></script>
|
<script src="<?= e(asset_url('/assets/js/warehouse.js')) ?>"></script>
|
||||||
<?php include __DIR__ . '/includes/footer.php'; ?>
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,10 @@ function warehouse_fail(string $form, string $message, array $extra = []): void
|
||||||
*/
|
*/
|
||||||
function warehouse_read_common(string $form, bool $counterpartRequired): array
|
function warehouse_read_common(string $form, bool $counterpartRequired): array
|
||||||
{
|
{
|
||||||
|
// Obergrenze hier die fuer Kina; die fuer Gegenstaende prueft warehouse_check_quantity().
|
||||||
$quantity = filter_var($_POST['quantity'] ?? '', FILTER_VALIDATE_INT);
|
$quantity = filter_var($_POST['quantity'] ?? '', FILTER_VALIDATE_INT);
|
||||||
if ($quantity === false || $quantity < 1 || $quantity > WAREHOUSE_MAX_QUANTITY) {
|
if ($quantity === false || $quantity < 1 || $quantity > WAREHOUSE_MAX_CURRENCY) {
|
||||||
warehouse_fail($form, 'Bitte eine Anzahl zwischen 1 und ' . number_format(WAREHOUSE_MAX_QUANTITY, 0, ',', '.') . ' angeben.');
|
warehouse_fail($form, 'Bitte eine gültige Anzahl angeben.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$occurredAt = warehouse_parse_time((string) ($_POST['occurred_at'] ?? ''));
|
$occurredAt = warehouse_parse_time((string) ($_POST['occurred_at'] ?? ''));
|
||||||
|
|
@ -78,6 +79,15 @@ function warehouse_read_common(string $form, bool $counterpartRequired): array
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Prueft die Menge gegen die Obergrenze der Kategorie (Gegenstaende 1 Mio., Kina 1 Billion). */
|
||||||
|
function warehouse_check_quantity(string $form, int $quantity, string $category, array $extra = []): void
|
||||||
|
{
|
||||||
|
$max = warehouse_max_quantity($category);
|
||||||
|
if ($quantity > $max) {
|
||||||
|
warehouse_fail($form, 'Bitte eine Anzahl zwischen 1 und ' . number_format($max, 0, ',', '.') . ' angeben.', $extra);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function warehouse_insert_movement(int $itemId, string $direction, array $data, int $userId): void
|
function warehouse_insert_movement(int $itemId, string $direction, array $data, int $userId): void
|
||||||
{
|
{
|
||||||
db()->prepare(
|
db()->prepare(
|
||||||
|
|
@ -111,11 +121,12 @@ switch ($action) {
|
||||||
}
|
}
|
||||||
$pdo->prepare("INSERT INTO warehouse_items (name, category, source, created_by) VALUES (?, ?, 'custom', ?)")
|
$pdo->prepare("INSERT INTO warehouse_items (name, category, source, created_by) VALUES (?, ?, 'custom', ?)")
|
||||||
->execute([$itemName, $category, $userId]);
|
->execute([$itemName, $category, $userId]);
|
||||||
$item = ['id' => (int) $pdo->lastInsertId(), 'name' => $itemName];
|
$item = ['id' => (int) $pdo->lastInsertId(), 'name' => $itemName, 'category' => $category];
|
||||||
}
|
}
|
||||||
|
warehouse_check_quantity('in', $data['quantity'], (string) $item['category']);
|
||||||
|
|
||||||
warehouse_insert_movement((int) $item['id'], 'in', $data, $userId);
|
warehouse_insert_movement((int) $item['id'], 'in', $data, $userId);
|
||||||
set_flash('success', $data['quantity'] . '× ' . $item['name'] . ' eingelagert.');
|
set_flash('success', number_format($data['quantity'], 0, ',', '.') . ($item['category'] === 'currency' ? ' ' . $item['name'] . ' eingezahlt.' : '× ' . $item['name'] . ' eingelagert.'));
|
||||||
redirect('/warehouse.php');
|
redirect('/warehouse.php');
|
||||||
|
|
||||||
// ---- Entnehmen ----
|
// ---- Entnehmen ----
|
||||||
|
|
@ -126,22 +137,26 @@ switch ($action) {
|
||||||
$pdo->beginTransaction();
|
$pdo->beginTransaction();
|
||||||
// Zeile des Gegenstands sperren: zwei gleichzeitige Entnahmen koennten sonst beide den
|
// Zeile des Gegenstands sperren: zwei gleichzeitige Entnahmen koennten sonst beide den
|
||||||
// alten Bestand sehen und zusammen mehr entnehmen, als da ist.
|
// alten Bestand sehen und zusammen mehr entnehmen, als da ist.
|
||||||
$stmt = $pdo->prepare('SELECT id, name FROM warehouse_items WHERE id = ? FOR UPDATE');
|
$stmt = $pdo->prepare('SELECT id, name, category FROM warehouse_items WHERE id = ? FOR UPDATE');
|
||||||
$stmt->execute([$itemId]);
|
$stmt->execute([$itemId]);
|
||||||
$item = $stmt->fetch();
|
$item = $stmt->fetch();
|
||||||
if (!$item) {
|
if (!$item) {
|
||||||
$pdo->rollBack();
|
$pdo->rollBack();
|
||||||
warehouse_fail('out', 'Bitte einen Gegenstand aus dem Bestand wählen.');
|
warehouse_fail('out', 'Bitte einen Gegenstand aus dem Bestand wählen.');
|
||||||
}
|
}
|
||||||
|
if ($data['quantity'] > warehouse_max_quantity((string) $item['category'])) {
|
||||||
|
$pdo->rollBack();
|
||||||
|
warehouse_check_quantity('out', $data['quantity'], (string) $item['category']);
|
||||||
|
}
|
||||||
$available = warehouse_item_stock($itemId);
|
$available = warehouse_item_stock($itemId);
|
||||||
if ($data['quantity'] > $available) {
|
if ($data['quantity'] > $available) {
|
||||||
$pdo->rollBack();
|
$pdo->rollBack();
|
||||||
warehouse_fail('out', 'Von „' . $item['name'] . '“ sind nur ' . $available . ' auf Lager.');
|
warehouse_fail('out', 'Von „' . $item['name'] . '“ sind nur ' . number_format($available, 0, ',', '.') . ' auf Lager.');
|
||||||
}
|
}
|
||||||
warehouse_insert_movement($itemId, 'out', $data, $userId);
|
warehouse_insert_movement($itemId, 'out', $data, $userId);
|
||||||
$pdo->commit();
|
$pdo->commit();
|
||||||
|
|
||||||
set_flash('success', $data['quantity'] . '× ' . $item['name'] . ' entnommen.');
|
set_flash('success', number_format($data['quantity'], 0, ',', '.') . ($item['category'] === 'currency' ? ' ' . $item['name'] . ' ausgezahlt.' : '× ' . $item['name'] . ' entnommen.'));
|
||||||
redirect('/warehouse.php');
|
redirect('/warehouse.php');
|
||||||
|
|
||||||
// ---- Eintrag loeschen (Fehleingabe) ----
|
// ---- Eintrag loeschen (Fehleingabe) ----
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue