11 Commits

Author SHA1 Message Date
bc89452b5e Bump version to 1.17.5 2026-04-17 21:39:32 +02:00
be8e8832f5 Adjust column widths in statement tables for better text readability 2026-04-17 21:39:15 +02:00
95682bb35f Remove Gesamtkosten column from Abrechnung view 2026-04-17 18:30:41 +02:00
fca849c1a5 Bump version to 1.17.4 2026-04-17 17:44:55 +02:00
80600be607 Fix is_mandatory checkbox not saving when unchecked 2026-04-17 17:44:36 +02:00
6b15d7b2a1 Bump version to 1.17.3 2026-04-17 17:30:30 +02:00
ba45d09bdd Add cost entry status column 2026-04-17 17:28:02 +02:00
e71868dac6 Bump version to 1.17.2 2026-04-17 17:21:40 +02:00
b41e3c7bb1 Fix parcel statement cost assignment behavior 2026-04-17 17:20:51 +02:00
62a25726e8 Bump version to 1.17.1 2026-04-17 17:02:23 +02:00
1e739cfd3f Feature: is_mandatory Flag für Kostenpositionstypen
- Neue Spalte wp_kgvvm_cost_entries.is_mandatory (TINYINT, default 1)
- Kostenposten können jetzt als 'verpflichtend' oder 'manuell/optional' gekennzeichnet werden
- Validator: sanitize_cost_entry() und validate_cost_entry() aktualisiert
- CostRepository.save(): is_mandatory wird gespeichert
- Admin: Checkbox 'Verpflichtende Position' in der Kostenposten-Form hinzugefügt
- Datenbank: ALTER TABLE durchgeführt für existierende Instanzen
2026-04-17 17:02:13 +02:00
7 changed files with 100 additions and 42 deletions

View File

@@ -3,7 +3,7 @@ Contributors: ronnygrobel
Tags: verein, mitgliederverwaltung, parzellen, zaehler, abrechnung
Requires at least: 6.0
Tested up to: 6.8
Stable tag: 1.17.0
Stable tag: 1.17.5
Requires PHP: 7.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -43,6 +43,21 @@ Ja, insbesondere fuer Kleingartenvereine und deren Verwaltungsprozesse.
== Changelog ==
= 1.17.5 =
Fix: Spaltenbreiten in Abrechnungstabellen angepasst für bessere Lesbarkeit langer Texte.
= 1.17.4 =
Fix: Checkbox "Verpflichtende Position" bei Kostenposten wird jetzt korrekt gespeichert wenn sie deaktiviert ist.
= 1.17.3 =
Verbesserung: Kostenübersicht zeigt jetzt direkt pro Kostenposten den Status Verpflichtend oder Manuell in einer eigenen Spalte an.
= 1.17.2 =
Fix: Manuelle Kostenpositionen auf der Jahresabrechnung einer Parzelle werden nach dem Hinzufügen jetzt sofort korrekt berücksichtigt. Pflichtpositionen ohne Einschränkung werden in der Seitenleiste als automatisch aktiv dargestellt.
= 1.17.1 =
Feat: is_mandatory Flag für Kostenpositionstypen - Kostenposten können jetzt als "verpflichtend" oder "manuell/optional" gekennzeichnet werden. Checkbox in der Kostenposten-Bearbeitung.
= 1.17.0 =
Parzellenspezifische Kostenpositionenzuweisung: Kostenposten können jetzt einzelnen Parzellen zugeordnet werden (z.B. Versicherung nur für bestimmte Parzellen). Editor auf der Jahresabrechnung Parzelle Seite mit übersichtlicher Liste und Hinzufügen/Entfernen-Funktionen. Zuordnungen werden in einer separaten Tabelle gespeichert und sind vollständig in Export/Import integriert.

View File

@@ -1373,6 +1373,17 @@ class Admin {
<p class='kgvvm-help'><?php echo esc_html__( 'Betrag je ausgewählter Einheit, also pro Parzelle oder pro Mitglied.', KGVVM_TEXT_DOMAIN ); ?></p>
</td>
</tr>
<tr>
<th scope='row'><?php echo esc_html__( 'Position', KGVVM_TEXT_DOMAIN ); ?></th>
<td>
<label>
<input type='hidden' name='is_mandatory' value='0' />
<input type='checkbox' name='is_mandatory' value='1' <?php checked( $cost ? (bool) $cost->is_mandatory : true, true ); ?> />
<?php echo esc_html__( 'Verpflichtende Position', KGVVM_TEXT_DOMAIN ); ?>
</label>
<p class='kgvvm-help'><?php echo esc_html__( 'Wenn aktiviert: Diese Position wird automatisch in allen Abrechnungen berechnet. Wenn deaktiviert: Diese Position wird als manuelle/optionale Position behandelt.', KGVVM_TEXT_DOMAIN ); ?></p>
</td>
</tr>
<tr>
<th scope='row'><label for='kgvvm-cost-note'><?php echo esc_html__( 'Bemerkung', KGVVM_TEXT_DOMAIN ); ?></label></th>
<td><textarea name='note' id='kgvvm-cost-note' rows='4' class='large-text'><?php echo esc_textarea( $cost ? $cost->note : '' ); ?></textarea></td>
@@ -1456,6 +1467,7 @@ class Admin {
<thead>
<tr>
<th><a href='<?php echo esc_url( $this->sort_url( 'kgvvm-costs', 'name' ) ); ?>'><?php echo esc_html__( 'Name', KGVVM_TEXT_DOMAIN ); ?></a></th>
<th><?php echo esc_html__( 'Status', KGVVM_TEXT_DOMAIN ); ?></th>
<th><?php echo esc_html__( 'Verteilung', KGVVM_TEXT_DOMAIN ); ?></th>
<th><?php echo esc_html__( 'Betrag', KGVVM_TEXT_DOMAIN ); ?></th>
<th><a href='<?php echo esc_url( $this->sort_url( 'kgvvm-costs', 'total_cost' ) ); ?>'><?php echo esc_html__( 'Gesamt im Jahr', KGVVM_TEXT_DOMAIN ); ?></a></th>
@@ -1466,11 +1478,18 @@ class Admin {
</thead>
<tbody>
<?php if ( empty( $rows ) ) : ?>
<tr><td colspan='7'><?php echo esc_html__( 'Für das gewählte Jahr sind noch keine Kostenposten vorhanden.', KGVVM_TEXT_DOMAIN ); ?></td></tr>
<tr><td colspan='8'><?php echo esc_html__( 'Für das gewählte Jahr sind noch keine Kostenposten vorhanden.', KGVVM_TEXT_DOMAIN ); ?></td></tr>
<?php else : ?>
<?php foreach ( $rows as $row ) : ?>
<tr>
<td><strong><?php echo esc_html( $row->name ); ?></strong></td>
<td>
<?php if ( ! isset( $row->is_mandatory ) || (bool) $row->is_mandatory ) : ?>
<span style='color:#007017;'><?php echo esc_html__( 'Verpflichtend', KGVVM_TEXT_DOMAIN ); ?></span>
<?php else : ?>
<span style='color:#9a6700;'><?php echo esc_html__( 'Manuell', KGVVM_TEXT_DOMAIN ); ?></span>
<?php endif; ?>
</td>
<td><?php echo esc_html( $this->get_cost_distribution_label( $row->distribution_type ) ); ?></td>
<td><?php echo esc_html( $this->format_currency( $row->unit_amount ) ); ?></td>
<td><?php echo esc_html( $this->format_currency( $row->calculated_total_cost ) ); ?></td>
@@ -1705,22 +1724,28 @@ class Admin {
$fixed_items = array();
$fixed_total = 0.0;
// Load parcel-specific cost assignments so that entries with explicit
// assignments are only charged to the assigned parcels.
$entries_with_assignments = ( 'parcel' === $statement_type )
? $this->costs->get_entry_ids_with_assignments( $year )
: array();
$parcel_assigned_ids = ( 'parcel' === $statement_type )
? $this->costs->get_assigned_entry_ids( $subject_id )
: array();
// Load parcel-specific cost assignments so entries can either apply to
// all parcels (mandatory) or only to explicitly assigned parcels (manual).
$entries_with_assignments = $this->costs->get_entry_ids_with_assignments( $year );
$subject_assigned_ids = array();
foreach ( array_map( 'intval', $parcel_ids ) as $parcel_id ) {
$subject_assigned_ids = array_merge( $subject_assigned_ids, $this->costs->get_assigned_entry_ids( $parcel_id ) );
}
$subject_assigned_ids = array_values( array_unique( array_map( 'intval', $subject_assigned_ids ) ) );
foreach ( $cost_entries as $entry ) {
$entry_id = (int) $entry->id;
$has_assignments = in_array( $entry_id, $entries_with_assignments, true );
$entry_id = (int) $entry->id;
$has_assignments = in_array( $entry_id, $entries_with_assignments, true );
$is_assigned = in_array( $entry_id, $subject_assigned_ids, true );
$is_mandatory = ! isset( $entry->is_mandatory ) || (bool) $entry->is_mandatory;
// For parcel statements: if this entry has any parcel restrictions,
// skip it unless this specific parcel is assigned.
if ( 'parcel' === $statement_type && $has_assignments && ! in_array( $entry_id, $parcel_assigned_ids, true ) ) {
if ( ! $is_mandatory && ! $is_assigned ) {
continue;
}
if ( $is_mandatory && $has_assignments && ! $is_assigned ) {
continue;
}
@@ -1848,8 +1873,7 @@ class Admin {
<thead>
<tr>
<th><?php echo esc_html__( 'Kostenposten', KGVVM_TEXT_DOMAIN ); ?></th>
<th><?php echo esc_html__( 'Gesamtkosten', KGVVM_TEXT_DOMAIN ); ?></th>
<th><?php echo esc_html__( 'Anteil', KGVVM_TEXT_DOMAIN ); ?></th>
<th style='width:140px; white-space:nowrap;'><?php echo esc_html__( 'Anteil', KGVVM_TEXT_DOMAIN ); ?></th>
</tr>
</thead>
<tbody>
@@ -1860,8 +1884,7 @@ class Admin {
<br /><span class="kgvvm-help"><?php echo esc_html( sprintf( __( '%1$s × %2$s zu je %3$s', KGVVM_TEXT_DOMAIN ), $item['distribution_label'], number_format_i18n( (int) $item['units'], 0 ), $this->format_currency( $item['unit_amount'] ) ) ); ?></span>
<?php echo $item['note'] ? '<br /><span class="kgvvm-help">' . esc_html( $item['note'] ) . '</span>' : ''; ?>
</td>
<td><?php echo esc_html( $this->format_currency( $item['total'] ) ); ?></td>
<td><?php echo esc_html( $this->format_currency( $item['share'] ) ); ?></td>
<td style='width:140px; white-space:nowrap; text-align:right;'><?php echo esc_html( $this->format_currency( $item['share'] ) ); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
@@ -1898,15 +1921,16 @@ class Admin {
<?php else : ?>
<ul class='kgvvm-cost-assignment-list'>
<?php foreach ( $cost_entries as $entry ) :
$entry_id = (int) $entry->id;
$is_assigned = in_array( $entry_id, $parcel_assigned_ids, true );
$has_any = in_array( $entry_id, $entries_with_assignments, true );
$entry_id = (int) $entry->id;
$is_assigned = in_array( $entry_id, $subject_assigned_ids, true );
$has_any = in_array( $entry_id, $entries_with_assignments, true );
$is_mandatory = ! isset( $entry->is_mandatory ) || (bool) $entry->is_mandatory;
?>
<li>
<span class='kgvvm-entry-name'>
<?php if ( $is_assigned ) : ?>
<span style='color:#007017;' title='<?php esc_attr_e( 'Diese Parzelle ist zugeordnet', KGVVM_TEXT_DOMAIN ); ?>'>&#10003;</span>
<?php elseif ( $has_any ) : ?>
<?php elseif ( ! $is_mandatory || $has_any ) : ?>
<span style='color:#b32d2e;' title='<?php esc_attr_e( 'Diese Parzelle ist nicht zugeordnet', KGVVM_TEXT_DOMAIN ); ?>'>&#10007;</span>
<?php else : ?>
<span style='color:#999;' title='<?php esc_attr_e( 'Gilt für alle Parzellen', KGVVM_TEXT_DOMAIN ); ?>'>&#8212;</span>
@@ -1924,6 +1948,8 @@ class Admin {
<input type='hidden' name='page' value='kgvvm-costs' />
<button type='submit' class='button button-small'><?php echo esc_html__( 'Entfernen', KGVVM_TEXT_DOMAIN ); ?></button>
</form>
<?php elseif ( $is_mandatory && ! $has_any ) : ?>
<span class='button button-small' style='pointer-events:none; opacity:.65;'><?php echo esc_html__( 'Automatisch', KGVVM_TEXT_DOMAIN ); ?></span>
<?php else : ?>
<form method='post' action='<?php echo esc_url( admin_url( 'admin.php' ) ); ?>' style='display:inline;'>
<?php wp_nonce_field( 'kgvvm_toggle_parcel_cost' ); ?>
@@ -1941,8 +1967,8 @@ class Admin {
</ul>
<p class='description' style='margin-top:12px; font-size:11px;'>
<span style='color:#007017;'>&#10003;</span> <?php echo esc_html__( 'zugeordnet', KGVVM_TEXT_DOMAIN ); ?> &nbsp;
<span style='color:#b32d2e;'>&#10007;</span> <?php echo esc_html__( 'nicht zugeordnet', KGVVM_TEXT_DOMAIN ); ?> &nbsp;
<span style='color:#999;'>&#8212;</span> <?php echo esc_html__( 'alle Parzellen', KGVVM_TEXT_DOMAIN ); ?>
<span style='color:#b32d2e;'>&#10007;</span> <?php echo esc_html__( 'manuell oder ausgeschlossen', KGVVM_TEXT_DOMAIN ); ?> &nbsp;
<span style='color:#999;'>&#8212;</span> <?php echo esc_html__( 'Pflichtposition für alle Parzellen', KGVVM_TEXT_DOMAIN ); ?>
</p>
<?php endif; ?>
</div>
@@ -2044,24 +2070,24 @@ class Admin {
<h2><?php echo esc_html__( 'Zusammenfassung', KGVVM_TEXT_DOMAIN ); ?></h2>
<table cellpadding="5" cellspacing="0" border="1">
<tr>
<th><strong><?php echo esc_html__( 'Position', KGVVM_TEXT_DOMAIN ); ?></strong></th>
<th><strong><?php echo esc_html__( 'Betrag', KGVVM_TEXT_DOMAIN ); ?></strong></th>
<th style="width:76%;"><strong><?php echo esc_html__( 'Position', KGVVM_TEXT_DOMAIN ); ?></strong></th>
<th style="width:24%; text-align:right; white-space:nowrap;"><strong><?php echo esc_html__( 'Betrag', KGVVM_TEXT_DOMAIN ); ?></strong></th>
</tr>
<tr>
<td><?php echo esc_html__( 'Anteilige Grundkosten', KGVVM_TEXT_DOMAIN ); ?></td>
<td><?php echo esc_html( $this->format_currency( $statement['fixed_total'] ) ); ?></td>
<td style="text-align:right; white-space:nowrap;"><?php echo esc_html( $this->format_currency( $statement['fixed_total'] ) ); ?></td>
</tr>
<tr>
<td><?php echo esc_html__( 'Wasserkosten', KGVVM_TEXT_DOMAIN ); ?></td>
<td><?php echo esc_html( $this->format_currency( $statement['water_cost_total'] ) ); ?></td>
<td style="text-align:right; white-space:nowrap;"><?php echo esc_html( $this->format_currency( $statement['water_cost_total'] ) ); ?></td>
</tr>
<tr>
<td><?php echo esc_html__( 'Stromkosten', KGVVM_TEXT_DOMAIN ); ?></td>
<td><?php echo esc_html( $this->format_currency( $statement['power_cost_total'] ) ); ?></td>
<td style="text-align:right; white-space:nowrap;"><?php echo esc_html( $this->format_currency( $statement['power_cost_total'] ) ); ?></td>
</tr>
<tr>
<td><strong><?php echo esc_html__( 'Gesamtbetrag', KGVVM_TEXT_DOMAIN ); ?></strong></td>
<td><strong><?php echo esc_html( $this->format_currency( $statement['grand_total'] ) ); ?></strong></td>
<td style="text-align:right; white-space:nowrap;"><strong><?php echo esc_html( $this->format_currency( $statement['grand_total'] ) ); ?></strong></td>
</tr>
</table>
@@ -2071,15 +2097,13 @@ class Admin {
<?php else : ?>
<table cellpadding="5" cellspacing="0" border="1">
<tr>
<th><strong><?php echo esc_html__( 'Kostenposten', KGVVM_TEXT_DOMAIN ); ?></strong></th>
<th><strong><?php echo esc_html__( 'Gesamtkosten', KGVVM_TEXT_DOMAIN ); ?></strong></th>
<th><strong><?php echo esc_html__( 'Anteil', KGVVM_TEXT_DOMAIN ); ?></strong></th>
<th style="width:76%;"><strong><?php echo esc_html__( 'Kostenposten', KGVVM_TEXT_DOMAIN ); ?></strong></th>
<th style="width:24%; text-align:right; white-space:nowrap;"><strong><?php echo esc_html__( 'Anteil', KGVVM_TEXT_DOMAIN ); ?></strong></th>
</tr>
<?php foreach ( $statement['fixed_items'] as $item ) : ?>
<tr>
<td><?php echo esc_html( $item['name'] . ' ' . sprintf( __( '%1$s × %2$s zu je %3$s', KGVVM_TEXT_DOMAIN ), $item['distribution_label'], number_format_i18n( (int) $item['units'], 0 ), $this->format_currency( $item['unit_amount'] ) ) ); ?></td>
<td><?php echo esc_html( $this->format_currency( $item['total'] ) ); ?></td>
<td><?php echo esc_html( $this->format_currency( $item['share'] ) ); ?></td>
<td style="width:76%;"><?php echo esc_html( $item['name'] . ' ' . sprintf( __( '%1$s × %2$s zu je %3$s', KGVVM_TEXT_DOMAIN ), $item['distribution_label'], number_format_i18n( (int) $item['units'], 0 ), $this->format_currency( $item['unit_amount'] ) ) ); ?></td>
<td style="width:24%; text-align:right; white-space:nowrap;"><?php echo esc_html( $this->format_currency( $item['share'] ) ); ?></td>
</tr>
<?php endforeach; ?>
</table>

View File

@@ -93,11 +93,12 @@ class CostRepository extends AbstractRepository {
'distribution_type' => isset( $data['distribution_type'] ) ? $data['distribution_type'] : 'parcel',
'unit_amount' => isset( $data['unit_amount'] ) ? (float) $data['unit_amount'] : 0,
'total_cost' => (float) $data['total_cost'],
'is_mandatory' => isset( $data['is_mandatory'] ) ? (int) (bool) $data['is_mandatory'] : 1,
'note' => $data['note'],
'updated_at' => $this->now(),
);
$formats = array( '%d', '%s', '%s', '%f', '%f', '%s', '%s' );
$formats = array( '%d', '%s', '%s', '%f', '%f', '%d', '%s', '%s' );
$this->ensure_year( $payload['entry_year'] );
@@ -107,7 +108,7 @@ class CostRepository extends AbstractRepository {
}
$payload['created_at'] = $this->now();
$this->wpdb->insert( $this->table, $payload, array( '%d', '%s', '%s', '%f', '%f', '%s', '%s', '%s' ) );
$this->wpdb->insert( $this->table, $payload, array( '%d', '%s', '%s', '%f', '%f', '%d', '%s', '%s', '%s' ) );
return $this->wpdb->insert_id;
}

View File

@@ -201,6 +201,7 @@ class Schema {
distribution_type VARCHAR(20) NOT NULL DEFAULT 'parcel',
unit_amount DECIMAL(12,2) NULL,
total_cost DECIMAL(12,2) NOT NULL DEFAULT 0.00,
is_mandatory TINYINT(1) NOT NULL DEFAULT 1,
note TEXT NULL,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,

View File

@@ -259,6 +259,7 @@ class Validator {
$unit_amount = isset( $data['unit_amount'] ) ? str_replace( ',', '.', wp_unslash( $data['unit_amount'] ) ) : '';
$entry_year = $this->sanitize_cost_year( $data );
$distribution_type = sanitize_key( wp_unslash( isset( $data['distribution_type'] ) ? $data['distribution_type'] : 'parcel' ) );
$is_mandatory = isset( $data['is_mandatory'] ) && '1' === (string) wp_unslash( $data['is_mandatory'] );
return array(
'entry_year' => $entry_year,
@@ -266,6 +267,7 @@ class Validator {
'distribution_type' => $distribution_type,
'unit_amount' => '' === trim( (string) $unit_amount ) ? '' : (float) $unit_amount,
'total_cost' => 0.0,
'is_mandatory' => $is_mandatory,
'note' => sanitize_textarea_field( wp_unslash( isset( $data['note'] ) ? $data['note'] : '' ) ),
);
}

View File

@@ -4,7 +4,7 @@
* Plugin Name: KGV Vereinsverwaltung
* Plugin URI: https://apex-project.de/
* Description: Verwaltung von Sparten, Parzellen, Mitgliedern, Pächtern sowie Wasser- und Stromzählern für Kleingartenvereine.
* Version: 1.17.0
* Version: 1.17.5
* Author: Ronny Grobel
* Author URI: https://apex-project.de/
* License: GPL v2 or later
@@ -31,7 +31,7 @@ if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'KGVVM_VERSION', '1.17.0' );
define( 'KGVVM_VERSION', '1.17.5' );
define( 'KGVVM_PLUGIN_FILE', __FILE__ );
define( 'KGVVM_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'KGVVM_PLUGIN_URL', plugin_dir_url( __FILE__ ) );

View File

@@ -3,7 +3,7 @@ Contributors: ronnygrobel
Tags: verein, mitgliederverwaltung, parzellen, zaehler, abrechnung
Requires at least: 6.0
Tested up to: 6.8
Stable tag: 1.17.0
Stable tag: 1.17.5
Requires PHP: 7.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -41,6 +41,21 @@ Ja, insbesondere fuer Kleingartenvereine und deren Verwaltungsprozesse.
== Changelog ==
= 1.17.5 =
Fix: Spaltenbreiten in Abrechnungstabellen angepasst für bessere Lesbarkeit langer Texte.
= 1.17.4 =
Fix: Checkbox "Verpflichtende Position" bei Kostenposten wird jetzt korrekt gespeichert wenn sie deaktiviert ist.
= 1.17.3 =
Verbesserung: Kostenübersicht zeigt jetzt direkt pro Kostenposten den Status Verpflichtend oder Manuell in einer eigenen Spalte an.
= 1.17.2 =
Fix: Manuelle Kostenpositionen auf der Jahresabrechnung einer Parzelle werden nach dem Hinzufügen jetzt sofort korrekt berücksichtigt. Pflichtpositionen ohne Einschränkung werden in der Seitenleiste als automatisch aktiv dargestellt.
= 1.17.1 =
Feat: is_mandatory Flag für Kostenpositionstypen - Kostenposten können jetzt als "verpflichtend" oder "manuell/optional" gekennzeichnet werden. Checkbox in der Kostenposten-Bearbeitung.
= 1.17.0 =
Parzellenspezifische Kostenpositionenzuweisung: Kostenposten können jetzt einzelnen Parzellen zugeordnet werden (z.B. Versicherung nur für bestimmte Parzellen). Editor auf der Jahresabrechnung Parzelle Seite mit übersichtlicher Liste und Hinzufügen/Entfernen-Funktionen. Zuordnungen werden in einer separaten Tabelle gespeichert und sind vollständig in Export/Import integriert.