fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [17131] booking: dateformat and reference to applicat


From: sigurdne
Subject: [Fmsystem-commits] [17131] booking: dateformat and reference to application for booking
Date: Tue, 3 Oct 2017 08:02:27 -0400 (EDT)

Revision: 17131
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17131
Author:   sigurdne
Date:     2017-10-03 08:02:27 -0400 (Tue, 03 Oct 2017)
Log Message:
-----------
booking: dateformat and reference to application for booking

Modified Paths:
--------------
    trunk/booking/inc/class.uiallocation.inc.php
    trunk/booking/inc/class.uibooking.inc.php
    trunk/bookingfrontend/inc/class.uibooking.inc.php

Modified: trunk/booking/inc/class.uiallocation.inc.php
===================================================================
--- trunk/booking/inc/class.uiallocation.inc.php        2017-10-02 14:00:14 UTC 
(rev 17130)
+++ trunk/booking/inc/class.uiallocation.inc.php        2017-10-03 12:02:27 UTC 
(rev 17131)
@@ -468,13 +468,18 @@
                        {
                                if($dateformat == 'Y-m-d' && 
$_SERVER['REQUEST_METHOD'] == 'GET')
                                {
-                                       $allocation['from_'] = 
date("{$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']} 
H:i",strtotime($dateTimeFrom));
+                                       $_dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                                       $allocation['from_'] = 
date("{$_dateformat} H:i",strtotime($dateTimeFrom));
                                        $_timeFrom = strtotime($dateTimeFrom);
+                                       $allocation['to_'] = 
date("{$_dateformat} H:i",strtotime($dateTimeTo));
+                                       $_timeTo = strtotime($dateTimeTo);
                                }
                                else
                                {
                                        $allocation['from_'] = $dateTimeFrom;
                                        $_timeFrom = 
phpgwapi_datetime::date_to_timestamp($dateTimeFrom);
+                                       $allocation['to_'] = $dateTimeTo;
+                                       $_timeTo = 
phpgwapi_datetime::date_to_timestamp($dateTimeTo);
                                }
                                if ($_SERVER['REQUEST_METHOD'] == 'POST' && 
$errors)
                                {
@@ -485,7 +490,7 @@
                                }
 
                                
$GLOBALS['phpgw']->jqcal2->add_listener('field_from', 'datetime', $_timeFrom);
-                               
$GLOBALS['phpgw']->jqcal2->add_listener('field_to', 'time', $_timeTo);
+                               
$GLOBALS['phpgw']->jqcal2->add_listener('field_to', 'datetime', $_timeTo);
 
                                self::render_template_xsl('allocation_new', 
array('allocation' => $allocation,
                                        'step' => $step,

Modified: trunk/booking/inc/class.uibooking.inc.php
===================================================================
--- trunk/booking/inc/class.uibooking.inc.php   2017-10-02 14:00:14 UTC (rev 
17130)
+++ trunk/booking/inc/class.uibooking.inc.php   2017-10-03 12:02:27 UTC (rev 
17131)
@@ -621,8 +621,8 @@
                        $active_tab = 'generic';
 
                        
$GLOBALS['phpgw']->jqcal2->add_listener('field_repeat_until', 'date');
-                       $GLOBALS['phpgw']->jqcal2->add_listener('start_date', 
'datetime');
-                       $GLOBALS['phpgw']->jqcal2->add_listener('end_date', 
'datetime');
+                       $GLOBALS['phpgw']->jqcal2->add_listener('start_date', 
'datetime', phpgwapi_datetime::date_to_timestamp($booking['from_']));
+                       $GLOBALS['phpgw']->jqcal2->add_listener('end_date', 
'datetime', phpgwapi_datetime::date_to_timestamp($booking['to_']));
 
                        $booking['tabs'] = 
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
                        $booking['validator'] = 
phpgwapi_jquery::formvalidator_generate(array('location',

Modified: trunk/bookingfrontend/inc/class.uibooking.inc.php
===================================================================
--- trunk/bookingfrontend/inc/class.uibooking.inc.php   2017-10-02 14:00:14 UTC 
(rev 17130)
+++ trunk/bookingfrontend/inc/class.uibooking.inc.php   2017-10-03 12:02:27 UTC 
(rev 17131)
@@ -131,6 +131,7 @@
                                $booking['building_id'] = $building['id'];
                                $booking['building_name'] = $building['name'];
                                $booking['allocation_id'] = $allocation_id;
+                               $booking['application_id'] = 
$allocation['application_id'];
                                array_set_default($booking, 'resources', 
array(phpgw::get_var('resource')));
                        }
                        else
@@ -143,6 +144,8 @@
                                $today = getdate();
                                $booking = extract_values($_POST, 
$this->fields);
 
+                               $booking['application_id'] = 
$allocation['application_id'];
+
                                $timestamp = 
phpgwapi_datetime::date_to_timestamp($booking['from_']);
                                $booking['from_'] = date("Y-m-d H:i:s", 
$timestamp);
                                $timestamp = 
phpgwapi_datetime::date_to_timestamp($booking['to_']);
@@ -805,14 +808,17 @@
                {
                        $config = CreateObject('phpgwapi.config', 'booking');
                        $config->read();
+                       $id = phpgw::get_var('id', 'int');
 
                        if ($config->config_data['user_can_delete_bookings'] != 
'yes')
                        {
-
-                               $booking = 
$this->bo->read_single(phpgw::get_var('id', 'int'));
+                               $booking = $this->bo->read_single($id);
                                $errors = array();
                                if ($_SERVER['REQUEST_METHOD'] == 'POST')
                                {
+                                       $_POST['from_'] = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($_POST['from_']));
+                                       $_POST['to_'] = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($_POST['to_']));
+                                       $_POST['repeat_until'] = 
isset($_POST['repeat_until']) && $_POST['repeat_until'] ? date("Y-m-d", 
phpgwapi_datetime::date_to_timestamp($_POST['repeat_until'])) : false;
 
                                        $from = $_POST['from_'];
                                        $to = $_POST['to_'];
@@ -872,8 +878,6 @@
                        }
                        else
                        {
-
-                               $id = phpgw::get_var('id', 'int');
                                $outseason = phpgw::get_var('outseason', 
'string');
                                $recurring = phpgw::get_var('recurring', 
'string');
                                $repeat_until = phpgw::get_var('repeat_until', 
'string');
@@ -918,7 +922,7 @@
                                {
                                        $_POST['from_'] = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($_POST['from_']));
                                        $_POST['to_'] = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($_POST['to_']));
-                                       $_POST['repeat_until'] = date("Y-m-d 
H:i:s", phpgwapi_datetime::date_to_timestamp($_POST['repeat_until']));
+                                       $_POST['repeat_until'] = 
isset($_POST['repeat_until']) && $_POST['repeat_until'] ? date("Y-m-d", 
phpgwapi_datetime::date_to_timestamp($_POST['repeat_until'])) : false;
 
                                        $from_date = $_POST['from_'];
                                        $to_date = $_POST['to_'];




reply via email to

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