Browse code

Fix reservation submit callback to use POST variables

Benjamin Roth authored on03/09/2025 11:43:43
Showing2 changed files
... ...
@@ -151,7 +151,7 @@ $GLOBALS['TL_DCA']['tl_vr_wa_reservation'] = array
151 151
         (
152 152
             'exclude'                 => true,
153 153
             'inputType'               => 'text',
154
-            'eval'       => array('rgxp'=>'natural','tl_class'=>'w50', 'readonly' => true, 'disabled'=>true),
154
+            'eval'       => array('rgxp'=>'natural','tl_class'=>'w50', 'readonly' => true),
155 155
             'sql'        => "int(4) unsigned NOT NULL default 0",
156 156
         ),
157 157
         'unit_id' => array
... ...
@@ -369,8 +369,8 @@ class WeinanlieferungReservationContainerListener
369 369
     {
370 370
         if (($reservation = WeinanlieferungReservationModel::findByPk($dc->id)) !== null)
371 371
         {
372
-            // Handle checck-in
373
-            if ($reservation->checked_in)
372
+            // Handle check-in
373
+            if (Input::post('checked_in') == '1')
374 374
             {
375 375
                 $time = time();
376 376
                 $reservation->checked_in = '1';
... ...
@@ -382,11 +382,11 @@ class WeinanlieferungReservationContainerListener
382 382
             }
383 383
 
384 384
             // Handle units
385
-            if ($reservation->unit_amount)
385
+            if (Input::post('unit_amount') !== null)
386 386
             {
387 387
                 // recompute the base units
388
-                $unitId = (int)$reservation->unit_id;
389
-                $unitAmount = (int)$reservation->unit_amount;
388
+                $unitId = (int) Input::post('unit_id');
389
+                $unitAmount = (int) Input::post('unit_amount');
390 390
                 $multiplier = 1;
391 391
                 if ($unitId > 0)
392 392
                 {
... ...
@@ -397,6 +397,7 @@ class WeinanlieferungReservationContainerListener
397 397
                 }
398 398
 
399 399
                 $intBehaelter = $unitAmount * $multiplier;
400
+
400 401
                 $reservation->behaelter = $intBehaelter;
401 402
                 $reservation->save();
402 403
             }