fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15569] booking: transaction and date handling


From: sigurdne
Subject: [Fmsystem-commits] [15569] booking: transaction and date handling
Date: Fri, 2 Sep 2016 13:39:59 +0000 (UTC)

Revision: 15569
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15569
Author:   sigurdne
Date:     2016-09-02 13:39:58 +0000 (Fri, 02 Sep 2016)
Log Message:
-----------
booking: transaction and date handling

Modified Paths:
--------------
    trunk/booking/inc/class.boseason.inc.php
    trunk/booking/inc/class.socommon.inc.php
    trunk/booking/inc/class.uiallocation.inc.php

Modified: trunk/booking/inc/class.boseason.inc.php
===================================================================
--- trunk/booking/inc/class.boseason.inc.php    2016-09-02 13:39:23 UTC (rev 
15568)
+++ trunk/booking/inc/class.boseason.inc.php    2016-09-02 13:39:58 UTC (rev 
15569)
@@ -149,12 +149,12 @@
                                {
                                        if ($write)
                                        {
-                                               
$this->so->db->transaction_begin();
+                                               $this->so->transaction_begin();
                                                foreach ($valid as $alloc)
                                                {
                                                        
$this->bo_allocation->add($alloc);
                                                }
-                                               
$this->so->db->transaction_commit();
+                                               $this->so->transaction_commit();
                                        }
                                        return array('valid' => $valid, 
'invalid' => $invalid);
                                }

Modified: trunk/booking/inc/class.socommon.inc.php
===================================================================
--- trunk/booking/inc/class.socommon.inc.php    2016-09-02 13:39:23 UTC (rev 
15568)
+++ trunk/booking/inc/class.socommon.inc.php    2016-09-02 13:39:58 UTC (rev 
15569)
@@ -48,6 +48,36 @@
                        $this->like = & $this->db->like;
                }
 
+               /**
+                * Begin transaction
+                *
+                * @return integer|bool current transaction id
+                */
+               public function transaction_begin()
+               {
+                       return $this->db->transaction_begin();
+               }
+
+               /**
+                * Complete the transaction
+                *
+                * @return bool True if sucessful, False if fails
+                */
+               public function transaction_commit()
+               {
+                       return $this->db->transaction_commit();
+               }
+
+               /**
+                * Rollback the current transaction
+                *
+                * @return bool True if sucessful, False if fails
+                */
+               public function transaction_abort()
+               {
+                       return $this->db->transaction_abort();
+               }
+
                public function get_db()
                {
                        return $this->db;

Modified: trunk/booking/inc/class.uiallocation.inc.php
===================================================================
--- trunk/booking/inc/class.uiallocation.inc.php        2016-09-02 13:39:23 UTC 
(rev 15568)
+++ trunk/booking/inc/class.uiallocation.inc.php        2016-09-02 13:39:58 UTC 
(rev 15569)
@@ -287,7 +287,7 @@
 
                        if ($_SERVER['REQUEST_METHOD'] == 'POST')
                        {
-                               $season = 
$this->season_bo->read_single($_POST['season_id']);
+                               $season = 
$this->season_bo->read_single(phpgw::get_var('season_id', 'int'));
                                array_set_default($_POST, 'resources', array());
                                $allocation = extract_values($_POST, 
$this->fields);
                                if ($_POST['cost'])
@@ -301,6 +301,17 @@
                                $to_date = $_POST['to_'];
                                $from_date_arr = explode(' ', $_POST['from_']);
                                $to_date_arr = explode(' ', $_POST['to_']);
+                               if(count($from_date_arr) == 2)
+                               {
+                                       $from_time = $from_date_arr[1];
+                                       $to_time = $to_date_arr[1];
+                               }
+                               else
+                               {
+                                       $from_time = $_POST['from_'];
+                                       $to_time = $_POST['to_'];
+                               }
+
                                if(!isset($_POST['weekday']))
                                {
                                        $_POST['weekday'] = strtolower 
(date('l', phpgwapi_datetime::date_to_timestamp($_POST['from_'])));
@@ -310,8 +321,8 @@
 
 //                             $allocation['from_'] = strftime("%Y-%m-%d 
%H:%M", strtotime($_POST['weekday'] . " " . $_POST['from_']));
 //                             $allocation['to_'] = strftime("%Y-%m-%d %H:%M", 
strtotime($_POST['weekday'] . " " . $_POST['to_']));
-                               $allocation['from_'] = strftime("%Y-%m-%d 
%H:%M", strtotime($_POST['weekday'] . " " . $from_date_arr[1]));
-                               $allocation['to_'] = strftime("%Y-%m-%d %H:%M", 
strtotime($_POST['weekday'] . " " . $to_date_arr[1]));
+                               $allocation['from_'] = strftime("%Y-%m-%d 
%H:%M", strtotime($_POST['weekday'] . " " . $from_time));
+                               $allocation['to_'] = strftime("%Y-%m-%d %H:%M", 
strtotime($_POST['weekday'] . " " . $to_time));
 
                                if (($_POST['weekday'] != 'sunday' && date('w') 
> date('w', strtotime($_POST['weekday']))) || (date('w') == '0' && date('w') < 
date('w', strtotime($_POST['weekday']))))
                                {
@@ -398,14 +409,14 @@
                        }
                        else
                        {
-                               $dateTimeFrom = phpgw::get_var('from_', 
'string');
-                               $dateTimeTo = phpgw::get_var('to_', 'string');
+                               $dateTimeFrom = phpgw::get_var('from_', 
'string', 'POST');
+                               $dateTimeTo = phpgw::get_var('to_', 'string', 
'POST');
                                $dateTimeFromE = explode(" ", $dateTimeFrom[0]);
                                $dateTimeToE = explode(" ", $dateTimeTo[0]);
                                if (phpgw::get_var('from_', 'string') < 14)
                                {
-                                       $timeFrom[] = phpgw::get_var('from_', 
'string');
-                                       $timeTo[] = phpgw::get_var('to_', 
'string');
+                                       $timeFrom[] = phpgw::get_var('from_', 
'string', 'POST');
+                                       $timeTo[] = phpgw::get_var('to_', 
'string', 'POST');
                                }
                                else
                                {




reply via email to

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