8 Commits

Author SHA1 Message Date
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
6602a56a1c Bump version to 1.17.0 2026-04-17 16:55:29 +02:00
1a6b1199cd Feature: Parzellenspezifische Kostenpositionsenzuweisung
- Neue Tabelle wp_kgvvm_parcel_cost_assignments für 1:N Zuordnungen
- CostRepository erweitert: get_assigned_entry_ids(), get_entry_ids_with_assignments(), assign_to_parcel(), unassign_from_parcel(), delete_assignments_for_entry()
- Admin: Neue POST-Action toggle_parcel_cost_assignment() mit Nonce-Sicherung
- Jahresabrechnung Parzelle: Rechte Seitenleiste zeigt alle Kostenpositions mit Zuordnungsstatus (✓ zugeordnet, ✗ nicht zugeordnet, – alle Parzellen)
- Berechnung: Kostenposten mit Beschränkung werden nur berechnet wenn Parzelle zugeordnet ist
- DataTransfer.php: parcel_cost_assignments in table_keys integriert für Export/Import
- DELETE-Handler bereinigt Zuordnungen beim Löschen einer Kostenposition
2026-04-17 16:55:09 +02:00
8 changed files with 349 additions and 9 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.16.3
Stable tag: 1.17.3
Requires PHP: 7.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -43,6 +43,18 @@ Ja, insbesondere fuer Kleingartenvereine und deren Verwaltungsprozesse.
== Changelog ==
= 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.
= 1.16.3 =
* Datensicherung erweitert: Export und Import umfassen jetzt zusätzlich die zugehörigen WordPress-Mitgliederkonten inklusive Metadaten.

View File

@@ -249,6 +249,9 @@ class Admin {
case 'import_plugin_data':
$this->import_plugin_data();
break;
case 'toggle_parcel_cost_assignment':
$this->toggle_parcel_cost_assignment();
break;
}
}
@@ -313,6 +316,7 @@ class Admin {
$this->redirect_with_notice( 'kgvvm-costs', 'error', __( 'Der gewünschte Kostenposten wurde nicht gefunden.', KGVVM_TEXT_DOMAIN ), array( 'year' => $year ) );
}
$year = (int) $cost->entry_year;
$this->costs->delete_assignments_for_entry( $id );
$this->costs->delete( $id );
$this->redirect_with_notice( 'kgvvm-costs', 'success', __( 'Kostenposten wurde gelöscht.', KGVVM_TEXT_DOMAIN ), array( 'year' => $year ) );
break;
@@ -835,6 +839,34 @@ class Admin {
$this->redirect_with_notice( 'kgvvm-costs', 'success', __( 'Kostenposten wurde gespeichert.', KGVVM_TEXT_DOMAIN ), array( 'year' => $data['entry_year'] ) );
}
/**
* Add or remove a cost entry assignment for a specific parcel.
*
* @return void
*/
private function toggle_parcel_cost_assignment() {
$this->require_cap( 'manage_kleingarten' );
check_admin_referer( 'kgvvm_toggle_parcel_cost' );
$parcel_id = absint( isset( $_POST['parcel_id'] ) ? $_POST['parcel_id'] : 0 );
$cost_entry_id = absint( isset( $_POST['cost_entry_id'] ) ? $_POST['cost_entry_id'] : 0 );
$mode = isset( $_POST['assignment_mode'] ) ? sanitize_key( wp_unslash( $_POST['assignment_mode'] ) ) : '';
$year = absint( isset( $_POST['year'] ) ? $_POST['year'] : 0 );
if ( $parcel_id < 1 || $cost_entry_id < 1 || ! in_array( $mode, array( 'add', 'remove' ), true ) ) {
$this->redirect_with_notice( 'kgvvm-costs', 'error', __( 'Ungültige Anfrage.', KGVVM_TEXT_DOMAIN ), array( 'view' => 'statement', 'statement_type' => 'parcel', 'subject_id' => $parcel_id, 'year' => $year ) );
}
if ( 'add' === $mode ) {
$this->costs->assign_to_parcel( $parcel_id, $cost_entry_id );
} else {
$this->costs->unassign_from_parcel( $parcel_id, $cost_entry_id );
}
wp_safe_redirect( $this->admin_url( 'kgvvm-costs', array( 'view' => 'statement', 'statement_type' => 'parcel', 'subject_id' => $parcel_id, 'year' => $year ) ) );
exit;
}
/**
* Render dashboard.
*
@@ -1341,6 +1373,16 @@ 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='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>
@@ -1424,6 +1466,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>
@@ -1434,11 +1477,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>
@@ -1673,7 +1723,31 @@ class Admin {
$fixed_items = array();
$fixed_total = 0.0;
// 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 );
$is_assigned = in_array( $entry_id, $subject_assigned_ids, true );
$is_mandatory = ! isset( $entry->is_mandatory ) || (bool) $entry->is_mandatory;
if ( ! $is_mandatory && ! $is_assigned ) {
continue;
}
if ( $is_mandatory && $has_assignments && ! $is_assigned ) {
continue;
}
$distribution_type = $this->get_cost_distribution_type( $entry );
$unit_amount = $this->get_cost_unit_amount( $entry, count( $active_parcels ), count( $active_members ) );
$subject_units = 'member' === $distribution_type ? $subject_member_count : $subject_parcel_count;
@@ -1714,6 +1788,18 @@ class Admin {
return;
}
?>
<style>
@media screen {
.kgvvm-statement-layout { display: flex; gap: 24px; align-items: flex-start; }
.kgvvm-statement-main { flex: 1 1 0; min-width: 0; }
.kgvvm-statement-sidebar { flex: 0 0 300px; width: 300px; }
}
@media print { .kgvvm-statement-sidebar { display: none !important; } }
.kgvvm-cost-assignment-list { list-style: none; margin: 0; padding: 0; }
.kgvvm-cost-assignment-list li { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #f0f0f0; gap: 8px; }
.kgvvm-cost-assignment-list li:last-child { border-bottom: none; }
.kgvvm-cost-assignment-list .kgvvm-entry-name { flex: 1; }
</style>
<div class='wrap kgvvm-print-page'>
<h1><?php echo esc_html( $subject_label ); ?></h1>
<div class='kgvvm-print-actions'>
@@ -1722,6 +1808,9 @@ class Admin {
<a href='<?php echo esc_url( $this->admin_url( 'kgvvm-costs', array( 'year' => $year ) ) ); ?>' class='button-secondary'><?php echo esc_html__( 'Zurück', KGVVM_TEXT_DOMAIN ); ?></a>
</div>
<div class='kgvvm-statement-layout'>
<div class='kgvvm-statement-main'>
<?php if ( ! empty( $settings['pdf_club_name'] ) || ! empty( $settings['pdf_logo_url'] ) || ! empty( $settings['pdf_contact_block'] ) || ! empty( $settings['pdf_intro_text'] ) ) : ?>
<div class='kgvvm-card'>
<table style='width:100%; border-collapse:collapse;'>
@@ -1819,6 +1908,75 @@ class Admin {
<p><?php echo wp_kses_post( nl2br( esc_html( $settings['pdf_footer_text'] ) ) ); ?></p>
</div>
<?php endif; ?>
</div><!-- .kgvvm-statement-main -->
<?php if ( 'parcel' === $statement_type ) : ?>
<div class='kgvvm-statement-sidebar'>
<div class='kgvvm-card'>
<h3 style='margin-top:0;'><?php echo esc_html__( 'Kostenpositionen', KGVVM_TEXT_DOMAIN ); ?></h3>
<p class='description'><?php echo esc_html__( 'Hier legen Sie fest, welche Positionen dieser Parzelle berechnet werden. Positionen ohne Einschränkung gelten für alle Parzellen.', KGVVM_TEXT_DOMAIN ); ?></p>
<?php if ( empty( $cost_entries ) ) : ?>
<p><?php echo esc_html__( 'Für dieses Jahr sind keine Kostenposten hinterlegt.', KGVVM_TEXT_DOMAIN ); ?></p>
<?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, $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 ( ! $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>
<?php endif; ?>
<?php echo esc_html( $entry->name ); ?>
</span>
<?php if ( $is_assigned ) : ?>
<form method='post' action='<?php echo esc_url( admin_url( 'admin.php' ) ); ?>' style='display:inline;'>
<?php wp_nonce_field( 'kgvvm_toggle_parcel_cost' ); ?>
<input type='hidden' name='kgvvm_action' value='toggle_parcel_cost_assignment' />
<input type='hidden' name='parcel_id' value='<?php echo esc_attr( $subject_id ); ?>' />
<input type='hidden' name='cost_entry_id' value='<?php echo esc_attr( $entry_id ); ?>' />
<input type='hidden' name='assignment_mode' value='remove' />
<input type='hidden' name='year' value='<?php echo esc_attr( $year ); ?>' />
<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' ); ?>
<input type='hidden' name='kgvvm_action' value='toggle_parcel_cost_assignment' />
<input type='hidden' name='parcel_id' value='<?php echo esc_attr( $subject_id ); ?>' />
<input type='hidden' name='cost_entry_id' value='<?php echo esc_attr( $entry_id ); ?>' />
<input type='hidden' name='assignment_mode' value='add' />
<input type='hidden' name='year' value='<?php echo esc_attr( $year ); ?>' />
<input type='hidden' name='page' value='kgvvm-costs' />
<button type='submit' class='button button-small button-primary'><?php echo esc_html__( 'Hinzufügen', KGVVM_TEXT_DOMAIN ); ?></button>
</form>
<?php endif; ?>
</li>
<?php endforeach; ?>
</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__( '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>
</div>
<?php endif; ?>
</div><!-- .kgvvm-statement-layout -->
</div>
<?php
}

View File

@@ -33,6 +33,7 @@ class DataTransfer {
'cost_years',
'cost_rates',
'cost_entries',
'parcel_cost_assignments',
'work_jobs',
'work_year_config',
'work_logs',

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;
}
@@ -310,4 +311,146 @@ class CostRepository extends AbstractRepository {
return (float) $total;
}
// -------------------------------------------------------------------------
// Parcel cost assignments
// -------------------------------------------------------------------------
/**
* Get the parcel cost assignments table name.
*
* @return string
*/
private function assignment_table() {
return Schema::table( 'parcel_cost_assignments' );
}
/**
* Get cost entry IDs assigned to a specific parcel.
*
* @param int $parcel_id Parcel ID.
* @return int[]
*/
public function get_assigned_entry_ids( $parcel_id ) {
$parcel_id = absint( $parcel_id );
$table = $this->assignment_table();
if ( $parcel_id < 1 || '' === $table ) {
return array();
}
$ids = $this->wpdb->get_col( $this->wpdb->prepare( "SELECT cost_entry_id FROM {$table} WHERE parcel_id = %d", $parcel_id ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
return array_map( 'intval', (array) $ids );
}
/**
* Get all cost entry IDs that have at least one parcel assignment.
*
* @param int $year Optional filter by entry year (0 = all years).
* @return int[]
*/
public function get_entry_ids_with_assignments( $year = 0 ) {
$table = $this->assignment_table();
if ( '' === $table ) {
return array();
}
$year = absint( $year );
if ( $year > 0 ) {
$ids = $this->wpdb->get_col( $this->wpdb->prepare( // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
"SELECT DISTINCT a.cost_entry_id FROM {$table} a
INNER JOIN {$this->table} e ON e.id = a.cost_entry_id
WHERE e.entry_year = %d",
$year
) );
} else {
$ids = $this->wpdb->get_col( "SELECT DISTINCT cost_entry_id FROM {$table}" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery
}
return array_map( 'intval', (array) $ids );
}
/**
* Assign a cost entry to a parcel.
*
* @param int $parcel_id Parcel ID.
* @param int $cost_entry_id Cost entry ID.
* @return bool
*/
public function assign_to_parcel( $parcel_id, $cost_entry_id ) {
$parcel_id = absint( $parcel_id );
$cost_entry_id = absint( $cost_entry_id );
$table = $this->assignment_table();
if ( $parcel_id < 1 || $cost_entry_id < 1 || '' === $table ) {
return false;
}
$exists = (int) $this->wpdb->get_var( $this->wpdb->prepare( // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
"SELECT COUNT(*) FROM {$table} WHERE parcel_id = %d AND cost_entry_id = %d",
$parcel_id,
$cost_entry_id
) );
if ( $exists > 0 ) {
return true;
}
$result = $this->wpdb->insert(
$table,
array(
'parcel_id' => $parcel_id,
'cost_entry_id' => $cost_entry_id,
'created_at' => $this->now(),
),
array( '%d', '%d', '%s' )
);
return false !== $result;
}
/**
* Remove a cost entry assignment from a parcel.
*
* @param int $parcel_id Parcel ID.
* @param int $cost_entry_id Cost entry ID.
* @return bool
*/
public function unassign_from_parcel( $parcel_id, $cost_entry_id ) {
$parcel_id = absint( $parcel_id );
$cost_entry_id = absint( $cost_entry_id );
$table = $this->assignment_table();
if ( $parcel_id < 1 || $cost_entry_id < 1 || '' === $table ) {
return false;
}
$result = $this->wpdb->delete(
$table,
array(
'parcel_id' => $parcel_id,
'cost_entry_id' => $cost_entry_id,
),
array( '%d', '%d' )
);
return false !== $result;
}
/**
* Remove all parcel assignments for a cost entry (e.g. when the entry is deleted).
*
* @param int $cost_entry_id Cost entry ID.
* @return void
*/
public function delete_assignments_for_entry( $cost_entry_id ) {
$table = $this->assignment_table();
if ( '' !== $table && absint( $cost_entry_id ) > 0 ) {
$this->wpdb->delete( $table, array( 'cost_entry_id' => absint( $cost_entry_id ) ), array( '%d' ) );
}
}
}

View File

@@ -36,8 +36,9 @@ class Schema {
'cost_entries' => $wpdb->prefix . 'kgvvm_cost_entries',
'work_jobs' => $wpdb->prefix . 'kgvvm_work_jobs',
'work_year_config' => $wpdb->prefix . 'kgvvm_work_year_config',
'work_logs' => $wpdb->prefix . 'kgvvm_work_logs',
'work_logs' => $wpdb->prefix . 'kgvvm_work_logs',
'work_log_members' => $wpdb->prefix . 'kgvvm_work_log_members',
'parcel_cost_assignments' => $wpdb->prefix . 'kgvvm_parcel_cost_assignments',
);
return isset( $map[ $key ] ) ? $map[ $key ] : '';
@@ -200,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,
@@ -254,6 +256,14 @@ class Schema {
KEY log_id (log_id)
) {$charset_collate};";
$sql[] = "CREATE TABLE " . self::table( 'parcel_cost_assignments' ) . " (
parcel_id BIGINT UNSIGNED NOT NULL,
cost_entry_id BIGINT UNSIGNED NOT NULL,
created_at DATETIME NOT NULL,
PRIMARY KEY (parcel_id, cost_entry_id),
KEY cost_entry_id (cost_entry_id)
) {$charset_collate};";
foreach ( $sql as $statement ) {
dbDelta( $statement );
}
@@ -283,6 +293,7 @@ class Schema {
self::table( 'work_year_config' ),
self::table( 'work_logs' ),
self::table( 'work_log_members' ),
self::table( 'parcel_cost_assignments' ),
);
foreach ( $tables as $table ) {
@@ -301,6 +312,7 @@ class Schema {
global $wpdb;
$tables = array(
self::table( 'parcel_cost_assignments' ),
self::table( 'work_log_members' ),
self::table( 'work_logs' ),
self::table( 'work_year_config' ),

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'] ) ? (bool) $data['is_mandatory'] : true;
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.16.3
* Version: 1.17.3
* 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.16.3' );
define( 'KGVVM_VERSION', '1.17.3' );
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.16.3
Stable tag: 1.17.3
Requires PHP: 7.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -41,6 +41,18 @@ Ja, insbesondere fuer Kleingartenvereine und deren Verwaltungsprozesse.
== Changelog ==
= 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.
= 1.16.3 =
* Datensicherung erweitert: Export und Import umfassen jetzt zusätzlich die zugehörigen WordPress-Mitgliederkonten inklusive Metadaten.