fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [7501] bkbooking: fixed bug that booking created from


From: Kjell Arne Espedal
Subject: [Fmsystem-commits] [7501] bkbooking: fixed bug that booking created from application was not marked with application id
Date: Tue, 16 Aug 2011 09:40:10 +0000

Revision: 7501
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7501
Author:   kjell
Date:     2011-08-16 09:40:10 +0000 (Tue, 16 Aug 2011)
Log Message:
-----------
bkbooking: fixed bug that booking created from application was not marked with 
application id

Modified Paths:
--------------
    trunk/booking/inc/class.uibooking.inc.php
    trunk/booking/templates/base/booking_new_preview.xsl

Modified: trunk/booking/inc/class.uibooking.inc.php
===================================================================
--- trunk/booking/inc/class.uibooking.inc.php   2011-08-12 10:50:18 UTC (rev 
7500)
+++ trunk/booking/inc/class.uibooking.inc.php   2011-08-16 09:40:10 UTC (rev 
7501)
@@ -184,6 +184,7 @@
                        $booking = array();
                        $booking['cost'] = 0;
                        $allocation_id = phpgw::get_var('allocation_id', 'int', 
'GET');
+                       $application_id = phpgw::get_var('application_id', 
'int', 'POST');
                        $booking['building_id'] = phpgw::get_var('building_id', 
'int', 'GET');
                        $booking['resources'] = phpgw::get_var('resources', 
'int', 'GET');
             #The string replace is a workaround for a problem at Bergen 
Kommune 
@@ -196,8 +197,7 @@
                        if (! isset($allocation_id)) $noallocation = 1;
                        $invalid_dates = array();
                        $valid_dates = array();
-
-
+                       
                        if(isset($allocation_id))
                        {
                                $allocation = 
$this->allocation_bo->read_single($allocation_id);
@@ -216,11 +216,12 @@
                 $noallocation = 1;
             }
 
+
                        if($_SERVER['REQUEST_METHOD'] == 'POST')
                        {
                                $today = getdate();
                                $booking = extract_values($_POST, 
$this->fields);
-                
+
                                if(strlen($_POST['from_']) < 6) 
                                {
                                        $date_from = array($time_from[0], 
$_POST['from_']);
@@ -273,6 +274,7 @@
                         $allocation['season_id'] = $booking['season_id'];
                         $allocation['organization_id'] = 
$booking['organization_id'];
                         $allocation['organization_name'] = 
$booking['organization_name'];
+                           $allocation['application_id'] = $application_id;
                         $allocation['from_'] = $booking['from_'];
                         $allocation['to_'] = $booking['to_'];
                                        $allocation['active'] = '1';
@@ -332,17 +334,20 @@
                                     $allocation['season_id'] = 
$booking['season_id'];
                                     $allocation['organization_id'] = 
$booking['organization_id'];
                                     $allocation['organization_name'] = 
$booking['organization_name'];
+                                               $allocation['application_id'] = 
$application_id;
                                     $allocation['from_'] = $booking['from_'];
                                     $allocation['to_'] = $booking['to_'];
                                                        $allocation['active'] = 
'1';
                                                $allocation['completed'] = '0';
                                     $receipt = 
$this->allocation_bo->add($allocation);
                                     $booking['allocation_id'] = $receipt['id'];
+                                                                       
$booking['application_id'] = $application_id;
                                                                
$booking['secret'] = $this->generate_secret();
                                                                $receipt = 
$this->bo->add($booking);
                                     $booking['allocation_id'] = '';
                                     
$this->allocation_bo->so->update_id_string();
                                 } else {
+                                                                       
$booking['application_id'] = $application_id;
                                                                
$booking['secret'] = $this->generate_secret();
                                                                $receipt = 
$this->bo->add($booking);
                                 }
@@ -352,11 +357,14 @@
                                        }
                                        if ($step == 3) 
                                        {
-                                               
$this->redirect(array('menuaction' => 'booking.uimassbooking.schedule', 
'id'=>$booking['building_id']));
+                                               if (isset($application_id)) {
+                                                       
$this->redirect(array('menuaction' => 'booking.uiapplication.show', 
'id'=>$application_id));
+                                               } else {
+                                                       
$this->redirect(array('menuaction' => 'booking.uimassbooking.schedule', 
'id'=>$booking['building_id']));
+                                               }
                                        }
                                }
                        }
-
                        $this->flash_form_errors($errors);
                        self::add_javascript('booking', 'booking', 
'booking.js');
                        array_set_default($booking, 'resources', array());
@@ -387,7 +395,9 @@
                                        'outseason' => $_POST['outseason'],
                                        'date_from' => $time_from[0],
                                        'date_to' => $time_to[0],
+                                       'application_id' => $application_id,
                     'noallocation' => $noallocation)
+                                       
                                );
                        } 
                        else if ($step == 2) 
@@ -406,6 +416,7 @@
                                        'valid_dates' => $valid_dates,
                                        'invalid_dates' => $invalid_dates,
                                        'groups' => $groups,
+                                       'application_id' => $application_id,
                     'noallocation' => $noallocation)
                                );
                        }

Modified: trunk/booking/templates/base/booking_new_preview.xsl
===================================================================
--- trunk/booking/templates/base/booking_new_preview.xsl        2011-08-12 
10:50:18 UTC (rev 7500)
+++ trunk/booking/templates/base/booking_new_preview.xsl        2011-08-16 
09:40:10 UTC (rev 7501)
@@ -16,6 +16,7 @@
                        <input type="hidden" name="organization_id" 
value="{booking/organization_id}"/>
                        <input type="hidden" name="organization_name" 
value="{booking/organization_name}"/>
                        <input type="hidden" name="allocation_id" 
value="{booking/allocation_id}"/>
+                       <input type="hidden" name="application_id" 
value="{booking/application_id}"/>
                        <input type="hidden" name="noallocation" 
value="{noallocation}" />
                        <input type="hidden" name="step" value="{step}" />
                        <input type="hidden" name="from_" value="{from_date}" />




reply via email to

[Prev in Thread] Current Thread [Next in Thread]