2 Commits

Author SHA1 Message Date
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
4 changed files with 38 additions and 23 deletions

View File

@@ -3,7 +3,7 @@ Contributors: ronnygrobel
Tags: verein, mitgliederverwaltung, parzellen, zaehler, abrechnung Tags: verein, mitgliederverwaltung, parzellen, zaehler, abrechnung
Requires at least: 6.0 Requires at least: 6.0
Tested up to: 6.8 Tested up to: 6.8
Stable tag: 1.17.1 Stable tag: 1.17.2
Requires PHP: 7.2 Requires PHP: 7.2
License: GPLv2 or later License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -43,6 +43,9 @@ Ja, insbesondere fuer Kleingartenvereine und deren Verwaltungsprozesse.
== Changelog == == Changelog ==
= 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 = = 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. Feat: is_mandatory Flag für Kostenpositionstypen - Kostenposten können jetzt als "verpflichtend" oder "manuell/optional" gekennzeichnet werden. Checkbox in der Kostenposten-Bearbeitung.

View File

@@ -1715,22 +1715,28 @@ class Admin {
$fixed_items = array(); $fixed_items = array();
$fixed_total = 0.0; $fixed_total = 0.0;
// Load parcel-specific cost assignments so that entries with explicit // Load parcel-specific cost assignments so entries can either apply to
// assignments are only charged to the assigned parcels. // all parcels (mandatory) or only to explicitly assigned parcels (manual).
$entries_with_assignments = ( 'parcel' === $statement_type ) $entries_with_assignments = $this->costs->get_entry_ids_with_assignments( $year );
? $this->costs->get_entry_ids_with_assignments( $year ) $subject_assigned_ids = array();
: array();
$parcel_assigned_ids = ( 'parcel' === $statement_type ) foreach ( array_map( 'intval', $parcel_ids ) as $parcel_id ) {
? $this->costs->get_assigned_entry_ids( $subject_id ) $subject_assigned_ids = array_merge( $subject_assigned_ids, $this->costs->get_assigned_entry_ids( $parcel_id ) );
: array(); }
$subject_assigned_ids = array_values( array_unique( array_map( 'intval', $subject_assigned_ids ) ) );
foreach ( $cost_entries as $entry ) { foreach ( $cost_entries as $entry ) {
$entry_id = (int) $entry->id; $entry_id = (int) $entry->id;
$has_assignments = in_array( $entry_id, $entries_with_assignments, true ); $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, if ( ! $is_mandatory && ! $is_assigned ) {
// skip it unless this specific parcel is assigned. continue;
if ( 'parcel' === $statement_type && $has_assignments && ! in_array( $entry_id, $parcel_assigned_ids, true ) ) { }
if ( $is_mandatory && $has_assignments && ! $is_assigned ) {
continue; continue;
} }
@@ -1908,15 +1914,16 @@ class Admin {
<?php else : ?> <?php else : ?>
<ul class='kgvvm-cost-assignment-list'> <ul class='kgvvm-cost-assignment-list'>
<?php foreach ( $cost_entries as $entry ) : <?php foreach ( $cost_entries as $entry ) :
$entry_id = (int) $entry->id; $entry_id = (int) $entry->id;
$is_assigned = in_array( $entry_id, $parcel_assigned_ids, true ); $is_assigned = in_array( $entry_id, $subject_assigned_ids, true );
$has_any = in_array( $entry_id, $entries_with_assignments, true ); $has_any = in_array( $entry_id, $entries_with_assignments, true );
$is_mandatory = ! isset( $entry->is_mandatory ) || (bool) $entry->is_mandatory;
?> ?>
<li> <li>
<span class='kgvvm-entry-name'> <span class='kgvvm-entry-name'>
<?php if ( $is_assigned ) : ?> <?php if ( $is_assigned ) : ?>
<span style='color:#007017;' title='<?php esc_attr_e( 'Diese Parzelle ist zugeordnet', KGVVM_TEXT_DOMAIN ); ?>'>&#10003;</span> <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> <span style='color:#b32d2e;' title='<?php esc_attr_e( 'Diese Parzelle ist nicht zugeordnet', KGVVM_TEXT_DOMAIN ); ?>'>&#10007;</span>
<?php else : ?> <?php else : ?>
<span style='color:#999;' title='<?php esc_attr_e( 'Gilt für alle Parzellen', KGVVM_TEXT_DOMAIN ); ?>'>&#8212;</span> <span style='color:#999;' title='<?php esc_attr_e( 'Gilt für alle Parzellen', KGVVM_TEXT_DOMAIN ); ?>'>&#8212;</span>
@@ -1934,6 +1941,8 @@ class Admin {
<input type='hidden' name='page' value='kgvvm-costs' /> <input type='hidden' name='page' value='kgvvm-costs' />
<button type='submit' class='button button-small'><?php echo esc_html__( 'Entfernen', KGVVM_TEXT_DOMAIN ); ?></button> <button type='submit' class='button button-small'><?php echo esc_html__( 'Entfernen', KGVVM_TEXT_DOMAIN ); ?></button>
</form> </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 : ?> <?php else : ?>
<form method='post' action='<?php echo esc_url( admin_url( 'admin.php' ) ); ?>' style='display:inline;'> <form method='post' action='<?php echo esc_url( admin_url( 'admin.php' ) ); ?>' style='display:inline;'>
<?php wp_nonce_field( 'kgvvm_toggle_parcel_cost' ); ?> <?php wp_nonce_field( 'kgvvm_toggle_parcel_cost' ); ?>
@@ -1951,8 +1960,8 @@ class Admin {
</ul> </ul>
<p class='description' style='margin-top:12px; font-size:11px;'> <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:#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:#b32d2e;'>&#10007;</span> <?php echo esc_html__( 'manuell oder ausgeschlossen', KGVVM_TEXT_DOMAIN ); ?> &nbsp;
<span style='color:#999;'>&#8212;</span> <?php echo esc_html__( 'alle Parzellen', KGVVM_TEXT_DOMAIN ); ?> <span style='color:#999;'>&#8212;</span> <?php echo esc_html__( 'Pflichtposition für alle Parzellen', KGVVM_TEXT_DOMAIN ); ?>
</p> </p>
<?php endif; ?> <?php endif; ?>
</div> </div>

View File

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

View File

@@ -3,7 +3,7 @@ Contributors: ronnygrobel
Tags: verein, mitgliederverwaltung, parzellen, zaehler, abrechnung Tags: verein, mitgliederverwaltung, parzellen, zaehler, abrechnung
Requires at least: 6.0 Requires at least: 6.0
Tested up to: 6.8 Tested up to: 6.8
Stable tag: 1.17.1 Stable tag: 1.17.2
Requires PHP: 7.2 Requires PHP: 7.2
License: GPLv2 or later License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -41,6 +41,9 @@ Ja, insbesondere fuer Kleingartenvereine und deren Verwaltungsprozesse.
== Changelog == == Changelog ==
= 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 = = 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. Feat: is_mandatory Flag für Kostenpositionstypen - Kostenposten können jetzt als "verpflichtend" oder "manuell/optional" gekennzeichnet werden. Checkbox in der Kostenposten-Bearbeitung.