| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/seaside.pacim.de/web/ |
Upload File : |
<?php
/**
* booking-capture.php – Admin-Endpunkt zum manuellen Erfassen einer Buchung
* aus der Tagesansicht (/tasks/day/). Zwei Modi:
* eigene Buchung -> customer_source = Parken-am-Schiff.de (volle Kundendaten)
* AIDA-Nachtrag -> customer_source = AIDA (Name, Buchungs-Nr., Kabine, KFZ)
* Reisezeitraum + Schiff kommen aus dem gewählten Event des Tages.
*/
require_once( __DIR__ . '/includes/config.inc.php' );
@ini_set( 'display_errors', '0' );
error_reporting( 0 );
ob_start();
function bc_json( $a ) { while ( ob_get_level() > 0 ) ob_end_clean(); header( 'Content-Type: application/json; charset=utf-8' ); echo json_encode( $a ); exit(); }
function bc_fail( $m ) { bc_json( array( 'ok' => false, 'error' => $m ) ); }
if ( ! function_exists( 'is_admin' ) || ! is_admin() ) { http_response_code( 403 ); bc_json( array( 'ok' => false, 'error' => 'forbidden' ) ); }
$action = isset( $_GET['action'] ) ? $_GET['action'] : ( isset( $_POST['action'] ) ? $_POST['action'] : '' );
if ( class_exists( 'perflog' ) && $action !== '' ) perflog::wholeRequest( 'booking', 'capture_' . preg_replace( '/[^a-z-]/i', '', $action ), 'booking_capture' );
/* Events (Schiffe) eines Tages – zur Auswahl im Erfassungsdialog. */
if ( $action === 'events' ) {
$date = (string) ( $_GET['date'] ?? '' );
bc_json( array( 'ok' => true, 'events' => bookingservice::eventsOnDay( $date ) ) );
}
/* Preisvorschau nach Staffelung (Brutto) – für die automatische Berechnung im Dialog. */
if ( $action === 'quote' ) {
$begin = (string) ( $_GET['begin'] ?? ( $_POST['begin'] ?? '' ) );
$end = (string) ( $_GET['end'] ?? ( $_POST['end'] ?? '' ) );
$type = (int) ( $_GET['type'] ?? ( $_POST['type'] ?? 1 ) );
if ( ! preg_match( '/^\d{4}-\d{2}-\d{2}$/', substr( $begin, 0, 10 ) ) || ! preg_match( '/^\d{4}-\d{2}-\d{2}$/', substr( $end, 0, 10 ) ) ) bc_fail( 'Bitte Reisezeitraum wählen.' );
$q = bookingservice::quote( array( 'type' => $type, 'begin' => $begin, 'end' => $end, 'products' => array(), 'brokerId' => 0 ) );
bc_json( array( 'ok' => true, 'gross' => $q['gross'], 'net' => $q['net'], 'duration' => $q['duration'] ) );
}
$notify = ! empty( $_POST['notify'] );
/* Eigene Buchung (Parken-am-Schiff.de). */
if ( $action === 'create-own' ) {
$products = array();
if ( isset( $_POST['products'] ) && is_array( $_POST['products'] ) ) foreach ( $_POST['products'] as $p ) { $p = (int) $p; if ( $p > 0 ) $products[] = $p; }
$res = bookingservice::create( array(
'source' => 'Parken-am-Schiff.de',
'notify' => $notify,
'begin' => (string) ( $_POST['begin'] ?? '' ),
'end' => (string) ( $_POST['end'] ?? '' ),
'event' => (string) ( $_POST['event'] ?? '' ),
'event_id' => (int) ( $_POST['event_id'] ?? 0 ),
'type' => (int) ( $_POST['type'] ?? 1 ),
'plate' => (string) ( $_POST['plate'] ?? '' ),
'guests' => (int) ( $_POST['guests'] ?? 0 ),
'products' => $products,
'price' => isset( $_POST['price'] ) && $_POST['price'] !== '' ? (float) str_replace( ',', '.', (string) $_POST['price'] ) : null,
'customer' => array(
'gender' => (int) ( $_POST['gender'] ?? 1 ),
'company' => (string) ( $_POST['company'] ?? '' ),
'firstname' => (string) ( $_POST['firstname'] ?? '' ),
'lastname' => (string) ( $_POST['lastname'] ?? '' ),
'street' => (string) ( $_POST['street'] ?? '' ),
'zipcode' => (string) ( $_POST['zipcode'] ?? '' ),
'city' => (string) ( $_POST['city'] ?? '' ),
'country' => (string) ( $_POST['country'] ?? 'Deutschland' ),
'phone' => (string) ( $_POST['phone'] ?? '' ),
'email' => (string) ( $_POST['email'] ?? '' ),
),
) );
bc_json( $res );
}
/* AIDA-Nachtrag. */
if ( $action === 'create-aida' ) {
$res = bookingservice::captureAida( array(
'notify' => $notify,
'begin' => (string) ( $_POST['begin'] ?? '' ),
'end' => (string) ( $_POST['end'] ?? '' ),
'event' => (string) ( $_POST['event'] ?? '' ),
'event_id' => (int) ( $_POST['event_id'] ?? 0 ),
'type' => (int) ( $_POST['type'] ?? 2 ),
'firstname' => (string) ( $_POST['firstname'] ?? '' ),
'lastname' => (string) ( $_POST['lastname'] ?? '' ),
'booking_no' => (string) ( $_POST['booking_no'] ?? '' ),
'cabin' => (string) ( $_POST['cabin'] ?? '' ),
'price' => isset( $_POST['price'] ) && $_POST['price'] !== '' ? (float) str_replace( ',', '.', (string) $_POST['price'] ) : null,
'plate' => (string) ( $_POST['plate'] ?? '' ),
'phone' => (string) ( $_POST['phone'] ?? '' ),
'email' => (string) ( $_POST['email'] ?? '' ),
'guests' => (int) ( $_POST['guests'] ?? 0 ),
'note' => (string) ( $_POST['note'] ?? '' ),
) );
bc_json( $res );
}
bc_fail( 'unknown_action' );