Compare commits
13 Commits
docs-readm
...
1.16.3
| Author | SHA1 | Date | |
|---|---|---|---|
| a1e6c52eaf | |||
| f1571d3c0e | |||
| 5590306959 | |||
| 96969bb0a2 | |||
| 6c793ad41a | |||
| 295b67dcce | |||
| f69a648ea5 | |||
| 7d3d543954 | |||
| f399cc30bc | |||
| c0c1c46435 | |||
| 7d08fabaa6 | |||
| 199bc911eb | |||
| f08dfc029a |
27
README.md
27
README.md
@@ -1,13 +1,14 @@
|
||||
=== KGV Vereinsverwaltung ===
|
||||
Contributors: ronnygrobel
|
||||
Contributors: ronnygrobel
|
||||
Tags: verein, mitgliederverwaltung, parzellen, zaehler, abrechnung
|
||||
Requires at least: 6.0
|
||||
Tested up to: 6.8
|
||||
Stable tag: 1.15.5
|
||||
Stable tag: 1.16.3
|
||||
Requires PHP: 7.2
|
||||
License: GPLv2 or later
|
||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
|
||||
Umfassende Verwaltung von Vereinsdaten, Parzellen, Mitgliedern und Zaehlerstaenden.
|
||||
|
||||
== Description ==
|
||||
@@ -31,6 +32,7 @@ KGV Vereinsverwaltung bietet ein umfangreiches Backend fuer Kleingartenvereine m
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
|
||||
= Welche Mindestanforderungen gelten? =
|
||||
|
||||
WordPress ab 6.0 und PHP ab 7.2.
|
||||
@@ -41,6 +43,27 @@ Ja, insbesondere fuer Kleingartenvereine und deren Verwaltungsprozesse.
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 1.16.3 =
|
||||
* Datensicherung erweitert: Export und Import umfassen jetzt zusätzlich die zugehörigen WordPress-Mitgliederkonten inklusive Metadaten.
|
||||
|
||||
= 1.16.2 =
|
||||
* Neue Datensicherungsfunktion unter Einstellungen: Export und Import aller kgvvm-Tabellen als JSON.
|
||||
* Import mit Sicherheitsprüfung und vollständigem Überschreiben der vorhandenen Plugin-Daten.
|
||||
|
||||
= 1.16.1 =
|
||||
* Wartungsrelease mit synchronisierter Versionsnummer in Plugin-Header, Konstante und Readme-Dateien.
|
||||
* Release-Tag 1.16.1 gesetzt.
|
||||
|
||||
= 1.16.0 =
|
||||
* Neues Modul Arbeitsstunden im Adminbereich mit drei Bereichen: geleistete Arbeiten, Mitgliederuebersicht und Arbeitsarten.
|
||||
* Pflichtstunden je Mitglied pro Jahr konfigurierbar, inklusive variablem Preis je fehlender Stunde fuer den Aufschlag in der Jahresrechnung.
|
||||
* Arbeitseintraege mit Datum, Arbeitsart und Notiz sowie Mehrfachzuordnung von Mitgliedern mit individuellen Stundenwerten.
|
||||
* Neue Datenbanktabellen fuer Arbeitsarten, Jahreseinstellungen, Arbeitseintraege und Stundenzuordnungen je Mitglied.
|
||||
|
||||
= 1.15.6 =
|
||||
* Versionsabgleich zwischen Plugin-Header, Konstante und Readme.
|
||||
* WordPress-Readme-Format weiter vereinheitlicht.
|
||||
|
||||
= 1.15.5 =
|
||||
* Aktuelle Version laut Plugin-Header.
|
||||
* Kontinuierliche Verbesserungen in Verwaltung und Datenpflege.
|
||||
|
||||
@@ -300,3 +300,21 @@
|
||||
break-inside: avoid;
|
||||
}
|
||||
}
|
||||
|
||||
/* Arbeitsstunden sub-table */
|
||||
.kgvvm-subtable {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
max-width: 480px;
|
||||
}
|
||||
.kgvvm-subtable th,
|
||||
.kgvvm-subtable td {
|
||||
padding: 4px 8px;
|
||||
border: 1px solid #ddd;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.kgvvm-subtable thead th {
|
||||
background: #f9f9f9;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,9 @@ use KGV\VereinManager\Repositories\MeterRepository;
|
||||
use KGV\VereinManager\Repositories\ParcelRepository;
|
||||
use KGV\VereinManager\Repositories\SectionRepository;
|
||||
use KGV\VereinManager\Repositories\TenantRepository;
|
||||
use KGV\VereinManager\Repositories\WorkRepository;
|
||||
use KGV\VereinManager\Services\ParcelService;
|
||||
use KGV\VereinManager\DataTransfer;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
@@ -43,7 +45,9 @@ class Admin {
|
||||
private $assignments;
|
||||
private $chat;
|
||||
private $costs;
|
||||
private $work;
|
||||
private $parcel_service;
|
||||
private $data_transfer;
|
||||
|
||||
/**
|
||||
* Construct admin controller.
|
||||
@@ -58,7 +62,10 @@ class Admin {
|
||||
$this->assignments = new AssignmentRepository();
|
||||
$this->chat = new ChatRepository();
|
||||
$this->costs = new CostRepository();
|
||||
$this->parcel_service = new ParcelService();
|
||||
$this->work = new WorkRepository();
|
||||
$this->parcel_service = new ParcelService();
|
||||
global $wpdb;
|
||||
$this->data_transfer = new DataTransfer( $wpdb );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,6 +108,7 @@ class Admin {
|
||||
add_submenu_page( 'kgvvm-dashboard', __( 'Zähler', KGVVM_TEXT_DOMAIN ), __( 'Zähler', KGVVM_TEXT_DOMAIN ), 'edit_zaehler', 'kgvvm-zaehler', array( $this, 'render_meters_page' ) );
|
||||
add_submenu_page( 'kgvvm-dashboard', __( 'Verbrauch', KGVVM_TEXT_DOMAIN ), __( 'Verbrauch', KGVVM_TEXT_DOMAIN ), $cap, 'kgvvm-consumption', array( $this, 'render_consumption_page' ) );
|
||||
add_submenu_page( 'kgvvm-dashboard', __( 'Kosten', KGVVM_TEXT_DOMAIN ), __( 'Kosten', KGVVM_TEXT_DOMAIN ), $cap, 'kgvvm-costs', array( $this, 'render_costs_page' ) );
|
||||
add_submenu_page( 'kgvvm-dashboard', __( 'Arbeitsstunden', KGVVM_TEXT_DOMAIN ), __( 'Arbeitsstunden', KGVVM_TEXT_DOMAIN ), $cap, 'kgvvm-arbeit', array( $this, 'render_work_page' ) );
|
||||
add_submenu_page( 'kgvvm-dashboard', __( 'Pächter', KGVVM_TEXT_DOMAIN ), __( 'Pächter', KGVVM_TEXT_DOMAIN ), 'edit_paechter', 'kgvvm-paechter', array( $this, 'render_tenants_page' ) );
|
||||
add_submenu_page( 'kgvvm-dashboard', __( 'Einstellungen', KGVVM_TEXT_DOMAIN ), __( 'Einstellungen', KGVVM_TEXT_DOMAIN ), Roles::SETTINGS_CAP, 'kgvvm-settings', array( $this, 'render_settings_page' ) );
|
||||
}
|
||||
@@ -229,6 +237,18 @@ class Admin {
|
||||
case 'save_settings':
|
||||
$this->save_settings();
|
||||
break;
|
||||
case 'save_work_year_config':
|
||||
$this->save_work_year_config();
|
||||
break;
|
||||
case 'save_work_job':
|
||||
$this->save_work_job();
|
||||
break;
|
||||
case 'save_work_log':
|
||||
$this->save_work_log();
|
||||
break;
|
||||
case 'import_plugin_data':
|
||||
$this->import_plugin_data();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,6 +319,30 @@ class Admin {
|
||||
case 'export_readings_csv':
|
||||
$this->export_readings_csv();
|
||||
break;
|
||||
case 'export_plugin_data':
|
||||
$this->require_cap( Roles::SETTINGS_CAP );
|
||||
if ( ! wp_verify_nonce( $nonce, 'kgvvm_export_plugin_data' ) ) {
|
||||
$this->redirect_with_notice( 'kgvvm-settings', 'error', __( 'Export wurde aus Sicherheitsgründen abgebrochen.', KGVVM_TEXT_DOMAIN ) );
|
||||
}
|
||||
$this->data_transfer->send_download();
|
||||
break;
|
||||
case 'delete_work_job':
|
||||
$this->require_cap( 'manage_kleingarten' );
|
||||
if ( ! wp_verify_nonce( $nonce, 'kgvvm_delete_work_job_' . $id ) ) {
|
||||
$this->redirect_with_notice( 'kgvvm-arbeit', 'error', __( 'Der Löschvorgang wurde aus Sicherheitsgründen abgebrochen.', KGVVM_TEXT_DOMAIN ) );
|
||||
}
|
||||
$this->work->delete_job( $id );
|
||||
$this->redirect_with_notice( 'kgvvm-arbeit', 'success', __( 'Arbeitsart wurde gelöscht.', KGVVM_TEXT_DOMAIN ), array( 'tab' => 'jobs' ) );
|
||||
break;
|
||||
case 'delete_work_log':
|
||||
$this->require_cap( 'manage_kleingarten' );
|
||||
$year = absint( isset( $_GET['year'] ) ? $_GET['year'] : current_time( 'Y' ) );
|
||||
if ( ! wp_verify_nonce( $nonce, 'kgvvm_delete_work_log_' . $id ) ) {
|
||||
$this->redirect_with_notice( 'kgvvm-arbeit', 'error', __( 'Der Löschvorgang wurde aus Sicherheitsgründen abgebrochen.', KGVVM_TEXT_DOMAIN ), array( 'year' => $year ) );
|
||||
}
|
||||
$this->work->delete_log( $id );
|
||||
$this->redirect_with_notice( 'kgvvm-arbeit', 'success', __( 'Arbeitseintrag wurde gelöscht.', KGVVM_TEXT_DOMAIN ), array( 'year' => $year ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -654,6 +698,59 @@ class Admin {
|
||||
$this->redirect_with_notice( 'kgvvm-settings', 'success', __( 'Einstellungen wurden gespeichert.', KGVVM_TEXT_DOMAIN ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle plugin data import from an uploaded JSON file.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function import_plugin_data() {
|
||||
$this->require_cap( Roles::SETTINGS_CAP );
|
||||
check_admin_referer( 'kgvvm_import_plugin_data' );
|
||||
|
||||
if ( empty( $_FILES['kgvvm_import_file']['tmp_name'] ) ) {
|
||||
$this->redirect_with_notice( 'kgvvm-settings', 'error', __( 'Bitte eine JSON-Datei auswählen.', KGVVM_TEXT_DOMAIN ) );
|
||||
}
|
||||
|
||||
$file = $_FILES['kgvvm_import_file'];
|
||||
|
||||
// Validate MIME type.
|
||||
$finfo = new \finfo( FILEINFO_MIME_TYPE );
|
||||
$mimetype = $finfo->file( $file['tmp_name'] );
|
||||
if ( ! in_array( $mimetype, array( 'application/json', 'text/plain' ), true ) ) {
|
||||
$this->redirect_with_notice( 'kgvvm-settings', 'error', __( 'Die hochgeladene Datei ist keine gültige JSON-Datei.', KGVVM_TEXT_DOMAIN ) );
|
||||
}
|
||||
|
||||
$raw = file_get_contents( $file['tmp_name'] ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
|
||||
if ( false === $raw ) {
|
||||
$this->redirect_with_notice( 'kgvvm-settings', 'error', __( 'Die Datei konnte nicht gelesen werden.', KGVVM_TEXT_DOMAIN ) );
|
||||
}
|
||||
|
||||
$payload = json_decode( $raw, true );
|
||||
if ( ! is_array( $payload ) ) {
|
||||
$this->redirect_with_notice( 'kgvvm-settings', 'error', __( 'Die JSON-Datei konnte nicht verarbeitet werden. Bitte eine gültige Exportdatei hochladen.', KGVVM_TEXT_DOMAIN ) );
|
||||
}
|
||||
|
||||
$result = $this->data_transfer->import( $payload );
|
||||
|
||||
if ( ! empty( $result['errors'] ) ) {
|
||||
$this->redirect_with_notice( 'kgvvm-settings', 'error', implode( ' | ', $result['errors'] ) );
|
||||
}
|
||||
|
||||
$summary = array();
|
||||
foreach ( $result['imported'] as $key => $count ) {
|
||||
$summary[] = $key . ': ' . $count;
|
||||
}
|
||||
$this->redirect_with_notice(
|
||||
'kgvvm-settings',
|
||||
'success',
|
||||
sprintf(
|
||||
/* translators: %s: summary of imported rows per table */
|
||||
__( 'Import erfolgreich. Importierte Datensätze – %s', KGVVM_TEXT_DOMAIN ),
|
||||
implode( ', ', $summary )
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Persist one year for the cost dropdown.
|
||||
*
|
||||
@@ -751,7 +848,26 @@ class Admin {
|
||||
$meters_free = count( $this->meters->search( array( 'assignment' => 'free' ) ) );
|
||||
$meters_used = count( $this->meters->search( array( 'assignment' => 'assigned' ) ) );
|
||||
$tenants_total = count( $this->tenants->search() );
|
||||
$members_total = count( $this->assignments->get_member_users() );
|
||||
$all_members = $this->assignments->get_member_users();
|
||||
$members_total = count( $all_members );
|
||||
|
||||
// Arbeitsstunden laufendes Jahr
|
||||
$work_year = (int) current_time( 'Y' );
|
||||
$work_config = $this->work->get_year_config( $work_year );
|
||||
$work_summary = $this->work->get_member_summary( $work_year, $all_members );
|
||||
$members_ok = 0;
|
||||
$members_open = 0;
|
||||
$total_missing_h = 0.0;
|
||||
$total_surcharge = 0.0;
|
||||
foreach ( $work_summary as $ws ) {
|
||||
if ( $ws->missing_hours > 0 ) {
|
||||
$members_open++;
|
||||
$total_missing_h += $ws->missing_hours;
|
||||
$total_surcharge += $ws->surcharge;
|
||||
} else {
|
||||
$members_ok++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class='wrap'>
|
||||
<h1><?php echo esc_html__( 'Kleingartenverwaltung', KGVVM_TEXT_DOMAIN ); ?></h1>
|
||||
@@ -784,6 +900,42 @@ class Admin {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php /* Arbeitsstunden-Widget */ ?>
|
||||
<div class='kgvvm-card'>
|
||||
<h2><?php echo esc_html( sprintf( __( 'Arbeitsstunden %d', KGVVM_TEXT_DOMAIN ), $work_year ) ); ?></h2>
|
||||
<?php if ( ! $work_config ) : ?>
|
||||
<p class='kgvvm-help'><?php echo esc_html__( 'Für das laufende Jahr wurden noch keine Jahreseinstellungen für Arbeitsstunden hinterlegt.', KGVVM_TEXT_DOMAIN ); ?>
|
||||
<a href='<?php echo esc_url( $this->admin_url( 'kgvvm-arbeit', array( 'year' => $work_year ) ) ); ?>'><?php echo esc_html__( 'Jetzt einrichten', KGVVM_TEXT_DOMAIN ); ?></a>
|
||||
</p>
|
||||
<?php else : ?>
|
||||
<div class='kgvvm-grid' style='margin-top:8px;'>
|
||||
<div class='kgvvm-card' style='background:#f0faf0;'>
|
||||
<h2 style='color:#2e7d32;'><?php echo esc_html( $members_ok ); ?></h2>
|
||||
<p><?php echo esc_html__( 'Mitglieder erfüllt', KGVVM_TEXT_DOMAIN ); ?></p>
|
||||
</div>
|
||||
<div class='kgvvm-card' style='background:#fff4f4;'>
|
||||
<h2 style='color:#c00;'><?php echo esc_html( $members_open ); ?></h2>
|
||||
<p><?php echo esc_html__( 'Mitglieder mit offenen Stunden', KGVVM_TEXT_DOMAIN ); ?></p>
|
||||
</div>
|
||||
<div class='kgvvm-card' style='background:#fff4f4;'>
|
||||
<h2 style='color:#c00;'><?php echo esc_html( number_format_i18n( $total_missing_h, 2 ) ); ?> Std.</h2>
|
||||
<p><?php echo esc_html__( 'Fehlende Stunden gesamt', KGVVM_TEXT_DOMAIN ); ?></p>
|
||||
</div>
|
||||
<div class='kgvvm-card' style='background:#fff4f4;'>
|
||||
<h2 style='color:#c00;'><?php echo esc_html( $this->format_currency( $total_surcharge ) ); ?></h2>
|
||||
<p><?php echo esc_html__( 'Aufschlag gesamt (Jahresrechnung)', KGVVM_TEXT_DOMAIN ); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ( $members_open > 0 ) : ?>
|
||||
<p style='margin-top:8px;'>
|
||||
<a href='<?php echo esc_url( $this->admin_url( 'kgvvm-arbeit', array( 'year' => $work_year, 'tab' => 'summary' ) ) ); ?>' class='button button-secondary'>
|
||||
<?php echo esc_html__( 'Mitgliederübersicht aufrufen', KGVVM_TEXT_DOMAIN ); ?>
|
||||
</a>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class='kgvvm-card'>
|
||||
<h2><?php echo esc_html__( 'Fachmodell', KGVVM_TEXT_DOMAIN ); ?></h2>
|
||||
<p><?php echo esc_html__( 'Das Plugin verwendet eigene Datenbanktabellen statt Custom Post Types, weil das Fachmodell stark relational ist: Sparten, Parzellen, Zähler, Pächter und Zuordnungen müssen performant gefiltert, eindeutig verknüpft und später um Zählerstände, Verträge oder Umlagen erweitert werden können.', KGVVM_TEXT_DOMAIN ); ?></p>
|
||||
@@ -3239,6 +3391,33 @@ class Admin {
|
||||
</table>
|
||||
<?php submit_button( __( 'Einstellungen speichern', KGVVM_TEXT_DOMAIN ) ); ?>
|
||||
</form>
|
||||
|
||||
<hr />
|
||||
<h2><?php echo esc_html__( 'Datensicherung', KGVVM_TEXT_DOMAIN ); ?></h2>
|
||||
|
||||
<div class='kgvvm-grid'>
|
||||
<div class='kgvvm-card'>
|
||||
<h3><?php echo esc_html__( 'Export', KGVVM_TEXT_DOMAIN ); ?></h3>
|
||||
<p><?php echo esc_html__( 'Exportiert alle Plugin-Tabellen (Sparten, Parzellen, Zähler, Verbrauch, Kosten, Arbeitsstunden usw.) sowie die zugehörigen WordPress-Mitgliederkonten als JSON-Datei.', KGVVM_TEXT_DOMAIN ); ?></p>
|
||||
<a href='<?php echo esc_url( wp_nonce_url( $this->admin_url( 'kgvvm-settings', array( 'kgvvm_action' => 'export_plugin_data' ) ), 'kgvvm_export_plugin_data' ) ); ?>'
|
||||
class='button button-secondary'>
|
||||
<?php echo esc_html__( 'JSON-Export herunterladen', KGVVM_TEXT_DOMAIN ); ?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class='kgvvm-card'>
|
||||
<h3><?php echo esc_html__( 'Import', KGVVM_TEXT_DOMAIN ); ?></h3>
|
||||
<p class='notice notice-warning inline' style='margin:0 0 10px;padding:6px 10px;'>
|
||||
<?php echo esc_html__( 'Achtung: Der Import überschreibt alle vorhandenen Plugin-Daten vollständig. Bitte vorher einen Export erstellen.', KGVVM_TEXT_DOMAIN ); ?>
|
||||
</p>
|
||||
<form method='post' enctype='multipart/form-data'>
|
||||
<?php wp_nonce_field( 'kgvvm_import_plugin_data' ); ?>
|
||||
<input type='hidden' name='kgvvm_action' value='import_plugin_data' />
|
||||
<input type='file' name='kgvvm_import_file' accept='.json,application/json' required style='margin-bottom:8px;display:block;' />
|
||||
<?php submit_button( __( 'Import starten', KGVVM_TEXT_DOMAIN ), 'secondary', 'submit', false ); ?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
@@ -4050,4 +4229,401 @@ class Admin {
|
||||
|
||||
return add_query_arg( $args, admin_url( 'admin.php' ) );
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// ARBEITSSTUNDEN
|
||||
// =========================================================================
|
||||
|
||||
/**
|
||||
* Save work year configuration.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function save_work_year_config() {
|
||||
$this->require_cap( 'manage_kleingarten' );
|
||||
check_admin_referer( 'kgvvm_save_work_year_config' );
|
||||
|
||||
$year = absint( isset( $_POST['entry_year'] ) ? $_POST['entry_year'] : 0 );
|
||||
$required_hours = isset( $_POST['required_hours'] ) ? (float) $_POST['required_hours'] : 0;
|
||||
$price_per_missing_hour = isset( $_POST['price_per_missing_hour'] ) ? (float) $_POST['price_per_missing_hour'] : 0;
|
||||
|
||||
if ( $year < 2000 || $year > 2100 ) {
|
||||
$this->redirect_with_notice( 'kgvvm-arbeit', 'error', __( 'Bitte ein gültiges Jahr eingeben.', KGVVM_TEXT_DOMAIN ) );
|
||||
}
|
||||
|
||||
$this->work->save_year_config( $year, $required_hours, $price_per_missing_hour );
|
||||
$this->redirect_with_notice( 'kgvvm-arbeit', 'success', __( 'Jahreseinstellungen wurden gespeichert.', KGVVM_TEXT_DOMAIN ), array( 'year' => $year ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save work job (add/update).
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function save_work_job() {
|
||||
$this->require_cap( 'manage_kleingarten' );
|
||||
check_admin_referer( 'kgvvm_save_work_job' );
|
||||
|
||||
$id = absint( isset( $_POST['id'] ) ? $_POST['id'] : 0 );
|
||||
$name = sanitize_text_field( wp_unslash( isset( $_POST['job_name'] ) ? $_POST['job_name'] : '' ) );
|
||||
|
||||
if ( '' === $name ) {
|
||||
$this->redirect_with_notice( 'kgvvm-arbeit', 'error', __( 'Bitte einen Namen für die Arbeitsart eingeben.', KGVVM_TEXT_DOMAIN ), array( 'tab' => 'jobs' ) );
|
||||
}
|
||||
|
||||
if ( $this->work->job_name_exists( $name, $id ) ) {
|
||||
$this->redirect_with_notice( 'kgvvm-arbeit', 'error', __( 'Eine Arbeitsart mit diesem Namen existiert bereits.', KGVVM_TEXT_DOMAIN ), array( 'tab' => 'jobs' ) );
|
||||
}
|
||||
|
||||
$this->work->save_job(
|
||||
array(
|
||||
'name' => $name,
|
||||
'description' => isset( $_POST['job_description'] ) ? wp_unslash( $_POST['job_description'] ) : '',
|
||||
),
|
||||
$id
|
||||
);
|
||||
|
||||
$this->redirect_with_notice( 'kgvvm-arbeit', 'success', __( 'Arbeitsart wurde gespeichert.', KGVVM_TEXT_DOMAIN ), array( 'tab' => 'jobs' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save work log entry (add/update).
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function save_work_log() {
|
||||
$this->require_cap( 'manage_kleingarten' );
|
||||
check_admin_referer( 'kgvvm_save_work_log' );
|
||||
|
||||
$id = absint( isset( $_POST['id'] ) ? $_POST['id'] : 0 );
|
||||
$job_id = absint( isset( $_POST['job_id'] ) ? $_POST['job_id'] : 0 );
|
||||
$work_date = sanitize_text_field( wp_unslash( isset( $_POST['work_date'] ) ? $_POST['work_date'] : '' ) );
|
||||
$year = $work_date ? (int) substr( $work_date, 0, 4 ) : (int) current_time( 'Y' );
|
||||
|
||||
if ( '' === $work_date ) {
|
||||
$this->redirect_with_notice( 'kgvvm-arbeit', 'error', __( 'Bitte ein gültiges Datum eingeben.', KGVVM_TEXT_DOMAIN ), array( 'year' => $year ) );
|
||||
}
|
||||
|
||||
$raw_members = isset( $_POST['member_hours'] ) ? (array) wp_unslash( $_POST['member_hours'] ) : array();
|
||||
$members = array();
|
||||
foreach ( $raw_members as $uid => $hours ) {
|
||||
$uid = absint( $uid );
|
||||
$hours = (float) $hours;
|
||||
if ( $uid > 0 && $hours > 0 ) {
|
||||
$members[ $uid ] = $hours;
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $members ) ) {
|
||||
$this->redirect_with_notice( 'kgvvm-arbeit', 'error', __( 'Bitte mindestens ein Mitglied mit Stundenzahl zuordnen.', KGVVM_TEXT_DOMAIN ), array( 'year' => $year ) );
|
||||
}
|
||||
|
||||
$this->work->save_log(
|
||||
array(
|
||||
'job_id' => $job_id,
|
||||
'work_date' => $work_date,
|
||||
'note' => isset( $_POST['note'] ) ? wp_unslash( $_POST['note'] ) : '',
|
||||
),
|
||||
$id,
|
||||
$members
|
||||
);
|
||||
|
||||
$this->redirect_with_notice( 'kgvvm-arbeit', 'success', __( 'Arbeitseintrag wurde gespeichert.', KGVVM_TEXT_DOMAIN ), array( 'year' => $year ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the Arbeitsstunden admin page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function render_work_page() {
|
||||
$this->require_cap( 'manage_kleingarten' );
|
||||
|
||||
$tab = isset( $_GET['tab'] ) ? sanitize_key( wp_unslash( $_GET['tab'] ) ) : 'logs';
|
||||
$selected_year = isset( $_GET['year'] ) ? absint( $_GET['year'] ) : (int) current_time( 'Y' );
|
||||
$selected_year = $selected_year > 0 ? $selected_year : (int) current_time( 'Y' );
|
||||
$edit_log_id = absint( isset( $_GET['id'] ) ? $_GET['id'] : 0 );
|
||||
$edit_job_id = absint( isset( $_GET['job_id'] ) ? $_GET['job_id'] : 0 );
|
||||
|
||||
$years = $this->work->get_years( $selected_year );
|
||||
$year_config = $this->work->get_year_config( $selected_year );
|
||||
$jobs = $this->work->get_jobs();
|
||||
$all_members = $this->assignments->get_member_users();
|
||||
|
||||
$edit_log = null;
|
||||
$edit_job = null;
|
||||
|
||||
if ( $edit_log_id ) {
|
||||
$edit_log = $this->work->find_log( $edit_log_id );
|
||||
}
|
||||
if ( $edit_job_id ) {
|
||||
$edit_job = $this->work->find_job( $edit_job_id );
|
||||
}
|
||||
|
||||
$logs = $this->work->search_logs(
|
||||
array(
|
||||
'year' => $selected_year,
|
||||
'orderby' => isset( $_GET['orderby'] ) ? sanitize_key( wp_unslash( $_GET['orderby'] ) ) : 'work_date',
|
||||
'order' => isset( $_GET['order'] ) ? sanitize_key( wp_unslash( $_GET['order'] ) ) : 'DESC',
|
||||
's' => isset( $_GET['s'] ) ? sanitize_text_field( wp_unslash( $_GET['s'] ) ) : '',
|
||||
)
|
||||
);
|
||||
$summary = $this->work->get_member_summary( $selected_year, $all_members );
|
||||
?>
|
||||
<div class='wrap'>
|
||||
<h1 class='wp-heading-inline'><?php echo esc_html__( 'Arbeitsstunden', KGVVM_TEXT_DOMAIN ); ?></h1>
|
||||
<?php $this->render_notice(); ?>
|
||||
|
||||
<?php /* Year filter */ ?>
|
||||
<form method='get' class='kgvvm-toolbar' style='margin-top:12px;'>
|
||||
<input type='hidden' name='page' value='kgvvm-arbeit' />
|
||||
<input type='hidden' name='tab' value='<?php echo esc_attr( $tab ); ?>' />
|
||||
<div class='kgvvm-filters'>
|
||||
<label for='kgvvm-work-year'><?php echo esc_html__( 'Jahr', KGVVM_TEXT_DOMAIN ); ?></label>
|
||||
<select name='year' id='kgvvm-work-year'>
|
||||
<?php foreach ( $years as $year ) : ?>
|
||||
<option value='<?php echo esc_attr( $year ); ?>' <?php selected( $selected_year, $year ); ?>><?php echo esc_html( $year ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<button class='button'><?php echo esc_html__( 'Filtern', KGVVM_TEXT_DOMAIN ); ?></button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php /* Year config card */ ?>
|
||||
<div class='kgvvm-card' style='max-width:560px;margin-top:16px;'>
|
||||
<h2><?php echo esc_html( sprintf( __( 'Jahreseinstellungen %d', KGVVM_TEXT_DOMAIN ), $selected_year ) ); ?></h2>
|
||||
<form method='post'>
|
||||
<?php wp_nonce_field( 'kgvvm_save_work_year_config' ); ?>
|
||||
<input type='hidden' name='kgvvm_action' value='save_work_year_config' />
|
||||
<input type='hidden' name='entry_year' value='<?php echo esc_attr( $selected_year ); ?>' />
|
||||
<table class='form-table kgvvm-form-table'>
|
||||
<tr>
|
||||
<th scope='row'><label for='kgvvm-work-required-hours'><?php echo esc_html__( 'Pflichtstunden je Mitglied', KGVVM_TEXT_DOMAIN ); ?></label></th>
|
||||
<td><input type='number' min='0' step='0.5' name='required_hours' id='kgvvm-work-required-hours'
|
||||
value='<?php echo esc_attr( $year_config ? (float) $year_config->required_hours : 0 ); ?>' /> <?php echo esc_html__( 'Std.', KGVVM_TEXT_DOMAIN ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope='row'><label for='kgvvm-work-price'><?php echo esc_html__( 'Preis je fehlender Stunde', KGVVM_TEXT_DOMAIN ); ?></label></th>
|
||||
<td><input type='number' min='0' step='0.01' name='price_per_missing_hour' id='kgvvm-work-price'
|
||||
value='<?php echo esc_attr( $year_config ? (float) $year_config->price_per_missing_hour : 0 ); ?>' /> € / Std.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php submit_button( __( 'Einstellungen speichern', KGVVM_TEXT_DOMAIN ), 'secondary' ); ?>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php /* Tabs */ ?>
|
||||
<nav class='nav-tab-wrapper' style='margin-top:20px;'>
|
||||
<a href='<?php echo esc_url( $this->admin_url( 'kgvvm-arbeit', array( 'year' => $selected_year, 'tab' => 'logs' ) ) ); ?>'
|
||||
class='nav-tab <?php echo 'logs' === $tab ? 'nav-tab-active' : ''; ?>'><?php echo esc_html__( 'Geleistete Arbeiten', KGVVM_TEXT_DOMAIN ); ?></a>
|
||||
<a href='<?php echo esc_url( $this->admin_url( 'kgvvm-arbeit', array( 'year' => $selected_year, 'tab' => 'summary' ) ) ); ?>'
|
||||
class='nav-tab <?php echo 'summary' === $tab ? 'nav-tab-active' : ''; ?>'><?php echo esc_html__( 'Mitgliederübersicht', KGVVM_TEXT_DOMAIN ); ?></a>
|
||||
<a href='<?php echo esc_url( $this->admin_url( 'kgvvm-arbeit', array( 'year' => $selected_year, 'tab' => 'jobs' ) ) ); ?>'
|
||||
class='nav-tab <?php echo 'jobs' === $tab ? 'nav-tab-active' : ''; ?>'><?php echo esc_html__( 'Arbeitsarten', KGVVM_TEXT_DOMAIN ); ?></a>
|
||||
</nav>
|
||||
|
||||
<?php if ( 'jobs' === $tab ) : ?>
|
||||
<?php /* ---- ARBEITSARTEN ---- */ ?>
|
||||
<div class='kgvvm-card' style='margin-top:0;border-top:none;padding-top:20px;'>
|
||||
<h2><?php echo esc_html( $edit_job ? __( 'Arbeitsart bearbeiten', KGVVM_TEXT_DOMAIN ) : __( 'Neue Arbeitsart', KGVVM_TEXT_DOMAIN ) ); ?></h2>
|
||||
<form method='post'>
|
||||
<?php wp_nonce_field( 'kgvvm_save_work_job' ); ?>
|
||||
<input type='hidden' name='kgvvm_action' value='save_work_job' />
|
||||
<input type='hidden' name='id' value='<?php echo esc_attr( $edit_job ? $edit_job->id : 0 ); ?>' />
|
||||
<table class='form-table kgvvm-form-table'>
|
||||
<tr>
|
||||
<th scope='row'><label for='kgvvm-job-name'><?php echo esc_html__( 'Name', KGVVM_TEXT_DOMAIN ); ?></label></th>
|
||||
<td><input type='text' class='regular-text' name='job_name' id='kgvvm-job-name' required
|
||||
value='<?php echo esc_attr( $edit_job ? $edit_job->name : '' ); ?>' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope='row'><label for='kgvvm-job-description'><?php echo esc_html__( 'Beschreibung', KGVVM_TEXT_DOMAIN ); ?></label></th>
|
||||
<td><textarea name='job_description' id='kgvvm-job-description' rows='3' class='large-text'><?php echo esc_textarea( $edit_job ? $edit_job->description : '' ); ?></textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php submit_button( $edit_job ? __( 'Arbeitsart aktualisieren', KGVVM_TEXT_DOMAIN ) : __( 'Arbeitsart anlegen', KGVVM_TEXT_DOMAIN ) ); ?>
|
||||
<?php if ( $edit_job ) : ?>
|
||||
<a href='<?php echo esc_url( $this->admin_url( 'kgvvm-arbeit', array( 'year' => $selected_year, 'tab' => 'jobs' ) ) ); ?>' class='button'><?php echo esc_html__( 'Abbrechen', KGVVM_TEXT_DOMAIN ); ?></a>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php if ( ! empty( $jobs ) ) : ?>
|
||||
<table class='wp-list-table widefat fixed striped' style='margin-top:16px;'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo esc_html__( 'Name', KGVVM_TEXT_DOMAIN ); ?></th>
|
||||
<th><?php echo esc_html__( 'Beschreibung', KGVVM_TEXT_DOMAIN ); ?></th>
|
||||
<th style='width:120px;'><?php echo esc_html__( 'Aktionen', KGVVM_TEXT_DOMAIN ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ( $jobs as $job ) : ?>
|
||||
<tr>
|
||||
<td><strong><?php echo esc_html( $job->name ); ?></strong></td>
|
||||
<td><?php echo esc_html( $job->description ); ?></td>
|
||||
<td>
|
||||
<a href='<?php echo esc_url( $this->admin_url( 'kgvvm-arbeit', array( 'tab' => 'jobs', 'year' => $selected_year, 'job_id' => $job->id ) ) ); ?>'><?php echo esc_html__( 'Bearbeiten', KGVVM_TEXT_DOMAIN ); ?></a>
|
||||
|
|
||||
<a href='<?php echo esc_url( wp_nonce_url( $this->admin_url( 'kgvvm-arbeit', array( 'kgvvm_action' => 'delete_work_job', 'id' => $job->id, 'year' => $selected_year, 'tab' => 'jobs' ) ), 'kgvvm_delete_work_job_' . $job->id ) ); ?>'
|
||||
class='kgvvm-delete-link' onclick='return confirm("<?php echo esc_attr__( 'Diese Arbeitsart und alle zugehörigen Einträge wirklich löschen?', KGVVM_TEXT_DOMAIN ); ?>")'><?php echo esc_html__( 'Löschen', KGVVM_TEXT_DOMAIN ); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else : ?>
|
||||
<p class='kgvvm-help'><?php echo esc_html__( 'Noch keine Arbeitsarten angelegt.', KGVVM_TEXT_DOMAIN ); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php elseif ( 'summary' === $tab ) : ?>
|
||||
<?php /* ---- MITGLIEDERÜBERSICHT ---- */ ?>
|
||||
<div style='margin-top:0;'>
|
||||
<?php if ( ! $year_config ) : ?>
|
||||
<p class='notice notice-warning inline'><?php echo esc_html__( 'Für dieses Jahr wurden noch keine Jahreseinstellungen hinterlegt.', KGVVM_TEXT_DOMAIN ); ?></p>
|
||||
<?php endif; ?>
|
||||
<table class='wp-list-table widefat fixed striped' style='margin-top:16px;'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo esc_html__( 'Mitglied', KGVVM_TEXT_DOMAIN ); ?></th>
|
||||
<th><?php echo esc_html__( 'Geleistet (Std.)', KGVVM_TEXT_DOMAIN ); ?></th>
|
||||
<th><?php echo esc_html__( 'Pflicht (Std.)', KGVVM_TEXT_DOMAIN ); ?></th>
|
||||
<th><?php echo esc_html__( 'Fehlend (Std.)', KGVVM_TEXT_DOMAIN ); ?></th>
|
||||
<th><?php echo esc_html__( 'Aufschlag (€)', KGVVM_TEXT_DOMAIN ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if ( empty( $summary ) ) : ?>
|
||||
<tr><td colspan='5'><?php echo esc_html__( 'Keine Mitglieder gefunden.', KGVVM_TEXT_DOMAIN ); ?></td></tr>
|
||||
<?php else : ?>
|
||||
<?php foreach ( $summary as $row ) : ?>
|
||||
<tr>
|
||||
<td><?php echo esc_html( $row->display_name ); ?></td>
|
||||
<td><?php echo esc_html( number_format_i18n( $row->completed_hours, 2 ) ); ?></td>
|
||||
<td><?php echo esc_html( number_format_i18n( $row->required_hours, 2 ) ); ?></td>
|
||||
<td><?php echo $row->missing_hours > 0 ? '<strong style="color:#c00">' . esc_html( number_format_i18n( $row->missing_hours, 2 ) ) . '</strong>' : esc_html( number_format_i18n( 0, 2 ) ); ?></td>
|
||||
<td><?php echo $row->surcharge > 0 ? '<strong style="color:#c00">' . esc_html( $this->format_currency( $row->surcharge ) ) . '</strong>' : '—'; ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php else : ?>
|
||||
<?php /* ---- GELEISTETE ARBEITEN (logs) ---- */ ?>
|
||||
|
||||
<?php /* New/edit log form */ ?>
|
||||
<div class='kgvvm-card' style='margin-top:0;border-top:none;padding-top:20px;'>
|
||||
<h2><?php echo esc_html( $edit_log ? __( 'Arbeitseintrag bearbeiten', KGVVM_TEXT_DOMAIN ) : __( 'Neuer Arbeitseintrag', KGVVM_TEXT_DOMAIN ) ); ?></h2>
|
||||
<form method='post'>
|
||||
<?php wp_nonce_field( 'kgvvm_save_work_log' ); ?>
|
||||
<input type='hidden' name='kgvvm_action' value='save_work_log' />
|
||||
<input type='hidden' name='id' value='<?php echo esc_attr( $edit_log ? $edit_log->id : 0 ); ?>' />
|
||||
<table class='form-table kgvvm-form-table'>
|
||||
<tr>
|
||||
<th scope='row'><label for='kgvvm-log-date'><?php echo esc_html__( 'Datum', KGVVM_TEXT_DOMAIN ); ?></label></th>
|
||||
<td><input type='date' name='work_date' id='kgvvm-log-date' required
|
||||
value='<?php echo esc_attr( $edit_log ? esc_attr( $edit_log->work_date ) : current_time( 'Y-m-d' ) ); ?>' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope='row'><label for='kgvvm-log-job'><?php echo esc_html__( 'Arbeitsart', KGVVM_TEXT_DOMAIN ); ?></label></th>
|
||||
<td>
|
||||
<select name='job_id' id='kgvvm-log-job'>
|
||||
<option value='0'><?php echo esc_html__( '— keine Zuordnung —', KGVVM_TEXT_DOMAIN ); ?></option>
|
||||
<?php foreach ( $jobs as $job ) : ?>
|
||||
<option value='<?php echo esc_attr( $job->id ); ?>' <?php selected( $edit_log ? (int) $edit_log->job_id : 0, (int) $job->id ); ?>><?php echo esc_html( $job->name ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope='row'><label><?php echo esc_html__( 'Mitglieder & Stunden', KGVVM_TEXT_DOMAIN ); ?></label></th>
|
||||
<td>
|
||||
<?php
|
||||
$existing_member_hours = array();
|
||||
if ( $edit_log && ! empty( $edit_log->members ) ) {
|
||||
foreach ( $edit_log->members as $m ) {
|
||||
$existing_member_hours[ (int) $m->user_id ] = (float) $m->hours;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<table class='kgvvm-subtable'>
|
||||
<thead><tr><th><?php echo esc_html__( 'Mitglied', KGVVM_TEXT_DOMAIN ); ?></th><th><?php echo esc_html__( 'Stunden', KGVVM_TEXT_DOMAIN ); ?></th></tr></thead>
|
||||
<tbody>
|
||||
<?php foreach ( $all_members as $member ) : ?>
|
||||
<?php
|
||||
$uid = (int) $member->ID;
|
||||
$hours_val = isset( $existing_member_hours[ $uid ] ) ? $existing_member_hours[ $uid ] : '';
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo esc_html( $member->display_name ); ?></td>
|
||||
<td><input type='number' min='0' step='0.25' style='width:80px;'
|
||||
name='member_hours[<?php echo esc_attr( $uid ); ?>]'
|
||||
value='<?php echo esc_attr( $hours_val ); ?>'
|
||||
placeholder='0' /></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class='description'><?php echo esc_html__( 'Nur Mitglieder mit eingetragenen Stunden werden gespeichert.', KGVVM_TEXT_DOMAIN ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope='row'><label for='kgvvm-log-note'><?php echo esc_html__( 'Notiz', KGVVM_TEXT_DOMAIN ); ?></label></th>
|
||||
<td><textarea name='note' id='kgvvm-log-note' rows='3' class='large-text'><?php echo esc_textarea( $edit_log ? $edit_log->note : '' ); ?></textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php submit_button( $edit_log ? __( 'Arbeitseintrag aktualisieren', KGVVM_TEXT_DOMAIN ) : __( 'Arbeitseintrag speichern', KGVVM_TEXT_DOMAIN ) ); ?>
|
||||
<?php if ( $edit_log ) : ?>
|
||||
<a href='<?php echo esc_url( $this->admin_url( 'kgvvm-arbeit', array( 'year' => $selected_year ) ) ); ?>' class='button'><?php echo esc_html__( 'Abbrechen', KGVVM_TEXT_DOMAIN ); ?></a>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php /* Log list */ ?>
|
||||
<?php if ( ! empty( $logs ) ) : ?>
|
||||
<table class='wp-list-table widefat fixed striped' style='margin-top:16px;'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo esc_html__( 'Datum', KGVVM_TEXT_DOMAIN ); ?></th>
|
||||
<th><?php echo esc_html__( 'Arbeitsart', KGVVM_TEXT_DOMAIN ); ?></th>
|
||||
<th><?php echo esc_html__( 'Mitglieder', KGVVM_TEXT_DOMAIN ); ?></th>
|
||||
<th><?php echo esc_html__( 'Notiz', KGVVM_TEXT_DOMAIN ); ?></th>
|
||||
<th style='width:120px;'><?php echo esc_html__( 'Aktionen', KGVVM_TEXT_DOMAIN ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ( $logs as $log ) : ?>
|
||||
<?php $log_members = $this->work->get_log_members( $log->id ); ?>
|
||||
<tr>
|
||||
<td><?php echo esc_html( date_i18n( get_option( 'date_format' ), strtotime( $log->work_date ) ) ); ?></td>
|
||||
<td><?php echo esc_html( $log->job_name ?: '—' ); ?></td>
|
||||
<td>
|
||||
<?php foreach ( $log_members as $lm ) :
|
||||
$u = get_userdata( $lm->user_id );
|
||||
if ( $u ) : ?>
|
||||
<?php echo esc_html( $u->display_name ); ?>: <strong><?php echo esc_html( number_format_i18n( (float) $lm->hours, 2 ) ); ?> Std.</strong><br>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</td>
|
||||
<td><?php echo esc_html( $log->note ); ?></td>
|
||||
<td>
|
||||
<a href='<?php echo esc_url( $this->admin_url( 'kgvvm-arbeit', array( 'year' => $selected_year, 'id' => $log->id ) ) ); ?>'><?php echo esc_html__( 'Bearbeiten', KGVVM_TEXT_DOMAIN ); ?></a>
|
||||
|
|
||||
<a href='<?php echo esc_url( wp_nonce_url( $this->admin_url( 'kgvvm-arbeit', array( 'kgvvm_action' => 'delete_work_log', 'id' => $log->id, 'year' => $selected_year ) ), 'kgvvm_delete_work_log_' . $log->id ) ); ?>'
|
||||
class='kgvvm-delete-link' onclick='return confirm("<?php echo esc_attr__( 'Diesen Arbeitseintrag wirklich löschen?', KGVVM_TEXT_DOMAIN ); ?>")'><?php echo esc_html__( 'Löschen', KGVVM_TEXT_DOMAIN ); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else : ?>
|
||||
<p class='kgvvm-help' style='margin-top:12px;'><?php echo esc_html( sprintf( __( 'Keine Arbeitseinträge für %d vorhanden.', KGVVM_TEXT_DOMAIN ), $selected_year ) ); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
412
includes/DataTransfer.php
Normal file
412
includes/DataTransfer.php
Normal file
@@ -0,0 +1,412 @@
|
||||
<?php
|
||||
/**
|
||||
* Export and import all kgvvm plugin data as JSON.
|
||||
*
|
||||
* @package KGV\VereinManager
|
||||
*/
|
||||
|
||||
namespace KGV\VereinManager;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class DataTransfer {
|
||||
|
||||
/** @var \wpdb */
|
||||
private $wpdb;
|
||||
|
||||
/**
|
||||
* Table keys in dependency order (parent before child).
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private static $table_keys = array(
|
||||
'sections',
|
||||
'parcels',
|
||||
'tenants',
|
||||
'parcel_members',
|
||||
'parcel_tenants',
|
||||
'meters',
|
||||
'meter_readings',
|
||||
'chat_messages',
|
||||
'cost_years',
|
||||
'cost_rates',
|
||||
'cost_entries',
|
||||
'work_jobs',
|
||||
'work_year_config',
|
||||
'work_logs',
|
||||
'work_log_members',
|
||||
);
|
||||
|
||||
public function __construct( \wpdb $wpdb ) {
|
||||
$this->wpdb = $wpdb;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Export
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Build the export payload as an associative array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function build_export() {
|
||||
$payload = array(
|
||||
'plugin' => 'kgv-verein-manager',
|
||||
'version' => KGVVM_VERSION,
|
||||
'exported' => gmdate( 'Y-m-d\TH:i:s\Z' ),
|
||||
'members' => array(),
|
||||
'tables' => array(),
|
||||
);
|
||||
|
||||
$payload['members'] = $this->export_members();
|
||||
|
||||
foreach ( self::$table_keys as $key ) {
|
||||
$table = Schema::table( $key );
|
||||
if ( '' === $table ) {
|
||||
continue;
|
||||
}
|
||||
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
|
||||
$rows = $this->wpdb->get_results( "SELECT * FROM {$table}", ARRAY_A );
|
||||
$payload['tables'][ $key ] = is_array( $rows ) ? $rows : array();
|
||||
}
|
||||
|
||||
return $payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export all member user accounts relevant to the plugin.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function export_members() {
|
||||
$ids = $this->collect_member_user_ids();
|
||||
|
||||
if ( empty( $ids ) ) {
|
||||
return array(
|
||||
'ids' => array(),
|
||||
'users' => array(),
|
||||
'usermeta' => array(),
|
||||
);
|
||||
}
|
||||
|
||||
$placeholders = implode( ', ', array_fill( 0, count( $ids ), '%d' ) );
|
||||
|
||||
$users_sql = "SELECT ID, user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_activation_key, user_status, display_name
|
||||
FROM {$this->wpdb->users}
|
||||
WHERE ID IN ({$placeholders})
|
||||
ORDER BY ID ASC";
|
||||
|
||||
$meta_sql = "SELECT user_id, meta_key, meta_value
|
||||
FROM {$this->wpdb->usermeta}
|
||||
WHERE user_id IN ({$placeholders})
|
||||
ORDER BY user_id ASC, umeta_id ASC";
|
||||
|
||||
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
$users = $this->wpdb->get_results( $this->wpdb->prepare( $users_sql, $ids ), ARRAY_A );
|
||||
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
$meta = $this->wpdb->get_results( $this->wpdb->prepare( $meta_sql, $ids ), ARRAY_A );
|
||||
|
||||
return array(
|
||||
'ids' => $ids,
|
||||
'users' => is_array( $users ) ? $users : array(),
|
||||
'usermeta' => is_array( $meta ) ? $meta : array(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect all user IDs relevant for member data export.
|
||||
*
|
||||
* @return int[]
|
||||
*/
|
||||
private function collect_member_user_ids() {
|
||||
$ids = array();
|
||||
|
||||
$member_query = new \WP_User_Query(
|
||||
array(
|
||||
'role' => Roles::MEMBER_ROLE,
|
||||
'fields' => 'ID',
|
||||
'number' => 2000,
|
||||
'orderby' => 'ID',
|
||||
'order' => 'ASC',
|
||||
)
|
||||
);
|
||||
$ids = array_merge( $ids, (array) $member_query->get_results() );
|
||||
|
||||
$parcel_members_table = Schema::table( 'parcel_members' );
|
||||
if ( '' !== $parcel_members_table ) {
|
||||
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||
$ids = array_merge( $ids, (array) $this->wpdb->get_col( "SELECT DISTINCT user_id FROM {$parcel_members_table}" ) );
|
||||
}
|
||||
|
||||
$work_log_members_table = Schema::table( 'work_log_members' );
|
||||
if ( '' !== $work_log_members_table ) {
|
||||
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||
$ids = array_merge( $ids, (array) $this->wpdb->get_col( "SELECT DISTINCT user_id FROM {$work_log_members_table}" ) );
|
||||
}
|
||||
|
||||
$ids = array_values( array_unique( array_filter( array_map( 'absint', $ids ) ) ) );
|
||||
sort( $ids, SORT_NUMERIC );
|
||||
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the export as a JSON file download and exit.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function send_download() {
|
||||
$payload = $this->build_export();
|
||||
$json = wp_json_encode( $payload, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE );
|
||||
$filename = 'kgvvm-export-' . gmdate( 'Y-m-d' ) . '.json';
|
||||
|
||||
nocache_headers();
|
||||
header( 'Content-Type: application/json; charset=utf-8' );
|
||||
header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
|
||||
header( 'Content-Length: ' . strlen( $json ) );
|
||||
echo $json; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
exit;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Import
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Validate and import data from a decoded JSON array.
|
||||
*
|
||||
* Returns an array with keys 'imported' (int[]), 'skipped' (string[]), 'errors' (string[]).
|
||||
*
|
||||
* @param array $payload Decoded JSON payload.
|
||||
* @return array
|
||||
*/
|
||||
public function import( array $payload ) {
|
||||
$result = array(
|
||||
'imported' => array(),
|
||||
'skipped' => array(),
|
||||
'errors' => array(),
|
||||
);
|
||||
|
||||
if ( empty( $payload['plugin'] ) || 'kgv-verein-manager' !== $payload['plugin'] ) {
|
||||
$result['errors'][] = __( 'Die Datei stammt nicht vom KGV Verein Manager Plugin.', KGVVM_TEXT_DOMAIN );
|
||||
return $result;
|
||||
}
|
||||
|
||||
if ( empty( $payload['tables'] ) || ! is_array( $payload['tables'] ) ) {
|
||||
$result['errors'][] = __( 'Die Exportdatei enthält keine Tabellendaten.', KGVVM_TEXT_DOMAIN );
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Wrap everything in a transaction so a partial failure can be rolled back.
|
||||
$this->wpdb->query( 'SET FOREIGN_KEY_CHECKS = 0' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||
$this->wpdb->query( 'START TRANSACTION' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||
|
||||
if ( ! empty( $payload['members'] ) && is_array( $payload['members'] ) ) {
|
||||
$member_result = $this->import_members( $payload['members'] );
|
||||
if ( ! empty( $member_result['errors'] ) ) {
|
||||
$result['errors'] = array_merge( $result['errors'], $member_result['errors'] );
|
||||
$this->wpdb->query( 'ROLLBACK' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||
$this->wpdb->query( 'SET FOREIGN_KEY_CHECKS = 1' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||
return $result;
|
||||
}
|
||||
$result['imported']['wp_members'] = isset( $member_result['users'] ) ? (int) $member_result['users'] : 0;
|
||||
$result['imported']['wp_member_meta'] = isset( $member_result['meta'] ) ? (int) $member_result['meta'] : 0;
|
||||
}
|
||||
|
||||
// Truncate in reverse dependency order.
|
||||
foreach ( array_reverse( self::$table_keys ) as $key ) {
|
||||
if ( ! isset( $payload['tables'][ $key ] ) ) {
|
||||
continue;
|
||||
}
|
||||
$table = Schema::table( $key );
|
||||
if ( '' === $table ) {
|
||||
continue;
|
||||
}
|
||||
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||
$this->wpdb->query( "TRUNCATE TABLE {$table}" );
|
||||
}
|
||||
|
||||
// Re-insert in dependency order.
|
||||
foreach ( self::$table_keys as $key ) {
|
||||
if ( ! isset( $payload['tables'][ $key ] ) ) {
|
||||
$result['skipped'][] = $key;
|
||||
continue;
|
||||
}
|
||||
|
||||
$table = Schema::table( $key );
|
||||
if ( '' === $table ) {
|
||||
$result['skipped'][] = $key;
|
||||
continue;
|
||||
}
|
||||
|
||||
$rows = (array) $payload['tables'][ $key ];
|
||||
$count = 0;
|
||||
|
||||
foreach ( $rows as $row ) {
|
||||
if ( ! is_array( $row ) || empty( $row ) ) {
|
||||
continue;
|
||||
}
|
||||
// Sanitize keys – only allow simple column names.
|
||||
$clean = array();
|
||||
foreach ( $row as $col => $val ) {
|
||||
$col_clean = preg_replace( '/[^a-zA-Z0-9_]/', '', (string) $col );
|
||||
if ( '' !== $col_clean ) {
|
||||
$clean[ $col_clean ] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$inserted = $this->wpdb->insert( $table, $clean ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||
if ( false !== $inserted ) {
|
||||
$count++;
|
||||
} else {
|
||||
$result['errors'][] = sprintf(
|
||||
/* translators: 1: table key 2: DB error */
|
||||
__( 'Fehler beim Einfügen in %1$s: %2$s', KGVVM_TEXT_DOMAIN ),
|
||||
$key,
|
||||
(string) $this->wpdb->last_error
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$result['imported'][ $key ] = $count;
|
||||
}
|
||||
|
||||
if ( empty( $result['errors'] ) ) {
|
||||
$this->wpdb->query( 'COMMIT' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||
} else {
|
||||
$this->wpdb->query( 'ROLLBACK' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||
}
|
||||
|
||||
$this->wpdb->query( 'SET FOREIGN_KEY_CHECKS = 1' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import member user accounts and their usermeta.
|
||||
*
|
||||
* @param array $members Member payload from export.
|
||||
* @return array
|
||||
*/
|
||||
private function import_members( array $members ) {
|
||||
$result = array(
|
||||
'users' => 0,
|
||||
'meta' => 0,
|
||||
'errors' => array(),
|
||||
);
|
||||
|
||||
$users = isset( $members['users'] ) && is_array( $members['users'] ) ? $members['users'] : array();
|
||||
$meta = isset( $members['usermeta'] ) && is_array( $members['usermeta'] ) ? $members['usermeta'] : array();
|
||||
|
||||
if ( empty( $users ) ) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$imported_user_ids = array();
|
||||
|
||||
foreach ( $users as $row ) {
|
||||
if ( ! is_array( $row ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$user_id = isset( $row['ID'] ) ? absint( $row['ID'] ) : 0;
|
||||
$login = isset( $row['user_login'] ) ? sanitize_user( (string) $row['user_login'], true ) : '';
|
||||
$email = isset( $row['user_email'] ) ? sanitize_email( (string) $row['user_email'] ) : '';
|
||||
|
||||
if ( $user_id < 1 || '' === $login || '' === $email ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'user_login' => $login,
|
||||
'user_pass' => isset( $row['user_pass'] ) ? (string) $row['user_pass'] : '',
|
||||
'user_nicename' => isset( $row['user_nicename'] ) ? sanitize_title( (string) $row['user_nicename'] ) : sanitize_title( $login ),
|
||||
'user_email' => $email,
|
||||
'user_url' => isset( $row['user_url'] ) ? esc_url_raw( (string) $row['user_url'] ) : '',
|
||||
'user_registered' => isset( $row['user_registered'] ) ? (string) $row['user_registered'] : current_time( 'mysql', true ),
|
||||
'user_activation_key' => isset( $row['user_activation_key'] ) ? (string) $row['user_activation_key'] : '',
|
||||
'user_status' => isset( $row['user_status'] ) ? (int) $row['user_status'] : 0,
|
||||
'display_name' => isset( $row['display_name'] ) ? sanitize_text_field( (string) $row['display_name'] ) : $login,
|
||||
);
|
||||
|
||||
$exists = (int) $this->wpdb->get_var( $this->wpdb->prepare( "SELECT COUNT(*) FROM {$this->wpdb->users} WHERE ID = %d", $user_id ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
|
||||
if ( $exists > 0 ) {
|
||||
$updated = $this->wpdb->update( $this->wpdb->users, $data, array( 'ID' => $user_id ) );
|
||||
if ( false === $updated ) {
|
||||
$result['errors'][] = sprintf(
|
||||
/* translators: %d: user id */
|
||||
__( 'Mitglied mit ID %d konnte nicht aktualisiert werden.', KGVVM_TEXT_DOMAIN ),
|
||||
$user_id
|
||||
);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
$insert_data = $data;
|
||||
$insert_data['ID'] = $user_id;
|
||||
$inserted = $this->wpdb->insert( $this->wpdb->users, $insert_data );
|
||||
if ( false === $inserted ) {
|
||||
$result['errors'][] = sprintf(
|
||||
/* translators: 1: user id 2: DB error */
|
||||
__( 'Mitglied mit ID %1$d konnte nicht angelegt werden: %2$s', KGVVM_TEXT_DOMAIN ),
|
||||
$user_id,
|
||||
(string) $this->wpdb->last_error
|
||||
);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$imported_user_ids[] = $user_id;
|
||||
$result['users']++;
|
||||
}
|
||||
|
||||
$imported_user_ids = array_values( array_unique( array_filter( array_map( 'absint', $imported_user_ids ) ) ) );
|
||||
|
||||
if ( empty( $imported_user_ids ) || empty( $meta ) ) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$placeholders = implode( ', ', array_fill( 0, count( $imported_user_ids ), '%d' ) );
|
||||
$delete_sql = "DELETE FROM {$this->wpdb->usermeta} WHERE user_id IN ({$placeholders})";
|
||||
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
$this->wpdb->query( $this->wpdb->prepare( $delete_sql, $imported_user_ids ) );
|
||||
|
||||
$allowed_ids = array_flip( $imported_user_ids );
|
||||
|
||||
foreach ( $meta as $row ) {
|
||||
if ( ! is_array( $row ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$user_id = isset( $row['user_id'] ) ? absint( $row['user_id'] ) : 0;
|
||||
if ( $user_id < 1 || ! isset( $allowed_ids[ $user_id ] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$meta_key = isset( $row['meta_key'] ) ? (string) $row['meta_key'] : '';
|
||||
if ( '' === $meta_key ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$meta_value = isset( $row['meta_value'] ) ? maybe_serialize( maybe_unserialize( $row['meta_value'] ) ) : '';
|
||||
|
||||
$inserted = $this->wpdb->insert(
|
||||
$this->wpdb->usermeta,
|
||||
array(
|
||||
'user_id' => $user_id,
|
||||
'meta_key' => $meta_key,
|
||||
'meta_value' => $meta_value,
|
||||
)
|
||||
);
|
||||
|
||||
if ( false !== $inserted ) {
|
||||
$result['meta']++;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
470
includes/Repositories/WorkRepository.php
Normal file
470
includes/Repositories/WorkRepository.php
Normal file
@@ -0,0 +1,470 @@
|
||||
<?php
|
||||
/**
|
||||
* Work hours repository.
|
||||
*
|
||||
* @package KGV\VereinManager
|
||||
*/
|
||||
|
||||
namespace KGV\VereinManager\Repositories;
|
||||
|
||||
use KGV\VereinManager\Schema;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class WorkRepository extends AbstractRepository {
|
||||
|
||||
/**
|
||||
* Resolve main table (work_logs).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function resolve_table() {
|
||||
return Schema::table( 'work_logs' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Jobs table.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function jobs_table() {
|
||||
return Schema::table( 'work_jobs' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Year config table.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function year_config_table() {
|
||||
return Schema::table( 'work_year_config' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Log members table.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function members_table() {
|
||||
return Schema::table( 'work_log_members' );
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Jobs
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get all jobs.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_jobs() {
|
||||
$table = $this->jobs_table();
|
||||
return $this->wpdb->get_results( "SELECT * FROM {$table} ORDER BY name ASC" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a single job by ID.
|
||||
*
|
||||
* @param int $id Job ID.
|
||||
* @return object|null
|
||||
*/
|
||||
public function find_job( $id ) {
|
||||
$table = $this->jobs_table();
|
||||
return $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM {$table} WHERE id = %d", absint( $id ) ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
}
|
||||
|
||||
/**
|
||||
* Save or update a job.
|
||||
*
|
||||
* @param array $data Job data.
|
||||
* @param int $id Optional ID.
|
||||
* @return int|false
|
||||
*/
|
||||
public function save_job( $data, $id = 0 ) {
|
||||
$table = $this->jobs_table();
|
||||
$payload = array(
|
||||
'name' => sanitize_text_field( $data['name'] ),
|
||||
'description' => isset( $data['description'] ) ? sanitize_textarea_field( $data['description'] ) : '',
|
||||
'updated_at' => $this->now(),
|
||||
);
|
||||
$formats = array( '%s', '%s', '%s' );
|
||||
|
||||
if ( $id > 0 ) {
|
||||
$this->wpdb->update( $table, $payload, array( 'id' => $id ), $formats, array( '%d' ) );
|
||||
return $id;
|
||||
}
|
||||
|
||||
$payload['created_at'] = $this->now();
|
||||
$this->wpdb->insert( $table, $payload, array( '%s', '%s', '%s', '%s' ) );
|
||||
return $this->wpdb->insert_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a job and related log members/logs.
|
||||
*
|
||||
* @param int $id Job ID.
|
||||
* @return bool
|
||||
*/
|
||||
public function delete_job( $id ) {
|
||||
$id = absint( $id );
|
||||
$logs_table = $this->table;
|
||||
$mem_table = $this->members_table();
|
||||
$jobs_table = $this->jobs_table();
|
||||
|
||||
// Delete members of all logs for this job.
|
||||
$log_ids = $this->wpdb->get_col( $this->wpdb->prepare( "SELECT id FROM {$logs_table} WHERE job_id = %d", $id ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
foreach ( array_map( 'absint', (array) $log_ids ) as $log_id ) {
|
||||
$this->wpdb->delete( $mem_table, array( 'log_id' => $log_id ), array( '%d' ) );
|
||||
}
|
||||
// Delete logs.
|
||||
$this->wpdb->delete( $logs_table, array( 'job_id' => $id ), array( '%d' ) );
|
||||
// Delete job.
|
||||
$result = $this->wpdb->delete( $jobs_table, array( 'id' => $id ), array( '%d' ) );
|
||||
return false !== $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a job name already exists (for uniqueness).
|
||||
*
|
||||
* @param string $name Job name.
|
||||
* @param int $exclude_id Exclude this ID.
|
||||
* @return bool
|
||||
*/
|
||||
public function job_name_exists( $name, $exclude_id = 0 ) {
|
||||
$table = $this->jobs_table();
|
||||
$sql = $this->wpdb->prepare( "SELECT COUNT(*) FROM {$table} WHERE name = %s", sanitize_text_field( $name ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
if ( $exclude_id > 0 ) {
|
||||
$sql .= $this->wpdb->prepare( ' AND id != %d', absint( $exclude_id ) );
|
||||
}
|
||||
return (int) $this->wpdb->get_var( $sql ) > 0; // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Year config
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get config for a specific year (creates if missing).
|
||||
*
|
||||
* @param int $year Year.
|
||||
* @return object|null
|
||||
*/
|
||||
public function get_year_config( $year ) {
|
||||
$year = absint( $year );
|
||||
$table = $this->year_config_table();
|
||||
$row = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM {$table} WHERE entry_year = %d", $year ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all available configured years.
|
||||
*
|
||||
* @param int $selected_year Optional selected year to always include.
|
||||
* @return array
|
||||
*/
|
||||
public function get_years( $selected_year = 0 ) {
|
||||
$config_table = $this->year_config_table();
|
||||
$log_table = $this->table;
|
||||
$current_year = (int) current_time( 'Y' );
|
||||
|
||||
$config_years = $this->wpdb->get_col( "SELECT entry_year FROM {$config_table} ORDER BY entry_year DESC" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||
$log_years = $this->wpdb->get_col( "SELECT DISTINCT YEAR(work_date) FROM {$log_table}" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||
|
||||
$years = array_map( 'absint', array_merge( (array) $config_years, (array) $log_years ) );
|
||||
$years[] = $current_year;
|
||||
$years[] = $current_year - 1;
|
||||
$years[] = $current_year + 1;
|
||||
if ( $selected_year > 0 ) {
|
||||
$years[] = absint( $selected_year );
|
||||
}
|
||||
|
||||
$years = array_values( array_unique( array_filter( $years ) ) );
|
||||
rsort( $years, SORT_NUMERIC );
|
||||
return $years;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save year configuration (upsert).
|
||||
*
|
||||
* @param int $year Year.
|
||||
* @param float $required_hours Required hours per member.
|
||||
* @param float $price_per_missing_hour Price per missing hour in €.
|
||||
* @return bool
|
||||
*/
|
||||
public function save_year_config( $year, $required_hours, $price_per_missing_hour ) {
|
||||
$year = absint( $year );
|
||||
$required_hours = max( 0, (float) $required_hours );
|
||||
$price_per_missing_hour = max( 0, (float) $price_per_missing_hour );
|
||||
$table = $this->year_config_table();
|
||||
$existing = $this->get_year_config( $year );
|
||||
|
||||
if ( $existing ) {
|
||||
$result = $this->wpdb->update(
|
||||
$table,
|
||||
array(
|
||||
'required_hours' => $required_hours,
|
||||
'price_per_missing_hour' => $price_per_missing_hour,
|
||||
'updated_at' => $this->now(),
|
||||
),
|
||||
array( 'entry_year' => $year ),
|
||||
array( '%f', '%f', '%s' ),
|
||||
array( '%d' )
|
||||
);
|
||||
return false !== $result;
|
||||
}
|
||||
|
||||
$result = $this->wpdb->insert(
|
||||
$table,
|
||||
array(
|
||||
'entry_year' => $year,
|
||||
'required_hours' => $required_hours,
|
||||
'price_per_missing_hour' => $price_per_missing_hour,
|
||||
'created_at' => $this->now(),
|
||||
'updated_at' => $this->now(),
|
||||
),
|
||||
array( '%d', '%f', '%f', '%s', '%s' )
|
||||
);
|
||||
return false !== $result;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Work logs
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Search work logs.
|
||||
*
|
||||
* @param array $args Query arguments (year, user_id, job_id, s, orderby, order).
|
||||
* @return array
|
||||
*/
|
||||
public function search_logs( $args = array() ) {
|
||||
$year = isset( $args['year'] ) ? absint( $args['year'] ) : 0;
|
||||
$user_id = isset( $args['user_id'] ) ? absint( $args['user_id'] ) : 0;
|
||||
$job_id = isset( $args['job_id'] ) ? absint( $args['job_id'] ) : 0;
|
||||
$search = isset( $args['s'] ) ? sanitize_text_field( wp_unslash( $args['s'] ) ) : '';
|
||||
$orderby = $this->sanitize_orderby(
|
||||
isset( $args['orderby'] ) ? sanitize_key( wp_unslash( $args['orderby'] ) ) : 'work_date',
|
||||
array( 'work_date', 'job_name', 'updated_at', 'created_at' ),
|
||||
'work_date'
|
||||
);
|
||||
$order = $this->sanitize_order( isset( $args['order'] ) ? sanitize_key( wp_unslash( $args['order'] ) ) : 'DESC' );
|
||||
|
||||
$logs_table = $this->table;
|
||||
$jobs_table = $this->jobs_table();
|
||||
$mem_table = $this->members_table();
|
||||
|
||||
$sql = "SELECT l.*, COALESCE(j.name, '') AS job_name FROM {$logs_table} l
|
||||
LEFT JOIN {$jobs_table} j ON j.id = l.job_id WHERE 1=1";
|
||||
$params = array();
|
||||
|
||||
if ( $year > 0 ) {
|
||||
$sql .= ' AND YEAR(l.work_date) = %d';
|
||||
$params[] = $year;
|
||||
}
|
||||
|
||||
if ( $job_id > 0 ) {
|
||||
$sql .= ' AND l.job_id = %d';
|
||||
$params[] = $job_id;
|
||||
}
|
||||
|
||||
if ( $user_id > 0 ) {
|
||||
$sql .= " AND l.id IN (SELECT log_id FROM {$mem_table} WHERE user_id = %d)";
|
||||
$params[] = $user_id;
|
||||
}
|
||||
|
||||
if ( '' !== $search ) {
|
||||
$like = '%' . $this->wpdb->esc_like( $search ) . '%';
|
||||
$sql .= ' AND (j.name LIKE %s OR l.note LIKE %s)';
|
||||
$params[] = $like;
|
||||
$params[] = $like;
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY l.{$orderby} {$order}, l.id DESC";
|
||||
|
||||
if ( ! empty( $params ) ) {
|
||||
return $this->wpdb->get_results( $this->wpdb->prepare( $sql, $params ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
}
|
||||
|
||||
return $this->wpdb->get_results( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a work log with its member assignments.
|
||||
*
|
||||
* @param int $id Log ID.
|
||||
* @return object|null
|
||||
*/
|
||||
public function find_log( $id ) {
|
||||
$row = $this->find( $id );
|
||||
if ( $row ) {
|
||||
$row->members = $this->get_log_members( $id );
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save or update a work log including member assignments.
|
||||
*
|
||||
* @param array $data Log data.
|
||||
* @param int $id Optional log ID.
|
||||
* @param array $members Array of [user_id => hours].
|
||||
* @return int|false
|
||||
*/
|
||||
public function save_log( $data, $id = 0, $members = array() ) {
|
||||
$payload = array(
|
||||
'job_id' => absint( $data['job_id'] ),
|
||||
'work_date' => sanitize_text_field( $data['work_date'] ),
|
||||
'note' => isset( $data['note'] ) ? sanitize_textarea_field( $data['note'] ) : '',
|
||||
'updated_at' => $this->now(),
|
||||
);
|
||||
$formats = array( '%d', '%s', '%s', '%s' );
|
||||
|
||||
if ( $id > 0 ) {
|
||||
$this->wpdb->update( $this->table, $payload, array( 'id' => $id ), $formats, array( '%d' ) );
|
||||
$log_id = $id;
|
||||
} else {
|
||||
$payload['created_at'] = $this->now();
|
||||
$this->wpdb->insert( $this->table, $payload, array( '%d', '%s', '%s', '%s', '%s' ) );
|
||||
$log_id = $this->wpdb->insert_id;
|
||||
}
|
||||
|
||||
if ( $log_id && is_array( $members ) ) {
|
||||
$this->sync_log_members( $log_id, $members );
|
||||
}
|
||||
|
||||
return $log_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a work log and its member assignments.
|
||||
*
|
||||
* @param int $id Log ID.
|
||||
* @return bool
|
||||
*/
|
||||
public function delete_log( $id ) {
|
||||
$id = absint( $id );
|
||||
$this->wpdb->delete( $this->members_table(), array( 'log_id' => $id ), array( '%d' ) );
|
||||
$result = $this->wpdb->delete( $this->table, array( 'id' => $id ), array( '%d' ) );
|
||||
return false !== $result;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Log members
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get member assignments for a log.
|
||||
*
|
||||
* @param int $log_id Log ID.
|
||||
* @return array
|
||||
*/
|
||||
public function get_log_members( $log_id ) {
|
||||
$table = $this->members_table();
|
||||
return $this->wpdb->get_results( $this->wpdb->prepare( "SELECT * FROM {$table} WHERE log_id = %d", absint( $log_id ) ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync member assignments for a log.
|
||||
*
|
||||
* @param int $log_id Log ID.
|
||||
* @param array $members Array of [user_id => hours].
|
||||
* @return void
|
||||
*/
|
||||
public function sync_log_members( $log_id, $members ) {
|
||||
$log_id = absint( $log_id );
|
||||
$table = $this->members_table();
|
||||
$now = $this->now();
|
||||
|
||||
$this->wpdb->delete( $table, array( 'log_id' => $log_id ), array( '%d' ) );
|
||||
|
||||
foreach ( $members as $user_id => $hours ) {
|
||||
$user_id = absint( $user_id );
|
||||
$hours = max( 0, (float) $hours );
|
||||
if ( $user_id < 1 ) {
|
||||
continue;
|
||||
}
|
||||
$this->wpdb->insert(
|
||||
$table,
|
||||
array(
|
||||
'log_id' => $log_id,
|
||||
'user_id' => $user_id,
|
||||
'hours' => $hours,
|
||||
'created_at' => $now,
|
||||
),
|
||||
array( '%d', '%d', '%f', '%s' )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Summary / statistics
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Get completed hours per member for a given year.
|
||||
*
|
||||
* @param int $year Year.
|
||||
* @return array Array keyed by user_id with total hours.
|
||||
*/
|
||||
public function get_hours_per_member( $year ) {
|
||||
$year = absint( $year );
|
||||
$log_table = $this->table;
|
||||
$mem_table = $this->members_table();
|
||||
|
||||
$rows = $this->wpdb->get_results(
|
||||
$this->wpdb->prepare(
|
||||
"SELECT m.user_id, SUM(m.hours) AS total_hours
|
||||
FROM {$mem_table} m
|
||||
INNER JOIN {$log_table} l ON l.id = m.log_id
|
||||
WHERE YEAR(l.work_date) = %d
|
||||
GROUP BY m.user_id", // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
$year
|
||||
)
|
||||
);
|
||||
|
||||
$result = array();
|
||||
foreach ( $rows as $row ) {
|
||||
$result[ absint( $row->user_id ) ] = (float) $row->total_hours;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build per-member work summary for a year.
|
||||
*
|
||||
* Returns array of objects with user_id, display_name, completed_hours,
|
||||
* required_hours, missing_hours, surcharge.
|
||||
*
|
||||
* @param int $year Year.
|
||||
* @param array $all_members Array of WP_User objects.
|
||||
* @return array
|
||||
*/
|
||||
public function get_member_summary( $year, $all_members ) {
|
||||
$config = $this->get_year_config( $year );
|
||||
$required_hours = $config ? (float) $config->required_hours : 0.0;
|
||||
$price = $config ? (float) $config->price_per_missing_hour : 0.0;
|
||||
$done_map = $this->get_hours_per_member( $year );
|
||||
|
||||
$summary = array();
|
||||
foreach ( $all_members as $member ) {
|
||||
$uid = (int) $member->ID;
|
||||
$completed = isset( $done_map[ $uid ] ) ? $done_map[ $uid ] : 0.0;
|
||||
$missing = max( 0.0, $required_hours - $completed );
|
||||
$surcharge = round( $missing * $price, 2 );
|
||||
|
||||
$obj = new \stdClass();
|
||||
$obj->user_id = $uid;
|
||||
$obj->display_name = $member->display_name;
|
||||
$obj->completed_hours = $completed;
|
||||
$obj->required_hours = $required_hours;
|
||||
$obj->missing_hours = $missing;
|
||||
$obj->surcharge = $surcharge;
|
||||
|
||||
$summary[] = $obj;
|
||||
}
|
||||
return $summary;
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,11 @@ class Schema {
|
||||
'meter_readings' => $wpdb->prefix . 'kgvvm_meter_readings',
|
||||
'cost_years' => $wpdb->prefix . 'kgvvm_cost_years',
|
||||
'cost_rates' => $wpdb->prefix . 'kgvvm_cost_rates',
|
||||
'cost_entries' => $wpdb->prefix . 'kgvvm_cost_entries',
|
||||
'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_log_members' => $wpdb->prefix . 'kgvvm_work_log_members',
|
||||
);
|
||||
|
||||
return isset( $map[ $key ] ) ? $map[ $key ] : '';
|
||||
@@ -205,6 +209,51 @@ class Schema {
|
||||
KEY distribution_type (distribution_type)
|
||||
) {$charset_collate};";
|
||||
|
||||
$sql[] = "CREATE TABLE " . self::table( 'work_jobs' ) . " (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
name VARCHAR(190) NOT NULL,
|
||||
description TEXT NULL,
|
||||
created_at DATETIME NOT NULL,
|
||||
updated_at DATETIME NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY name (name)
|
||||
) {$charset_collate};";
|
||||
|
||||
$sql[] = "CREATE TABLE " . self::table( 'work_year_config' ) . " (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
entry_year SMALLINT UNSIGNED NOT NULL,
|
||||
required_hours DECIMAL(8,2) NOT NULL DEFAULT 0.00,
|
||||
price_per_missing_hour DECIMAL(12,2) NOT NULL DEFAULT 0.00,
|
||||
created_at DATETIME NOT NULL,
|
||||
updated_at DATETIME NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY entry_year (entry_year)
|
||||
) {$charset_collate};";
|
||||
|
||||
$sql[] = "CREATE TABLE " . self::table( 'work_logs' ) . " (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
job_id BIGINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
work_date DATE NOT NULL,
|
||||
note TEXT NULL,
|
||||
created_at DATETIME NOT NULL,
|
||||
updated_at DATETIME NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
KEY job_id (job_id),
|
||||
KEY work_date (work_date)
|
||||
) {$charset_collate};";
|
||||
|
||||
$sql[] = "CREATE TABLE " . self::table( 'work_log_members' ) . " (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
log_id BIGINT UNSIGNED NOT NULL,
|
||||
user_id BIGINT UNSIGNED NOT NULL,
|
||||
hours DECIMAL(8,2) NOT NULL DEFAULT 0.00,
|
||||
created_at DATETIME NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY log_user (log_id, user_id),
|
||||
KEY user_id (user_id),
|
||||
KEY log_id (log_id)
|
||||
) {$charset_collate};";
|
||||
|
||||
foreach ( $sql as $statement ) {
|
||||
dbDelta( $statement );
|
||||
}
|
||||
@@ -230,6 +279,10 @@ class Schema {
|
||||
self::table( 'cost_years' ),
|
||||
self::table( 'cost_rates' ),
|
||||
self::table( 'cost_entries' ),
|
||||
self::table( 'work_jobs' ),
|
||||
self::table( 'work_year_config' ),
|
||||
self::table( 'work_logs' ),
|
||||
self::table( 'work_log_members' ),
|
||||
);
|
||||
|
||||
foreach ( $tables as $table ) {
|
||||
@@ -248,6 +301,10 @@ class Schema {
|
||||
global $wpdb;
|
||||
|
||||
$tables = array(
|
||||
self::table( 'work_log_members' ),
|
||||
self::table( 'work_logs' ),
|
||||
self::table( 'work_year_config' ),
|
||||
self::table( 'work_jobs' ),
|
||||
self::table( 'cost_entries' ),
|
||||
self::table( 'cost_rates' ),
|
||||
self::table( 'cost_years' ),
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* @wordpress-plugin
|
||||
* 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.15.5
|
||||
* Version: 1.16.3
|
||||
* Author: Ronny Grobel
|
||||
* Author URI: https://apex-project.de/
|
||||
* License: GPL v2 or later
|
||||
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
* Update URI: https://git.apex-project.de/Wordpress_Plugins/KGV-Verein-Manager.git
|
||||
* Gitea Plugin URI: https://git.apex-project.de/Wordpress_Plugins/KGV-Verein-Manager.git
|
||||
* Text Domain: kgv-verein-manager
|
||||
@@ -14,13 +17,21 @@
|
||||
* Requires PHP: 7.2
|
||||
* Requires Plugins: KGV-Updater
|
||||
* @package KGV\VereinManager
|
||||
* License: GPLv2+
|
||||
*
|
||||
* Php Version 5.6
|
||||
*
|
||||
* @package WordPress
|
||||
* @author Ronny Grobel <dgsoft.de@gmail.com>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
* @version 2026-04-16
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
define( 'KGVVM_VERSION', '1.15.1' );
|
||||
define( 'KGVVM_VERSION', '1.16.3' );
|
||||
define( 'KGVVM_PLUGIN_FILE', __FILE__ );
|
||||
define( 'KGVVM_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||
define( 'KGVVM_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
||||
|
||||
23
readme.txt
23
readme.txt
@@ -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.15.5
|
||||
Stable tag: 1.16.3
|
||||
Requires PHP: 7.2
|
||||
License: GPLv2 or later
|
||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
@@ -41,6 +41,27 @@ Ja, insbesondere fuer Kleingartenvereine und deren Verwaltungsprozesse.
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 1.16.3 =
|
||||
* Datensicherung erweitert: Export und Import umfassen jetzt zusätzlich die zugehörigen WordPress-Mitgliederkonten inklusive Metadaten.
|
||||
|
||||
= 1.16.2 =
|
||||
* Neue Datensicherungsfunktion unter Einstellungen: Export und Import aller kgvvm-Tabellen als JSON.
|
||||
* Import mit Sicherheitsprüfung und vollständigem Überschreiben der vorhandenen Plugin-Daten.
|
||||
|
||||
= 1.16.1 =
|
||||
* Wartungsrelease mit synchronisierter Versionsnummer in Plugin-Header, Konstante und Readme-Dateien.
|
||||
* Release-Tag 1.16.1 gesetzt.
|
||||
|
||||
= 1.16.0 =
|
||||
* Neues Modul Arbeitsstunden im Adminbereich mit drei Bereichen: geleistete Arbeiten, Mitgliederuebersicht und Arbeitsarten.
|
||||
* Pflichtstunden je Mitglied pro Jahr konfigurierbar, inklusive variablem Preis je fehlender Stunde fuer den Aufschlag in der Jahresrechnung.
|
||||
* Arbeitseintraege mit Datum, Arbeitsart und Notiz sowie Mehrfachzuordnung von Mitgliedern mit individuellen Stundenwerten.
|
||||
* Neue Datenbanktabellen fuer Arbeitsarten, Jahreseinstellungen, Arbeitseintraege und Stundenzuordnungen je Mitglied.
|
||||
|
||||
= 1.15.6 =
|
||||
* Versionsabgleich zwischen Plugin-Header, Konstante und Readme.
|
||||
* WordPress-Readme-Format weiter vereinheitlicht.
|
||||
|
||||
= 1.15.5 =
|
||||
* Aktuelle Version laut Plugin-Header.
|
||||
* Kontinuierliche Verbesserungen in Verwaltung und Datenpflege.
|
||||
|
||||
Reference in New Issue
Block a user